brief

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 40 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 brief previews each pull request with one headless call of the agent: goal, context, kind, size, risk and open questions.

Index

Constants

View Source
const (
	// BreakerAfter consecutive global failures, across pull requests, open
	// the breaker.
	BreakerAfter = 3
	// BreakerCool is how long the breaker stays open before a trial.
	BreakerCool = 15 * time.Minute
)
View Source
const (
	KindBreakerOpened      = "brief_breaker_opened"
	KindBreakerClosed      = "brief_breaker_closed"
	KindBreakerTrialFailed = "brief_breaker_trial_failed"
)

Events of the breaker, on no pull request, keyed by the time: Data is the error that opened it, the trial run that closed it, or the error of a trial that kept it open.

View Source
const (
	PromptFile       = "prompts/brief.md"
	FieldsPromptFile = "prompts/brief-fields.md"
	TaxonomyFile     = "prompts/brief-taxonomy.md"
)

PromptFile and TaxonomyFile are the bundled profile's brief prompt and taxonomy, relative to the profile's root.

View Source
const (
	// Batch, Concurrency and CallTimeout bound what one run spends.
	Batch       = 5
	Concurrency = 2
	CallTimeout = 3 * time.Minute
	// RefreshFiles is how many files a new head must add before the brief
	// is made again.
	RefreshFiles = 5
	// BodyQuiet is how long an edited description must sit unchanged before
	// the background job briefs it again.
	BodyQuiet = 10 * time.Minute
)
View Source
const (
	OutcomeOK         = "ok"
	OutcomeFailed     = "failed"
	OutcomeUnfit      = "unfit"
	OutcomeOverBudget = "over-budget"
	OutcomeTooLong    = "too-long"
	OutcomeTimeout    = "timeout"
	// OutcomeReused is a run whose input hash matched the brief in use: no
	// diff read and no agent call.
	OutcomeReused = "reused"
	// OutcomeUnavailable is the agent unavailable, or GitHub refusing the
	// token or the budget.
	OutcomeUnavailable = "unavailable"
)

Outcomes of a brief run besides the store's running and interrupted.

View Source
const (
	// TriggerBackground is a run the brief job started on its own.
	TriggerBackground = "background"
	// TriggerWanted is a run a first turn waits on.
	TriggerWanted = "wanted"
	// TriggerRefresh is a run a later turn started for a stale brief.
	TriggerRefresh = "refresh"
	// TriggerTrial is the breaker's run that tells whether briefs work again.
	TriggerTrial = "trial"
	// TriggerFields is a run that fills a brief's missing extra fields,
	// reusing its core.
	TriggerFields = "fields"
)

Triggers of a brief run.

View Source
const (
	// MaxFailures failures of a wanted brief that belong to its pull
	// request, on one attempt_of, give it up.
	MaxFailures   = 3
	WantedTimeout = 30 * time.Second
	// SessionWait is how long a turn asked for inside an agent session waits
	// for its brief, under the 2 minutes an agent's shell tool allows.
	SessionWait = 90 * time.Second
)
View Source
const (
	WaitBriefing = intake.WaitBriefing
	WaitRetry    = intake.WaitRetry
)

The waits of a Readiness.

View Source
const (
	ReasonOff  = "briefs are off"
	ReasonNone = "this pull request has no brief yet"
)
View Source
const DemandTimeout = 2 * time.Minute

DemandTimeout bounds a first turn's wait for an OnDemand source's brief: the Slack extraction runs every 30 seconds and its call takes as long.

View Source
const Resync = 10 * time.Minute

Resync is how long Start sleeps when no deadline waits: a change nothing announced is found within it.

View Source
const VocabularySize = 30

VocabularySize is how many values of each open tag key the prompt lists.

View Source
const WantedConcurrency = 2

WantedConcurrency bounds the runs started outside Run.

Variables

View Source
var DefaultTaxonomy = bundled(TaxonomyFile)

DefaultTaxonomy is the bundled profile's taxonomy.

View Source
var ErrExtra = errors.New("the brief's extra fields do not fit their schema")

ErrExtra is a model answer whose core brief fits and whose extra fields do not: the core brief is kept and the fields stay missing.

View Source
var ErrInvalid = errors.New("the brief does not fit the schema")
View Source
var Schema string
View Source
var WantedRetry = []time.Duration{time.Minute, 4 * time.Minute}

WantedRetry is the wait before the second and the third attempt of a wanted brief.

Functions

func AttemptKey added in v0.3.0

func AttemptKey(version string, at At) string

AttemptKey names an attempt at version on a unit at at, as attempt_of stores it, so a failure counts against that attempt only.

func Due

func Due(pr dinv.PR, rec dinv.BriefRecord, ok bool, version string, now time.Time, retry time.Duration) bool

Due says whether the pull request needs a brief now: none yet, a failed one that changed or whose wait is over, or a brief the pull request moved past. A new prompt version alone is not due: the brief in use stays until a turn asks for it.

func Facts added in v0.2.0

func Facts(b *Brief, c Composed) workflow.Facts

Facts are the brief.* facts of b under c, the brief intent's composed schema: empty values, and every extra field missing, when the unit has no brief. Extra fields b holds at an older version still read as their value and are listed in brief.missing.

func InputSHA

func InputSHA(head, settings string, in Input) string

InputSHA hashes what a brief is made from, the head included: the facts with every task-list box read as unticked, so ticking one changes nothing. settings are the other inputs of the call that the version does not cover.

func Prompt

func Prompt(taxonomy, vocabulary string, in Input) string

Prompt fills the template in one pass, so a "{{...}}" inside the pull request's own text stays as it is. The data markers carry a hash of the data, so the pull request cannot close its own block. The vocabulary is not part of Version, so a new tag value makes no brief stale.

func Version

func Version(taxonomy string) string

Version keys the cache: a new prompt, schema or taxonomy makes every brief stale.

Types

type AskRunner

type AskRunner struct{ Asker turns.Asker }

AskRunner makes a brief with one headless call of the agent.

func (AskRunner) Run

func (a AskRunner) Run(ctx context.Context, c Call) (Result, error)

Run returns, with a failure, what the call cost when the agent said.

type At added in v0.2.0

type At struct {
	Revision string
	Parts    json.RawMessage
	Attempt  string
}

At is what a unit is at: its revision in the provider's own format, as brief_runs.revision stores it, the parts of its input a staleness rule reads, as brief_runs.input stores them, and what an attempt at it is made from, in the provider's own format.

func AtOf added in v0.2.0

func AtOf(p dinv.PR) At

AtOf is what p is at, in the format brief_runs stores. Its attempt is the head, the description's edit time to the second and the changed files, as attempt_of has stored them since version 4.

type Brief

type Brief struct {
	Goal          string   `json:"goal"`
	Context       string   `json:"context"`
	Kind          string   `json:"kind"`
	Size          string   `json:"size"`
	Risk          string   `json:"risk"`
	RiskWhy       string   `json:"risk_why"`
	OpenQuestions []string `json:"open_questions"`
	// Tags are the normalized key:value tags.
	Tags []string `json:"tags"`
	// Extra are the brief intent's extra fields, by name, and the version
	// of each field the brief holds.
	Extra         map[string]any    `json:"extra,omitempty"`
	ExtraVersions map[string]string `json:"extra_versions,omitempty"`
}

func Parse added in v0.2.0

func Parse(stored string) (*Brief, error)

Parse reads a stored brief, of any provider; empty reads none.

type BriefSource added in v0.2.0

type BriefSource interface {
	// Input reads what a brief of u reads now.
	Input(ctx context.Context, u unit.Unit) (UnitInput, error)
	// Revision is what u is at now, read without the input.
	Revision(ctx context.Context, u unit.Unit) (At, error)
	// Describe is in, one line, as the prompt's header names it.
	Describe(in UnitInput) string
	// Stale says whether the brief w holds of a unit now at cur is due
	// again at now, version being the brief's current version.
	Stale(w Written, cur At, version string, now time.Time) bool
}

BriefSource is what the brief queue asks a provider about its units, the calls of a source plugin's Briefer. A provider without one answers "without" to the intakes of its units.

type Call

type Call struct {
	Tier turns.Tier
	// Home is the agent's configuration directory, "" for its default.
	Home   string
	Prompt string
	// Schema is what the answer is asked for and validated against; the
	// zero Composed is the core schema.
	Schema Composed
	// Fields, when set, asks only these extra fields of a brief that has
	// its core: the missing-fields call.
	Fields []string
}

type Composed added in v0.2.0

type Composed struct {
	// Core is the core schema's JSON.
	Core string
	// Extra is the brief intent's flat extra schema; nil when it declares
	// none, and then JSON is Core byte for byte.
	Extra *jsonschema.Schema
	// contains filtered or unexported fields
}

Composed is the schema a brief call sends and Go validates the answer against: the core schema Go owns (goal, context, kind, size, risk, risk_why, open_questions, tags and the provider's facets) plus {"extra": <the brief intent's schema.json>}. The zero Composed is the core schema alone.

func Compose added in v0.2.0

func Compose(core string, extra []byte) (Composed, error)

Compose is the composed schema of the core schema and extra, the brief intent's schema.json; a nil extra adds nothing. extra must be a flat object schema: a nested object or a keyword outside the subset fails, naming the field.

func ComposeExtra added in v0.2.0

func ComposeExtra(core string, props []jsonschema.Property) (Composed, error)

ComposeExtra is Compose with the extra schema made of a brief intent's properties, every one required: the brief intent's Def.Extra.

func (Composed) DecodeFields added in v0.2.0

func (c Composed) DecodeFields(answer []byte, names []string) (map[string]any, error)

DecodeFields validates a missing-fields answer asking for names.

func (Composed) FieldVersions added in v0.2.0

func (c Composed) FieldVersions() map[string]string

FieldVersions are the versions of c's extra fields, by name: a hash of each property's schema.

func (Composed) FieldsJSON added in v0.2.0

func (c Composed) FieldsJSON(names []string) string

FieldsJSON is the schema of a missing-fields answer, {"extra": {...}} holding names alone, every one required.

func (Composed) JSON added in v0.2.0

func (c Composed) JSON() string

JSON is the schema sent to the model.

func (Composed) Missing added in v0.2.0

func (c Composed) Missing(b Brief) []string

Missing are the extra fields b lacks at their current version, by name.

func (Composed) Validate added in v0.2.0

func (c Composed) Validate(answer []byte) (Brief, error)

Validate checks a model's answer against c, then decodes it; a bad extra fails only the extras, keeping the core brief, with ErrExtra.

func (Composed) WithFields added in v0.2.0

func (c Composed) WithFields(b Brief, values map[string]any) Brief

WithFields is b with values filled at their current versions.

type Deps

type Deps struct {
	Store Store
	// PRs are the pull requests the GitHub plugin last reported; nil knows
	// none.
	PRs    PRReader
	Source interface {
		Facts(ctx context.Context, ref github.Ref) (Input, error)
		Diff(ctx context.Context, ref github.Ref, max int) (diff string, cut bool, err error)
	}
	Runner interface {
		Run(ctx context.Context, c Call) (Result, error)
	}
	// Enabled is brief.enabled: false answers every Ready without a brief.
	Enabled bool
	// Unavailable is why the queue cannot brief pull requests, such as no
	// agent to ask: their turns start without a brief, Runner may be nil
	// and the queue is never started. On-demand units are briefed all the
	// same.
	Unavailable string
	// Taxonomy is the bundled one until profiles exist; see the step 2 seam.
	Taxonomy func(ref github.Ref) string
	// Home is the agent home a pull request's brief runs with.
	Home         func(ref github.Ref) string
	Tier         turns.Tier
	MaxDiffBytes int
	// Retry is how long a background failure waits before the next try:
	// sweep.slow, doubled after each failure.
	Retry time.Duration
	// Allow is false while the GitHub budget refuses reads of that
	// priority; nil means fine.
	Allow func(dgh.Priority) bool
	// CallTimeout and WantedTimeout bound reading the input and the call
	// together, of a background and of a wanted run; zero means the
	// package's constant.
	CallTimeout, WantedTimeout time.Duration
	// DemandTimeout bounds a first turn's wait for an OnDemand source's
	// brief; zero is the package's.
	DemandTimeout time.Duration
	Now           func() time.Time
	// After is time.After unless set.
	After func(time.Duration) <-chan time.Time
	// Changes keeps Status's counts until a pull request, a brief or the
	// configuration changes, or the minute turns; nil reads every call.
	Changes port.Changes
	Log     func(format string, args ...any)
	// Intent is the brief intent of a provider's units as the profile
	// resolves it now; nil is the bundled one.
	Intent func(p unit.ProviderID) Intent
	// Records projects a pull request's brief record onto the tasks holding
	// it; nil projects none.
	Records *Records
	// Sources are the providers' BriefSources by provider. Pull requests
	// default to GitHubSource over Store and Source; a GitHub source set
	// here keeps Retry. A source that is also an OnDemand briefs its units
	// on a first turn's demand.
	Sources map[unit.ProviderID]BriefSource
}

type GitHubSource added in v0.2.0

type GitHubSource struct {
	Store  PRReader
	Source interface {
		Facts(ctx context.Context, ref github.Ref) (Input, error)
		Diff(ctx context.Context, ref github.Ref, limit int) (string, bool, error)
	}
	MaxDiffBytes int
	// Retry is the first wait after a failed attempt, the queue's Deps.Retry.
	Retry time.Duration
}

GitHubSource is the BriefSource of pull requests: the revision is the head and the description's edit time, the parts the changed files; its staleness and attempt rules are the queue's.

func (GitHubSource) Describe added in v0.2.0

func (g GitHubSource) Describe(in UnitInput) string

func (GitHubSource) Input added in v0.2.0

func (g GitHubSource) Input(ctx context.Context, u unit.Unit) (UnitInput, error)

func (GitHubSource) Revision added in v0.2.0

func (g GitHubSource) Revision(ctx context.Context, u unit.Unit) (At, error)

func (GitHubSource) Stale added in v0.2.0

func (g GitHubSource) Stale(w Written, cur At, version string, now time.Time) bool

Stale is the queue's rule: a failed attempt is due when the pull request moved or its backoff passed, a brief when the pull request moved.

type Input

type Input struct {
	Title, Body, Issue string
	Files              []string
	Diff               string
	// DiffNote says why the diff is cut or missing, "" when it is whole.
	DiffNote string
	// Paths are the changed files, at most filesMax.
	Paths []string
	// DiffBytes is the whole diff's size, 0 when gh did not return it.
	DiffBytes int
	DiffCut   bool
}

type Intakes

type Intakes struct{ Q *Queue }

Intakes is the queue as the intake's Briefs port.

func (Intakes) Changed

func (a Intakes) Changed(_ context.Context, u unit.Unit) (<-chan struct{}, func())

func (Intakes) Peek

func (a Intakes) Peek(ctx context.Context, u unit.Unit, first bool, need []string) (intake.Readiness, error)

Peek is Ready without starting a brief or writing.

func (Intakes) Ready

func (a Intakes) Ready(ctx context.Context, u unit.Unit, first bool, need []string) (intake.Readiness, error)

func (Intakes) Unwant

func (a Intakes) Unwant(ctx context.Context, u unit.Unit) error

type Intent added in v0.2.0

type Intent struct {
	Schema               Composed
	Prompt, FieldsPrompt string
}

Intent is what the brief intent sets of a brief: the composed schema, the zero Composed being the core alone, and the prompt and the missing-fields prompt, empty for the bundled ones.

type OnDemand added in v0.2.0

type OnDemand interface {
	// Want asks for u's brief now; false when no brief of u is coming,
	// such as when nothing of it is left to read.
	Want(ctx context.Context, u unit.Unit) (bool, error)
}

OnDemand is a BriefSource whose briefs another job writes, such as the Slack extraction, which a first turn asks for its unit's brief. The job tells the queue of each brief it writes through Noted.

type PRReader added in v0.2.0

type PRReader interface {
	PR(ctx context.Context, ref github.Ref) (dinv.PR, bool, error)
}

PRReader reads a pull request the GitHub plugin reported.

type Projection added in v0.3.0

type Projection struct {
	Projects map[string]string
	Parse    func(prop, text string, w task.Writer) (task.Value, bool)
}

Projection is how a brief record sets the properties of its task, as records.toml declares it: Projects are the fields that set a property, by field; Parse is a property's value from a field's text, false when w may not write the property or the text is no value of it.

func (Projection) Props added in v0.3.0

func (p Projection) Props(data []byte, w task.Writer) map[string]task.Value

Props are the properties data, a brief record's JSON, sets as w wrote it: each projected field that holds a string its property takes.

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

func New

func New(d Deps) *Queue

func (*Queue) Attempt

func (q *Queue) Attempt(ctx context.Context, ref github.Ref) (int, error)

Attempt is the attempt a first turn of ref waits on, as Ready counts it.

func (*Queue) AttemptOf

func (q *Queue) AttemptOf(pr dinv.PR, rec dinv.BriefRecord) int

AttemptOf is Attempt with the pull request and its brief record already read.

func (*Queue) Breaker

func (q *Queue) Breaker() (open bool, since time.Time, lastErr string, next time.Time)

Breaker is the state the health and the menu bar show; open is false while it is closed.

func (*Queue) Briefed

func (q *Queue) Briefed(ctx context.Context) (map[github.Ref]Summary, map[github.Ref]dinv.BriefRecord, error)

Briefed reads every brief record in one query, with the summary of each stored brief; a pull request whose brief is missing or does not fit the schema has no summary.

func (*Queue) Changed

func (q *Queue) Changed(u unit.Unit) (<-chan struct{}, func())

Changed is closed by the next end of a brief run of u after the call, or by another job noting u's brief; the func releases it.

func (*Queue) Due

func (q *Queue) Due() <-chan struct{}

Due is signaled when followed pull requests are due a background brief.

func (*Queue) Fill added in v0.2.0

func (q *Queue) Fill(ctx context.Context, u unit.Unit, need []string) (bool, error)

Fill fills the extra fields u's brief lacks, those of need when need is not empty, without briefing its core again; see fillPR. Only pull requests' briefs are filled this way, and only by a queue that can brief: another provider's job writes its fields at its next pass.

func (*Queue) Forget

func (q *Queue) Forget(ctx context.Context, ref github.Ref) error

Forget drops the brief in use and any give-up, so the next run makes it again; every run stays.

func (*Queue) Interrupted

func (q *Queue) Interrupted(ctx context.Context) error

Interrupted ends the runs a daemon that stopped mid-call left running.

func (*Queue) Next

func (q *Queue) Next(states []inventory.BriefState, now time.Time) (next time.Time, ok bool)

Next is the earliest time the queue has something to do with states: the breaker's trial while it is open, else the retry of a wanted brief and the end of a failed background brief's backoff and the end of an edited description's quiet period. ok is false when nothing waits.

func (*Queue) Noted added in v0.2.0

func (q *Queue) Noted(u unit.Unit)

Noted wakes the Changed of u once another job wrote its brief.

func (*Queue) Peek

func (q *Queue) Peek(ctx context.Context, u unit.Unit, first bool, need []string) (Readiness, error)

Peek is Ready's answer without starting a brief, waiting or writing.

func (*Queue) Ready

func (q *Queue) Ready(ctx context.Context, u unit.Unit, first bool, need []string) (Readiness, error)

Ready answers for a turn of u. A pull request is briefed by the queue: a first turn waits for a brief at the current version, a later one takes the brief there is. need are the extra fields the turn's intent needs: a first turn also waits until a call fills the missing ones, once, and a later one starts that call. A unit of another provider takes its brief in use; a first turn without one asks its OnDemand source and waits, at most DemandTimeout, while the source says a brief is coming.

func (*Queue) RefreshIfStale

func (q *Queue) RefreshIfStale(ctx context.Context, pr dinv.PR) error

RefreshIfStale starts one refresh of pr's brief when it is stale and due; View alone never starts a run.

func (*Queue) Register added in v0.2.0

func (q *Queue) Register(p unit.ProviderID, s BriefSource)

Register adds p's BriefSource.

func (*Queue) Run

func (q *Queue) Run(ctx context.Context) (string, error)

Run briefs up to Batch due pull requests, Concurrency at a time, leaving out the wanted ones and the ones in flight.

func (*Queue) Start

func (q *Queue) Start(ctx context.Context)

Start runs wanted briefs and the breaker's trials until ctx ends, waking at the earliest deadline, on Touched and on the end of a run, and after Resync at most.

func (*Queue) Status

func (q *Queue) Status(ctx context.Context) (Status, error)

Status counts the followed pull requests by brief state, read again only after a note of statusInputs or when the minute turns.

func (*Queue) Touched

func (q *Queue) Touched(refs []pr.Ref)

Touched wakes the scheduler for pull requests whose inputs changed; any number of calls before it scans make one scan.

func (*Queue) Unwant

func (q *Queue) Unwant(ctx context.Context, u unit.Unit) error

Unwant drops u's want of a brief, once no turn waits on it.

func (*Queue) Views

func (q *Queue) Views(ctx context.Context, prs ...dinv.PR) (map[github.Ref]*View, error)

Views are what the detail panel shows for each of prs, by pull request.

type Readiness

type Readiness struct {
	State       ReadyState
	Wait        string
	Attempt     int
	LastError   string
	Next, Since time.Time
	Reason      string
	Cause       string
	Brief       *Brief
	Run         int64
}

Readiness answers whether a turn goes now. Ready carries Brief, made by Run. Wait names what the turn waits on: Attempt is the attempt it waits for, LastError the failure of the one before, Next the retry's time. Without says why in Reason, and Cause names a give-up (Attempt failures, the last LastError), an open breaker (since Since, for LastError) or briefs that are disabled.

type ReadyState

type ReadyState string
const (
	Ready   ReadyState = "ready"
	Wait    ReadyState = "wait"
	Without ReadyState = "without"
)

type Records added in v0.3.0

type Records struct {
	// Holders are the tasks that hold a unit.
	Holders interface {
		TasksHolding(ctx context.Context, u unit.Unit) ([]task.ID, error)
	}
	Props interface {
		SetProp(ctx context.Context, id task.ID, name string, v task.Value, w task.Writer) error
	}
	// Projection is the brief record kind's as the profile declares it now.
	Projection func() Projection
}

Records projects brief records onto tasks.

func (*Records) Project added in v0.3.0

func (r *Records) Project(ctx context.Context, ids []task.ID, data []byte, w task.Writer) error

Project sets, on each task of ids, the properties data sets as w wrote it; a task gone since is skipped.

func (*Records) ProjectHeld added in v0.3.0

func (r *Records) ProjectHeld(ctx context.Context, u unit.Unit, data []byte, w task.Writer) error

ProjectHeld sets, on every task holding u, the properties u's brief record data sets, as w wrote it: a pull request task's brief is its pull request's.

func (*Records) ProjectUnheld added in v0.3.0

func (r *Records) ProjectUnheld(ctx context.Context, u unit.Unit, data []byte, w task.Writer) error

ProjectUnheld sets, on every task holding u that holds none of the properties u's brief record data sets, those properties as w wrote them: a task that starts holding a briefed pull request takes its brief's properties once, and a value already there, a person's included, stays.

type Result

type Result struct {
	Brief    Brief
	Model    string
	CostUSD  *float64
	Duration time.Duration
	Tokens   *usage.Tokens
	// DroppedTags are the key:value spellings normalization refused.
	DroppedTags []string
	// Fields are a missing-fields call's values, by name.
	Fields map[string]any
	// ExtraErr is why the extra fields of an otherwise fitting brief were
	// refused; the brief holds none of them.
	ExtraErr error
}

type RunStore

type RunStore interface {
	StartBriefRun(ctx context.Context, r dinv.BriefRun) (int64, error)
	EndBriefRun(ctx context.Context, r dinv.BriefRun, st dinv.BriefRecord) error
	InterruptBriefRuns(ctx context.Context, at time.Time) (int, error)
	RefreshBrief(ctx context.Context, ref github.Ref) error
	WantBrief(ctx context.Context, ref github.Ref, at time.Time) error
	ClearWanted(ctx context.Context, ref github.Ref) error
	RecordEvent(ctx context.Context, ev dinv.Event) error
}

type Status

type Status struct {
	Ready     int    `json:"ready"`
	Pending   int    `json:"pending"`
	Failed    int    `json:"failed"`
	LastError string `json:"last_error,omitempty"`
	// PausedUntil is the breaker's next trial while it is open.
	PausedUntil time.Time `json:"paused_until,omitzero"`
}

type Store

type Store interface {
	BriefStates(ctx context.Context) ([]inventory.BriefState, error)
	BriefRecords(ctx context.Context, refs ...github.Ref) (map[github.Ref]dinv.BriefRecord, error)
	BriefRecord(ctx context.Context, ref github.Ref) (dinv.BriefRecord, bool, error)
	TagVocabulary(ctx context.Context, owner string, keys []string, limit int) (map[string][]tag.Count, error)
	UnitBrief(ctx context.Context, u unit.Unit) (inventory.UnitBrief, bool, error)
	RunStore
}

type Summary

type Summary struct {
	Kind          string `json:"kind"`
	Size          string `json:"size"`
	Risk          string `json:"risk"`
	Goal          string `json:"goal"`
	OpenQuestions int    `json:"open_questions"`
	// Tags are the brief's key:value tags, sorted.
	Tags []string `json:"tags"`
	// Extra are the brief intent's extra fields the brief holds, by name.
	Extra map[string]any `json:"extra,omitempty"`
}

Summary is what a row of the list shows of a brief.

type UnitInput added in v0.2.0

type UnitInput struct {
	// Text is the unit's own text the prompt's data block holds.
	Text string
	// Bytes is the whole input's size, 0 when unknown; Cut says Text is cut.
	Bytes int
	Cut   bool
	// Parts are the provider's parts as a JSON object, such as GitHub's
	// changed files.
	Parts json.RawMessage
}

UnitInput is what a brief of a unit reads: the text the prompt carries and the provider's own parts, which brief_runs.input stores.

type View

type View struct {
	State string    `json:"state"`
	Brief *Brief    `json:"brief,omitempty"`
	Model string    `json:"model,omitempty"`
	At    time.Time `json:"at,omitzero"`
	Error string    `json:"error,omitempty"`
	// Stale marks a brief that is due again: the pull request moved on.
	Stale bool `json:"stale"`
}

type Written added in v0.2.0

type Written struct {
	// At is what the unit was at when the brief in use was made.
	At      At
	Version string
	// Error is the last attempt's error, empty when it went ok.
	Error       string
	Failures    int
	AttemptedAt time.Time
	// AttemptOf is AttemptKey of the last attempt.
	AttemptOf string
}

Written is what a stored brief was made from and how its last attempt went, as brief_runs and unit_briefs keep it.

Jump to

Keyboard shortcuts

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