Documentation
¶
Overview ¶
Package agentplugin manages the lich companion plugin inside the provider CLIs that can run it: whether it is installed, whether a newer release exists, and installing or updating it. Six of the registry's seven ship the same plugin from the same repository; what differs per provider — the subcommands, where the installed version is read from, and whether there is a CLI at all — lives in claude.go, codex.go, antigravity.go, opencode.go, omp.go and crush.go.
Two install shapes, decided by the harness rather than by lich:
- Claude Code and Codex are driven through their own plugin CLI, the supported interface, so lich never edits their state files by hand.
- Antigravity, opencode, oh-my-pi and Crush have lich write the files the release published: a customization directory under Antigravity's global `config/plugins/`, a module into opencode's plugin directory, another into oh-my-pi's extensions directory, and hook scripts plus a delimited block of `hook add` lines into Crush's crushrc. Each carries the version it installed — a marker line, or a field in a manifest lich owns outright — which is the only record of what is installed where the harness keeps none. Antigravity does have a plugin CLI; antigravity.go says why it is not the install.
Index ¶
- Constants
- func ClaudeInstalledIn(dir string) bool
- func ClaudeNestsSubagentCards() bool
- func ClaudeRunsSubagentCards() bool
- func Compatible(version string) bool
- func MCPServers(provider, cwd string) []string
- type BinResolver
- type ProfileFailure
- type ProfilesEvent
- type Service
- func (s *Service) ClaudeProfileStatus(slug string) (Status, error)
- func (s *Service) HasTools(provider string) bool
- func (s *Service) Install(_ context.Context, opts api.PluginProviderOptions) (api.None, error)
- func (s *Service) InstallInClaudeProfile(slug string) error
- func (s *Service) InstallInCodexProfile(slug string) error
- func (s *Service) Installed(provider string) bool
- func (s *Service) RepairRegistrations()
- func (s *Service) SetEmit(emit func(name string, data any))
- func (s *Service) Status(_ context.Context, _ api.None) ([]Status, error)
- func (s *Service) SyncProfiles()
- func (s *Service) Update(ctx context.Context, opts api.PluginProviderOptions) (api.None, error)
- type Status
Constants ¶
const ( // PluginVersionFloor is the oldest plugin release this lich supports: the // first to name itself in the X-Lich-Plugin header, so every supported // install says which release a report comes from. PluginVersionFloor = "0.13.0" // PluginVersionCeiling is the first release past the newest contract this // lich implements (0.20), and the first one it cannot vouch for. PluginVersionCeiling = "0.21.0" // ModAnswerRelease is the first release whose mod answers a subagent // worker's errand itself (docs/hooks/mod-answer.md). ModAnswerRelease = "0.17.0" )
The plugin releases this lich speaks the hook contract with (docs/hooks/README.md, Versioning). The plugin bumps its minor for a contract change (its major, from 1.0) and its patch for anything else, so every release below the ceiling sends only what this lich accepts.
const NestedSubagentCardsRelease = "0.19.0"
NestedSubagentCardsRelease is the first lich-plugin release whose mod tells a worker by LICH_SUBAGENT_DEPTH rather than by LICH_SUBAGENT_CARDS=off (hooks/worker-answer.js), so a worker can open cards of its own and still answer its errand. An older one reads a worker without that variable as a session that answers nothing.
const PluginKey = pluginKey
PluginKey is how Claude Code names the lich plugin, the key a port of a profile's plugins leaves to InstallInClaudeProfile.
const SubagentCardsRelease = "0.15.0"
SubagentCardsRelease is the first lich-plugin release whose Claude Code mod runs a general-purpose subagent as a lich session (hooks/agent-cards.js).
Variables ¶
This section is empty.
Functions ¶
func ClaudeInstalledIn ¶
ClaudeInstalledIn reports whether the plugin is installed in the Claude Code config directory dir, a profile's own plugin state.
func ClaudeNestsSubagentCards ¶
func ClaudeNestsSubagentCards() bool
ClaudeNestsSubagentCards reports whether the installed Claude Code plugin is a release a worker can open cards from. It reads Claude Code's plugin state on each call.
func ClaudeRunsSubagentCards ¶
func ClaudeRunsSubagentCards() bool
ClaudeRunsSubagentCards reports whether the installed Claude Code plugin is a release whose mod turns subagents into lich sessions. It reads Claude Code's plugin state on each call.
func Compatible ¶
Compatible reports whether a plugin release speaks the contract this lich implements. An unreadable version sorts as 0.0.0 and is not compatible.
func MCPServers ¶
MCPServers names the MCP servers whose tools a session of this provider, started in cwd, can call — sorted, with lich's own always among them, since lich is registered wherever it spawns a session.
Types ¶
type BinResolver ¶
BinResolver supplies the binary to shell out to for a provider. The store implements it; the empty project id asks for the global value, and an empty return means "the provider's default name on PATH".
type ProfileFailure ¶
type ProfileFailure = api.PluginProfileFailure
type ProfilesEvent ¶
type ProfilesEvent = api.PluginProfiles
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service reports and manages the lich plugin's install state per provider.
func (*Service) ClaudeProfileStatus ¶
ClaudeProfileStatus is Status's Claude Code row for one profile: a profile has a plugin set of its own.
func (*Service) HasTools ¶
HasTools reports whether a provider's sessions can call lich's own operations — whether a relayed message may name a tool rather than the command line.
True for the two lich registers at spawn, and for the three that get them with the plugin, once the installed one is new enough.
func (*Service) Install ¶
Install puts the plugin into a provider: through its plugin CLI where there is one, by writing the released files where there is not.
func (*Service) InstallInClaudeProfile ¶
InstallInClaudeProfile installs the plugin into one Claude Code profile, run as that profile so its account's plugin policy applies. It is the install and the update both, as Install is for Personal.
func (*Service) InstallInCodexProfile ¶
InstallInCodexProfile installs the plugin into one Codex profile, run as that profile: a profile has a plugin set and downloads of its own, so the pinned reinstall there never touches Personal's. It is the install and the update both, as Install is for Personal.
func (*Service) Installed ¶
Installed reports whether the lich plugin is installed for a provider — that its sessions report what they are doing (docs/hooks/). The relay asks before reading a session's silence as an answer: a provider that never reports is silent whatever happens in it.
It reads the provider's own plugin state — a file for Claude Code, opencode and oh-my-pi, a CLI call for Codex and Crush — so it is not for a hot path. The relay asks it once per errand, and HasTools once more before that; neither question is cached, so each one pays for itself.
func (*Service) RepairRegistrations ¶
func (s *Service) RepairRegistrations()
RepairRegistrations rewrites every lich MCP registration that names a binary other than this one. It runs once at startup, off the prompt: Crush's config directory and two of the rewrites are CLI calls.
func (*Service) SetEmit ¶
SetEmit wires where a pass over the profiles reports (api.PluginProfilesEvent). Startup wiring; without it Install reaches Personal alone.
func (*Service) SyncProfiles ¶
func (s *Service) SyncProfiles()
SyncProfiles brings every profile of every provider that has them to the release Personal's plugin is at, installing it where it is missing: a profile logged in before it got the plugin at login has none. It runs at backend start, off the request path, and reports like an update does.
func (*Service) Update ¶
Update pulls the newest compatible release into a provider, which is the same write as an install for every harness: the file-shipped ones replace their files wholesale, and Claude Code and Codex re-pin the marketplace (claudePinMarketplace). Every one applies it on the next session (a restart is required, which the UI signals).
type Status ¶
type Status = api.PluginStatus