agentplugin

package
v0.93.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package 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. 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.

Index

Constants

View Source
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.22, whose texts describe the notification envelope,
	// whose pre-tool hook asks /subagent and whose touched report names its
	// paths and reads the edit-overlap note), and the first one it cannot vouch
	// for.
	PluginVersionCeiling = "0.23.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.

View Source
const EditNoteRelease = "0.22.0"

EditNoteRelease is the first lich-plugin release whose touched report names the paths it wrote and hands lich's edit-overlap note to the model (docs/hooks/session-touched.md).

View Source
const ExtensionSkillRelease = "0.21.1"

ExtensionSkillRelease is the first plugin release that ships extensionSkill.

View Source
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.

View Source
const PluginKey = pluginKey

PluginKey is how Claude Code names the lich plugin, the key a port of a profile's plugins leaves to InstallInClaudeProfile.

View Source
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).

View Source
const SubagentHookRelease = "0.22.0"

SubagentHookRelease is the first lich-plugin release whose pre-tool hook asks /subagent (docs/hooks/subagent-cards.md) and whose mod no longer converts subagents itself, so LICH_SUBAGENT_CARDS no longer means anything to it.

Variables

This section is empty.

Functions

func ClaudeAsksSubagentHook

func ClaudeAsksSubagentHook(profileDir string) bool

ClaudeAsksSubagentHook reports whether the Claude Code plugin installed in profileDir ("" for Personal) is a release whose hook asks lich. It reads Claude Code's plugin state on each call.

func ClaudeInstalledIn

func ClaudeInstalledIn(dir string) bool

ClaudeInstalledIn reports whether the plugin is installed in the Claude Code config directory dir, a profile's own plugin state.

func ClaudeNestsSubagentCards

func ClaudeNestsSubagentCards(profileDir string) bool

ClaudeNestsSubagentCards 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.

func ClaudeRunsSubagentCards

func ClaudeRunsSubagentCards(profileDir string) bool

ClaudeRunsSubagentCards 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.

func Compatible

func Compatible(version string) bool

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

func MCPServers(provider, cwd, profileDir string) []string

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. profileDir is the profile the session runs in, "" for Personal.

Types

type BinResolver

type BinResolver interface {
	ProviderBin(providerID, projectID string) string
}

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 New

func New(bins BinResolver) *Service

New returns a service that shells out through bins.

func (*Service) ClaudeProfileStatus

func (s *Service) ClaudeProfileStatus(slug string) (Status, error)

ClaudeProfileStatus is Status's Claude Code row for one profile: a profile has a plugin set of its own.

func (*Service) HasTools

func (s *Service) HasTools(provider string) bool

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 three lich registers at spawn, and for the ones that get them with the plugin, once the installed one is new enough.

func (*Service) Install

func (s *Service) Install(_ context.Context, opts api.PluginProviderOptions) (api.None, error)

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

func (s *Service) InstallInClaudeProfile(slug string) error

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

func (s *Service) InstallInCodexProfile(slug string) error

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

func (s *Service) Installed(provider string) bool

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.

A Crush block written for a Crush without the lifecycle events reports no state, so it reads as not installed here (crushReportsState).

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

func (s *Service) SetEmit(emit func(name string, data any))

SetEmit wires where a pass over the profiles reports (api.PluginProfilesEvent). Startup wiring; without it Install reaches Personal alone.

func (*Service) Status

func (s *Service) Status(_ context.Context, _ api.None) ([]Status, error)

Status answers status over RPC.

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

func (s *Service) Update(ctx context.Context, opts api.PluginProviderOptions) (api.None, error)

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

Jump to

Keyboard shortcuts

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