api

package
v0.79.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: AGPL-3.0 Imports: 4 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 (
	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 (
	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.

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 (
	// SessionStatusEvent carries a session's processing state ({id, state, tool,
	// detail, reason} — "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")

	// 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")

	// 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")

	// 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")

	// 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")

	// 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")

	// 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 (
	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")
	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")
	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")
	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")
	ProjectPullRequestDiff          = define[NumberOptions, string]("project.PullRequestDiff")
	ProjectPullRequestMergeBase     = define[NumberOptions, string]("project.PullRequestMergeBase")
	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")
)
View Source
var (
	QuotaPlans            = define[QuotaPlansOptions, []QuotaPlan]("quota.Plans")
	QuotaProfilePlan      = define[ProfilePlanOptions, QuotaPlan]("quota.ProfilePlan")
	QuotaCodexProfilePlan = define[ProfilePlanOptions, QuotaPlan]("quota.CodexProfilePlan")
)
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")
	RelayAnnounceMerge = define[AnnounceMergeOptions, None]("relay.AnnounceMerge")
	RelaySubmit        = define[SubmitOptions, None]("relay.Submit")
)
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")
)
View Source
var (
	SpawnOpen         = define[OpenSessionOptions, OpenedSession]("spawn.Open")
	SpawnOpenSubagent = define[OpenSubagentOptions, OpenedSession]("spawn.OpenSubagent")
	SpawnClose        = define[CloseSessionOptions, ClosedSession]("spawn.Close")
	SpawnControl      = define[ControlSessionOptions, ControlledSession]("spawn.Control")
	SpawnAsk          = define[AskSessionOptions, SessionAnswer]("spawn.Ask")
	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")
)
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[SearchTermOptions, 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")
	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")
	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")
)
View Source
var (
	ProjectAwaitThreadFix = define[ThreadFixOptions, None]("project.AwaitThreadFix")
	ProjectThreadFixes    = define[None, []ThreadFix]("project.ThreadFixes")

	// ThreadFixesEvent carries every review thread waiting for its fix, emitted
	// once one starts waiting or stops: resolved by a push, or dropped with
	// its pull request.
	ThreadFixesEvent = defineEvent[[]ThreadFix]("thread-fixes")
)
View Source
var DropAttach = define[AttachDropOptions, DropAttachment]("drop.Attach")
View Source
var PatchNotesCurrent = define[PatchNotesOptions, PatchNotes]("patchnotes.Current")

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.

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"`
}

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"`
	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 AskSessionOptions

type AskSessionOptions struct {
	From     string `json:"from"`
	Target   string `json:"target"`
	Project  string `json:"project"`
	Question string `json:"question"`
}

AskSessionOptions is one Ask call, an object for the reason CloseOptions is one.

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 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 CarryUncommittedOptions

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

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

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 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 CloseSessionOptions

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

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 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 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 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 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"`
	CommandID string `json:"command_id"`
	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, and CommandID the id the session's mod acks it under.

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"`
}

CreateWorktreeOptions creates worktree Name of the project at ProjectPath, branched from Base (a remote branch when BaseIsRemote).

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"`
}

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.

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"`
}

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 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 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 GetSettingOptions

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

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

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 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 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"`
}

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.

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"`
	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"`
	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"`
	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 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"`
	// 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"`
	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"`
}

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"`
}

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 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 PullRequest

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

PullRequest is the GitHub pull request of a work tree's current branch, as reported by the gh CLI, 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 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"`
	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 QuotaWindow

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

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

Label is the window's name as the provider frames it ("Session", "Weekly"), or the display name of the model a scoped window belongs to. 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. Ahead is lich's own reading of the rate rather than the provider's — 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 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 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"`
}

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"`
	// 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"`
}

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 SessionAnswer

type SessionAnswer struct {
	ID      string `json:"id"`
	Project string `json:"project"`
	Label   string `json:"label"`
	Answer  string `json:"answer"`
}

SessionAnswer is a session's answer to a side question.

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 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 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"`
}

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"`
}

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.

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 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 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 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 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"`
}

Theme describes every color value the window needs to paint the app and the terminal.

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 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"`
	Head      string `json:"head"`
}

ThreadFix is a review thread waiting for the pull request's next push, which resolves it. Head is the commit the pull request stood on when the thread was sent.

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 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"`
	Running         string `json:"running"`
	Quit            string `json:"quit"`
	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. Running 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 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 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 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