Documentation
¶
Overview ¶
Package catalog is the action catalog: the actions a pull request's row offers, the builtin ones and the intents', derived from facts the daemon gathers.
Index ¶
- Constants
- func Authority(loaded func() *intentload.Loaded) ...
- func Baseline(loaded func() *intentload.Loaded, ...) func(ctx context.Context, t task.Task, when string) (string, error)
- func CheckFacets(task []intentload.FacetDef, plugin []api.FacetSpec) intentload.Problems
- func CheckPluginKeys(id unit.ProviderID, ui *api.PluginUI) error
- func DraftRefusal(id string, f DraftFacts) string
- func DraftStates(l *intentload.Loaded, f DraftFacts) []api.ActionState
- func FactFacets(defs []intentload.FacetDef, f workflow.Facts) map[string][]string
- func FirstProblem(p intentload.Problems) string
- func GateView(def intentload.ViewsDef, id string, g gate.Gate, f workflow.Facts) (bool, error)
- func GateViewAt(def intentload.ViewsDef, id string, _ gate.Gate, f workflow.Facts, ...) (bool, error)
- func Holds(loaded func() *intentload.Loaded, ...) func(ctx context.Context, w wake.Wake, t task.Task) (bool, error)
- func JoinDiffers(d dintent.Def, open, req map[string]any) string
- func JoinRefusalText(seq int64, intent, how string) string
- func LensWords(w intentload.LensWords) api.LensWords
- func Lists(def intentload.ViewsDef, id string) bool
- func MergeFacets(defs []intentload.FacetDef, own map[string][]string, ...) map[string][]string
- func OfferFacts(e task.Task) workflow.Facts
- func Origin(s api.ActionSpec) int
- func OwedByOf(loaded func() *intentload.Loaded) func(ctx context.Context, f workflow.Facts) (string, error)
- func OwnFacts(def intentload.ViewsDef, id string) bool
- func Paged(def intentload.ViewsDef, id string) bool
- func PlanSpecs(l *intentload.Loaded) []api.ActionSpec
- func PlanStates(l *intentload.Loaded, it api.PlanItem, row []api.ActionState) []api.ActionState
- func PropFacts(t task.Task, d intentload.TasksDef) workflow.Facts
- func Rank(s api.ActionSpec, provider unit.ProviderID) int
- func RecordFacets(defs []intentload.FacetDef, kind string, data json.RawMessage) map[string][]string
- func ResolveRun(reg *dintent.Registry, role string) (dintent.Def, bool)
- func RowOf(loaded func() *intentload.Loaded, ...) func(ctx context.Context, t task.Task) (Row, error)
- func RunActions(f RunFacts) []string
- func RunNowIntent(reg *dintent.Registry, w api.Workspace, o api.Override, mine bool) (string, error)
- func RunsHeld(l *intentload.Loaded, action string) bool
- func SessionWithout(seq int64) string
- func Sort(def intentload.ViewsDef, id string, ts []task.Task, ...) error
- func Specs(l *intentload.Loaded) []api.ActionSpec
- func SpecsFor(l *intentload.Loaded, disabled []unit.ProviderID) []api.ActionSpec
- func States(f Facts) []api.ActionState
- func Survives(loaded func() *intentload.Loaded, ...) func(ctx context.Context, verb string, t task.Task) (bool, error)
- func TaskFacets(defs []intentload.FacetDef, tasks intentload.TasksDef, contexts []string) []api.FacetSpec
- func TaskFacts(t task.Task, d intentload.TasksDef) workflow.Facts
- func UnitStates(f Facts) []api.ActionState
- func Version(specs []api.ActionSpec) string
- func VersionFor(l *intentload.Loaded, disabled []unit.ProviderID) string
- func VersionOf(l *intentload.Loaded) string
- func View(def intentload.ViewsDef, id string, t task.Task, f workflow.Facts) (bool, error)
- func ViewAt(def intentload.ViewsDef, id string, _ task.Task, f workflow.Facts, ...) (bool, error)
- func WithOffers(states []api.ActionState, offered []string) []api.ActionState
- func WorkspaceRole(f RoleFacts) string
- type Asked
- type Config
- type DraftFacts
- type Facts
- type GateIntent
- type Intake
- type Lens
- type RoleFacts
- type Row
- type RunFacts
Constants ¶
const ( SurfaceRow = "row" SurfaceDetail = "detail" SurfaceTUI = "tui" SurfaceMenubar = "menubar" SurfaceNotification = "notification" SurfaceCLI = "cli" SurfaceExplore = "explore" )
The surfaces an action spec names.
const ( OriginBuiltin = iota OriginBundled OriginUser )
The origins of an action spec, in the order a shared verb ranks them.
const ( BasisPending = "pending:" BasisHeld = "held:" )
BasisPending and BasisHeld prefix the basis of the plan gate's first approving intent.
const ( RunOpen = "open" RunEnter = "enter" RunTranscript = "transcript" )
The run actions, as a RunView's actions name them; actions.toml words each under runPrefix and its name.
const ( DraftCloseSilently = "draft.close-silently" DraftSkipWorkflow = "draft.skip-workflow" //nolint:gosec // G101: an action id, no credential )
The draft actions of the Outbox's cards: close the conversation without the draft's message, and stop the draft's workflow on its conversation.
const ( PlanApply = "plan_apply" PlanDismiss = "plan_dismiss" )
The ids of a plan item's own actions.
const ( ScopeUnit = "unit" ScopeItem = "item" ScopeDraft = "draft" ScopeRun = "run" )
The scopes of an action spec: what the action acts on.
const ( RoleReview = "review" RoleAuthor = "author" )
The workspace roles a held round resolves its intent by, as a manifest's workspace names them.
const SourceBuiltin = "builtin"
SourceBuiltin is the Source of an action spec Go declares.
const StartBlocked = "round blocked: "
StartBlocked prefixes the reason of a turn.start item a start block holds.
Variables ¶
This section is empty.
Functions ¶
func Authority ¶ added in v0.3.0
func Authority(loaded func() *intentload.Loaded) func(ctx context.Context, verb string, a task.Actor, t task.Task) (allow, gate bool, err error)
Authority is the profile's word on who runs the task verbs, the core's tasks.Authority: actor a may run verb on t where tasks.toml's verbs.<verb>.by.<a> holds over t's own facts, and running it opens the verb's gate where that is "gate". An actor the verb's by leaves out may not run it. loaded is the profile as it loads now.
func Baseline ¶ added in v0.3.0
func Baseline(loaded func() *intentload.Loaded, facts func(ctx context.Context, t task.Task) (workflow.Facts, error)) func(ctx context.Context, t task.Task, when string) (string, error)
Baseline is the core's tasks.Baseline: a wake's When that names facts of the task alone, list or bool ones separated by commas, such as "task.link_owes, task.link_signal.in_loop", asks to wake once the task's own value of any of them changes. Baseline turns it into the condition over the values facts reads of the task now, a list's in any order; any other When stays as it is.
func CheckFacets ¶ added in v0.4.0
func CheckFacets(task []intentload.FacetDef, plugin []api.FacetSpec) intentload.Problems
CheckFacets are the problems of facets of one id that do not group, sort, rank, match and bucket alike: two plugins' facets, and a task facet against a plugin's. plugin are the facets the plugins serve, those of one id that agree already merged into one.
func CheckPluginKeys ¶
func CheckPluginKeys(id unit.ProviderID, ui *api.PluginUI) error
CheckPluginKeys refuses the plugin's declared keys that the core or a built-in action holds on the binding's surface, or that two of its actions share; a binding with no surface binds every surface. The error starts with the plugin id.
func DraftRefusal ¶ added in v0.4.0
func DraftRefusal(id string, f DraftFacts) string
DraftRefusal is why draft action id is disabled on a draft of f, as a code of builtin.DraftRefusals; "" when it is enabled.
func DraftStates ¶
func DraftStates(l *intentload.Loaded, f DraftFacts) []api.ActionState
DraftStates are the draft actions in catalog order as they stand on a draft, worded by l: all disabled when its plugin is off.
func FactFacets ¶ added in v0.4.0
FactFacets are the values of the facets defs declares that f holds the fact of, as text: a true bool is "yes", a number its decimal, an instant RFC 3339, a list its elements; false, zero, empty and the zero instant are no value.
func FirstProblem ¶
func FirstProblem(p intentload.Problems) string
FirstProblem is the first line of the problems, sorted.
func GateView ¶ added in v0.3.0
GateView says whether gate g, whose facts f holds, is in view id of def. A view over tasks, one that lists nothing and one def does not declare hold no gate.
func GateViewAt ¶ added in v0.3.0
func GateViewAt(def intentload.ViewsDef, id string, _ gate.Gate, f workflow.Facts, now time.Time) (bool, error)
GateViewAt is GateView with now the time the view's when reads as now.
func Holds ¶ added in v0.3.0
func Holds(loaded func() *intentload.Loaded, facts func(ctx context.Context, t task.Task) (workflow.Facts, error)) func(ctx context.Context, w wake.Wake, t task.Task) (bool, error)
Holds is the core's wakes.Holds: a wake's When, a predicate over the task's workflow facts and the properties of tasks.toml, matched over the facts facts reads of the task. A condition that does not compile fails.
func JoinDiffers ¶
JoinDiffers is how the open intake's inputs differ from a request's on the intent's join.differs_on, from the open intake's view: "with --self-review" or "without --self-review"; "" when they agree.
func JoinRefusalText ¶
JoinRefusalText is why open intake seq of intent refuses a request that differs from it as how says.
func LensWords ¶ added in v0.4.0
func LensWords(w intentload.LensWords) api.LensWords
LensWords are the profile's lens words as clients read them.
func Lists ¶ added in v0.3.0
func Lists(def intentload.ViewsDef, id string) bool
Lists says whether view id of def lists something: it has a when.
func MergeFacets ¶ added in v0.4.0
func MergeFacets(defs []intentload.FacetDef, own map[string][]string, rows []map[string][]string) map[string][]string
MergeFacets joins a task's own facet values with those of its units' rows, rows in unit order, the primary unit's first and nil for a unit without a row. A facet defs declares as rows-first takes the rows' values, its own only when no row has one; one declared own keeps its own alone; any other joins its own and then the rows', each value once. A facet declared for the primary unit reads the first row alone. A facet defs does not declare comes from the rows alone.
func OfferFacts ¶ added in v0.3.0
OfferFacts are the facts of e a verb's offer reads.
func Origin ¶
func Origin(s api.ActionSpec) int
Origin is where s comes from: Go (Source "builtin"), a bundled manifest (a relative path) or a user's (an absolute path).
func OwedByOf ¶ added in v0.3.0
func OwedByOf(loaded func() *intentload.Loaded) func(ctx context.Context, f workflow.Facts) (string, error)
OwedByOf is who owes the next step of the task whose facts f holds, as tasks.toml's owed_by.expr says over them: me, a person's key, or "" when nobody does, and when the profile names no expression. loaded is the profile as it loads now.
func OwnFacts ¶ added in v0.3.0
func OwnFacts(def intentload.ViewsDef, id string) bool
OwnFacts says whether view id of def reads only the facts a task's own fields hold, which TaskFacts reads with no store: its when, its group and its sort.
func Paged ¶ added in v0.3.0
func Paged(def intentload.ViewsDef, id string) bool
Paged says whether view id of def can be paged since a position: it reads only a task's own facts, and not the time, so a write of the task is all that moves it in or out.
func PlanSpecs ¶
func PlanSpecs(l *intentload.Loaded) []api.ActionSpec
PlanSpecs are the actions a plan item may offer, in render order, worded by l, then the intents of the trust gate a start block holds it on.
func PlanStates ¶
func PlanStates(l *intentload.Loaded, it api.PlanItem, row []api.ActionState) []api.ActionState
PlanStates are the actions plan item it offers now, worded by l. A turn.start item a start block holds offers the intents of its trust gate that row, the actions its pull request's row, offers: no plan action trusts a folder.
func PropFacts ¶ added in v0.3.0
PropFacts are the task.prop.* facts of t's properties, typed as d declares them, and the task.prop_by.* of who wrote each; a property d does not declare is left out.
func Rank ¶
func Rank(s api.ActionSpec, provider unit.ProviderID) int
Rank orders the specs whose verb a task runs on a unit of provider, the lowest first: the built-in actions, then the intents of the unit's own provider, then those of any provider, a user's intent before a bundled one within each.
func RecordFacets ¶ added in v0.4.0
func RecordFacets(defs []intentload.FacetDef, kind string, data json.RawMessage) map[string][]string
RecordFacets are the values of the facets defs declares over the fields of a record of kind, the facets whose fact is <kind>.<field>, read from the record's data as FactFacets reads a fact.
func ResolveRun ¶
ResolveRun is run.resolve: the intent that drives the row whose workspace is the role of the held round's workspace; false when none or more than one is.
func RowOf ¶ added in v0.3.0
func RowOf(loaded func() *intentload.Loaded, facts func(ctx context.Context, t task.Task) (workflow.Facts, error)) func(ctx context.Context, t task.Task) (Row, error)
RowOf is the Row of a task over the facts facts reads of it, the task facts provider's, with the facets of the profile loaded reads.
func RunActions ¶ added in v0.3.0
RunActions are the names of the run actions a run offers, in catalog order.
func RunNowIntent ¶
func RunNowIntent(reg *dintent.Registry, w api.Workspace, o api.Override, mine bool) (string, error)
RunNowIntent is the intent a held round runs as on a pull request with workspace w and override o, or the error that says why no single one does.
func RunsHeld ¶ added in v0.3.0
func RunsHeld(l *intentload.Loaded, action string) bool
RunsHeld says whether action is the plan gate's first approving intent, which also runs a round the daily cap held.
func SessionWithout ¶
SessionWithout is why a turn by hand's intake does not start without its brief.
func Sort ¶ added in v0.3.0
func Sort(def intentload.ViewsDef, id string, ts []task.Task, facts func(task.Task) (workflow.Facts, error)) error
Sort orders ts, stably, by the facts view id of def sorts by, each task's facts as facts reads them; a view with no sort keeps their order.
func Specs ¶
func Specs(l *intentload.Loaded) []api.ActionSpec
Specs are the specs in render order: the built-in start group, the intents of l, then the other built-ins. The slice is shared: callers must not change it.
func SpecsFor ¶
func SpecsFor(l *intentload.Loaded, disabled []unit.ProviderID) []api.ActionSpec
SpecsFor are Specs of l without the actions of the disabled plugins, memoized per l and disabled set. The slice is shared: callers must not change it.
func States ¶
func States(f Facts) []api.ActionState
States are every action the row offers now, in the order of the specs.
func Survives ¶ added in v0.4.0
func Survives(loaded func() *intentload.Loaded, facts func(ctx context.Context, t task.Task) (workflow.Facts, error)) func(ctx context.Context, verb string, t task.Task) (bool, error)
Survives is the core's tasks.Survives: the survivor predicate of tasks.toml's verb over task t's facts, as the profile loads now; a verb that names none holds on no task.
func TaskFacets ¶ added in v0.4.0
func TaskFacets(defs []intentload.FacetDef, tasks intentload.TasksDef, contexts []string) []api.FacetSpec
TaskFacets are the profile's task facets as they are served: facets of every row, in the profile's order. A facet that declares no rank takes the order of the values its fact has in tasks (the states, the categories their states declare, an enum property's values) or in contexts, the configured contexts, and the labels of the states.
func TaskFacts ¶ added in v0.3.0
TaskFacts are the facts of t its own fields hold, its properties typed as d declares them; the facts only the task facts provider reads are absent, and read as their zero.
func UnitStates ¶
func UnitStates(f Facts) []api.ActionState
UnitStates are the intents' actions a row of a provider other than GitHub offers now, in the order of the specs: the built-in actions act on pull requests or on the loop's rounds, which such a row has none of.
func Version ¶
func Version(specs []api.ActionSpec) string
Version names the specs, so a client refetches them when it changes.
func VersionFor ¶
func VersionFor(l *intentload.Loaded, disabled []unit.ProviderID) string
VersionFor is Version of SpecsFor.
func VersionOf ¶
func VersionOf(l *intentload.Loaded) string
VersionOf is Version of the specs of l.
func View ¶ added in v0.3.0
View says whether task t, whose facts f holds, is in view id of def, as its when says now. A view over gates, one that lists nothing and one def does not declare hold no task.
func ViewAt ¶ added in v0.3.0
func ViewAt(def intentload.ViewsDef, id string, _ task.Task, f workflow.Facts, now time.Time) (bool, error)
ViewAt is View with now the time the view's when reads as now.
func WithOffers ¶ added in v0.3.0
func WithOffers(states []api.ActionState, offered []string) []api.ActionState
WithOffers are states, then each action of offered they do not hold, enabled: what a plugin offers on its unit.
func WorkspaceRole ¶
WorkspaceRole is the role of the pull request's workspace: the linked one's, else the author's for a pull request that is the user's to develop.
Types ¶
type Config ¶
type Config struct {
AddressReviews, AddressChecks bool
FollowupsWithoutWorkspace, AddressWithoutWorkspace bool
}
Config is the configuration the action slot reads.
type DraftFacts ¶
type DraftFacts struct {
State string
Provider unit.ProviderID
// Disabled is a draft whose plugin is off; NoPublisher one whose plugin posts nothing.
Disabled, NoPublisher bool
// MayHaveBeenPosted is a failed draft whose post may have reached its provider.
MayHaveBeenPosted bool
// Effects are the draft's effects; Workflow the workflow that proposed it, "" for none; Skipped says that
// workflow is stopped on the draft's unit.
Effects []string
Workflow string
Skipped bool
}
DraftFacts are what a draft's actions depend on.
type Facts ¶
type Facts struct {
// PR is the unit of the row's pull request, and Owner and Repo its
// repository; zero on a row of any other unit.
PR unit.Unit
Owner, Repo string
Row api.Row
// Author, Workspace and Override are the pull request's, from its row's
// payload.
Author string
Workspace api.Workspace
Override api.Override
// PendingSince is when the open plan gate an automatic round of the row
// waits on opened; zero for none.
PendingSince time.Time
// HeldByCap is a row whose automatic round the daily cap held.
HeldByCap bool
Tracked bool
Open bool
Mine bool
Muted bool
// MutedStored is a mute kept in the override, active or not.
MutedStored bool
Draft bool
CrossRepository bool
ReviewRequestedMe bool
State, Base string
Question bool
// StartBlocked is a round a start block holds until the user acts.
StartBlocked bool
// TrustFolder is the folder whose trust lifts the start block, "" for
// a block on another question, and TrustHomes the agent homes trusting
// it writes in.
TrustFolder string
TrustHomes []string
// Intakes are the open intakes, the oldest first.
Intakes []Intake
NudgeWho []string
NudgeWhy string
NudgeRefusal string
GateOn, BriefOn bool
Forceable string
Config Config
// Asked is the action a request asks for, whose inputs an open intake
// joins on; zero for a row served to a client.
Asked Asked
Intents *intentload.Loaded
// CapturedByUser is a row of a task the user captured; false for any
// other row, a derived task's included.
CapturedByUser bool
// Recommended is the execution mode recommended for the row's items ("session", "headless"), "" none;
// the row offers every mode's action whatever it says.
Recommended string
}
Facts are what decides the actions a row offers; the action slot of manifest predicates reads the same values through Get.
type GateIntent ¶ added in v0.3.0
type GateIntent struct {
Kind gate.Kind
Intent intentload.GateIntent
Role builtin.GateRole
First bool
}
GateIntent is a row action that resolves an intent of the row's open gate: the gate's kind and the intent, as gates.toml declares them, and whether it is the first of its role, which a row offers beyond its gate.
func RowGateIntent ¶ added in v0.3.0
func RowGateIntent(l *intentload.Loaded, id string) (GateIntent, bool)
RowGateIntent is the row gate intent action id names; false for an id no row gate declares.
func RowGateIntents ¶ added in v0.3.0
func RowGateIntents(l *intentload.Loaded) []GateIntent
RowGateIntents are the intents of the first gate of each kind a row offers, in gates.toml's order, the plan gate's first.
type Intake ¶
Intake is an open intake with the action it carries, "" for a turn by hand, and its request's inputs.
type Lens ¶ added in v0.3.0
type Lens struct {
Loaded func() *intentload.Loaded
Facts func(ctx context.Context, t task.Task) (workflow.Facts, error)
Now func() time.Time
}
Lens places tasks in the profile's views and sorts them, the core's tasks.ViewEval and tasks.ViewSort. Facts reads a task's facts for a view that reads more than its own fields hold; Now is the time a view's when reads as now.
type RoleFacts ¶
type RoleFacts struct {
ReviewWorkspace, AuthorWorkspace bool
// Mine and Adopted tell a pull request the user opened or took over.
Mine, Adopted bool
}
RoleFacts are what run.resolve reads of a pull request to pick the role of its held round.
type Row ¶ added in v0.3.0
type Row struct {
OwedBy string
Askers []string
ExtractionLag time.Duration
Facets map[string][]string
}
Row is what a task's row shows of its facts: who owes its next step (task.owed_by), who waits on you through it (task.askers), how long its links' messages have waited to be extracted (task.extraction_lag), and its values of the profile's facets that read its facts.