intent

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 45 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 intent loads intent manifests from the bundled profile and the user's layers into one registry; import it as intentload.

Index

Constants

View Source
const (
	WorkspaceNameName = "workspace.name"
	TargetTitleName   = "target.title"
)

WorkspaceNameName and TargetTitleName are the names workspace.name and target.title are parsed under.

View Source
const ActionsFile = "actions.toml"

ActionsFile is the profile file that words the built-in actions.

View Source
const DecisionsFile = "decisions.toml"

DecisionsFile maps gates, and each plugin's situations and signals, to decision kinds, and words each kind.

View Source
const DefaultChanged = "The head moved since the question: re-check what changed before acting on the answer."

DefaultChanged is resume.changed when a manifest leaves it out: the generic sentence of resume.md.tmpl.

View Source
const DefaultsFile = "defaults.toml"

DefaultsFile is the profile file of the manifests' defaults, read from the bundled profile and then each layer, a later layer's key winning.

View Source
const GatesFile = "gates.toml"

GatesFile is the profile file that declares and words the gates.

View Source
const HomeFile = "home.toml"

HomeFile is the profile file of the cockpit's home.

View Source
const HomeView = "home"

HomeView is the cockpit's home route, which no view may be named.

View Source
const KeysFile = "keys.toml"

KeysFile is the profile file that words the core keys' help.

View Source
const NoticesFile = "notices.toml"

NoticesFile is the profile file that words what the loop tells a session.

View Source
const OmniboxFile = "omnibox.toml"

OmniboxFile is the profile file of the omnibox: how a search groups its results, and the known verbs.

View Source
const PlanView = "plan"

PlanView is the cockpit's plan route, the core's screen of every workflow's plan, which no view may be named; its label is the "Plan" text of strings.toml.

View Source
const PredicatesFile = "predicates.toml"

PredicatesFile sets the predicates a plugin's manifest declares, in the plugin's layers.

View Source
const RecentView = "recent"

RecentView is the cockpit's recent route, the core's feed of the newest events of every unit the loop follows, which no view may be named; its label is the "Recent" text of strings.toml.

View Source
const RecordsFile = "records.toml"

RecordsFile is the profile file that declares the record kinds.

View Source
const SessionNameName = "session.name"

SessionNameName is the name session.name is parsed under.

View Source
const StringsFile = "strings.toml"

StringsFile holds the texts the clients show, by their English text, and the formats of the Go clients.

View Source
const TasksFile = "tasks.toml"

TasksFile is the profile file that declares the task properties and states and words the verbs a task offers.

View Source
const TimelineFile = "timeline.toml"

TimelineFile words the core's event kinds and declares the facts a timeline folds its events into.

View Source
const ToolsFile = "tools.toml"

ToolsFile is the profile file that describes the MCP tools.

View Source
const UIFile = "ui.toml"

UIFile is the file of a plugin's profile layer that words the views, facets, situations and menu bar sections its manifest declares.

View Source
const ViewsFile = "views.toml"

ViewsFile is the profile file that declares the views, the review and the badge.

View Source
const WhyName = "manifest.why"

The names the manifest's other inline templates are parsed under in an intent's template set.

Variables

View Source
var ActionFuncs = template.FuncMap{"join": strings.Join, "name": func() string { return brand.Name }, "command": func() string { return brand.Command }}

ActionFuncs are the functions action texts may call.

View Source
var ActionsSchema []byte

ActionsSchema is the JSON Schema of actions.toml, for editors.

View Source
var ByFacts = []string{"task.id", "task.state", "task.category", "task.unit", "task.unit_provider"}

ByFacts are the facts a verb's by reads besides the task.prop.* of tasks.toml: the task's own, which the authority reads off the task with no facts provider at hand.

View Source
var ConfigSchema []byte

ConfigSchema is the JSON Schema of config.toml, for editors.

View Source
var DecisionsSchema []byte

DecisionsSchema is the JSON Schema of decisions.toml, for editors.

View Source
var GateKinds = slices.DeleteFunc(slices.Clone(gate.Kinds), func(k gate.Kind) bool { return k == gate.KindDraft || k == gate.KindPlan })

GateKinds are the kinds of the gates a workflow's gate.open steps open: every kind but draft and plan, which its drafts and runs are.

View Source
var GatesSchema []byte

GatesSchema is the JSON Schema of gates.toml, for editors.

View Source
var HomeSchema []byte

HomeSchema is the JSON Schema of home.toml, for editors.

View Source
var KeysSchema []byte

KeysSchema is the JSON Schema of keys.toml, for editors.

View Source
var NameFuncs = template.FuncMap{"slug": slug, "firstLine": firstLine, "title": title}

NameFuncs are the functions a manifest's names may call: slug, a text as lowercase words joined by dashes; firstLine, its first non-blank line, trimmed; and title n, that line without its markdown heading marks, cut at its last whole word within n runes.

View Source
var OmniboxSchema []byte

OmniboxSchema is the JSON Schema of omnibox.toml, for editors.

View Source
var OwedFacts = []string{"task.owed_by", "task.owed_since", "task.check_on"}

OwedFacts are the task facts owed_by.expr may not read: those its value makes.

View Source
var RecordsSchema []byte

RecordsSchema is the JSON Schema of records.toml, for editors.

View Source
var Schema []byte

Schema is the JSON Schema of intent.toml, for editors (Taplo's #:schema directive).

View Source
var StringsSchema []byte

StringsSchema is the JSON Schema of strings.toml, for editors.

View Source
var TasksSchema []byte

TasksSchema is the JSON Schema of tasks.toml, for editors.

View Source
var TimelineSchema []byte

TimelineSchema is the JSON Schema of timeline.toml, for editors.

View Source
var ViewsSchema []byte

ViewsSchema is the JSON Schema of views.toml, for editors.

View Source
var WorkflowSchema []byte

WorkflowSchema is the JSON Schema of workflow.toml, for editors.

Functions

func ActionFactMap

func ActionFactMap(get func(name string) any) map[string]any

ActionFactMap nests dotted action facts into the map action texts execute over: {"pr": {"slug": ...}, "row": {"question": ...}}.

func ActionText added in v0.2.0

func ActionText(funcs template.FuncMap, path, src string, sample map[string]any) (*template.Template, error)

ActionText parses an action text named path with funcs and executes it once over sample, so a text that cannot render fails at load.

func BundledGates added in v0.3.0

func BundledGates(bundled fs.FS) (GatesDef, Problems)

BundledGates is the gates.toml of bundled alone.

func BundledKeys added in v0.3.0

func BundledKeys(bundled fs.FS) (KeyTexts, Problems)

BundledKeys is the key help of the bundled profile alone.

func BundledTasks added in v0.3.0

func BundledTasks(bundled fs.FS) (TasksDef, Problems)

BundledTasks is the bundled profile's tasks.toml alone.

func BundledViews added in v0.3.0

func BundledViews(bundled fs.FS) (ViewsDef, Problems)

BundledViews is the views of the bundled profile alone.

func ByEnv added in v0.3.0

func ByEnv(d TasksDef) expr.Env

ByEnv is the env a verb's by compiles over: ByFacts and d's properties.

func DefaultApproval added in v0.3.0

func DefaultApproval(k gate.Kind, gates GatesDef) workflow.Approval

DefaultApproval is gates.toml's default for a gate of kind k, a kind but draft, as a run approval.

func DefaultDraftApproval added in v0.3.0

func DefaultDraftApproval(gates GatesDef) draft.Approval

DefaultDraftApproval is gates.toml's default for a draft gate.

func DraftActionFactMap added in v0.2.0

func DraftActionFactMap(get func(name string) any) map[string]any

DraftActionFactMap is ActionFactMap for the texts of a draft's actions.

func GateFacts added in v0.3.0

func GateFacts(g gate.Gate, delivery string) workflow.Facts

GateFacts are g's facts in slot gate, which a gates.toml rule and a view over gates read; delivery is a draft gate's delivery state, as the Outbox reads it from its draft, "" for any other gate.

func HeadlineName

func HeadlineName(i int) string

HeadlineName is the name a headline text is parsed under in an intent's template set: "headline.resumed", "headline.new[0]", ...

func KeyActions added in v0.3.0

func KeyActions() map[string][]string

KeyActions are the actions keys.toml words, by context: one per core action, a numbered one as <name>:{n}.

func Load

func Load(layers []profile.Layer, bundled fs.FS, base *template.Template, check TemplateCheck) (*Loaded, Problems)

Load reads intents/ of the bundled FS and of each directory layer; check may be nil. The partials under partials/ of each directory layer are parsed over base's; one that does not parse, or that a problem names, is left out and the bundled partials load instead. Layers with an empty Dir are skipped: the bundled intents come from bundled only. A user directory named as a bundled intent overrides its files one by one; when the result does not load, the bundled intent stays and the problems name the user's files.

func LoadIn added in v0.4.0

func LoadIn(locale string, layers []profile.Layer, bundled fs.FS, base *template.Template, check TemplateCheck) (*Loaded, Problems)

LoadIn is Load with the texts a person reads in locale, each by the layer rule of profile.Texts.

func Locales added in v0.4.0

func Locales(layers []profile.Layer, bundled fs.FS) []string

Locales are English and every locale a layer of layers, the bundled one read from bundled, holds texts in.

func NestFacts added in v0.2.0

func NestFacts(env expr.Env, get func(name string) any) map[string]any

NestFacts nests the dotted facts of env into the map an inline template executes over, {"pr": {"slug": ...}}, each read by get; a fact get has no value for reads as its type's zero value.

func OverlayDraftApproval added in v0.2.0

func OverlayDraftApproval(base *draft.Policy, def draft.Approval, o ApprovalOverlay, envs ApprovalEnvs) (draft.Policy, error)

OverlayDraftApproval is base, a workflow's draft policy (nil: def, gates.toml's default for a draft gate), with o laid over it, o's rules for draft gates compiled over envs. The merged policy is validated.

func OverlayRunApproval added in v0.2.0

func OverlayRunApproval(a workflow.Approval, k gate.Kind, o ApprovalOverlay, envs ApprovalEnvs) (workflow.Approval, error)

OverlayRunApproval is a, a workflow's approval of its gates of kind k (a kind but draft), with o laid over it, o's rules for k compiled over envs. A mode that does not apply to k leaves a's. The merged approval is validated, and a releasing rule of o may not read an untrusted fact.

func OwedByEnv added in v0.3.0

func OwedByEnv(d TasksDef) expr.Env

OwedByEnv is the env owed_by.expr compiles over: the task's workflow facts but OwedFacts, and d's properties.

func ProposalFacts added in v0.3.0

func ProposalFacts(get func(name string) any) map[string]any

ProposalFacts are the proposal facts, each value got by its name.

func RefusalText added in v0.2.0

func RefusalText(i int) string

RefusalText is the ActionTexts key of the why of refusal i.

func RefuseWhyName added in v0.2.0

func RefuseWhyName(i int) string

RefuseWhyName is the name refuse[i].why is parsed under.

func SampleActionFacts

func SampleActionFacts() map[string]any

SampleActionFacts is the action fact map with every fact set, for checking texts.

func SampleDraftActionFacts added in v0.2.0

func SampleDraftActionFacts() map[string]any

SampleDraftActionFacts is SampleActionFacts for a draft's actions.

func StepFacts added in v0.4.0

func StepFacts(get func(name string) any) map[string]any

StepFacts are the facts a step gate's text reads: the workflow facts of its unit and of the units its task holds, each value got by its name.

func SurvivorEnv added in v0.4.0

func SurvivorEnv(d TasksDef) expr.Env

SurvivorEnv is the env a verb's survivor compiles over: the task's workflow facts and d's properties.

func TextFuncs added in v0.4.0

func TextFuncs(locale string) template.FuncMap

TextFuncs are the template functions of a text localized in locale: the action functions and plural.

func TurnEnv added in v0.2.0

func TurnEnv(d dintent.Def) expr.Env

TurnEnv is the env an intent's turn predicates and inline texts read: the turn slot's facts and its inputs, turn.stage only with the stage dimension.

func ValidRepo added in v0.3.0

func ValidRepo(name string) bool

ValidRepo says whether name is a repository, owner/name, whose parts are names and not . or .., so no path joined from it leaves its folder.

func ViewEnv added in v0.3.0

func ViewEnv(over string, tasks TasksDef) expr.Env

ViewEnv is the facts a view over over reads: a task's, its properties typed as tasks declares them, or a gate's.

Types

type ActionPrograms added in v0.2.0

type ActionPrograms struct {
	When    *expr.Program
	Primary *expr.Program
	Refuse  []RefusalProgram
	// ActionTexts are note, warning, confirm and each refusal's why
	// ("refuse[<i>].why"), over the action fact map.
	ActionTexts map[string]*template.Template
}

ActionPrograms are an intent's compiled [action] predicates and texts.

type ApprovalEnvs added in v0.3.0

type ApprovalEnvs struct{ Draft, Unit expr.Env }

ApprovalEnvs are what an overlay rule of a workflow reads: Draft over a draft gate's facts and its unit's, Unit over its unit's for any other kind.

type ApprovalOverlay added in v0.2.0

type ApprovalOverlay struct {
	Mode   string
	Window *time.Duration
	Rules  []RuleOverlay
}

ApprovalOverlay is the configuration's [gates.approval] of a workflow, laid over its manifest's field by field: a set Mode or Window replaces that field, and non-nil Rules replace the rules, an empty list clearing them. A Mode other than delay drops the manifest's window, which JSON cannot unset.

type BuiltinAction added in v0.2.0

type BuiltinAction struct {
	Label, Summary string
	Input          struct{ Label, Help string }
	// Texts are note, warning, confirm and why, parsed; a text the table
	// leaves empty is absent.
	Texts map[string]*template.Template
}

BuiltinAction is a built-in action's texts, from its actions.toml table.

func (BuiltinAction) Render added in v0.2.0

func (a BuiltinAction) Render(name string, facts map[string]any) (string, error)

Render is text name of a over facts, "" when a has none.

type Cache

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

Cache reloads when the newest mtime under the user layer's intents/ and blocks changes; safe for concurrent use.

func NewCache

func NewCache(layers func() []profile.Layer, bundled fs.FS, base *template.Template, check TemplateCheck, opts CacheOptions) *Cache

func (*Cache) Get

func (c *Cache) Get() *Loaded

type CacheOptions

type CacheOptions struct {
	// Recheck is how long a stamp is trusted before the layers are walked again.
	Recheck time.Duration
	// Now is the clock; time.Now when nil.
	Now func() time.Time
	// LoadTree reads the profile tree of a Loaded; profile.Load when nil.
	LoadTree func([]profile.Layer, *dintent.Registry, []dintent.Name) (profile.Tree, error)
	// OnReload is called, holding no lock, after Get replaces the loaded registry with a changed one; the first load is not a reload.
	OnReload func()
	// Locale is the locale of the texts a person reads, asked on each walk; English when nil.
	Locale func() string
}

CacheOptions tune a Cache; the zero value rechecks the stamp on every Get.

type Decisions added in v0.4.0

type Decisions struct {
	Map   decision.Map
	Kinds map[decision.Kind]KindTexts
	// Primary is what a queue offers first on a plugin's unit, by provider and kind: a catalog action or
	// decision.Open.
	Primary map[dunit.ProviderID]map[decision.Kind]string
	// Open is what a queue's button that opens a unit at its source says.
	Open string
}

Decisions are decisions.toml over every layer.

type DraftWords added in v0.4.0

type DraftWords struct {
	ByHand, ByHandAbout       string
	Purposes, States, Reasons map[string]string
	// Quoted says a draft posted in the direct conversation of the person it is to quotes {conversation}.
	Quoted string
}

DraftWords name drafts to a person: ByHand and ByHandAbout head the Outbox's group of the drafts no workflow proposed and no purpose names, Purposes name a purpose, States a delivery state and Reasons why a dropped draft was withdrawn, by its id.

type FacetBucket added in v0.4.0

type FacetBucket struct {
	ID, Label string
	Within    time.Duration
}

FacetBucket is a bucket of a facet that sorts by time; a Within of 0 takes the rest.

type FacetDef added in v0.4.0

type FacetDef struct {
	ID, Fact, Label, Empty, Sort, Match string
	// LabelPrefix goes before the label of each value the facet shows on a row.
	LabelPrefix        string
	Group, Menu, Strip bool
	// Colors are the strip hues of the facet's values, by value.
	Colors map[string]string
	// Show is where the facet's values show on a task's row.
	Show         Show
	Rank         []string
	Values       map[string]string
	Buckets      []FacetBucket
	Merge, Units string
	// contains filtered or unexported fields
}

FacetDef is a task facet: the fact (or the "<record>.<field>" of a record kind) it reads, and the mechanics every client filters, groups and sorts it by. Merge is "union", "rows-first" or "own", Units "all" or "primary".

func (FacetDef) Problem added in v0.4.0

func (f FacetDef) Problem(key, format string, args ...any) Problem

Problem is a problem at key of the facet's declaration, in the file of the layer that set it.

type GateApproval added in v0.3.0

type GateApproval struct {
	Rules  []GateRule
	Mode   gate.Mode
	Window time.Duration
}

GateApproval is gates.toml's [approval]: the first rule whose When holds over the gate's facts decides, else Mode and Window.

func (GateApproval) Decide added in v0.3.0

Decide is how a decides a gate whose facts are f: the mode, its window and where the rule that decided is declared.

type GateDef added in v0.3.0

type GateDef struct {
	Name    string
	Kind    gate.Kind
	Label   string
	Intents []GateIntent
	// ClosesWith is the intent, one that refuses the gate, a person's
	// ending of the gate's task resolves it with; an open gate with one
	// holds its task open until a person settles it or its unit ends,
	// which supersedes it. "" neither holds nor closes.
	ClosesWith string
	// EndsTask is the category, done or dropped, a task opened only to hold gates ends in once the gate closes
	// with a status and none of its gates is open; a status it leaves out leaves the task open.
	EndsTask map[gate.Status]task.Category
	// CardSays makes the gate's card list what each intent does, its Summary.
	CardSays bool
	// Text words the gate's subject when the loop writes it, a template
	// over the proposal facts, or a step gate's over StepFacts; nil writes nothing.
	Text *template.Template
}

GateDef is a named gate: its kind, which names the consequence of resolving it, its words and the intents it is resolved with.

func (GateDef) Words added in v0.3.0

func (g GateDef) Words(facts map[string]any) (string, error)

Words is the gate's text over facts, "" when it has none.

type GateIntent added in v0.3.0

type GateIntent struct {
	Name, Label string
	// Summary is what resolving with it does, as help and palettes show it.
	Summary string
	Status  gate.Status
	Answer  bool
	// Texts are its note and confirm, templates over the action facts a
	// row offering it reads.
	Texts map[string]*template.Template
}

GateIntent is what a gate is resolved with: the status it resolves the gate to, and whether it takes text.

func (GateIntent) Render added in v0.3.0

func (in GateIntent) Render(name string, facts map[string]any) (string, error)

Render is the intent's text name over facts, "" when it has none.

type GateRule added in v0.3.0

type GateRule struct {
	At     string
	When   workflow.Predicate
	Mode   gate.Mode
	Window time.Duration
}

GateRule is one rule of gates.toml's [approval], its When over the gate's facts only.

type GatesDef added in v0.3.0

type GatesDef struct {
	Gates []GateDef
	// Approval is gates.toml's [approval]: how a gate is decided when no
	// manifest or configuration says, the default of each kind.
	Approval GateApproval
	// Effects are the sentences that say what each effect does when a draft is sent, by effect name.
	Effects map[string]string
	// Drafts are the words a draft's card and the Outbox read: gates.toml's [drafts].
	Drafts DraftWords
}

GatesDef is the profile's gates.toml over every layer, in declared order as TasksDef's states are: bundled gates first, then each user layer's new ones; a gate's intents likewise.

func (GatesDef) DefaultFor added in v0.3.0

func (d GatesDef) DefaultFor(k gate.Kind) (gate.Mode, time.Duration, string)

DefaultFor is how gates.toml decides a gate of kind k: the first gate of that kind, open. A rule that cannot be read waits.

func (GatesDef) FirstOf added in v0.3.0

func (d GatesDef) FirstOf(k gate.Kind) (GateDef, bool)

FirstOf is the first gate of kind k in the profile's order, which a gate the loop opens by kind takes.

func (GatesDef) Gate added in v0.3.0

func (d GatesDef) Gate(name string) (GateDef, bool)

Gate is the gate name declares.

type HomeCounterDef added in v0.4.0

type HomeCounterDef struct {
	ID           string
	Kind         decision.Kind
	View         string
	Noun, Clause i18n.Forms
	// contains filtered or unexported fields
}

HomeCounterDef is a counter of the briefing: a decision kind's (Kind) or a view's (View).

type HomeDef added in v0.4.0

type HomeDef struct {
	Template, Join, LastJoin, End, Count, Empty string
	PerSentence                                 int
	Counters                                    []HomeCounterDef
	Sections                                    []HomeSectionDef
	CaptureHint                                 string
}

HomeDef is home.toml over every layer, its texts in the load's locale.

type HomeSectionDef added in v0.4.0

type HomeSectionDef struct {
	ID, View, Time string
	Limit          int
}

HomeSectionDef is a section of the home: the first Limit rows of View, each showing Time.

type KeyTexts added in v0.3.0

type KeyTexts map[string]map[string]string

KeyTexts are the help lines of the core keys, by context, then action; a numbered action such as answer:3 reads answer:{n}.

func (KeyTexts) Help added in v0.3.0

func (k KeyTexts) Help(context, action string) string

Help is the help line of action in context, "" when the profile has none.

type KindTexts added in v0.4.0

type KindTexts struct {
	View         string
	Noun, Clause i18n.Forms
	Queue, Empty string
	Primary      string
	// contains filtered or unexported fields
}

KindTexts are a decision kind's view and words; Primary is the gate intent a queue offers first, "" the gate's first.

type LensWords added in v0.4.0

type LensWords struct {
	DefaultGroup, BoardGroup, NoGroup, Copied, CopiedGrouped, TagKey, TagKeyEmpty, Grouped, Sorted, Descending, NoLens string
	// Row are the words of a row.
	Row RowWords
}

LensWords are what a list's lens bar says, each a template whose only actions are the {{.name}} its key's doc lists, which clients fill in.

type Loaded

type Loaded struct {
	// Locale is the locale the person-read texts were loaded in.
	Locale    string
	Registry  *dintent.Registry
	Templates map[dintent.Name]*template.Template // body on a clone of base, missingkey=error
	Programs  map[dintent.Name]Programs
	Problems  Problems                  // user intents that did not load, and overrides read as bundled
	Broken    map[dintent.Name]Problems // user intents that failed, keyed by directory name
	Reverted  map[dintent.Name]Problems // bundled intents read without the user's override, which does not load
	// Warnings are what the loaded intents and workflows declare that loads
	// but is deprecated.
	Warnings Problems

	Workflows       []workflow.Workflow // by order, then name; a user workflow that failed is not here
	BrokenWorkflows map[string]Problems // user workflows that failed, keyed by directory name
	// RevertedWorkflows are bundled workflows read without the user's override, which does not load.
	RevertedWorkflows map[string]Problems

	// Actions are the built-in actions' texts from actions.toml, by catalog id.
	Actions map[string]BuiltinAction
	// Tools are the MCP tools' texts from tools.toml, by tool name.
	Tools map[string]ToolText
	// Views are the views, the review and the badge of views.toml.
	Views ViewsDef
	// Tasks are the task properties, states and verbs of tasks.toml.
	Tasks TasksDef
	// Gates are the gates of gates.toml.
	Gates GatesDef
	// Records are the record kinds of records.toml.
	Records RecordsDef
	// Keys are the core keys' help from keys.toml.
	Keys KeyTexts
	// Notices are what the loop tells a session, from notices.toml, by notice name.
	Notices map[string]string
	// UI are each plugin's words of its manifest's views, facets and
	// situations, from its layers' ui.toml, by plugin id.
	UI map[string]UITexts
	// Strings are the clients' texts in Locale, by their English text; Formats the Go clients' date and
	// number formats in Locale.
	Strings map[string]i18n.Forms
	Formats map[string]string
	// StringsStamp changes when Locale, Strings or Formats do.
	StringsStamp string
	// Timeline is timeline.toml in Locale.
	Timeline TimelineDef
	// Decisions are decisions.toml in Locale: what maps to each decision kind, and its words.
	Decisions Decisions
	// Home is home.toml in Locale.
	Home HomeDef
	// Predicates are each plugin's predicates.toml over its layers.
	Predicates Predicates
	// Omnibox is omnibox.toml in Locale.
	Omnibox OmniboxDef
	// EmptyRefusal is what a [[refuse]] case whose why renders empty says,
	// from defaults.toml.
	EmptyRefusal string
	// contains filtered or unexported fields
}

func (*Loaded) BrokenNames

func (l *Loaded) BrokenNames() []dintent.Name

BrokenNames is the kinds whose blocks are skipped, sorted: the user intents that did not load, and the kinds whose blocks need what a reverted override declared.

func (*Loaded) ProfileFile added in v0.4.0

func (l *Loaded) ProfileFile(rel string) (profile.Resolved, error)

ProfileFile is rel, a file of a workflow's directory, resolved through the layers that workflow loaded from, a whole-file text a person reads in l's locale.

func (*Loaded) Refusal added in v0.2.0

func (l *Loaded) Refusal(name dintent.Name, facts map[string]any) (string, error)

Refusal is the why of the intent name's first refusal whose when holds over facts, the unit's workflow facts, never empty when one holds; "" when none holds.

func (*Loaded) Rules

func (l *Loaded) Rules(intent string) (dintent.RecordRules, error)

Rules is intent's record rules; for a broken user intent the error carries its first problem.

func (*Loaded) SessionName added in v0.3.0

func (l *Loaded) SessionName(name dintent.Name, facts map[string]any) (string, error)

SessionName renders the session.name of the intent name over facts, its name facts but session.title, which it reads from the manifest; the title when the template is empty or renders blank.

func (*Loaded) TargetTitle added in v0.3.0

func (l *Loaded) TargetTitle(name dintent.Name, guidance string) (string, error)

TargetTitle renders the target.title of the intent name over guidance; "" when it has none.

func (*Loaded) Tree

func (l *Loaded) Tree() (profile.Tree, error)

Tree is the profile's blocks as of this load, read on the first call and kept; an unreadable block is the error every call returns.

func (*Loaded) Why added in v0.2.0

func (l *Loaded) Why(name dintent.Name, facts map[string]any) (string, error)

Why renders the why of the intent name over facts, the unit's workflow facts; "" for an intent without one.

func (*Loaded) WorkspaceName added in v0.3.0

func (l *Loaded) WorkspaceName(name dintent.Name, facts map[string]any) (string, error)

WorkspaceName renders the workspace.name of the intent name over facts, its name facts; "" when it has none.

type OmniboxDef added in v0.4.0

type OmniboxDef struct {
	// Limit is the most results a group shows.
	Limit int
	// Other labels the last group, of what no group's view holds.
	Other  string
	Groups []SearchGroupDef
	// Verbs are the known verbs, by id order of their first layer.
	Verbs []OmniboxVerbDef
}

OmniboxDef is omnibox.toml over every layer, its texts in the load's locale.

type OmniboxVerbDef added in v0.4.0

type OmniboxVerbDef struct {
	ID               string
	Words            []string
	Action, Verb, Op string
	// contains filtered or unexported fields
}

OmniboxVerbDef is a known verb: its words in every language and its target.

type Predicates added in v0.4.0

type Predicates map[dunit.ProviderID]map[string]*expr.Program

Predicates are each plugin's predicates, by provider and name, as its layers set them.

func (Predicates) Eval added in v0.4.0

func (ps Predicates) Eval(p dunit.ProviderID, name string, sets []map[string]any) (holds []bool, errs []error, err error)

Eval is Holds over each of sets: one verdict and one evaluation error per set, in order; err when p declares no such predicate or no layer sets it.

func (Predicates) Holds added in v0.4.0

func (ps Predicates) Holds(p dunit.ProviderID, name string, facts map[string]any) (bool, error)

Holds says whether plugin p's predicate name holds over facts; an error when p declares no such predicate or no layer sets it, or when it fails to evaluate.

type Problem

type Problem struct {
	File      string
	Line, Col int
	Field     string // "inputs.self_review.persist", "action.enabled"
	Msg       string
	Snippet   string // a predicate problem's expression and caret line; Error leaves it out
}

type Problems

type Problems []Problem

func BundledNotices added in v0.3.0

func BundledNotices(bundled fs.FS) (map[string]string, Problems)

BundledNotices are the notices' texts of bundled alone.

func BundledTools added in v0.3.0

func BundledTools(bundled fs.FS) (map[string]ToolText, Problems)

BundledTools are the tools' texts of bundled and the bundled plugins' layers.

func BundledUI added in v0.3.0

func BundledUI() (map[string]UITexts, Problems)

BundledUI is the words of the bundled plugins' own layers alone.

func (Problems) Error

func (p Problems) Error() string

Error is the problems sorted, one "file:line:col: field: msg" per line; a problem with no line (a whole directory) reads "dir: msg".

func (Problems) Sorted

func (p Problems) Sorted() Problems

Sorted is the problems by file, line, column, field and message.

type Programs

type Programs struct {
	Records  *expr.Program
	Headline []*expr.Program // per Headline.New case; nil for the unconditional last case
	Also     []*expr.Program
	// Refuse are the refusals' when, per Refuse of the definition.
	Refuse []*expr.Program
	Action ActionPrograms
}

type PropDef added in v0.3.0

type PropDef struct {
	Name    string
	Type    task.PropType
	Values  []string
	Writers []task.Writer
	Doc     string
	// Role is the mechanism that acts on the property, "" for none.
	Role task.Role
}

PropDef is a task property: the fact task.prop.<Name>. Values are an enum's, at least one.

func (PropDef) Untrusted added in v0.3.0

func (p PropDef) Untrusted() bool

Untrusted says whether an agent or a plugin may write p, so no approval rule that releases reads it.

type RecordKind added in v0.3.0

type RecordKind struct {
	Name       string
	SchemaFile string
	Schema     *jsonschema.Schema
	Writers    []task.Writer
	Projects   map[string]string
}

RecordKind is a declared record kind: the schema its data follows, who may write it, and the task properties its fields set, by field.

func (RecordKind) Writes added in v0.3.0

func (k RecordKind) Writes(w task.Writer) bool

Writes says whether w may write a record of k.

type RecordsDef added in v0.3.0

type RecordsDef struct {
	Kinds []RecordKind
}

RecordsDef is the profile's records.toml over every layer: the record kinds a run, a person or a plugin writes on a task, in declared order.

func (RecordsDef) Kind added in v0.3.0

func (d RecordsDef) Kind(name string) (RecordKind, bool)

Kind is the record kind name declares.

type RefusalProgram added in v0.2.0

type RefusalProgram struct {
	When *expr.Program
}

RefusalProgram is an [[action.refuse]] case's compiled when.

type ReviewStepDef added in v0.3.0

type ReviewStepDef struct {
	View, Label string
}

ReviewStepDef is a step of the review: the view it walks and what it asks of the user.

type RowWords added in v0.4.0

type RowWords struct {
	AgeNow           string
	AgeMinutes       string
	AgeHours         string
	AgeDays          string
	FilterLabel      string
	FilterTitle      string
	FilterTitleGroup string
	FilterGroup      string
	ListCount        string
	ListEmpty        string
	CountdownTitle   string
	CountdownSending string
	CountdownSeconds string
	CountdownMinutes string
	TipNamed         string
	TipKind          string
	TipWhy           string
	LegendTitle      string
	SortBy           string
	ColUnit          string
	Stale            string
	StaleTitle       string
	Briefing         string
	BriefingTitle    string
	BriefingAttempt  string
	BriefingError    string
	Questions        string
	QuestionsTitle   string
	Starred          string
	Until            string
	Due              string
	Unread           string
	UnreadTitle      string
	ReviewDue        string
	NoNextAction     string
	OpenChildren     string
	Sequential       string
	Every            string
	Reviewed         string
	More             string
}

RowWords are the words of a row beside its facets, by builtin.RowWords' keys.

func (RowWords) Over added in v0.4.0

func (w RowWords) Over(over RowWords) RowWords

Over is w with the words of over that are set.

func (RowWords) Set added in v0.4.0

func (w RowWords) Set() map[string]string

Set are the words w sets, by key.

type RuleOverlay added in v0.2.0

type RuleOverlay struct {
	When, Mode string
	Window     time.Duration
}

RuleOverlay is one rule of an ApprovalOverlay.

type SearchGroupDef added in v0.4.0

type SearchGroupDef struct {
	ID, Label, View string
}

SearchGroupDef is a search group: the results its view holds.

type Shared added in v0.4.0

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

Shared loads one registry per chain of embedded layers over the installed builtin tables, for the caches it makes and for Load. No caller changes a Loaded it returns.

func NewShared added in v0.4.0

func NewShared(bundled fs.FS, base *template.Template, check TemplateCheck) *Shared

func (*Shared) Load added in v0.4.0

func (s *Shared) Load(layers []profile.Layer) (*Loaded, Problems)

Load is the registry over layers, loaded once while they are all embedded and the installed tables stay the same; a layer on disk loads anew.

func (*Shared) LoadIn added in v0.4.0

func (s *Shared) LoadIn(locale string, layers []profile.Layer) (*Loaded, Problems)

LoadIn is Load with the texts a person reads in locale, one registry per chain and locale.

func (*Shared) NewCache added in v0.4.0

func (s *Shared) NewCache(layers func() []profile.Layer, opts CacheOptions) *Cache

NewCache is a Cache over s's bundled FS, base and check that takes s's registry while its layers are all embedded and opts has no LoadTree.

type Show added in v0.4.0

type Show struct {
	Part   string
	Only   []string
	Values string
	When   map[string][]string
	Max    int
	Label  string
}

Show is where a facet's values show on a row: Part, one of builtin.ShowParts, "" for the lens alone; Only the values the part shows, all when empty; Values "all" or "first"; When the values, by facet id, a row must hold for the facet to show; Max how many values show before the rest count into one; Label an age part's label over {{.age}} and {{.at}}.

type SortKey added in v0.3.0

type SortKey struct {
	Fact string
	Desc bool
}

SortKey is a fact a view sorts by, descending when Desc.

type StateDef added in v0.3.0

type StateDef struct {
	Name     string
	Category task.Category
	Label    string
}

StateDef is a state a task takes and its category, which is all Go reads of it.

type TasksDef added in v0.3.0

type TasksDef struct {
	Props  []PropDef
	States []StateDef
	Verbs  map[string]VerbText
	// VerbOrder are the names of Verbs in the order clients list them: the bundled file's, then each user
	// layer's new ones.
	VerbOrder []string
	// OwedBy is owed_by.expr as written; Owed is it compiled over OwedByEnv, nil when the profile has none.
	OwedBy string
	Owed   *expr.Program
	// ChatIntent is the intent of the turn a chat message starts on a task with no live session.
	ChatIntent string
	// ChatAt is where the layer that set ChatIntent sets it.
	ChatAt dintent.Pos
	// ViaSession names a change an agent made for the user through a session they drove; {session} is the
	// session's id.
	ViaSession string
	// ViaWorkflow names a change a workflow made; {workflow} is the workflow's name.
	ViaWorkflow string
	// DetailVerbs are the verbs a task's detail offers as its buttons, in order; the rest it offers wait in a
	// palette.
	DetailVerbs []string
	// RunStates word a run's turn state and SessionStates its session's, by state: tasks.toml's [runs].
	RunStates, SessionStates map[string]string
	Areas, Contexts          []string
	StaleWaitingDays         int
}

TasksDef is the profile's tasks.toml over every layer. Props and States keep their declared order: the bundled entries in the order the bundled file declares them, then each user layer's new entries in its own order; a layer that sets an entry declared below it changes it in place.

A zero task.Value unsets a property, so an int or a duration property holds no 0: 0 means unset, and Parse refuses it.

func (TasksDef) CategoryOf added in v0.3.0

func (d TasksDef) CategoryOf(state string) (task.Category, bool)

CategoryOf is the category of state; false when the profile declares no such state.

func (TasksDef) Facts added in v0.3.0

func (d TasksDef) Facts() expr.Env

Facts are the task.prop.<name> facts of the declared properties, typed from their types, an enum's closed to its values and an untrusted one marked so, with task.prop_by.<name>, who last wrote each; and task.state closed to the declared states.

func (TasksDef) FirstOf added in v0.3.0

func (d TasksDef) FirstOf(c task.Category) string

FirstOf is the first state of category c in the profile's order, which a task proposed in c takes; "" when no state is of c.

func (TasksDef) Handler added in v0.3.0

func (d TasksDef) Handler(verb string) string

Handler is the handler verb runs besides its move, "" for none.

func (TasksDef) HeldProblems added in v0.3.0

func (d TasksDef) HeldProblems(held []string) Problems

HeldProblems are the problems of the states stored tasks hold, held, that no layer declares: their tasks keep the category they had, and no verb moves them.

func (TasksDef) Move added in v0.3.0

func (d TasksDef) Move(verb string) ([]string, string, bool)

Move is the states verb moves a task from (every state when empty) and the state it moves it to ("" for none); false when no verb is named so.

func (TasksDef) Parse added in v0.3.0

func (d TasksDef) Parse(name, text string, loc *time.Location) (task.Value, error)

Parse reads text as the value of the property name, by its type: a string as is; an enum one of its values; a date YYYY-MM-DD (midnight in loc) or RFC 3339; a duration as the profile writes them (90m, 2d); an int in decimal; an actor a person's key, provider:id; a list type its items comma-separated. Empty text is the zero Value, which unsets the property, and so is 0: Parse refuses 0 for an int or a duration.

func (TasksDef) Prop added in v0.3.0

func (d TasksDef) Prop(name string) (PropDef, bool)

Prop is the property name declares.

func (TasksDef) PropOf added in v0.3.0

func (d TasksDef) PropOf(r task.Role) (string, []string)

PropOf is the property that takes role r, and its values; "" when none does.

func (TasksDef) ShapingVerbs added in v0.4.0

func (d TasksDef) ShapingVerbs() []string

ShapingVerbs are d's verbs that shape a task by hand, which task.clarified reads: those whose move has a state to go to, and those whose handler files the task under a project, in name order.

func (TasksDef) Untrusted added in v0.3.0

func (d TasksDef) Untrusted(name string) bool

Untrusted says whether no approval rule that releases may read the property name: an agent or a plugin writes it, or the profile declares no such property.

func (TasksDef) VerbKinds added in v0.3.0

func (d TasksDef) VerbKinds() []string

VerbKinds are the kinds of the events of the profile's verbs, in name order.

type TemplateCheck

type TemplateCheck func(d dintent.Def, t *template.Template) []Problem

TemplateCheck renders a manifest's templates against real samples; internal/turn provides it.

type TimelineDef added in v0.4.0

type TimelineDef struct {
	Events map[string]TimelineEvent
	Facts  []TimelineFact
}

TimelineDef is timeline.toml: the core's event kinds as the timeline names them, and its facts in the order they are tried.

type TimelineEvent added in v0.4.0

type TimelineEvent struct {
	Label, Tone string
}

TimelineEvent is one core event kind's words and tone.

type TimelineFact added in v0.4.0

type TimelineFact struct {
	Name                 string
	Start, End, Absorb   []string
	Label, Running, Tone string
	// Unfinished is how a span reads that its start kind came to again before its end.
	Unfinished string
	Order      int
	Subs       map[string]string
}

TimelineFact is one [facts.<name>]: the event kinds that open, close and join it, and how it reads.

type ToolText added in v0.3.0

type ToolText struct {
	Description string
	Params      map[string]string
	Answers     map[string]string
}

ToolText is an MCP tool's description, its parameters', by parameter path, and its answers, by name, as templates over builtin.ToolData and, for an answer, the fields of its builtin.ToolAnswers row.

type UIDecision added in v0.4.0

type UIDecision struct {
	ClauseRaw any        `toml:"clause"`
	Clause    i18n.Forms `toml:"-"`
	Queue     string     `toml:"queue"`
	Empty     string     `toml:"empty"`
}

UIDecision is a plugin's words of a decision kind.

type UIEvent added in v0.3.0

type UIEvent struct {
	Label string `toml:"label"`
	Loop  bool   `toml:"loop"`
	Tone  string `toml:"tone"`
	Data  string `toml:"data"`
}

UIEvent is an event kind's words.

type UIFacet added in v0.3.0

type UIFacet struct {
	Label       string              `toml:"label"`
	Empty       string              `toml:"empty"`
	Values      map[string]string   `toml:"values"`
	Buckets     map[string]string   `toml:"buckets"`
	ShowRaw     any                 `toml:"show"`
	ShowValues  *string             `toml:"show_values"`
	ShowWhen    map[string][]string `toml:"show_when"`
	ShowMax     *int                `toml:"show_max"`
	ShowLabel   *string             `toml:"show_label"`
	LabelPrefix *string             `toml:"label_prefix"`
	RowClass    map[string]string   `toml:"row_class"`
	Colors      map[string]string   `toml:"colors"`
	// Show is where the facet's values show on the plugin's rows, read from ShowRaw and ShowValues.
	Show Show `toml:"-"`
}

UIFacet is a facet's words.

type UIField added in v0.3.0

type UIField struct {
	Label string `toml:"label"`
	Title string `toml:"title"`
}

UIField is how a field of a unit's detail shows.

type UISearch added in v0.3.0

type UISearch struct {
	DefaultSort string            `toml:"default_sort"`
	Presets     []UISearchPreset  `toml:"presets"`
	Filters     []UISearchFilter  `toml:"filters"`
	Sorts       []UISearchSort    `toml:"sorts"`
	Decisions   map[string]string `toml:"decisions"`
	NoDecision  string            `toml:"no_decision"`
}

UISearch is a custom view's search: the queries it runs at a press, the terms it toggles, the orders it offers and how a result's decision reads.

type UISearchFilter added in v0.3.0

type UISearchFilter struct {
	Term   string `toml:"term"`
	Window int    `toml:"window"`
	Label  string `toml:"label"`
}

UISearchFilter toggles a term, or with Window a recent-activity window in days.

type UISearchPreset added in v0.3.0

type UISearchPreset struct {
	Query string `toml:"query"`
	Label string `toml:"label"`
}

UISearchPreset is a query run at a press.

type UISearchSort added in v0.3.0

type UISearchSort struct {
	Sort  string `toml:"sort"`
	Label string `toml:"label"`
	Shown string `toml:"shown"`
}

UISearchSort is an order a search offers.

type UISignal added in v0.4.0

type UISignal struct {
	Label      string            `toml:"label"`
	Values     map[string]string `toml:"values"`
	ValuesFrom string            `toml:"values_from"`
	Notes      map[string]string `toml:"notes"`
}

UISignal is a card signal's words: its name, its values' and its notes' by code, and where else its values take words from.

type UITexts added in v0.3.0

type UITexts struct {
	Views      map[string]UIView   `toml:"views"`
	Facets     map[string]UIFacet  `toml:"facets"`
	Situations map[string]string   `toml:"situations"`
	Reasons    map[string]string   `toml:"reasons"`
	Signals    map[string]UISignal `toml:"signals"`
	Events     map[string]UIEvent  `toml:"events"`
	Menubar    map[string]string   `toml:"menubar"`
	Detail     map[string]UIField  `toml:"detail"`
	LensRaw    map[string]string   `toml:"lens"`
	// Lens are the plugin's own row words, those it leaves out empty.
	Lens    RowWords `toml:"-"`
	NounRaw any      `toml:"noun"`
	// Noun is what one of the plugin's units is, as the briefing counts it.
	Noun i18n.Forms `toml:"-"`
	// Decisions are the plugin's words of the decisions its units wait on, by decision kind.
	Decisions map[string]UIDecision `toml:"decisions"`
}

UITexts are one plugin's words of its manifest's ids.

type UIView added in v0.3.0

type UIView struct {
	Label       string    `toml:"label"`
	Unit        string    `toml:"unit"`
	DefaultSort string    `toml:"default_sort"`
	Search      *UISearch `toml:"search"`
}

UIView is a view's words.

type VerbText added in v0.3.0

type VerbText struct {
	Label, Summary, Input string
	Offer                 workflow.Predicate
	From                  []string
	To                    string
	By                    map[string]string
	Allow                 map[string]workflow.Predicate
	Gate, Handler, Send   string
	// KeepDrafts are the purposes of the held drafts a task keeps when the verb ends it; the others are
	// withdrawn.
	KeepDrafts []string
	// Survivor, on a merge, is the predicate over each task's facts (SurvivorEnv) that names the one that
	// stays; nil when the verb sets none.
	Survivor workflow.Predicate
}

VerbText is a verb's words: Input is the question a verb that asks for a value puts first. Offer, when set, is where a task offers the verb. From are the states it moves a task from, every state when empty; To the state it moves it to, "" for none. By are who may run it, by actor: a predicate's source over the task's facts, or "gate"; an actor left out may not. Gate is the gate a "gate" opens, Handler what it runs besides its move ("" for none), Send how a reply's handler sends. Allow are By's predicates compiled, by actor; a "gate" has none.

type ViewDef added in v0.3.0

type ViewDef struct {
	ID, Label, Summary, Over, Group, Key, Empty string
	WhenText, SortText                          string
	Sort                                        []SortKey
	HideDisabled, RemoveClean                   bool
	// Rail says that the rail lists the view; a view only the home, a queue or search reads has it false.
	Rail bool
	When workflow.Predicate

	// Layout is how the cockpit draws the view, one of builtin.ViewLayouts.
	Layout string
	// contains filtered or unexported fields
}

ViewDef is a view: Summary, one line on what it lists; what it lists (Over, task.OverTasks or task.OverGates); When, which of them, compiled over their facts, nil for a view that lists nothing and is a place a client draws itself, such as the review; Group the fact it groups by, Sort the facts it sorts by, Key the key that jumps to it, HideDisabled whether it leaves out what a disabled plugin holds, RemoveClean whether it offers to remove its tasks' clean workspaces, and Empty what it shows when it lists nothing. WhenText and SortText are its when and sort as the profile writes them.

type ViewsDef added in v0.3.0

type ViewsDef struct {
	Views []ViewDef
	// Review are the review's steps in order, each a view.
	Review []ReviewStepDef
	// Badge are the views whose counts the badge adds up.
	Badge []string
	// Empty is what a view without its own empty shows when it lists nothing.
	Empty *template.Template
	// DefaultSort is what clients call a view's own order.
	DefaultSort string
	// Lens is what every list's lens bar says.
	Lens LensWords
	// Facets are the task facets in their declared order.
	Facets []FacetDef
}

ViewsDef is views.toml over every layer. Views and Review keep their declared order, as TasksDef's states do: the bundled entries first, then each user layer's new ones in its own order.

func (ViewsDef) Badged added in v0.3.0

func (d ViewsDef) Badged(id string) bool

Badged says whether the badge counts view id.

func (ViewsDef) IDs added in v0.3.0

func (d ViewsDef) IDs() []string

IDs are the views' ids in order.

func (ViewsDef) View added in v0.3.0

func (d ViewsDef) View(id string) (ViewDef, bool)

View is the view id; false when the profile declares none.

Directories

Path Synopsis
Package builtin is the Go vocabulary manifests name: builtins by slot, reserved names and keys, and the facts predicates read.
Package builtin is the Go vocabulary manifests name: builtins by slot, reserved names and keys, and the facts predicates read.
builtintest
Package builtintest swaps the builtin tables for a test.
Package builtintest swaps the builtin tables for a test.
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.
cmd/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.
Package expr compiles and evaluates the predicates of intent and workflow manifests: CEL expressions (cel-go) over typed facts, checked at load.
Package expr compiles and evaluates the predicates of intent and workflow manifests: CEL expressions (cel-go) over typed facts, checked at load.

Jump to

Keyboard shortcuts

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