builtin

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: 24 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 builtin is the Go vocabulary manifests name: builtins by slot, reserved names and keys, and the facts predicates read. The implementations live in internal/cli and internal/daemon and register at wiring.

Index

Constants

View Source
const (
	WorkspaceReview = "review"
	WorkspaceAuthor = "author"
)

The workspaces of a round on someone else's pull request and on one you develop.

View Source
const (
	EffectPlanCleared    = "plan.cleared"
	EffectGuidanceHanded = "guidance.handed"
	EffectPRRoundSent    = "pr.round_sent"
	EffectPRReviewed     = "pr.reviewed"
	EffectPRAddressed    = "pr.addressed"
	EffectEntryNudged    = "entry.nudged"
	EffectUnitClosed     = "unit.closed"
	EffectPRNudged       = "pr.nudged"
)

The effects code applies by name.

View Source
const (
	DraftPurpose = "draft.purpose"
	DraftEffects = "draft.effects"
)

DraftPurpose and DraftEffects are the approval facts an intent's rules may not read: a turn's agent names its drafts' purpose and effects.

View Source
const (
	RoleReview   = "pr.review"
	RoleAddress  = "pr.address"
	RoleNudge    = "pr.nudge"
	RoleProbe    = "probe"
	RoleHeadless = "headless"
)

The roles Go resolves an intent by (Registry.ByRole).

View Source
const (
	RoundKindReview  = "review"
	RoundKindAddress = "address"
)

The round kinds a role binds: a review round, first or follow-up by the step's stage, and an address round.

View Source
const (
	PolicyRound = "round"
	PolicyProbe = "probe"
)

The agent policies a role binds: a round's, and the probe's.

View Source
const (
	ContextPR        = "pr"
	ContextSynthetic = "synthetic"
)

The contexts a role binds: a real pull request, and a made-up one.

View Source
const (
	StepTurnDismiss  = "turn.dismiss"
	StepAnswerRefuse = "answer.refuse"
	StepClassify     = "classify"
	StepNotifySelf   = "notify.self"
)

The steps whose arguments the grammar names.

View Source
const BriefSlot = "brief"

BriefSlot is the slot of the facts of a unit's brief.

View Source
const BuildsBrief = "brief"

BuildsBrief is what the brief intent builds.

View Source
const ClassifyPrefix = "classify."

ClassifyPrefix names a classify step's output as a fact.

View Source
const CommentForm = `draft.delivery == "comment" as a term of the top-level &&`

CommentForm is how a rule names comment delivery.

View Source
const DraftDelivery = "draft.delivery"

DraftDelivery is the approval fact a rule must pin to "comment" to release a comment draft.

View Source
const DraftSlot = "draft"

DraftSlot is the slot of the facts a workflow's [withdraw] when reads of each draft it proposed.

View Source
const ExtraPrefix = "brief.extra."

ExtraPrefix names a brief's extra field as a fact.

View Source
const GroupStart = "start"

GroupStart is the action group of the actions that start or continue a unit's turn, the intents' default.

View Source
const LaunchProbe = "probe"

LaunchProbe is the launch of a probe: a synthetic pull request in the workspace the request names.

View Source
const PrepareNudge = "nudge.prepare"

PrepareNudge is the prepare that fills a nudge's inputs or refuses it.

View Source
const ReconcileMyReview = "my_review"

ReconcileMyReview reconciles a review turn with the review the viewer published.

View Source
const StepDraftPropose = "draft.propose"

StepDraftPropose is the step that proposes a draft in the Outbox.

View Source
const StepTurnStart = "turn.start"

StepTurnStart is the step that starts an agent turn: its reach is its intent's.

View Source
const WorkspaceLinkedElseMain = "linked_else_main"

WorkspaceLinkedElseMain runs a turn in the workspace linked to its unit, else in the repository's main checkout.

Variables

EntryKinds and EntryStates are a GTD entry's kinds and states.

View Source
var (
	DraftDeliveries = []string{"message", "reaction", "comment"}
	// DraftEmojiDeliveries are the deliveries that post an emoji, which
	// need the reaction argument, and no text.
	DraftEmojiDeliveries = []string{"reaction"}
	DraftItems           = []string{"owed", "resolved", "unowned", "unowned_aged", "all"}
	DraftPer             = []string{"unit", "person"}
	DraftTargets         = []string{"unit", "item"}
	// RepeatForever is repeat_after_sent's value that never proposes again
	// after a draft was sent.
	RepeatForever = "forever"
)

The values of draft.propose's arguments.

View Source
var ActionFacts = slices.Concat(rowActionFacts, draftActionFacts)

ActionFacts are the facts only the action slot reads, what a row offers decides on them, then the draft actions' facts.

View Source
var ActionGroups = []string{GroupStart, "turn", "control", "workspace", "brief", "intake"}

ActionGroups are the groups an action is listed under.

View Source
var ActionKeys = map[string]string{
	"open":      "O",
	"take_over": "A",
	"skip":      "S",
	"pause":     "H",
	"resume":    "H",
	"run_now":   "R",
	"mute":      "M",
	"unmute":    "M",
	"answer":    "W",
	"continue":  "C",
	"dismiss":   "X",
	"guide":     "G",
	"trust_run": "T",
	"unblock":   "D",
}

ActionKeys are the keys of the built-in actions, by id; internal/keys holds the rule they follow.

View Source
var ActionSurfaces = []string{"row", "detail", "tui", "menubar", "notification", "cli", "explore"}

ActionSurfaces are where an action may be offered.

View Source
var Associations = []string{"OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MANNEQUIN", "NONE"}

Associations are GitHub's author associations.

AutoOnly are the approval facts only a workflow's rules and the configuration's read.

View Source
var Boards = []string{"review", "author"}

Boards are the workspaces whose board an intent's turns move: a turn in the review or the author workspace moves that board, any other none.

View Source
var BriefSubjects = []string{"pr", "slack", "entry"}

BriefSubjects are the workflow slots whose units may have a brief, which read the brief slot's facts.

View Source
var Builds = []string{BuildsBrief}

Builds are what a builder intent may build.

View Source
var BuiltinActionIDs = []string{
	"run_now", "skip", "guide", "trust_run", "unblock",
	"answer", "continue", "dismiss",
	"take_over", "pause", "resume", "mute", "unmute", "track", "untrack",
	"open", "remove", "remove_force",
	"brief_refresh", "intake_without", "intake_cancel",
	"draft.approve", "draft.edit", "draft.discard", "draft.retry",
	"plan_apply", "plan_dismiss", "plan_guide",
}

BuiltinActionIDs are the built-in actions actions.toml words, one table each: a row's, a draft's and a plan item's. plan_guide is the plan item's guide, whose wire id is guide.

View Source
var ConfigTiers = cfgValues("fast", "balanced", "frontier")

ConfigTiers are the model tiers a configured call takes, the set core/turns.Tiers holds.

View Source
var DraftRefusals = []string{"", "plugin_off", "state", "posts_nothing"}

DraftRefusals are why a draft's action is disabled: its plugin is off, the draft is in a state the action does not move it from, or its plugin posts nothing.

View Source
var Effects = []Effect{
	{EffectPlanCleared, "", AppliesTurn, "Drops the unit's pending plan items.", false},
	{EffectGuidanceHanded, unit.GitHub, AppliesTurn, "Hands the guidance queued on the pull request to the turn, and queues it back when the turn is not sent.", false},
	{EffectPRRoundSent, unit.GitHub, AppliesTurn, "Records the round-sent event on the pull request.", false},
	{EffectPRReviewed, unit.GitHub, AppliesTurn, "Writes the plugin mark reviewed: the reviews the round covered, once its review is submitted.", false},
	{EffectPRAddressed, unit.GitHub, AppliesTurn, "Writes the plugin marks addressed.*: the reviews, checks and conflict the address round covered.", false},
	{EffectEntryNudged, "", AppliesDraft, "Stamps the last nudge of the draft's entry, or of every live waiting entry of its unit when it names none.", false},
	{EffectUnitClosed, "", AppliesDraft, "Records the closure of the draft's unit, which ends its close entry and unwatches it after its warm period; through the unit's plugin.", true},
	{EffectPRNudged, unit.GitHub, AppliesTurn | AppliesDraft, "Records the nudged event on the pull request, which the nudge refusal reads: when its turn is sent, or as the GitHub publisher posts its draft.", false},
}

Effects is the effect vocabulary of turns and drafts.

View Source
var ErrRuleMarks = errors.New("a rule reads no marks: handled() is for a workflow's when")

ErrRuleMarks refuses a rule's when that calls handled().

View Source
var Facts = slices.Concat(intentPRFacts, ActionFacts, otherFacts)

Facts are the fields predicates read, by slot; inputs.<name> are added per intent by Env. A workflow fact may share a name with an intent fact.

View Source
var Grammar = slices.Concat(intentGrammar, workflowGrammar, stepGrammar, actionsGrammar, configGrammar, profileGrammar)

Grammar is every reserved key of the language.

View Source
var InputTypes = map[string]expr.Type{"bool": expr.Bool, "text": expr.String, "list": expr.List}

InputTypes are the types an input declares, with the type its fact has.

IntentDims are the profile dimensions a manifest's dims may list.

IntentVerbs are the gtd verbs a manifest's verb may name: those an entry bridges to its unit's served action.

View Source
var Marks = []Mark{
	{round.AddressedReviews, "The newest review an address round triaged on a pull request you develop, a time: handled(\"addressed.reviews\", <time>)."},
	{round.AddressedChecks, "The head whose failing checks an address round covered: handled(\"addressed.checks\", pr.head)."},
	{round.AddressedConflict, "The head whose conflict with the base an address round covered: handled(\"addressed.conflict\", pr.head)."},
}

Marks are the plugins' marks a workflow may read. reviewed is not one: its value is a fingerprint no fact has.

Names are the builtins a manifest names, by the key that names them.

View Source
var NoRole = Role{Context: ContextPR, Policy: PolicyRound}

NoRole is what an intent without a role binds.

View Source
var PRRowKinds = []string{"round_pending", "loop_waiting", "loop_stopped", "blocked", "to_address", "held", "loop_working",
	"changes", "checks", "conflicts", "reply", "reviewer_back", "review", "no_reviewer", "merge", "draft", "muted", "done"}

PRRowKinds are a pull request row's situation kinds, as the cockpit ranks them.

View Source
var PRStates = []string{"OPEN", "CLOSED", "MERGED"}

PRStates are a pull request's states as GitHub spells them.

View Source
var PayloadProviders = map[string]unit.ProviderID{"PR": unit.GitHub}

PayloadProviders are the template roots a provider's payload alone holds, which only an intent of that provider may read.

View Source
var Providers = slices.Sorted(maps.Keys(Slots))

Providers are the providers an intent may serve: those of Slots, and a plugin whose units have no workflow facts adds its own.

RecordStates are the states a manifest's record.states may list.

View Source
var ReservedFlags = []string{"--no-wait", "--no-brief", "--turn", "--help"}

ReservedFlags are flags the CLI owns; no input may declare them.

View Source
var ReservedNames = []string{
	"app", "brief", "config", "doctor", "eval-instructions", "explore", "help", "hook", "init", "install",
	"instructions", "intake", "mute", "open", "outbox", "pause", "plan", "profile", "remove", "resume",
	"serve", "slack", "status", "store", "take-over", "timings", "track", "trust", "tui", "turn", "uninstall", "unmute", "untrack",
	"version", "workflows",

	"answer", "brief_refresh", "continue", "dismiss", "guide", "intake_cancel", "intake_without", "remove_force", "skip",
	"plan_apply", "plan_dismiss", "run_now", "take_over", "trust_run", "unblock",

	"eval", "intents", "settings", "tags", "try",

	"association", "base", "kind", "label", "organization", "repo", "reviewer", "risk", "size", "stage", "team", "user",
}

ReservedNames are names a user intent may not take: CLI commands, built-in action ids, profile words, dimensions. The loader checks them against user layers only.

View Source
var ReviewStates = []string{"", "APPROVED", "CHANGES_REQUESTED", "COMMENTED", "DISMISSED", "PENDING"}

ReviewStates are GitHub's review states, and the empty value of no review.

View Source
var Roles = []Role{
	{Name: RoleReview, Doc: "The review round on someone else's pull request, in its review workspace: first or follow-up, reconciled with the review you published; it drives its workspace's row.",
		Provider: unit.GitHub, RoundKind: RoundKindReview, Reconcile: ReconcileMyReview, Workspace: WorkspaceReview, Context: ContextPR, Policy: PolicyRound, DrivesRow: true},
	{Name: RoleAddress, Doc: "The address round on a pull request you develop, in its author workspace: its reviews, failing checks and conflicts; its instructions say why it is due; it drives its workspace's row.",
		Provider: unit.GitHub, RoundKind: RoundKindAddress, Workspace: WorkspaceAuthor, Context: ContextPR, Policy: PolicyRound, DrivesRow: true},
	{Name: RoleNudge, Doc: "The nudge on a pull request: nudge.prepare fills its inputs from who the pull request waits on, or refuses it.",
		Provider: unit.GitHub, Prepare: PrepareNudge, Context: ContextPR, Policy: PolicyRound},
	{Name: RoleProbe, Doc: "The probe of an agent home: a synthetic pull request in the workspace the request names, under the probe's policy.",
		Provider: unit.GitHub, Launch: LaunchProbe, Context: ContextSynthetic, Policy: PolicyProbe},
	{Name: RoleHeadless, Doc: "The intent a headless turn on a unit runs when its request names none.",
		Context: ContextPR, Policy: PolicyRound},
}

Roles are what Go resolves an intent by, a manifest's role.

View Source
var RoundProviders = []unit.ProviderID{unit.GitHub}

RoundProviders are the providers whose plugin keeps a per-unit count of turns: every automated turn.start on their units spends turns.per_unit_per_day; a workflow starting turns on any other must set limits.per_day.

View Source
var Slots = map[unit.ProviderID]string{unit.GitHub: "pr", unit.Session: "session", unit.Workspace: "workspace",
	unit.Entry: "entry", dslack.Provider: "slack"}

Slots name each provider's fact slot.

View Source
var Stages = []string{"first", "follow-up"}

Stages are the passes over a unit: the first, and each one after.

View Source
var Steps = []StepDef{
	{"session.close", providers(unit.Session), workflow.ReachLocal, nil,
		"Closes the agent session."},
	{"workspace.remove", providers(unit.Workspace), workflow.ReachLocal, nil,
		"Removes the workspace, after its guards. Never with `force`: a manifest that sets it fails to load."},
	{"workspace.unregister", providers(unit.Workspace), workflow.ReachLocal, nil,
		"Unregisters a workspace whose path is gone."},
	{StepTurnDismiss, providers(unit.Session, unit.GitHub), workflow.ReachLocal, nil,
		"Dismisses the open turn, recording the reason."},
	{StepAnswerRefuse, providers(unit.GitHub), workflow.ReachLocal, nil,
		"Refuses a queued answer whose route is gone."},
	{"session.mark_dormant", providers(unit.Session), workflow.ReachLocal, nil,
		"Marks dormant an active session whose process its manager's census no longer lists: the session stays open, and the next turn wakes it."},
	{StepTurnStart, nil, "", nil,
		"Starts a turn of `intent` on the unit, which the intent must serve; `stage` (`first` or `follow-up`) for a review; `runner` (`session` or `headless`), by default the intent's first runner. On a pull request, caps, the brief, busy and held checks apply as for any automatic round; on any other unit, the workflow's `limits.per_day` and `turns.per_day`."},
	{StepDraftPropose, nil, workflow.ReachLocal, nil,
		"Proposes a draft in the Outbox: `purpose` (a label), `delivery` (`message`, `reaction` or `comment`), `text` (a template in the workflow's directory, by default `text.md.tmpl`), `reaction` (an emoji name), `items` (`owed`, `resolved`, `unowned`, `unowned_aged` or `all`), `per` (`unit` or `person`), `target` (`unit` or `item`), `effects` (the effects sending it applies), `repeat_after` (the least time after a settled draft of the same person, a duration or a duration of the config such as `config.drafts.repeat_after`) and `repeat_after_sent` (the same after a sent one, or `forever`). Holds while a draft of the workflow, unit and person is open or failed; a run that leaves a person under a delay that ends with time stays pending until it ends."},
	{StepClassify, nil, workflow.ReachLocal, []workflow.TriggerKind{workflow.TriggerEvent},
		"A headless classification whose output becomes facts: `prompt` (a file in the workflow's directory, by default `prompt.md`) and `schema` (the JSON schema its answer follows, by default `schema.json`). Event triggers only, cached by fingerprint, under `classify.per_day`."},
	{StepNotifySelf, nil, workflow.ReachPrivate, nil,
		"A private notification: `text` (a template in the workflow's directory, by default `text.md.tmpl`, over `.Workflow`, `.Unit` and `.Facts`, the unit's facts by name, such as `{{index .Facts \"pr.slug\"}}`, none once the unit is gone)."},
}

Steps is the step vocabulary of workflow manifests.

View Source
var TurnRunners = []string{"session", "headless"}

TurnRunners are the values of turn.start's runner.

TurnStates are the states a turn is in, and the empty value of none.

View Source
var Visibilities = []string{"public", "private", "internal"}

Visibilities are a repository's visibilities, lowercased as the GitHub adapter reads them.

View Source
var WorkflowSlots = []string{"pr", "session", "workspace", "entry", "slack", "brief", "draft", "trigger", "config"}

WorkflowSlots are the slots of workflow facts: each provider's, then the brief's, the draft's, the trigger's and the config's.

Functions

func ApprovalEnv added in v0.2.0

func ApprovalEnv(auto bool, slots ...string) expr.Env

ApprovalEnv is the env of a [drafts.approval] rule's when: the approval slot's facts, without AutoOnly unless auto, and the facts of each of slots, never a brief's, which an agent writes.

func ApprovalRule added in v0.2.0

func ApprovalRule(when string, a draft.Approval, env expr.Env) (draft.Rule, error)

ApprovalRule is the [drafts.approval] rule of a whose when is compiled over env. It names comment delivery when its top-level conjunction holds draft.delivery == "comment", the only way a rule releases a comment.

func BoardOf added in v0.2.0

func BoardOf(workspace string) string

BoardOf is the board a turn in workspace moves, "none" for none.

func DynamicFacts added in v0.2.0

func DynamicFacts(src string) []string

DynamicFacts are the brief.extra.* and classify.* facts src names outside its string literals: facts the profile declares, untrusted whatever their name, which a check without the profile cannot type.

func EffectNames added in v0.2.0

func EffectNames() []string

EffectNames are the names of the draft effects: what a draft's effects, a draft.propose's effects and an intent's allowed_effects list.

func EnumProblem added in v0.2.0

func EnumProblem(v string, values []Value) (msg, near string)

EnumProblem says why v is none of values, "" when it is one: the values and the near one, never a value that releases, which a guess must not turn a typo into.

func Env

func Env(slot FactSlot, inputs []dintent.Input) expr.Env

Env is the slot's facts plus, for the turn slot, the intent's declared inputs.

func ExtraFacts added in v0.2.0

func ExtraFacts(props []jsonschema.Property) expr.Env

ExtraFacts are the brief.extra.<name> facts the brief intent's extra schema declares, typed from its properties: a string (with or without an enum), an integer, a boolean or an array of strings, the types the loader lets a builder's schema hold. A predicate's env is extended with them at load, so naming an undeclared extra fails there.

func FactProvider

func FactProvider(name string) unit.ProviderID

FactProvider is the provider whose units an intent fact describes; "" for a fact of every provider, or a name that is no intent fact.

func FactType

func FactType(name string) (expr.Type, bool)

FactType is the type of the workflow fact name.

func IsPredKey added in v0.2.0

func IsPredKey(last string) bool

IsPredKey says whether a key named last holds a predicate somewhere in the language, so a value written without quotes gets the quoting hint.

func IsUntrusted added in v0.2.0

func IsUntrusted(name string) bool

IsUntrusted says whether a rule may not trust the fact name: an agent or a third party sets its value. A brief's extra fields and a classification's output are untrusted whatever their name.

func Narrow added in v0.2.0

func Narrow(env expr.Env, providers []unit.ProviderID)

Narrow closes, in env, each fact whose values are declared per provider to the values of providers: their union when each of them declares a set, and any value when one does not or providers is empty.

func NeverReleasesComment added in v0.2.0

func NeverReleasesComment(r draft.Rule) bool

NeverReleasesComment says that r releases, reads draft.delivery and pins it to no delivery, yet does not name comment delivery: a form such as draft.delivery in ["comment"] reads as one that may release a comment, and never does.

func OrList added in v0.2.0

func OrList(names []string) string

OrList is names quoted, as "a", "b" or "c".

func PREnv

func PREnv() expr.Env

PREnv is the pull request's own facts of the turn slot, the ones a turn reads before it is built.

func RoleNames added in v0.2.0

func RoleNames() []string

RoleNames are the names of Roles.

func StepArgs added in v0.2.0

func StepArgs(use string) []string

StepArgs are the arguments step use takes, in the grammar's order.

func TimeVarying added in v0.2.0

func TimeVarying(name string) bool

TimeVarying says whether the workflow fact name changes as time passes with nothing else changing; false for a name that is no workflow fact.

func TurnEffectNames added in v0.2.0

func TurnEffectNames() []string

TurnEffectNames are the names of the turn effects: what an intent's effects list.

func UnitSlots added in v0.2.0

func UnitSlots() []string

UnitSlots are the workflow slots of every provider's units.

func ValueNames added in v0.2.0

func ValueNames(values []Value) []string

ValueNames are the names of values.

func WithdrawEnv added in v0.2.0

func WithdrawEnv(slot string) expr.Env

WithdrawEnv is the env of a workflow's [withdraw] when: WorkflowEnv(slot) and the draft slot's facts.

func WorkflowEnv

func WorkflowEnv(slot string) expr.Env

WorkflowEnv is the env of a workflow's when: the facts of slot, the brief's when slot is one of BriefSubjects, trigger.* and config.*.

func WorkflowEnvAll

func WorkflowEnvAll() expr.Env

WorkflowEnvAll is WorkflowEnv over every slot, for a predicate whose workflow is not known yet.

Types

type Applies added in v0.2.0

type Applies int

Applies says what an effect applies on: a sent turn (an intent's effects) or a sent draft (a draft.propose's effects and an intent's [drafts] allowed_effects).

const (
	AppliesTurn Applies = 1 << iota
	AppliesDraft
)

type Effect added in v0.2.0

type Effect struct {
	Name string
	// Provider is the provider whose turns or drafts alone may name it; ""
	// any.
	Provider unit.ProviderID
	Applies  Applies
	Doc      string
	// Plugin says a draft effect applies through the unit's plugin, so it
	// waits while that plugin is not built.
	Plugin bool
}

Effect is what sending a turn or a draft applies, by name.

func EffectOf added in v0.2.0

func EffectOf(name string) (Effect, bool)

EffectOf is the effect named name.

type Fact

type Fact struct {
	Name  string
	Type  expr.Type
	Slots []FactSlot
	Doc   string
	Slot  string // a workflow fact's slot: one of WorkflowSlots
	// Provider is the provider whose intents alone may read the fact; "" for every provider.
	Provider unit.ProviderID
	// Subjects are the workflow slots besides Slot whose when reads the
	// fact: the brief slot's facts are read on every unit that has a brief.
	Subjects []string
	// Dim makes the fact a profile dimension: a block path condition under
	// the intents of its provider.
	Dim bool
	// Enum are the fact's values by provider, "" standing for every
	// provider; a provider absent takes any value.
	Enum map[unit.ProviderID][]string
	// Untrusted says that a third party's text, read by the extraction, the
	// proposing turn itself or an agent's brief sets the fact's value, so
	// no [drafts.approval] rule may read it.
	Untrusted bool
	// TimeVarying says that the fact changes as time passes with nothing
	// else changing, so no workflow key may hold it.
	TimeVarying bool
}

type FactSlot

type FactSlot string
const (
	ActionSlot   FactSlot = "action"
	TurnSlot     FactSlot = "turn"
	WorkflowSlot FactSlot = "workflow"
	// ApprovalSlot holds the draft's own facts a [drafts.approval] rule
	// reads besides its unit's.
	ApprovalSlot FactSlot = "approval"
)
const DraftActionSlot FactSlot = "draft_action"

DraftActionSlot holds the facts the texts of a draft's built-in actions read.

type Key added in v0.2.0

type Key struct {
	Path string
	In   Surface
	// Step is the step whose argument the key is, for In == SurfaceStep.
	Step string
	Kind Kind
	// Elem is a list's element kind, for Kind == KindList.
	Elem Kind
	// Values are an enum's values, from the table that owns the set.
	Values  func() []Value
	Default string
	Doc     string
	// Required says that the table holding the key must set it.
	Required bool
}

Key is one reserved key of the language. Path is dotted, "[]" marks an array of tables and "*" a name the author chooses: "action.refuse[].why", "inputs.*.type", "workflows.*.approval.mode".

func StepArg added in v0.2.0

func StepArg(use, k string) (Key, bool)

StepArg is the grammar row of step use's argument k.

func StepFiles added in v0.2.0

func StepFiles(use string) []Key

StepFiles are the rows of step use's arguments that name a file beside the manifest, which the loader reads. draft.propose reads its text as it renders, since an emoji draft has none.

type Kind added in v0.2.0

type Kind int

Kind is what a key's value is.

const (
	KindPred     Kind = iota + 1 // a predicate's source
	KindFact                     // a fact's name
	KindTemplate                 // an inline text/template
	KindFile                     // a file beside the manifest
	KindEnum                     // one of Values
	KindDur                      // a duration (internal/domain/duration)
	KindBool
	KindInt
	KindText
	KindList // a list of Elem
	KindTable
	KindMap    // a table whose keys an author names
	KindAny    // more than one form, which its decoder reads
	KindNumber // an integer or a decimal
)

type Mark added in v0.2.0

type Mark struct {
	Name, Doc string
}

Mark is a mark a plugin writes that a workflow may read with handled().

type Problem added in v0.2.0

type Problem struct {
	Path string
	Msg  string
	// Near is the value or key the message suggests, "" when none.
	Near string
	// Unknown says that no row names the key.
	Unknown bool
}

Problem is a key Check refuses, at its dotted path in the document.

func Check added in v0.2.0

func Check(surface Surface, doc map[string]any) []Problem

Check walks doc, a document of surface decoded without a schema (a TOML table or a JSON object as map[string]any), against the grammar: unknown keys and values, with did-you-mean, kinds and enums. A surface the grammar has no row of is not checked.

func CheckStep added in v0.2.0

func CheckStep(use string, args map[string]any) []Problem

CheckStep is Check on the arguments of a workflow step, use, without use itself.

type Role added in v0.2.0

type Role struct {
	Name string
	Doc  string
	// Provider is the provider whose units the role's turns run on; "" any.
	Provider unit.ProviderID
	// RoundKind is the sweep round its turns are; "" none.
	RoundKind string
	// Reconcile, Prepare, Launch: builtins its turns run; "" none.
	Reconcile, Prepare, Launch string
	// Workspace is the workspace builtin its holder names; "" any.
	Workspace string
	// Context is what its turn is about; Policy the agent policy of its
	// sessions.
	Context, Policy string
	// DrivesRow says its turns drive the row of the workspace they run in;
	// a user intent taking the role takes it over.
	DrivesRow bool
}

Role is what an intent's role binds it to: the plugin mechanism Go runs its turns with.

func RoleOf added in v0.2.0

func RoleOf(name string) (Role, bool)

RoleOf is the role named name; NoRole and false when there is none.

type Slot

type Slot string
const (
	SlotWorkspace Slot = "workspace"
	SlotBefore    Slot = "before"
)

type StepDef

type StepDef struct {
	Name      string
	Providers []unit.ProviderID      // empty means any
	Reach     workflow.Reach         // "" for turn.start: the intent decides
	Trigger   []workflow.TriggerKind // empty means any
	Doc       string
}

StepDef is a workflow step the engine can run: the providers whose units it acts on, its reach, the triggers it runs under and what it does. Its arguments are its rows of the grammar (StepArgs).

type SubjectsError added in v0.2.0

type SubjectsError struct{ Subjects []string }

SubjectsError refuses a rule's when that reads the facts of two subjects, which no draft has.

func (*SubjectsError) Error added in v0.2.0

func (e *SubjectsError) Error() string

type Surface added in v0.2.0

type Surface string

Surface is a file kind of the profile language, or the configuration.

const (
	SurfaceIntent   Surface = "intent"   // intents/<name>/intent.toml
	SurfaceWorkflow Surface = "workflow" // workflows/<name>/workflow.toml
	SurfaceStep     Surface = "step"     // a workflow step's arguments
	SurfaceActions  Surface = "actions"  // actions.toml
	SurfaceDefaults Surface = "defaults" // defaults.toml
	SurfaceLabels   Surface = "labels"   // labels.toml
	SurfaceBlock    Surface = "block"    // a judgment block's front matter
	SurfaceConfig   Surface = "config"   // config.json
)

type UntrustedError added in v0.2.0

type UntrustedError struct{ Fact string }

UntrustedError refuses a rule's when that reads an untrusted fact.

func (*UntrustedError) Error added in v0.2.0

func (e *UntrustedError) Error() string

type Value added in v0.2.0

type Value struct {
	Name string
	Doc  string
	// Releases says that the value lets a send or a run go with no person
	// approving it, which no did-you-mean suggests.
	Releases bool
}

Value is one value of an enum key.

func DraftModes added in v0.2.0

func DraftModes() []Value

DraftModes are the draft approval's modes, from draft.ApprovalModes.

func NameValues added in v0.2.0

func NameValues(slot Slot) []Value

NameValues are the builtins of slot, with what each is.

func RunModes added in v0.2.0

func RunModes() []Value

RunModes are the run approval's modes, from workflow.ApprovalModes.

func StepValuesOf added in v0.2.0

func StepValuesOf(use, arg string) []Value

StepValuesOf are the values of step use's enum argument arg.

func ValuesOf added in v0.2.0

func ValuesOf(surface Surface, path string) []Value

ValuesOf are the values of the enum key at path of surface, the table's set that a decoder checks a value against; nil when the key is no enum.

Directories

Path Synopsis
cmd
factsdoc command
Command factsdoc prints the facts reference page: the intents' facts and the workflow facts, each grouped by slot, the draft approval facts, the workflow steps, then the draft effects.
Command factsdoc prints the facts reference page: the intents' facts and the workflow facts, each grouped by slot, the draft approval facts, the workflow steps, then the draft effects.
grammardoc command
Command grammardoc writes what the grammar table derives: the JSON schemas of the profile files and the configuration, the generated tables of the manifest and configuration reference pages, and the language page.
Command grammardoc writes what the grammar table derives: the JSON schemas of the profile files and the configuration, the generated tables of the manifest and configuration reference pages, and the language page.

Jump to

Keyboard shortcuts

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