api

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: 22 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 api is the schema every client of the daemon speaks: its version, its headers and the wire types it decodes.

Index

Constants

View Source
const (
	DoctorOK      = "ok"
	DoctorMissing = "missing"
	DoctorInfo    = "info"
)

Doctor marks.

View Source
const (
	AgentPrefix         = "/api/agent/"
	AgentTurnsStart     = "/api/agent/turns/start"
	AgentTurnsByHand    = "/api/agent/turns/by-hand"
	AgentTurnsEnd       = "/api/agent/turns/end"
	AgentSessionsStart  = "/api/agent/sessions/start"
	AgentSessionsStop   = "/api/agent/sessions/stop"
	AgentSessionsPrompt = "/api/agent/sessions/prompt"
	AgentAnswer         = "/api/agent/answer"
	// AgentDrafts is the caller's drafts: POST an AgentDraftProposal proposes one, GET ?id=<id> reads one,
	// PATCH an AgentDraftUpdate revises one at the rev it read, DELETE an AgentDraftWithdrawal withdraws one;
	// each answers an AgentDraft.
	AgentDrafts = "/api/agent/drafts"
)

AgentAPI paths, served on the Unix socket only. The caller's session is the SessionHeader.

View Source
const (
	Header = "X-Loop-API"
	// SessionHeader carries the handle the workspace manager gave the calling
	// agent's process; the daemon resolves it to the loop's session.
	SessionHeader = "X-Loop-Session"
	// ManagerHeader names the manager that gave SessionHeader's handle, when
	// the caller knows it: a hook does, an MCP request does not.
	ManagerHeader = "X-Loop-Manager"
	// MCPKeyHeader carries the per-install secret the MCP endpoint requires.
	MCPKeyHeader = "X-Loop-Key"
)
View Source
const (
	AdminPrefix     = "/api/admin/"
	AdminDryRunTurn = "/api/admin/dry-run-turn"
	AdminDoctor     = "/api/admin/doctor"
	// AdminTurn takes the pull request's URL in the query parameter pr.
	AdminTurn = "/api/admin/turn"
	// AdminProbe sends a probe turn: the loop's self-test of an agent home.
	AdminProbe = "/api/admin/probe"
	// AdminGitAccess records a git access outcome another process saw.
	AdminGitAccess = "/api/admin/git-access"
	// AdminMeter is the metered cost of every scope since the daemon started.
	AdminMeter = "/api/admin/meter"
)

AdminAPI paths: the daemon's answers to diagnostics and dry runs, served on the Unix socket only, like AgentAPI.

View Source
const (
	Intakes       = "/api/intakes/{seq}"
	IntakeWithout = "/api/intakes/{seq}/without"
	IntakeCancel  = "/api/intakes/{seq}/cancel"
)

Intake paths. Intakes answers ?after=<n>&wait=<seconds>: the log lines past the n-th, once there are any or the intake ends, waiting at most IntakeWaitMax seconds.

View Source
const (
	IntakeAccepted = "accepted"
	IntakeBriefing = "briefing"
	IntakeStarting = "starting"
	IntakeStarted  = "started"
	IntakeFailed   = "failed"
	IntakeCanceled = "canceled"
)

The states of an intake.

View Source
const (
	SearchPath         = "/api/search"
	OmniboxResolvePath = "/api/omnibox/resolve"
	OmniboxAskPath     = "/api/omnibox/ask"
	OmniboxRunPath     = "/api/omnibox/run"
)

Omnibox paths: SearchPath takes the query parameter q and answers a Search; OmniboxResolvePath takes an OmniboxText and answers an OmniboxResolved; OmniboxAskPath takes an OmniboxText and answers an OmniboxAnswer; OmniboxRunPath takes an OmniboxRun and answers an OmniboxRan.

View Source
const (
	OmniboxDropUnknownOperation    = "unknown_operation"
	OmniboxDropIncompleteOperation = "incomplete_operation"
	OmniboxDropUnknownTask         = "unknown_task"
	OmniboxDropUnknownUnit         = "unknown_unit"
	OmniboxDropOutsideVocabulary   = "outside_vocabulary"
)

Why codes of an OmniboxDropped the read-only agent call writes; each is a key of the client strings, worded with the drop's Params.

View Source
const (
	OmniboxAskEmpty    = "Type what to ask the agent"
	OmniboxAskOverCap  = "Today's spend cap for agent calls is reached; ask again tomorrow"
	OmniboxAskNoAgent  = "No agent here can answer from the omnibox: {error}"
	OmniboxAskFailed   = "The agent could not answer: {error}"
	OmniboxAskTimedOut = "The agent took too long to answer; nothing changed"
	OmniboxAskUnwired  = "This daemon runs no omnibox agent"
)

The errors OmniboxAskPath answers, keys of the client strings the daemon words in the loaded locale.

View Source
const (
	OmniboxWhyUnclaimed    = "unclaimed_address"
	OmniboxWhyNoRef        = "no_unit_or_task"
	OmniboxWhyAmbiguous    = "ambiguous_ref"
	OmniboxWhyNothingNamed = "nothing_named"
)

Why codes of an OmniboxResolved that fell to search or to the agent; each is a key of the client strings, worded with the resolution's Params.

View Source
const (
	OmniboxUnitUnreadable = "unit_unreadable"
	OmniboxUnitNoRow      = "unit_no_row"
)

Why codes of an OmniboxUnit that offers no action; each is a key of the client strings, worded with the unit's Params.

View Source
const (
	OmniboxRunInvalid     = "run_invalid"     // 400
	OmniboxRunForbidden   = "run_forbidden"   // 403
	OmniboxRunNotFound    = "run_not_found"   // 404
	OmniboxRunConflict    = "run_conflict"    // 409
	OmniboxRunUnavailable = "run_unavailable" // 503
	OmniboxRunFailed      = "run_failed"      // any other
)

The Error of an OmniboxResult whose handler refused or failed, by its status: each is a key of the client strings, whose words name no handler text; Params["detail"] keeps the handler's own message, in English. Outside the vocabulary and incomplete operations take the drop codes.

View Source
const (
	// CapabilityCheckouts: a session on a unit runs in a checkout of the
	// unit's own repository.
	CapabilityCheckouts = "checkouts"
	// CapabilityBriefs: the brief queue briefs the plugin's units.
	CapabilityBriefs = "briefs"
	// CapabilityPublishes: the plugin posts approved drafts.
	CapabilityPublishes = "publishes"
	// CapabilityReacts: the plugin posts reactions.
	CapabilityReacts = "reacts"
	// CapabilityItems: the plugin's rows derive items.
	CapabilityItems = "items"
	// CapabilityDetail: the cockpit shows a detail of the plugin's units,
	// which a client opens in place of the unit's link.
	CapabilityDetail = "detail"
)

The capabilities a plugin serves in Plugin.Capabilities.

View Source
const (
	// ViewUnitRow answers a UnitRowQuery with the Row of a unit the read
	// model does not list, its Unit as its source names it; ErrNotFound for
	// a unit the plugin has no row of.
	ViewUnitRow = "unit.row"
	// ViewUnitDetail answers a UnitQuery with the PluginDetail of a unit.
	ViewUnitDetail = "unit.detail"
	// ViewUnitChecks answers a UnitQuery with the unit's []CheckDetail.
	ViewUnitChecks = "unit.checks"
	// ViewTimings answers a TimingsQuery with a TimingsReport.
	ViewTimings = "timings"
)

The views the daemon asks of a unit's plugin, by the name its View serves them under, and what each answers.

View Source
const (
	ProbeOwner = "loop-e2e"
	ProbeRepo  = "probe"
)

ProbeOwner and ProbeRepo name the forge unit of every probe, keyed <owner>/<repo>#<n>: one that exists nowhere, so no inventory holds it and no view has a role for it.

View Source
const (
	ReviewPath     = "/api/review"
	ReviewStepDone = ReviewPath + "/steps/{step}/done"
)

The Review's routes: ReviewPath serves the current Review, ReviewStepDone marks one of its steps done.

View Source
const (
	ViewsPath    = "/api/views"
	TasksPath    = "/api/tasks"
	TaskDetail   = TasksPath + "/{id}"
	TaskVerb     = TaskDetail + "/{verb}"
	CountersPath = "/api/counters"
	DigestPath   = "/api/digest"
)

The tasks' routes: ViewsPath serves the ViewsCatalog, TasksPath lists a view (query parameters view, area, context as "a,b", since, a Since's String, and TasksUnits) and takes a TaskCreate, TaskVerb runs a verb, CountersPath serves the counters of the query parameter area (narrowed to the tasks the lens query CountersQuery keeps), DigestPath the daily digest of the query parameter day (YYYY-MM-DD).

View Source
const (
	TimelinePath  = TaskDetail + "/timeline"
	RunsPath      = TaskDetail + "/runs"
	ChatPath      = TaskDetail + "/chat"
	AttachPath    = TaskDetail + "/attach"
	GatesPath     = "/api/gates"
	GatePath      = GatesPath + "/{id}/{intent}"
	RunOpen       = "/api/runs/{seq}/open"
	RunEnter      = "/api/runs/{seq}/enter"
	RunTranscript = "/api/runs/{seq}/transcript"
)

A task's timeline, runs and chat, and the gates and runs as resources: TimelinePath serves a task's []TimelineEvent, newest first (query parameters kinds as "a,b", before a Seq and limit; as=nodes answers []TimelineNode instead), RunsPath its []RunView, ChatPath takes a ChatRequest, AttachPath makes the caller's session, from SessionHeader, a run of the task (it takes an AttachRequest and answers a ByHandResult). GatesPath lists []GateView (query parameter status as "a,b", open when absent), GatePath resolves gate id with intent (a TaskRequest's args carry an answer). RunOpen opens a run's workspace in its manager, RunEnter enters its session, RunTranscript pages its transcript as a TranscriptPage (query parameters from and limit).

View Source
const (
	// AdminTimings takes the days to look back in the query parameter since.
	AdminTimings = "/api/admin/timings"
	// AdminFacts takes the pull request's URL in the query parameter pr.
	AdminFacts = "/api/admin/facts"
)
View Source
const (
	MilestoneReviewWait  = "request_to_my_review"
	MilestoneToApproval  = "opened_to_approved"
	MilestoneToMerge     = "opened_to_merged"
	MilestoneMineToMerge = "mine_opened_to_merged"
	MilestoneInLoop      = "followed_to_unfollowed"
	MilestoneLeadTime    = "first_push_to_merged"
	MilestoneMineLead    = "mine_first_push_to_merged"
)

The keys of TimingsReport.Milestones.

View Source
const (
	WaitingOnMe     = "me"
	WaitingOnOthers = "others"
	WaitingOnLoop   = "loop"
)

The keys of TimingsReport.Waiting: who a followed pull request waited on, by its situation events.

View Source
const (
	TurnStartWait = "sent_to_started"
	TurnBriefWait = "brief_wanted_to_sent"
)

The keys of TimingsReport.Turns beyond the intents: the wait from sent to started, and an automated first turn's wait for its brief, from brief_wanted to the turn's send.

View Source
const (
	UpcomingGate       = "gate"
	UpcomingUnmute     = "unmute"
	UpcomingBriefRetry = "brief_retry"
)
View Source
const (
	TaskActionPrefix    = "task:"
	AttentionDraftForMe = TaskActionPrefix + "delegate:headless"
	AttentionReply      = "reply:save"
	AttentionSendReply  = "reply:send"
)

AttentionAction ids are catalog ids, task:<verb> (task:<verb>:<mode> with the delegate's mode) for a task's verb, answer:option:<id>, answer:yes, answer:no and answer:text for the answer's choices, and reply:save and reply:send for a reply typed in the notification. The actions of an Inbox task's notification: Draft for me delegates it headless, Reply saves the typed text to the Outbox as a reply on its unit and Send reply sends it at once.

View Source
const (
	StoreOK             = "ok"
	StoreBusy           = "busy"
	StoreNeedsMigration = "needs-migration"
	StoreTooNew         = "too-new"
	StoreFailed         = "failed"
)

The states of StoreStatus: StoreOK is open; the others leave the store closed until a command fixes it or, for StoreBusy, the command finishes.

View Source
const (
	WindowOpen      = "open"  // show the main window at Route, hide the panel
	WindowPanel     = "panel" // show the panel
	WindowHidePanel = "hide-panel"
	WindowDetach    = "detach"   // show the item Route names in a window of its own
	WindowExternal  = "external" // open URL, a web address, in the default browser
)

The actions of a WindowRequest.

View Source
const Actions = "/api/actions"

Actions is the route of the action specs.

View Source
const AnswerQueued = "answer queued; the agent session is told of it when the agent stops"

ActionResult carries, for an action an intake runs, the intake that accepted it instead of the action's output. AnswerQueued is the output line of an answer that waits for its busy agent to stop.

View Source
const Catalog = "/api/catalog"

Catalog is the route of the served presentation.

View Source
const CountersQuery = "q"

CountersQuery is the query parameter of CountersPath that counts only the tasks a lens query keeps.

View Source
const DraftCloseSilently = Drafts + "/{id}/close-silently"

DraftCloseSilently takes a DraftCloseSilentlyRequest: it closes the held draft's conversation as the draft would, applying its effects without posting it, and answers the Draft.

View Source
const Drafts = "/api/drafts"

Drafts lists drafts (query parameters state, a comma list, id, a comma list of draft ids, task, and unit, "<provider>/<key>"; with none, the Outbox's: those whose gate is open, and those whose gate approved them and whose delivery failed) and, posted a DraftCreate, holds a draft the user wrote. A draft's decision is its gate's, resolved through GatePath; a draft gate's Subject is its Draft.

View Source
const GateKindDraft = "draft"

GateKindDraft is the Kind of a draft's gate.

View Source
const HomePath = "/api/home"

HomePath serves the cockpit's home, as Home.

View Source
const IntakeWaitMax = 25
View Source
const Keys = "/api/keys"

Keys serves the keyboard map of a surface: GET takes the query parameter surface (web, tui or menubar).

View Source
const OutboxPath = "/api/outbox"

OutboxPath serves the Outbox's drafts as an OutboxPage, each with its context, its draft facets' values and its search texts, in the order of the sort of the outbox-layout view ?view= names, else of the profile's first.

View Source
const Plan = "/api/plan"

Plan is the workflows' plan: GET takes a PlanQuery's fields as query parameters, POST a PlanActRequest.

View Source
const PluginAction = "/api/plugins/{id}/actions/{action}"

PluginAction runs an action of a running plugin that names no unit: POST takes a PluginActionRequest and answers the plugin's JSON.

View Source
const PluginAssets = "/plugins/{id}/{path...}"

PluginAssets serves an enabled plugin's WebAssets; 404 while it is disabled.

View Source
const PluginRun = "/api/plugins/{id}/run"

PluginRun runs a command line of a running plugin: POST takes a PluginRunRequest and streams PluginRunChunk lines, one JSON object a line, as the command writes, the last one its exit.

View Source
const PluginView = "/api/plugins/{id}/views/{view}"

PluginView serves one of an enabled plugin's views, its Presenter.View: GET -> the view's content, its query the request's query parameters as a JSON object of strings; POST with the query as the body -> the same.

View Source
const Plugins = "/api/plugins"

Plugins is the route of every compiled-in plugin: GET -> []Plugin.

View Source
const QueuePath = "/api/queues/{kind}"

QueuePath serves the decision queue of a decision kind, as Queue; the query parameter q narrows it by a lens query, as CountersPath's does.

View Source
const RefusalNotOffered = "not_offered"

RefusalNotOffered is the refusal code of an action the row does not offer.

View Source
const Resolve = "/api/resolve"

Resolve is the unit an address lands in: GET takes the address as the address query parameter and answers a Resolved.

View Source
const Rows = "/api/rows"

Rows takes the query parameters view, person and since, a Since's String.

View Source
const StringsPath = "/api/strings"

StringsPath serves the client strings in the daemon's interface language, as Strings.

View Source
const TasksExcept = "except"

TasksExcept is the query parameter of a TasksMatch request that names the task the picker picks for, which the list leaves out, as its id reads.

View Source
const TasksMatch = "match"

TasksMatch is the query parameter of TasksPath that lists every open task whose title holds it, case aside, whatever the view, for a picker of another task; both clients read the same list. The page is Full and its views hold only the id, title, state, category and units of each task, the newest change first.

View Source
const TasksUnits = "units"

TasksUnits is the query parameter of TasksPath, repeated, that names a unit as its String does: a page since a position also holds the tasks holding it, as a change named it.

View Source
const UnitDetail = "/api/units/{provider}/{key}"

UnitDetail is a unit's detail; its checks, tasks and actions are under it.

View Source
const UnitSkip = UnitDetail + "/skip/{workflow}"

UnitSkip stops (POST) or lets again (DELETE) a workflow on one unit, answering a UnitSkipState.

View Source
const UnitTasks = UnitDetail + "/tasks"

UnitTasks serves the open tasks that hold the unit or one of its items, as []TaskView.

View Source
const Version = "1"

Version is the API this binary speaks, a major only. A client of another major is refused; a change older clients can ignore, such as a new field, keeps it.

View Source
const WindowClient = "window"

WindowClient is the events client the window controller subscribes as.

View Source
const WindowPath = "/api/window"

WindowPath takes a WindowRequest and relays it to the events client named WindowClient, answering a WindowResult.

View Source
const WorkflowDisable = "/api/workflows/{name}/disable"

WorkflowDisable turns a workflow off in the configuration, applied without a restart, answering a WorkflowSwitch.

Variables

View Source
var ErrSessionHandle = errors.New(SessionHeader + " is missing or not a process handle: this session does not run under one of " + brand.Name + "'s workspace managers, so " + brand.Name + " cannot tell which turn it records")
View Source
var ErrUnknownSession = errors.New(SessionHeader + " names a process no session of " + brand.Name + " took: start the session from " + brand.Name + ", or let its SessionStart hook run")

ErrUnknownSession is a handle no session of the loop took.

View Source
var Operations = []Operation{
	{"GET", "/api/health"},
	{"GET", Rows},
	{"GET", Catalog},
	{"GET", Resolve},
	{"GET", UnitDetail},
	{"GET", UnitDetail + "/checks"},
	{"GET", UnitTasks},
	{"POST", "/api/jobs/{name}"},
	{"POST", UnitDetail + "/{action}"},
	{"GET", Actions},
	{"GET", Keys},
	{"GET", "/api/events"},
	{"GET", "/api/activity"},
	{"POST", "/api/pause"},
	{"POST", "/api/app"},
	{"POST", "/api/workspaces/remove-clean"},
	{"GET", Intakes},
	{"POST", IntakeWithout},
	{"POST", IntakeCancel},
	{"GET", Plan},
	{"POST", Plan},
	{"GET", Plugins},
	{"GET", PluginAssets},
	{"GET", PluginView},
	{"POST", PluginView},
	{"POST", PluginAction},
	{"POST", PluginRun},
	{"GET", ViewsPath},
	{"GET", TasksPath},
	{"POST", TasksPath},
	{"GET", TaskDetail},
	{"POST", TaskVerb},
	{"GET", TimelinePath},
	{"GET", RunsPath},
	{"POST", ChatPath},
	{"POST", AttachPath},
	{"GET", GatesPath},
	{"POST", GatePath},
	{"POST", RunOpen},
	{"POST", RunEnter},
	{"GET", RunTranscript},
	{"GET", CountersPath},
	{"GET", Drafts},
	{"POST", Drafts},
	{"GET", DigestPath},
	{"GET", ReviewPath},
	{"POST", ReviewStepDone},
	{"GET", StringsPath},
	{"GET", HomePath},
	{"GET", QueuePath},
	{"GET", SearchPath},
	{"POST", OmniboxResolvePath},
	{"POST", OmniboxAskPath},
	{"POST", OmniboxRunPath},
	{"POST", WindowPath},
	{"POST", WorkflowDisable},
	{"POST", UnitSkip},
	{"DELETE", UnitSkip},
	{"POST", DraftCloseSilently},
	{"GET", OutboxPath},

	{"POST", AgentTurnsStart},
	{"POST", AgentTurnsByHand},
	{"POST", AgentTurnsEnd},
	{"POST", AgentSessionsStart},
	{"POST", AgentSessionsStop},
	{"POST", AgentSessionsPrompt},
	{"GET", AgentAnswer},
	{"GET", AgentDrafts},
	{"POST", AgentDrafts},
	{"PATCH", AgentDrafts},
	{"DELETE", AgentDrafts},

	{"POST", AdminDryRunTurn},
	{"GET", AdminDoctor},
	{"GET", AdminTurn},
	{"POST", AdminProbe},
	{"POST", AdminGitAccess},
	{"GET", AdminTimings},
	{"GET", AdminFacts},
	{"GET", AdminMeter},
}

Operations is every route the daemon serves, UserAPI, AgentAPI and AdminAPI; the daemon routes each exactly once and no other.

View Source
var PlanReasons = []string{
	"the task holds no open item",
	"the task is not derived from items: its items do not close it",
	"its terminal is closed; it ends on its own",
	"its terminal is open with no agent in it: close that terminal, or dismiss this",
	"it has no workspace to find its terminal in: dismiss this",
	"its process is not proven a lasting orphan",
	"its process is no longer the orphan the census proved",
	"its process lingers orphaned and may come back; it closes once the process is gone, or after cleanup.orphan_hold",
	"its process changed while it was being closed",
}

PlanReasons are the plan item reasons strings.toml words, by their English text. No code reads the list: a client reads every reason through its catalog, and these literals are what internal/archtest counts as the clients reading those keys, since the daemon's guards, which give the reasons, lie outside the packages it scans.

WindowActions are the actions a WindowRequest may name.

Functions

func BucketOf

func BucketOf(buckets []Bucket, now, t time.Time) string

Bucket is the id of the first bucket whose Within is above now - t, the one with Within "" catching the rest; "" when no bucket takes t.

func BuiltinWhy added in v0.2.0

func BuiltinWhy(id string) string

BuiltinWhy is the refusal code of a built-in action disabled by its actions.toml why: "<id>.why".

func CompareUnits

func CompareUnits(a, b unit.Unit) int

CompareUnits orders units by provider, then key.

func Fold added in v0.2.0

func Fold(s string) string

Fold lowers s and drops its accents, a decomposed "é" (e and U+0301) included, the way the filters compare text.

func Major

func Major(v string) string

Major is the major of a version, "0" for a missing one.

func NotificationID

func NotificationID(cat Category, task string, token string) string

NotificationID is "<category>|<task-id>|<token>".

func ParseUnits added in v0.4.0

func ParseUnits(raw []string) ([]unit.Unit, error)

ParseUnits reads the TasksUnits of a request.

func PluginActionPath added in v0.3.0

func PluginActionPath(id, action string) string

PluginActionPath is the path of plugin id's action.

func PluginCan added in v0.2.0

func PluginCan(ps []Plugin, id unit.ProviderID, c string) bool

PluginCan says whether the plugin of provider id is enabled and serves capability c.

func PluginRunPath added in v0.3.0

func PluginRunPath(id string) string

PluginRunPath is the path of plugin id's command lines.

func PluginViewPath added in v0.3.0

func PluginViewPath(id unit.ProviderID, view string) string

PluginViewPath is the route of plugin id's view.

func Refuse added in v0.3.0

func Refuse(status int, format string, args ...any) error

Refuse is the refusal msg answered with status.

func RefuseCase added in v0.2.0

func RefuseCase(i int) string

RefuseCase is the refusal code of an intent's action disabled by its [[action.refuse]] case i: "action.refuse[<i>]".

func RefuseCaseIndex added in v0.2.0

func RefuseCaseIndex(code string) (int, bool)

RefuseCaseIndex is the case a RefuseCase code names.

func ReviewStepPath

func ReviewStepPath(step string) string

ReviewStepPath is the path that marks step done.

func SessionHandle

func SessionHandle(v string) (string, error)

SessionHandle validates the value of SessionHeader.

func TaskPath added in v0.3.0

func TaskPath(id string, rest ...string) string

TaskPath is the path of task id, followed by the segments of rest.

func UnitPath

func UnitPath(u unit.Unit, rest ...string) string

UnitPath is the path of u's detail, followed by the segments of rest.

func VersionOf added in v0.4.0

func VersionOf(v any) string

VersionOf is the first 12 hex digits of the SHA-256 of v as JSON: the version of a served catalog, whose own Version is empty.

func WordReason added in v0.4.0

func WordReason(words map[string]string, s Summary) string

WordReason is why s waits in words, a plugin's words of reasons by key, filled with the reason's values; s's reason as written when words name none.

func WorkflowDisablePath added in v0.4.0

func WorkflowDisablePath(name string) string

WorkflowDisablePath is WorkflowDisable for workflow name.

Types

type ActionRequest

type ActionRequest struct {
	Until      string `json:"until"`
	UntilState bool   `json:"until_state"`
	Guidance   string `json:"guidance"`
	AgentHome  string `json:"agent_home,omitempty"`
	Force      bool   `json:"force,omitempty"`
	// Basis is the action state's basis the client saw; the daemon refuses
	// the action when the row no longer rests on it.
	Basis string `json:"basis,omitempty"`
	// Inputs are the intent's declared inputs, by name.
	Inputs map[string]any `json:"inputs,omitempty"`
	// OptionID, Yes, No and Source answer a question; Guidance is the
	// answer's text, a note to an option, yes or no. Source is cockpit,
	// notification, tui or terminal.
	OptionID string `json:"option_id,omitempty"`
	Yes      bool   `json:"yes,omitempty"`
	No       bool   `json:"no,omitempty"`
	Source   string `json:"source,omitempty"`
	// NoBrief starts a review, address or run without waiting for the
	// brief.
	NoBrief bool `json:"no_brief,omitempty"`
	// Items and Task tie what the action's turn drafts to the item ids of the unit and the task it
	// was asked from.
	Items []string `json:"items,omitempty"`
	Task  string   `json:"task,omitempty"`
	// Manager is the workspace manager that creates the turn's worktree, ""
	// for the configured ones; Parent is the caller's worktree, the new
	// one's parent where its manager keeps parents.
	Manager string `json:"manager,omitempty"`
	Parent  string `json:"parent,omitempty"`
}

type ActionResult

type ActionResult struct {
	OK     bool     `json:"ok"`
	Output []string `json:"output,omitempty"`
	Intake *Intake  `json:"intake,omitempty"`
	// Seq is the turn an intent started headless, answered 202; 0 otherwise.
	Seq int64 `json:"seq,omitempty"`
	// Copy is what the action produced for the person to paste elsewhere; a client puts it on the
	// clipboard, or shows it where it cannot. Output then says what was copied.
	Copy *Copy `json:"copy,omitempty"`
}

type ActionSpec

type ActionSpec struct {
	ID       string     `json:"id"`
	Label    string     `json:"label"`
	Summary  string     `json:"summary,omitempty"` // what pressing it does, from the profile
	Group    string     `json:"group"`             // start | turn | control | workspace | brief | intake; draft and plan for theirs
	Key      string     `json:"key,omitempty"`     // TUI key
	Surfaces []string   `json:"surfaces"`          // row, detail, task, tui, menubar, notification, cli, explore
	Input    *InputSpec `json:"input,omitempty"`
	Intake   bool       `json:"intake,omitempty"`
	Toggle   string     `json:"toggle,omitempty"` // paired id sharing the key: hold<->release
	Source   string     `json:"source"`           // "builtin" or the manifest path
	Scope    string     `json:"scope,omitempty"`  // "unit" (default), "item", "draft" or "run"
	Verb     string     `json:"verb,omitempty"`   // task verb it fulfills: "next", "waiting", "delegate", "done", "dismiss", "approve", "snooze"; scope draft also "edit", "retry"
	Plugin   string     `json:"plugin,omitempty"` // provider id, from the intent's Def.Provider; "" is core
	// Copies marks an action whose result carries something to copy (ActionResult.Copy), so a client that
	// must claim the clipboard while the person's click lasts claims it before the result arrives.
	Copies bool `json:"copies,omitempty"`
}

ActionSpec is an action the daemon may offer on a row, as GET /api/actions serves it.

type ActionState

type ActionState struct {
	ID      string `json:"id"`
	Enabled bool   `json:"enabled"`
	// Reason is why a disabled action is off: the profile's why.
	Reason string `json:"reason,omitempty"`
	// Refusal names the profile text Reason is, which a client recognizes
	// a refusal by: BuiltinWhy or RefuseCase; "" for another reason.
	Refusal string `json:"refusal,omitempty"`
	// Note is what an enabled action would do on this row.
	Note    string `json:"note,omitempty"`
	Label   string `json:"label,omitempty"`
	Primary bool   `json:"primary,omitempty"`
	Confirm string `json:"confirm,omitempty"`
	Basis   string `json:"basis,omitempty"`
	// Warning is shown under an enabled action.
	Warning string `json:"warning,omitempty"`
	// Intent is the intent an intake action runs as when it is not the
	// action's own, such as run_now's on a held round; "" when none resolves.
	Intent string `json:"intent,omitempty"`
}

ActionState is one action as offered on a row now.

type ActionsResponse

type ActionsResponse struct {
	Version string       `json:"version"`
	Specs   []ActionSpec `json:"specs"`
	// Plan are the actions a plan item may offer.
	Plan []ActionSpec `json:"plan"`
}

ActionsResponse is the answer of GET /api/actions; a row's specs_version names the Version its actions follow.

type ActivityItem

type ActivityItem struct {
	Event Event `json:"event"`
	// Label is the event's unit as people read it; "" for none.
	Label  string `json:"label,omitempty"`
	Title  string `json:"title"`
	URL    string `json:"url"`
	Author string `json:"author"`
	State  string `json:"state"`
	Mine   bool   `json:"mine"`
}

type AgentDraft added in v0.5.0

type AgentDraft struct {
	ID       int64           `json:"id"`
	Rev      int64           `json:"rev"`
	Unit     string          `json:"unit"` // "<provider>/<key>"
	Kind     string          `json:"kind"`
	Delivery string          `json:"delivery"`
	Target   string          `json:"target,omitempty"`
	Text     string          `json:"text"`
	Payload  json.RawMessage `json:"payload,omitempty"`
	Basis    string          `json:"basis,omitempty"`
	Hold     bool            `json:"hold,omitempty"`
	// State is where its delivery stands: held, queued, sending, sent, failed or dropped; Error why it
	// failed, Reason why it was dropped.
	State     string `json:"state"`
	Error     string `json:"error,omitempty"`
	Reason    string `json:"reason,omitempty"`
	Permalink string `json:"permalink,omitempty"`
	// Link is the address of its card in the cockpit, where the user reviews, edits and posts it.
	Link string `json:"link,omitempty"`
	// Revisions are its content's revisions, oldest first.
	Revisions []AgentDraftRevision `json:"revisions,omitempty"`
}

AgentDraft is a draft as an agent reads it.

type AgentDraftProposal added in v0.5.0

type AgentDraftProposal struct {
	// Unit is the unit the draft posts on, "<provider>/<key>"; "" is the unit of the caller's turn.
	Unit string `json:"unit,omitempty"`
	// Kind is a draft kind the unit's plugin declares.
	Kind   string `json:"kind"`
	Target string `json:"target,omitempty"`
	Text   string `json:"text,omitempty"`
	// Payload is what the kind's schema shapes beside Text, posted verbatim.
	Payload json.RawMessage `json:"payload,omitempty"`
	// Basis is what the agent read the unit at, such as a pull request's head, for a kind that takes one.
	Basis string `json:"basis,omitempty"`
	// Hold keeps the draft waiting for the user whatever the approval rules say.
	Hold bool `json:"hold,omitempty"`
	// Draft false posts it at once from a session the user drives; true or absent makes a draft.
	Draft   *bool    `json:"draft,omitempty"`
	Items   []string `json:"items,omitempty"`
	Effects []string `json:"effects,omitempty"`
	Why     string   `json:"why,omitempty"`
}

AgentDraftProposal is a draft an agent proposes for the user's approval.

type AgentDraftRevision added in v0.5.0

type AgentDraftRevision struct {
	Rev     int64           `json:"rev"`
	Text    string          `json:"text"`
	Payload json.RawMessage `json:"payload,omitempty"`
	Basis   string          `json:"basis,omitempty"`
	By      string          `json:"by"`
	Session string          `json:"session,omitempty"`
	At      time.Time       `json:"at"`
}

AgentDraftRevision is one revision of a draft's content: By is person, session, rule or window, Session the agent session of a session's.

type AgentDraftUpdate added in v0.5.0

type AgentDraftUpdate struct {
	ID      int64           `json:"id"`
	Rev     int64           `json:"rev"`
	Text    *string         `json:"text,omitempty"`
	Payload json.RawMessage `json:"payload,omitempty"`
	Basis   *string         `json:"basis,omitempty"`
	Draft   *bool           `json:"draft,omitempty"`
}

AgentDraftUpdate revises draft ID at Rev, the rev the agent read; an absent field is left as it is. Draft false posts the draft, revised or not, at once from a session the user drives; true or absent leaves it a draft.

type AgentDraftWithdrawal added in v0.5.0

type AgentDraftWithdrawal struct {
	ID     int64  `json:"id"`
	Rev    int64  `json:"rev"`
	Reason string `json:"reason,omitempty"`
}

AgentDraftWithdrawal withdraws draft ID at Rev for Reason.

type AppStatus

type AppStatus struct {
	State         string `json:"state"`
	Notifications string `json:"notifications"`
}

AppStatus is what the menu bar app reports about itself.

type AskView added in v0.3.0

type AskView struct {
	Item      string   `json:"item"`
	Summary   string   `json:"summary"`
	Asker     string   `json:"asker,omitempty"`
	Permalink string   `json:"permalink,omitempty"`
	Quotes    []string `json:"quotes,omitempty"`
}

AskView is an item a task serves, as its asker put it, with the source messages it quotes.

type AttachRequest added in v0.3.0

type AttachRequest struct {
	Cwd          string `json:"cwd"`
	Pane         string `json:"pane,omitempty"`
	AgentSession string `json:"agent_session,omitempty"`
	Home         string `json:"home,omitempty"`
	Agent        string `json:"agent,omitempty"`
}

AttachRequest is what AttachPath reads of the calling session's environment besides SessionHeader: its directory, pane, agent session, agent home and agent.

type Attention

type Attention struct {
	ID       string            `json:"id"`
	Category string            `json:"category"`
	Title    string            `json:"title"`
	Subtitle string            `json:"subtitle"`
	Body     string            `json:"body"`
	Image    string            `json:"image,omitempty"`
	Actions  []AttentionAction `json:"actions"`
}

Attention is a notification as the daemon decides it; ID is stable for as long as what it notifies lasts.

type AttentionAction

type AttentionAction struct {
	ID        string `json:"id"`
	Title     string `json:"title"`
	TextInput bool   `json:"text_input,omitempty"`
	// Placeholder and Button word a text input: the hint in its field and the button that sends it.
	Placeholder string `json:"placeholder,omitempty"`
	Button      string `json:"button,omitempty"`
	// Basis is the row state's basis the action was offered on.
	Basis string `json:"basis,omitempty"`
}

type Brief

type Brief struct {
	Goal          string   `json:"goal"`
	Context       string   `json:"context"`
	Kind          string   `json:"kind"`
	Size          string   `json:"size"`
	Risk          string   `json:"risk"`
	RiskWhy       string   `json:"risk_why"`
	OpenQuestions []string `json:"open_questions"`
	Tags          []string `json:"tags,omitempty"`
	// Extra are the brief intent's extra fields, by name; ExtraVersions the
	// version of each the brief holds.
	Extra         map[string]any    `json:"extra,omitempty"`
	ExtraVersions map[string]string `json:"extra_versions,omitempty"`
}

type BriefStatus

type BriefStatus struct {
	Ready       int       `json:"ready"`
	Pending     int       `json:"pending"`
	Failed      int       `json:"failed"`
	LastError   string    `json:"last_error,omitempty"`
	PausedUntil time.Time `json:"paused_until,omitzero"`
}

type BriefSummary

type BriefSummary struct {
	Kind          string   `json:"kind"`
	Size          string   `json:"size"`
	Risk          string   `json:"risk"`
	Goal          string   `json:"goal"`
	OpenQuestions int      `json:"open_questions"`
	Tags          []string `json:"tags,omitempty"`
	// Extra are the brief intent's extra fields, by name.
	Extra map[string]any `json:"extra,omitempty"`
}

type BriefTimings

type BriefTimings struct {
	Call   Quantiles `json:"call"`
	Failed int       `json:"failed"`
	// Reused counts the runs that carried the brief in use over.
	Reused  int     `json:"reused"`
	CostUSD float64 `json:"cost_usd"`
	Outages int     `json:"outages"`
	// Unrecorded counts the runs started before recording began, which the
	// figures leave out.
	Unrecorded int `json:"unrecorded"`
}

BriefTimings are the brief runs of the window: the call time of the ok ones, the failed and the reused ones, their cost and the breaker's openings.

type BriefView

type BriefView struct {
	State string    `json:"state"`
	Brief *Brief    `json:"brief,omitempty"`
	Model string    `json:"model,omitempty"`
	At    time.Time `json:"at,omitzero"`
	Error string    `json:"error,omitempty"`
	// Stale marks a brief that is due again: the pull request moved on.
	Stale bool `json:"stale"`
}

type Briefing added in v0.4.0

type Briefing struct {
	Template  string           `json:"template"`
	Sentences [][]BriefingPart `json:"sentences"`
	Counters  []HomeCounter    `json:"counters"`
	Empty     string           `json:"empty,omitempty"`
}

Briefing is the home's sentences, each a run of text and counter parts; Empty is what it says when every counter is zero.

type BriefingPart added in v0.4.0

type BriefingPart struct {
	Text    string `json:"text,omitempty"`
	Counter *int   `json:"counter,omitempty"`
}

BriefingPart is text, or with Counter set the counter of that index in Briefing.Counters.

type BriefsHealth

type BriefsHealth struct {
	Unavailable string    `json:"unavailable,omitempty"`
	Open        bool      `json:"open"`
	Since       time.Time `json:"since,omitzero"`
	Error       string    `json:"error,omitempty"`
	Next        time.Time `json:"next,omitzero"`
}

BriefsHealth is the brief breaker: Open while briefs are unavailable, since Since for Error, with the next trial at Next. Unavailable says why the daemon runs no brief at all while brief.enabled is set.

type Bucket

type Bucket struct {
	ID     string `json:"id"` // the value the lens groups and filters by ("today", "week", "due")
	Label  string `json:"label"`
	Within string `json:"within"` // Go duration; the first bucket whose Within covers now - value wins; "" catches the rest
}

type ByHandRequest

type ByHandRequest struct {
	Intent string `json:"intent"`
	URL    string `json:"url,omitempty"`
	// Inputs are the intent's declared inputs, by name.
	Inputs       map[string]any `json:"inputs,omitempty"`
	Agent        string         `json:"agent,omitempty"`
	Guidance     string         `json:"guidance,omitempty"`
	Cwd          string         `json:"cwd"`
	Pane         string         `json:"pane,omitempty"`
	AgentSession string         `json:"agent_session,omitempty"`
	Home         string         `json:"home,omitempty"`
}

ByHandRequest is a turn the user starts by hand from the session that calls, described by that session's environment.

type ByHandResult

type ByHandResult struct {
	Text string `json:"text"`
	// Notes are what the loop did around the turn, for the caller's standard
	// error.
	Notes []string `json:"notes,omitempty"`
}

type Candidate

type Candidate struct {
	Unit           unit.Unit `json:"unit"`
	Label          string    `json:"label"`
	URL            string    `json:"url"`
	Title          string    `json:"title"`
	Author         string    `json:"author"`
	State          string    `json:"state"`
	IsDraft        bool      `json:"draft"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	Additions      int       `json:"additions"`
	Deletions      int       `json:"deletions"`
	ChangedFiles   int       `json:"changed_files"`
	HeadBranch     string    `json:"head"`
	BaseBranch     string    `json:"base"`
	ReviewDecision string    `json:"review_decision"`
	ReviewRequests []string  `json:"review_requests"` // logins and team:org/slug
	ChecksState    string    `json:"checks"`
	Comments       int       `json:"comments"`
	// MyReview is the viewer's latest review state, "" when none.
	MyReview       string     `json:"my_review"`
	MyReviewOnHead bool       `json:"my_review_on_head"`
	Brief          *BriefView `json:"brief,omitempty"`
	// Actions are what the pull request offers now, as its row would.
	Actions []ActionState `json:"actions"`
}

Candidate is a pull request Explore found, with what deciding whether to help on it needs.

type CardView

type CardView = card.Snapshot

CardView is a unit's stored card on a task's detail.

type CatalogResponse

type CatalogResponse struct {
	Version    string          `json:"version"` // changes when any list changes; rows do not carry it
	Views      []ViewSpec      `json:"views"`
	Facets     []FacetSpec     `json:"facets"`
	Situations []SituationSpec `json:"situations"`
	// Events are the words of the plugins' event kinds.
	Events []EventSpec `json:"events,omitempty"`
	// Details are the words of the fields of the plugins' unit details.
	Details []DetailSpec `json:"details,omitempty"`
	// Lens are the plugins' own row words, which replace the views catalog's for their rows.
	Lens []ProviderWords `json:"lens,omitempty"`
	// Reasons are the plugins' words of the reasons their rows name (Summary.ReasonKey), by key.
	Reasons []ProviderWords `json:"reasons,omitempty"`
	// CardSignals are the plugins' words of their cards' signals, by key.
	CardSignals []SignalSpec `json:"card_signals,omitempty"`
}

func (CatalogResponse) CardSignal added in v0.4.0

func (c CatalogResponse) CardSignal(provider, key string) (SignalSpec, bool)

CardSignal is the words of provider's card signal key; ok is false when no plugin words it.

func (CatalogResponse) KindLabel

func (c CatalogResponse) KindLabel(r Row) string

KindLabel is the label of a row's kind, the kind itself when the catalog has none.

func (CatalogResponse) ReasonOf added in v0.4.0

func (c CatalogResponse) ReasonOf(r Row) string

ReasonOf is why r waits: its plugin's words of the reason it names, filled with the reason's values, else the reason as the plugin wrote it.

func (CatalogResponse) RowWordsOf added in v0.4.0

func (c CatalogResponse) RowWordsOf(provider string, w LensWords) LensWords

RowWordsOf are w with provider's own row words of c over them.

func (CatalogResponse) Situation

func (c CatalogResponse) Situation(provider string, k Kind) (SituationSpec, bool)

Situation is the spec of a provider's kind; ok is false for an unknown one.

func (CatalogResponse) ViewsOn

func (c CatalogResponse) ViewsOn(surface string) []ViewSpec

ViewsOn are the views a surface shows, in order.

type Category

type Category string

Category is the first part of a notification id: Q<record-id>, INBOX, OUTBOX, HELD, DIGEST or NOTE.

const (
	CategoryInbox  Category = "INBOX"
	CategoryOutbox Category = "OUTBOX"
	// CategoryHeld's token is the local day, so it is posted once a day.
	CategoryHeld Category = "HELD"
	// CategoryDigest's task is "-" and its token the day.
	CategoryDigest Category = "DIGEST"
	CategoryNote   Category = "NOTE"
)

func ParseNotificationID

func ParseNotificationID(id string) (cat Category, task string, ok bool)

ParseNotificationID reads an id NotificationID wrote.

func QuestionCategory

func QuestionCategory(record int64) Category

QuestionCategory is the category of the question of turn record record.

func (Category) Record

func (c Category) Record() (int64, bool)

Record is the turn record a question category names; ok is false for any other category.

type Change

type Change struct {
	Type   string      `json:"type"` // "changed", "notify" or "window"
	Epoch  string      `json:"epoch"`
	Rev    uint64      `json:"rev"`
	Units  []unit.Unit `json:"units,omitempty"`
	All    bool        `json:"all,omitempty"`
	Health bool        `json:"health,omitempty"`
	// Plan says what GET /api/plan serves moved.
	Plan bool `json:"plan,omitempty"`
	// Gates says what GET /api/gates serves moved: a gate, or the draft, item, message or plan item one shows.
	Gates   bool     `json:"gates,omitempty"`
	Notices []Notice `json:"notices,omitempty"`
	// Counters are the Area "" counters, on every "changed" change after a note of what a view reads: the tasks,
	// their gates, wakes, drafts, records, links, placements or the profile.
	Counters *Counters `json:"counters,omitempty"`
	// Windows are window requests, in the order they came, sent only to the events client named WindowClient.
	Windows []WindowRequest `json:"windows,omitempty"`
}

Change says what moved: the units whose row changed or left since the previous change, or All when too much moved to list, and whether the health, the plan or the gates moved. A client reads again only what a change names. A "notify" change carries the notices a workflow raised for the user.

func (*Change) Merge

func (into *Change) Merge(c Change)

Merge folds c into the change, which then says what both said; a change of another epoch makes it All.

type ChangeFailure

type ChangeFailure struct {
	Merged  int `json:"merged"`
	Briefed int `json:"briefed"`
	Failed  int `json:"failed"`
	Tagged  int `json:"tagged"`
	// Recent counts the briefed merges younger than Days, left out of
	// Briefed until a fix had the time to come.
	Recent     int    `json:"recent"`
	Days       int    `json:"days"`
	Definition string `json:"definition"`
}

ChangeFailure is the share of the window's merges a later fix or revert changed again: Failed of Briefed, the merges at least Days old whose brief listed their changed files; Recent are younger ones, left out. Tagged counts the merges whose own brief tags them change:fix or change:revert.

type ChatRequest added in v0.3.0

type ChatRequest struct {
	Text   string `json:"text"`
	Intent string `json:"intent,omitempty"`
}

ChatRequest is a message to a task's agent; Intent picks the intent of the turn it starts when no session is live, the profile's chat intent when "".

type CheckDetail

type CheckDetail struct {
	Name    string   `json:"name"`
	URL     string   `json:"url,omitempty"`
	Summary string   `json:"summary,omitempty"`
	Steps   []string `json:"steps,omitempty"`
}

type CheckFacts

type CheckFacts struct {
	State   string   `json:"state"`
	Failing []string `json:"failing,omitempty"`
}

type ClosedSession

type ClosedSession struct {
	Session string    `json:"session"`
	At      time.Time `json:"at"`
	Reason  string    `json:"reason"`
	Resume  string    `json:"resume,omitempty"`
}

ClosedSession is a session closed with the line that resumes it.

type Copy added in v0.5.0

type Copy struct {
	Text string `json:"text"`
	HTML string `json:"html,omitempty"`
}

Copy is a text to put on the clipboard: Text as plain text, HTML the same text formatted, "" for none.

type Counters

type Counters struct {
	Area     string         `json:"area"`
	Views    map[string]int `json:"views"`
	Areas    map[string]int `json:"areas"`
	Contexts map[string]int `json:"contexts"`
	Badge    int            `json:"badge"`
}

type Detail

type Detail struct {
	Row    Row        `json:"row"`
	Events []Event    `json:"events"`
	Brief  *BriefView `json:"brief,omitempty"`
	// ProfileChain names the review profile layers a round here reads.
	ProfileChain string    `json:"profile_chain"`
	Turn         *TurnView `json:"turn,omitempty"`
	// Card and Items are the unit card's (#unit-card).
	Card  *card.Snapshot `json:"card,omitempty"`
	Items []items.Item   `json:"items"`
	// ItemTies are how each of Items stands with the user's work, by item id.
	ItemTies map[string]ItemTie `json:"item_ties"`
	// SkippedWorkflows are the workflows skipped on the unit, through UnitSkip.
	SkippedWorkflows []string `json:"skipped_workflows"`
}

type DetailSpec added in v0.3.0

type DetailSpec struct {
	Provider string `json:"provider"`
	Field    string `json:"field"`
	Label    string `json:"label"`
	Title    string `json:"title,omitempty"`
}

DetailSpec is how a field of a plugin's unit detail shows: the field of the detail, else of the row's payload override, that holds its value.

type Digest

type Digest struct {
	Day    string   `json:"day"`
	Title  string   `json:"title"`
	Body   string   `json:"body"`
	Counts Counters `json:"counts"`
	Tasks  []string `json:"tasks"`
}

type DoctorCheck

type DoctorCheck struct {
	Mark string `json:"mark"`
	Name string `json:"name"`
	Info string `json:"info,omitempty"`
	Fix  string `json:"fix,omitempty"`
}

DoctorCheck is one line of `doctor`; Fix is printed for a missing check.

type DoctorQuery

type DoctorQuery struct {
	Repo string `json:"repo,omitempty"`
	PR   string `json:"pr,omitempty"`
}

DoctorQuery narrows the state `profile show` reads to one repository or, with PR, one pull request.

type DoctorReport

type DoctorReport struct {
	Checks []DoctorCheck `json:"checks"`
	// BundledChanged are the intents whose bundled guide changed since the
	// queried repository's last round.
	BundledChanged []string `json:"bundled_changed,omitempty"`
	// Reconcile is the start-up reconcile's report; nil while it runs.
	Reconcile *ReconcileReport `json:"reconcile,omitempty"`
	// Workflows are the checks of the workflows the daemon runs.
	Workflows []DoctorCheck `json:"workflows,omitempty"`
}

DoctorReport is doctor's checks that read the loop's state.

type Draft

type Draft struct {
	ID    int64    `json:"id"`
	Unit  string   `json:"unit"` // "<provider>/<key>"
	Items []string `json:"items"`
	Task  string   `json:"task,omitempty"`
	Kind  string   `json:"kind"`
	// Purpose is what the draft is for, Delivery how it is posted (message,
	// reaction or comment) and Effects what posting it applies.
	Purpose  string   `json:"purpose"`
	Delivery string   `json:"delivery"`
	Effects  []string `json:"effects"`
	Target   string   `json:"target"`
	// Broadcast is "on" or "off" for a thread reply also posted, or not, to its conversation, which edit's
	// broadcast argument turns; "" when the draft replies in no thread.
	Broadcast string `json:"broadcast"`
	// Where names the conversation or person the draft posts to; "" when its publisher could not tell.
	Where string `json:"where"`
	Text  string `json:"text"`
	// Why is why the draft was proposed, in the interface language when it was made; Language is the
	// language Text is written in.
	Why      string `json:"why"`
	Language string `json:"language"`
	Reaction string `json:"reaction"`
	Original string `json:"original"`
	// Replaced is the text a sent edit replaced.
	Replaced string      `json:"replaced,omitempty"`
	Edited   bool        `json:"edited"`
	Origin   DraftOrigin `json:"origin"`
	// State is where its delivery stands: held while its gate is open, queued, sending, sent, failed or dropped.
	State  string `json:"state"`
	Error  string `json:"error"`
	Reason string `json:"reason"`
	// Quoted says, in the profile's words (gates.toml's drafts.quoted), which conversation a draft posted in
	// the direct conversation of the person it is to quotes; "" for any other draft.
	Quoted string `json:"quoted,omitempty"`
	// ReasonText is Reason in the profile's words (gates.toml's drafts.reasons) for a dropped draft; "" when
	// it words none.
	ReasonText string `json:"reason_text,omitempty"`
	Permalink  string `json:"permalink"`
	// Gate is the draft's gate, 0 for none; Deadline is when its window resolves it, nil for none; Intents are
	// its open gate's intents by the status each resolves it to (approved, rejected), the first of each.
	Gate     int64             `json:"gate,omitempty"`
	Deadline *time.Time        `json:"deadline"`
	Intents  map[string]string `json:"intents,omitempty"`
	// Actions are the draft actions of the catalog as they stand on the draft: its delivery's, edit and retry.
	Actions []ActionState `json:"actions"`
	// Rev is the stored draft's version; approve and retry send the one they showed.
	Rev       int64     `json:"rev"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	// Label, Title and Link present the unit as its row does; with no row, Label is the unit's own.
	Label string `json:"label,omitempty"`
	Title string `json:"title,omitempty"`
	Link  string `json:"link,omitempty"`
	// Names are the display names of the people Text mentions, by mention key ("slack:U0123"), as the
	// unit's items know them; the draft routes fill them and the item details, the Outbox tasks do not.
	Names map[string]string `json:"names,omitempty"`
	// ItemDetails are the items the draft is about, with their summaries.
	ItemDetails []ItemView `json:"item_details,omitempty"`
	// Preview is the draft's summary line, its kind's preview template over the draft, as markdown; "" when the
	// kind has none.
	Preview string `json:"preview,omitempty"`
	// Payload is what the draft posts besides Text, verbatim, and Fields every value of it as its card shows
	// it, in the payload's order; both empty for a draft of a kind with no payload.
	Payload json.RawMessage `json:"payload,omitempty"`
	Fields  []DraftField    `json:"fields,omitempty"`
	// Basis is what the draft was written against, such as a pull request's head; Stale says its unit moved
	// past it, so approving it is refused.
	Basis string `json:"basis,omitempty"`
	Stale bool   `json:"stale,omitempty"`
	// PinnedBy is the open question message whose option or confirm pins the draft, 0 for none. Approving the
	// draft at the pinned rev picks that option; clients show it under the option where the question shows.
	PinnedBy int64 `json:"pinned_by,omitempty"`
	// StaleUnknown says the unit's live basis could not be read in time, so Stale is not known; the approval
	// stays offered, and approving and sending re-check it live.
	StaleUnknown bool `json:"stale_unknown,omitempty"`
	// TextLocked says the draft's kind lets no person change its text, which its publisher may not post.
	TextLocked bool `json:"text_locked,omitempty"`
	// Hold keeps every approval rule from releasing the draft.
	Hold bool `json:"hold,omitempty"`
	// By is who wrote the draft's current content (person, session, rule or window), Author that in the
	// profile's words (gates.toml's drafts.authors); both "" when unknown.
	By     string `json:"by,omitempty"`
	Author string `json:"author,omitempty"`
	// ByRule is the approval rule of the user's that sent the draft, "" when none did.
	ByRule string `json:"by_rule,omitempty"`
	// Notes are the profile's sentences on how the draft stands (gates.toml's drafts.stale and drafts.hold,
	// notices.toml's draft_by_rule), in that order, and, on the draft an agent session just wrote and asked to
	// send, last, notices.toml's draft_sent.
	Notes []string `json:"notes,omitempty"`
}

type DraftCloseSilentlyRequest added in v0.4.0

type DraftCloseSilentlyRequest struct {
	Rev int64 `json:"rev"`
}

DraftCloseSilentlyRequest names the draft's version the person saw.

type DraftContext added in v0.4.0

type DraftContext struct {
	Asks  []AskView    `json:"asks"`
	Items []OutboxItem `json:"items"`
}

DraftContext is what a draft answers: the asks of its task, with their quotes, and the items it is about, with where each stands.

type DraftCreate

type DraftCreate struct {
	Unit     unit.Unit `json:"unit"`
	Task     string    `json:"task,omitempty"`
	Items    []string  `json:"items,omitempty"`
	Kind     string    `json:"kind,omitempty"`
	Text     string    `json:"text,omitempty"`
	Reaction string    `json:"reaction,omitempty"`
	// Target is the message a reply answers or a reaction goes on, when it is
	// not the unit's own.
	Target string `json:"target,omitempty"`
	// Broadcast asks, "on" or "off", that a reply in a thread also post to its conversation, or not; "" leaves it
	// to the publisher, which also ignores it on a reply in no thread.
	Broadcast string `json:"broadcast,omitempty"`
	Send      bool   `json:"send,omitempty"`
	Source    string `json:"source"`
}

DraftCreate is a draft the user writes on Unit, for Task and its Items when set: Text, a reply its plugin posts as its default kind, or Reaction alone, which its plugin posts as its first kind that reacts; Kind names another kind its plugin declares. It waits in the Outbox for approval, unless Send approves it at once to go out through the same publisher. Source is cockpit, notification, tui or terminal.

type DraftField added in v0.5.0

type DraftField struct {
	Pointer  string        `json:"pointer"`
	Label    string        `json:"label"`
	Value    string        `json:"value,omitempty"`
	Shown    string        `json:"shown,omitempty"`
	Fields   []DraftField  `json:"fields,omitempty"`
	Editable bool          `json:"editable,omitempty"`
	Options  []DraftOption `json:"options,omitempty"`
	// Markdown says Value is Markdown, which the card renders as it renders the draft's text.
	Markdown bool `json:"markdown,omitempty"`
}

DraftField is a value of a draft's payload as its card shows it: Label is the plugin's word for its key (ui.toml's drafts.<kind>.fields), else the key, or the item's position in a list. A scalar has Value, as posted, and Shown, its word when the plugin words it; an object or a list has Fields. Editable says a person may change it, to one of Options, its schema's enum; a field with no enum is never editable on the card.

type DraftOption added in v0.5.0

type DraftOption struct {
	Value string `json:"value"`
	Label string `json:"label"`
}

DraftOption is a value an editable field takes, with its word.

type DraftOrigin

type DraftOrigin struct {
	Kind     string `json:"kind"`
	TurnSeq  int64  `json:"turn_seq"`
	Intent   string `json:"intent"`
	Workflow string `json:"workflow"`
	Rule     string `json:"rule"`
	// Unit is the label of the proposing turn's unit when it is not the
	// draft's, "" when it is.
	Unit string `json:"unit,omitempty"`
}

type DraftsResponse

type DraftsResponse struct {
	Drafts []Draft `json:"drafts"`
}

type DryRunTurn

type DryRunTurn struct {
	ID     string `json:"id"`
	Prompt string `json:"prompt"`
	// Why is the why section the instructions rendered; empty without one.
	Why string `json:"why,omitempty"`
}

DryRunTurn is the stored dry-run turn the command line runs the agent on.

type DryRunTurnRequest

type DryRunTurnRequest struct {
	PR  string        `json:"pr"`
	Why *workflow.Why `json:"why,omitempty"`
}

DryRunTurnRequest asks for the review turn of a `profile try`.

type Event

type Event struct {
	Unit  unit.Unit `json:"unit"`
	Kind  string    `json:"kind"`
	Key   string    `json:"key"`
	Actor string    `json:"actor"`
	At    time.Time `json:"at"`
	Data  string    `json:"data"`
}

type EventSpec added in v0.3.0

type EventSpec struct {
	Provider string `json:"provider"`
	Kind     string `json:"kind"`
	Label    string `json:"label"`
	Loop     bool   `json:"loop,omitempty"`
	Tone     string `json:"tone,omitempty"`
	// Data is how its data shows: "" as it is, "none", "first_field",
	// "short_sha" or "requested".
	Data string `json:"data,omitempty"`
}

EventSpec is how an event kind, a plugin's or the core's (Provider ""), shows on a timeline; Loop says it is the loop's doing, and Tone is what it is drawn in: "loop", "me", "people" or "".

type ExploreRequest

type ExploreRequest struct {
	Query string `json:"query"`
}

type ExploreResult

type ExploreResult struct {
	Query      string      `json:"query"` // what GitHub was asked
	Read       string      `json:"read"`  // how the input was read
	Empty      string      `json:"empty,omitempty"`
	Total      int         `json:"total"`
	Candidates []Candidate `json:"candidates"`
	Cost       int         `json:"cost"`
	RateLimit  RateLimit   `json:"rate_limit"`
	Recent     []string    `json:"recent"`
}

type Facet

type Facet struct {
	ID     string   `json:"id"`
	Label  string   `json:"label"`
	Field  string   `json:"field"`
	Values []string `json:"values,omitempty"`
}

Facet: Field is "row.*", "item.*" or "<provider>.*".

type FacetDisplay added in v0.4.0

type FacetDisplay struct {
	Show        string              `json:"show,omitempty"`
	ShowOnly    []string            `json:"show_only,omitempty"`
	ShowValues  string              `json:"show_values,omitempty"`
	LabelPrefix string              `json:"label_prefix,omitempty"`
	ShowWhen    map[string][]string `json:"show_when,omitempty"`
	ShowMax     int                 `json:"show_max,omitempty"`
	ShowLabel   string              `json:"show_label,omitempty"`
	RowClass    map[string]string   `json:"row_class,omitempty"`
	Labels      map[string]string   `json:"labels,omitempty"`
	Strip       bool                `json:"strip,omitempty"`
	Colors      map[string]string   `json:"colors,omitempty"`
	// BucketLabels are the words of the facet's buckets, by bucket id.
	BucketLabels map[string]string `json:"bucket_labels,omitempty"`
}

FacetDisplay is where and how one provider shows a facet's values on its rows: FacetSpec's keys of the same names.

type FacetSpec

type FacetSpec struct {
	ID       string `json:"id"` // "repo", "author", "kind", ...
	Label    string `json:"label"`
	Provider string `json:"provider"` // "" applies to every row
	// Fact is the task fact or record field a profile's task facet reads; "" for a plugin's facet.
	Fact    string            `json:"fact,omitempty"`
	Group   bool              `json:"group"`
	Sort    string            `json:"sort,omitempty"` // "", "rank", "text", "time" (RFC 3339 values)
	Rank    []string          `json:"rank,omitempty"`
	Labels  map[string]string `json:"labels,omitempty"` // value -> shown text
	Empty   string            `json:"empty,omitempty"`
	Match   string            `json:"match,omitempty"` // "exact" (default), "suffix" (repo), "prefix" (tag), "team"
	Menu    bool              `json:"menu"`
	Buckets []Bucket          `json:"buckets,omitempty"` // Sort "time" only: the client buckets now - value
	// Strip says each row's strip is colored by the facet's first value,
	// its rank the strip's legend.
	Strip bool `json:"strip,omitempty"`
	// Colors are the strip hues of the facet's values (builtin.StripColors names them), by value.
	Colors map[string]string `json:"colors,omitempty"`
	// Show is the part of a row the facet's values show in (builtin.ShowParts names them); "" keeps the facet to the lens.
	Show string `json:"show,omitempty"`
	// ShowOnly are the values the part shows, all of them when empty.
	ShowOnly []string `json:"show_only,omitempty"`
	// ShowValues is how many of an item's values the part shows: "all" (the default) or "first".
	ShowValues string `json:"show_values,omitempty"`
	// LabelPrefix goes before each shown value's label on a row, never in a group's head.
	LabelPrefix string `json:"label_prefix,omitempty"`
	// ShowWhen names, by facet id, the values a row must hold in that facet for this facet to show; empty
	// shows it always.
	ShowWhen map[string][]string `json:"show_when,omitempty"`
	// ShowMax is how many of the values the part shows at most; the rest count into one piece. 0 shows all.
	ShowMax int `json:"show_max,omitempty"`
	// ShowLabel is an age part's label, a template over `{{.age}}`, which Parts fills, and `{{.at}}`, the
	// raw time a client writes in its own locale.
	ShowLabel string `json:"show_label,omitempty"`
	// RowClass is the class of a row that holds a value, by value.
	RowClass map[string]string `json:"row_class,omitempty"`
	// Displays are, on a facet merged across providers, each provider's display keys, by provider: a row
	// is placed with its own provider's.
	Displays map[string]FacetDisplay `json:"displays,omitempty"`
	// Providers are the providers a merged facet (Provider "") came from; never served.
	Providers []string `json:"-"`
}

func (FacetSpec) Display added in v0.4.0

func (f FacetSpec) Display() FacetDisplay

Display is the facet's own display keys.

func (FacetSpec) For added in v0.4.0

func (f FacetSpec) For(provider string) FacetSpec

For is the facet as provider's rows show it: its display keys replaced by provider's on a merged facet, the labels provider leaves out kept.

func (FacetSpec) MechanicsDiff added in v0.4.0

func (f FacetSpec) MechanicsDiff(o FacetSpec) string

MechanicsDiff says how o groups, sorts, ranks, matches or buckets differently from f, "" when it does not: the mechanics two declarations of one facet id must share.

func (FacetSpec) Sources added in v0.4.0

func (f FacetSpec) Sources() []string

Sources are the providers the facet comes from, none for a facet of the profile.

type Fact

type Fact struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Facts

type Facts struct {
	Owner       string   `json:"owner"`
	Repo        string   `json:"repo"`
	Author      string   `json:"author"`
	Association string   `json:"association"`
	Base        string   `json:"base"`
	Teams       []string `json:"teams,omitempty"`
	Labels      []string `json:"labels,omitempty"`
	Kind        string   `json:"kind,omitempty"`
	Size        string   `json:"size,omitempty"`
	Risk        string   `json:"risk,omitempty"`
	Goal        string   `json:"goal,omitempty"`
	Context     string   `json:"context,omitempty"`
	RiskWhy     string   `json:"risk_why,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Files       []string `json:"files,omitempty"`
	HasBrief    bool     `json:"has_brief"`
}

Facts are what a pull request's guide is matched against: GitHub's read, the requested teams and, with a brief, its kind, size, risk, tags and files, with the goal, context and risk reason its turn text shows.

type Gain

type Gain struct {
	MemoryBytes int64 `json:"memory_bytes"`
	DiskBytes   int64 `json:"disk_bytes"`
}

type GateView added in v0.3.0

type GateView struct {
	ID       int64           `json:"id"`
	Task     string          `json:"task,omitempty"`
	Unit     string          `json:"unit,omitempty"`
	Kind     string          `json:"kind"`
	Name     string          `json:"name,omitempty"`
	Status   string          `json:"status"`
	Text     string          `json:"text,omitempty"`
	Intents  []IntentView    `json:"intents"`
	Deadline time.Time       `json:"deadline,omitzero"`
	Default  string          `json:"default,omitempty"`
	Delivery string          `json:"delivery,omitempty"`
	Subject  json.RawMessage `json:"subject,omitempty"`
	Plan     *PlanItem       `json:"plan,omitempty"`
	// Units are what a step gate is about: the units its task holds, as a person finds them.
	Units []PlanUnit `json:"units,omitempty"`
}

GateView is a gate as clients offer it: Task and Unit what it is on ("" when none), Text its words from gates.toml, Intents what a person may resolve it with, in order, Default the intent its Deadline resolves it with, Delivery a draft gate's delivery state (held, queued, sending, sent, failed, dropped), Subject its subject as its kind serves it: a draft gate's is its Draft, a plan gate's its plan item's id. Plan is a plan gate's item while it waits.

func DraftGate added in v0.3.0

func DraftGate(d Draft) GateView

DraftGate is d as the gate it waits on serves it: its subject d, its delivery d's state.

type GitAccess

type GitAccess struct {
	Host   string            `json:"host"`
	Last   GitAccessOutcome  `json:"last"`
	LastOK *GitAccessOutcome `json:"last_ok,omitempty"`
}

GitAccess is the latest git network operation the daemon ran against a host and its latest success; LastOK is nil when none succeeded yet.

type GitAccessOutcome

type GitAccessOutcome struct {
	At    time.Time `json:"at"`
	Op    string    `json:"op"`
	Error string    `json:"error,omitempty"`
}

GitAccessOutcome is one git network operation: when, which (such as "fetch of acme/widget#7") and its error, "" when it succeeded.

type GitAccessRecord

type GitAccessRecord struct {
	Host string `json:"host"`
	GitAccessOutcome
}

GitAccessRecord is an outcome another process saw against Host, such as doctor --git's ls-remote, for the daemon to keep with its own.

type Health

type Health struct {
	Version string `json:"version"`
	// Build names the cockpit the daemon serves; a page that loaded another
	// reloads.
	Build     string      `json:"build"`
	Jobs      []JobStatus `json:"jobs"`
	Warnings  []string    `json:"warnings"`
	RateLimit RateLimit   `json:"rate_limit"`
	SlowSync  bool        `json:"slow_sync"`
	Viewer    string      `json:"viewer"`
	// Strings is a stamp of the client strings /api/strings serves, which changes with their locale and
	// words, so a client reads them again only then.
	Strings  string       `json:"strings,omitempty"`
	Paused   bool         `json:"paused"`
	PausedAt time.Time    `json:"paused_at,omitzero"`
	App      *AppStatus   `json:"app,omitempty"`
	Brief    *BriefStatus `json:"brief,omitempty"`
	// Briefs is the brief breaker; nil when briefs are off.
	Briefs *BriefsHealth `json:"briefs,omitempty"`
	// Notifier is whether the menu bar follows the daemon's events.
	Notifier bool `json:"notifier"`
	// StalledReviewHours is stalled.review, for a client that judges a pull
	// request the inventory does not hold.
	StalledReviewHours float64 `json:"stalled_review_hours"`
	// WorkspaceManagers name the workspace managers the daemon runs on, in
	// their configured order, such as "Claude Desktop" and "Orca".
	WorkspaceManagers []string `json:"workspace_managers,omitempty"`
	// GitAccess is, per remote host, how the daemon's own git network
	// operations went, sorted by host.
	GitAccess []GitAccess `json:"git_access,omitempty"`
	// Store is the store's schema version and state; nil from a daemon that
	// predates it.
	Store *StoreStatus `json:"store,omitempty"`
	// Plugins are the plugins the daemon runs, by id, and how each answers.
	Plugins []PluginHealth `json:"plugins,omitempty"`
}

type Home added in v0.4.0

type Home struct {
	Briefing Briefing      `json:"briefing"`
	Sections []HomeSection `json:"sections"`
	Capture  HomeCapture   `json:"capture"`
}

Home is the briefing, the home's sections and the capture field.

type HomeCapture added in v0.4.0

type HomeCapture struct {
	Hint string `json:"hint"`
	Key  string `json:"key,omitempty"`
}

HomeCapture is the capture field's hint and key.

type HomeCounter added in v0.4.0

type HomeCounter struct {
	ID    string       `json:"id"`
	Kind  string       `json:"kind,omitempty"`
	View  string       `json:"view"`
	Count int          `json:"count"`
	Label string       `json:"label"`
	Nouns []PluginNoun `json:"nouns,omitempty"`
}

HomeCounter counts the decisions of a kind (Kind), those its queue lists, or the tasks of a view; View is the view it opens.

type HomeFinding

type HomeFinding struct {
	Home    string `json:"home"`
	Entry   string `json:"entry"`
	Problem string `json:"problem"`
	Fix     string `json:"fix,omitempty"`
}

HomeFinding is one entry an agent home lacks or holds wrong; Fix is the command that repairs it, "" when none does.

func (HomeFinding) Warning

func (f HomeFinding) Warning() string

Warning is the finding as a line of Health.Warnings.

type HomeSection added in v0.4.0

type HomeSection struct {
	ID    string     `json:"id"`
	View  string     `json:"view"`
	Label string     `json:"label"`
	Time  string     `json:"time"`
	Rows  []TaskView `json:"rows"`
	Total int        `json:"total"`
}

HomeSection is the first rows of View; Total counts all of them, Time names the time each row shows ("owed" or "moved").

type Info

type Info struct {
	Port  int    `json:"port"`
	Token string `json:"token"`
}

Info is the cockpit address the daemon writes for the command line.

type InputSpec

type InputSpec struct {
	Kind        string `json:"kind"` // text | duration | answer
	Required    bool   `json:"required,omitempty"`
	Label       string `json:"label,omitempty"`
	Placeholder string `json:"placeholder,omitempty"`
	Default     string `json:"default,omitempty"`
	UntilState  bool   `json:"until_state,omitempty"`
	Max         int    `json:"max,omitempty"`
}

type Intake

type Intake struct {
	Seq       int64     `json:"seq"`
	PR        string    `json:"pr"`
	Intent    string    `json:"intent"`
	Source    string    `json:"source"`
	State     string    `json:"state"`
	Brief     string    `json:"brief,omitempty"`
	Note      string    `json:"note,omitempty"`
	Attempt   int       `json:"attempt,omitempty"`
	LastError string    `json:"last_error,omitempty"`
	Next      time.Time `json:"next,omitzero"`
	Error     string    `json:"error,omitempty"`
	Joined    bool      `json:"joined,omitempty"`
	Log       []string  `json:"log,omitempty"`
	LogLen    int       `json:"log_len"`
}

Intake is a turn a user asked for, waiting for its pull request's brief or started. Log holds the lines past the asked index and LogLen counts every line; Attempt and LastError are the brief attempt it waits on and the failure of the one before.

func (Intake) Open

func (i Intake) Open() bool

Open tells an intake that has not ended.

func (Intake) Waiting

func (i Intake) Waiting() bool

Waiting tells an intake that waits for the brief.

type IntentView added in v0.3.0

type IntentView struct {
	ID      string `json:"id"`
	Label   string `json:"label"`
	Summary string `json:"summary,omitempty"`
	Answer  bool   `json:"answer,omitempty"`
}

IntentView is an intent a gate offers: Summary says what resolving with it does, for the card of a gate whose gates.toml sets card_says, Answer that it takes text, as a question's answer.

type ItemApplied

type ItemApplied struct {
	Op      items.Op   `json:"op"`
	Item    items.Item `json:"item"`
	Changed bool       `json:"changed"`
}

type ItemPerson added in v0.4.0

type ItemPerson struct {
	Key  string `json:"key"`
	Name string `json:"name"`
	Me   bool   `json:"me,omitempty"`
}

ItemPerson is a person an item waits on; Me marks the user.

type ItemProposal

type ItemProposal struct {
	ID         int64            `json:"id"`
	Unit       unit.Unit        `json:"unit"`
	Item       string           `json:"item"`
	Op         items.Op         `json:"op"`
	Provenance items.Provenance `json:"provenance"`
	Reason     string           `json:"reason"`
	State      string           `json:"state"`
	At         time.Time        `json:"at"`
}

type ItemRefused

type ItemRefused struct {
	Index  int      `json:"index"` // position in the ops passed
	Op     items.Op `json:"op"`
	Reason string   `json:"reason"`
}

type ItemTie added in v0.4.0

type ItemTie struct {
	WaitsOn   []ItemPerson `json:"waits_on"`
	Task      string       `json:"task,omitempty"`
	TaskTitle string       `json:"task_title,omitempty"`
}

ItemTie is whom an item waits on and the task that holds it; Task is empty when no task does.

type ItemView

type ItemView struct {
	Unit    unit.Unit `json:"unit"`
	ID      string    `json:"id"`
	Summary string    `json:"summary"`
	State   string    `json:"state"`
	Kind    string    `json:"kind"`
}

type ItemsResult

type ItemsResult struct {
	Applied  []ItemApplied  `json:"applied"`
	Proposed []ItemProposal `json:"proposed"`
	Refused  []ItemRefused  `json:"refused"`
}

ItemsResult is what the items ledger did with a turn record's ops.

type JobStatus

type JobStatus struct {
	Name    string        `json:"name"`
	Every   time.Duration `json:"every"`
	LastRun time.Time     `json:"last_run"`
	LastOK  time.Time     `json:"last_ok"`
	LastErr string        `json:"last_error"`
	Running bool          `json:"running"`
}

type Kept

type Kept struct {
	Named
	Reason    string `json:"reason"`
	Detail    string `json:"detail,omitempty"`
	Source    string `json:"source,omitempty"`
	Forceable bool   `json:"forceable,omitempty"`
}

type KeyBinding

type KeyBinding struct {
	Key     string `json:"key"`
	Action  string `json:"action"`
	Surface string `json:"surface,omitempty"`
}

KeyBinding: Surface is web, tui or menubar.

type KeyView

type KeyView struct {
	Key     string `json:"key"`
	Action  string `json:"action"`
	Context string `json:"context"`
	Owner   string `json:"owner"`
	Help    string `json:"help"`
	// Summary is what an action's key does, from its spec or, for a core
	// verb's key, the verb's summary; "" for any other core key.
	Summary string `json:"summary,omitempty"`
}

KeyView is one key of a surface. Owner is "core", a plugin id or "intent:<name>"; Action is a core action or an action spec's id.

type KeysResponse

type KeysResponse struct {
	Bindings []KeyView `json:"bindings"`
}

KeysResponse is the answer of GET /api/keys: the core bindings of the surface, then every served action key.

type Kind

type Kind string

Kind is a row's provider-scoped situation; its labels come from CatalogResponse.Situations.

type LensWords added in v0.4.0

type LensWords struct {
	DefaultGroup  string `json:"default_group"`
	BoardGroup    string `json:"board_group"`
	NoGroup       string `json:"no_group"`
	Copied        string `json:"copied"`
	CopiedGrouped string `json:"copied_grouped"`
	TagKey        string `json:"tag_key"`
	TagKeyEmpty   string `json:"tag_key_empty"`
	Grouped       string `json:"grouped"`
	Sorted        string `json:"sorted"`
	Descending    string `json:"descending"`
	NoLens        string `json:"no_lens"`
	// RowWords are what a row says beside its facets.
	RowWords
}

LensWords are what a list's lens bar says, templates whose only actions are {{.name}} substitutions: DefaultGroup and BoardGroup over label, Copied over count and view, CopiedGrouped over those and group, TagKey over the tag facet's label and key, TagKeyEmpty over key, Grouped, Sorted and Descending over label.

type Load

type Load struct {
	Since time.Time   `json:"since"`
	Stats []MeterStat `json:"stats"`
	// CLIOps are the workspace manager's operations that spawned its CLI,
	// per op.
	CLIOps []MeterStat `json:"cli_ops,omitempty"`
	// Fallbacks is how many calls went to the CLI because the manager's
	// runtime drifted; nil when the manager does not count them.
	Fallbacks *int64 `json:"fallbacks,omitempty"`
}

Load is the daemon's cost since Since, per resource (Op is empty).

type Loading added in v0.3.0

type Loading struct {
	Plugin string `json:"plugin"`
	Reason string `json:"reason"`
}

Loading is a plugin that has not yet imported its data and reported every unit since the daemon started, and why, in the plugin's words.

type MenubarSection struct {
	Label string `json:"label"`
	View  string `json:"view"`
}

type Message

type Message struct {
	ID        int64           `json:"id"`
	Unit      unit.Unit       `json:"unit"`
	Kind      string          `json:"kind"`
	Text      string          `json:"text"`
	Options   []record.Option `json:"options,omitempty"`
	Recommend string          `json:"recommend,omitempty"`
	Confirm   bool            `json:"confirm,omitempty"`
	// Draft is the held draft a confirm's yes approves, at the rev the question pinned; nil for none.
	Draft *record.DraftRef `json:"draft,omitempty"`
	// Pinned are the drafts the confirm and the options pin, each as its card serves it now, so a person sees
	// what an answer approves; a pinned draft that is gone is absent, and one whose Rev is not its pin's
	// changed since the question pinned it.
	Pinned    []Draft   `json:"pinned,omitempty"`
	Origin    string    `json:"origin"`
	CreatedAt time.Time `json:"created_at"`
	// Answers are the user's answers to the message, oldest first, each with when the agent read it.
	Answers []TurnAnswer `json:"answers,omitempty"`
}

Message is the subject of a question, post or proposal gate, as GateView.Subject serves it: what was asked, with the user's answers to it.

type MeterReport

type MeterReport struct {
	Since  time.Time    `json:"since"`
	At     time.Time    `json:"at"`
	Load   Load         `json:"load"`
	Scopes []MeterScope `json:"scopes"`
	Recent *MeterWindow `json:"recent,omitempty"`
}

MeterReport is every scope's metered cost since the daemon started, sorted by name, and the same for the last minutes in Recent.

type MeterScope

type MeterScope struct {
	Name     string      `json:"name"`
	Runs     int64       `json:"runs"`
	WallMS   int64       `json:"wall_ms"`
	Stats    []MeterStat `json:"stats"`
	Last     []MeterStat `json:"last,omitempty"`
	LastAt   time.Time   `json:"last_at,omitzero"`
	LastWall int64       `json:"last_wall_ms,omitempty"`
}

MeterScope is the cost of one scope since the daemon started. For a job or a loop that has phases, Stats holds the scope and its phases together and each phase is listed under its own "<scope>/<phase>" name with its own samples only.

type MeterStat

type MeterStat struct {
	Res         string `json:"res"`
	Op          string `json:"op,omitempty"`
	Calls       int64  `json:"calls"`
	Spawns      int64  `json:"spawns,omitempty"`
	Errors      int64  `json:"errors,omitempty"`
	NotModified int64  `json:"not_modified,omitempty"`
	Points      int64  `json:"points,omitempty"`
	Bytes       int64  `json:"bytes,omitempty"`
	Rows        int64  `json:"rows,omitempty"`
	DurMS       int64  `json:"dur_ms,omitempty"`
	MaxMS       int64  `json:"max_ms,omitempty"`
}

MeterStat is the metered cost of one resource, or of one operation of it when Op is set.

type MeterWindow

type MeterWindow struct {
	Since  time.Time    `json:"since"`
	Scopes []MeterScope `json:"scopes"`
}

MeterWindow is what each scope spent since Since, a recent minute, with MeterScope's roll-up of phases; Last and its fields are left out.

type Named added in v0.3.0

type Named struct {
	Unit  unit.Unit `json:"unit"`
	Label string    `json:"label"`
}

Named is a unit with its label.

type Notice

type Notice struct {
	ID       string    `json:"id"`
	Workflow string    `json:"workflow"`
	Unit     unit.Unit `json:"unit"`
	Label    string    `json:"label,omitempty"` // Unit as a person reads it
	Text     string    `json:"text"`
}

Notice is a notification a workflow's notify.self step raised; ID is unique per raise.

type Notification

type Notification struct {
	ID    string `json:"id"`
	On    string `json:"on"`
	Title string `json:"title"`
	Body  string `json:"body"`
}

Notification: On is "item:<kind>" or "row:<kind>"; Body a text/template over the row or item.

type ObserveMode added in v0.2.0

type ObserveMode bool

ObserveMode is a plan item's observe flag: its workflow only plans, and a person applies the item by hand.

type OmniboxAnswer added in v0.4.0

type OmniboxAnswer struct {
	Answer   *OmniboxList     `json:"answer,omitempty"`
	Proposal *OmniboxProposal `json:"proposal,omitempty"`
	Dropped  []OmniboxDropped `json:"dropped,omitempty"`
	CostUSD  *float64         `json:"cost_usd,omitempty"`
}

OmniboxAnswer is the read-only agent's answer, a list or a proposal, with what it proposed that was dropped and the call's cost.

type OmniboxDropped added in v0.4.0

type OmniboxDropped struct {
	Operation OmniboxOperation  `json:"operation"`
	Why       string            `json:"why"`
	Params    map[string]string `json:"params,omitempty"`
}

OmniboxDropped is a proposed operation refused: Why is the code, snake_case, of why, and Params the values its words name.

type OmniboxList added in v0.4.0

type OmniboxList struct {
	Text  string     `json:"text"`
	Tasks []TaskView `json:"tasks"`
}

OmniboxList is an answer's text and the tasks it lists.

type OmniboxOperation added in v0.4.0

type OmniboxOperation struct {
	Op       string     `json:"op"`
	Unit     *unit.Unit `json:"unit,omitempty"`
	Task     string     `json:"task,omitempty"`
	Action   string     `json:"action,omitempty"`
	Verb     string     `json:"verb,omitempty"`
	Title    string     `json:"title,omitempty"`
	Brief    string     `json:"brief,omitempty"`
	Repo     string     `json:"repo,omitempty"`
	Guidance string     `json:"guidance,omitempty"`
	Reason   string     `json:"reason,omitempty"`
	Confirm  string     `json:"confirm,omitempty"`
}

OmniboxOperation is one operation: Op "action" (Action on Unit), "verb" (Verb on Task), "capture" (a task titled Title) or "start" (a task from Brief, started in Repo). Confirm is what the unit's row asks before Action runs, for the person confirming the operation to read.

type OmniboxProposal added in v0.4.0

type OmniboxProposal struct {
	Summary    string             `json:"summary,omitempty"`
	Operations []OmniboxOperation `json:"operations"`
	Question   string             `json:"question,omitempty"`
}

OmniboxProposal is a set of operations to confirm, and the question the agent asks first, if any.

type OmniboxRan added in v0.4.0

type OmniboxRan struct {
	Results []OmniboxResult `json:"results"`
}

OmniboxRan is each operation's result, in order.

type OmniboxResolved added in v0.4.0

type OmniboxResolved struct {
	Kind    string            `json:"kind"`
	Why     string            `json:"why,omitempty"`
	Params  map[string]string `json:"params,omitempty"`
	Unit    *OmniboxUnit      `json:"unit,omitempty"`
	Preview *OmniboxProposal  `json:"preview,omitempty"`
}

OmniboxResolved is how typed text resolves, by Kind: "unit", "verb" (a known verb's operations), "search", or "agent" (the agent would help); Why is the code, snake_case, of why it fell to search or agent, and Params the values its words name.

type OmniboxResult added in v0.4.0

type OmniboxResult struct {
	OK      bool              `json:"ok"`
	Status  int               `json:"status"`
	Error   string            `json:"error,omitempty"`
	Params  map[string]string `json:"params,omitempty"`
	Refusal string            `json:"refusal,omitempty"`
	Output  []string          `json:"output,omitempty"`
	Task    string            `json:"task,omitempty"`
}

OmniboxResult is an operation's outcome as its handler answered it: Error is the code, snake_case, of why it failed and Params the values its words name, Refusal the handler's refusal code; Task is the task it created, if any.

type OmniboxRun added in v0.4.0

type OmniboxRun struct {
	Operations []OmniboxOperation `json:"operations"`
}

OmniboxRun is the operations the user confirmed.

type OmniboxText added in v0.4.0

type OmniboxText struct {
	Text   string        `json:"text"`
	Follow []OmniboxTurn `json:"follow,omitempty"`
}

OmniboxText is what the user typed; Follow carries the questions the agent asked and their answers.

type OmniboxTurn added in v0.4.0

type OmniboxTurn struct {
	Question string `json:"question"`
	Answer   string `json:"answer"`
}

OmniboxTurn is a question the agent asked and the user's answer.

type OmniboxUnit added in v0.4.0

type OmniboxUnit struct {
	Unit      unit.Unit         `json:"unit"`
	Label     string            `json:"label"`
	Permalink string            `json:"permalink,omitempty"`
	Held      bool              `json:"held"`
	Tasks     []TaskView        `json:"tasks"`
	Actions   []ActionSpec      `json:"actions"`
	Row       *Row              `json:"row,omitempty"`
	Why       string            `json:"why,omitempty"`
	Params    map[string]string `json:"params,omitempty"`
}

OmniboxUnit is a resolved unit: its tasks and actions. Held says the loop holds it, and so serves its detail; Row is the row its plugin derives for one it does not hold, which a client acts on as it would on the detail's row. Why is the code, snake_case, of why a unit with no task offers no action, and Params the values its words name.

type Operation

type Operation struct{ Method, Path string }

Operation is one route of the daemon's API.

func (Operation) Pattern

func (o Operation) Pattern() string

Pattern is the operation as a net/http ServeMux pattern.

type OutboxDraft added in v0.4.0

type OutboxDraft struct {
	Draft
	Context DraftContext        `json:"context"`
	Facets  map[string][]string `json:"facets,omitempty"`
	Texts   []string            `json:"texts,omitempty"`
}

OutboxDraft is a draft with what a person reads to decide on it, the values of its draft facets, by facet id, and the texts a search over the Outbox matches: its text, its unit's label and title, and where it goes.

type OutboxHead added in v0.7.0

type OutboxHead struct {
	About    string `json:"about,omitempty"`
	Workflow string `json:"workflow,omitempty"`
}

OutboxHead is what a group of drafts says beside its title, in the served locale: About why they were written, and Workflow the workflow that drafted them, which a person may stop; "" for a group of no one workflow.

type OutboxItem added in v0.4.0

type OutboxItem struct {
	ID      string `json:"id"`
	Summary string `json:"summary"`
	State   string `json:"state"`
}

OutboxItem is an item a draft is about.

type OutboxPage added in v0.4.0

type OutboxPage struct {
	Drafts []OutboxDraft `json:"drafts"`
	Facets []FacetSpec   `json:"facets"`
	// Heads are what a group head shows under a value's title, which the facet's labels carry, by facet id,
	// then by value; a value with nothing more to say has none.
	Heads map[string]map[string]OutboxHead `json:"heads,omitempty"`
}

OutboxPage is the Outbox's drafts, in the order of its view's sort, with the draft facets a lens over them reads.

type Override

type Override struct {
	Hold         bool   `json:"hold"`
	Adopted      bool   `json:"adopted"`
	Tracked      bool   `json:"tracked"`
	NextGuidance string `json:"next_guidance"`
}

Override is what the user set on a unit; the zero Override leaves the wire.

func (Override) IsZero

func (o Override) IsZero() bool

IsZero reports an override that sets nothing.

type PRTimes

type PRTimes struct {
	PR           string    `json:"pr"`
	Title        string    `json:"title,omitempty"`
	Author       string    `json:"author,omitempty"`
	Opened       time.Time `json:"opened,omitzero"`
	Followed     time.Time `json:"followed,omitzero"`
	FirstRequest time.Time `json:"first_request,omitzero"`
	FirstReview  time.Time `json:"first_review,omitzero"`
	Approved     time.Time `json:"approved,omitzero"`
	Merged       time.Time `json:"merged,omitzero"`
	Turns        int       `json:"turns"`
	Briefs       int       `json:"briefs"`
}

PRTimes are a pull request's milestones, zero when it has not reached one, with its turns and brief runs in the window.

type PauseRequest

type PauseRequest struct {
	Paused bool     `json:"paused"`
	Repos  []string `json:"repos,omitempty"` // owner/repo
	PRs    []string `json:"prs,omitempty"`   // owner/repo#n
}

PauseRequest pauses or resumes the repositories in Repos and the pull requests in PRs; naming neither pauses or resumes everything.

type PlanActRequest

type PlanActRequest struct {
	IDs      []string `json:"ids"`
	Action   string   `json:"action"`
	Guidance string   `json:"guidance,omitempty"`
}

type PlanItem

type PlanItem struct {
	ID       string `json:"id"`
	Workflow string `json:"workflow"`
	Summary  string `json:"summary,omitempty"` // Workflow's summary, in the profile's locale
	Decision string `json:"decision"`
	Reason   string `json:"reason,omitempty"`
	// ReasonKey is the engine's template Reason renders, the catalog's key for it, with the values it carries and,
	// for a wait on facts, those facts; "" for a reason no template renders, which reads as Reason.
	ReasonKey    string            `json:"reason_key,omitempty"`
	ReasonParams map[string]string `json:"reason_params,omitempty"`
	ReasonFacts  []Fact            `json:"reason_facts,omitempty"`
	Default      string            `json:"default,omitempty"`
	Observe      ObserveMode       `json:"observe"`
	Error        string            `json:"error,omitempty"`
	Unit         unit.Unit         `json:"unit"`
	Label        string            `json:"label"`           // Unit as a person reads it
	Title        string            `json:"title,omitempty"` // Unit's row title
	Link         string            `json:"link,omitempty"`  // Unit's row link
	Steps        []string          `json:"steps"`
	// Target is the task a task's item acts on, as a person finds it; nil for another unit.
	Target *PlanTarget `json:"target,omitempty"`
	// Does are its steps with what each needs said of it.
	Does     []PlanStep    `json:"does,omitempty"`
	Deadline time.Time     `json:"deadline,omitzero"`
	Gain     Gain          `json:"gain"`
	Why      Why           `json:"why"`
	Attempts int           `json:"attempts,omitempty"`
	Actions  []ActionState `json:"actions"` // built by internal/catalog only
}

PlanItem is one item of the workflows' plan.

func (PlanItem) UnitLabel added in v0.2.0

func (it PlanItem) UnitLabel() string

UnitLabel is the item's unit as a person reads it.

type PlanQuery

type PlanQuery struct {
	Workflow string `json:"workflow,omitempty"`
	Provider string `json:"provider,omitempty"`
	Trigger  string `json:"trigger,omitempty"`
	// Closed asks for the sessions closed in the last day with the stored
	// plan.
	Closed bool `json:"closed,omitempty"`
	// Unit, provider:key, asks what every workflow decides for that unit
	// now; the other fields are then ignored.
	Unit string `json:"unit,omitempty"`
}

type PlanResponse

type PlanResponse struct {
	Items  []PlanItem      `json:"items"`
	Errors []string        `json:"errors"`
	Closed []ClosedSession `json:"closed,omitempty"`
	// Unit is the unit a Unit query explained, as its provider lists it.
	Unit      string         `json:"unit,omitempty"`
	Label     string         `json:"label,omitempty"` // Unit as a person reads it
	Title     string         `json:"title,omitempty"` // Unit's row title
	Workflows []UnitWorkflow `json:"workflows,omitempty"`
}

type PlanStep added in v0.4.0

type PlanStep struct {
	Use   string `json:"use"`
	Reach string `json:"reach,omitempty"`
	// Says is the catalog key of what the step does, its {name}s its Args; "" for a step the catalog does not word.
	Says string `json:"says,omitempty"`
	// Posts says the step may post where others see it: its reach is visible or its intent's, or it drafts.
	Posts bool              `json:"posts,omitempty"`
	Args  map[string]string `json:"args,omitempty"`
	Items []string          `json:"items,omitempty"`
}

PlanStep is a step of a plan item: what it uses, its reach (local, private, visible; "" for the intent's), its text arguments, and for items.resolve the summaries of the open items it resolves.

type PlanTarget added in v0.4.0

type PlanTarget struct {
	Task  string     `json:"task"`
	Title string     `json:"title"`
	Units []PlanUnit `json:"units,omitempty"`
}

PlanTarget is a task a plan item acts on: its id, its title and the units it came from.

type PlanUnit added in v0.4.0

type PlanUnit struct {
	Label string `json:"label"`
	Title string `json:"title,omitempty"`
	Link  string `json:"link,omitempty"`
}

PlanUnit is a unit as a person reads it, with its title and link when it has them.

type Plugin

type Plugin struct {
	ID      unit.ProviderID `json:"id"`
	Name    string          `json:"name"` // the service as a person reads it, such as "GitHub"
	Enabled bool            `json:"enabled"`
	// Reacts: the plugin's publisher posts reactions (drafts of kind react); only when enabled.
	Reacts bool      `json:"reacts,omitempty"`
	UI     *PluginUI `json:"ui,omitempty"` // only when enabled
	// Capabilities are what the plugin can do, so a client asks what a
	// provider does, never which it is: checkouts, briefs, publishes, reacts,
	// items; only when enabled.
	Capabilities []string `json:"capabilities,omitempty"`
}

func (Plugin) Can added in v0.2.0

func (p Plugin) Can(c string) bool

Can says whether the plugin is enabled and serves capability c.

type PluginActionArgs added in v0.3.0

type PluginActionArgs struct {
	Request ActionRequest  `json:"request"`
	Unmuted *Row           `json:"unmuted,omitempty"`
	Inputs  map[string]any `json:"inputs,omitempty"`
}

PluginActionArgs are the Args of an action the daemon sends a unit's plugin: the person's request, the unit's row without the user's mute and pending round, and, for an intent's prepare, the call's inputs so far.

type PluginActionRequest added in v0.3.0

type PluginActionRequest struct {
	Action string          `json:"-"`
	Actor  string          `json:"-"`
	Args   json.RawMessage `json:"args,omitempty"`
}

PluginActionRequest is an action of a plugin and its arguments, whose shape the plugin owns; the route sets Action, and Actor from the request's session header.

type PluginActionResult added in v0.3.0

type PluginActionResult struct {
	Output []string       `json:"output,omitempty"`
	Inputs map[string]any `json:"inputs,omitempty"`
}

PluginActionResult is what a plugin's Action answers the daemon: the lines it reports and, for a prepare, the call's inputs.

type PluginDetail added in v0.3.0

type PluginDetail struct {
	Events []Event    `json:"events"`
	Brief  *BriefView `json:"brief,omitempty"`
}

PluginDetail is what a unit's plugin adds to its detail: the timeline and the brief.

type PluginError added in v0.3.0

type PluginError struct {
	Status int
	Msg    string
}

PluginError is a plugin's refusal of a request, with the HTTP status the daemon answers it with.

func (*PluginError) Error added in v0.3.0

func (e *PluginError) Error() string

type PluginHealth added in v0.3.0

type PluginHealth struct {
	ID     string `json:"id"`
	Status string `json:"status"`
	Reason string `json:"reason,omitempty"`
}

PluginHealth is a plugin the daemon runs: its status, one of loading, serving, degraded or down, and why in the plugin's words.

type PluginNoun added in v0.4.0

type PluginNoun struct {
	Plugin string `json:"plugin"`
	Count  int    `json:"count"`
	Noun   string `json:"noun"`
}

PluginNoun is a plugin's share of a counter, worded with the plugin's noun.

type PluginRunChunk added in v0.3.0

type PluginRunChunk struct {
	Stdout string `json:"stdout,omitempty"`
	Stderr string `json:"stderr,omitempty"`
	Exit   *int   `json:"exit,omitempty"`
	Error  string `json:"error,omitempty"`
}

PluginRunChunk is one line of a plugin command's stream: what it wrote to its standard output or error, or how it ended.

type PluginRunRequest added in v0.3.0

type PluginRunRequest struct {
	Args []string `json:"args"`
}

PluginRunRequest is a command line of a plugin: the words after its id.

type PluginUI

type PluginUI struct {
	Facets        []Facet        `json:"facets,omitempty"`        // qualifiers over row and item facts
	Views         []SavedView    `json:"views,omitempty"`         // listed under the plugin in navigation
	Notifications []Notification `json:"notifications,omitempty"` // templates keyed by item kind or row kind
	Keys          []KeyBinding   `json:"keys,omitempty"`          // checked with keys.Check when the catalog loads
	// Key is the chord that jumps to the plugin's views, checked with
	// keys.CheckView; "" for none.
	Key     string           `json:"key,omitempty"`
	Web     *WebView         `json:"web,omitempty"` // tier c
	Menubar []MenubarSection `json:"menubar,omitempty"`
}

type ProbeRequest

type ProbeRequest struct {
	// WorkspaceID is the workspace's id in its manager, or its worktree path.
	WorkspaceID string `json:"workspace_id"`
	// Home and Model are the agent's; "" is its default.
	Home  string `json:"home,omitempty"`
	Model string `json:"model,omitempty"`
}

type ProbeResult

type ProbeResult struct {
	PR      string `json:"pr"`
	Turn    string `json:"turn"`
	Session string `json:"session"`
}

ProbeResult names the probe's pull request, the id of its turn and the session the turn was sent to.

type PromptRequest

type PromptRequest struct {
	Prompt string `json:"prompt"`
}

PromptRequest is the prompt the caller's session took.

type PropSpec added in v0.3.0

type PropSpec struct {
	Name    string   `json:"name"`
	Type    string   `json:"type"`
	Values  []string `json:"values,omitempty"`
	Writers []string `json:"writers,omitempty"`
	Role    string   `json:"role,omitempty"`
}

PropSpec is a task property of tasks.toml: its type, an enum's values, who may write it, and the role of the loop's that acts on it ("" for none): area, contexts, star or deadline.

type ProviderWords added in v0.4.0

type ProviderWords struct {
	Provider string            `json:"provider"`
	Words    map[string]string `json:"words"`
}

ProviderWords are a provider's words, by key.

type Quantiles

type Quantiles struct {
	Count int   `json:"count"`
	P50MS int64 `json:"p50_ms"`
	P90MS int64 `json:"p90_ms"`
}

Quantiles are a duration's nearest-rank median and 90th percentile over Count samples.

type QuestionView

type QuestionView struct {
	RecordID  int64           `json:"record_id"`
	State     string          `json:"state"`
	Kind      string          `json:"kind"`
	Text      string          `json:"text"`
	Options   []record.Option `json:"options,omitempty"`
	Recommend string          `json:"recommend,omitempty"`
	Publishes bool            `json:"publishes,omitempty"`
	// Draft is the held draft a confirm's yes approves, at the rev the question pinned; nil for none. A row
	// does not carry the pinned drafts: a client sends a person to the question's card to see them.
	Draft       *record.DraftRef `json:"draft,omitempty"`
	Verdict     string           `json:"verdict,omitempty"`
	Blocking    int              `json:"blocking"`
	NonBlocking int              `json:"non_blocking"`
	LastMessage string           `json:"last_message,omitempty"`
	// Queued says the user's answer waits for the agent's busy session.
	Queued bool `json:"queued,omitempty"`
}

QuestionView is a turn that waits on the user: asked, failed or unrecorded, with its last record's question and outcome.

func (*QuestionView) Open added in v0.4.0

func (q *QuestionView) Open() bool

Open says whether q still takes an answer from its options.

type Queue added in v0.4.0

type Queue struct {
	Kind  string      `json:"kind"`
	View  string      `json:"view"`
	Title string      `json:"title"`
	Empty string      `json:"empty"`
	Total int         `json:"total"`
	Items []QueueItem `json:"items"`
}

Queue is a decision kind's items, oldest decision first; View is the view whose rows draw its items.

type QueueAction added in v0.4.0

type QueueAction struct {
	Kind  string `json:"kind"`
	ID    string `json:"id,omitempty"`
	Label string `json:"label"`
}

QueueAction is an item's primary action: Kind "gate" (ID a gate intent), "action" (ID a catalog action) or "open" (open the unit at its source).

type QueueItem added in v0.4.0

type QueueItem struct {
	Task      TaskView        `json:"task"`
	Gate      *GateView       `json:"gate,omitempty"`
	Situation *QueueSituation `json:"situation,omitempty"`
	Primary   QueueAction     `json:"primary"`
}

QueueItem is one decision: a task's open gate, or a situation of one of its units.

type QueueSituation added in v0.4.0

type QueueSituation struct {
	Provider string `json:"provider"`
	Kind     string `json:"kind"`
	Label    string `json:"label"`
}

QueueSituation is the situation of a provider's unit that makes the decision.

type RateLimit

type RateLimit struct {
	Cost      int       `json:"cost"`
	Remaining int       `json:"remaining"`
	Limit     int       `json:"limit"`
	ResetAt   time.Time `json:"reset_at"`
}

type ReconcileReport

type ReconcileReport struct {
	// Unrecorded are the pull requests whose turn ended without a record.
	Unrecorded []unit.Unit `json:"unrecorded"`
	// Closed are the pull requests whose asked turn my review closed.
	Closed       []unit.Unit `json:"closed"`
	GoneSessions []string    `json:"gone_sessions"`
	// Rewritten counts the view items the sinks were brought back to.
	Rewritten int       `json:"rewritten"`
	At        time.Time `json:"at"`
}

ReconcileReport is what the daemon found and repaired when it started, before it served UserAPI.

type RecordView added in v0.3.0

type RecordView struct {
	Kind string          `json:"kind"`
	At   time.Time       `json:"at"`
	Data json.RawMessage `json:"data"`
}

RecordView is a record of a declared kind, such as a brief, with its data as its schema holds it.

type RemoveCleanRequest added in v0.3.0

type RemoveCleanRequest struct {
	View string `json:"view"`
}

RemoveCleanRequest names the view whose tasks' clean workspaces to remove.

type RemoveCleanResult added in v0.3.0

type RemoveCleanResult struct {
	Removed []Named `json:"removed"`
	Kept    []Kept  `json:"kept"`
}

type Resolved added in v0.3.0

type Resolved struct {
	Unit  unit.Unit `json:"unit"`
	Found bool      `json:"found"`
}

Resolved is the unit an address lands in; Found is false when no plugin reads the address.

type Review

type Review struct {
	ID        string       `json:"id"`
	Steps     []ReviewStep `json:"steps"`
	StartedAt time.Time    `json:"started_at"`
	Done      bool         `json:"done"`
}

Review is the Review. ID is empty when nothing was left to review as it started.

type ReviewStep

type ReviewStep struct {
	ID    string            `json:"id"`
	Label string            `json:"label"`
	View  string            `json:"view"`
	Query map[string]string `json:"query"`
	Count int               `json:"count"`
	Done  bool              `json:"done"`
}

ReviewStep is a step of the Review: the tasks of Query (GET /api/tasks with these parameters), their count, and whether the step is done. Step ids: inbox, outbox, waiting, projects, someday, focus.

type Row

type Row struct {
	Unit unit.Unit `json:"unit"`
	// Link and Label are the server's presentation of the unit, such as
	// its pull request's URL and "owner/repo#12".
	Link    string              `json:"link"`
	Label   string              `json:"label"`
	Title   string              `json:"title"`
	Kind    Kind                `json:"kind"`
	Summary Summary             `json:"summary"`
	Views   []string            `json:"views"`
	Facets  map[string][]string `json:"facets"` // facet id -> values; Values[0] is the group and sort key
	// Actions are what the row offers now, in the order of the specs.
	Actions []ActionState `json:"actions"`
	// SpecsVersion is the version of GET /api/actions the actions follow.
	SpecsVersion string `json:"specs_version"`
	// Question is the open question or stop of the turn the situation
	// comes from.
	Question *QuestionView   `json:"question,omitempty"`
	Items    []RowItem       `json:"items,omitempty"`
	Payload  json.RawMessage `json:"payload,omitempty"`
	// Search are the row's texts a filter's free words search beyond its title, label, link, kind, summary
	// and facet values, such as what its payload holds.
	Search []string `json:"search,omitempty"`
	// Stale says the row is its plugin's last report, which the plugin no
	// longer stands behind: it is down.
	Stale bool `json:"stale,omitempty"`
}

Row is one unit's row: the generic part every surface reads, the served facet values, and the provider's payload, opaque to the core.

func (Row) In

func (r Row) In(view string) bool

In tells whether the row is in plugin view view; a closed row is in none.

type RowFacts

type RowFacts struct {
	CreatedAt    time.Time  `json:"created_at,omitzero"`
	ChangedFiles int        `json:"changed_files"`
	Checks       CheckFacts `json:"checks"`
	Turns        TurnFacts  `json:"turns"`
	// Next is sorted by At and holds only future instants.
	Next []Upcoming `json:"next,omitempty"`
}

RowFacts are a row's numbers for the backlog panels.

type RowItem

type RowItem struct {
	ID        string    `json:"id"`
	Kind      string    `json:"kind"` // request, question, decision, todo
	Summary   string    `json:"summary"`
	State     string    `json:"state"` // open, resolved
	WaitingOn []string  `json:"waiting_on"`
	Since     time.Time `json:"since"`
}

type RowWords added in v0.4.0

type RowWords struct {
	AgeNow           string `json:"age_now"`
	AgeMinutes       string `json:"age_minutes"`
	AgeHours         string `json:"age_hours"`
	AgeDays          string `json:"age_days"`
	FilterLabel      string `json:"filter_label"`
	FilterTitle      string `json:"filter_title"`
	FilterTitleGroup string `json:"filter_title_group"`
	FilterGroup      string `json:"filter_group"`
	ListCount        string `json:"list_count"`
	ListEmpty        string `json:"list_empty"`
	CountdownTitle   string `json:"countdown_title"`
	CountdownSending string `json:"countdown_sending"`
	CountdownSeconds string `json:"countdown_seconds"`
	CountdownMinutes string `json:"countdown_minutes"`
	TipNamed         string `json:"tip_named"`
	TipKind          string `json:"tip_kind"`
	TipWhy           string `json:"tip_why"`
	LegendTitle      string `json:"legend_title"`
	SortBy           string `json:"sort_by"`
	ColUnit          string `json:"col_unit"`
	Stale            string `json:"stale"`
	StaleTitle       string `json:"stale_title"`
	Briefing         string `json:"briefing"`
	BriefingTitle    string `json:"briefing_title"`
	BriefingAttempt  string `json:"briefing_attempt"`
	BriefingError    string `json:"briefing_error"`
	Questions        string `json:"questions"`
	QuestionsTitle   string `json:"questions_title"`
	Starred          string `json:"starred"`
	Until            string `json:"until"`
	Due              string `json:"due"`
	Unread           string `json:"unread"`
	UnreadTitle      string `json:"unread_title"`
	ReviewDue        string `json:"review_due"`
	NoNextAction     string `json:"no_next_action"`
	OpenChildren     string `json:"open_children"`
	Sequential       string `json:"sequential"`
	Every            string `json:"every"`
	Reviewed         string `json:"reviewed"`
	More             string `json:"more"`
}

RowWords are the words of a row: its age, its facet buttons' title and aria-label, the head of a mixed list's unit, the flags and tooltips no facet carries. A plugin's ui.toml may replace any for its own rows.

type RowsPage

type RowsPage struct {
	Epoch    string      `json:"epoch"`
	Rev      uint64      `json:"rev"`
	Full     bool        `json:"full"`
	Rows     []Row       `json:"rows"`
	Removed  []unit.Unit `json:"removed"`
	Counters *Counters   `json:"counters,omitempty"`
	// Loading are the plugins whose rows are not all here yet.
	Loading []Loading `json:"loading,omitempty"`
	// Catalog is the version of GET /api/catalog; a client holding another reads it again.
	Catalog string `json:"catalog,omitempty"`
}

RowsPage is a view's rows at Rev: every row when Full, else the rows that changed since the asked revision and the units that left the view.

type RunView added in v0.3.0

type RunView struct {
	Seq          int64    `json:"seq"`
	Intent       string   `json:"intent"`
	State        string   `json:"state"`
	Manager      string   `json:"manager,omitempty"`
	Workspace    string   `json:"workspace,omitempty"`
	Worktree     string   `json:"worktree,omitempty"`
	Session      string   `json:"session,omitempty"`
	SessionState string   `json:"session_state,omitempty"`
	Resume       string   `json:"resume,omitempty"`
	Actions      []string `json:"actions,omitempty"`
}

RunView is a run of a task: the turn Seq of Intent in State, where it ran, its session and that session's state, the command that resumes it, and the run actions it offers (open, enter, transcript).

type RunnerState added in v0.2.0

type RunnerState struct {
	Runner  string `json:"runner"`
	Enabled bool   `json:"enabled"`
	Reason  string `json:"reason,omitempty"`
}

RunnerState is a runner a delegate runs on; a session is disabled when the unit has nowhere to run one.

type SavedView

type SavedView struct {
	ID    string `json:"id"`
	Label string `json:"label"`
	View  string `json:"view"`
	Group string `json:"group,omitempty"`
}

SavedView: View is a ViewSpec id served by the generic rows (rows or custom).

type Search struct {
	Query  string        `json:"query"`
	Total  int           `json:"total"`
	Groups []SearchGroup `json:"groups"`
}

Search is every task matching Query, grouped by whom it waits on.

type SearchFilter added in v0.3.0

type SearchFilter struct {
	Term   string `json:"term,omitempty"`
	Window int    `json:"window,omitempty"`
	Label  string `json:"label"`
}

SearchFilter toggles Term, or keeps Window days of recent activity.

type SearchGroup added in v0.4.0

type SearchGroup struct {
	ID      string         `json:"id"`
	Label   string         `json:"label"`
	Count   int            `json:"count"`
	Results []SearchResult `json:"results"`
}

SearchGroup is the first results of a group; Count counts all of them.

type SearchPreset added in v0.3.0

type SearchPreset struct {
	Query string `json:"query"`
	Label string `json:"label"`
}

type SearchResult added in v0.4.0

type SearchResult struct {
	Task      TaskView `json:"task"`
	Views     []string `json:"views"`
	UnitLabel string   `json:"unit_label,omitempty"`
}

SearchResult is a task found, the rail views it appears in and its unit's label.

type SearchSort added in v0.3.0

type SearchSort struct {
	Sort  string `json:"sort"`
	Label string `json:"label"`
	Shown string `json:"shown,omitempty"`
}

type SearchSpec added in v0.3.0

type SearchSpec struct {
	DefaultSort string            `json:"default_sort,omitempty"`
	Presets     []SearchPreset    `json:"presets,omitempty"`
	Filters     []SearchFilter    `json:"filters,omitempty"`
	Sorts       []SearchSort      `json:"sorts,omitempty"`
	Decisions   map[string]string `json:"decisions,omitempty"`
	NoDecision  string            `json:"no_decision,omitempty"`
}

SearchSpec 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 SessionStartRequest

type SessionStartRequest struct {
	Pane         string `json:"pane,omitempty"`
	WorktreeID   string `json:"worktree_id,omitempty"`
	AgentSession string `json:"agent_session,omitempty"`
	Source       string `json:"source,omitempty"`
	Cwd          string `json:"cwd,omitempty"`
	Home         string `json:"home,omitempty"`
	// Agent is the hook's agent and Transcript the session's transcript
	// file, "" when the agent's payload names none.
	Agent      string `json:"agent,omitempty"`
	Transcript string `json:"transcript,omitempty"`
}

type SignalSpec added in v0.4.0

type SignalSpec struct {
	Provider string            `json:"provider"`
	Key      string            `json:"key"`
	Label    string            `json:"label"`
	Values   map[string]string `json:"values,omitempty"`
	Notes    map[string]string `json:"notes,omitempty"`
}

SignalSpec is how a card signal of a provider shows: its name, its values' and its notes' words by code, `{{.name}}` where a value the signal gives goes.

type Since

type Since struct {
	Epoch string
	Rev   uint64
}

Since is a client's position in the rows: the epoch and revision it last merged. The zero Since asks for every row.

func ParseSince

func ParseSince(raw string) (Since, error)

ParseSince reads a since parameter; "" and "0" are the zero Since.

func (Since) String

func (s Since) String() string

String is s as the since parameter and the SSE id, "<epoch>:<rev>"; "" for the zero Since.

type SituationSpec

type SituationSpec struct {
	Provider string `json:"provider"`
	Kind     Kind   `json:"kind"`
	Label    string `json:"label"`
	Rank     int    `json:"rank"`
}

type SourceHealth

type SourceHealth struct {
	Provider unit.ProviderID `json:"provider"`
	Warnings []string        `json:"warnings"`
	Detail   json.RawMessage `json:"detail,omitempty"`
}

type StateSpec added in v0.3.0

type StateSpec struct {
	Name     string `json:"name"`
	Label    string `json:"label"`
	Category string `json:"category"`
}

StateSpec is a state of tasks.toml and the category Go reads of it.

type StopAnswer

type StopAnswer struct {
	Block  bool   `json:"block"`
	Reason string `json:"reason,omitempty"`
}

type StopRequest

type StopRequest struct {
	AgentSession string `json:"agent_session,omitempty"`
	PromptID     string `json:"prompt_id,omitempty"`
	LastMessage  string `json:"last_message,omitempty"`
	// Agent and Transcript are as in SessionStartRequest.
	Agent      string `json:"agent,omitempty"`
	Transcript string `json:"transcript,omitempty"`
}

type StoreStatus added in v0.2.0

type StoreStatus struct {
	// Version is the store's schema version and Reads the one this release
	// creates and migrates to.
	Version uint32 `json:"version"`
	Reads   uint32 `json:"reads"`
	// State is one of the Store* states.
	State   string `json:"state"`
	Message string `json:"message,omitempty"`
	Fix     string `json:"fix,omitempty"`
	// LastBackup is the newest copy of the store in the backups directory.
	LastBackup   string    `json:"last_backup,omitempty"`
	LastBackupAt time.Time `json:"last_backup_at,omitzero"`
}

StoreStatus is the store as the daemon found it. A daemon whose store is not open answers only its health, with State saying why and Fix the command that gets past it.

type Strings added in v0.4.0

type Strings struct {
	Locale string `json:"locale"`
	// Stamp is the same stamp Health.Strings carries, so a client knows which strings it holds.
	Stamp   string            `json:"stamp"`
	Strings map[string]Text   `json:"strings"`
	Formats map[string]string `json:"formats"`
}

Strings are the client strings resolved for Locale, by key (the English text), and Formats the date and number patterns Go clients format with (time, date, datetime as Go layouts; decimal and group separators).

type Summary

type Summary struct {
	WaitsOn   string    `json:"waits_on"` // "me", a login, "loop", "nobody", ...
	Since     time.Time `json:"since"`
	Stalled   bool      `json:"stalled"`
	Closed    bool      `json:"closed"` // replaces Kind == "done" in Row.In
	OpenItems int       `json:"open_items"`
	Reason    string    `json:"reason"` // one sentence: why it waits
	Line      string    `json:"line"`   // the short status every client shows (menu bar, TUI list)
	// ReasonKey names Reason in its plugin's words (CatalogResponse.Reasons), which ReasonParams fill; empty
	// for a reason no plugin words.
	ReasonKey    string            `json:"reason_key,omitempty"`
	ReasonParams map[string]string `json:"reason_params,omitempty"`
}

type TagCount

type TagCount struct {
	Value string `json:"value"`
	Count int    `json:"count"`
}

type TaskCreate added in v0.3.0

type TaskCreate struct {
	Title     string            `json:"title"`
	Brief     string            `json:"brief,omitempty"`
	Props     map[string]string `json:"props,omitempty"`
	Placement string            `json:"placement,omitempty"`
	Unit      *unit.Unit        `json:"unit,omitempty"`
}

TaskCreate creates a task: a Title alone captures it. Brief is its brief's markdown, Props its properties as their text, Placement a hint of where its work runs, such as a repository, and Unit the unit it is about.

type TaskRef added in v0.4.0

type TaskRef struct {
	ID     string    `json:"id"`
	Title  string    `json:"title"`
	State  string    `json:"state,omitempty"`
	Merged bool      `json:"merged,omitempty"`
	Within []TaskRef `json:"within,omitempty"`
}

TaskRef is another task as a task's page names it: its id, title and state; Merged says it is merged into another task and reads as that one. Within are, on an entry of MergedFrom, the tasks merged into it before it was merged, shown without a split: that entry is split first.

type TaskRequest added in v0.3.0

type TaskRequest struct {
	Args   map[string]string `json:"args,omitempty"`
	Source string            `json:"source"`
}

TaskRequest args: waiting {on, resurface}; schedule {until (RFC3339 or YYYY-MM-DD), on_activity "true"}; project {id | title (creates one)}; context {set "a,b"}; area {set}; answer: as ActionRequest fields; delegate {guidance, mode "headless" | "session"}; reply {text | reaction, kind "reply" | "react", send "now"}; merge, split, relate, unrelate {task (task.ArgTask): the other task's id}.

type TaskResult added in v0.3.0

type TaskResult struct {
	Task  TaskView `json:"task"`
	Lines []string `json:"lines,omitempty"`
}

type TaskView added in v0.3.0

type TaskView struct {
	ID         string      `json:"id"`
	State      string      `json:"state"`
	Category   string      `json:"category,omitempty"`
	Title      string      `json:"title"`
	Notes      string      `json:"notes,omitempty"`
	Changed    bool        `json:"changed,omitempty"`
	Units      []unit.Unit `json:"units"`
	UnitLabels []string    `json:"unit_labels,omitempty"` // Units as a person reads them, in order
	Cards      []CardView  `json:"cards,omitempty"`       // detail only
	Verbs      []VerbState `json:"verbs"`
	// Actions are the intents that serve the task's own unit, such as start.
	Actions []ActionState `json:"actions,omitempty"`
	// UnitActions are, for each unit the task holds that has a row, the actions its row offers on a task's
	// page (the task surface), run on that unit; detail only.
	UnitActions []UnitActions `json:"unit_actions,omitempty"`
	Attention   *Attention    `json:"attention,omitempty"`
	Created     time.Time     `json:"created"`
	Updated     time.Time     `json:"updated"`

	// A project's: whether it takes its children one at a time, and its review.
	Sequential  bool      `json:"sequential,omitempty"`
	ReviewEvery string    `json:"review_every,omitempty"` // a Go duration
	ReviewedAt  time.Time `json:"reviewed_at,omitzero"`
	ReviewDue   bool      `json:"review_due,omitempty"`

	// Props are the task's properties by name, each in its type's JSON: a string, a number, an RFC 3339 time,
	// a Go duration string, a list of strings, or a list of people for an actor.
	Props map[string]json.RawMessage `json:"props,omitempty"`
	// OwedBy is who owes the task's next step, as the profile's owed_by says: "me" or a person's key.
	OwedBy string `json:"owed_by,omitempty"`
	// Askers are who waits on you through the task, by key: the requesters of its open asks to you.
	Askers []string `json:"askers,omitempty"`
	// ExtractionLag is how long the oldest message of its links has waited to be extracted, a Go duration;
	// empty when none waits.
	ExtractionLag string `json:"extraction_lag,omitempty"`
	// Facets are the task's values of every facet, by facet id, from its facts, its brief and its units' rows,
	// joined as the profile's facets say; Values[0] is the group and sort key.
	Facets map[string][]string `json:"facets,omitempty"`
	// Reason is why the task's primary unit waits, its row's summary reason; empty when it has no row.
	Reason string `json:"reason,omitempty"`
	// Asks are the items the task holds, detail only.
	Asks  []AskView   `json:"asks,omitempty"`
	Gates []GateView  `json:"gates,omitempty"` // the open ones
	Runs  []RunView   `json:"runs,omitempty"`  // detail only
	Brief *RecordView `json:"brief,omitempty"`
	Wake  *WakeView   `json:"wake,omitempty"`
	// Parent is the parent task's id; Children are its children's, in sibling order.
	Parent   string   `json:"parent,omitempty"`
	Children []string `json:"children,omitempty"`
	// Related are the tasks related to this one, as its property of role related lists them; MergedFrom the
	// tasks merged into it, in merge order, each as its merge record keeps it: the ones split gives back.
	Related    []TaskRef `json:"related,omitempty"`
	MergedFrom []TaskRef `json:"merged_from,omitempty"`
	// Drafts are the ids of the task's pending drafts (held or failed), ascending.
	Drafts []int64 `json:"drafts"`
	// ReplyBroadcast is "on" or "off" when a reply the user writes on the task would reply in a thread that can
	// also post to its conversation, as its publisher would place it, which the reply verb's broadcast argument
	// turns; "" otherwise. Detail only.
	ReplyBroadcast string `json:"reply_broadcast,omitempty"`
}

func (TaskView) DraftOf added in v0.3.0

func (e TaskView) DraftOf() (Draft, bool)

DraftOf is the draft of e's first draft gate, its subject, that no open question pins; false when e has none. A pinned draft is its question's to decide, which shows it under the option that pins it.

func (TaskView) MessageOf added in v0.3.0

func (e TaskView) MessageOf() (Message, GateView, bool)

MessageOf is the message of e's first open question, post or proposal gate, and that gate.

func (TaskView) PropList added in v0.3.0

func (e TaskView) PropList(name string) []string

PropList is the property name's list of strings; nil when unset or of another type.

func (TaskView) PropText added in v0.3.0

func (e TaskView) PropText(name string) string

PropText is the property name's text: a string, an enum or a duration; "" when unset or of another type.

func (TaskView) PropTime added in v0.3.0

func (e TaskView) PropTime(name string) time.Time

PropTime is the property name's time; zero when unset or of another type.

func (TaskView) Texts added in v0.3.0

func (e TaskView) Texts() []string

Texts are what a filter's free words search in a task: its title, notes, state, the text and the lists of text of its properties, its units, who owes it, its asks, its cards' people, its draft, its message and its facets' values, by facet id. The cockpit's taskHaystack lists the same texts.

func (TaskView) UnitLabel added in v0.3.0

func (e TaskView) UnitLabel(i int) string

UnitLabel is the i-th unit as a person reads it.

type TaskViewSpec added in v0.3.0

type TaskViewSpec struct {
	ID           string `json:"id"`
	Label        string `json:"label"`
	Summary      string `json:"summary,omitempty"`
	Empty        string `json:"empty,omitempty"`
	When         string `json:"when,omitempty"`
	Sort         string `json:"sort,omitempty"`
	Over         string `json:"over,omitempty"`
	Group        string `json:"group,omitempty"`
	Key          string `json:"key,omitempty"`
	Badge        bool   `json:"badge,omitempty"`
	HideDisabled bool   `json:"hide_disabled,omitempty"`
	RemoveClean  bool   `json:"remove_clean,omitempty"`
	// Rail says whether the rail lists the view; a view only the home, a queue or search reads does not.
	Rail bool `json:"rail"`
	// Layout is how the cockpit draws the view: list, board or outbox.
	Layout string `json:"layout,omitempty"`
}

TaskViewSpec is a view of views.toml: Summary is one line on what it lists, Empty what it shows when it lists nothing, Over what it lists (tasks or gates), When and Sort its rule as the profile writes it, Group the fact it groups by, Key the key that jumps to it, Badge whether the badge counts it, HideDisabled whether it hides the tasks of a disabled plugin, RemoveClean whether it offers to remove its tasks' clean workspaces.

type TasksPage added in v0.3.0

type TasksPage struct {
	Epoch    string     `json:"epoch"`
	Rev      uint64     `json:"rev"`
	Full     bool       `json:"full"`
	Tasks    []TaskView `json:"tasks"`
	Gates    []GateView `json:"gates,omitempty"`
	Removed  []string   `json:"removed"`
	Counters Counters   `json:"counters"`
	// Loading are the plugins whose units are not all reported yet.
	Loading []Loading `json:"loading,omitempty"`
	// Specs is the version of GET /api/views; a client holding another reads them again.
	Specs string `json:"specs,omitempty"`
}

TasksPage is a page of a view; a view over gates lists Gates and no Tasks.

type Text added in v0.4.0

type Text map[string]string

Text is one client string as its CLDR plural forms by category ("zero", "one", "two", "few", "many", "other"); a string with no plural holds only "other".

func (Text) MarshalJSON added in v0.4.0

func (t Text) MarshalJSON() ([]byte, error)

MarshalJSON writes a text with only an "other" form as a bare string, else the object of its forms.

func (*Text) UnmarshalJSON added in v0.4.0

func (t *Text) UnmarshalJSON(b []byte) error

UnmarshalJSON reads a bare string as the "other" form, else the object of forms.

type TimelineEvent added in v0.3.0

type TimelineEvent struct {
	Seq   int64  `json:"seq"`
	Kind  string `json:"kind"`
	Sub   string `json:"sub,omitempty"`
	Actor string `json:"actor,omitempty"`
	// Session is the session an agent acted through, and By how the profile names a change made through one.
	Session string          `json:"session,omitempty"`
	By      string          `json:"by,omitempty"`
	At      time.Time       `json:"at"`
	Unit    string          `json:"unit,omitempty"`
	Data    json.RawMessage `json:"data,omitempty"`
}

TimelineEvent is one event of a task's timeline: Seq its stable position, which pages it, and Unit the unit it happened on, "" for the task itself.

type TimelineNode added in v0.4.0

type TimelineNode struct {
	Rule    string          `json:"rule,omitempty"`
	Label   string          `json:"label"`
	Tone    string          `json:"tone,omitempty"`
	At      time.Time       `json:"at"`
	End     time.Time       `json:"end,omitzero"`
	Running bool            `json:"running,omitempty"`
	Actor   string          `json:"actor,omitempty"`
	Events  []TimelineEvent `json:"events"`
}

TimelineNode is one fact of a task's timeline, as GET TimelinePath?as=nodes serves it, newest first: the events a profile's [facts.<name>] Rule folded, oldest first, or one event no fact took (Rule ""). Label and Tone are the fact's words; End is zero for a single event and for a span still Running.

type TimingsQuery added in v0.3.0

type TimingsQuery struct {
	Days int `json:"days"`
}

TimingsQuery asks for the timings of the Days days before now.

type TimingsReport

type TimingsReport struct {
	Since         time.Time `json:"since"`
	RecordedSince time.Time `json:"recorded_since,omitzero"`
	// Viewer is the login the report counts as mine, "" when the daemon
	// does not know it yet.
	Viewer        string                 `json:"viewer,omitempty"`
	Milestones    map[string]Quantiles   `json:"milestones"`
	Waiting       map[string]WaitShare   `json:"waiting"`
	ChangeFailure ChangeFailure          `json:"change_failure"`
	Briefs        BriefTimings           `json:"briefs"`
	Intakes       Quantiles              `json:"intakes"`
	Turns         map[string]Quantiles   `json:"turns"`
	Tokens        map[string]TokenCounts `json:"tokens"`
	Tags          map[string][]TagCount  `json:"tags,omitempty"`
	Dropped       []string               `json:"dropped,omitempty"`
	PRs           []PRTimes              `json:"prs"`
	TurnList      []TurnTimes            `json:"turn_list"`
}

TimingsReport is what the loop recorded in the window since Since; RecordedSince is when recording began. Milestones are pull request durations that start and end in the window; Turns are the durations of the turns that ended in it by intent, plus TurnStartWait.

type TokenCounts

type TokenCounts struct {
	Input      int64 `json:"input"`
	Output     int64 `json:"output"`
	CacheRead  int64 `json:"cache_read"`
	CacheWrite int64 `json:"cache_write"`
}

type TranscriptLine added in v0.3.0

type TranscriptLine struct {
	Role string    `json:"role"`
	Text string    `json:"text"`
	At   time.Time `json:"at,omitzero"`
}

TranscriptLine is one message of a run's agent transcript: who wrote it (user or assistant) and its text.

type TranscriptPage added in v0.3.0

type TranscriptPage struct {
	Lines []TranscriptLine `json:"lines"`
	Total int              `json:"total"`
}

TranscriptPage is what RunTranscript serves: the transcript's lines from the asked one, oldest first, and how many lines it holds in all.

type Turn

type Turn struct {
	Seq        int64     `json:"seq"`
	Intent     string    `json:"intent"`
	ID         string    `json:"id"`
	Trigger    string    `json:"trigger"`
	Guidance   string    `json:"guidance"`
	Head       string    `json:"head"`
	SentTo     string    `json:"sent_to"`
	Session    string    `json:"session"`
	State      string    `json:"state"`
	SentAt     time.Time `json:"sent_at"`
	StartedAt  time.Time `json:"started_at,omitzero"`
	EndedAt    time.Time `json:"ended_at,omitzero"`
	ResumeOf   int64     `json:"resume_of,omitempty"`
	ReplacedBy int64     `json:"replaced_by,omitempty"`
	Before     string    `json:"before,omitempty"`
	// Agent is the agent that ran the turn, BriefRun the brief run its
	// instructions carried and AgentSession the agent session that started it.
	Agent        string `json:"agent,omitempty"`
	BriefRun     int64  `json:"brief_run,omitempty"`
	AgentSession string `json:"agent_session,omitempty"`
	// Runner is "" for a session turn; Workflow the workflow that started it;
	// Role the role its intent held.
	Runner   string `json:"runner,omitempty"`
	Workflow string `json:"workflow,omitempty"`
	Role     string `json:"role,omitempty"`
}

type TurnAnswer

type TurnAnswer struct {
	ID       int64     `json:"id"`
	TurnSeq  int64     `json:"turn_seq"`
	Text     string    `json:"text"`
	OptionID string    `json:"option_id,omitempty"`
	Yes      bool      `json:"yes"`
	No       bool      `json:"no,omitempty"`
	Source   string    `json:"source"`
	Route    string    `json:"route"`
	Session  string    `json:"session,omitempty"`
	At       time.Time `json:"at"`
	// BySession is the session an agent answered through for you, absent for your own answer.
	BySession string `json:"by_session,omitempty"`
	// Message is the Inbox message answered, 0 for none; Posted says the agent posted it. Gate is the gate the
	// answer resolved, 0 for one given with no gate open.
	Message int64 `json:"message_id,omitempty"`
	Gate    int64 `json:"gate_id,omitempty"`
	Posted  bool  `json:"posted,omitempty"`
	// NoticedAt is when the session was told of the answer, ReadAt when the agent read it; each absent until then.
	NoticedAt *time.Time `json:"noticed_at,omitempty"`
	ReadAt    *time.Time `json:"read_at,omitempty"`
}

type TurnBook

type TurnBook struct {
	Unit  Named       `json:"unit"`
	Turns []TurnShown `json:"turns"`
}

TurnBook is a pull request's book as `turn show` prints it.

type TurnEndRequest

type TurnEndRequest struct {
	Turn string `json:"turn"`
	// PR is the pull request the command line names, "" for none.
	PR           string          `json:"pr,omitempty"`
	Record       json.RawMessage `json:"record"`
	AgentSession string          `json:"agent_session,omitempty"`
	// WrittenAt is when the record's file was last written; zero when the
	// record came from no file.
	WrittenAt time.Time `json:"written_at,omitzero"`
}

type TurnEnded

type TurnEnded struct {
	PR    string `json:"pr"`
	State string `json:"state"`
	Added bool   `json:"added"`
	// Note tells the agent its record changes nothing.
	Note   string       `json:"note,omitempty"`
	Ledger *ItemsResult `json:"ledger,omitempty"`
}

type TurnFacts

type TurnFacts struct {
	Count      int     `json:"count"`
	Open       int     `json:"open"`
	LastIntent string  `json:"last_intent,omitempty"`
	Tokens     int64   `json:"tokens"`
	CostUSD    float64 `json:"cost_usd"`
}

TurnFacts counts every turn of the pull request; Open is those sent, started or asked, and CostUSD counts an unreported cost as 0.

type TurnRecord

type TurnRecord struct {
	ID           int64         `json:"id"`
	TurnSeq      int64         `json:"turn_seq"`
	Session      string        `json:"session"`
	AgentSession string        `json:"agent_session"`
	Head         string        `json:"head"`
	Hash         string        `json:"hash"`
	At           time.Time     `json:"at"`
	Acked        bool          `json:"acked"`
	Record       record.Record `json:"record"`
}

type TurnShown

type TurnShown struct {
	Turn         turn.Turn     `json:"turn"`
	Instructions string        `json:"instructions,omitempty"`
	Records      []turn.Record `json:"records"`
	Answers      []turn.Answer `json:"answers"`
}

TurnShown is one turn with its stored instructions and its events: the records and the answers it got.

type TurnStartRequest

type TurnStartRequest struct {
	Turn   string `json:"turn"`
	Intent string `json:"intent"`
}

type TurnText

type TurnText struct {
	Text string `json:"text"`
}

TurnText is a turn's stored instructions, or the answers the caller reads with turn answer.

type TurnTimes

type TurnTimes struct {
	PR           string    `json:"pr"`
	Seq          int64     `json:"seq"`
	Intent       string    `json:"intent"`
	Trigger      string    `json:"trigger"`
	State        string    `json:"state"`
	Agent        string    `json:"agent,omitempty"`
	Sent         time.Time `json:"sent"`
	Started      time.Time `json:"started,omitzero"`
	Ended        time.Time `json:"ended,omitzero"`
	DurationMS   int64     `json:"duration_ms,omitempty"`
	OutputTokens int64     `json:"output_tokens,omitempty"`
}

TurnTimes is one turn of the window, for --turns.

type TurnView

type TurnView struct {
	Turn        Turn         `json:"turn"`
	Records     []TurnRecord `json:"records"`
	Answers     []TurnAnswer `json:"answers"`
	LastMessage string       `json:"last_message,omitempty"`
}

TurnView is the pull request's newest turn with its records and answers.

type UnitActions added in v0.5.0

type UnitActions struct {
	Unit    unit.Unit     `json:"unit"`
	Label   string        `json:"label"`
	Actions []ActionState `json:"actions"`
}

UnitActions are actions a unit's row offers, with the unit and its label.

type UnitQuery added in v0.3.0

type UnitQuery struct {
	Unit unit.Unit `json:"unit"`
}

UnitQuery names the unit a view is of.

type UnitRowQuery added in v0.3.0

type UnitRowQuery struct {
	Unit    unit.Unit      `json:"unit"`
	Action  string         `json:"action,omitempty"`
	Inputs  map[string]any `json:"inputs,omitempty"`
	Unmuted bool           `json:"unmuted,omitempty"`
	Kept    bool           `json:"kept,omitempty"`
}

UnitRowQuery asks for a unit's row; Action and Inputs are the action a request asks for, Unmuted derives it without the user's mute and pending round, and Kept asks only for a unit the plugin keeps, reading nothing from its source.

type UnitSkipState added in v0.4.0

type UnitSkipState struct {
	Unit     string `json:"unit"`
	Workflow string `json:"workflow"`
	Skipped  bool   `json:"skipped"`
}

UnitSkipState is whether a workflow is skipped on a unit ("<provider>/<key>").

type UnitWorkflow

type UnitWorkflow struct {
	Workflow string `json:"workflow"`
	Trigger  string `json:"trigger"`
	Outcome  string `json:"outcome"`
	Reason   string `json:"reason,omitempty"`
	Facts    []Fact `json:"facts,omitempty"`
}

UnitWorkflow is a workflow of the explained unit's provider that gives the unit no item: Outcome is "not_matched", "matched", "waits" or "error", Facts the facts its `when` read.

type Upcoming

type Upcoming struct {
	At   time.Time `json:"at"`
	What string    `json:"what"`
}

Upcoming is a future instant of the row: What is gate, unmute or brief_retry.

type VerbSpec added in v0.3.0

type VerbSpec struct {
	Verb    string `json:"verb"`
	Handler string `json:"handler,omitempty"`
	Label   string `json:"label"`
	Summary string `json:"summary,omitempty"`
	Input   string `json:"input,omitempty"` // the question a verb that asks for a value puts first
	// Send is what a reply of a verb whose handler is reply does by default: "now" sends it, "draft" holds it
	// for approval; every client's reply composer starts on it.
	Send string `json:"send,omitempty"`
	// Pick is, on a verb that takes another task, the tasks a person picks it from: open (the open tasks but
	// this one, as TasksPath lists them with TasksMatch and TasksExcept), merged (TaskView.MergedFrom) or related
	// (TaskView.Related); the pick goes in the argument task.ArgTask. Empty for a verb that takes none.
	Pick string   `json:"pick,omitempty"`
	Key  string   `json:"key"`
	From []string `json:"from,omitempty"`
	To   string   `json:"to,omitempty"`
}

VerbSpec is a verb a task offers: Handler is what it runs besides its move, as the profile names it ("" for none), From the states it moves a task from (every state when empty), To the state it moves it to ("" for none).

type VerbState

type VerbState struct {
	Verb    string `json:"verb"`
	Enabled bool   `json:"enabled"`
	Reason  string `json:"reason,omitempty"`
	// Runners are, on an enabled delegate, the runners of the action it runs: headless, session or both.
	Runners []RunnerState `json:"runners,omitempty"`
}

type ViewSpec

type ViewSpec struct {
	ID       string   `json:"id"` // "needs-me", ...; unique across providers
	Label    string   `json:"label"`
	Provider string   `json:"provider"` // "" for a core view
	Rows     bool     `json:"rows"`     // a list of rows filtered by Row.Views; false: a custom view the client knows (plan, dash, explore, recent)
	Order    int      `json:"order"`
	Surfaces []string `json:"surfaces"` // "web", "tui", "menubar"
	// Unit names the view's rows, such as "Pull request"; "" for a view whose rows mix providers.
	Unit string `json:"unit,omitempty"`
	// DefaultSort is what the sort menu calls the view's own order.
	DefaultSort string `json:"default_sort,omitempty"`
	// Search is a custom view's search; nil for none.
	Search *SearchSpec `json:"search,omitempty"`
}

type ViewsCatalog added in v0.3.0

type ViewsCatalog struct {
	Views    []TaskViewSpec `json:"views"` // core views in spec 9.1 order, review only once registered
	Areas    []string       `json:"areas"`
	Contexts []string       `json:"contexts"`
	Verbs    []VerbSpec     `json:"verbs"` // key from internal/keys
	// Review are the ids of the views the review walks, in order.
	Review []string `json:"review,omitempty"`
	// States are the profile's states in their declared order; Props its task properties.
	States []StateSpec `json:"states,omitempty"`
	Props  []PropSpec  `json:"props,omitempty"`
	// Facets are the profile's task facets, DefaultSort what clients call a view's own order.
	Facets      []FacetSpec `json:"facets,omitempty"`
	DefaultSort string      `json:"default_sort,omitempty"`
	Lens        LensWords   `json:"lens"`
	// DetailVerbs are the verbs a task's detail shows as buttons, in order (tasks.toml's detail.verbs); Effects
	// the sentence that says what each effect does when a draft is sent, by effect name (gates.toml's effects).
	DetailVerbs []string          `json:"detail_verbs"`
	Effects     map[string]string `json:"effects"`
	// DraftPurposes name what a draft is for, by purpose, and DraftStates where its delivery stands, by state
	// (gates.toml's drafts.purposes and drafts.states).
	DraftPurposes map[string]string `json:"draft_purposes"`
	DraftStates   map[string]string `json:"draft_states"`
	// RunStates word a run's turn state and SessionStates its session's, by state (tasks.toml's runs).
	RunStates     map[string]string `json:"run_states"`
	SessionStates map[string]string `json:"session_states"`
	// Version changes whenever anything above does.
	Version string `json:"version,omitempty"`
}

func (ViewsCatalog) HandlerOf added in v0.3.0

func (c ViewsCatalog) HandlerOf(verb string) string

HandlerOf is the handler verb runs in c: its profile handler, else its own name, as the tasks service binds it.

func (ViewsCatalog) PropOf added in v0.3.0

func (c ViewsCatalog) PropOf(role string) (PropSpec, bool)

PropOf is the property of c that takes role; false when none does.

func (ViewsCatalog) Starred added in v0.3.0

func (c ViewsCatalog) Starred(e TaskView) bool

Starred says whether e holds the starred value, the first, of the property c's star role acts on.

func (ViewsCatalog) VerbOf added in v0.3.0

func (c ViewsCatalog) VerbOf(handler string) (string, bool)

VerbOf is the verb of c that runs handler: the first whose handler it is, or with no handler, whose name it is, as the tasks service binds a kind's own verbs; false when none does.

type WaitShare

type WaitShare struct {
	TotalMS int64     `json:"total_ms"`
	OpenMS  int64     `json:"open_ms"`
	PRs     int       `json:"prs"`
	Spans   Quantiles `json:"spans"`
}

WaitShare is the time followed pull requests spent waiting on one party in the window: the total, and the spans between situation changes. OpenMS is the part of the total in spans still open at the report's time, which Spans leaves out.

type WakeView added in v0.3.0

type WakeView struct {
	Until  time.Time `json:"until,omitzero"`
	When   string    `json:"when,omitempty"`
	Return string    `json:"return,omitempty"`
}

WakeView is a task's wake: until a time, or When, a condition, holds; Return is the state it goes back to.

type WebView

type WebView struct {
	Module string   `json:"module"`
	Views  []string `json:"views"`
}

WebView: Module is served at /plugins/<id>/<Module>.

type Why

type Why struct {
	Trigger string `json:"trigger"`
	Event   string `json:"event,omitempty"`
	Matched []Fact `json:"matched"`
}

type WindowRequest added in v0.4.0

type WindowRequest struct {
	Action string `json:"action"`
	Route  string `json:"route,omitempty"`
	// URL is the http or https address an external request opens.
	URL string `json:"url,omitempty"`
}

WindowRequest asks the native window to act; Route is a cockpit route, a hash without "#".

type WindowResult added in v0.4.0

type WindowResult struct {
	Delivered bool `json:"delivered"`
}

WindowResult says whether a window client took the request.

type WorkflowSwitch added in v0.4.0

type WorkflowSwitch struct {
	Workflow string `json:"workflow"`
	Enabled  bool   `json:"enabled"`
}

WorkflowSwitch is whether a workflow is enabled.

type Workspace

type Workspace struct {
	// Manager owns the workspace; ID is its id there.
	Manager     string   `json:"manager,omitempty"`
	ID          string   `json:"id"`
	DisplayName string   `json:"display_name"`
	Status      string   `json:"status"`
	IsReview    bool     `json:"is_review"`
	AgentStates []string `json:"agent_states"`
	Comment     string   `json:"comment"`
	// IsMain is the repository's main checkout on the pull request's branch,
	// which the loop never removes.
	IsMain bool `json:"is_main"`
}

Directories

Path Synopsis
Package client is the Go client of the daemon's API, over its Unix socket.
Package client is the Go client of the daemon's API, over its Unix socket.
Package lens is the one semantics of a view's filter, group and sort over facets.
Package lens is the one semantics of a view's filter, group and sort over facets.

Jump to

Keyboard shortcuts

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