Documentation
¶
Overview ¶
Package intent holds the definition of an intent, as its manifest declares it, and the registry of every loaded intent.
Index ¶
- Constants
- func Normalize(spec Input, v any) (any, error)
- func OrList(names []string) string
- func Zero(v any) bool
- type Action
- type AlsoProfile
- type Brief
- type Case
- type Def
- type Guidance
- type Headline
- type Help
- type Input
- type Join
- type Name
- type Pos
- type Pred
- type RecordRules
- type Refusal
- type Refuse
- type Registry
- func (r *Registry) All() []Def
- func (r *Registry) AllNames() string
- func (r *Registry) Answerable() []string
- func (r *Registry) Builder(what string, p unit.ProviderID) (Def, bool)
- func (r *Registry) ByRole(role string, p unit.ProviderID) (Def, bool)
- func (r *Registry) ClosesWhenDone(intent string) bool
- func (r *Registry) DeclaringFlag(flag string) []Name
- func (r *Registry) ForProvider(p unit.ProviderID) []Def
- func (r *Registry) Get(n Name) (Def, bool)
- func (r *Registry) Names() string
- func (r *Registry) Reconcile(intent string) string
- func (r *Registry) Rules(intent string) (RecordRules, error)
- func (r *Registry) SessionTitles() []string
- func (r *Registry) UserFacing() []Def
- type Require
- type Resume
- type Session
- type Source
- type Target
- type Text
- type WorkspaceRepo
Constants ¶
const AnyProvider unit.ProviderID = "any"
AnyProvider is the provider of an intent whose turns run on units of every provider.
const DimReviewer = "reviewer"
DimReviewer is the profile dimension that selects an address round by a reviewer it answers.
const DimStage = "stage"
DimStage is the profile dimension that selects by the pass over a unit: first or follow-up.
const TargetCapture = "capture"
TargetCapture is the target.missing that captures the run's guidance as a new task, the turn's unit.
Variables ¶
This section is empty.
Functions ¶
func Normalize ¶
Normalize is v as the input's type: a bool a bool, a text a string, a list a []string, whatever JSON decoded them as.
Types ¶
type Action ¶
type Action struct {
Group string
Surfaces []string
When Pred
Primary Pred
// Refuse are the cases that offer the action disabled; the first whose
// When holds gives its Why.
Refuse []Refusal
Note Text
Warning Text
Confirm Text
}
Action is how an intent's action is offered on a row. Its description is the intent's Summary.
type AlsoProfile ¶
type Def ¶
type Def struct {
Name Name
Label string
Summary string
Key string
Verb string // the task verb its action fulfills; "" for none
UserFacing bool
Workspace string // review | author | linked_else_main | given
Session Session
Context string // pr | synthetic, from the role
Launch string // "" | probe, from the role
Policy string // round | probe, from the role
Intake bool
StartLine string
OwnerOnly bool
Answerable bool
Board string // review | author | none, from the workspace
DrivesRow bool // from the role, moved to a user intent that takes it
Reports bool
Reconcile string // "" | my_review, from the role
Brief Brief
Profile string // "" means none
Dims []string
// Records is [record] when.
Records Pred
Prepare string // from the role
// Effects are what sending the turn applies, turn effects of
// builtin.Effects.
Effects []string
Headline Headline
Guidance Guidance
Inputs []Input // sorted by name
AlsoProfiles []AlsoProfile
Action *Action // nil: not offered
Join Join
Record RecordRules
Resume Resume
Source Source
Bundled bool
// Provider is the manifest's provider; default "github".
Provider unit.ProviderID
// DraftApproval is the approval of its turns' drafts, from the manifest's
// [gates.approval]; nil when that names none for a draft gate.
DraftApproval *draft.Policy
// Runners are turn.Runner values; default ["session"].
Runners []string
// Providers are the providers of a manifest whose provider is a list,
// Provider the first; nil for a single provider.
Providers []unit.ProviderID
// Role is what Go resolves the intent by (Registry.ByRole), one of
// builtin.Roles; "" none.
Role string
// Builds is what a builder intent builds, such as "brief": it is never
// started as a turn. Prompt and Schema are its prompt, resolved through
// the profile layers, and its schema, in its directory.
Builds, Prompt, Schema string
// Extra are a brief builder's extra fields, the top-level properties of
// its Schema as the loader compiled it; nil for any other intent.
Extra []jsonschema.Property
// WorkspaceRepo is a manifest's workspace table: the repository the
// turn runs in, named outright or by an input; nil for a workspace
// builtin.
WorkspaceRepo *WorkspaceRepo
// Target is what a run with no unit does.
Target Target
// AllowedEffects are the effects the intent's agents may declare on the
// drafts they propose, names of builtin.Effects.
AllowedEffects []string
// AttachPosts says the unit of each post its turns make on a task is
// attached to that task.
AttachPosts bool
// RoundKind is the sweep round the intent's turns are, from its role:
// "review" (first or follow-up, by the step's stage) or "address"; ""
// none.
RoundKind string
// Why is the template, over the unit's workflow facts, that says why
// the intent's turn is due; empty for none.
Why Text
// Refuse are the refusals of turn.start, in order: the first whose when
// holds refuses with its why.
Refuse []Refuse
// Skill says whether install writes the intent a turn skill.
Skill bool
Help Help
}
func (Def) NormalizeAll ¶
NormalizeAll normalizes inputs read back from a stored request, keeping only the declared ones.
func (Def) ProviderOrDefault ¶
func (d Def) ProviderOrDefault() unit.ProviderID
ProviderOrDefault is the provider whose units the intent's turns run on; the loader fills it from the profile's defaults when the manifest names none.
type Help ¶ added in v0.2.0
type Help struct {
// Target says what the command's target is, such as "a pull request
// URL"; the turn skill and the command's help read it.
Target string
// Summary is the main help's line for the command, Summary when empty.
Summary string
// Group is the title of the main help's group the command joins, in
// any case; "" or a title the help has not joins the user's intents.
Group string
// Examples are command lines without the command's name.
Examples []string
// Docs is a page path of the documentation site.
Docs string
}
Help is how the intent's command and turn skill present it.
type Input ¶
type Pred ¶
Pred is a predicate's source and where its value starts; compiled programs live in the loader.
type RecordRules ¶
type RecordRules struct {
States []string // done settled asked failed
Artifacts []string
Outcome []string // verdict url
OutcomeDoc string
HistoryArtifact string
Require []Require
// AttachURL says a done record's outcome url, when it names a unit, is
// attached to the turn's task.
AttachURL bool
// Requires is the record kind a run owes, "" for none; Missing the gate
// a run that ends without it opens.
Requires, Missing string
// None is an intent whose manifest has no [record]: its turns owe no
// record, so its sessions' stops are never blocked for one.
None bool
}
type Refuse ¶ added in v0.2.0
Refuse is a refusal of turn.start: when holds over the unit's workflow facts, why says it.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the set of loaded intents, read-only once built.
func NewRegistry ¶
func (*Registry) Answerable ¶
func (*Registry) Builder ¶ added in v0.2.0
Builder is the intent that builds what for units of p, such as the brief: the user's holder over the bundled one.
func (*Registry) ByRole ¶ added in v0.2.0
ByRole is the intent holding role for units of p: a user's intent over the bundled one; the loader refuses two holders in one layer.
func (*Registry) ClosesWhenDone ¶
func (*Registry) DeclaringFlag ¶
func (*Registry) ForProvider ¶
func (r *Registry) ForProvider(p unit.ProviderID) []Def
ForProvider is the intents whose turns run on units of p.
func (*Registry) Names ¶
Names is "address, ask-author, nudge or review": user-facing, for messages.
func (*Registry) Rules ¶
func (r *Registry) Rules(intent string) (RecordRules, error)
Rules, Answerable, ClosesWhenDone, Reconcile and SessionTitles satisfy turns.Intents.
func (*Registry) SessionTitles ¶
SessionTitles is session.title of the user-facing intents, each once.
func (*Registry) UserFacing ¶
type Resume ¶
type Resume struct{ Changed string }
Resume holds Changed, the text a resumed turn reads when its unit changed since the question.
type Target ¶ added in v0.3.0
Target is what a run of the intent with no unit does: Missing is "" to refuse it, or TargetCapture; Title names the captured task over the guidance.
type WorkspaceRepo ¶ added in v0.2.0
type WorkspaceRepo struct {
Repo, RepoInput string
// Optional lets a turn whose input names no repository run without
// one, in the neutral repository.
Optional bool
// Name is the created worktree's name over the name facts; empty for
// the loop's own.
Name Text
}
WorkspaceRepo is where a turn runs when its manifest names a repository: Repo (owner/name) outright, or the input RepoInput holds.