catalog

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 30 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 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

View Source
const (
	SurfaceRow    = "row"
	SurfaceDetail = "detail"
	// SurfaceTask is a task's page, which offers the actions of the units the task holds.
	SurfaceTask         = "task"
	SurfaceTUI          = "tui"
	SurfaceMenubar      = "menubar"
	SurfaceNotification = "notification"
	SurfaceCLI          = "cli"
	SurfaceExplore      = "explore"
)

The surfaces an action spec names.

View Source
const (
	OriginBuiltin = iota
	OriginBundled
	OriginUser
)

The origins of an action spec, in the order a shared verb ranks them.

View Source
const (
	BasisPending = "pending:"
	BasisHeld    = "held:"
)

BasisPending and BasisHeld prefix the basis of the plan gate's first approving intent.

View Source
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.

View Source
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.

View Source
const (
	PlanApply   = "plan_apply"
	PlanDismiss = "plan_dismiss"
)

The ids of a plan item's own actions.

View Source
const (
	ScopeUnit  = "unit"
	ScopeItem  = "item"
	ScopeDraft = "draft"
	ScopeRun   = "run"
)

The scopes of an action spec: what the action acts on.

View Source
const (
	RoleReview = "review"
	RoleAuthor = "author"
)

The workspace roles a held round resolves its intent by, as a manifest's workspace names them.

View Source
const CopyReviewRequest = "copy_review_request"

CopyReviewRequest is the built-in action whose only effect is its copy: a review request to paste in a chat.

View Source
const SourceBuiltin = "builtin"

SourceBuiltin is the Source of an action spec Go declares.

View Source
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 Copy added in v0.5.0

func Copy(l *intentload.Loaded, id string, f CopyFacts) (*api.Copy, string, error)

Copy is what built-in action id gives the person to copy over f, with what the client says once it copied; nil when the action's table under l has no copy.

func DraftFacets added in v0.7.0

func DraftFacets(defs []intentload.FacetDef) []api.FacetSpec

DraftFacets are the profile's draft facets as they are served, in the profile's order.

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

func FactFacets(defs []intentload.FacetDef, f workflow.Facts) map[string][]string

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

func GateView(def intentload.ViewsDef, id string, g gate.Gate, f workflow.Facts) (bool, error)

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

func JoinDiffers(d dintent.Def, open, req map[string]any) string

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

func JoinRefusalText(seq int64, intent, how string) string

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

func OfferFacts(e task.Task) workflow.Facts

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

func PropFacts(t task.Task, d intentload.TasksDef) workflow.Facts

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

func ResolveRun(reg *dintent.Registry, role string) (dintent.Def, bool)

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

func RunActions(f RunFacts) []string

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

func SessionWithout(seq int64) string

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 SortBy added in v0.7.0

func SortBy[T any](def intentload.ViewsDef, id string, items []T, facts func(T) (workflow.Facts, error)) error

SortBy orders items, stably, by the facts view id of def sorts by, each item'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

func TaskFacts(t task.Task, d intentload.TasksDef) workflow.Facts

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

func View(def intentload.ViewsDef, id string, t task.Task, f workflow.Facts) (bool, error)

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

func WorkspaceRole(f RoleFacts) string

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 Asked

type Asked struct {
	Name   string
	Inputs map[string]any
}

Asked is an action a request asks for, with its inputs.

type Config

type Config struct {
	AddressReviews, AddressChecks                      bool
	FollowupsWithoutWorkspace, AddressWithoutWorkspace bool
}

Config is the configuration the action slot reads.

type CopyFacts added in v0.5.0

type CopyFacts struct {
	Row   api.Row
	Brief *api.Brief
}

CopyFacts are what the copy texts of a built-in action read: the row of the unit it runs on and the unit's brief, nil when it has none.

func (CopyFacts) Get added in v0.5.0

func (f CopyFacts) Get(name string) any

Get resolves a fact of the copy slot by its dotted name; nil for one the slot does not have.

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.

func (Facts) Get

func (f Facts) Get(field string) any

Get resolves a fact of the action slot by its dotted name; nil for one the slot does not have.

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

type Intake struct {
	api.Intake
	Action      string
	Inputs      map[string]any
	FromSession bool
}

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.

func (Lens) Eval added in v0.3.0

func (l Lens) Eval(ctx context.Context, view string, t task.Task) (bool, error)

Eval says whether t is in view.

func (Lens) Sort added in v0.3.0

func (l Lens) Sort(ctx context.Context, view string, ts []task.Task) error

Sort orders a view's tasks as the profile sorts it.

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.

type RunFacts added in v0.3.0

type RunFacts struct {
	Workspace, Session, Transcript bool
}

RunFacts are what a run's actions depend on: its workspace in a manager, a session not closed, and an agent transcript.

Jump to

Keyboard shortcuts

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