api

package
v0.94.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 9 Imported by: 1 module, 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 contract between the lich backend and its clients: the window (native/backend), `lich` and `lich mcp`. Each RPC is declared here once, as a Method whose type parameters are what it takes and what it returns, so a client and the backend that disagree on either do not compile.

On the wire a call is a JSON array holding its one options object, or empty for a method that takes nothing: the envelope internal/rpc has always read, which keeps a `lich` of another release talking to this backend. Fields are matched by name, never by position, so an option one side does not know is dropped and one it does not send is its zero value.

The package is pure Go with no dependency beyond the standard library: the window's module imports it, and must not reach internal/. testdata/contract.golden records every method's shape; a change to it is a change to the contract, visible in review.

Index

Constants

View Source
const (
	DownloadInProgress = "inProgress"
	DownloadCompleted  = "completed"
	DownloadCanceled   = "canceled"
	DownloadFailed     = "failed"
)

Download states, Chrome's own (Browser.downloadProgress), and lich's DownloadFailed: Chrome completed it, and moving it into Downloads failed.

View Source
const (
	TabNew    = "new"
	TabSelect = "select"
	TabClose  = "close"
)

Tab actions: open a blank tab in front, bring Tab to the front, close Tab.

View Source
const (
	DialogAccepted  = "accepted"
	DialogDismissed = "dismissed"
)

Dialog answers, as a page answer reports one the person gave.

View Source
const (
	ViewTerminal = "terminal"
	ViewChat     = "chat"
)

The views a session is drawn in.

View Source
const (
	ItemUser       = "user"       // the person's message
	ItemAgent      = "agent"      // the agent's text, Markdown
	ItemThought    = "thought"    // the agent's reasoning, when the provider reports it
	ItemTool       = "tool"       // a tool call and its outcome
	ItemPermission = "permission" // the agent asking before a tool runs
	ItemQuestion   = "question"   // the agent asking the person to choose or write
	ItemNotice     = "notice"     // something lich or the provider says about the session: an error, a resume
	ItemPlan       = "plan"       // the agent's task list as it stands, whole, drawn over the composer and not in the conversation
	ItemCompaction = "compaction" // the agent folding the conversation into a summary, while it runs and once it ended
)

The kinds of chat item.

View Source
const (
	CompactionRunning   = "running"
	CompactionDone      = "done"
	CompactionFailed    = "failed"
	CompactionCancelled = "cancelled"
)

The states of a compaction item. A cancelled one is not drawn.

View Source
const (
	PlanPending    = "pending"
	PlanInProgress = "in_progress"
	PlanCompleted  = "completed"
)

The states of a plan entry, Claude Code's and ACP's own.

View Source
const (
	ToolPending = "pending"
	ToolRunning = "running"
	ToolDone    = "done"
	ToolFailed  = "failed"
)

The states of a tool item.

View Source
const (
	PermitAllowOnce   = "allow_once"
	PermitAllowAlways = "allow_always"
	PermitRejectOnce  = "reject_once"
)

The kinds of permission option, ACP's own.

View Source
const (
	OptionModel  = "model"
	OptionEffort = "thought_level"
	OptionMode   = "mode"
)

The categories of chat option, ACP's session config option categories.

View Source
const (
	MemoryUser       = "user"
	MemoryProject    = "project"
	MemoryProjectAlt = "project-alt"
	MemoryLocal      = "local"
	MemoryOther      = "other"
)

Instruction file kinds, as ChatMemoryFile.Kind names them: the person's own, the project's ./CLAUDE.md, its ./.claude/CLAUDE.md, the checkout's ./CLAUDE.local.md, and any other the provider loads.

View Source
const (
	MemoryAuto  = "auto-memory"
	MemoryDream = "auto-dream"
)

ChatSetMemory settings.

View Source
const (
	AgentBuiltIn = "built-in"
	AgentUser    = "user"
	AgentProject = "project"
	AgentPlugin  = "plugin"
	AgentManaged = "managed"
	AgentOther   = "other"
)

Where a subagent comes from, as ChatAgent.Source names it.

View Source
const (
	PermissionAllow = "allow"
	PermissionAsk   = "ask"
	PermissionDeny  = "deny"
)

What a permission rule does to a tool call it matches.

View Source
const (
	PermissionAdd    = "add"
	PermissionRemove = "remove"
)

ChatPermissionAct actions.

View Source
const (
	SettingsUser    = "user"
	SettingsProject = "project"
	SettingsLocal   = "local"
	SettingsManaged = "managed"
	SettingsFlag    = "flag"
	SettingsSession = "session"
	SettingsPlugin  = "plugin"
	SettingsOther   = "other"
)

Where a rule, a folder or a hook comes from, as lich names the providers' sources: a settings file for the person, the project's shared one, the checkout's own, the organization's, a launch flag, this session alone, or a plugin.

View Source
const (
	HookTrusted   = "trusted"
	HookUntrusted = "untrusted"
	HookModified  = "modified"
)

Hook trust, as ChatHook.Trust names it: Codex runs a hook only once the person trusted it, and again only once they trust it after it changed.

View Source
const (
	HookTrust   = "trust"
	HookEnable  = "enable"
	HookDisable = "disable"
)

ChatHookAct actions.

View Source
const (
	HooksOffByPolicy = "policy"
	HooksManagedOnly = "managed-only"
	HooksOff         = "off"
	HooksSafeMode    = "safe-mode"
	HooksBareMode    = "bare-mode"
)

Why no hook of a session runs, as ChatHookList.Blocked names it.

View Source
const (
	PluginInstall     = "install"
	PluginUninstall   = "uninstall"
	PluginEnable      = "enable"
	PluginDisable     = "disable"
	PluginUpdate      = "update"
	MarketplaceAdd    = "marketplace-add"
	MarketplaceUpdate = "marketplace-update"
	MarketplaceRemove = "marketplace-remove"
)

ChatPluginAct actions. The Plugin ones name a plugin by its ID, the Marketplace ones a marketplace by its name, MarketplaceAdd by its source.

View Source
const (
	PluginScopeUser    = "user"
	PluginScopeProject = "project"
	PluginScopeLocal   = "local"
)

Where a plugin is installed, as ChatPlugin.Scope and ChatPluginList.Scopes name it: for the person, for everyone in the project, or in this checkout only.

View Source
const (
	ShellRunning   = "running"
	ShellCompleted = "completed"
	ShellFailed    = "failed"
	ShellStopped   = "stopped"
)

The states of a background shell.

View Source
const (
	MCPConnected = "connected"
	MCPPending   = "pending"
	MCPFailed    = "failed"
	MCPNeedsAuth = "needs-auth"
	MCPDisabled  = "disabled"
)

MCP server statuses, as ChatMCPServer.Status names them.

View Source
const (
	MCPSignedIn    = "signed-in"
	MCPNotSignedIn = "not-signed-in"
)

MCP sign-in states, as ChatMCPServer.Auth names them; "" when the provider does not say.

View Source
const (
	MCPEnable    = "enable"
	MCPDisable   = "disable"
	MCPReconnect = "reconnect"
	MCPSignIn    = "sign-in"
)

ChatMCPAct actions.

View Source
const (
	SkillOn                = "on"
	SkillOff               = "off"
	SkillNameOnly          = "name-only"
	SkillUserInvocableOnly = "user-invocable-only"
)

Skill states, as ChatSkill.State names them. Claude Code reports all four; Codex only on and off.

View Source
const (
	WorkflowQueued    = "queued"
	WorkflowRunning   = "running"
	WorkflowCompleted = "completed"
	WorkflowFailed    = "failed"
	WorkflowStopped   = "stopped"
)

The states of a workflow and of its agents. An agent is queued until it starts, and ends done or failed; a workflow also ends stopped.

View Source
const (
	ExtensionInvalid    = "invalid"
	ExtensionRunning    = "running"
	ExtensionRestarting = "restarting"
	ExtensionFailed     = "failed"
	ExtensionStopped    = "stopped"
)

The states an Extension is in. Invalid never started, its Error says why; restarting is the wait after a crash; failed is lich having given up on it.

View Source
const (
	GitRefLocal  = "local"
	GitRefRemote = "remote"
	GitRefTag    = "tag"
)

A GitRef's Kind, read from its full name: a remote branch called origin/x and a local branch called origin/x are both spelled the same short.

View Source
const (
	GitChunkOurs     = "ours"
	GitChunkTheirs   = "theirs"
	GitChunkBoth     = "both" // both sides made the same change
	GitChunkConflict = "conflict"
)

A GitConflictChunk's Kind: which side changed the base there.

View Source
const (
	ForgeGitHub = "github"
	ForgeGitLab = "gitlab"
)

The forge a checkout's remote points at, as ProjectForge answers it. Every pull request RPC keeps GitHub's names and vocabulary on both; a GitLab merge request arrives mapped onto them.

View Source
const (
	FileModified  = "modified"
	FileAdded     = "added"
	FileUntracked = "untracked"
	FileRenamed   = "renamed"
	FileConflict  = "conflict"
)

A dirty file's state in DiffStats.Changes.

View Source
const (
	CheckOK    = "ok"
	CheckEmpty = "empty"
)

The Status of a BinaryCheck that passed, and of one with nothing to check; every other value is a failure.

View Source
const (
	UseResetReset       = "reset"
	UseResetAlreadyUsed = "already_used"
	UseResetNotLimited  = "not_limited"
	UseResetIneligible  = "ineligible"
	UseResetCooldown    = "cooldown"
)

What a spend can come back as. Reset and AlreadyUsed both mean the limit is cleared (the second is the same request answered twice); the rest cleared nothing.

View Source
const (
	QuotaWindowSession      = "session"
	QuotaWindowWeekly       = "weekly"
	QuotaWindowMonthly      = "monthly"
	QuotaWindowUsage        = "usage"
	QuotaWindowCursorModels = "cursorModels"
	QuotaWindowOtherModels  = "otherModels"
	QuotaWindowOnDemand     = "onDemand"
)
View Source
const (
	QuotaClearsSession = "session"
	QuotaClearsWeekly  = "weekly"
	QuotaClearsModel   = "model"
)

The limits a reset can clear: the five-hour window, the weekly one and the weekly cap of a model.

View Source
const (
	RequestConflicts      = "conflicts"
	RequestChecks         = "checks"
	RequestReviewThread   = "review-thread"
	RequestReviewComments = "review-comments"
	RequestBrowserNotes   = "browser-notes"
	RequestIssue          = "issue"
)

The topics of a request (RequestOptions.Topic).

View Source
const (
	WatchChecksFailed = "checks-failed"
	WatchChecksPassed = "checks-passed"
	WatchReview       = "review"
)

The conditions a session's watch waits for, read from the pull request of the session's branch.

View Source
const (
	ScheduledByAgent = "agent"
	ScheduledByLich  = "lich"
)

Who set a scheduled prompt or a watch, when not the person at the window.

View Source
const (
	ServiceStopped  = "stopped"
	ServiceRunning  = "running"
	ServiceStopping = "stopping"
	ServiceFailed   = "failed"
)

The states a Service is in. A service that is not running is stopped when it exited on its own with 0 or because it was asked to (Stop, or Ctrl+C typed at its console), and failed when it exited on its own with anything else.

View Source
const (
	SubagentSpawn = "spawn"
	SubagentWait  = "wait"
)

The calls a /subagent request is (docs/hooks/subagent-cards.md).

View Source
const (
	SubagentAllow = "allow"
	SubagentDeny  = "deny"
)

The decisions a /subagent answer carries.

View Source
const CheckLogLines = 80

CheckLogLines is how much of a failing step reaches the agent unless it asks for more: on lich's own failed runs the error and the lines that explain it sit within the last few dozen.

View Source
const MaxEventBytes = 8 << 20

MaxEventBytes is what the window's /events socket reads in one message: one over it ends that socket for every session. The backend bounds what it sends (a browser frame, an extension's line) below it, leaving room for the envelope, so the two sides share this value instead of each keeping a copy.

View Source
const NewTabPrefix = "/new-tab/"

NewTabPrefix is the path every session's new-tab page is served under, on a loopback listener of its own (internal/preview), followed by the session's id.

View Source
const QuotaResetFull = "full"

QuotaResetFull is a grant that clears the weekly window too, not only a scoped one.

View Source
const WatchRunLimit = 3

WatchRunLimit is how many times a watch fires on one pull request before it stops. An agent answering failing checks with commits is a loop nobody is watching, and three tries is where a person should look.

Variables

View Source
var (
	AgentPluginStatus  = define[None, []PluginStatus]("agentplugin.Status")
	AgentPluginInstall = define[PluginProviderOptions, None]("agentplugin.Install")
	AgentPluginUpdate  = define[PluginProviderOptions, None]("agentplugin.Update")
)
View Source
var (
	AppUpdateGetStatus = define[None, AppUpdateStatus]("appupdate.Status")
	AppUpdateApply     = define[None, None]("appupdate.Apply")
)
View Source
var (
	// ArtifactList is every open session's artifacts, for a window that has
	// just attached; ArtifactsEvent keeps it current from there.
	ArtifactList = define[None, []SessionArtifacts]("artifact.List")

	// ArtifactAttach puts one of From's artifacts where SessionID can read it
	// and answers with the path and notice to paste at its prompt: From's own
	// path and no notice when the two are the same session, a copy in
	// SessionID's artifact folder otherwise.
	ArtifactAttach = define[AttachArtifactOptions, DropAttachment]("artifact.Attach")

	// ArtifactOpen loads From's artifact Name in SessionID's browser, starting
	// one when SessionID has none. The page is served from From's own folder
	// and origin. Window only: a confined token is refused it
	// (internal/scope), since it would let one session read another's pages.
	ArtifactOpen = define[AttachArtifactOptions, None]("artifact.Open")

	// ArtifactsEvent carries one open session's whole artifact list each time
	// its folder changes, and an empty one when the session closes.
	ArtifactsEvent = defineEvent[SessionArtifacts]("artifacts")
)
View Source
var (
	BrowserShow = define[SessionIDOptions, BrowserHandle]("browser.Show")
	BrowserOpen = define[BrowserOpenOptions, BrowserHandle]("browser.Open")
	BrowserInfo = define[BrowserInfoOptions, BrowserPageInfo]("browser.Info")
	// Click and Press answer with the page as it stands after them, so an
	// agent reads what its action did without a browser.Info of its own. Type
	// does not: typing into a field seldom changes the page, and a page per
	// field filled cost a fifth of a session's page text (measured
	// 2026-10-26).
	BrowserClick      = define[BrowserClickOptions, BrowserPageInfo]("browser.Click")
	BrowserType       = define[BrowserTypeOptions, None]("browser.Type")
	BrowserPress      = define[BrowserPressOptions, BrowserPageInfo]("browser.Press")
	BrowserScreenshot = define[BrowserScreenshotOptions, string]("browser.Screenshot")
	BrowserNavigate   = define[BrowserOpenOptions, BrowserHandle]("browser.Navigate")
	BrowserReload     = define[SessionIDOptions, None]("browser.Reload")
	BrowserBack       = define[SessionIDOptions, None]("browser.Back")
	BrowserForward    = define[SessionIDOptions, None]("browser.Forward")
	BrowserScroll     = define[BrowserScrollOptions, None]("browser.Scroll")
	BrowserList       = define[SessionIDOptions, []BrowserHandle]("browser.List")
	BrowserClose      = define[SessionIDOptions, None]("browser.Close")

	// BrowserEval runs the agent's script in the page and answers with its
	// value: a string as it is, anything else as JSON.
	BrowserEval = define[BrowserEvalOptions, string]("browser.Eval")

	// BrowserTabs lists the browser's tabs; BrowserTabAction is the agent
	// opening, selecting or closing one, answered with the page then in front.
	BrowserTabs      = define[SessionIDOptions, []BrowserTab]("browser.Tabs")
	BrowserTabAction = define[BrowserTabOptions, BrowserPageInfo]("browser.TabAction")
	// BrowserAnswerDialog answers the JavaScript dialog the page holds open,
	// and answers with the page as it stands after it.
	BrowserAnswerDialog = define[BrowserDialogOptions, BrowserPageInfo]("browser.AnswerDialog")

	// The window's side: a pane that shows a session's page and passes the
	// person's input to it, beside the agent driving the same page.
	BrowserRunning = define[None, []BrowserState]("browser.Running")
	BrowserAttach  = define[BrowserViewOptions, BrowserHandle]("browser.Attach")
	BrowserDetach  = define[SessionIDOptions, None]("browser.Detach")
	BrowserResize  = define[BrowserViewOptions, None]("browser.Resize")
	// BrowserKeep answers BrowserState.Idle with keep: the browser stays and
	// is asked about again after another idle window. browser.Close answers
	// it with close.
	BrowserKeep = define[SessionIDOptions, None]("browser.Keep")
	// BrowserDefaultView is the window's size, which a page no pane shows
	// lays out at.
	BrowserDefaultView = define[BrowserDefaultViewOptions, None]("browser.DefaultView")
	// BrowserNewTabPage is the window handing over what the new-tab page is
	// drawn with: its theme and its words, the only ones that know them.
	BrowserNewTabPage = define[BrowserNewTabPageOptions, None]("browser.NewTabPage")
	BrowserMouse      = define[BrowserMouseOptions, None]("browser.Mouse")
	BrowserKey        = define[BrowserKeyOptions, None]("browser.Key")
	BrowserText       = define[BrowserTextOptions, None]("browser.Text")
	BrowserNav        = define[BrowserNavOptions, None]("browser.Nav")
	// BrowserTabNav is the person opening, selecting or closing a tab in the
	// pane, the window's side of BrowserTabAction.
	BrowserTabNav = define[BrowserTabOptions, None]("browser.TabNav")
	// BrowserNativeLoad is a main-frame load event of the page the window
	// draws itself in place of the screencast, for the session's front tab.
	BrowserNativeLoad = define[BrowserNativeLoadOptions, None]("browser.NativeLoad")
	// BrowserIcon is the PNG a BrowserTab's Icon names.
	BrowserIcon = define[BrowserIconOptions, []byte]("browser.Icon")
	// BrowserDevTools is the person opening Chrome's DevTools for the front
	// tab in the pane, as a tab of its own, or selecting it when it is open.
	// The agent never sees that tab.
	BrowserDevTools = define[SessionIDOptions, None]("browser.DevTools")
	// BrowserAnswer is the person answering the page's open dialog in the
	// pane, the window's side of BrowserAnswerDialog.
	BrowserAnswer = define[BrowserDialogOptions, None]("browser.Answer")
	// BrowserSelection is the text selected in the page, which the pane
	// copies to the system clipboard: the headless browser's own clipboard
	// is not the person's.
	BrowserSelection = define[SessionIDOptions, string]("browser.Selection")
	// BrowserElementAt is the element under a point of the page, for a note
	// the person leaves on it; BrowserLocate is where noted elements stand
	// now, after the page scrolled or changed.
	BrowserElementAt = define[BrowserPointOptions, BrowserElement]("browser.ElementAt")
	BrowserLocate    = define[BrowserLocateOptions, []BrowserRect]("browser.Locate")
)
View Source
var (
	// BrowserStateEvent is emitted whenever a session's browser starts, closes,
	// moves to a window or loads another page, so the one store the window
	// keeps of them stays true.
	BrowserStateEvent = defineEvent[BrowserState]("browser-state")

	// BrowserFrameEvents carries a base64 JPEG of a session's page while a pane
	// shows it, and a PNG once the page is still: per session, like terminal
	// output, so only that pane listens.
	BrowserFrameEvents = defineEventFamily[BrowserFrame]("browser:frame:")

	// BrowserAgentEvent is emitted each time the agent acts on its page, so the
	// pane can show that the page moved because of it, and where it clicked.
	BrowserAgentEvent = defineEvent[BrowserAgentAct]("browser-agent")

	// BrowserDownloadEvent is emitted when a file a session's page downloaded
	// is complete on disk, so the person learns where it went.
	BrowserDownloadEvent = defineEvent[BrowserDownload]("browser-download")
)
View Source
var (
	// ChatKinds is the providers whose sessions can be drawn as a chat.
	ChatKinds = define[None, []string]("chat.Kinds")
	// ChatSetView switches a session between its terminal and its chat. It
	// refuses while the agent is working.
	ChatSetView = define[ChatViewOptions, None]("chat.SetView")
	// ChatHistory is a chat session's conversation so far, for a window that
	// opens on it.
	ChatHistory = define[SessionIDOptions, []ChatItem]("chat.History")
	// ChatPrompt sends the person's message.
	ChatPrompt = define[ChatPromptOptions, None]("chat.Prompt")
	// ChatSteer sends the person's message into the turn in flight, which
	// carries on with it; with no turn in flight it is ChatPrompt. A provider
	// that takes no message during a turn stops it and sends the message
	// after.
	ChatSteer = define[ChatPromptOptions, None]("chat.Steer")
	// ChatCancel stops the turn in flight.
	ChatCancel = define[SessionIDOptions, None]("chat.Cancel")
	// ChatAnswer answers a permission item with one of its options.
	ChatAnswer = define[ChatAnswerOptions, None]("chat.Answer")
	// ChatReply answers a question item, or declines it.
	ChatReply = define[ChatReplyOptions, None]("chat.Reply")
	// ChatOptions is what a chat session can be set to now: its model, its
	// effort and its mode, each as the provider offers them.
	ChatOptions = define[SessionIDOptions, []ChatOption]("chat.Options")
	// ChatSetOption sets one of them. A value the provider only takes at spawn
	// is applied by resuming the conversation once the agent is idle; while a
	// turn runs it is refused.
	ChatSetOption = define[ChatSetOptionOptions, None]("chat.SetOption")
	// ChatCommands is what a chat session's provider takes typed at its
	// prompt, its slash commands and skills, as it lists them; none until it
	// has.
	ChatCommands = define[SessionIDOptions, []ChatCommand]("chat.Commands")
	// ChatRunShell runs a command the person typed after "!" the way the
	// provider's own TUI does, with no model and no permission check; a
	// provider whose protocol has no such way refuses it.
	ChatRunShell = define[ChatRunShellOptions, None]("chat.RunShell")
	// ChatNew starts an empty conversation in a chat session, the one it had
	// left to the provider. It refuses while the agent works.
	ChatNew = define[SessionIDOptions, None]("chat.New")

	// ChatItemEvent carries one item of a chat, whole, each time it changes:
	// the window replaces the item with the same id, or appends a new one.
	ChatItemEvent = defineEvent[ChatItemUpdate]("chat-item")
	// ChatTurnEvent carries a chat session's turn starting and ending.
	ChatTurnEvent = defineEvent[ChatTurn]("chat-turn")
	// ChatOptionsEvent carries a chat session's options whole, each time one
	// changes, whoever changed it.
	ChatOptionsEvent = defineEvent[ChatOptionsUpdate]("chat-options")
	// ChatCommandsEvent carries a chat session's commands whole, each time
	// the provider lists them anew.
	ChatCommandsEvent = defineEvent[ChatCommandsUpdate]("chat-commands")
	// ChatSuggestionEvent carries what the person is likely to type next, once
	// a turn they opened ends; an empty Text, sent as the next turn starts,
	// clears it.
	ChatSuggestionEvent = defineEvent[ChatSuggestion]("chat-suggestion")
	// SessionViewEvent carries a session's view once the switch is done: the
	// new process is up, not merely asked for. A chat resumed in a new process
	// for an option sends it too, and its history is read again.
	SessionViewEvent = defineEvent[SessionView]("session-view")
)
View Source
var (
	// ChatMemory is the instruction files a chat session loads, its saved
	// memories and its memory settings. A provider that reports none leaves
	// Reported false.
	ChatMemory = define[SessionIDOptions, ChatMemoryList]("chat.Memory")
	// ChatSetMemory turns one of the memory settings on or off.
	ChatSetMemory = define[ChatSetMemoryOptions, None]("chat.SetMemory")
	// ChatCreateMemory creates, empty, an instruction file the list names
	// as missing.
	ChatCreateMemory = define[ChatPathOptions, None]("chat.CreateMemory")
	// ChatAgents is the subagents a chat session can hand work to. A
	// provider that reports none leaves Reported false.
	ChatAgents = define[SessionIDOptions, ChatAgentList]("chat.Agents")
	// ChatNewAgent writes a new subagent's file, which the person then
	// writes the prompt of.
	ChatNewAgent = define[ChatNewAgentOptions, ChatNewAgentResult]("chat.NewAgent")
)
View Source
var (
	// ChatPermissions is a chat session's permission rules and the folders
	// it may work in. A provider that reports none leaves Reported false.
	ChatPermissions = define[SessionIDOptions, ChatPermissionList]("chat.Permissions")
	// ChatPermissionAct adds a rule to a settings file or removes one from
	// it; the running chat applies it before the call answers.
	ChatPermissionAct = define[ChatPermissionActOptions, ChatPermissionActResult]("chat.PermissionAct")
	// ChatHooks is a chat session's hooks. A provider that reports none
	// leaves Reported false.
	ChatHooks = define[SessionIDOptions, ChatHookList]("chat.Hooks")
	// ChatHookAct trusts a hook or turns it on or off.
	ChatHookAct = define[ChatHookActOptions, None]("chat.HookAct")
)
View Source
var (
	// ChatPlugins is a chat session's plugins, installed and on offer, and its
	// marketplaces. A provider that reports none leaves Reported false.
	ChatPlugins = define[SessionIDOptions, ChatPluginList]("chat.Plugins")
	// ChatPluginAct acts on one plugin or marketplace: installs, uninstalls,
	// turns on or off or updates a plugin, adds, updates or removes a
	// marketplace.
	ChatPluginAct = define[ChatPluginActOptions, ChatPluginActResult]("chat.PluginAct")
)
View Source
var (
	// ChatShells is a chat session's background shells, running and ended,
	// in the order they started. A provider that reports none has none.
	ChatShells = define[SessionIDOptions, []ChatShell]("chat.Shells")
	// ChatShellOutput is the end of one shell's output so far, plain text.
	ChatShellOutput = define[ChatShellOptions, string]("chat.ShellOutput")
	// ChatStopShell stops one shell that runs.
	ChatStopShell = define[ChatShellOptions, None]("chat.StopShell")
	// ChatBackground moves the commands the turn waits on to the background,
	// as Ctrl+B does in Claude Code's TUI: each call returns and the turn
	// carries on, the command a shell from then on.
	ChatBackground = define[SessionIDOptions, None]("chat.Background")

	// ChatShellsEvent carries a chat session's shells whole, each time one
	// starts or ends.
	ChatShellsEvent = defineEvent[ChatShellsUpdate]("chat-shells")
)
View Source
var (
	// ChatMCP is a chat session's MCP servers as its provider reports them
	// now. A provider that reports none leaves Reported false.
	ChatMCP = define[SessionIDOptions, ChatMCPList]("chat.MCP")
	// ChatMCPAct acts on one of them: turns it on or off in the session's
	// project, reconnects it, or signs in to it. Signing in answers the page
	// the person opens to finish it.
	ChatMCPAct = define[ChatMCPActOptions, ChatMCPActResult]("chat.MCPAct")
	// ChatSkills is a chat session's skills as its provider reports them now.
	// A provider that reports none leaves Reported false.
	ChatSkills = define[SessionIDOptions, ChatSkillList]("chat.Skills")
	// ChatSetSkill turns one of them on or off.
	ChatSetSkill = define[ChatSetSkillOptions, None]("chat.SetSkill")
)
View Source
var (
	// ChatWorkflows is a chat session's workflows, running and ended, in the
	// order they started. A provider that reports none has none.
	ChatWorkflows = define[SessionIDOptions, []ChatWorkflow]("chat.Workflows")

	// ChatWorkflowsEvent carries a chat session's workflows whole, each time
	// one of them or one of its agents moves.
	ChatWorkflowsEvent = defineEvent[ChatWorkflowsUpdate]("chat-workflows")
)
View Source
var (
	// SessionStatusEvent carries a session's processing state ({id, state, tool,
	// detail, reason, program} — "busy"/"done"/"waiting"/"idle"/"compacting", plus the tool
	// a pre-tool report names and what a waiting one is blocked on), reported by
	// the lich hooks running inside the PTY (see transport.hook and
	// docs/hooks/session-state.md). "interrupted" is the one value lich raises
	// itself, for a turn the user stopped at the PTY. The window keeps it in a
	// store keyed by id (statusStore, native/cmd/lich- native/status.go).
	SessionStatusEvent = defineEvent[SessionStatus]("session-status")

	// SessionUsageEvent carries a session's context-window usage ({id, percent,
	// tokens}), emitted after a turn ends. Global like the other session events.
	SessionUsageEvent = defineEvent[SessionUsage]("session-usage")

	// SessionTitleEvent carries a session's new name ({id, label}), so every card
	// takes it without a reload: the auto-applied ai-title, and a rename the store
	// has written, whoever asked (the window, `lich rename` or the MCP tool). One
	// event for both because the payload is the same pair and the window's answer
	// to both is the same: relabel that card.
	SessionTitleEvent = defineEvent[SessionTitle]("session-title")

	// SessionTouchedEvent carries the id of a session that likely changed files on
	// disk, nudging an immediate git-status refresh ahead of the steady poll.
	SessionTouchedEvent = defineEvent[SessionTouched]("session-touched")

	// SessionAgentEvent carries which provider CLI is live inside a session's PTY
	// ({id, agent}) — reported through the session-start hook by whichever
	// provider ships it, so a shell card shows that provider's mark while its CLI
	// runs in it. An empty agent clears the mark; every PTY spawn emits that clear
	// so a respawned session never wears a dead agent's icon.
	SessionAgentEvent = defineEvent[SessionAgent]("session-agent")

	// SessionConversationEvent carries the provider conversation a session's row
	// now names ({id, providerSessionId}, "" once it names none), emitted after
	// the row is written: the window offers that conversation back when the
	// session's process exits.
	SessionConversationEvent = defineEvent[SessionConversation]("session-conversation")

	// SessionSandboxEvent carries whether a session's PTY runs confined ({id,
	// confined, skippedLinks}), emitted by every spawn. The card marks a confined
	// session, and the answer is the spawn's own — it takes the provider's rung,
	// the checkout and a per-session override to reach, so the window is told
	// rather than asked to work it out again. skippedLinks is what that sandbox
	// left out of the private home for being a symlink, which is the one absence a
	// session has no other way of learning about. Both persisted with the row
	// (store.Session's Sandbox and SandboxSkippedLinks), which is what a reopened
	// window hydrates from.
	SessionSandboxEvent = defineEvent[SessionSandbox]("session-sandbox")

	// SessionMCPEvent carries the MCP servers a session's provider could reach at
	// its spawn ({id, servers}), emitted by every spawn. The card divides a tool
	// name against them — two harnesses spell an MCP tool with a single underscore
	// between the server and the tool, which nothing in the string divides
	// (docs/hooks/session-state.md). Persisted with the row too (store.Session's
	// MCPServers), which is what a reopened window hydrates from: the PTY outlives
	// the window, so there is no second spawn to report it again.
	SessionMCPEvent = defineEvent[SessionMCP]("session-mcp")

	// SessionDuplicateEvent carries a session that just reported a conversation
	// another open card already runs ({id, heldBy}): a resume typed in the
	// provider's own TUI, which lich cannot stop, only point out. Emitted once the
	// report is stored, so the window can offer to switch to heldBy.
	SessionDuplicateEvent = defineEvent[SessionDuplicate]("session-duplicate")

	// SessionCwdEvent carries a session's live working directory ({id, cwd,
	// host}), emitted once with the directory the PTY starts in and again whenever
	// the child process moves (the user runs `cd`). A non-empty host names a
	// foreground process the directory cannot be read through (see shellHosts) and
	// comes with an empty cwd: the session is somewhere, but not somewhere this
	// machine can name. Global like the other session events.
	SessionCwdEvent = defineEvent[SessionCwd]("session-cwd")

	// SessionLimitEvent carries a turn a plan's usage limit ended ({id, window,
	// resetsAt}). Nothing clears it; the window reads plan quota again when it
	// arrives (planQuota, native/cmd/lich-native/footer_quota.go).
	SessionLimitEvent = defineEvent[SessionLimit]("session-limit")

	// SessionProfileOfferEvent carries another profile that could take a session:
	// one with quota left after a usage limit, or one the agent handing off to it
	// suggested. Nothing moves unless the person answers with
	// TerminalTakeProfileOffer.
	SessionProfileOfferEvent = defineEvent[SessionProfileOffer]("session-profile-offer")

	// SessionProfileEvent carries the profile a session moved to: Continue in, or
	// a resume that found its conversation in another profile.
	SessionProfileEvent = defineEvent[SessionProfile]("session-profile")

	// SessionTodoEvent carries how far a session got through the task list its
	// agent wrote for itself ({id, done, total}), emitted whenever that pair
	// changes. Global like the other session events.
	//
	// The pair is what the agent last wrote, not what is true: an agent that
	// abandons a list without closing its items leaves the card reporting the
	// count it was abandoned at, until it writes another one.
	SessionTodoEvent = defineEvent[SessionTodo]("session-todo")

	// PluginIncompatibleEvent carries a session whose hooks report from a plugin
	// release outside the range this lich speaks ({id, version}). The window
	// answers it by asking for the plugin status again, which is where the fix is
	// offered: an install moved by the harness's own marketplace shows up here
	// first.
	PluginIncompatibleEvent = defineEvent[PluginIncompatible]("plugin-incompatible")

	// TerminalDataEvents carries base64-encoded PTY output. Output is
	// base64-encoded because raw PTY bytes may split a multi-byte UTF-8 sequence
	// mid-read, which the JSON event bridge would otherwise corrupt.
	TerminalDataEvents = defineEventFamily[string]("terminal:data:")

	// TerminalExitEvents is emitted once when a session's shell process exits,
	// carrying the status it exited with (see SessionExit).
	TerminalExitEvents = defineEventFamily[SessionExit]("terminal:exit:")

	// SessionFocusEvent asks the window to open a session's card, the way a click
	// on it does. Global like the other session events: the card it names may live
	// in a project whose tab is not the one on screen.
	SessionFocusEvent = defineEvent[SessionFocus]("session-focus")

	// SessionInboxEvent carries how many uncollected results a session has
	// waiting, so its card can say so — the nudge tells the agent, and this tells
	// the person. Emitted whenever a sender's inbox changes size; zero clears the
	// mark. Global for the same reason the relay event is.
	SessionInboxEvent = defineEvent[SessionInbox]("session-inbox")

	// SessionScheduleEvent is emitted when a session's scheduled prompt changes
	// without the window having written it: delivered, or parked and dropped by
	// lich itself around a usage limit (resume.go). Payload: SessionSchedule.
	SessionScheduleEvent = defineEvent[SessionSchedule]("session-schedule")

	// SessionScheduleByEvent follows a SessionScheduleEvent that says who set
	// the prompt. Payload: SessionScheduleBy.
	SessionScheduleByEvent = defineEvent[SessionScheduleBy]("session-schedule-by")

	// SessionWatchEvent is emitted when a session's watch is armed, fires or
	// stops. Payload: SessionWatchChange.
	SessionWatchEvent = defineEvent[SessionWatchChange]("session-watch")

	// SessionWatchStoppedEvent is emitted when a watch reached its run limit on
	// one pull request and disarmed. Payload: SessionWatchStopped.
	SessionWatchStoppedEvent = defineEvent[SessionWatchStopped]("session-watch-stopped")

	// SessionRelayEvent carries which session is waiting on which, so the sidebar
	// can say it. Global rather than per-session because its consumer — one store
	// keyed by id — outlives any one card, exactly as the status event's does.
	SessionRelayEvent = defineEvent[SessionRelay]("session-relay")

	// RelayStalledEvent carries a request whose target ended its turn without
	// answering through lich. The window turns it into a toast that opens the
	// target's card, because the answer — if there is one — is on that screen and
	// the person who asked has no other way to know where it went.
	RelayStalledEvent = defineEvent[RelayStalled]("session-relay-stalled")

	// SessionOpenedEvent carries a session opened outside the window, so the card
	// appears without a reload. Global, like every other session event: its
	// consumer is the workspace state, which outlives any one card.
	SessionOpenedEvent = defineEvent[OpenedSession]("session-opened")

	// SessionClosedEvent carries a session closed outside the window, so the card
	// goes away without a reload. Its payload is SessionClosed.
	SessionClosedEvent = defineEvent[SessionClosed]("session-closed")

	// SessionsFiledEvent carries sessions whose folder changed outside the window,
	// so their cards move into or out of the folder's block without a reload. One
	// event for a card filed and for a folder renamed, because the window's answer
	// to both is the same: set these cards' folder.
	SessionsFiledEvent = defineEvent[SessionsFiled]("sessions-filed")

	// SessionsColoredEvent carries sessions painted outside the window, so their
	// cards take the colour without a reload.
	SessionsColoredEvent = defineEvent[SessionsColored]("sessions-colored")

	// ProjectOpenedEvent carries a project opened outside the window — an agent
	// naming a directory rather than a project already on screen — so its tab
	// appears without a reload. Its payload is the whole Project, sessions
	// included: a reopened project brings back the cards it was closed with, and
	// the session this open is about to announce lands in a tab the window has to
	// be holding already.
	ProjectOpenedEvent = defineEvent[Project]("project-opened")

	// ProjectAddedEvent is emitted once AddProject has committed: a project opened
	// new, reopened from the history, or reopened at the directory it moved to —
	// the same id under another path is how a relocate reaches the store. Payload:
	// ProjectAdded. It is not project-opened, which an agent's open announces with
	// the whole project and which the web workspace adds a tab from; this one only
	// says the row changed, and the window reads it back.
	ProjectAddedEvent = defineEvent[ProjectAdded]("project-added")

	// ProjectClosedEvent is emitted once CloseProject has marked a project closed,
	// whoever asked: the window's own tab, an agent, the CLI. Payload:
	// ProjectClosed.
	ProjectClosedEvent = defineEvent[ProjectClosed]("project-closed")

	// ProjectsReorderedEvent is emitted once ReorderProjects has written the tab
	// order. Payload: ProjectsReordered.
	ProjectsReorderedEvent = defineEvent[ProjectsReordered]("projects-reordered")

	// ScheduleForfeitedEvent is emitted when a scheduled prompt was lost with the
	// session it was parked on, so the person who parked it is told rather than
	// left to find out at a time that never comes. Payload: ScheduleForfeited.
	ScheduleForfeitedEvent = defineEvent[ScheduleForfeited]("session-schedule-forfeited")

	// ClaudeProfileLoginEvent is the event a login reports its progress on.
	ClaudeProfileLoginEvent = defineEvent[ProfileLogin]("claude-profile-login")

	// CodexProfileLoginEvent is the event a login reports its progress on.
	CodexProfileLoginEvent = defineEvent[ProfileLogin]("codex-profile-login")

	// ProviderInstallEvent is the event an install ProvidersInstall started
	// reports its progress on, the last one with Done set.
	ProviderInstallEvent = defineEvent[ProviderInstall]("provider-install")

	// ProfileChangedEvent is the event a profile's update emits once it is
	// written: its name, color or image changed.
	ProfileChangedEvent = defineEvent[ProfileChanged]("profile-changed")

	// PluginProfilesEvent is the event a pass over a provider's profiles reports
	// on, once it has installed into at least one.
	PluginProfilesEvent = defineEvent[PluginProfiles]("lich-plugin-profiles")

	// AppUpdateProgressEvent is the hub event Apply's phases ride on, for the
	// toast.
	AppUpdateProgressEvent = defineEvent[AppUpdateProgress]("appupdate-progress")

	// ThemeSelectionEvent is pushed on /events with a ThemeSelection once a change
	// to it is stored.
	ThemeSelectionEvent = defineEvent[ThemeSelection]("theme-selection")

	// ThemeUpdatesEvent is pushed on /events once the newer versions known for
	// the installed theme packs changed: a check found or lost one, or an
	// update installed one. Theme.Latest carries them.
	ThemeUpdatesEvent = defineEvent[None]("theme-updates")

	// ThemeCatalogEvent carries the theme catalog once the backend holds a copy
	// newer than the one it last sent.
	ThemeCatalogEvent = defineEvent[ThemeCatalog]("theme-catalog")

	// PullRequestChangedEvent is what a pull request write through lich reports
	// once GitHub took it, so every window's pull request store reads it again
	// instead of the screen that made the change telling the others.
	PullRequestChangedEvent = defineEvent[PRChanged]("pull-request-changed")

	// BranchPullRequestEvent is every read of a checkout's branch pull request,
	// changed or not: the backend is the one reader of it, and a window that
	// asked for a recheck hears its answer here.
	BranchPullRequestEvent = defineEvent[BranchPullRequest]("branch-pull-request")

	// ForgeEvent is a checkout's forge once the backend's answer for it
	// changes: a host glab signs in to later turns a checkout GitLab, and
	// nothing else would tell the window.
	ForgeEvent = defineEvent[ForgeChange]("forge")

	// ServicesEvent carries every project service and its state, emitted once a
	// change to either is true: a save, a delete, a start, an exit.
	ServicesEvent = defineEvent[[]Service]("services")

	// ServiceRevealEvent asks the window to open a service's console, which the
	// tray's Show output does from outside it.
	ServiceRevealEvent = defineEvent[ServiceIDOptions]("service-reveal")

	// ExtensionStatusEvent carries an extension once its state has changed.
	ExtensionStatusEvent = defineEvent[Extension]("extension-status")

	// ExtensionUpdateEvent carries what a look for a newer release of an
	// extension found, once that differs from what the window was last told.
	ExtensionUpdateEvent = defineEvent[ExtensionUpdate]("extension-update")

	// ExtensionRemovedEvent names an extension once its directory is gone, for
	// the window to drop it.
	ExtensionRemovedEvent = defineEvent[ExtensionIDOptions]("extension-removed")

	// ExtensionCatalogEvent carries the lich catalog once the backend holds a
	// copy that differs from the one before.
	ExtensionCatalogEvent = defineEvent[ExtensionCatalog]("extension-catalog")

	// ExtensionMessageEvent carries a line an extension wrote, after lich
	// accepted it. With no window attached it is dropped, like every event.
	ExtensionMessageEvent = defineEvent[ExtensionMessage]("extension-message")

	// SubagentVetoEvent carries a tool call /subagent answered deny, once the
	// answer was written, for the asker's chat to draw it as opened.
	SubagentVetoEvent = defineEvent[SubagentVeto]("subagent-veto")

	// CodexHookUntrustedEvent tells the window Codex is skipping lich-plugin's
	// PreToolUse hook, read from a Codex chat's hooks/list once per run.
	CodexHookUntrustedEvent = defineEvent[CodexHookUntrusted]("codex-hook-untrusted")

	// WindowCloseEvent asks the native window to close, lich quitting.
	WindowCloseEvent = defineEvent[None]("window-close")

	// WindowRaiseEvent asks the native window to come forward.
	WindowRaiseEvent = defineEvent[None]("window-raise")
)
View Source
var (
	ExtensionsList = define[None, []Extension]("extensions.List")
	ExtensionsSend = define[ExtensionSendOptions, None]("extensions.Send")
	// ExtensionsRestart starts an extension again, the one way back from failed.
	ExtensionsRestart = define[ExtensionIDOptions, None]("extensions.Restart")
	// ExtensionsDir is the directory lich reads extensions from.
	ExtensionsDir = define[None, string]("extensions.Dir")
	// ExtensionsPrepareFromGit downloads the latest release of a GitHub
	// repository's extension, checks and stages it, and returns what it is;
	// nothing runs until CommitInstall.
	ExtensionsPrepareFromGit = define[ExtensionGitInstallOptions, ExtensionInstallPreview]("extensions.PrepareFromGit")
	// ExtensionsPrepareFromDir stages a copy of a folder on disk holding an
	// extension, as PrepareFromGit does.
	ExtensionsPrepareFromDir = define[ExtensionDirInstallOptions, ExtensionInstallPreview]("extensions.PrepareFromDir")
	// ExtensionsCommitInstall moves a staged extension into place and starts it.
	// A token commits once.
	ExtensionsCommitInstall = define[ExtensionInstallTokenOptions, Extension]("extensions.CommitInstall")
	// ExtensionsDiscardInstall deletes a staged extension.
	ExtensionsDiscardInstall = define[ExtensionInstallTokenOptions, None]("extensions.DiscardInstall")
	// ExtensionsCheckUpdates looks for a newer release of every extension
	// installed from GitHub and answers with the list as it then stands; what
	// changed also arrives as ExtensionUpdateEvent.
	ExtensionsCheckUpdates = define[None, []Extension]("extensions.CheckUpdates")
	// ExtensionsPrepareUpdate stages the latest release of an installed
	// extension's repository, as PrepareFromGit does; CommitInstall then puts
	// it in place of the installed version, which runs until then.
	ExtensionsPrepareUpdate = define[ExtensionIDOptions, ExtensionInstallPreview]("extensions.PrepareUpdate")
	// ExtensionsRemove stops an extension and deletes its directory. Its data
	// directory is kept.
	ExtensionsRemove = define[ExtensionIDOptions, None]("extensions.Remove")
	// ExtensionsDeleteData deletes the data directory of an extension that is
	// not installed, and refuses one that is.
	ExtensionsDeleteData = define[ExtensionIDOptions, None]("extensions.DeleteData")
	// ExtensionsCatalog is the lich catalog the backend holds, read first when
	// it holds none: it fails only when it has no copy and cannot read one. A
	// copy read later arrives as ExtensionCatalogEvent.
	ExtensionsCatalog = define[None, ExtensionCatalog]("extensions.Catalog")
	// ExtensionsCatalogImage reads an icon, cover or screenshot the catalog
	// held names, and nothing else.
	ExtensionsCatalogImage = define[ExtensionCatalogImageOptions, []byte]("extensions.CatalogImage")
)
View Source
var (
	ProjectGitLog        = define[GitLogOptions, GitLogPage]("project.GitLog")
	ProjectGitAuthors    = define[GitAuthorsOptions, []string]("project.GitAuthors")
	ProjectGitRefs       = define[PathOptions, GitRefs]("project.GitRefs")
	ProjectGitCommit     = define[GitCommitOptions, GitCommitDetail]("project.GitCommit")
	ProjectGitCommitDiff = define[GitCommitDiffOptions, string]("project.GitCommitDiff")

	ProjectGitCheckout     = define[GitCheckoutOptions, None]("project.GitCheckout")
	ProjectGitCreateBranch = define[GitCreateBranchOptions, None]("project.GitCreateBranch")
	ProjectGitRenameBranch = define[GitRenameBranchOptions, None]("project.GitRenameBranch")
	ProjectGitBranchOnly   = define[GitBranchOptions, int]("project.GitBranchOnly")
	ProjectGitDeleteBranch = define[GitBranchOptions, GitDeletedBranch]("project.GitDeleteBranch")

	ProjectGitMergePreview = define[GitMergeOptions, GitMergePreview]("project.GitMergePreview")
	ProjectGitMerge        = define[GitMergeOptions, GitMergeResult]("project.GitMerge")
	ProjectGitMergeUndo    = define[GitMergeUndoOptions, None]("project.GitMergeUndo")
	ProjectGitConflict     = define[CheckoutFileOptions, GitConflict]("project.GitConflict")
	ProjectGitResolveFile  = define[GitResolveFileOptions, None]("project.GitResolveFile")
	ProjectGitBlame        = define[CheckoutFileOptions, GitBlame]("project.GitBlame")
	ProjectGitMergeAbort   = define[PathOptions, None]("project.GitMergeAbort")
	ProjectGitMergeCommit  = define[PathOptions, None]("project.GitMergeCommit")
	ProjectGitMarkResolved = define[CheckoutFileOptions, None]("project.GitMarkResolved")
)
View Source
var (
	ClaudeProfiles         = profileMethods("claudeprofile")
	ClaudeProfileLogin     = profileLoginMethods("claudeprofile")
	ClaudeProfilePlugins   = profilePluginMethods("claudeprofile")
	ClaudeProfileLoginCode = define[LoginCodeOptions, None]("claudeprofile.LoginCode")
	CodexProfiles          = profileMethods("codexprofile")
	CodexProfileLogin      = profileLoginMethods("codexprofile")
	CodexProfilePlugins    = profilePluginMethods("codexprofile")
	OMPProfiles            = profileMethods("ompprofile")
	// XDGProfiles are the profile services of the providers whose logins a
	// variable moves (internal/xdgprofile), by provider id.
	XDGProfiles = map[string]ProfileMethods{
		"opencode": profileMethods("opencodeprofile"),
		"cursor":   profileMethods("cursorprofile"),
		"kiro":     profileMethods("kiroprofile"),
	}
)
View Source
var (
	ProjectOpen                     = define[None, *OpenedProject]("project.Open")
	ProjectHome                     = define[None, *OpenedProject]("project.Home")
	ProjectRelocate                 = define[ProjectIDOptions, *OpenedProject]("project.Relocate")
	ProjectExists                   = define[PathOptions, bool]("project.Exists")
	ProjectMissing                  = define[PathsOptions, []string]("project.Missing")
	ProjectPickFile                 = define[PickFileOptions, string]("project.PickFile")
	ProjectPickDirectory            = define[PickFileOptions, string]("project.PickDirectory")
	ProjectPickSaveFile             = define[PickSaveFileOptions, string]("project.PickSaveFile")
	ProjectDiff                     = define[PathOptions, DiffStats]("project.Diff")
	ProjectDiffText                 = define[PathOptions, string]("project.DiffText")
	ProjectBranchesOf               = define[PathsOptions, map[string]string]("project.BranchesOf")
	ProjectBaseStatus               = define[PathOptions, *BaseStatus]("project.BaseStatus")
	ProjectBaseFreshness            = define[PathBranchOptions, BaseFreshness]("project.BaseFreshness")
	ProjectBranchRules              = define[PathBranchOptions, *BranchRules]("project.BranchRules")
	ProjectCommitIdentity           = define[PathOptions, CommitIdentity]("project.CommitIdentity")
	ProjectTree                     = define[PathOptions, FileListing]("project.Tree")
	ProjectSearch                   = define[SearchOptions, SearchResult]("project.Search")
	ProjectReadFile                 = define[CheckoutFileOptions, string]("project.ReadFile")
	ProjectReadFileAt               = define[ReadFileAtOptions, string]("project.ReadFileAt")
	ProjectWriteFile                = define[WriteFileOptions, None]("project.WriteFile")
	ProjectFileLines                = define[FileLinesOptions, []string]("project.FileLines")
	ProjectDiscardFile              = define[CheckoutFileOptions, None]("project.DiscardFile")
	ProjectRevertLines              = define[RevertLinesOptions, RevertResult]("project.RevertLines")
	ProjectRestoreLines             = define[RestoreLinesOptions, None]("project.RestoreLines")
	ProjectCarryUncommitted         = define[CarryUncommittedOptions, None]("project.CarryUncommitted")
	ProjectListBranches             = define[PathOptions, Branches]("project.ListBranches")
	ProjectListCheckouts            = define[PathOptions, []Worktree]("project.ListCheckouts")
	ProjectCreateWorktree           = define[CreateWorktreeOptions, *Worktree]("project.CreateWorktree")
	ProjectCreateWorktreeFromPR     = define[CreateWorktreeFromPROptions, *Worktree]("project.CreateWorktreeFromPR")
	ProjectRemoveWorktree           = define[RemoveWorktreeOptions, None]("project.RemoveWorktree")
	ProjectWorktreeDirty            = define[PathOptions, bool]("project.WorktreeDirty")
	ProjectWorktreeAdopted          = define[PathOptions, bool]("project.WorktreeAdopted")
	ProjectGitHubAccounts           = define[None, []string]("project.GitHubAccounts")
	ProjectGitLabAccounts           = define[None, []string]("project.GitLabAccounts")
	ProjectGlobalCommitIdentity     = define[None, CommitIdentity]("project.GlobalCommitIdentity")
	ProjectSetGlobalCommitIdentity  = define[CommitIdentityOptions, None]("project.SetGlobalCommitIdentity")
	ProjectGitHubAccountOf          = define[PathOptions, GitHubAccountState]("project.GitHubAccountOf")
	ProjectForge                    = define[PathOptions, string]("project.Forge")
	ProjectIssue                    = define[NumberOptions, Issue]("project.Issue")
	ProjectRecheckPullRequest       = define[PathOptions, None]("project.RecheckPullRequest")
	ProjectListPullRequests         = define[ListPullRequestsOptions, []PRSummary]("project.ListPullRequests")
	ProjectPullRequestDetail        = define[NumberOptions, *PRDetail]("project.PullRequestDetail")
	ProjectPullRequestConversation  = define[NumberOptions, *PRConversation]("project.PullRequestConversation")
	ProjectPullRequestAvatar        = define[AvatarOptions, []byte]("project.PullRequestAvatar")
	ProjectPullRequestDiff          = define[NumberOptions, string]("project.PullRequestDiff")
	ProjectPullRequestMergeBase     = define[NumberOptions, string]("project.PullRequestMergeBase")
	ProjectCommitRangeDiff          = define[CommitRangeOptions, CommitRangeDiff]("project.CommitRangeDiff")
	ProjectPullRequestConflicts     = define[PRConflictsOptions, []string]("project.PullRequestConflicts")
	ProjectCreatePullRequest        = define[PathOptions, None]("project.CreatePullRequest")
	ProjectMergePullRequest         = define[MergePullRequestOptions, None]("project.MergePullRequest")
	ProjectEditPullRequestTitle     = define[PRTitleOptions, None]("project.EditPullRequestTitle")
	ProjectEditPullRequestBody      = define[PRBodyOptions, None]("project.EditPullRequestBody")
	ProjectCommentOnPullRequest     = define[PRBodyOptions, None]("project.CommentOnPullRequest")
	ProjectEditPullRequestComment   = define[PRCommentBodyOptions, None]("project.EditPullRequestComment")
	ProjectDeletePullRequestComment = define[PRCommentOptions, None]("project.DeletePullRequestComment")
	ProjectSubmitReview             = define[SubmitReviewOptions, None]("project.SubmitReview")
	ProjectEditReviewBody           = define[PRReviewBodyOptions, None]("project.EditReviewBody")
	ProjectEditReviewComment        = define[PRCommentBodyOptions, None]("project.EditReviewComment")
	ProjectDeleteReviewComment      = define[PRCommentOptions, None]("project.DeleteReviewComment")
	ProjectReplyToReviewThread      = define[PRCommentBodyOptions, None]("project.ReplyToReviewThread")
	ProjectResolveReviewThread      = define[ResolveThreadOptions, None]("project.ResolveReviewThread")
)
View Source
var (
	ProvidersDetect      = define[None, []DetectedProvider]("providers.Detect")
	ProvidersOnPath      = define[ProviderIDOptions, []ProviderBinary]("providers.OnPath")
	ProvidersRefreshPath = define[None, None]("providers.RefreshPath")
	ProvidersVerify      = define[BinaryOptions, BinaryCheck]("providers.Verify")
	ProvidersVersion     = define[BinaryOptions, string]("providers.Version")
	// ProvidersInstall starts installing a provider's CLI and returns once it
	// runs; ProviderInstallEvent carries the rest.
	ProvidersInstall = define[ProviderIDOptions, None]("providers.Install")
	// ProvidersToolInstall is the command that installs a version control
	// tool (git, gh, glab) with the machine's package manager, "" when lich
	// knows none for it.
	ProvidersToolInstall = define[BinaryOptions, string]("providers.ToolInstall")
)
View Source
var (
	QuotaPlans            = define[QuotaPlansOptions, []QuotaPlan]("quota.Plans")
	QuotaProfilePlan      = define[ProfilePlanOptions, QuotaPlan]("quota.ProfilePlan")
	QuotaCodexProfilePlan = define[ProfilePlanOptions, QuotaPlan]("quota.CodexProfilePlan")
	QuotaUseReset         = define[UseResetOptions, UseResetResult]("quota.UseReset")
)
View Source
var (
	RelayPeers         = define[PeersOptions, []Peer]("relay.Peers")
	RelaySelf          = define[SelfOptions, Peer]("relay.Self")
	RelaySend          = define[SendOptions, SendResult]("relay.Send")
	RelaySendPrivate   = define[SendOptions, SendResult]("relay.SendPrivate")
	RelaySendSubagent  = define[SendOptions, SendResult]("relay.SendSubagent")
	RelayWait          = define[WaitOptions, SendResult]("relay.Wait")
	RelayCollect       = define[CollectOptions, CollectedResults]("relay.Collect")
	RelayCollectNow    = define[CollectNowOptions, CollectedResults]("relay.CollectNow")
	RelayReply         = define[ReplyOptions, None]("relay.Reply")
	RelayInsert        = define[InsertTextOptions, InsertedText]("relay.Insert")
	RelayFocus         = define[FocusSessionOptions, FocusedSession]("relay.Focus")
	RelayFocused       = define[None, FocusedSession]("relay.Focused")
	RelaySetShown      = define[ShownSessionOptions, None]("relay.SetShown")
	RelayAnnounceMerge = define[AnnounceMergeOptions, None]("relay.AnnounceMerge")
	RelaySubmit        = define[SubmitOptions, None]("relay.Submit")
	RelayRequest       = define[RequestOptions, None]("relay.Request")
)
View Source
var (
	RelaySetSchedule  = define[SetScheduleOptions, None]("relay.SetSchedule")
	RelayScheduleSelf = define[ScheduleSelfOptions, None]("relay.ScheduleSelf")
)
View Source
var (
	ServicesList       = define[None, []Service]("services.List")
	ServicesSave       = define[SaveServiceOptions, Service]("services.Save")
	ServicesDelete     = define[ServiceIDOptions, None]("services.Delete")
	ServicesStart      = define[ServiceIDOptions, None]("services.Start")
	ServicesStop       = define[ServiceIDOptions, None]("services.Stop")
	ServicesForceStop  = define[ServiceIDOptions, None]("services.ForceStop")
	ServicesRestart    = define[ServiceIDOptions, None]("services.Restart")
	ServicesStartAll   = define[ProjectIDOptions, None]("services.StartAll")
	ServicesStopAll    = define[ProjectIDOptions, None]("services.StopAll")
	ServicesOutput     = define[ServiceIDOptions, []byte]("services.Output")
	ServicesLiveOutput = define[ServiceIDOptions, []byte]("services.LiveOutput")
)
View Source
var (
	ProjectLinkPullRequest     = define[LinkPullRequestOptions, None]("project.LinkPullRequest")
	ProjectUnlinkPullRequest   = define[UnlinkPullRequestOptions, None]("project.UnlinkPullRequest")
	ProjectSessionPullRequests = define[None, []SessionPullRequest]("project.SessionPullRequests")

	// SessionPullRequestsEvent carries every pull request linked to or
	// unlinked from a session by hand, emitted once a link or an unlink is
	// stored and whenever a read of a linked one changes what it holds.
	SessionPullRequestsEvent = defineEvent[[]SessionPullRequest]("session-pull-requests")
)
View Source
var (
	// ProjectShowCode checks a file and lines of session ID's own checkout and
	// asks the window to show them. A confined token may call it for its own
	// session only (internal/scope).
	ProjectShowCode = define[ShowCodeOptions, ShowCode]("project.ShowCode")

	// ShowCodeEvent carries what ProjectShowCode checked. It is global: the
	// session may not be the one on screen, and the window words that itself.
	ShowCodeEvent = defineEvent[ShowCode]("show-code")
)
View Source
var (
	SpawnOpen         = define[OpenSessionOptions, OpenedSession]("spawn.Open")
	SpawnOpenSubagent = define[OpenSubagentOptions, OpenedSession]("spawn.OpenSubagent")
	SpawnHandoff      = define[HandoffSessionOptions, OpenedSession]("spawn.Handoff")
	SpawnClose        = define[CloseSessionOptions, ClosedSession]("spawn.Close")
	SpawnCloseProject = define[CloseProjectOptions, ClosedProject]("spawn.CloseProject")
	SpawnControl      = define[ControlSessionOptions, ControlledSession]("spawn.Control")
	SpawnWorktrees    = define[WorktreesOptions, []WorktreeCheckout]("spawn.Worktrees")
	SpawnFolders      = define[FoldersOptions, []SessionFolder]("spawn.Folders")
	SpawnFile         = define[FileSessionOptions, FiledSession]("spawn.File")
	SpawnRenameFolder = define[RenameFolderOptions, RenamedFolder]("spawn.RenameFolder")
	SpawnColorFolder  = define[ColorFolderOptions, ColoredFolder]("spawn.ColorFolder")
	SpawnRename       = define[RenameSessionOptions, RenamedSession]("spawn.Rename")
	SpawnProject      = define[ProjectRefOptions, ProjectRef]("spawn.Project")
)
View Source
var (
	StoreCostTotals            = define[CostTotalsOptions, CostReport]("store.CostTotals")
	StoreLoadState             = define[None, []Project]("store.LoadState")
	StoreAddProject            = define[AddProjectOptions, None]("store.AddProject")
	StoreCloseProject          = define[ProjectIDOptions, None]("store.CloseProject")
	StoreReorderProjects       = define[ReorderProjectsOptions, None]("store.ReorderProjects")
	StoreRecentProjects        = define[SearchTermOptions, []RecentProject]("store.RecentProjects")
	StoreClosedProjectCount    = define[SearchTermOptions, int]("store.ClosedProjectCount")
	StoreAddSession            = define[AddSessionOptions, None]("store.AddSession")
	StoreAddSessionInFolder    = define[AddSessionInFolderOptions, None]("store.AddSessionInFolder")
	StoreAddSessionFrom        = define[AddSessionFromOptions, None]("store.AddSessionFrom")
	StoreSetActiveSession      = define[ActiveSessionOptions, None]("store.SetActiveSession")
	StoreCloseSession          = define[ParkSessionOptions, None]("store.CloseSession")
	StoreReopenSession         = define[ReopenSessionOptions, *Session]("store.ReopenSession")
	StoreReopenWorktreeSession = define[ReopenWorktreeSessionOptions, *Session]("store.ReopenWorktreeSession")
	StorePurgeWorktreeSessions = define[WorktreeSessionsOptions, None]("store.PurgeWorktreeSessions")
	StoreClosedSessions        = define[ClosedSessionsOptions, ClosedHistory]("store.ClosedSessions")
	StoreExternalSessions      = define[None, []ExternalSession]("store.ExternalSessions")
	StoreAdoptExternalSession  = define[AdoptExternalSessionOptions, None]("store.AdoptExternalSession")
	StoreForgetSession         = define[SessionIDOptions, None]("store.ForgetSession")
	StoreMarkForked            = define[SessionIDOptions, None]("store.MarkForked")
	StoreReorderSessions       = define[ReorderSessionsOptions, None]("store.ReorderSessions")
	StoreRenameSession         = define[LabelSessionOptions, None]("store.RenameSession")
	StoreSetSessionColor       = define[SessionColorOptions, None]("store.SetSessionColor")
	StoreSetSessionFolder      = define[SessionFolderOptions, None]("store.SetSessionFolder")
	StoreSetSessionPinned      = define[SessionPinnedOptions, None]("store.SetSessionPinned")
	StoreSetSessionUnread      = define[SessionUnreadOptions, None]("store.SetSessionUnread")
	StoreRenameFolder          = define[RenameProjectFolderOptions, []string]("store.RenameFolder")
	StoreGetSetting            = define[GetSettingOptions, string]("store.GetSetting")
	StoreSetSetting            = define[SetSettingOptions, None]("store.SetSetting")
)
View Source
var (
	SystemShowWindow         = define[ShowWindowOptions, None]("system.ShowWindow")
	SystemQuit               = define[QuitOptions, None]("system.Quit")
	SystemAttachNative       = define[AttachNativeOptions, None]("system.AttachNative")
	SystemDiagnostics        = define[None, Diagnostics]("system.Diagnostics")
	SystemNotify             = define[NotifyOptions, None]("system.Notify")
	SystemOpenExternal       = define[OpenExternalOptions, None]("system.OpenExternal")
	SystemOpenFile           = define[OpenFileOptions, None]("system.OpenFile")
	SystemOpenFolder         = define[OpenFolderOptions, None]("system.OpenFolder")
	SystemOpenFolderInEditor = define[OpenFolderOptions, string]("system.OpenFolderInEditor")
	SystemRevealLog          = define[None, None]("system.RevealLog")
	SystemSandboxBackend     = define[None, string]("system.SandboxBackend")
	SystemSSHAgentKeys       = define[None, []string]("system.SSHAgentKeys")
	SystemTakeUncleanExit    = define[None, bool]("system.TakeUncleanExit")
	TraySetLabels            = define[TrayLabels, None]("tray.SetLabels")
)
View Source
var (
	TerminalStart             = define[StartOptions, None]("terminal.Start")
	TerminalClose             = define[SessionIDOptions, None]("terminal.Close")
	TerminalWrite             = define[WriteOptions, None]("terminal.Write")
	TerminalResize            = define[ResizeOptions, None]("terminal.Resize")
	TerminalSetVisible        = define[SetVisibleOptions, None]("terminal.SetVisible")
	TerminalReplay            = define[SessionIDOptions, bool]("terminal.Replay")
	TerminalLive              = define[SessionIDOptions, bool]("terminal.Live")
	TerminalLiveCount         = define[None, int]("terminal.LiveCount")
	TerminalReady             = define[SessionIDOptions, bool]("terminal.Ready")
	TerminalHandsOn           = define[SessionIDOptions, int64]("terminal.HandsOn")
	TerminalLastTurnSaid      = define[SessionIDOptions, LastSaid]("terminal.LastTurnSaid")
	TerminalTurnStates        = define[None, []TurnState]("terminal.TurnStates")
	TerminalContinueIn        = define[ContinueInOptions, None]("terminal.ContinueIn")
	TerminalTakeProfileOffer  = define[ContinueInOptions, None]("terminal.TakeProfileOffer")
	TerminalSearchTranscripts = define[SearchTranscriptsOptions, []TranscriptMatch]("terminal.SearchTranscripts")
	TerminalWorkdirMissing    = define[WorkdirOptions, bool]("terminal.WorkdirMissing")
	TerminalResumeAvailable   = define[ResumeAvailableOptions, bool]("terminal.ResumeAvailable")
)
View Source
var (
	ThemesList            = define[None, []Theme]("themes.List")
	ThemesListBroken      = define[None, []BrokenTheme]("themes.ListBroken")
	ThemesImport          = define[ImportThemeOptions, ThemeImportResult]("themes.Import")
	ThemesInstallFromGit  = define[InstallThemesOptions, ThemeGitResult]("themes.InstallFromGit")
	ThemesUpdateFromGit   = define[UpdateThemeOptions, ThemeGitResult]("themes.UpdateFromGit")
	ThemesCheckUpdates    = define[None, None]("themes.CheckUpdates")
	ThemesRemove          = define[RemoveThemeOptions, None]("themes.Remove")
	ThemesSaveTemplate    = define[SaveThemeTemplateOptions, None]("themes.SaveTemplate")
	ThemesSelection       = define[None, ThemeSelection]("themes.Selection")
	ThemesSelect          = define[SelectThemeOptions, None]("themes.Select")
	ThemesSetFollowSystem = define[FollowSystemOptions, None]("themes.SetFollowSystem")
	// ThemesCatalog is the theme catalog the backend holds, read first when it
	// holds none: it fails only when it has no copy and cannot read one. A copy
	// read later arrives as ThemeCatalogEvent.
	ThemesCatalog = define[None, ThemeCatalog]("themes.Catalog")
	// ThemesInstallFromCatalog installs a listed pack at the commit the catalog
	// names, and nothing else.
	ThemesInstallFromCatalog = define[ThemeCatalogInstallOptions, ThemeGitResult]("themes.InstallFromCatalog")
)
View Source
var (
	ProjectAwaitThreadFix  = define[ThreadFixOptions, None]("project.AwaitThreadFix")
	ProjectMarkThreadFixed = define[MarkThreadFixedOptions, None]("project.MarkThreadFixed")
	ProjectThreadFixes     = define[None, []ThreadFix]("project.ThreadFixes")

	// ThreadFixesEvent carries every review thread handed to a session, emitted
	// once one is sent, marked fixed, or stops waiting: resolved by the push of
	// its fix, or dropped with its pull request.
	ThreadFixesEvent = defineEvent[[]ThreadFix]("thread-fixes")
)
View Source
var (
	StoreViewedFiles  = define[ViewedFilesOptions, []ViewedFile]("store.ViewedFiles")
	StoreMarkViewed   = define[MarkViewedOptions, None]("store.MarkViewed")
	StoreUnmarkViewed = define[UnmarkViewedOptions, None]("store.UnmarkViewed")
)
View Source
var DropAttach = define[AttachDropOptions, DropAttachment]("drop.Attach")
View Source
var PatchNotesCurrent = define[PatchNotesOptions, PatchNotes]("patchnotes.Current")
View Source
var ProjectCheckLog = define[CheckLogOptions, CheckLog]("project.CheckLog")

ProjectCheckLog reads the failed checks of the pull request of session ID's own checkout, with the tail of each failed GitHub Actions job's log. A confined token may call it for its own session only (internal/scope).

View Source
var (
	// SubagentVetoed is every call /subagent answered deny that a chat may still
	// draw, for a window that attaches after they were made.
	SubagentVetoed = define[None, []SubagentVeto]("subagent.Vetoed")
)

Functions

func Events

func Events() map[string]DeclaredEvent

Events returns every Event and EventFamily this package declares.

func Methods

func Methods() map[string]Declared

Methods returns every Method this package declares.

func ParseWhen added in v0.87.0

func ParseWhen(raw string, now time.Time) (time.Time, bool)

ParseWhen reads the one form a scheduled time is written in, by the window's field and by `lich schedule --when`: 45m, 2h30, 14:30 or 2026-11-12 14:30. Digits only, so it reads the same in every interface language. A clock that has passed today means tomorrow; a full date in the past is refused.

func TypedURL

func TypedURL(text string) string

TypedURL is what a browser's address field loads for text: a URL or an absolute path as typed, and a bare host (localhost:3000, example.com) over http for a local one and https for any other. The backend serves a path from the session's checkout (internal/preview).

Types

type ActiveSessionOptions

type ActiveSessionOptions struct {
	ProjectID string `json:"projectId"`
	SessionID string `json:"sessionId"`
}

ActiveSessionOptions makes SessionID project ProjectID's active session.

type AddProjectOptions

type AddProjectOptions struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Path string `json:"path"`
}

AddProjectOptions stores a project opened at Path.

type AddSessionFromOptions

type AddSessionFromOptions struct {
	ProjectID   string `json:"projectId"`
	SessionID   string `json:"sessionId"`
	Label       string `json:"label"`
	Kind        string `json:"kind"`
	Path        string `json:"path"`
	NextSeq     int    `json:"nextSeq"`
	OriginID    string `json:"originId"`
	OriginLabel string `json:"originLabel"`
	Folder      string `json:"folder"`
}

AddSessionFromOptions stores a session another session opened: OriginID and OriginLabel name that session.

type AddSessionInFolderOptions

type AddSessionInFolderOptions struct {
	AddSessionOptions
	Folder string `json:"folder"`
}

AddSessionInFolderOptions stores a new session filed under Folder.

type AddSessionOptions

type AddSessionOptions struct {
	ProjectID string `json:"projectId"`
	SessionID string `json:"sessionId"`
	Label     string `json:"label"`
	Kind      string `json:"kind"`
	Path      string `json:"path"`
	NextSeq   int    `json:"nextSeq"`
	Sandbox   string `json:"sandbox"`
}

AddSessionOptions stores a new session of project ProjectID. NextSeq is the project's label counter after it; Sandbox is the answer to the sandbox question, "" to follow the provider's rung.

type AdoptExternalSessionOptions

type AdoptExternalSessionOptions struct {
	ProjectID         string `json:"projectId"`
	SessionID         string `json:"sessionId"`
	Kind              string `json:"kind"`
	Path              string `json:"path"`
	ProviderSessionID string `json:"providerSessionId"`
	Label             string `json:"label"`
}

AdoptExternalSessionOptions files conversation ProviderSessionID as a parked session of project ProjectID under SessionID.

type AnnounceMergeOptions

type AnnounceMergeOptions struct {
	Checkout string `json:"checkout"`
	Number   int    `json:"number"`
	Title    string `json:"title"`
	Branch   string `json:"branch"`
	Base     string `json:"base"`
	// Forge is ForgeGitHub or ForgeGitLab, the words the notice names it in;
	// "" reads as GitHub.
	Forge string `json:"forge,omitempty"`
}

AnnounceMergeOptions is a pull request merged through lich: the checkout its branch was in and what the notice tells the agents working there.

type AppUpdateProgress

type AppUpdateProgress struct {
	Phase    string `json:"phase"`
	Received int64  `json:"received"`
	Total    int64  `json:"total"`
}

AppUpdateProgress is one step of Apply: bytes received of total during the download (total is -1 when the asset came without a Content-Length), then the phase that has no percentage: "installer", where lich hands over to the Windows installer and closes.

type AppUpdateStatus

type AppUpdateStatus struct {
	CurrentVersion  string `json:"currentVersion"`
	LatestVersion   string `json:"latestVersion"`
	UpdateAvailable bool   `json:"updateAvailable"`
	// Required is true when a release newer than the running one, up to the
	// latest, marks itself required: no new agent session opens until lich is
	// updated.
	Required     bool   `json:"required"`
	CanSelfApply bool   `json:"canSelfApply"`
	ReleaseURL   string `json:"releaseUrl"`
	// InstallCommand is the shell command the UI pastes (never auto-runs) to
	// update a package-manager-owned install; empty on the self-apply platforms.
	InstallCommand string `json:"installCommand"`
}

AppUpdateStatus is lich's install/update state, reported to the window.

type Artifact added in v0.88.0

type Artifact struct {
	Name     string `json:"name"`
	Path     string `json:"path"`
	Modified int64  `json:"modified"`
}

Artifact is one page or file an agent left in its session's artifact folder. Name is the entry's own name; Path is the file to open, the folder's index.html for a folder that holds one. Modified is in unix milliseconds.

type AttachArtifactOptions added in v0.88.0

type AttachArtifactOptions struct {
	SessionID string `json:"sessionId"`
	From      string `json:"from"`
	Name      string `json:"name"`
}

AttachArtifactOptions names the artifact Name of session From, for session SessionID: to attach to its prompt, or to open in its browser.

type AttachDropOptions

type AttachDropOptions struct {
	SessionID string `json:"sessionId"`
	Root      string `json:"root"`
	Confined  bool   `json:"confined"`
}

AttachDropOptions asks for a file to attach to a session: SessionID's checkout is Root, and a Confined session reads only what lies inside it.

type AttachNativeOptions

type AttachNativeOptions struct {
	// Executable is the native window's own binary, the one started again when
	// lich is asked for its window after that window closed.
	Executable string `json:"executable"`
}

AttachNativeOptions is the native window announcing itself.

type AvatarOptions added in v0.84.0

type AvatarOptions struct {
	Path string `json:"path"`
	URL  string `json:"url"`
}

AvatarOptions names the picture at URL, an author's Avatar in a conversation read from the checkout at Path.

type BaseFreshness

type BaseFreshness struct {
	Upstream string `json:"upstream"` // "origin/main" form
	Ahead    int    `json:"ahead"`
	Behind   int    `json:"behind"`
	// FetchError is why the fetch failed, "" when it did not. The counts are
	// then against whatever an earlier fetch left.
	FetchError string `json:"fetchError,omitempty"`
}

BaseFreshness is where a local branch stands against its upstream, read right after fetching it: what the new-worktree dialog needs to start a worktree from the newer of the two. Upstream is "" for a branch that tracks nothing on a remote, and every other field is then zero.

type BaseStatus

type BaseStatus struct {
	Base      string   `json:"base"`   // the branch merged into, "origin/main" form
	Behind    int      `json:"behind"` // commits the base has that this checkout does not
	Conflicts []string `json:"conflicts"`
}

BaseStatus is where a checkout stands against the branch it will merge into: how far that branch has moved underneath it, and which files a merge would collide on right now. It is what turns "the merge button refused" into something a parallel worktree knows before anyone clicks it.

type BinaryCheck

type BinaryCheck struct {
	Path   string `json:"path"`
	Status string `json:"status"`
}

BinaryCheck is what a configured binary resolves to. Path is the absolute executable a session would spawn, empty for every status but CheckOK.

func (BinaryCheck) Failed

func (b BinaryCheck) Failed() bool

Failed reports a check to show as a problem.

type BinaryOptions

type BinaryOptions struct {
	Bin string `json:"bin"`
}

BinaryOptions names an executable as a session's spawn would resolve it.

type BranchPullRequest added in v0.79.0

type BranchPullRequest struct {
	Path string       `json:"path"`
	PR   *PullRequest `json:"pr"`
}

BranchPullRequest is one read of the pull request of the branch checked out at Path; PR is nil when the branch has none.

type BranchRules

type BranchRules struct {
	// AllowedMergeMethods is squash|merge|rebase, in GitHub's own spelling.
	// Empty means the branch has no rule about it and all three stand — which
	// is also what a repository with no rulesets at all reports.
	AllowedMergeMethods []string `json:"allowedMergeMethods"`
	// CommitPatterns are the rules that read a commit's own text. Empty is the
	// common case and means only "no rule of this kind", never "nothing blocks".
	CommitPatterns []CommitPattern `json:"commitPatterns"`
	// ViewerCanBypass is whether this account administers the repository, and so
	// may merge past the rules above. It is the one answer here that must fail
	// *closed*: an unreadable one hides an action rather than offering one that
	// cannot work, because a bypass offered to an account that has none reads as
	// a broken button, not as a permission it never had.
	ViewerCanBypass bool `json:"viewerCanBypass"`
}

BranchRules is what a repository's rulesets say about merging into one branch. GitHub's pull request fields do not carry it: `mergeStateStatus` answers whether this merge can happen, never which methods the branch would accept, so a Merge menu built without this offers buttons the ruleset refuses — and gh's refusal arrives after the click, as one flat sentence (gherror.go).

The endpoint answers for a branch, not a pull request, which is why this is its own read: every pull request onto the same base shares one answer.

type Branches

type Branches struct {
	Local     []string   `json:"local"`
	Remote    []string   `json:"remote"` // "origin/main" form
	Worktrees []Worktree `json:"worktrees"`
}

Branches groups everything the base-branch picker offers: local and remote branch names plus already-existing worktrees, so a closed-but-kept worktree can be resumed instead of recreated.

type BrokenTheme

type BrokenTheme struct {
	ID     string `json:"id"`
	Reason string `json:"reason"`
}

BrokenTheme is a stored custom theme this lich cannot load. It is listed rather than dropped, so the user sees why and can remove it by id.

type BrowserAgentAct added in v0.80.0

type BrowserAgentAct struct {
	Owner  string   `json:"owner"`
	Action string   `json:"action,omitempty"`
	X      *float64 `json:"x,omitempty"`
	Y      *float64 `json:"y,omitempty"`
	DY     int      `json:"dy,omitempty"`
	URL    string   `json:"url,omitempty"`
	// Tab is the tab a tab action acted on.
	Tab string `json:"tab,omitempty"`
}

BrowserAgentAct is one agent action on its page. Action is click, type, press or scroll at a point; back, forward, reload or navigate, which the pane's toolbar does; accept or dismiss, the buttons of the pane's dialog card; tab-new, tab-select or tab-close, the header's tabs, with Tab the one it acted on; or "" for one that changes nothing on screen (reading the page, a screenshot). X and Y are where it acted, in CSS pixels, when it acted at a point; DY is a scroll's distance, positive down; URL is where a navigate went.

type BrowserClickOptions added in v0.80.0

type BrowserClickOptions struct {
	ID string `json:"id"`
	BrowserTarget
}

BrowserClickOptions clicks in the session's browser.

type BrowserDefaultViewOptions added in v0.81.0

type BrowserDefaultViewOptions struct {
	W      int     `json:"w"`
	H      int     `json:"h"`
	Scale  float64 `json:"scale"`
	Window float64 `json:"window"`
}

BrowserDefaultViewOptions is the window's size: W and H in CSS pixels, Scale the device pixels per CSS pixel, which is Window, the window's own scale, times the page zoom.

type BrowserDialog added in v0.81.0

type BrowserDialog struct {
	Type    string `json:"type"`
	Message string `json:"message"`
	Default string `json:"default,omitempty"`
	URL     string `json:"url"`
	Answer  string `json:"answer,omitempty"`
}

BrowserDialog is a JavaScript dialog a session's page opened. Type is Chrome's: alert, confirm, prompt or beforeunload. Default is a prompt's default text; URL is the page that opened it. Answer, on one the person answered, is DialogAccepted or DialogDismissed.

type BrowserDialogOptions added in v0.81.0

type BrowserDialogOptions struct {
	ID     string  `json:"id"`
	Accept bool    `json:"accept"`
	Text   *string `json:"text,omitempty"`
}

BrowserDialogOptions answers session ID's open dialog: Accept is OK (Leave on a beforeunload), false is Cancel. Text is what a prompt returns on OK; nil keeps its default text.

type BrowserDownload added in v0.81.0

type BrowserDownload struct {
	Owner string `json:"owner,omitempty"`
	Path  string `json:"path"`
	Bytes int64  `json:"bytes"`
	State string `json:"state"`
}

BrowserDownload is one file a session's page downloaded: Path is where it lands in the user's Downloads folder, under the name it keeps once complete; Bytes is what arrived so far.

type BrowserElement added in v0.81.0

type BrowserElement struct {
	Label     string      `json:"label"`
	Selector  string      `json:"selector"`
	Component string      `json:"component,omitempty"`
	Source    string      `json:"source,omitempty"`
	HTML      string      `json:"html"`
	URL       string      `json:"url"`
	Box       BrowserRect `json:"box"`
}

BrowserElement is the element under a point, as a note on it names it. Label is its tag and text (button "Buy now"), empty when the point holds none; Selector finds it again, in the form browser.Click takes. Component and Source are the React component that drew it and where, when the page is a React development build. HTML is its markup, shortened, with no field's value. URL is the page's, without query or fragment.

type BrowserEvalOptions added in v0.87.0

type BrowserEvalOptions struct {
	ID     string `json:"id"`
	Script string `json:"script"`
}

type BrowserFrame added in v0.90.0

type BrowserFrame struct {
	Tab  string `json:"tab"`
	Data string `json:"data"`
}

BrowserFrame is one screencast frame: Data is the base64 JPEG, Tab the BrowserTab.ID of the tab it is of. Chrome sends no frames for a tab behind another, so the window keeps each tab's last one to show on a switch.

type BrowserHandle added in v0.80.0

type BrowserHandle struct {
	ID        string            `json:"id"`
	URL       string            `json:"url"`
	Title     string            `json:"title"`
	Owner     string            `json:"owner"`
	Headed    bool              `json:"headed"`
	Downloads []BrowserDownload `json:"downloads,omitempty"`
}

BrowserHandle is one session's browser: the id later calls take, and enough for a tool result to say which window it is. Downloads, on an open or a navigate, are what that load downloaded: a URL that answers with a file saves it and leaves the page where it was.

type BrowserIconOptions

type BrowserIconOptions struct {
	Key string `json:"key"`
}

BrowserIconOptions names an icon by a BrowserTab's Icon.

type BrowserInfoOptions added in v0.81.0

type BrowserInfoOptions struct {
	ID       string `json:"id"`
	WaitFor  string `json:"waitFor,omitempty"`
	WaitGone string `json:"waitGone,omitempty"`
	Within   string `json:"within,omitempty"`
}

BrowserInfoOptions reads session ID's page. WaitFor and WaitGone, when set, hold the read until that text is on the page's visible text, or off it (case-sensitive substring, the whole page, not only the viewport). Within, when set, is a CSS selector that limits the page text and the element list to the first element it matches.

type BrowserInteractive added in v0.80.0

type BrowserInteractive struct {
	Index   int         `json:"index"`
	Tag     string      `json:"tag"`
	Type    string      `json:"type,omitempty"`
	Role    string      `json:"role,omitempty"`
	Text    string      `json:"text"`
	Href    string      `json:"href,omitempty"`
	Rect    BrowserRect `json:"rect"`
	Filled  *bool       `json:"filled,omitempty"`
	Checked *bool       `json:"checked,omitempty"`
}

BrowserInteractive is one clickable or fillable node. It never carries a control's value: filled and checked say that typing landed.

type BrowserKeyOptions added in v0.80.0

type BrowserKeyOptions struct {
	ID        string `json:"id"`
	Type      string `json:"type"`
	Key       string `json:"key"`
	Code      string `json:"code,omitempty"`
	KeyCode   int    `json:"keyCode,omitempty"`
	Modifiers int    `json:"modifiers,omitempty"`
}

BrowserKeyOptions is one key going down or up, for keys that do not type text (Enter, arrows, shortcuts): text goes through BrowserText. Key and Code are the DOM's KeyboardEvent.key and .code; Modifiers is CDP's bit set (Alt 1, Ctrl 2, Meta 4, Shift 8).

type BrowserLocateOptions added in v0.81.0

type BrowserLocateOptions struct {
	ID        string   `json:"id"`
	Selectors []string `json:"selectors"`
	Reveal    string   `json:"reveal,omitempty"`
}

BrowserLocateOptions asks where the elements Selectors find stand in session ID's page; one gone from the page, or hidden by what it scrolls in, answers an empty box. Reveal, when set, is a selector whose element the page first scrolls into view unless it already shows whole.

type BrowserMouseOptions added in v0.80.0

type BrowserMouseOptions struct {
	ID        string  `json:"id"`
	Type      string  `json:"type"`
	X         float64 `json:"x"`
	Y         float64 `json:"y"`
	Button    string  `json:"button,omitempty"`
	Clicks    int     `json:"clicks,omitempty"`
	DX        float64 `json:"dx,omitempty"`
	DY        float64 `json:"dy,omitempty"`
	Modifiers int     `json:"modifiers,omitempty"`
}

BrowserMouseOptions is one pointer event over the pane, in CSS pixels. Type is press, release, move or wheel; Button is left, middle, right or none; DX and DY are a wheel's scroll in CSS pixels.

type BrowserNativeLoadOptions

type BrowserNativeLoadOptions struct {
	ID      string `json:"id"`
	Loading bool   `json:"loading"`
	URL     string `json:"url,omitempty"`
}

BrowserNativeLoadOptions is session ID's front tab as the window's own page sees it: Loading from its main frame's load start until that load finished, failed or was cancelled, and URL, set only for a load the page started itself (a link the person followed, a form, back or forward), where it landed after any redirect.

type BrowserNavOptions added in v0.80.0

type BrowserNavOptions struct {
	ID     string `json:"id"`
	Action string `json:"action"`
	URL    string `json:"url,omitempty"`
}

BrowserNavOptions is the pane's toolbar: Action is back, forward, reload or go, and URL is where go loads.

type BrowserNewTabColors

type BrowserNewTabColors struct {
	Background string `json:"background"`
	Card       string `json:"card"`
	Foreground string `json:"foreground"`
	Muted      string `json:"muted"`
	Border     string `json:"border"`
	Accent     string `json:"accent"`
	Pass       string `json:"pass"`
}

BrowserNewTabColors are the window's theme tokens as CSS hex colors, with an alpha pair when the token is translucent.

type BrowserNewTabPageOptions

type BrowserNewTabPageOptions struct {
	Lang   string              `json:"lang"`
	Colors BrowserNewTabColors `json:"colors"`
	Text   BrowserNewTabText   `json:"text"`
}

BrowserNewTabPageOptions is what the new-tab page is drawn with. Lang is the interface language's tag, which the page formats times in.

type BrowserNewTabText

type BrowserNewTabText struct {
	Title        string `json:"title"`
	Address      string `json:"address"`
	AddressError string `json:"addressError"`
	Running      string `json:"running"`
	Worktree     string `json:"worktree"`
	Artifacts    string `json:"artifacts"`
	Recent       string `json:"recent"`
}

BrowserNewTabText is every sentence of the new-tab page, in the interface language.

type BrowserOpenOptions added in v0.80.0

type BrowserOpenOptions struct {
	ID  string `json:"id"`
	URL string `json:"url"`
}

BrowserOpenOptions loads a URL in the session's browser, creating a headless one when the card has not opened a window yet.

type BrowserPageInfo added in v0.80.0

type BrowserPageInfo struct {
	URL         string               `json:"url"`
	Title       string               `json:"title"`
	Text        string               `json:"text"`
	Interactive []BrowserInteractive `json:"interactive"`
	Truncated   bool                 `json:"truncated"`
	// InteractiveSame leaves Interactive out: it is the list the agent's last
	// page answer gave, every element and index as they were.
	InteractiveSame bool `json:"interactiveSame,omitempty"`
	// Downloads are the ones the agent has not heard of in their current
	// state: what its last action saved, or one it saw start and that ended
	// since.
	Downloads []BrowserDownload `json:"downloads,omitempty"`
	// WaitTimedOut says the text a read waited for never came (or never
	// went): the page is the one standing when the wait gave up.
	WaitTimedOut bool `json:"waitTimedOut,omitempty"`
	// ConsoleErrors are the errors the page's console showed since the
	// agent's last page answer, each one line cut short; ConsoleErrorsMore
	// counts those past the cap.
	ConsoleErrors     []string `json:"consoleErrors,omitempty"`
	ConsoleErrorsMore int      `json:"consoleErrorsMore,omitempty"`
	// Dialog is the JavaScript dialog the page holds open: until it is
	// answered (BrowserAnswerDialog) the page runs no script, so the rest of the
	// answer is the page as it stood when the dialog opened.
	Dialog *BrowserDialog `json:"dialog,omitempty"`
	// Dialogs are the ones the person answered in the pane since the agent's
	// last page answer.
	Dialogs []BrowserDialog `json:"dialogs,omitempty"`
}

BrowserPageInfo is what the agent reads instead of a screenshot.

type BrowserPointOptions added in v0.81.0

type BrowserPointOptions struct {
	ID string  `json:"id"`
	X  float64 `json:"x"`
	Y  float64 `json:"y"`
}

BrowserPointOptions is a point of session ID's page, in CSS pixels.

type BrowserPressOptions added in v0.80.0

type BrowserPressOptions struct {
	ID  string `json:"id"`
	Key string `json:"key"`
	BrowserTarget
}

BrowserPressOptions presses one named key. An empty target presses into whatever is focused.

type BrowserRect added in v0.80.0

type BrowserRect struct {
	X int `json:"x"`
	Y int `json:"y"`
	W int `json:"w"`
	H int `json:"h"`
}

BrowserRect is an element's viewport box, integer pixels.

type BrowserScreenshotOptions added in v0.80.0

type BrowserScreenshotOptions struct {
	ID       string `json:"id"`
	Path     string `json:"path"`
	Annotate bool   `json:"annotate"`
}

BrowserScreenshotOptions captures the page to Path, or to a file lich chooses when Path is empty. Annotate draws each listed element's index on the image.

type BrowserScrollOptions added in v0.80.0

type BrowserScrollOptions struct {
	ID string `json:"id"`
	DY int    `json:"dy"`
}

BrowserScrollOptions scrolls the page by DY CSS pixels. Positive is down.

type BrowserState added in v0.80.0

type BrowserState struct {
	Owner   string `json:"owner"`
	Open    bool   `json:"open"`
	Headed  bool   `json:"headed"`
	ByAgent bool   `json:"byAgent"`
	URL     string `json:"url"`
	Title   string `json:"title"`
	// NewTab says URL is lich's own new-tab page, which the window shows as an
	// empty address under the title it names.
	NewTab bool `json:"newTab,omitempty"`
	// Dialog is the JavaScript dialog the page holds open until the person
	// or the agent answers it; nil when none is.
	Dialog *BrowserDialog `json:"dialog,omitempty"`
	// Tabs are the browser's tabs in the order the pane shows them.
	Tabs []BrowserTab `json:"tabs,omitempty"`
	// Idle is the reaper asking whether to close it: headless, no pane shows
	// it, and nobody used it for the idle window. It stays until browser.Close,
	// browser.Keep or a use answers it; the browser stays open meanwhile.
	Idle bool `json:"idle,omitempty"`
	// Reloads counts the loads of the page at the URL it was already at: a
	// reload, the agent's, the toolbar's or the page's own, or the agent
	// opening that URL again. The window's own page follows only a URL that
	// changed, so it loads again when this rises.
	Reloads int `json:"reloads,omitempty"`
}

BrowserState is a session's browser as the window shows it. Open false means it is gone; ByAgent says the agent started it rather than the window.

type BrowserTab added in v0.83.0

type BrowserTab struct {
	ID    string `json:"id"`
	URL   string `json:"url"`
	Title string `json:"title"`
	// NewTab is BrowserState.NewTab for this tab.
	NewTab   bool `json:"newTab,omitempty"`
	Front    bool `json:"front,omitempty"`
	DevTools bool `json:"devtools,omitempty"`
	Paused   bool `json:"paused,omitempty"`
	// Loading is the tab's page loading, from its navigation's start until the
	// page and its resources finished or failed: whatever engine draws the
	// page sets it from its own main-frame load events.
	Loading bool `json:"loading,omitempty"`
	// Icon names the page's icon, a small PNG BrowserIcon returns, and
	// changes when the icon does; "" for a page whose icon is unknown or
	// does not load. browser-state carries the name, never the image.
	Icon string `json:"icon,omitempty"`
}

BrowserTab is one tab of a session's browser. ID is Chrome's own for it; Front marks the one shown and driven. In BrowserState, a DevTools tab follows the page tab it inspects, and is Front while the pane shows it in place of that page, which the agent still drives; Paused says that page is stopped in the debugger. The agent's list never holds a DevTools tab.

type BrowserTabOptions added in v0.83.0

type BrowserTabOptions struct {
	ID     string `json:"id"`
	Action string `json:"action"`
	Tab    string `json:"tab,omitempty"`
	URL    string `json:"url,omitempty"`
}

BrowserTabOptions acts on session ID's tabs: Action is a Tab* constant, Tab the tab it acts on (none for TabNew), and URL where a new tab loads, blank when empty.

type BrowserTarget added in v0.80.0

type BrowserTarget struct {
	Index    *int     `json:"index,omitempty"`
	Selector string   `json:"selector,omitempty"`
	X        *float64 `json:"x,omitempty"`
	Y        *float64 `json:"y,omitempty"`
}

BrowserTarget picks an element. Index is the one page-info stamped; selector is a CSS query; x/y are viewport coordinates. Coordinates win when set, then selector, then index.

type BrowserTextOptions added in v0.80.0

type BrowserTextOptions struct {
	ID   string `json:"id"`
	Text string `json:"text"`
}

BrowserTextOptions types text into whatever has focus, the way an input method commits it.

type BrowserTypeOptions added in v0.80.0

type BrowserTypeOptions struct {
	ID    string `json:"id"`
	Text  string `json:"text"`
	Clear bool   `json:"clear"`
	BrowserTarget
}

BrowserTypeOptions types into the session's browser. An empty target types into whatever is focused.

type BrowserViewOptions added in v0.80.0

type BrowserViewOptions struct {
	ID    string  `json:"id"`
	W     int     `json:"w"`
	H     int     `json:"h"`
	Scale float64 `json:"scale"`
	// Drawn is the window drawing the page itself, in a web view of its own:
	// the backend lays its page out at W x H for the agent and sends no frames.
	Drawn bool `json:"drawn,omitempty"`
}

BrowserViewOptions sizes a session's page to the pane showing it: W and H in CSS pixels, Scale the device pixels per CSS pixel.

type CarryUncommittedOptions

type CarryUncommittedOptions struct {
	Src string `json:"src"`
	Dst string `json:"dst"`
}

CarryUncommittedOptions carries the uncommitted changes of checkout Src to checkout Dst.

type ChatAgent

type ChatAgent struct {
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Model       string   `json:"model,omitempty"`
	Source      string   `json:"source"`
	Path        string   `json:"path,omitempty"`
	Tools       []string `json:"tools,omitempty"`
	ReadOnly    bool     `json:"readOnly,omitempty"`
}

ChatAgent is one subagent. Path is the file that defines it, "" for one built in; Tools are those it is limited to, nil when it takes them all or its file lists them in a form lich does not read. ReadOnly is set on a file the person does not edit here: a plugin's or a managed one.

type ChatAgentList

type ChatAgentList struct {
	Reported bool        `json:"reported"`
	Agents   []ChatAgent `json:"agents,omitempty"`
	Create   []string    `json:"create,omitempty"`
}

ChatAgentList is a chat session's subagents. Create is where ChatNewAgent writes one, AgentProject or AgentUser, the default first, nil where the provider takes none.

type ChatAnswerOptions

type ChatAnswerOptions struct {
	ID       string `json:"id"`
	ItemID   string `json:"itemId"`
	OptionID string `json:"optionId"`
}

ChatAnswerOptions answers permission item ItemID of session ID with the option OptionID.

type ChatAsk

type ChatAsk struct {
	Header  string      `json:"header,omitempty"`
	Text    string      `json:"text"`
	Options []ChatOffer `json:"options,omitempty"`
	Multi   bool        `json:"multi,omitempty"`
}

ChatAsk is one question. Header is its short label; an ask with no Options takes free text alone. Multi lets the person pick more than one option. Every ask also takes the person's own words.

type ChatAskAnswer

type ChatAskAnswer struct {
	Picked []string `json:"picked,omitempty"`
	Other  string   `json:"other,omitempty"`
}

ChatAskAnswer is the options picked, by label, and the person's own words, "" for none.

type ChatChoice

type ChatChoice struct {
	ID          string `json:"id"`
	Label       string `json:"label"`
	Description string `json:"description,omitempty"`
	Danger      bool   `json:"danger,omitempty"`
}

ChatChoice is one value a ChatOption can take, in the provider's words. Danger marks a mode that runs tools without asking (Claude Code's bypassPermissions), which the window sets apart.

type ChatCommand

type ChatCommand struct {
	Text        string `json:"text"`
	Description string `json:"description,omitempty"`
	Hint        string `json:"hint,omitempty"`
	Skill       bool   `json:"skill,omitempty"`
}

ChatCommand is one command a chat's provider takes typed at its prompt. Text is what the composer gets, as the provider's TUI takes it: "/compact", or "$deploy" for a Codex skill. Hint names its arguments, and Skill sets a skill apart from a command where the provider tells the two apart.

type ChatCommandsUpdate

type ChatCommandsUpdate struct {
	SessionID string        `json:"sessionId"`
	Commands  []ChatCommand `json:"commands"`
}

ChatCommandsUpdate is the payload of ChatCommandsEvent.

type ChatCompaction

type ChatCompaction struct {
	State   string `json:"state"`
	Auto    bool   `json:"auto,omitempty"`
	Before  int    `json:"before,omitempty"`
	After   int    `json:"after,omitempty"`
	Error   string `json:"error,omitempty"`
	Summary string `json:"summary,omitempty"`
	Hooks   string `json:"hooks,omitempty"`
}

ChatCompaction is the agent folding the conversation into a summary. Auto marks one the provider started on its own, mid-turn, where the person typed none. Before and After are the conversation's tokens on each side, 0 where the provider did not say; Error is its reason for a failed one, Summary what the conversation was folded into and Hooks what the compaction's hooks printed, each "" for none.

type ChatFileChange

type ChatFileChange struct {
	Path string `json:"path"`
	Diff string `json:"diff"`
}

ChatFileChange is one file a call changed: its path, relative to the session's checkout, and its unified diff against the checkout's HEAD.

type ChatFolder

type ChatFolder struct {
	Path   string `json:"path"`
	Source string `json:"source"`
}

ChatFolder is one folder a session may work in and where it was granted.

type ChatHook

type ChatHook struct {
	Event     string `json:"event"`
	Summary   string `json:"summary,omitempty"`
	Matcher   string `json:"matcher,omitempty"`
	Source    string `json:"source"`
	Plugin    string `json:"plugin,omitempty"`
	Type      string `json:"type"`
	Command   string `json:"command"`
	Label     string `json:"label,omitempty"`
	Condition string `json:"condition,omitempty"`
	Timeout   int    `json:"timeout,omitempty"`
	Off       bool   `json:"off,omitempty"`
	Key       string `json:"key,omitempty"`
	Hash      string `json:"hash,omitempty"`
	Trust     string `json:"trust,omitempty"`
	Managed   bool   `json:"managed,omitempty"`
}

ChatHook is one hook: what it runs (Command, a command, prompt or URL as Type says) on Event, for the tools Matcher names, "" for all. Label is what its row shows. Off is set on one that does not run. Key and Hash name it and its content to ChatHookAct, Trust and Managed say whether Codex runs it and whether the person may turn it off.

type ChatHookActOptions

type ChatHookActOptions struct {
	ID     string `json:"id"`
	Key    string `json:"key"`
	Action string `json:"action"`
	Hash   string `json:"hash,omitempty"`
}

ChatHookActOptions runs Action on the hook Key names; a trust trusts the content Hash names, the one the person saw.

type ChatHookList

type ChatHookList struct {
	Reported bool       `json:"reported"`
	Hooks    []ChatHook `json:"hooks,omitempty"`
	Actions  []string   `json:"actions,omitempty"`
	Blocked  string     `json:"blocked,omitempty"`
	Errors   []string   `json:"errors,omitempty"`
}

ChatHookList is a chat session's hooks, in the order its provider runs their events. Actions are the ChatHookAct actions it takes, nil when the list is to be read only. Blocked says why its hooks do not run, "" when they do; Errors are the files skipped for being broken.

type ChatItem

type ChatItem struct {
	ID   string `json:"id"`
	Kind string `json:"kind"`
	// Turn counts the person's messages: every item of an answer carries the
	// turn of the message it answers.
	Turn int    `json:"turn"`
	Text string `json:"text,omitempty"`
	// Files are the paths a person's message attached, in this run of the
	// chat: a conversation read back has its text alone.
	Files      []string        `json:"files,omitempty"`
	Tool       *ChatToolCall   `json:"tool,omitempty"`
	Permission *ChatPermission `json:"permission,omitempty"`
	Question   *ChatQuestion   `json:"question,omitempty"`
	Plan       *ChatPlan       `json:"plan,omitempty"`
	Compaction *ChatCompaction `json:"compaction,omitempty"`
	// At is when the item began, in unix milliseconds.
	At int64 `json:"at"`
	// Model and Effort are what produced the item, as the person reads them:
	// the model's name and the effort level in force when the item began. Each
	// is "" where the provider does not say, as for most of a conversation read
	// back from a transcript, which holds no effort.
	Model  string `json:"model,omitempty"`
	Effort string `json:"effort,omitempty"`
}

ChatItem is one entry of a conversation. Text is the whole text so far, not a delta. A tool item fills Tool; a permission item fills Permission.

type ChatItemUpdate

type ChatItemUpdate struct {
	SessionID string   `json:"sessionId"`
	Item      ChatItem `json:"item"`
}

ChatItemUpdate is the payload of ChatItemEvent.

type ChatMCPActOptions

type ChatMCPActOptions struct {
	ID     string `json:"id"`
	Server string `json:"server"`
	Action string `json:"action"`
}

ChatMCPActOptions names a ChatMCPAct action on server Server of session ID.

type ChatMCPActResult

type ChatMCPActResult struct {
	AuthURL string `json:"authUrl,omitempty"`
}

ChatMCPActResult is what an action leaves the person to do: AuthURL is the page that finishes a sign-in, "" when none is needed.

type ChatMCPList

type ChatMCPList struct {
	Reported bool            `json:"reported"`
	Servers  []ChatMCPServer `json:"servers,omitempty"`
	Actions  []string        `json:"actions,omitempty"`
}

ChatMCPList is a chat session's MCP servers. Actions are the ChatMCPAct actions its provider takes.

type ChatMCPServer

type ChatMCPServer struct {
	Name      string        `json:"name"`
	Status    string        `json:"status"`
	Scope     string        `json:"scope,omitempty"`
	Config    string        `json:"config,omitempty"`
	Transport string        `json:"transport,omitempty"`
	Target    string        `json:"target,omitempty"`
	Version   string        `json:"version,omitempty"`
	Error     string        `json:"error,omitempty"`
	Auth      string        `json:"auth,omitempty"`
	Fixed     bool          `json:"fixed,omitempty"`
	Tools     []ChatMCPTool `json:"tools,omitempty"`
}

ChatMCPServer is one MCP server of a chat session. Scope is where it is configured as the provider names it (Claude Code: user, project, local, claudeai, managed, plugin; Codex: user), Config the file that holds it, "" when lich cannot tell. Target is its URL or command, never its environment or headers. Fixed is set on a server the panel must not turn off: lich's own, which it adds to every session.

type ChatMCPTool

type ChatMCPTool struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

ChatMCPTool is one tool an MCP server offers.

type ChatMarketplace

type ChatMarketplace struct {
	Name    string `json:"name"`
	Source  string `json:"source,omitempty"`
	Plugins int    `json:"plugins"`
	Fixed   bool   `json:"fixed,omitempty"`
}

ChatMarketplace is one marketplace the provider was given. Source is the repository, URL or path it reads, Plugins how many it offers.

type ChatMemoryFile

type ChatMemoryFile struct {
	Kind     string `json:"kind"`
	Path     string `json:"path"`
	Imported bool   `json:"imported,omitempty"`
	Exists   bool   `json:"exists"`
}

ChatMemoryFile is one instruction file. Imported is set on one another file pulls in; Exists is false only on a user or project file not written yet, which ChatCreateMemory creates.

type ChatMemoryList

type ChatMemoryList struct {
	Reported   bool              `json:"reported"`
	Files      []ChatMemoryFile  `json:"files,omitempty"`
	Memories   []ChatMemoryNote  `json:"memories,omitempty"`
	AutoMemory *ChatMemoryToggle `json:"autoMemory,omitempty"`
	AutoDream  *ChatMemoryToggle `json:"autoDream,omitempty"`
}

ChatMemoryList is a chat session's memory: Files are the instruction files it loads in the provider's order, Memories what it saved itself, and AutoMemory and AutoDream its settings, nil where the provider has none or does not show one.

type ChatMemoryNote

type ChatMemoryNote struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	Description string `json:"description,omitempty"`
	Type        string `json:"type,omitempty"`
}

ChatMemoryNote is one memory the agent saved. Type is the provider's (Claude Code: user, feedback, project, reference), "" when it has none.

type ChatMemoryToggle

type ChatMemoryToggle struct {
	Enabled bool   `json:"enabled"`
	Locked  bool   `json:"locked,omitempty"`
	Detail  string `json:"detail,omitempty"`
}

ChatMemoryToggle is one memory setting. Locked is set where it cannot be changed from here; Detail is the provider's own words on it, "" when it says nothing.

type ChatNewAgentOptions

type ChatNewAgentOptions struct {
	ID          string `json:"id"`
	Scope       string `json:"scope"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

ChatNewAgentOptions writes subagent Name of session ID where Scope says, AgentUser or AgentProject, described by Description.

type ChatNewAgentResult

type ChatNewAgentResult struct {
	Path string `json:"path"`
}

ChatNewAgentResult is the file ChatNewAgent wrote.

type ChatOffer

type ChatOffer struct {
	Label       string `json:"label"`
	Description string `json:"description,omitempty"`
	Preview     string `json:"preview,omitempty"`
}

ChatOffer is one option of a question; Preview is a block of text shown beside the options while this one is highlighted.

type ChatOption

type ChatOption struct {
	ID       string       `json:"id"`
	Category string       `json:"category"`
	Label    string       `json:"label"`
	Current  string       `json:"current"`
	Choices  []ChatChoice `json:"choices"`
}

ChatOption is one setting of a chat session, as the provider offers it: Current is the ID of the choice in force.

type ChatOptionsUpdate

type ChatOptionsUpdate struct {
	SessionID string       `json:"sessionId"`
	Options   []ChatOption `json:"options"`
}

ChatOptionsUpdate is the payload of ChatOptionsEvent.

type ChatPathOptions

type ChatPathOptions struct {
	ID   string `json:"id"`
	Path string `json:"path"`
}

ChatPathOptions names file Path of session ID.

type ChatPermission

type ChatPermission struct {
	Tool      ChatToolCall       `json:"tool"`
	Options   []ChatPermitOption `json:"options"`
	Chosen    string             `json:"chosen,omitempty"`
	DefaultNo bool               `json:"defaultNo,omitempty"`
}

ChatPermission is the agent asking to run Tool. Chosen is the option the person picked, "" while it waits. DefaultNo is the provider asking that no single key allow it.

type ChatPermissionActOptions

type ChatPermissionActOptions struct {
	ID       string `json:"id"`
	Action   string `json:"action"`
	Behavior string `json:"behavior"`
	Rule     string `json:"rule"`
	Source   string `json:"source"`
}

ChatPermissionActOptions adds Rule as a Behavior rule to the settings file of Source, or removes it from there.

type ChatPermissionActResult

type ChatPermissionActResult struct {
	Warnings []string `json:"warnings,omitempty"`
}

ChatPermissionActResult is what the provider said of a rule it saved, such as it matching every use of its tool.

type ChatPermissionList

type ChatPermissionList struct {
	Reported     bool                 `json:"reported"`
	Rules        []ChatPermissionRule `json:"rules,omitempty"`
	Folders      []ChatFolder         `json:"folders,omitempty"`
	Cwd          string               `json:"cwd,omitempty"`
	Destinations []string             `json:"destinations,omitempty"`
	Locked       bool                 `json:"locked,omitempty"`
	Errors       []string             `json:"errors,omitempty"`
}

ChatPermissionList is a chat session's permission rules. Folders are those it may work in besides Cwd, the one it started in. Destinations are where a rule is added, nil when none can be, Locked set when the organization's settings allow only their own rules. Errors are the settings files skipped for being broken, whose rules are not listed.

type ChatPermissionRule

type ChatPermissionRule struct {
	Behavior    string `json:"behavior"`
	Rule        string `json:"rule"`
	Source      string `json:"source"`
	Description string `json:"description,omitempty"`
	Removable   bool   `json:"removable,omitempty"`
	Ignored     bool   `json:"ignored,omitempty"`
}

ChatPermissionRule is one rule. Rule is the text as the settings file holds it, what a removal names; Description its plain reading where the provider gives one. Removable is set on one a settings file holds that lich may take out, Ignored on one the organization's settings keep from applying.

type ChatPermitOption

type ChatPermitOption struct {
	ID    string `json:"id"`
	Label string `json:"label"`
	Kind  string `json:"kind"`
}

ChatPermitOption is one answer a permission item offers, in the provider's words.

type ChatPlan

type ChatPlan struct {
	Entries []ChatPlanEntry `json:"entries"`
}

ChatPlan is the agent's task list, in its order. A turn's plan item holds the list as it last stood in that turn; one with no entries is a list the agent cleared.

type ChatPlanEntry

type ChatPlanEntry struct {
	Content    string `json:"content"`
	ActiveForm string `json:"activeForm,omitempty"`
	Status     string `json:"status"`
}

ChatPlanEntry is one task. ActiveForm is what the task reads as while it runs ("Running the tests"), its Content where the provider gives none.

type ChatPlugin

type ChatPlugin struct {
	ID          string           `json:"id"`
	Name        string           `json:"name"`
	Marketplace string           `json:"marketplace"`
	Description string           `json:"description,omitempty"`
	Version     string           `json:"version,omitempty"`
	Latest      string           `json:"latest,omitempty"`
	Installed   bool             `json:"installed,omitempty"`
	Enabled     bool             `json:"enabled,omitempty"`
	Scope       string           `json:"scope,omitempty"`
	Installs    int              `json:"installs,omitempty"`
	Parts       *ChatPluginParts `json:"parts,omitempty"`
	Fixed       bool             `json:"fixed,omitempty"`
}

ChatPlugin is one plugin. ID is name@marketplace. Latest is a newer version than Version, "" when there is none or the provider cannot tell. Installs is how many people installed it, 0 when not reported. Parts is what an installed one brings, nil when not reported. Fixed is set on lich's own plugin, which lich installs and pins itself.

type ChatPluginActOptions

type ChatPluginActOptions struct {
	ID     string `json:"id"`
	Action string `json:"action"`
	Target string `json:"target"`
	Scope  string `json:"scope,omitempty"`
}

ChatPluginActOptions runs Action of session ID on Target: a plugin's ID, a marketplace's name, or for MarketplaceAdd its source. Scope is where a plugin is installed, or is to be, "" for the provider's default.

type ChatPluginActResult

type ChatPluginActResult struct {
	Restart bool `json:"restart,omitempty"`
	Current bool `json:"current,omitempty"`
}

ChatPluginActResult is what an update left: Restart when it installed a newer version the chat runs only once restarted, Current when it was already the latest.

type ChatPluginList

type ChatPluginList struct {
	Reported     bool              `json:"reported"`
	Plugins      []ChatPlugin      `json:"plugins,omitempty"`
	Marketplaces []ChatMarketplace `json:"marketplaces,omitempty"`
	Actions      []string          `json:"actions,omitempty"`
	Scopes       []string          `json:"scopes,omitempty"`
}

ChatPluginList is a chat session's plugins: the installed ones that apply in its checkout and, not installed, those its marketplaces offer. Actions are the ChatPluginAct actions its provider takes, Scopes where it installs one, the default first.

type ChatPluginParts

type ChatPluginParts struct {
	Skills int `json:"skills"`
	Agents int `json:"agents"`
	Hooks  int `json:"hooks"`
	MCP    int `json:"mcp"`
	Tokens int `json:"tokens,omitempty"`
}

ChatPluginParts is what a plugin brings, and Tokens what it adds to every session's context, 0 when not reported.

type ChatPromptOptions

type ChatPromptOptions struct {
	ID          string           `json:"id"`
	Text        string           `json:"text"`
	Attachments []DropAttachment `json:"attachments,omitempty"`
}

ChatPromptOptions sends Text to session ID's agent, with Attachments: an image goes as an image where the provider takes one, any other file as its path under the text with its notice, as a drop at the terminal pastes it.

type ChatProposal

type ChatProposal struct {
	Plan string `json:"plan"`
}

ChatProposal is the plan the agent asks to start on, in Markdown, "" where it gave none.

type ChatQReplied

type ChatQReplied struct {
	Answers  []ChatAskAnswer `json:"answers,omitempty"`
	Declined bool            `json:"declined,omitempty"`
}

ChatQReplied is how a question item was answered: one answer per ask, in order, or Declined when the person answered none.

type ChatQuestion

type ChatQuestion struct {
	Questions []ChatAsk     `json:"questions"`
	Reply     *ChatQReplied `json:"reply,omitempty"`
	Proposal  *ChatProposal `json:"proposal,omitempty"`
}

ChatQuestion is the agent asking the person, Claude Code's AskUserQuestion shape that every provider's request for input is read into: one to four questions. Reply is the answer once given, nil while it waits.

Proposal is set where the agent asks to start on the plan it wrote: the one ask's options are then the modes the work can start in, each Label a choice id of the session's mode option, which the window names; the person's own words, or no answer, keep it planning.

type ChatReplyOptions

type ChatReplyOptions struct {
	ID     string       `json:"id"`
	ItemID string       `json:"itemId"`
	Reply  ChatQReplied `json:"reply"`
}

ChatReplyOptions answers question item ItemID of session ID.

type ChatRunShellOptions

type ChatRunShellOptions struct {
	ID      string `json:"id"`
	Command string `json:"command"`
}

ChatRunShellOptions runs Command in session ID's checkout.

type ChatSetMemoryOptions

type ChatSetMemoryOptions struct {
	ID      string `json:"id"`
	Setting string `json:"setting"`
	Enabled bool   `json:"enabled"`
}

ChatSetMemoryOptions turns Setting of session ID on or off.

type ChatSetOptionOptions

type ChatSetOptionOptions struct {
	ID       string `json:"id"`
	OptionID string `json:"optionId"`
	Value    string `json:"value"`
}

ChatSetOptionOptions sets option OptionID of session ID to the choice Value.

type ChatSetSkillOptions

type ChatSetSkillOptions struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Enabled bool   `json:"enabled"`
}

ChatSetSkillOptions turns skill Name of session ID on or off.

type ChatShell

type ChatShell struct {
	ID          string `json:"id"`
	Command     string `json:"command"`
	Description string `json:"description,omitempty"`
	Monitor     bool   `json:"monitor,omitempty"`
	State       string `json:"state"`
	Started     int64  `json:"started"`
	Ended       int64  `json:"ended,omitempty"`
}

ChatShell is one background shell. Command is what it runs, Description the agent's words for it; Started and Ended are in unix milliseconds, Ended 0 while it runs. Monitor marks a command the agent watches, each line it prints reaching the agent, which Claude Code counts apart from shells.

type ChatShellOptions

type ChatShellOptions struct {
	ID    string `json:"id"`
	Shell string `json:"shell"`
}

ChatShellOptions names shell Shell of session ID.

type ChatShellsUpdate

type ChatShellsUpdate struct {
	SessionID string      `json:"sessionId"`
	Shells    []ChatShell `json:"shells"`
}

ChatShellsUpdate is the payload of ChatShellsEvent.

type ChatSkill

type ChatSkill struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Source      string `json:"source,omitempty"`
	Tokens      int    `json:"tokens,omitempty"`
	State       string `json:"state"`
	Locked      string `json:"locked,omitempty"`
}

ChatSkill is one skill of a chat session. Source is where it comes from as the provider names it (project, user, plugin, system...), Tokens what it costs the context, 0 when not reported, and Locked why it cannot be turned on or off (Claude Code: author, plugin, policy, flag, reserved-name), "" when it can.

type ChatSkillList

type ChatSkillList struct {
	Reported bool        `json:"reported"`
	Skills   []ChatSkill `json:"skills,omitempty"`
}

ChatSkillList is a chat session's skills.

type ChatSuggestion

type ChatSuggestion struct {
	SessionID string `json:"sessionId"`
	Text      string `json:"text"`
}

ChatSuggestion is the payload of ChatSuggestionEvent.

type ChatToolCall

type ChatToolCall struct {
	Name    string `json:"name"`
	Title   string `json:"title,omitempty"`
	State   string `json:"state"`
	Output  string `json:"output,omitempty"`
	Diff    string `json:"diff,omitempty"`
	Ended   int64  `json:"ended,omitempty"`
	Movable bool   `json:"movable,omitempty"`
	// Files are the files the checkout changed while a call with no Diff of
	// its own ran, a shell command's edits among them, as lich read them
	// from git once it ended; nil for none, and on a call read back from
	// history.
	Files []ChatFileChange `json:"files,omitempty"`
}

ChatToolCall is a tool the agent ran. Name is the provider's own (Read, Bash), Title what it acts on (a path, a command), Output a short reading of its result; Diff is a unified diff when the tool edits a file. Ended is when it finished, in unix milliseconds, 0 while it runs and where nobody reported its end: a conversation read back from most providers. Movable marks a call that waits on a command ChatBackground can move to the background.

type ChatTurn

type ChatTurn struct {
	SessionID  string `json:"sessionId"`
	Running    bool   `json:"running"`
	StopReason string `json:"stopReason,omitempty"`
	DurationMs int64  `json:"durationMs,omitempty"`
	// Changes is what the turn changed in the session's checkout, on its end
	// alone; nil where lich could not read the checkout.
	Changes *ChatTurnChanges `json:"changes,omitempty"`
}

ChatTurn is the payload of ChatTurnEvent: Running while a turn is in flight; on its end, StopReason ("end_turn", "cancelled", "error") and how long it took.

type ChatTurnChanges

type ChatTurnChanges struct {
	Files   int `json:"files"`
	Added   int `json:"added"`
	Removed int `json:"removed"`
}

ChatTurnChanges is the checkout's diff against HEAD at a turn's end less the one at its start: what the turn changed by any means, a tool or a shell command alike, and whatever else changed the checkout meanwhile.

type ChatViewOptions

type ChatViewOptions struct {
	ID   string `json:"id"`
	View string `json:"view"`
}

ChatViewOptions asks for session ID in View.

type ChatWorkflow

type ChatWorkflow struct {
	ID      string              `json:"id"`
	Name    string              `json:"name"`
	State   string              `json:"state"`
	Started int64               `json:"started"`
	Ended   int64               `json:"ended,omitempty"`
	Agents  []ChatWorkflowAgent `json:"agents"`
}

ChatWorkflow is one workflow. Started and Ended are in unix milliseconds, Ended 0 while it runs.

type ChatWorkflowAgent

type ChatWorkflowAgent struct {
	Index     int    `json:"index"`
	Label     string `json:"label"`
	Phase     string `json:"phase,omitempty"`
	Model     string `json:"model,omitempty"`
	State     string `json:"state"`
	Started   int64  `json:"started,omitempty"`
	Ended     int64  `json:"ended,omitempty"`
	Tokens    int    `json:"tokens,omitempty"`
	ToolCalls int    `json:"toolCalls,omitempty"`
	Tool      string `json:"tool,omitempty"`
	ToolInput string `json:"toolInput,omitempty"`
	Prompt    string `json:"prompt,omitempty"`
	Result    string `json:"result,omitempty"`
	Error     string `json:"error,omitempty"`
}

ChatWorkflowAgent is one agent of a workflow, in the order the script started them. Phase is the script's phase it runs in, empty outside one; Tool and ToolInput the last call it made; Prompt and Result the start of its task and of its answer, Error why it failed. Started and Ended are in unix milliseconds, 0 while unknown.

type ChatWorkflowsUpdate

type ChatWorkflowsUpdate struct {
	SessionID string         `json:"sessionId"`
	Workflows []ChatWorkflow `json:"workflows"`
}

ChatWorkflowsUpdate is the payload of ChatWorkflowsEvent.

type CheckItem

type CheckItem struct {
	Name        string `json:"name"`
	State       string `json:"state"`
	Description string `json:"description"` // workflow name, or the status context's own line
	URL         string `json:"url"`         // where to read the run; "" when gh reports none
	StartedAt   string `json:"startedAt"`
	CompletedAt string `json:"completedAt"`
	// Required is GitHub's own answer to "does this check gate the merge", the
	// same verdict its checks list labels Required.
	Required bool `json:"required"`
}

CheckItem is one check, flattened from gh's two rollup shapes into what the Checks tab lists. State is this package's own passed|failed|pending, the same verdict ChecksRollup counts. The timestamps are gh's ISO strings, left for the window to turn into a duration.

type CheckLog added in v0.89.0

type CheckLog struct {
	Number  int           `json:"number,omitempty"`
	Head    string        `json:"head,omitempty"`
	Passed  int           `json:"passed"`
	Pending int           `json:"pending"`
	Failed  []FailedCheck `json:"failed,omitempty"`
}

CheckLog is the pull request's checks at its head commit. Number 0 is a branch with no pull request. Logs are read only once no check is pending: gh serves a job's log only when its whole run has finished.

type CheckLogOptions added in v0.89.0

type CheckLogOptions struct {
	ID    string `json:"id"`
	Lines int    `json:"lines,omitempty"`
}

CheckLogOptions names the calling session. Lines is how many lines of each failing step to keep; 0 keeps CheckLogLines.

type CheckoutFileOptions

type CheckoutFileOptions struct {
	Path string `json:"path"`
	Rel  string `json:"rel"`
}

CheckoutFileOptions names file Rel of the checkout at Path.

type ChecksRollup

type ChecksRollup struct {
	Passed  int `json:"passed"`
	Failed  int `json:"failed"`
	Pending int `json:"pending"`
	Total   int `json:"total"`
}

ChecksRollup collapses gh's statusCheckRollup array into the counts the panel shows. Total is every check, so "all green" is Passed == Total && Total > 0.

type CloseProjectOptions added in v0.81.0

type CloseProjectOptions struct {
	From    string `json:"from"`
	Project string `json:"project"`
}

CloseProjectOptions is one CloseProject call, an object for the reason CloseSessionOptions is one. Project is an open project by name or by directory path; From is the caller's session, whose own project is refused.

type CloseSessionOptions

type CloseSessionOptions struct {
	From     string `json:"from"`
	Target   string `json:"target"`
	Project  string `json:"project"`
	Worktree string `json:"worktree"`
	Force    bool   `json:"force"`
	Self     bool   `json:"self"`
}

CloseSessionOptions is one Close call, an object for the reason OpenOptions is one: an option a newer lich adds is dropped by an older backend, and one an older lich does not send is its zero value.

type ClosedHistory

type ClosedHistory struct {
	Sessions []ParkedSession `json:"sessions"`
	Total    int             `json:"total"`
	// Parked sessions whose conversation has not been indexed yet, which is what
	// the list reports while the backfill catches up on a workspace that predates
	// the index. 0 once every row has one, which is the steady state.
	Indexing int `json:"indexing"`
}

ClosedHistory is one page of the parked-session history and the size of the match it was cut from. Total is what lets the list say it was cut instead of presenting closedSessionLimit rows as the whole answer.

type ClosedProject added in v0.81.0

type ClosedProject struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Path string `json:"path"`
	// Sessions is how many sessions the project held: their terminals were
	// stopped, and their rows stay for the reopen.
	Sessions int `json:"sessions"`
}

ClosedProject is what a caller is told about the project it closed.

type ClosedSession

type ClosedSession struct {
	ID        string `json:"id"`
	ProjectID string `json:"projectId"`
	Project   string `json:"project"`
	Label     string `json:"label"`
	// Worktree is the checkout the session lived in, empty for a session in the
	// project's own directory.
	Worktree string `json:"worktree"`
	// Kept is the answer given to the worktree question: the checkout was left on
	// disk rather than removed. Meaningless unless the close had that question to
	// answer — a session sharing its checkout, or living in the project's own
	// directory, reports false while leaving everything where it was.
	//
	// Nothing here reports the park, because every close but a removal parks and
	// a field that is true on all of them tells a caller nothing.
	Kept bool `json:"kept"`
	// Removed is whether the checkout was deleted.
	Removed bool `json:"removed"`
}

ClosedSession is what a caller is told about the session it closed.

type ClosedSessionsOptions

type ClosedSessionsOptions struct {
	Term      string `json:"term"`
	ProjectID string `json:"projectId,omitempty"`
}

ClosedSessionsOptions narrows the parked sessions to what matches Term and, when ProjectID is set, to that project's.

type CodexHookUntrusted

type CodexHookUntrusted struct {
	SessionID string `json:"sessionId"`
	Trust     string `json:"trust"`
}

CodexHookUntrusted names the Codex session whose chat found lich-plugin's PreToolUse hook not trusted (modified or untrusted), so Codex runs without it and its subagents stay native.

type CollectNowOptions

type CollectNowOptions struct {
	From string `json:"from"`
}

CollectNowOptions is one CollectNow call, an object for the reason SendOptions is one.

type CollectOptions

type CollectOptions struct {
	From        string `json:"from"`
	WaitSeconds int    `json:"waitSeconds"`
}

CollectOptions is one Collect call, an object for the reason SendOptions is one.

type CollectedResults

type CollectedResults struct {
	Results []SendResult `json:"results"`
	Open    []string     `json:"open"`
}

CollectedResults is what a drain returns: every outcome that was waiting for the caller, oldest first, and the labels of the sessions still owing one.

type ColorFolderOptions

type ColorFolderOptions struct {
	From    string `json:"from"`
	Project string `json:"project"`
	Folder  string `json:"folder"`
	Color   string `json:"color"`
}

ColorFolderOptions is one ColorFolder call, an object for the reason CloseOptions is one.

type ColoredFolder

type ColoredFolder struct {
	Project  string   `json:"project"`
	Folder   string   `json:"folder"`
	Color    string   `json:"color"`
	Sessions []string `json:"sessions"`
}

ColoredFolder is what a caller is told about a folder it painted: the sessions that took the colour, by label.

type CommitIdentity

type CommitIdentity struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	Local bool   `json:"local"`
}

CommitIdentity is the name and email the next commit in a checkout would be authored with — the fact the project's gh account (ghaccount.go) does not carry, since that one only governs what lich asks gh. Local says the value comes from the checkout's own config rather than the global one.

The zero value is a legitimate answer, not a failure: a checkout with no identity configured is one of the states worth showing.

type CommitIdentityOptions

type CommitIdentityOptions struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

CommitIdentityOptions is the name and email to author commits with.

type CommitPattern

type CommitPattern struct {
	// Target is the part the rule reads, already in the words the screen uses:
	// "message", "author email", "committer email".
	Target string `json:"target"`
	// Operator is GitHub's own: regex | starts_with | ends_with | contains.
	Operator string `json:"operator"`
	Pattern  string `json:"pattern"`
	// Negate flips the test — the pattern is then what the text must *not* be.
	Negate bool `json:"negate"`
}

CommitPattern is one ruleset rule that tests the text of a commit rather than the state of a pull request. It earns its own field because it is the one class of rule nothing on a pull request hints at: the checks pass, the review lands, no conflict exists, and GitHub still answers BLOCKED — because the message the merge *would* write breaks a pattern nobody can see from here.

type CommitRangeDiff

type CommitRangeDiff struct {
	Base string `json:"base"`
	Diff string `json:"diff"`
}

CommitRangeDiff is the unified diff from Base, First's parent, to Last.

type CommitRangeOptions

type CommitRangeOptions struct {
	Path  string `json:"path"`
	First string `json:"first"`
	Last  string `json:"last"`
}

CommitRangeOptions names the commits First to Last of a pull request of the checkout at Path's repository, First no newer than Last.

type ContinueInOptions

type ContinueInOptions struct {
	ID      string `json:"id"`
	Profile string `json:"profile"`
}

ContinueInOptions moves session ID's conversation to Profile, a slug of its provider.

type ControlSessionOptions

type ControlSessionOptions struct {
	From    string `json:"from"`
	Target  string `json:"target"`
	Project string `json:"project"`
	Action  string `json:"action"`
	Value   string `json:"value"`
	Args    string `json:"args"`
}

ControlSessionOptions is one Control call, an object for the reason CloseOptions is one.

type ControlledSession

type ControlledSession struct {
	ID      string `json:"id"`
	Project string `json:"project"`
	Label   string `json:"label"`
	Action  string `json:"action"`
	Value   string `json:"value,omitempty"`
	State   string `json:"state"`
}

ControlledSession is what a caller is told about a command it gave a session. Value is the prompt, model, effort or slash command's name the action carried.

type CostReport

type CostReport struct {
	Projects []CostTotal `json:"projects"`
	Sessions int         `json:"sessions"`
	Unpriced int         `json:"unpriced"`
	Priced   int         `json:"priced"`
	Reported int         `json:"reported"`
	Source   string      `json:"source"`
	CostUSD  float64     `json:"costUsd"`
	Readout  bool        `json:"readout"`
}

CostReport is CostTotals' answer: a row per project, and the same numbers summed across every row.

The money is a **lower bound** whenever Unpriced is not zero. A session lich never priced holds no ledger row at all — its provider files its conversation where lich has no reader, a model in it has no price, or the readout was off while it ran — and nothing here can guess what it spent. Shipping that count beside the sum is the whole difference between "this is what it cost" and "this is what lich could add up", and a total that omitted it in silence would be the one failure mode that makes the number not worth reading.

Why the row is missing is not in here on purpose: that is costMiss (internal/terminal/usage_cost.go), which is decided by the live scan and never persisted, so the ledger can only say that a session has no price — not which of the reasons it was.

Priced and Reported are how many counted sessions each rung contributed, and they are what lets a reader weigh the total: the sum is the one place the difference between the two is invisible, since both arrive as dollars.

Readout is whether the cost readout is on at all. Off, no transcript is ever summed, so every session is unpriced and the total can only be zero — which a caller has to be able to say instead of printing a $0.00 that reads as free.

type CostTotal

type CostTotal struct {
	Project  string  `json:"project"`
	Sessions int     `json:"sessions"`
	Unpriced int     `json:"unpriced"`
	Source   string  `json:"source"`
	CostUSD  float64 `json:"costUsd"`
}

CostTotal is what one project's sessions have cost. Sessions is every session in the unit; Unpriced is how many of them carry no price at all, so the money covers Sessions-Unpriced of them.

Source is whose arithmetic that money is: providers.CostSourcePriced when lich derived every dollar of it from token counts, providers.CostSourceReported when the providers that spent it handed their own figures over, and CostSourceMixed when the row spans both. Empty is a row with nothing to attribute — every session in it unpriced, or its spend earned by a provider CLI run by hand inside a shell session, which lich never spawned a rung for.

type CostTotalsOptions

type CostTotalsOptions struct {
	Project  string `json:"project"`
	Provider string `json:"provider"`
	Since    int64  `json:"since"`
}

CostTotalsOptions is one CostTotals call. It travels as a single JSON object rather than as positional arguments because a package manager replaces the lich binary under a running backend: a filter a newer `lich cost` adds is dropped by an older backend, and one an older `lich cost` does not send is no filter, where a positional list refuses both on its count.

type CreateProfileOptions

type CreateProfileOptions struct {
	Name string `json:"name"`
}

CreateProfileOptions names a new profile.

type CreateWorktreeFromPROptions

type CreateWorktreeFromPROptions struct {
	ProjectPath string `json:"projectPath"`
	ProjectID   string `json:"projectId"`
	Number      int    `json:"number"`
}

CreateWorktreeFromPROptions creates a worktree on pull request Number's branch.

type CreateWorktreeOptions

type CreateWorktreeOptions struct {
	ProjectPath  string `json:"projectPath"`
	ProjectID    string `json:"projectId"`
	Name         string `json:"name"`
	Base         string `json:"base"`
	BaseIsRemote bool   `json:"baseIsRemote"`
	SeedFrom     string `json:"seedFrom,omitempty"`
}

CreateWorktreeOptions creates worktree Name of the project at ProjectPath, branched from Base (a remote branch when BaseIsRemote). SeedFrom is the checkout whose working tree the caller is about to carry into it; empty, or a branch that already exists, seeds from ProjectPath.

type Declared

type Declared struct {
	Name     string
	Request  reflect.Type
	Response reflect.Type
}

Declared is one Method with its type parameters as values, for code that walks the whole contract (the golden test).

type DeclaredEvent

type DeclaredEvent struct {
	Name    string
	Payload reflect.Type
}

DeclaredEvent is one Event or EventFamily with its payload as a value, for code that walks the whole contract (the golden test). Name ends in "<id>" for a family.

type DetectedProvider

type DetectedProvider struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Binary    string `json:"binary"`
	Installed bool   `json:"installed"`
	Path      string `json:"path"`
	Source    string `json:"source"`
	Docs      string `json:"docs"`
	// Installable is set on every entry, installed or not.
	Installable bool `json:"installable,omitempty"`
}

DetectedProvider reports a provider and whether a binary a session could spawn was found — on PATH, or at the path the user configured. Binary is the executable name a session spawns (DefaultBinary), which the settings screen needs even when nothing was found: a provider id is not its command — Antigravity's is `agy`. Docs is carried on every entry, installed or not: the row that has somewhere to send the user is exactly the one that found nothing. Source is SourcePath or SourceSetting, empty when nothing was found. Installable is whether ProvidersInstall has an install for it on this OS.

type Diagnostics

type Diagnostics struct {
	Version  string `json:"version"`
	Platform string `json:"platform"`
	LogPath  string `json:"logPath"`
}

Diagnostics is what a bug report opens with: the three facts that decide whether a report is actionable, and the log path the user attaches.

type DiffStats

type DiffStats struct {
	Files   int    `json:"files"`
	Added   int    `json:"added"`
	Deleted int    `json:"deleted"`
	Head    string `json:"head"`
	Branch  string `json:"branch"`
	// Merging names what a merge in progress brings in, "" when none.
	// Conflicted is the unmerged paths, repository-relative, during a merge,
	// a rebase or a cherry-pick alike.
	Merging    string   `json:"merging,omitempty"`
	Conflicted []string `json:"conflicted,omitempty"`
	// Changes is each dirty file still on disk by its state, keyed by its path
	// relative to the path read, as the Files tree lists it.
	// The values are the File* constants.
	Changes map[string]string `json:"changes,omitempty"`
}

DiffStats is what one status read says about a work tree: its uncommitted changes, and the two things they sit on. Head is the commit — the window watches it to notice a commit the way it watches Files/Added/Deleted to notice an edit — and Branch is the branch, carried here because git answers both in the same call the counts come out of.

type DropAttachment

type DropAttachment struct {
	Path   string `json:"path"`
	Notice string `json:"notice"`
}

DropAttachment is what the picker produced: the path to write at the prompt, and the line that goes under it when that path is a copy's (copyNotice), empty when the session opens the file where it lies. Both empty for a cancelled dialog.

type Event

type Event[T any] struct {
	Name string
}

Event names one message of the /events stream; T is its payload (None for one that carries nothing).

type EventFamily

type EventFamily[T any] struct {
	Prefix string
}

EventFamily is a set of events named by a prefix and a session id, one per session: "terminal:exit:<id>". Terminal I/O is named this way so each terminal subscribes only to its own stream instead of filtering a global broadcast. Every other session event is global and carries the id in its payload: its consumers outlive any one card, and a per-session name can only reach a subscriber that exists when it is emitted.

func (EventFamily[T]) ID

func (f EventFamily[T]) ID(name string) (string, bool)

ID is the session an event of the family is about, false for an event of another name.

func (EventFamily[T]) Of

func (f EventFamily[T]) Of(id string) Event[T]

Of is the family's event for session id.

type Extension added in v0.89.0

type Extension struct {
	ID          string                   `json:"id"`
	Name        string                   `json:"name"`
	Description string                   `json:"description,omitempty"`
	Version     string                   `json:"version"`
	Status      string                   `json:"status"`
	Error       string                   `json:"error,omitempty"`
	Dir         string                   `json:"dir"`
	Surfaces    []ExtensionSurface       `json:"surfaces"`
	Source      string                   `json:"source,omitempty"`
	Release     string                   `json:"release,omitempty"`
	Latest      string                   `json:"latest,omitempty"`
	Revoked     string                   `json:"revoked,omitempty"`
	Text        map[string]ExtensionText `json:"text,omitempty"`
	// Icons is the PNG each surface's iconFile names, by surface id, drawn in
	// place of its Icon.
	Icons map[string][]byte `json:"icons,omitempty"`
	// Permissions is what the manifest lists, the extension.Permission names
	// its calls and subscriptions may use.
	Permissions []string `json:"permissions"`
}

Extension is one directory under lich's extensions directory and where its process is. Name, Description and Surfaces come from its manifest, so they are the extension's own words; Text holds their translations, by the tag of each folder of the extension's locales. Source is the repository or folder it was installed from and Release the repository's tag, both empty for one placed by hand. Latest is the tag of a newer release, empty while lich knows of none. Revoked is why the lich catalog took its repository down, which keeps it stopped for good.

type ExtensionCatalog added in v0.91.0

type ExtensionCatalog struct {
	Catalog  extension.Catalog `json:"catalog"`
	Platform string            `json:"platform"`
}

ExtensionCatalog is catalog.json as the backend holds it. Platform is this lich's <goos>_<goarch>, the key of an entry's Builds an install takes.

type ExtensionCatalogImageOptions added in v0.91.0

type ExtensionCatalogImageOptions struct {
	URL string `json:"url"`
}

ExtensionCatalogImageOptions names an image by the URL the catalog gives.

type ExtensionDirInstallOptions added in v0.89.0

type ExtensionDirInstallOptions struct {
	Dir string `json:"dir"`
}

ExtensionDirInstallOptions names a folder holding manifest.json and the executable at its root.

type ExtensionGitInstallOptions added in v0.89.0

type ExtensionGitInstallOptions struct {
	URL string `json:"url"`
}

ExtensionGitInstallOptions names the repository to install from: https://github.com/<owner>/<repo>, with or without .git.

type ExtensionIDOptions added in v0.89.0

type ExtensionIDOptions struct {
	ID string `json:"id"`
}

ExtensionIDOptions names one extension.

type ExtensionInstallPreview added in v0.89.0

type ExtensionInstallPreview struct {
	Token       string   `json:"token"`
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Version     string   `json:"version"`
	Source      string   `json:"source"`
	Release     string   `json:"release,omitempty"`
	Publisher   string   `json:"publisher,omitempty"`
	Listed      bool     `json:"listed,omitempty"`
	Permissions []string `json:"permissions"`
}

ExtensionInstallPreview is a staged install: what the person is asked to confirm, read from the staged copy's manifest. Token names the copy for CommitInstall or DiscardInstall, and expires when neither comes in time. Publisher is the repository's owner, empty for a folder; Listed is whether the release is the one the lich catalog lists, pinned to its hashes.

type ExtensionInstallTokenOptions added in v0.89.0

type ExtensionInstallTokenOptions struct {
	Token string `json:"token"`
}

ExtensionInstallTokenOptions names a staged install by the token its preview carries.

type ExtensionMessage added in v0.89.0

type ExtensionMessage struct {
	ExtensionID string          `json:"extensionId"`
	Message     json.RawMessage `json:"message"`
}

ExtensionMessage is a line extension ExtensionID wrote and lich accepted.

type ExtensionSendOptions added in v0.89.0

type ExtensionSendOptions struct {
	ID      string          `json:"id"`
	Message json.RawMessage `json:"message"`
}

ExtensionSendOptions writes Message, one line of the extension contract, to the process of extension ID. Only event, surface.opened, surface.closed and language are accepted.

type ExtensionSurface added in v0.89.0

type ExtensionSurface struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	Icon  string `json:"icon,omitempty"`
	Place string `json:"place,omitempty"`
}

ExtensionSurface is a screen an extension declares, and Place where it lives: "" for a full screen, "dock" or "panel" (extension.Place).

type ExtensionText added in v0.89.0

type ExtensionText struct {
	Name        string            `json:"name,omitempty"`
	Description string            `json:"description,omitempty"`
	Surfaces    map[string]string `json:"surfaces,omitempty"`
}

ExtensionText is an extension's name, description and surface titles, by surface id, in one language of its catalogs. What it leaves out reads the manifest's.

type ExtensionUpdate added in v0.91.0

type ExtensionUpdate struct {
	ID     string `json:"id"`
	Latest string `json:"latest"`
}

ExtensionUpdate is the newer release lich found for extension ID, or an empty Latest once there is none.

type ExternalSession

type ExternalSession struct {
	Kind              string `json:"kind"`
	ProviderSessionID string `json:"providerSessionId"`
	Title             string `json:"title"`
	Path              string `json:"path"`
	ProjectID         string `json:"projectId"`
	ProjectName       string `json:"projectName"`
	ProjectPath       string `json:"projectPath"`
	UpdatedAt         int64  `json:"updatedAt"`
	// Profile is the Claude Code or Codex profile the conversation lives in,
	// the one a resume of it runs in whatever the project's own profile is.
	Profile string `json:"profile,omitempty"`
}

ExternalSession is a conversation started outside lich that one of its projects can adopt: it ran in that project's directory or in one of its checkouts. Path is what the adopted row carries, "" for the project's own directory, the same as a session lich opened there.

type FailedCheck added in v0.89.0

type FailedCheck struct {
	Name  string    `json:"name"`
	URL   string    `json:"url,omitempty"`
	Steps []StepLog `json:"steps,omitempty"`
}

FailedCheck is one failed check. Steps is empty for a check that is not a GitHub Actions job, whose log lives only at URL, and while checks are pending.

type FileLinesOptions

type FileLinesOptions struct {
	Path string `json:"path"`
	Rel  string `json:"rel"`
	Ref  string `json:"ref"`
	From int    `json:"from"`
	To   int    `json:"to"`
}

FileLinesOptions reads lines From to To of file Rel, at Ref ("" for the working tree).

type FileListing

type FileListing struct {
	Files []string `json:"files"`
	// Cut reports a listing that stopped at walkLimit. Only a plain-folder walk
	// can set it; git's own listing is never capped.
	Cut bool `json:"cut"`
	// Hidden names the walkIgnore directories this folder actually had, sorted
	// and deduped: the panel names them, so somebody keeping source under a
	// build/ or vendor/ reads why it is missing instead of guessing.
	Hidden []string `json:"hidden"`
}

FileListing is one listing of a directory's files: the paths, plus the two things the Files panel has to say out loud about how they were gathered. A tree that silently stops short, or silently leaves a directory out, reads as a folder with fewer files in it than it has.

type FileSessionOptions

type FileSessionOptions struct {
	From    string `json:"from"`
	Target  string `json:"target"`
	Project string `json:"project"`
	Folder  string `json:"folder"`
}

FileSessionOptions is one File call, an object for the reason CloseOptions is one.

type FiledSession

type FiledSession struct {
	ID       string `json:"id"`
	Project  string `json:"project"`
	Label    string `json:"label"`
	Folder   string `json:"folder"`
	Previous string `json:"previous"`
}

FiledSession is what a caller is told about the session it filed. Previous is the folder it left, "" when it was in none.

type FocusSessionOptions

type FocusSessionOptions struct {
	From    string `json:"from"`
	Target  string `json:"target"`
	Project string `json:"project"`
}

FocusSessionOptions is one Focus call, an object for the reason SendOptions is one.

type FocusedSession

type FocusedSession struct {
	ID      string `json:"id"`
	Label   string `json:"label"`
	Project string `json:"project"`
}

FocusedSession says which session's card was brought up, so a caller that named it loosely can tell the person which one it was.

type FoldersOptions

type FoldersOptions struct {
	From    string `json:"from"`
	Project string `json:"project"`
}

FoldersOptions is one Folders call, an object for the reason CloseOptions is one.

type FollowSystemOptions

type FollowSystemOptions struct {
	On bool `json:"on"`
}

FollowSystemOptions is whether the window follows the OS to the selected theme's pair.

type ForgeChange

type ForgeChange struct {
	Path  string `json:"path"`
	Forge string `json:"forge"`
}

ForgeChange is the forge the checkout at Path now answers with.

type GetSettingOptions

type GetSettingOptions struct {
	Key       string `json:"key"`
	ProjectID string `json:"projectId"`
}

GetSettingOptions reads setting Key of project ProjectID, "" for a global one.

type GitAuthorsOptions added in v0.91.0

type GitAuthorsOptions struct {
	Path string `json:"path"`
	Ref  string `json:"ref,omitempty"`
}

GitAuthorsOptions names the history GitAuthors reads, Ref empty for the same everything GitLogOptions reads.

type GitBlame

type GitBlame struct {
	// Lines holds, for each line from the first, the commit that last changed
	// it, "" for a line not committed yet. A line past its end is not
	// committed either: an untracked file, or a repository with no commit,
	// has no Lines at all.
	Lines   []string                  `json:"lines"`
	Commits map[string]GitBlameCommit `json:"commits"`
}

GitBlame is who last changed each line of a file as it is in the working tree.

type GitBlameCommit

type GitBlameCommit struct {
	Author string `json:"author"`
	// Time is when it was authored, in Unix seconds.
	Time    int64  `json:"time"`
	Summary string `json:"summary"`
	Message string `json:"message"`
}

GitBlameCommit is a commit a GitBlame names.

type GitBranchOptions added in v0.89.0

type GitBranchOptions struct {
	Path string `json:"path"`
	Name string `json:"name"`
}

GitBranchOptions names a local branch of the checkout at Path.

type GitCheckoutOptions added in v0.89.0

type GitCheckoutOptions struct {
	Path   string `json:"path"`
	Branch string `json:"branch"`
	Remote bool   `json:"remote,omitempty"`
}

GitCheckoutOptions switches the checkout at Path to Branch. A Remote branch ("origin/x") is checked out as the local branch that tracks it.

type GitCommit added in v0.89.0

type GitCommit struct {
	Hash    string   `json:"hash"`
	Parents []string `json:"parents"`
	Author  string   `json:"author"`
	When    int64    `json:"when"` // unix seconds, author date
	Subject string   `json:"subject"`
	Refs    []GitRef `json:"refs"`
	// Head marks the commit HEAD is at, a detached HEAD included.
	Head bool `json:"head,omitempty"`
}

GitCommit is one row of the history.

type GitCommitDetail added in v0.89.0

type GitCommitDetail struct {
	Hash    string          `json:"hash"`
	Author  string          `json:"author"`
	Email   string          `json:"email"`
	When    int64           `json:"when"`
	Message string          `json:"message"`
	Refs    []GitRef        `json:"refs"`
	Files   []GitCommitFile `json:"files"`
}

GitCommitDetail is what the history shows of the selected commit. Files of a merge are its changes against the first parent.

type GitCommitDiffOptions added in v0.89.0

type GitCommitDiffOptions struct {
	Path    string `json:"path"`
	Hash    string `json:"hash"`
	File    string `json:"file"`
	OldFile string `json:"oldFile,omitempty"`
}

GitCommitDiffOptions names one file of a commit. OldFile is where a renamed file came from: without it, git reads the rename as an added file.

type GitCommitFile added in v0.89.0

type GitCommitFile struct {
	Path    string `json:"path"`
	OldPath string `json:"oldPath,omitempty"`
	Added   int    `json:"added"`
	Deleted int    `json:"deleted"`
	Binary  bool   `json:"binary,omitempty"`
}

GitCommitFile is one file a commit changed. Binary has no line counts.

type GitCommitOptions added in v0.89.0

type GitCommitOptions struct {
	Path string `json:"path"`
	Hash string `json:"hash"`
}

GitCommitOptions names a commit of the checkout at Path.

type GitConflict added in v0.92.0

type GitConflict struct {
	Base   string             `json:"base"`
	Ours   string             `json:"ours"`
	Theirs string             `json:"theirs"`
	Chunks []GitConflictChunk `json:"chunks"`
}

GitConflict is a conflicted file's three versions as the index holds them, and the chunks where they differ, in order.

type GitConflictChunk added in v0.92.0

type GitConflictChunk struct {
	Kind   string   `json:"kind"`
	Base   GitLines `json:"base"`
	Ours   GitLines `json:"ours"`
	Theirs GitLines `json:"theirs"`
}

GitConflictChunk is one place where a side changed the base, and the lines it spans in each of the three versions.

type GitCreateBranchOptions added in v0.89.0

type GitCreateBranchOptions struct {
	Path string `json:"path"`
	Name string `json:"name"`
	From string `json:"from"`
	// Upstream is written to the new branch's config, to make a deleted one again.
	Upstream GitUpstream `json:"upstream,omitzero"`
}

GitCreateBranchOptions makes branch Name at From, a ref or a commit, without checking it out.

type GitDeletedBranch added in v0.91.0

type GitDeletedBranch struct {
	Hash     string      `json:"hash"`
	Upstream GitUpstream `json:"upstream,omitzero"`
}

GitDeletedBranch is what a delete returns to make the branch again: the commit it pointed at and the upstream it tracked.

type GitHubAccountState added in v0.89.0

type GitHubAccountState struct {
	Account  string   `json:"account"`
	Accounts []string `json:"accounts"`
	Hidden   bool     `json:"hidden"`
}

GitHubAccountState is how the checkout's project answers to gh: Account is the one it selected, "" for gh's active one; Accounts is every account gh is signed in to, "<host>/<login>"; Hidden is whether GitHub answers Account as if the repository did not exist, asked only when there is another account to pick instead.

type GitLines added in v0.92.0

type GitLines struct {
	From int `json:"from"`
	To   int `json:"to"`
}

GitLines is a run of lines, From included and To not, counted from 0; an empty run is the point between two lines.

type GitLogOptions added in v0.89.0

type GitLogOptions struct {
	Path   string `json:"path"`
	Ref    string `json:"ref,omitempty"`
	Query  string `json:"query,omitempty"`
	Author string `json:"author,omitempty"`
	Since  int64  `json:"since,omitempty"` // unix seconds, 0 for no bound
	File   string `json:"file,omitempty"`
	Skip   int    `json:"skip,omitempty"`
	Limit  int    `json:"limit"`
}

GitLogOptions asks for a page of a repository's history. An empty Ref is every branch, remote branch and tag. Query, Author, Since and File narrow it; a narrowed page lists commits whose parents it may not hold.

type GitLogPage added in v0.89.0

type GitLogPage struct {
	Commits []GitCommit `json:"commits"`
	More    bool        `json:"more"`
}

GitLogPage is a page of the history, newest first; More says another page follows it.

type GitMergeOptions added in v0.92.0

type GitMergeOptions struct {
	Path string `json:"path"`
	Ref  string `json:"ref"`
}

GitMergeOptions names Ref, a branch or commit, to merge into the checkout at Path.

type GitMergePreview added in v0.92.0

type GitMergePreview struct {
	Commits   int      `json:"commits"`
	Conflicts []string `json:"conflicts,omitempty"`
}

GitMergePreview is what merging Ref would bring: its commits HEAD lacks, and the files it would conflict on.

type GitMergeResult added in v0.92.0

type GitMergeResult struct {
	Before    string   `json:"before"`
	After     string   `json:"after,omitempty"`
	Conflicts []string `json:"conflicts,omitempty"`
}

GitMergeResult is a merge's outcome: the commit HEAD left and the one it reached, or, when it stopped, the files in conflict and no After.

type GitMergeUndoOptions added in v0.92.0

type GitMergeUndoOptions struct {
	Path   string `json:"path"`
	Before string `json:"before"`
	After  string `json:"after"`
}

GitMergeUndoOptions takes the checkout at Path back from After to Before.

type GitRef added in v0.89.0

type GitRef struct {
	Name string `json:"name"`
	Kind string `json:"kind"`
	Head bool   `json:"head,omitempty"`
	// Worktree is where a local branch is checked out, "" for none. GitRefs
	// fills it; a log row's refs leave it empty.
	Worktree string `json:"worktree,omitempty"`
}

GitRef is a branch or a tag. Name is the short name; Head marks the branch HEAD is on.

type GitRefs added in v0.89.0

type GitRefs struct {
	Refs []GitRef `json:"refs"`
	Head string   `json:"head"`
	// Stamp changes when any ref or HEAD moves, for a poll to tell a new
	// history from the one it holds without reading the log again.
	Stamp string `json:"stamp"`
}

GitRefs is every branch and tag of a repository. Head is the commit HEAD is at, "" in a repository without commits.

type GitRenameBranchOptions added in v0.89.0

type GitRenameBranchOptions struct {
	Path    string `json:"path"`
	Name    string `json:"name"`
	NewName string `json:"newName"`
}

GitRenameBranchOptions renames local branch Name to NewName.

type GitResolveFileOptions added in v0.92.0

type GitResolveFileOptions struct {
	Path    string `json:"path"`
	Rel     string `json:"rel"`
	Content string `json:"content"`
}

GitResolveFileOptions writes Content as the resolution of conflicted file Rel in the checkout at Path.

type GitUpstream added in v0.91.0

type GitUpstream struct {
	Remote     string `json:"remote,omitempty"`
	Merge      string `json:"merge,omitempty"`
	PushRemote string `json:"pushRemote,omitempty"`
}

GitUpstream is a branch's branch.<name>.remote, .merge and .pushRemote settings, each "" when unset.

type HandoffSessionOptions added in v0.87.0

type HandoffSessionOptions struct {
	From    string `json:"from"`
	Kind    string `json:"kind"`
	Model   string `json:"model"`
	Effort  string `json:"effort"`
	Profile string `json:"profile"`
}

HandoffSessionOptions is one Handoff call: the session handing its work off (From) and what its successor runs. Kind, Model and Effort left empty are the caller's own. Profile is only a suggestion put to the user: the successor starts in the caller's profile whatever it names, because lich moves work to another account only on the user's click.

type ImportThemeOptions

type ImportThemeOptions struct {
	Path      string `json:"path"`
	Overwrite bool   `json:"overwrite"`
}

ImportThemeOptions names the theme file to import; Overwrite replaces a custom theme of the same id instead of asking.

type InsertTextOptions

type InsertTextOptions struct {
	From        string `json:"from"`
	Target      string `json:"target"`
	Project     string `json:"project"`
	Text        string `json:"text"`
	WaitSeconds int    `json:"waitSeconds"`
}

InsertTextOptions is one Insert call, an object for the reason SendOptions is one.

type InsertedText

type InsertedText struct {
	ID      string `json:"id"`
	Label   string `json:"label"`
	Project string `json:"project"`
	Kind    string `json:"kind"`
	// Bytes is what was pasted, after control characters were stripped (sanitize).
	Bytes int `json:"bytes"`
}

InsertedText says where the text went, so an editor can tell the person which session took it when the target was chosen for them.

type InstallPluginsOptions

type InstallPluginsOptions struct {
	Slug string   `json:"slug"`
	Keys []string `json:"keys"`
}

InstallPluginsOptions installs Keys (plugin@marketplace) into profile Slug.

type InstallThemesOptions

type InstallThemesOptions struct {
	URL       string `json:"url"`
	Overwrite bool   `json:"overwrite"`
}

InstallThemesOptions names the theme repository to clone.

type Issue

type Issue struct {
	Number int    `json:"number"`
	Title  string `json:"title"`
	Body   string `json:"body"`
	URL    string `json:"url"`
}

Issue is the little of a GitHub issue the New worktree dialog needs: what to name the branch after, and what to tell the session it opens.

type LabelSessionOptions

type LabelSessionOptions struct {
	SessionID string `json:"sessionId"`
	Label     string `json:"label"`
}

LabelSessionOptions gives session SessionID the label the user typed.

type LastSaid

type LastSaid struct {
	Text string `json:"text,omitempty"`
}

LastSaid is the prose the agent ended its last turn with, the body of the window's finished-turn notification. Text is empty for every absence there is — a provider whose conversation lich cannot read, a turn that ended in a tool call, a transcript still being written — because the notification goes out without a body either way and a reason it cannot act on is a reason not worth wiring.

type LinkPullRequestOptions

type LinkPullRequestOptions struct {
	Session string `json:"session"`
	Path    string `json:"path"`
	Ref     string `json:"ref"`
}

LinkPullRequestOptions links Ref to Session: #N names a pull request of the repository checked out at Path, else Ref is a GitHub pull request or GitLab merge request URL.

type ListPullRequestsOptions

type ListPullRequestsOptions struct {
	Path  string `json:"path"`
	State string `json:"state"`
}

ListPullRequestsOptions lists the pull requests in State ("open", "closed", "merged", "all").

type LoginCodeOptions

type LoginCodeOptions struct {
	Slug string `json:"slug"`
	Code string `json:"code"`
}

LoginCodeOptions hands a running login of profile Slug the code its sign-in page showed.

type MarkThreadFixedOptions added in v0.93.0

type MarkThreadFixedOptions struct {
	ThreadID string `json:"threadId"`
	Commit   string `json:"commit"`
}

MarkThreadFixedOptions is the agent saying Commit fixes ThreadID, a thread handed to it from the Pulls screen.

type MarkViewedOptions

type MarkViewedOptions struct {
	PR   string `json:"pr"`
	Path string `json:"path"`
	Hash string `json:"hash"`
}

MarkViewedOptions ticks Path of pull request PR as viewed. Hash is the window's hash of the file's diff when it was ticked: a later diff that hashes differently means the file changed since the review.

type MergePullRequestOptions

type MergePullRequestOptions struct {
	Path    string `json:"path"`
	Number  int    `json:"number"`
	Method  string `json:"method"`
	Subject string `json:"subject"`
	Body    string `json:"body"`
	Admin   bool   `json:"admin"`
}

MergePullRequestOptions merges pull request Number by Method ("merge", "squash", "rebase"); Admin bypasses the branch's rules.

type Method

type Method[Req, Resp any] struct {
	Name string
}

Method names one RPC. Req is its options object (None for a method that takes nothing) and Resp its result (None for one that only fails or not).

func (Method[Req, Resp]) Args

func (m Method[Req, Resp]) Args(req Req) []any

Args is req in the wire envelope.

type None

type None struct{}

None is the request of a method that takes nothing and the result of one that returns only an error.

type NotifyOptions

type NotifyOptions struct {
	Summary string `json:"summary"`
	Detail  string `json:"detail"`
}

NotifyOptions is a desktop notification: its summary line and the detail under it.

type NumberOptions

type NumberOptions struct {
	Path   string `json:"path"`
	Number int    `json:"number"`
}

NumberOptions names issue or pull request Number of the checkout at Path's repository.

type OpenExternalOptions

type OpenExternalOptions struct {
	URL string `json:"url"`
}

OpenExternalOptions names the link to open in the system's browser.

type OpenFileOptions

type OpenFileOptions struct {
	Dir string `json:"dir"`
	Rel string `json:"rel"`
}

OpenFileOptions names a file by its checkout and its path inside it.

type OpenFolderOptions

type OpenFolderOptions struct {
	Dir string `json:"dir"`
}

OpenFolderOptions names a folder to open.

type OpenSessionOptions

type OpenSessionOptions struct {
	From      string `json:"from"`
	Project   string `json:"project"`
	Kind      string `json:"kind"`
	Worktree  string `json:"worktree"`
	Base      string `json:"base"`
	Model     string `json:"model"`
	Effort    string `json:"effort"`
	Folder    string `json:"folder"`
	Ultracode bool   `json:"ultracode"`
}

OpenSessionOptions is one Open call. It travels as a single JSON object rather than as positional arguments because a package manager replaces the lich binary under a running backend: a newer CLI's option the backend does not know is dropped, and one an older CLI does not send is its zero value, where a positional list refuses both on its count.

From is the session the caller runs in, empty for the command line run outside one. It decides two defaults: the project the session lands in and the provider it runs, both taken from the caller unless named. A caller with no session of its own must name the project — there is nothing to inherit. It is also recorded on the row as the new session's origin, which outlives the request that created it: the card says where it came from for as long as it exists.

Project is a project already on screen, by name, or a directory path — and a path is the only way to reach a project the window is not holding, which is what opening one from the command line means. See ensureProject.

Worktree, when given, is the branch name of a new git worktree created off Base (the project's current branch when Base is empty); the session is rooted there and labelled after it, exactly as the window's own worktree flow does. A Base without a Worktree has nothing to branch, and is refused rather than ignored.

Model, when given, is the model the provider is spawned on, in that provider's own spelling. It is recorded on the row so every later spawn repeats it. Effort, when given, is the reasoning effort, passed and recorded the same way. Ultracode turns Claude Code's ultracode on, at whatever effort the session runs; it is recorded the same way, and refused for every other provider.

Folder, when given, is the folder the session is filed under from its first frame: it is written with the row, so the card arrives in the folder's block rather than among its checkout's cards and then jumps.

type OpenSubagentOptions

type OpenSubagentOptions struct {
	From      string `json:"from"`
	Kind      string `json:"kind"`
	Worktree  string `json:"worktree"`
	Base      string `json:"base"`
	Model     string `json:"model"`
	Effort    string `json:"effort"`
	Ultracode bool   `json:"ultracode"`
}

OpenSubagentOptions is one OpenSubagent call, an object for the reason OpenOptions is one. Its fields mean what Open's do; there is no project or folder, both of which are the caller's.

type OpenedProject

type OpenedProject struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Path string `json:"path"`
}

OpenedProject identifies an opened project directory.

type OpenedSession

type OpenedSession struct {
	ID              string `json:"id"`
	ProjectID       string `json:"projectId"`
	Project         string `json:"project"`
	Label           string `json:"label"`
	Name            string `json:"name"`
	Kind            string `json:"kind"`
	Path            string `json:"path"`
	NextSeq         int    `json:"nextSeq"`
	OriginSessionID string `json:"originSessionId"`
	OriginLabel     string `json:"originLabel"`
	Confined        bool   `json:"confined"`
	Folder          string `json:"folder"`
	ProfileDropped  string `json:"profileDropped,omitempty"`
}

OpenedSession is one opened session: what the caller is told, and what the window is handed to draw the card. Both read the same struct because both need the same facts — a divergence between them is a card that does not match the session the agent was given.

Name is the second name the session answers to, empty for a Claude Code one, which names itself (relay.RosterNameOf); Label is the name on its card. Both address it (see internal/relay). Path is the worktree the session lives in, empty for a session in the project's own directory — the store's own spelling. NextSeq is the project's label counter after this session took its number. OriginSessionID and OriginLabel name the session that asked for this one — empty when the caller was not a session at all. Confined is whether the session opened inside the sandbox. Nobody is at this end to be asked, so it is the rung's own answer (store.SandboxDefault), and saying it is what keeps a caller from discovering the empty home and the read-only machine by running into them. Folder is the folder it was filed under, "" for none. ProfileDropped is why a handoff's suggested profile could not be put to the user, "" when none was dropped.

type PRBodyOptions

type PRBodyOptions struct {
	Path   string `json:"path"`
	Number int    `json:"number"`
	Body   string `json:"body"`
}

PRBodyOptions is a text for pull request Number: its description, or a comment on it.

type PRChanged

type PRChanged struct {
	Path   string `json:"path"`
	Number int    `json:"number"`
}

PRChanged names the checkout the write ran in and the pull request it addressed; Number is 0 where the write addresses a thread or a review rather than a number (the checkout's repository is then all that is known).

type PRComment

type PRComment struct {
	// ID is the REST database id, the address an edit or a delete takes.
	ID        int64  `json:"id"`
	Author    string `json:"author"`
	Avatar    string `json:"avatar,omitempty"`
	Body      string `json:"body"`
	Date      string `json:"date"`
	CanEdit   bool   `json:"canEdit"`
	CanDelete bool   `json:"canDelete"`
}

PRComment is one comment on the pull request itself.

type PRCommentBodyOptions

type PRCommentBodyOptions struct {
	Path      string `json:"path"`
	Number    int    `json:"number"`
	CommentID int64  `json:"commentId"`
	Body      string `json:"body"`
}

PRCommentBodyOptions is a text for comment CommentID of pull request Number: its new body, or a reply to it.

type PRCommentOptions

type PRCommentOptions struct {
	Path      string `json:"path"`
	Number    int    `json:"number"`
	CommentID int64  `json:"commentId"`
}

PRCommentOptions names comment CommentID of pull request Number.

type PRCommit

type PRCommit struct {
	OID      string `json:"oid"`
	Headline string `json:"headline"`
	Body     string `json:"body"`
	Login    string `json:"login"`
	Name     string `json:"name"`
	Email    string `json:"email"`
	Date     string `json:"date"` // gh's ISO committedDate
}

PRCommit is one commit the pull request would land, split the way git itself splits a message: the subject line, then the body (empty for a one-liner).

Login and Name are kept apart because only one of them is evidence: Name is free text, Login is the account GitHub resolved the author's email to against every account's verified addresses — an answer lich cannot compute, and one whose "" means the email belongs to nobody rather than "unknown".

type PRConflictsOptions

type PRConflictsOptions struct {
	Path   string `json:"path"`
	Number int    `json:"number"`
	Base   string `json:"base"`
	PRURL  string `json:"prUrl"`
}

PRConflictsOptions asks which files of pull request Number conflict with Base.

type PRConversation

type PRConversation struct {
	// HeadRefOID is the commit a new review comment is filed against. GitHub
	// defaults to the latest commit, but naming it means a review submitted
	// seconds after a push cannot silently land on lines nobody read.
	HeadRefOID string `json:"headRefOid"`
	// ViewerDidAuthor is whether the account gh ran as opened the pull
	// request, which GitHub lets neither approve it nor request changes on it.
	ViewerDidAuthor bool       `json:"viewerDidAuthor"`
	Reviews         []PRReview `json:"reviews"`
	// Comments are the pull request's own comments — the ones with no file and
	// no line, which GitHub files as issue comments.
	Comments []PRComment      `json:"comments"`
	Threads  []PRReviewThread `json:"threads"`
}

PRConversation is everything said about a pull request: the reviews and their verdicts, the comments left on the pull request itself, and the threads anchored to a file and line. The Pulls screen renders the anchored ones inside the diff and the rest in its Conversation tab.

type PRDetail

type PRDetail struct {
	Number int    `json:"number"`
	URL    string `json:"url"`
	Title  string `json:"title"`
	Body   string `json:"body"`
	// Author is the login of whoever opened it, or their display name when gh
	// reports no login. GitHub refuses a review request addressed to them, which
	// is what keeps them out of the picker.
	Author string `json:"author"`
	// AuthorLogin is the same account as Author, minus the fallback to a display
	// name — the value a commit's login is compared against. Author cannot serve:
	// a name matches no login, so a PR whose author gh reports without one would
	// read as every commit landing under the wrong account.
	AuthorLogin string `json:"authorLogin"`
	// State is gh's OPEN | CLOSED | MERGED. Only a number-addressed lookup can
	// return a non-OPEN one; the branch lookup still gates them out.
	State     string `json:"state"`
	IsDraft   bool   `json:"isDraft"`
	Mergeable string `json:"mergeable"` // gh: MERGEABLE | CONFLICTING | UNKNOWN
	// MergeStateStatus is GitHub's own answer to "can this merge right now" —
	// CLEAN | UNSTABLE | BLOCKED | BEHIND | DIRTY | DRAFT | HAS_HOOKS | UNKNOWN.
	// Mergeable alone cannot gate the button: it says nothing about a required
	// review or a required check, and it reads UNKNOWN while GitHub recomputes
	// after a push.
	MergeStateStatus string `json:"mergeStateStatus"`
	// ReviewDecision is gh's aggregate verdict — APPROVED | CHANGES_REQUESTED |
	// REVIEW_REQUIRED — and "" where the repository requires no review. Who
	// reviewed is a different field (latestReviews) this does not carry.
	ReviewDecision string `json:"reviewDecision"`
	// Reviewers is who was asked and who answered, in one list (prreviewers.go).
	Reviewers    []PRReviewer `json:"reviewers"`
	BaseRefName  string       `json:"baseRefName"`
	HeadRefName  string       `json:"headRefName"`
	ChangedFiles int          `json:"changedFiles"`
	Additions    int          `json:"additions"`
	Deletions    int          `json:"deletions"`
	Checks       ChecksRollup `json:"checks"`
	CheckRuns    []CheckItem  `json:"checkRuns"`
	Commits      []PRCommit   `json:"commits"`
	// IsCrossRepository marks a head branch that lives on a fork.
	IsCrossRepository bool `json:"isCrossRepository"`
	// MaintainerCanModify is GitHub's "allow edits by maintainers" on a fork PR,
	// and the whole of what decides whether a session can be opened on one: with
	// it a push back to the fork's branch is authorised, without it there is
	// nowhere for an agent's commits to go (CreateWorktreeFromPR). It is false on
	// a same-repository PR, where nothing needs the permission.
	MaintainerCanModify bool `json:"maintainerCanModify"`
}

PRDetail is the full view of a branch's open pull request — richer than the footer badge's PullRequest — driving the dock's Pulls panel: the title, body, CI rollup and mergeability gate the merge affordance. gh's state does not travel with it: a detail exists only when the PR is open (parsePRDetail).

type PRRead added in v0.87.0

type PRRead struct {
	Path   string
	Number int
	Open   bool
	Head   string
	Checks ChecksRollup
	Review string
	Forge  string
}

PRRead is one read of an armed checkout's pull request. Head, Checks and Review are only filled while it is open. Review is the latest submitted review's id, "" for none.

type PRReview

type PRReview struct {
	// ID is the GraphQL node id, which is what dismissing the review takes.
	ID string `json:"id"`
	// DatabaseID is the REST id, the address its summary is rewritten at.
	DatabaseID int64  `json:"databaseId"`
	Author     string `json:"author"`
	// Avatar is the address of the author's picture, read with
	// ProjectPullRequestAvatar; "" for an account deleted since.
	Avatar string `json:"avatar,omitempty"`
	// State is gh's APPROVED | CHANGES_REQUESTED | COMMENTED | DISMISSED.
	State   string `json:"state"`
	Body    string `json:"body"`
	Date    string `json:"date"`
	CanEdit bool   `json:"canEdit"`
}

PRReview is one submitted review: its verdict, and whatever was written in the summary box above the line comments.

type PRReviewBodyOptions

type PRReviewBodyOptions struct {
	Path     string `json:"path"`
	Number   int    `json:"number"`
	ReviewID int64  `json:"reviewId"`
	Body     string `json:"body"`
}

PRReviewBodyOptions rewrites the body of review ReviewID.

type PRReviewThread

type PRReviewThread struct {
	// ID is the GraphQL node id, which is what resolving a thread takes. It is
	// not the number a reply is addressed to — that is a comment's own ID.
	ID   string `json:"id"`
	Path string `json:"path"`
	// Line is the anchor in the file the thread's side names, and StartLine the
	// first line of a multi-line thread (0 when it covers one line). A thread
	// GitHub could not re-anchor keeps its original line and is marked outdated,
	// which is what sends it to the Conversation tab instead of the diff.
	Line      int `json:"line"`
	StartLine int `json:"startLine"`
	// Side is RIGHT for a thread on the new file, LEFT for one on a deleted
	// line — the two sides the diff renders in one document.
	Side       string            `json:"side"`
	IsResolved bool              `json:"isResolved"`
	IsOutdated bool              `json:"isOutdated"`
	Comments   []PRThreadComment `json:"comments"`
}

PRReviewThread is one conversation anchored to a line of the diff.

type PRReviewer

type PRReviewer struct {
	// Login is the account's login, or a team's slug — which is not what gh takes
	// to add or remove one (that is org/slug), so a team is shown and not edited.
	Login  string `json:"login"`
	IsTeam bool   `json:"isTeam"`
	// State is "" while the review is still owed, else gh's APPROVED |
	// CHANGES_REQUESTED | COMMENTED | DISMISSED.
	State string `json:"state"`
}

PRReviewer is one entry of a pull request's review roster: somebody who was asked and has not answered yet, or somebody who has.

type PRSummary

type PRSummary struct {
	Number  int    `json:"number"`
	Title   string `json:"title"`
	Author  string `json:"author"` // login, or the display name when gh reports no login
	State   string `json:"state"`  // gh: OPEN | CLOSED | MERGED
	IsDraft bool   `json:"isDraft"`
	// ReviewDecision is gh's APPROVED | CHANGES_REQUESTED | REVIEW_REQUIRED,
	// and "" for a repository that requires no review.
	ReviewDecision string `json:"reviewDecision"`
	HeadRefName    string `json:"headRefName"`
	// IsCrossRepository marks a PR whose head branch lives on a fork. lich can
	// check such a branch out, but the commits would have nowhere to push, so
	// the session flow refuses it (CreateWorktreeFromPR) and the button reads
	// as blocked rather than failing on click.
	IsCrossRepository bool         `json:"isCrossRepository"`
	UpdatedAt         string       `json:"updatedAt"` // gh's ISO timestamp
	Checks            ChecksRollup `json:"checks"`
	// Threads is counted only on a CHANGES_REQUESTED row (prlistthreads.go);
	// every other row carries a zero tally.
	Threads ThreadTally `json:"threads"`
}

PRSummary is one row of the repository's open pull requests — what the list column needs to render and rank a PR before anything is selected. The full view behind a row is PRDetail, fetched per PR.

type PRThreadComment

type PRThreadComment struct {
	// ID is the REST database id — the address a reply is posted to. GraphQL
	// node ids do not work there, which is why both identifiers travel.
	ID     int64  `json:"id"`
	Author string `json:"author"`
	Avatar string `json:"avatar,omitempty"`
	Body   string `json:"body"`
	Date   string `json:"date"`
	// DiffHunk is GitHub's own snippet of the lines the thread is about. The
	// diff already has them where the thread is anchored; this is what an
	// outdated thread has left.
	DiffHunk string `json:"diffHunk"`
	// CanEdit is GitHub's own answer to whether the account reading may
	// rewrite the comment, which is what the Edit button stands on.
	CanEdit   bool `json:"canEdit"`
	CanDelete bool `json:"canDelete"`
}

PRThreadComment is one message inside a thread.

type PRTitleOptions

type PRTitleOptions struct {
	Path   string `json:"path"`
	Number int    `json:"number"`
	Title  string `json:"title"`
}

PRTitleOptions retitles pull request Number.

type ParkSessionOptions

type ParkSessionOptions struct {
	ProjectID string `json:"projectId"`
	SessionID string `json:"sessionId"`
	ActiveID  string `json:"activeId"`
}

ParkSessionOptions parks session SessionID; ActiveID becomes the project's active session, "" for none.

type ParkedSession

type ParkedSession struct {
	ID          string `json:"id"`
	ProjectID   string `json:"projectId"`
	ProjectName string `json:"projectName"`
	// The project's own directory, so resuming a session of a closed project can
	// reopen that project first without a second lookup — and can ask where it
	// went when the directory has moved.
	ProjectPath string `json:"projectPath"`
	Label       string `json:"label"`
	Kind        string `json:"kind"`
	Path        string `json:"path"`
	// The branch the checkout was on at the close, empty for a row parked before
	// lich recorded one. Searchable, not drawn.
	ParkedBranch string `json:"parkedBranch"`
	// Unix seconds, 0 for a row parked before closed_at existed — which sorts
	// last and is drawn as no date rather than as 1970.
	ClosedAt int64 `json:"closedAt"`
	// Whether the search reached this row through its conversation. It is what
	// the window keeps the row on, apart from the snippet: a hit the index found
	// by a fold the plain text does not have ("cion" against "ción"), or a term
	// the index split on punctuation, has a snippet of nothing to show.
	MatchedConversation bool `json:"matchedConversation"`
	// The stretch of conversation that matched the search, empty for a row the
	// search matched by name, for one matched by a fold (see above), and for
	// every row of an empty query, which matched nothing in particular.
	Snippet string `json:"snippet"`
	// Whether the cap on one session's index dropped the oldest of this
	// conversation. The row says so on screen: a search that reaches only part
	// of a session has to be readable as that rather than as an absence.
	Truncated bool `json:"truncated"`
}

ParkedSession is one parked session offered for resuming — what identifies it in a list somebody is browsing rather than one they are already looking at. The project rides along because history spans every project at once, closed ones included, and the project name is what tells two sessions of the same name apart.

Two answers about the branch, and they are different questions: ParkedBranch is the snapshot this row was closed on, which is what the search matches, and what the window draws is read live off the checkout, because a worktree's directory stops agreeing with its branch the moment an agent branches inside it (native/cmd/lich-native/model.go, checkoutLabel). A row whose checkout is gone has nothing live to show — which is the same row that cannot be resumed anyway.

type PatchNotes

type PatchNotes struct {
	Version    string                `json:"version"`
	Highlights []PatchNotesHighlight `json:"highlights"`
	Groups     []PatchNotesGroup     `json:"groups"`
}

PatchNotes is a release's changelog section, ready for the window to render.

type PatchNotesGroup

type PatchNotesGroup struct {
	Label string `json:"label"`
	// Items keep their markdown bold/code markers; the window renders them.
	Items []string `json:"items"`
}

PatchNotesGroup is one "### Added / Changed / Fixed" block of a release's notes.

type PatchNotesHighlight

type PatchNotesHighlight struct {
	Kind string `json:"kind"`
	// Text keeps its markdown bold/code markers; the window renders them.
	Text string `json:"text"`
}

PatchNotesHighlight is one GitHub alert block ("> [!IMPORTANT]") written between a release's heading and its first group. Kind is the alert type, lowercased.

type PatchNotesOptions

type PatchNotesOptions struct {
	Locale string `json:"locale"`
}

PatchNotesOptions names the interface language to read the release in.

type PathBranchOptions

type PathBranchOptions struct {
	Path   string `json:"path"`
	Branch string `json:"branch"`
}

PathBranchOptions names a branch of the checkout at Path.

type PathOptions

type PathOptions struct {
	Path string `json:"path"`
}

PathOptions names a checkout, or a directory, by its path.

type PathsOptions

type PathsOptions struct {
	Paths []string `json:"paths"`
}

PathsOptions names several paths.

type Peer

type Peer struct {
	Label   string `json:"label"`
	Name    string `json:"name"`
	Project string `json:"project"`
	Kind    string `json:"kind"`
	State   string `json:"state"`
	// ID is the session's lich id, the LICH_SESSION_ID its process carries,
	// so a reader holding a recorded id can find its card. Last, because
	// fields are appended to this shape, never inserted.
	ID string `json:"id"`
	// Path is the directory the session runs in, the worktree's for a worktree
	// session, and ProjectPath the root of the project it belongs to. They are
	// what an editor matches its open folder against to find the session beside
	// it; the name of a project says nothing about where it is.
	Path        string `json:"path"`
	ProjectPath string `json:"projectPath"`
	// Tool and Detail are the tool a busy session is running and what it acts
	// on, Reason what a waiting one is blocked on: the line its card draws
	// under the label, in the provider's own words (SessionStatus). Empty in
	// every other state, and for a busy turn that has named no tool yet.
	Tool   string `json:"tool,omitempty"`
	Detail string `json:"detail,omitempty"`
	Reason string `json:"reason,omitempty"`
	// Focused marks the session whose card the window has on screen: the
	// active card of the project tab in front. No session has it while no
	// window is open.
	Focused bool `json:"focused,omitempty"`
}

Peer is one session a caller may address: the label it is addressed by, the name it answers to in Claude Code's peer roster, the project it belongs to (labels are unique within a project, not across them), what is running in it, and what that session last reported it was doing.

Both names are published because both reach this session and an agent sees them in different places — the label on the card, the roster name in `/list-agents` and in what a mention writes at a prompt. Showing one and accepting the other is what made an agent treat a single session as two.

State is stateBusy, stateWaiting or stateDone, and empty when the session has reported nothing — which is a provider whose plugin does not report state as much as a session that has not had a turn yet. Empty is "not known", never "idle": guessing the second is how a caller ends up sending work into a session that cannot take it.

type PeersOptions

type PeersOptions struct {
	From string `json:"from"`
}

PeersOptions is one Peers call, an object for the reason SendOptions is one.

type PickFileOptions

type PickFileOptions struct {
	Title string `json:"title"`
}

PickFileOptions titles the file chooser.

type PickSaveFileOptions

type PickSaveFileOptions struct {
	Title       string `json:"title"`
	DefaultName string `json:"defaultName"`
}

PickSaveFileOptions titles the save dialog and names the file it offers.

type PluginIncompatible

type PluginIncompatible struct {
	ID      string `json:"id"`
	Version string `json:"version"`
}

type PluginProfileFailure

type PluginProfileFailure struct {
	Profile string `json:"profile"`
	Name    string `json:"name"`
	Error   string `json:"error"`
}

PluginProfileFailure is one profile the plugin could not be installed into.

type PluginProfiles

type PluginProfiles struct {
	Provider string                 `json:"provider"`
	Name     string                 `json:"name"`
	Version  string                 `json:"version"`
	Failures []PluginProfileFailure `json:"failures"`
}

PluginProfiles is what one pass did: the release it installed and the profiles where the install failed, in the CLI's own words. Name is the provider's display name.

type PluginProviderOptions

type PluginProviderOptions struct {
	Provider string `json:"provider"`
}

PluginProviderOptions names the provider whose lich plugin is installed or updated.

type PluginStatus

type PluginStatus struct {
	Provider string `json:"provider"`
	Name     string `json:"name"`
	// Available is whether the provider's CLI is on PATH at all. A provider the
	// machine does not have is still listed — with nothing to install — so the
	// UI can say why it is not on offer.
	Available        bool   `json:"available"`
	Installed        bool   `json:"installed"`
	InstalledVersion string `json:"installedVersion"`
	// LatestVersion is the newest release this lich is compatible with, not the
	// newest the plugin has published: it is the one an install or update writes.
	LatestVersion   string `json:"latestVersion"`
	UpdateAvailable bool   `json:"updateAvailable"`
	// Compatible is false when the installed release is outside the range this
	// lich speaks (PluginVersionFloor, PluginVersionCeiling). Its reports still
	// land where they parse; UpdateAvailable then offers LatestVersion, a
	// downgrade included.
	Compatible bool `json:"compatible"`
	// Reregister is an update that moves no version: the hooks lich wrote for
	// this CLI predate the release of it installed now (a Crush upgraded past
	// the lifecycle events), and only writing them again picks the new events
	// up. UpdateAvailable is true beside it.
	Reregister bool `json:"reregister"`
}

PluginStatus is one provider's plugin state, reported to the window.

type Profile

type Profile struct {
	Slug     string `json:"slug"`
	Name     string `json:"name"`
	Dir      string `json:"dir"`
	Personal bool   `json:"personal"`
	// Copied names the shared entries (a settings file, say) this profile holds
	// as a copy, so edits made in one account no longer reach the other.
	Copied []string `json:"copied,omitempty"`
	// Color is the card color the profile is shown in, "" for the one the
	// window derives from the slug.
	Color string `json:"color,omitempty"`
	// Image is the profile's picture as a PNG, avatarEdge square.
	Image []byte `json:"image,omitempty"`
}

Profile is one login lich knows about.

type ProfileChanged

type ProfileChanged struct {
	Provider string  `json:"provider"`
	Profile  Profile `json:"profile"`
}

ProfileChanged is ProfileChangedEvent's payload: Provider is the provider id ("claude", "kiro"), Profile the profile as it now is, without its login state.

type ProfileInfo

type ProfileInfo struct {
	Profile
	LoggedIn bool   `json:"loggedIn"`
	Email    string `json:"email,omitempty"`
	OrgName  string `json:"orgName,omitempty"`
	// Plan is the subscription the login is on: Claude Code's own name ("pro",
	// "max", "team", …), or Codex's from its plan reading.
	Plan string `json:"plan,omitempty"`
	// AuthMethod is how a Claude Code profile authenticates: "claude.ai",
	// "console", or "none" when nobody is logged in.
	AuthMethod string `json:"authMethod,omitempty"`
	// Plugins counts a Claude Code or Codex profile's plugins.
	Plugins int `json:"plugins"`
	// Providers are the providers an oh-my-pi profile holds an OAuth login for.
	Providers []string `json:"providers,omitempty"`
	// StatusError is why the CLI's status gave no answer, in its own words;
	// LoggedIn is then false for want of one.
	StatusError string `json:"statusError,omitempty"`
}

ProfileInfo is a profile with its login state, as the profile services of every provider list it; a field a provider has no reading for stays empty.

type ProfileLogin

type ProfileLogin struct {
	Profile        string `json:"profile"`
	Output         string `json:"output,omitempty"`
	URL            string `json:"url,omitempty"`
	Authenticating bool   `json:"authenticating,omitempty"`
	Done           bool   `json:"done,omitempty"`
	LoggedIn       bool   `json:"loggedIn,omitempty"`
	Cancelled      bool   `json:"cancelled,omitempty"`
	Error          string `json:"error,omitempty"`
	PluginError    string `json:"pluginError,omitempty"`
}

ProfileLogin is one step of a login. Output carries what the CLI printed, with URL set when that text holds the sign-in address. Authenticating says the CLI is through with the browser and lich is reading whether the login took. The last event has Done set: LoggedIn is what the CLI's login status answered afterwards (`claude auth status`, `codex login status`), Error why the login failed or was cancelled, and PluginError why the lich plugin did not install.

type ProfileLoginMethods

type ProfileLoginMethods struct {
	Login       Method[ProfileSlugOptions, None]
	CancelLogin Method[ProfileSlugOptions, None]
}

ProfileLoginMethods run a provider's login from lich, where its CLI has one that is not a terminal card's: Claude Code's and Codex's.

type ProfileMethods

type ProfileMethods struct {
	Profiles      Method[None, []ProfileInfo]
	CreateProfile Method[CreateProfileOptions, Profile]
	UpdateProfile Method[UpdateProfileOptions, Profile]
	DeleteProfile Method[ProfileSlugOptions, None]
	LoginCommand  Method[ProfileSlugOptions, string]
}

ProfileMethods are the calls every provider's profile service answers.

type ProfilePlanOptions

type ProfilePlanOptions struct {
	Profile string `json:"profile"`
}

ProfilePlanOptions names the profile whose plan is read, "personal" for the machine's own.

type ProfilePlugin

type ProfilePlugin struct {
	Key         string `json:"key"`
	Name        string `json:"name"`
	Marketplace string `json:"marketplace"`
	Version     string `json:"version,omitempty"`
}

ProfilePlugin is one plugin a profile has installed at user scope.

type ProfilePluginMethods

type ProfilePluginMethods struct {
	Plugins        Method[ProfileSlugOptions, []ProfilePlugin]
	InstallPlugins Method[InstallPluginsOptions, []ProfilePluginResult]
}

ProfilePluginMethods carry plugins between profiles: Claude Code's and Codex's.

type ProfilePluginResult

type ProfilePluginResult struct {
	Key     string `json:"key"`
	OK      bool   `json:"ok"`
	Message string `json:"message,omitempty"`
}

ProfilePluginResult is one plugin's install, with Claude Code's own words when it refused: an organization's policy, a marketplace the profile cannot reach.

type ProfileSlugOptions

type ProfileSlugOptions struct {
	Slug string `json:"slug"`
}

ProfileSlugOptions names a profile by its slug.

type ProfileUpdate

type ProfileUpdate struct {
	Name string `json:"name,omitempty"`
	// Color is a card color's name; "" goes back to the color the window
	// derives from the slug. The window draws a name it does not know the same
	// way, so it is stored as given.
	Color *string `json:"color,omitempty"`
	// Image is a file to make the profile's image from; "" removes the image.
	Image *string `json:"image,omitempty"`
}

ProfileUpdate is a change to how a profile is shown. A field left nil keeps what the profile has; Name keeps it when empty.

type Project

type Project struct {
	ID              string    `json:"id"`
	Name            string    `json:"name"`
	Path            string    `json:"path"`
	NextSeq         int       `json:"nextSeq"`
	ActiveSessionID string    `json:"activeSessionId"`
	DefaultProvider string    `json:"defaultProvider"`
	Sessions        []Session `json:"sessions"`
}

Project is a persisted project together with its restorable session state.

type ProjectAdded

type ProjectAdded struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Path string `json:"path"`
}

ProjectAdded is the payload of ProjectAddedEvent: the identity as stored.

type ProjectClosed

type ProjectClosed struct {
	ID string `json:"id"`
}

ProjectClosed is the payload of ProjectClosedEvent.

type ProjectIDOptions

type ProjectIDOptions struct {
	ID string `json:"id"`
}

ProjectIDOptions names a project by its id.

type ProjectRef added in v0.84.0

type ProjectRef struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Path string `json:"path"`
}

ProjectRef is the open project a ProjectRefOptions resolved to: the id the methods keyed by project (services.Save, services.StartAll) take.

type ProjectRefOptions added in v0.84.0

type ProjectRefOptions struct {
	From    string `json:"from"`
	Project string `json:"project"`
}

ProjectRefOptions names an open project the way every spawn call does: by name or by directory path, empty for the caller's own.

type ProjectsReordered

type ProjectsReordered struct {
	IDs []string `json:"ids"`
}

ProjectsReordered is the payload of ProjectsReorderedEvent: every open project, in the order that was stored.

type ProviderBinary

type ProviderBinary struct {
	Path    string `json:"path"`
	Version string `json:"version"`
}

ProviderBinary is one executable a provider could be started from, and the version it reports, empty when it printed none lich could read.

type ProviderIDOptions

type ProviderIDOptions struct {
	ID string `json:"id"`
}

ProviderIDOptions names a provider by its id ("claude", "codex").

type ProviderInstall

type ProviderInstall struct {
	ID       string  `json:"id"`
	Progress float64 `json:"progress"`
	Done     bool    `json:"done,omitempty"`
	Error    string  `json:"error,omitempty"`
}

ProviderInstall is one step of a provider's install. Progress runs from 0 to 1 and is an estimate read off the installer's output, which states no percentage. The last event has Done set, and Error then says, in one line, why the install failed; on success the provider is on PATH by then.

type PullRequest

type PullRequest struct {
	Number      int    `json:"number"`
	URL         string `json:"url"`
	Title       string `json:"title"`
	State       string `json:"state"`
	IsDraft     bool   `json:"isDraft"`
	HeadRefName string `json:"headRefName"`
	BaseRefName string `json:"baseRefName"`
}

PullRequest is the pull request of a work tree's current branch, whatever its state: one of gh's OPEN, CLOSED, MERGED.

type QuitOptions

type QuitOptions struct{}

QuitOptions is one Quit call, an object for the reason ShowWindowOptions is.

type QuotaExtra

type QuotaExtra struct {
	Used     int64  `json:"used"`
	Limit    *int64 `json:"limit,omitempty"`
	Currency string `json:"currency,omitempty"`
	Decimals int    `json:"decimals"`
}

QuotaExtra is the spend past a plan's windows, in the currency's minor units (cents for USD). Limit is nil for an account with no monthly cap. Decimals is how many of those digits sit after the point, 2 unless the provider says so.

type QuotaPlan

type QuotaPlan struct {
	Provider  string        `json:"provider"`
	Name      string        `json:"name"`
	Plan      string        `json:"plan,omitempty"`
	Account   string        `json:"account,omitempty"`
	NoAccount string        `json:"noAccount,omitempty"`
	Windows   []QuotaWindow `json:"windows,omitempty"`
	// Extra is Claude's pay-as-you-go spend past the plan, present only when the
	// account has it switched on. ResetCredits is how many windows Codex lets
	// the account reset on demand; 0 is none or not reported.
	Extra        *QuotaExtra `json:"extra,omitempty"`
	ResetCredits int         `json:"resetCredits,omitempty"`
	// Resets are the limit resets Claude Code lets the account spend: one entry
	// per grant still good, empty when the account is not offered any.
	Resets []QuotaReset `json:"resets,omitempty"`
	Status string       `json:"status"`
}

QuotaPlan is one provider's quota reading. Provider is a providers.Registry id, so the window resolves the icon and the login command it already knows.

Account names the login the windows were read against — the whole point of the custom-binary path being that a session can spend an account lich's own environment does not name. It is empty whenever the provider will not say which, which is a reading without a name and never an error: a gauge that cannot name its account is exactly what lich drew before this field existed.

NoAccount carries why it is empty, for the one absence a reader can act on. Left empty, an unnamed account is drawn the same whether the provider names nobody or the session's own login is one lich may not ask about, and nothing on the gauge told the two apart.

type QuotaPlansOptions

type QuotaPlansOptions struct {
	SessionID string `json:"sessionId"`
}

QuotaPlansOptions names the session whose account's plans are read; "" reads the machine's own login.

type QuotaReset

type QuotaReset struct {
	ID     string   `json:"id"`
	Clears []string `json:"clears,omitempty"`
	Kind   string   `json:"kind,omitempty"`
	Label  string   `json:"label,omitempty"`
	Left   int      `json:"left"`
	EndsAt string   `json:"endsAt"`
	Held   bool     `json:"held,omitempty"`
}

QuotaReset is one grant of limit resets. ID is the provider's own, what a spend names. Clears says which limits a reset of it clears, as the QuotaClears* names. Kind names a grant lich names itself (QuotaResetFull), which the window translates; Label is the provider's own name for the rest, shown verbatim (a model a grant is scoped to, or the grant's own text); empty when Kind is set. Left is how many resets remain, EndsAt when the grant lapses, RFC 3339. Held is a grant that cannot be spent now: paused, or not usable at the moment.

type QuotaWindow

type QuotaWindow struct {
	Kind         string `json:"kind,omitempty"`
	Label        string `json:"label,omitempty"`
	Seconds      int    `json:"seconds"`
	Percent      int    `json:"percent"`
	ResetsAt     string `json:"resetsAt,omitempty"`
	Active       bool   `json:"active,omitempty"`
	LockedReason string `json:"lockedReason,omitempty"`
	RunsOutAt    string `json:"runsOutAt,omitempty"`
}

QuotaWindow is one metered window of a plan: how much of it is spent, how long it runs, and when it starts over.

Kind names a window lich names itself, one of the QuotaWindow* kinds, which the window translates. Label is the provider's own name for the rest (the model a scoped weekly cap belongs to, an Antigravity group), shown verbatim; empty when Kind is set. Seconds is its length, so the window can print the metered window it is looking at; 0 when the provider does not report one. ResetsAt is RFC 3339, empty when unreported. Active is the provider's own verdict on which window is the binding one, when it reports one at all. LockedReason is non-empty only when the provider says this window cannot be spent past regardless of its percentage. RunsOutAt is lich's own reading of the rate rather than the provider's, RFC 3339 and set only when spending at the pace so far empties the window before ResetsAt (see pace.go).

type ReadFileAtOptions

type ReadFileAtOptions struct {
	Path string `json:"path"`
	Rel  string `json:"rel"`
	Ref  string `json:"ref"`
}

ReadFileAtOptions names file Rel of the checkout at Path as it was at Ref.

type RecentProject

type RecentProject struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Path string `json:"path"`
}

RecentProject is a closed project offered for reopening — identity only, since the menu that lists them shows a name and a path and nothing else.

type RelayStalled

type RelayStalled struct {
	ID       string `json:"id"`
	TargetID string `json:"targetId"`
	Target   string `json:"target"`
}

RelayStalled is the payload of RelayStalledEvent: who asked ("" when the request came from the command line rather than a session), and the session that has whatever was produced.

type RemoveThemeOptions

type RemoveThemeOptions struct {
	ID string `json:"id"`
}

RemoveThemeOptions names the custom theme to delete.

type RemoveWorktreeOptions

type RemoveWorktreeOptions struct {
	ProjectPath  string `json:"projectPath"`
	WorktreePath string `json:"worktreePath"`
	Force        bool   `json:"force"`
	AdoptedAck   bool   `json:"adoptedAck"`
}

RemoveWorktreeOptions removes the worktree at WorktreePath. AdoptedAck is the user's answer to removing one lich did not create.

type RenameFolderOptions

type RenameFolderOptions struct {
	From    string `json:"from"`
	Project string `json:"project"`
	Folder  string `json:"folder"`
	To      string `json:"to"`
}

RenameFolderOptions is one RenameFolder call, an object for the reason CloseOptions is one. Folder is the name to change and To the new one.

type RenameProjectFolderOptions

type RenameProjectFolderOptions struct {
	ProjectID string `json:"projectId"`
	From      string `json:"from"`
	To        string `json:"to"`
}

RenameProjectFolderOptions renames project ProjectID's folder From to To.

type RenameSessionOptions

type RenameSessionOptions struct {
	From    string `json:"from"`
	Target  string `json:"target"`
	Project string `json:"project"`
	Label   string `json:"label"`
}

RenameSessionOptions is one Rename call, an object for the reason CloseOptions is one.

type RenamedFolder

type RenamedFolder struct {
	Project  string   `json:"project"`
	From     string   `json:"from"`
	To       string   `json:"to"`
	Sessions []string `json:"sessions"`
}

RenamedFolder is what a caller is told about a folder it renamed or took apart: every session that moved, which is the part a merge into an existing folder would otherwise hide.

type RenamedSession

type RenamedSession struct {
	ID       string `json:"id"`
	Project  string `json:"project"`
	Label    string `json:"label"`
	Previous string `json:"previous"`
}

RenamedSession is what a caller is told about the session it renamed. Previous is the name that is gone, which is the half the caller cannot look up afterwards.

type ReopenSessionOptions

type ReopenSessionOptions struct {
	SessionID    string `json:"sessionId"`
	NewSessionID string `json:"newSessionId"`
}

ReopenSessionOptions brings parked session SessionID back as NewSessionID.

type ReopenWorktreeSessionOptions

type ReopenWorktreeSessionOptions struct {
	ProjectID    string `json:"projectId"`
	Path         string `json:"path"`
	NewSessionID string `json:"newSessionId"`
}

ReopenWorktreeSessionOptions brings back the parked session of the checkout at Path as NewSessionID.

type ReorderProjectsOptions

type ReorderProjectsOptions struct {
	IDs []string `json:"ids"`
}

ReorderProjectsOptions is the full order of the open projects.

type ReorderSessionsOptions

type ReorderSessionsOptions struct {
	ProjectID string   `json:"projectId"`
	IDs       []string `json:"ids"`
}

ReorderSessionsOptions is the full card order of project ProjectID.

type ReplyOptions

type ReplyOptions struct {
	From   string `json:"from"`
	Ticket string `json:"ticket"`
	Answer string `json:"answer"`
}

ReplyOptions is one Reply call, an object for the reason SendOptions is one. From is the session replying.

type RequestComment

type RequestComment struct {
	Author string `json:"author"`
	Body   string `json:"body"`
}

RequestComment is one comment of a review thread.

type RequestItem

type RequestItem struct {
	Path     string `json:"path,omitempty"`
	Lines    string `json:"lines,omitempty"`
	ID       string `json:"id,omitempty"`
	Outdated bool   `json:"outdated,omitempty"`
	Check    string `json:"check,omitempty"`
	Label    string `json:"label,omitempty"`
	// URL is a check's run, a thread's discussion or the page a note is on.
	URL      string `json:"url,omitempty"`
	Selector string `json:"selector,omitempty"`
	// Component, Source and HTML are what a browser note's element is.
	Component string `json:"component,omitempty"`
	Source    string `json:"source,omitempty"`
	HTML      string `json:"html,omitempty"`
	// Text is a review comment or a browser note.
	Text string `json:"text,omitempty"`
	// Comments are a review thread's, oldest first.
	Comments []RequestComment `json:"comments,omitempty"`
}

RequestItem is one row of a request: a conflicting file, a failing check, a review thread or comment, a note on a page.

type RequestOptions

type RequestOptions struct {
	SessionID string `json:"sessionId"`
	Topic     string `json:"topic"`
	// Forge is ForgeGitHub or ForgeGitLab, the words a pull request topic is
	// written in; "" reads as GitHub.
	Forge  string `json:"forge,omitempty"`
	PR     int    `json:"pr,omitempty"`
	Branch string `json:"branch,omitempty"`
	Base   string `json:"base,omitempty"`
	// URL is the page browser notes were left on or the issue's.
	URL string `json:"url,omitempty"`
	// Image is the sketch drawn on the page, a path the session can read.
	Image string `json:"image,omitempty"`
	Issue int    `json:"issue,omitempty"`
	// Title and Body are the issue's.
	Title string `json:"title,omitempty"`
	Body  string `json:"body,omitempty"`
	// Failed is how many checks failed, counted when no item names one.
	Failed int           `json:"failed,omitempty"`
	Items  []RequestItem `json:"items,omitempty"`
	// Note is what the person wrote to close the request, empty for none.
	Note string `json:"note,omitempty"`
}

RequestOptions is an action the person took in the window, which lich hands the session as a request envelope it words in the prompt language (docs/hooks/notification.md): the window says what was asked, the backend writes it. The fields a topic does not use stay empty.

type ResizeOptions

type ResizeOptions struct {
	ID   string `json:"id"`
	Cols int    `json:"cols"`
	Rows int    `json:"rows"`
}

ResizeOptions sets session ID's PTY size.

type ResolveThreadOptions

type ResolveThreadOptions struct {
	Path     string `json:"path"`
	ThreadID string `json:"threadId"`
	Resolved bool   `json:"resolved"`
}

ResolveThreadOptions resolves review thread ThreadID, or opens it again.

type RestoreLinesOptions

type RestoreLinesOptions struct {
	Path string       `json:"path"`
	Rel  string       `json:"rel"`
	Undo RevertResult `json:"undo"`
}

RestoreLinesOptions undoes the revert Undo describes.

type ResumeAvailableOptions

type ResumeAvailableOptions struct {
	Kind              string `json:"kind"`
	ProviderSessionID string `json:"providerSessionId"`
	Cwd               string `json:"cwd"`
}

ResumeAvailableOptions asks whether conversation ProviderSessionID of provider Kind can be resumed from Cwd.

type RevertLine

type RevertLine struct {
	Side string `json:"side"`
	Line int    `json:"line"`
	Text string `json:"text"`
}

RevertLine names one changed line of the diff the panel drew. Side "old" is a deletion, numbered in HEAD; "new" is an addition, numbered in the working tree. Text is the line without its +/- prefix, and is what proves the number still points at the same line.

type RevertLinesOptions

type RevertLinesOptions struct {
	Path  string       `json:"path"`
	Rel   string       `json:"rel"`
	Lines []RevertLine `json:"lines"`
}

RevertLinesOptions puts Lines of file Rel back to HEAD.

type RevertResult

type RevertResult struct {
	Patch      string
	IndexPatch string
}

RevertResult is what undoing a revert needs: the patch reversed onto the working tree, and the one reversed onto the index ("" when the index did not hold the change and was left alone).

func (RevertResult) MarshalJSON

func (r RevertResult) MarshalJSON() ([]byte, error)

func (*RevertResult) UnmarshalJSON

func (r *RevertResult) UnmarshalJSON(data []byte) error

type ReviewComment

type ReviewComment struct {
	Path      string `json:"path"`
	Line      int    `json:"line"`
	StartLine int    `json:"startLine"`
	// Side is RIGHT (the new file) or LEFT (a deleted line). Empty means RIGHT,
	// which is where all but a deletion comment goes.
	Side string `json:"side"`
	Body string `json:"body"`
}

ReviewComment is one line comment of a review being submitted. Line is the last line it covers and StartLine the first (0 for a single-line comment) — GitHub's own convention, kept here so a selection crosses unchanged.

type SaveServiceOptions added in v0.79.0

type SaveServiceOptions struct {
	ID            string `json:"id"`
	ProjectID     string `json:"projectId"`
	Name          string `json:"name"`
	Command       string `json:"command"`
	StartWithLich bool   `json:"startWithLich"`
}

SaveServiceOptions writes a service: a new one when ID is "", the one ID names otherwise. A changed command reaches a running service at its next start.

type SaveThemeTemplateOptions

type SaveThemeTemplateOptions struct {
	Path string `json:"path"`
}

SaveThemeTemplateOptions is where the starter theme is written.

type ScheduleForfeited

type ScheduleForfeited struct {
	Label  string `json:"label"`
	At     int64  `json:"at"`
	Prompt string `json:"prompt"`
}

ScheduleForfeited is a scheduled prompt lost with the session it was parked on, which was deleted for good: the row was the only copy of what the user wrote.

type ScheduleSelfOptions added in v0.87.0

type ScheduleSelfOptions struct {
	From   string `json:"from"`
	At     int64  `json:"at"`
	On     string `json:"on"`
	Prompt string `json:"prompt"`
}

ScheduleSelfOptions is an agent's trigger for the session it runs in.

type SearchMatch

type SearchMatch struct {
	Path string `json:"path"`
	// Line is 1-based, the same numbering the preview's gutter shows.
	Line int `json:"line"`
	// Text is the line with its indentation dropped, cut to an excerpt around
	// the first occurrence when the line is long.
	Text string `json:"text"`
}

SearchMatch is one line of one file that contains the query.

type SearchOptions

type SearchOptions struct {
	Path  string `json:"path"`
	Query string `json:"query"`
}

SearchOptions searches the checkout at Path for Query.

type SearchResult

type SearchResult struct {
	Matches []SearchMatch `json:"matches"`
	// Cut reports a search that stopped at maxSearchMatches.
	Cut bool `json:"cut"`
	// TooLarge counts the listed files skipped for being above maxReadFileSize.
	// The tree shows them, so an answer that left them out says so; a binary
	// is skipped without a count, since nobody searches one for text.
	TooLarge int `json:"tooLarge"`
}

SearchResult is one search over a checkout's files.

type SearchTermOptions

type SearchTermOptions struct {
	Term string `json:"term"`
}

SearchTermOptions narrows a listing to what matches Term, "" for all of it.

type SearchTranscriptsOptions

type SearchTranscriptsOptions struct {
	IDs   []string `json:"ids"`
	Query string   `json:"query"`
}

SearchTranscriptsOptions searches the transcripts of sessions IDs for Query.

type SelectThemeOptions

type SelectThemeOptions struct {
	ID string `json:"id"`
}

SelectThemeOptions names the theme to store as the selection: "system" or an installed theme's id.

type SelfOptions

type SelfOptions struct {
	From string `json:"from"`
}

SelfOptions is one Self call, an object for the reason SendOptions is one.

type SendOptions

type SendOptions struct {
	From        string `json:"from"`
	Target      string `json:"target"`
	Project     string `json:"project"`
	Prompt      string `json:"prompt"`
	WaitSeconds int    `json:"waitSeconds"`
	// ExtensionID and ExtensionName say the call is an extension's, by its id
	// and its name in the prompt language, so the prompt the target receives is
	// introduced as relayed by it. A call from a session leaves them empty.
	ExtensionID   string `json:"extensionId,omitempty"`
	ExtensionName string `json:"extensionName,omitempty"`
}

SendOptions is one Send, SendPrivate or SendSubagent call. It travels as a single JSON object rather than as positional arguments because a package manager replaces the lich binary under a running backend: a field a newer lich adds is dropped by an older backend, and one an older lich does not send is its zero value, where a positional list refuses both on its count.

type SendResult

type SendResult struct {
	Ticket string `json:"ticket"`
	Target string `json:"target"`
	Status string `json:"status"`
	Answer string `json:"answer"`
	// Private is set on the outcome of a ticket sent with SendPrivate, which
	// only that ticket collects: no note will announce it.
	Private bool `json:"private,omitempty"`
}

SendResult is what a caller gets back from Send or Wait. Answer is empty unless Status is StatusAnswered.

type Service added in v0.79.0

type Service struct {
	ServiceConfig
	ProjectName string `json:"projectName"`
	Terminal    string `json:"terminal"`
	State       string `json:"state"`
	ExitCode    *int   `json:"exitCode,omitempty"`
	StartedAt   int64  `json:"startedAt"`
	StoppedAt   int64  `json:"stoppedAt"`
}

Service is a service and where its process is. Terminal is the id its PTY streams under on /ws while it runs, the one terminal.Write, Resize, Replay and SetVisible take. ExitCode is set once a run exited with a status of its own (nil while it runs, before it ever ran, or when it was killed). StartedAt and StoppedAt are unix milliseconds, 0 for never.

type ServiceConfig added in v0.79.0

type ServiceConfig struct {
	ID            string `json:"id"`
	ProjectID     string `json:"projectId"`
	Name          string `json:"name"`
	Command       string `json:"command"`
	StartWithLich bool   `json:"startWithLich"`
}

ServiceConfig is a project service as the user saved it: a command lich runs in the project's directory, on its own PTY, until it exits. StartWithLich starts it whenever the lich backend starts.

type ServiceIDOptions added in v0.79.0

type ServiceIDOptions struct {
	ID string `json:"id"`
}

ServiceIDOptions names a service by its id.

type Session

type Session struct {
	ID                string `json:"id"`
	Label             string `json:"label"`
	Kind              string `json:"kind"`
	Path              string `json:"path"`
	ProviderSessionID string `json:"providerSessionId"`
	// Sandbox is whether this session runs confined: "on", "off", or empty for a
	// row nothing has spawned yet. The spawn writes its own verdict here, so the
	// window can mark a confined card without re-deriving a decision that took
	// the provider's rung, the checkout and a per-session override to reach.
	Sandbox string `json:"sandbox"`
	Pinned  bool   `json:"pinned"`
	// Folder is the sidebar block this session was filed under, "" for one the
	// user has not filed. It rides the row rather than a preference because it
	// is what the list is organised by — a workspace of forty sessions that
	// came back ungrouped after a restart would be a workspace nobody files.
	Folder string `json:"folder"`
	// Color is the palette colour the user painted the card with, "" for one
	// that follows the theme.
	Color string `json:"color"`
	// Profile is the Claude Code profile the session runs in
	// (internal/claudeprofile), "" for Personal and for every other provider.
	Profile string `json:"profile"`
	// Model is the model the session was born on (SetSessionModel), "" for one
	// opened on its provider's default.
	Model           string `json:"model"`
	OriginSessionID string `json:"originSessionId"`
	OriginLabel     string `json:"originLabel"`
	// Forked is whether the session was born branching its origin's
	// conversation, rather than delegated or opened as a subagent.
	Forked bool `json:"forked"`
	// ScheduledAt is when the prompt below is due, in unix seconds, 0 for a
	// session with nothing waiting. It rides the session row so the card that
	// draws the countdown and the relay that delivers it read the same hydration
	// call, and neither needs a channel of its own.
	ScheduledAt     int64  `json:"scheduledAt"`
	ScheduledPrompt string `json:"scheduledPrompt"`
	// ScheduledBy is who parked it: "" for the person, ScheduledByAgent or
	// ScheduledByLich.
	ScheduledBy string `json:"scheduledBy"`
	// Watch is the condition this session waits on, beside its scheduled prompt
	// because lich's own continuation may sit in that slot meanwhile.
	Watch SessionWatch `json:"watch"`
	// Unread is whether this session's last finished turn is still waiting to be
	// read. It rides the hydration call because the mark has to survive a window
	// restart: the window holds it while it is up, and this row is what it comes
	// back to (see SetSessionUnread).
	Unread bool `json:"unread"`
	// MCPServers names the MCP servers this session's provider could reach when
	// it was spawned. It rides the row for the reason Sandbox does: the spawn is
	// what resolved it — from the provider's own config documents and this
	// session's directory — and a window restart has to come back to the same
	// answer without re-deriving it. Nil for a row nothing has spawned yet.
	MCPServers []string `json:"mcpServers"`
	// SandboxSkippedLinks names the paths under the user's home this session's
	// sandbox left out for being symlinks, relative to that home. It rides the
	// row for the reason MCPServers does — the spawn is what resolved it, and a
	// window restart has to come back to the same answer. Nil for an unconfined
	// session and for one whose sandbox skipped nothing.
	SandboxSkippedLinks []string `json:"sandboxSkippedLinks"`
	// View is how the session is drawn, ViewChat or ViewTerminal; "" reads
	// as the terminal, what every session was before chats.
	View string `json:"view,omitempty"`
}

Session is a persisted terminal session (metadata only). Kind selects what the PTY runs: a provider id (see internal/providers) or "shell" (the user's shell). Path is the session's working directory when it lives in a git worktree; empty means the project's own path. ProviderSessionID is the id the provider CLI assigns the conversation running in the PTY, reported by that provider's session-start hook; empty until a hook fires (or for shell sessions), it is the key for features that need to reach a session's transcript or resume it. Pinned keeps a session at the head of its project's list and withholds its close affordances until it is unpinned. OriginSessionID and OriginLabel record the session that asked for this one, empty for a session nobody delegated: the id names the parent while it is still in the workspace, the label is what that parent was called at the time and is all that is left once it is closed.

type SessionAgent

type SessionAgent struct {
	ID    string `json:"id"`
	Agent string `json:"agent"`
}

SessionAgent is the payload of SessionAgentEvent: the session and the provider CLI now live in its PTY ("" when none is).

type SessionArtifacts added in v0.88.0

type SessionArtifacts struct {
	SessionID string     `json:"sessionId"`
	Files     []Artifact `json:"files"`
}

SessionArtifacts is one session's artifacts, newest first.

type SessionCache added in v0.80.0

type SessionCache struct {
	Read     int `json:"read"`
	Write    int `json:"write"`
	Uncached int `json:"uncached"`
}

SessionCache splits one turn's input tokens three ways: Read came from the prompt cache, Write was written into it, and Uncached was neither.

type SessionClosed

type SessionClosed struct {
	ID        string `json:"id"`
	ProjectID string `json:"projectId"`
	ActiveID  string `json:"activeId"`
}

SessionClosed is the payload of SessionClosedEvent: which session left, the project it left, and which of that project's sessions is active now — the window has no say in the choice, because the row that records it is already written.

type SessionColorOptions

type SessionColorOptions struct {
	SessionID string `json:"sessionId"`
	Color     string `json:"color"`
}

SessionColorOptions tints session SessionID's card, "" for the theme's.

type SessionConversation

type SessionConversation struct {
	ID                string `json:"id"`
	ProviderSessionID string `json:"providerSessionId"`
}

type SessionCwd

type SessionCwd struct {
	ID   string `json:"id"`
	Cwd  string `json:"cwd"`
	Host string `json:"host"`
}

SessionCwd is the payload of SessionCwdEvent.

type SessionDuplicate

type SessionDuplicate struct {
	ID     string `json:"id"`
	HeldBy string `json:"heldBy"`
}

SessionDuplicate is the payload of SessionDuplicateEvent.

type SessionExit

type SessionExit struct {
	Code *int `json:"code,omitempty"`
}

SessionExit is the payload of TerminalExitEvents: the status the session's PTY child exited with. Code is absent when the child left none — killed by a signal, or a wait that failed — so the window can say the session ended without reporting a clean exit nobody observed.

type SessionFocus

type SessionFocus struct {
	ID string `json:"id"`
}

SessionFocus is the payload of SessionFocusEvent.

type SessionFolder

type SessionFolder struct {
	Name     string   `json:"name"`
	Sessions []string `json:"sessions"`
}

SessionFolder is one of a project's folders as a caller outside the window sees it: its name, which is its whole identity (store.SetSessionFolder), and the sessions filed under it, by label.

type SessionFolderOptions

type SessionFolderOptions struct {
	SessionID string `json:"sessionId"`
	Folder    string `json:"folder"`
}

SessionFolderOptions files session SessionID under Folder, "" for none.

type SessionIDOptions

type SessionIDOptions struct {
	ID string `json:"id"`
}

SessionIDOptions names a session by its id.

type SessionInbox

type SessionInbox struct {
	ID    string `json:"id"`
	Count int    `json:"count"`
}

SessionInbox is the payload of SessionInboxEvent.

type SessionLimit

type SessionLimit struct {
	ID       string `json:"id"`
	Window   string `json:"window"`
	ResetsAt int64  `json:"resetsAt"`
}

SessionLimit is the payload of SessionLimitEvent.

type SessionMCP

type SessionMCP struct {
	ID      string   `json:"id"`
	Servers []string `json:"servers"`
}

SessionMCP is the payload of SessionMCPEvent: the session and the MCP servers its provider could reach when it was spawned.

type SessionPinnedOptions

type SessionPinnedOptions struct {
	SessionID string `json:"sessionId"`
	Pinned    bool   `json:"pinned"`
}

SessionPinnedOptions pins session SessionID to the head of the sidebar.

type SessionProfile

type SessionProfile struct {
	ID string `json:"id"`
	// Profile is the slug, "" for Personal.
	Profile string `json:"profile"`
}

type SessionProfileOffer added in v0.87.0

type SessionProfileOffer struct {
	ID string `json:"id"`
	// Profile is the slug offered, "personal" for Personal.
	Profile string `json:"profile"`
	// Handoff is true for a profile the agent handing off to this session
	// suggested, false for one with quota left after a usage limit.
	Handoff bool `json:"handoff"`
}

SessionProfileOffer is the payload of SessionProfileOfferEvent.

type SessionPullRequest

type SessionPullRequest struct {
	Session string       `json:"session"`
	URL     string       `json:"url"`
	Linked  bool         `json:"linked"`
	At      int64        `json:"at"`
	Forge   string       `json:"forge"`
	Here    bool         `json:"here"`
	PR      *PullRequest `json:"pr"`
	Error   string       `json:"error,omitempty"`
}

SessionPullRequest is the person's latest word on one pull request of a session, keyed by the URL the forge answers for it. Linked false is an unlink, which hides the branch's own pull request too. Here is a link made by number, in the session's own repository. PR is the last read, nil for an unlink nothing read; Error is why the last read of a linked one failed.

type SessionRelay

type SessionRelay struct {
	ID        string `json:"id"`
	Peer      string `json:"peer"`
	Direction string `json:"direction"`
	Ticket    string `json:"ticket"`
}

SessionRelay is the payload of SessionRelayEvent: the session whose mark changed, the label at the other end, which way the request runs, and the ticket the two ends share. Peer is empty when the other end is not a session at all — the CLI run from a script or a shell — which the card words its own way.

The ticket rides along because it is otherwise written down in exactly one place: the message typed at the target's prompt. An agent whose context was compacted past that message has no way back to it, and neither had the person watching — the window knew a request was open and could not say which one. Empty when the mark is being cleared, along with the direction.

type SessionSandbox

type SessionSandbox struct {
	ID           string   `json:"id"`
	Confined     bool     `json:"confined"`
	SkippedLinks []string `json:"skippedLinks"`
}

SessionSandbox is the payload of SessionSandboxEvent: the session, whether its PTY is confined, and the home paths that sandbox skipped for being symlinks, relative to the home (nil for an unconfined spawn and for one that skipped none).

type SessionSchedule

type SessionSchedule struct {
	ID     string `json:"id"`
	At     int64  `json:"at"`
	Prompt string `json:"prompt,omitempty"`
}

SessionSchedule is the payload of SessionScheduleEvent: the session whose mark changed, when its prompt is now due, and the prompt. At is 0 and Prompt empty when nothing is waiting anymore.

type SessionScheduleBy added in v0.87.0

type SessionScheduleBy struct {
	ID string `json:"id"`
	By string `json:"by"`
}

SessionScheduleBy is the payload of SessionScheduleByEvent: who set the prompt the last SessionScheduleEvent for this session named.

type SessionStatus

type SessionStatus struct {
	ID     string `json:"id"`
	State  string `json:"state"`
	Tool   string `json:"tool,omitempty"`
	Detail string `json:"detail,omitempty"`
	Reason string `json:"reason,omitempty"`
	// Program marks a report read from the session's own output (OSC 7501)
	// rather than from a hook. The window limits the alerts these raise, since
	// nothing bounds how often a program can change its state, and reads none
	// of a hook's other meanings into them: an "idle" is not the CLI leaving, a
	// busy with no tool clears the tool line.
	Program bool `json:"program,omitempty"`
}

SessionStatus is the payload of SessionStatusEvent: the session whose processing state changed, the new state, and — on a pre-tool report alone — the tool it is about to run and what that tool acts on, or — on a waiting one alone — what it is blocked on. All three are the provider's own words, never translated here (docs/hooks/session-state.md tables them).

type SessionTitle

type SessionTitle struct {
	ID    string `json:"id"`
	Label string `json:"label"`
}

SessionTitle is the payload of SessionTitleEvent: the session whose label changed and its new label.

type SessionTodo

type SessionTodo struct {
	ID    string `json:"id"`
	Done  int    `json:"done"`
	Total int    `json:"total"`
}

SessionTodo is the payload of SessionTodoEvent. Both counts are the whole list the agent last wrote, so a card can decide for itself whether a list is worth drawing (a finished one is not, and neither is a list of one).

type SessionTouched

type SessionTouched struct {
	ID string `json:"id"`
}

SessionTouched is the payload of SessionTouchedEvent: the session whose files likely changed.

type SessionUnreadOptions

type SessionUnreadOptions struct {
	SessionID string `json:"sessionId"`
	Unread    bool   `json:"unread"`
}

SessionUnreadOptions records whether session SessionID's finished turn is still unread.

type SessionUsage

type SessionUsage struct {
	ID       string        `json:"id"`
	Percent  int           `json:"percent"`
	Tokens   int           `json:"tokens"`
	Window   int           `json:"window"`
	Model    string        `json:"model"`
	Effort   string        `json:"effort"`
	CostUSD  *float64      `json:"costUsd,omitempty"`
	CostMiss string        `json:"costMiss,omitempty"`
	Cache    *SessionCache `json:"cache,omitempty"`
	// CacheReadTotal is the tokens every call of the session read back from the
	// prompt cache, sub-agents included: a long context is paid again on each
	// call, and this is what that adds up to. Claude Code only, and omitted
	// while zero.
	CacheReadTotal int `json:"cacheReadTotal,omitempty"`
}

SessionUsage is the payload of the session-usage event. Percent is the share of the context window the turn left occupied (0–100); Tokens is the provider's active context count behind it, Window the model's effective context window, Model the model id, and Effort the reasoning effort level ("" when the line records none).

All five are zero for a provider that records what a turn spent but not the window it spent it against — oh-my-pi, opencode and Crush, the cost-only rung of docs/ceilings.md (each in docs/providers/). A zero Window is the window's signal to draw the cost alone rather than a ring around a window nobody reported.

CostUSD is what the session has cost so far, and is omitted — not zeroed — whenever there is no number worth showing: the setting is off, or a model in the transcript has no known price. The readout is for API billing, so on a subscription the field never appears at all and the footer shows nothing.

CostMiss says why, and only when the answer is "lich cannot price this conversation". It stays empty for the readout being off, which is not a failure but the design above, and for a miss the next turn heals. Without it a session that cannot be priced and a session that is not being priced look identical, and an empty footer reads as zero spend.

Cache is where the last turn's input came from, and is nil whenever the provider files no split of it: Crush, Kiro, Cursor and Antigravity, and a Claude conversation whose last event is a compaction, since the turn before it no longer describes the window. On oh-my-pi and opencode it rides beside the cost with no window, so the footer puts it in the cost tooltip.

type SessionView

type SessionView struct {
	ID   string `json:"id"`
	View string `json:"view"`
}

SessionView is the payload of SessionViewEvent.

type SessionWatch added in v0.87.0

type SessionWatch struct {
	On     string `json:"on"`
	Prompt string `json:"prompt"`
	By     string `json:"by"`
	Runs   int    `json:"runs"`
	PR     int    `json:"pr"`
	Seen   string `json:"seen"`
}

SessionWatch is a session's condition and the prompt typed when it is met. On is "" for a session watching nothing. Runs, PR and Seen outlive a disarm so an agent re-arming its own watch cannot reset its run limit.

type SessionWatchChange added in v0.87.0

type SessionWatchChange struct {
	ID    string       `json:"id"`
	Watch SessionWatch `json:"watch"`
}

SessionWatchChange is the payload of SessionWatchEvent: a session's watch as it now stands.

type SessionWatchStopped added in v0.87.0

type SessionWatchStopped struct {
	ID     string `json:"id"`
	Label  string `json:"label"`
	Number int    `json:"number"`
	Runs   int    `json:"runs"`
}

SessionWatchStopped is the payload of SessionWatchStoppedEvent.

type SessionsColored

type SessionsColored struct {
	ProjectID string   `json:"projectId"`
	IDs       []string `json:"ids"`
	Color     string   `json:"color"`
}

SessionsColored is SessionsColoredEvent's payload. Color is "" when the cards went back to the theme.

type SessionsFiled

type SessionsFiled struct {
	ProjectID string   `json:"projectId"`
	IDs       []string `json:"ids"`
	Folder    string   `json:"folder"`
}

SessionsFiled is SessionsFiledEvent's payload. Folder is "" when the cards were taken out of the one they were in.

type SetScheduleOptions added in v0.87.0

type SetScheduleOptions struct {
	SessionID string `json:"sessionId"`
	At        int64  `json:"at"`
	On        string `json:"on"`
	Prompt    string `json:"prompt"`
}

SetScheduleOptions is the person's trigger for a session. At and On are exclusive; neither clears what the session holds.

type SetSettingOptions

type SetSettingOptions struct {
	Key       string `json:"key"`
	ProjectID string `json:"projectId"`
	Value     string `json:"value"`
}

SetSettingOptions writes Value as setting Key of project ProjectID, "" for a global one.

type SetVisibleOptions

type SetVisibleOptions struct {
	ID      string `json:"id"`
	Visible bool   `json:"visible"`
}

SetVisibleOptions says whether session ID is on screen.

type ShowCode added in v0.88.0

type ShowCode struct {
	SessionID string `json:"sessionId"`
	Rel       string `json:"rel"`
	Line      int    `json:"line,omitempty"`
	EndLine   int    `json:"endLine,omitempty"`
	Comment   string `json:"comment,omitempty"`
}

ShowCode is a checked request: Rel is relative to the session's checkout.

type ShowCodeOptions added in v0.88.0

type ShowCodeOptions struct {
	ID      string `json:"id"`
	Path    string `json:"path"`
	Line    int    `json:"line,omitempty"`
	EndLine int    `json:"endLine,omitempty"`
	Comment string `json:"comment,omitempty"`
}

ShowCodeOptions names a file relative to the session's checkout, or absolute inside it. Line and EndLine are 1-based and inclusive; 0 leaves them out. Comment is plain text the agent adds on the lines.

type ShowWindowOptions

type ShowWindowOptions struct{}

ShowWindowOptions is one ShowWindow call. It carries nothing yet; it is an object so a newer launch can still reach an older running lich the day it does (the CLI's options-object rule).

type ShownSessionOptions added in v0.83.0

type ShownSessionOptions struct {
	SessionID string `json:"sessionId"`
}

ShownSessionOptions is the native window saying which session's card it has on screen, "" for none.

type StartOptions

type StartOptions struct {
	ID        string `json:"id"`
	ProjectID string `json:"projectId"`
	Cwd       string `json:"cwd"`
	Kind      string `json:"kind"`
	Resume    string `json:"resume"`
	Fork      bool   `json:"fork"`
	Cols      int    `json:"cols"`
	Rows      int    `json:"rows"`
}

StartOptions spawns session ID's process at Cols x Rows. Resume is a provider conversation to reopen, "" to start fresh; Fork branches it into a conversation of its own instead.

type StepLog added in v0.89.0

type StepLog struct {
	Step  string   `json:"step,omitempty"`
	Lines []string `json:"lines"`
	Cut   int      `json:"cut,omitempty"`
}

StepLog is the tail of one failing step's log, cleaned of gh's prefixes and terminal escapes. Cut is how many earlier lines of the step were left out.

type SubagentAnswer

type SubagentAnswer struct {
	Decision string           `json:"decision"`
	Reason   string           `json:"reason,omitempty"`
	Sessions []SubagentOpened `json:"sessions,omitempty"`
}

SubagentAnswer is lich's decision: deny with the reason the model reads and what it opened, or allow.

type SubagentOpened

type SubagentOpened struct {
	ID     string `json:"id"`
	Label  string `json:"label"`
	Ticket string `json:"ticket"`
}

SubagentOpened is one session a deny opened.

type SubagentRequest

type SubagentRequest struct {
	SessionID         string         `json:"session_id"`
	ProviderSessionID string         `json:"provider_session_id"`
	Nested            bool           `json:"nested"`
	Call              string         `json:"call"`
	Tool              string         `json:"tool"`
	ToolUseID         string         `json:"tool_use_id"`
	Tasks             []SubagentTask `json:"tasks"`
	Model             string         `json:"model"`
	Sealed            bool           `json:"sealed"`
	Isolation         string         `json:"isolation"`
	Background        bool           `json:"background"`
}

SubagentRequest is one /subagent call: the provider's own subagent tool asking lich first (docs/hooks/subagent-cards.md, Request).

type SubagentTask

type SubagentTask struct {
	Title  string `json:"title"`
	Prompt string `json:"prompt"`
	Type   string `json:"type"`
}

SubagentTask is one subagent a spawn starts.

type SubagentVeto

type SubagentVeto struct {
	SessionID string           `json:"sessionId"`
	ToolUseID string           `json:"toolUseId"`
	Sessions  []SubagentOpened `json:"sessions"`
}

SubagentVeto is a tool call /subagent answered deny once its answer was written: the chat of SessionID draws that call as opened in Sessions rather than as a failed call.

type SubmitOptions

type SubmitOptions struct {
	SessionID string `json:"sessionId"`
	Message   string `json:"message"`
}

SubmitOptions is a message typed into a session and submitted with Enter.

type SubmitReviewOptions

type SubmitReviewOptions struct {
	Path     string          `json:"path"`
	Number   int             `json:"number"`
	Event    string          `json:"event"`
	Body     string          `json:"body"`
	Head     string          `json:"head"`
	Comments []ReviewComment `json:"comments"`
}

SubmitReviewOptions submits a review of pull request Number: Event is the verdict, Comments the line comments, and Head the commit they were written against.

type Syntax

type Syntax map[string]SyntaxStyle

Syntax is a theme's syntax highlighting, keyed by the tag each style is for, as @lezer/highlight prints it: "keyword", "function(variableName)".

func (*Syntax) UnmarshalJSON

func (s *Syntax) UnmarshalJSON(data []byte) error

UnmarshalJSON reads each entry as a bare color or a style object, naming the entry that is neither.

type SyntaxStyle

type SyntaxStyle struct {
	Color         string `json:"color,omitempty"`
	Bold          bool   `json:"bold,omitempty"`
	Italic        bool   `json:"italic,omitempty"`
	Underline     bool   `json:"underline,omitempty"`
	Strikethrough bool   `json:"strikethrough,omitempty"`
}

SyntaxStyle is how the code under one highlighting tag is drawn: a CodeMirror HighlightStyle spec. A theme file writes it as a bare color or as an object; Color empty leaves the code its foreground color.

type Theme

type Theme struct {
	FormatVersion int               `json:"formatVersion,omitempty"`
	ID            string            `json:"id"`
	Name          string            `json:"name"`
	Scheme        string            `json:"scheme"`
	Origin        string            `json:"origin"`
	Source        *ThemeSource      `json:"source,omitempty"`
	App           map[string]string `json:"app"`
	Terminal      map[string]string `json:"terminal"`
	// Syntax is optional: a theme without it is highlighted in the window's
	// default palette for its scheme.
	Syntax Syntax `json:"syntax,omitempty"`
	// Pair is optional: the id of this theme's variant for the other scheme,
	// which the window draws while the OS asks for that scheme and the user
	// turned on following it.
	Pair string `json:"pair,omitempty"`
	// Latest is set by lich, never by a file: the newer version of this
	// theme's pack the last update check found, nil when there is none.
	Latest *ThemeLatest `json:"latest,omitempty"`
}

Theme describes every color value the window needs to paint the app and the terminal.

type ThemeCatalog

type ThemeCatalog struct {
	FormatVersion int                `json:"formatVersion"`
	Generated     string             `json:"generated"`
	Packs         []ThemeCatalogPack `json:"packs"`
	// Revoked is every repository taken down: lich no longer offers it.
	Revoked []ThemeRevocation `json:"revoked,omitempty"`
}

ThemeCatalog is catalog.json of github.com/lichdotdev/themes, built there from the repositories it lists (docs/themes.md, Listing in the catalog).

type ThemeCatalogInstallOptions

type ThemeCatalogInstallOptions struct {
	ID        string `json:"id"`
	Overwrite bool   `json:"overwrite"`
}

ThemeCatalogInstallOptions names a listed pack by its id; Overwrite replaces custom themes of the same ids instead of asking.

type ThemeCatalogPack

type ThemeCatalogPack struct {
	ID             string  `json:"id"`
	Name           string  `json:"name"`
	Description    string  `json:"description,omitempty"`
	Publisher      string  `json:"publisher"`
	Official       bool    `json:"official,omitempty"`
	Stars          int     `json:"stars"`
	Repo           string  `json:"repo"`
	RepoID         int64   `json:"repoId"`
	License        string  `json:"license,omitempty"`
	Version        string  `json:"version"`
	Commit         string  `json:"commit"`
	MinLichVersion string  `json:"minLichVersion,omitempty"`
	Updated        string  `json:"updated"`
	Held           string  `json:"held,omitempty"`
	Themes         []Theme `json:"themes"`
}

ThemeCatalogPack is one listed theme repository at the version the catalog offers. Repo is https://github.com/<owner>/<repo> and Publisher its owner. Commit is the first commit the catalog saw carry Version: lich installs the pack there and only there. Held, when set, says why a newer state of the repository is not the one listed. Themes are the pack's theme files in full, so the window draws them before anything is installed.

type ThemeGitResult

type ThemeGitResult struct {
	Pack      string   `json:"pack"`
	Version   string   `json:"version"`
	Themes    []Theme  `json:"themes"`
	Conflicts []string `json:"conflicts"`
	UpToDate  bool     `json:"upToDate"`
}

ThemeGitResult reports what installing a repository produced. Conflicts names the theme ids that already exist locally: found by the scan that runs before any write, nothing was installed at all; found by the write itself — a theme that appeared in between — that one id was left alone and Themes says what did go in.

type ThemeImportResult

type ThemeImportResult struct {
	Theme          Theme `json:"theme"`
	NeedsOverwrite bool  `json:"needsOverwrite"`
}

ThemeImportResult either reports the installed theme or asks the UI to confirm replacing the existing custom theme with the same id.

type ThemeLatest added in v0.91.0

type ThemeLatest struct {
	Pack    string `json:"pack"`
	Version string `json:"version"`
}

ThemeLatest is a version of a theme pack newer than the installed one.

type ThemeRevocation

type ThemeRevocation struct {
	Repo   string `json:"repo"`
	RepoID int64  `json:"repoId,omitempty"`
	Reason string `json:"reason"`
}

ThemeRevocation is a repository the catalog took down, and why.

type ThemeSelection

type ThemeSelection struct {
	Theme        string `json:"theme"`
	FollowSystem bool   `json:"followSystem"`
}

ThemeSelection is the theme the user chose and whether the window draws that theme's pair while the OS asks for the pair's scheme.

type ThemeSource

type ThemeSource struct {
	URL     string `json:"url"`
	Version string `json:"version"`
}

ThemeSource records the repository a theme was installed from and the manifest version it came in at, so lich can clone it again to look for a newer one. It is written by lich, never by a picked file: a standalone import has no source and stays unversioned.

type ThreadFix added in v0.79.0

type ThreadFix struct {
	ThreadID  string `json:"threadId"`
	Path      string `json:"path"`
	Number    int    `json:"number"`
	CommentID int64  `json:"commentId"`
	Commit    string `json:"commit,omitempty"`
}

ThreadFix is a review thread handed to a session. Commit is empty until the agent marks the commit that fixes it; the thread is resolved once the pull request's head contains that commit.

type ThreadFixOptions added in v0.79.0

type ThreadFixOptions struct {
	Path      string `json:"path"`
	Number    int    `json:"number"`
	ThreadID  string `json:"threadId"`
	CommentID int64  `json:"commentId"`
}

ThreadFixOptions names a review thread just handed to a session: ThreadID is its GraphQL node id (what resolving takes), CommentID the database id of a comment in it (what a reply takes).

type ThreadTally

type ThreadTally struct {
	Open  int `json:"open"`
	Total int `json:"total"`
}

ThreadTally is how many of a pull request's review threads are still open.

type TouchedAnswer

type TouchedAnswer struct {
	Note string `json:"note"`
}

TouchedAnswer is the 200 body of a touch that has something to say.

type TouchedRequest

type TouchedRequest struct {
	SessionID string   `json:"session_id"`
	Paths     []string `json:"paths"`
	Hold      bool     `json:"hold"`
	Collect   bool     `json:"collect"`
}

TouchedRequest is one /session-touched call (docs/hooks/session-touched.md, Request): a file-mutating tool ran, on Paths when the provider names them. Hold keeps the note for a later Collect, for a provider that cannot show text from the hook that reports the edit.

type TranscriptMatch

type TranscriptMatch struct {
	ID      string `json:"id"`
	Snippet string `json:"snippet"`
	Count   int    `json:"count"`
}

TranscriptMatch is one session whose conversation mentions the query: the session id to jump to, the newest matching message trimmed to a line, and how many of its messages matched.

type TrayLabels

type TrayLabels struct {
	Show            string `json:"show"`
	Quit            string `json:"quit"`
	NoSessions      string `json:"noSessions"`
	NeedsYou        string `json:"needsYou"`
	Working         string `json:"working"`
	Idle            string `json:"idle"`
	More            string `json:"more"`
	Waiting         string `json:"waiting"`
	Done            string `json:"done"`
	ServicesRunning string `json:"servicesRunning"`
	ShowOutput      string `json:"showOutput"`
	Restart         string `json:"restart"`
	Stop            string `json:"stop"`
	StopAll         string `json:"stopAll"`
}

TrayLabels are the tray menu's words, in the interface language. Idle, More and ServicesRunning carry a {count} placeholder and are written so they need no plural form.

type TurnState

type TurnState struct {
	ID     string        `json:"id"`
	State  string        `json:"state,omitempty"`
	Tool   string        `json:"tool,omitempty"`
	Detail string        `json:"detail,omitempty"`
	Reason string        `json:"reason,omitempty"`
	Since  int64         `json:"since,omitempty"`
	Usage  *SessionUsage `json:"usage,omitempty"`
	Cwd    string        `json:"cwd,omitempty"`
	Host   string        `json:"host,omitempty"`
}

TurnState is what the window missed about one live session while it was not attached to /events: the last session-status report (State is empty for a session that never reported) and the readout the last session-usage event carried (nil when there is none to read). Since is when the session entered State, in Unix milliseconds. Cwd and Host are its last session-cwd report.

type UnlinkPullRequestOptions

type UnlinkPullRequestOptions struct {
	Session string `json:"session"`
	URL     string `json:"url"`
}

UnlinkPullRequestOptions hides the pull request at URL from Session, a hand-linked one or the one its branch has.

type UnmarkViewedOptions

type UnmarkViewedOptions struct {
	PR   string `json:"pr"`
	Path string `json:"path"`
}

UnmarkViewedOptions unticks Path of pull request PR.

type UpdateProfileOptions

type UpdateProfileOptions struct {
	Slug   string        `json:"slug"`
	Update ProfileUpdate `json:"update"`
}

UpdateProfileOptions changes profile Slug as Update says.

type UpdateThemeOptions

type UpdateThemeOptions struct {
	ID string `json:"id"`
}

UpdateThemeOptions names a theme whose repository is cloned again.

type UseResetOptions

type UseResetOptions struct {
	Profile string `json:"profile"`
	GrantID string `json:"grantId"`
}

UseResetOptions names the Claude Code profile ("personal" for the machine's own) and the grant of limit resets (QuotaReset.ID) to spend one of.

type UseResetResult

type UseResetResult struct {
	Status        string `json:"status"`
	CooldownUntil string `json:"cooldownUntil,omitempty"`
}

UseResetResult is how the provider answered, one of the UseReset* statuses. CooldownUntil is RFC 3339 and only set with UseResetCooldown, when the provider said when to try again.

type ViewedFile

type ViewedFile struct {
	Path     string `json:"path"`
	Hash     string `json:"hash"`
	ViewedAt int64  `json:"viewedAt"`
}

ViewedFile is a file of a pull request ticked as viewed, ViewedAt in Unix seconds.

type ViewedFilesOptions

type ViewedFilesOptions struct {
	PR string `json:"pr"`
}

ViewedFilesOptions names a pull request by its page URL, which holds the forge, the repository and the number.

type WaitOptions

type WaitOptions struct {
	Ticket      string `json:"ticket"`
	WaitSeconds int    `json:"waitSeconds"`
}

WaitOptions is one Wait call, an object for the reason SendOptions is one.

type WorkdirOptions

type WorkdirOptions struct {
	Cwd string `json:"cwd"`
}

WorkdirOptions names a session's working directory.

type Worktree

type Worktree struct {
	Name string `json:"name"`
	Path string `json:"path"`
	// Whether CreateWorktree checked out a branch that already existed instead
	// of starting one at the base it was given — the one case where the base
	// the caller picked decided nothing. Always false on a listed worktree.
	Reused bool `json:"reused,omitempty"`
}

Worktree is a git worktree checkout: the branch it holds and its path.

type WorktreeCheckout

type WorktreeCheckout struct {
	Name     string   `json:"name"`
	Path     string   `json:"path"`
	Dirty    bool     `json:"dirty"`
	Sessions []string `json:"sessions"`
}

WorktreeCheckout is one of a project's git worktrees, as a caller outside the window needs to see it: what it is called, where it is, whether anything in it is uncommitted, and which sessions are open in it.

Sessions is what makes the list actionable rather than informational. A checkout with none is one nobody is working in; the last session in one is the thing whose closing decides whether the checkout stays (see Close).

type WorktreeSessionsOptions

type WorktreeSessionsOptions struct {
	ProjectID string `json:"projectId"`
	Path      string `json:"path"`
}

WorktreeSessionsOptions names the sessions of project ProjectID rooted in the checkout at Path.

type WorktreesOptions

type WorktreesOptions struct {
	From    string `json:"from"`
	Project string `json:"project"`
}

WorktreesOptions is one Worktrees call, an object for the reason CloseOptions is one.

type WriteFileOptions

type WriteFileOptions struct {
	Path    string `json:"path"`
	Rel     string `json:"rel"`
	Content string `json:"content"`
}

WriteFileOptions writes Content over file Rel of the checkout at Path.

type WriteOptions

type WriteOptions struct {
	ID   string `json:"id"`
	Data string `json:"data"`
}

WriteOptions types Data into session ID's PTY.

Jump to

Keyboard shortcuts

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