{"modulePath":"github.com/lichdotdev/lich","version":"v0.93.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package agentplugin\n\nPackage 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.\n\nTwo install shapes, decided by the harness rather than by lich:\n\n  - Claude Code and Codex are driven through their own plugin CLI, the supported interface, so lich never edits their state files by hand.\n  - 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. opencode, oh-my-pi, Crush and Kiro also get the plugin's theme skill in their skills directory (skill.go). 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.\n\n## Constants\n\n```go\nconst (\n\t// PluginVersionFloor is the oldest plugin release this lich supports: the\n\t// first to name itself in the X-Lich-Plugin header, so every supported\n\t// install says which release a report comes from.\n\tPluginVersionFloor = \"0.13.0\"\n\t// PluginVersionCeiling is the first release past the newest contract this\n\t// lich implements (0.21), and the first one it cannot vouch for.\n\tPluginVersionCeiling = \"0.22.0\"\n\t// ModAnswerRelease is the first release whose mod answers a subagent\n\t// worker's errand itself (docs/hooks/mod-answer.md).\n\tModAnswerRelease = \"0.17.0\"\n)\n```\nThe 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.\n\n```go\nconst ExtensionSkillRelease = \"0.21.1\"\n```\nExtensionSkillRelease is the first plugin release that ships extensionSkill.\n\n```go\nconst NestedSubagentCardsRelease = \"0.19.0\"\n```\nNestedSubagentCardsRelease 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.\n\n```go\nconst PluginKey = pluginKey\n```\nPluginKey is how Claude Code names the lich plugin, the key a port of a profile's plugins leaves to InstallInClaudeProfile.\n\n```go\nconst SubagentCardsRelease = \"0.15.0\"\n```\nSubagentCardsRelease is the first lich-plugin release whose Claude Code mod runs a general-purpose subagent as a lich session (hooks/agent-cards.js).\n\n## Functions\n\n```go\nfunc ClaudeInstalledIn(dir string) bool\n```\nClaudeInstalledIn reports whether the plugin is installed in the Claude Code config directory dir, a profile's own plugin state.\n\n```go\nfunc ClaudeNestsSubagentCards(profileDir string) bool\n```\nClaudeNestsSubagentCards reports whether the Claude Code plugin installed in profileDir (\"\" for Personal) is a release a worker can open cards from. It reads Claude Code's plugin state on each call.\n\n```go\nfunc ClaudeRunsSubagentCards(profileDir string) bool\n```\nClaudeRunsSubagentCards reports whether the Claude Code plugin installed in profileDir (\"\" for Personal) is a release whose mod turns subagents into lich sessions. It reads Claude Code's plugin state on each call.\n\n```go\nfunc Compatible(version string) bool\n```\nCompatible reports whether a plugin release speaks the contract this lich implements. An unreadable version sorts as 0.0.0 and is not compatible.\n\n```go\nfunc MCPServers(provider, cwd, profileDir string) []string\n```\nMCPServers 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. profileDir is the profile the session runs in, \"\" for Personal.\n\n## Types\n\n```go\ntype BinResolver interface {\n\tProviderBin(providerID, projectID string) string\n}\n```\nBinResolver 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\".\n\n```go\ntype ProfileFailure = api.PluginProfileFailure\n```\n\n```go\ntype ProfilesEvent = api.PluginProfiles\n```\n\n```go\ntype Service struct {\n\t// contains filtered or unexported fields\n}\n```\nService reports and manages the lich plugin's install state per provider.\n\n```go\nfunc New(bins BinResolver) *Service\n```\nNew returns a service that shells out through bins.\n\n```go\nfunc (s *Service) ClaudeProfileStatus(slug string) (Status, error)\n```\nClaudeProfileStatus is Status's Claude Code row for one profile: a profile has a plugin set of its own.\n\n```go\nfunc (s *Service) HasTools(provider string) bool\n```\nHasTools 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.\n\nTrue for the three lich registers at spawn, and for the ones that get them with the plugin, once the installed one is new enough.\n\n```go\nfunc (s *Service) Install(_ context.Context, opts api.PluginProviderOptions) (api.None, error)\n```\nInstall puts the plugin into a provider: through its plugin CLI where there is one, by writing the released files where there is not.\n\n```go\nfunc (s *Service) InstallInClaudeProfile(slug string) error\n```\nInstallInClaudeProfile 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.\n\n```go\nfunc (s *Service) InstallInCodexProfile(slug string) error\n```\nInstallInCodexProfile 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.\n\n```go\nfunc (s *Service) Installed(provider string) bool\n```\nInstalled 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.\n\nIt 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.\n\n```go\nfunc (s *Service) RepairRegistrations()\n```\nRepairRegistrations 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.\n\n```go\nfunc (s *Service) SetEmit(emit func(name string, data any))\n```\nSetEmit wires where a pass over the profiles reports (api.PluginProfilesEvent). Startup wiring; without it Install reaches Personal alone.\n\n```go\nfunc (s *Service) Status(_ context.Context, _ api.None) ([]Status, error)\n```\nStatus answers status over RPC.\n\n```go\nfunc (s *Service) SyncProfiles()\n```\nSyncProfiles 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.\n\n```go\nfunc (s *Service) Update(ctx context.Context, opts api.PluginProviderOptions) (api.None, error)\n```\nUpdate 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).\n\n```go\ntype Status = api.PluginStatus\n```\n\n","path":"github.com/lichdotdev/lich/internal/agentplugin","name":"agentplugin","synopsis":"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.","isRedistributable":true}
