agentplugin

package
v0.94.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: AGPL-3.0 Imports: 32 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. Every provider of the registry runs 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.

Three shapes, decided by the harness rather than by lich:

  • Claude Code, Cursor CLI, opencode and oh-my-pi load lich's own copy of the plugin per session (bundle.go), so nothing in their config decides whether a lich session has it. Their install unpacks that copy and takes out what a lich of the past installed there; opencode and oh-my-pi still get the theme skill, and oh-my-pi and Cursor lich's MCP server, in their own directories.
  • Codex is driven through its own plugin CLI, the supported interface, and lich turns the plugin back on before each spawn (reenable.go).
  • Antigravity, Crush and Kiro CLI have lich write the files the release published: a customization directory under Antigravity's global `config/plugins/`, hook scripts plus a delimited block of `hook add` lines into Crush's crushrc, and an agent of lich's own for Kiro. Each carries the version it installed, a marker line or a field in a manifest lich owns outright, 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.23, whose done report says the turn left background
	// work running, docs/hooks/session-state.md), and the first one it cannot
	// vouch for.
	PluginVersionCeiling = "0.24.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 (
	// OMPExtension is the extension's path inside the plugin, and ompFile the
	// name a lich of the past gave it in omp's extensions directory.
	OMPExtension = "omp/lich.js"
)
View Source
const (
	// OpencodeModule is the module's path inside the plugin, and opencodeFile
	// the name a lich of the past gave it in opencode's plugin directory.
	OpencodeModule = "opencode/lich.js"
)
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 BundleDir

func BundleDir() (dir, version string, ok bool)

BundleDir is the plugin release lich hands its sessions: the newest compatible one unpacked, or ok false when none is.

func ClaudeAsksSubagentHook

func ClaudeAsksSubagentHook(profileDir string) bool

ClaudeAsksSubagentHook reports whether the release Claude Code sessions load, in any profile, is one whose hook asks lich. It reads the disk on each call.

func ClaudeInstalledIn

func ClaudeInstalledIn(string) bool

ClaudeInstalledIn reports whether a Claude Code session started in the config directory dir loads the plugin, which it does whenever lich has one.

func ClaudeNestsSubagentCards

func ClaudeNestsSubagentCards(profileDir string) bool

ClaudeNestsSubagentCards reports whether the release Claude Code sessions load, in any profile, is one a worker can open cards from. It reads the disk on each call.

func ClaudeRunsSubagentCards

func ClaudeRunsSubagentCards(profileDir string) bool

ClaudeRunsSubagentCards reports whether the release Claude Code sessions load, in any profile (profileDir, "" for Personal), is one whose mod turns subagents into lich sessions. It reads the disk 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.

func Reenable

func Reenable(kind, profileDir, bin string) (bool, error)

Reenable turns the lich plugin back on for kind's next session, when the person turned it off: in profileDir's Codex config ("" for Personal's), or through bin, Antigravity's CLI ("" for its default name). It reports what it changed, as an error, only when it could not.

Types

type BinResolver

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

BinResolver supplies the binary to shell out to for a provider, and whether the person turned it on. 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 Problem

type Problem = api.PluginProblem

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, which runs the same release Personal does.

func (*Service) Ensure

func (s *Service) Ensure()

Ensure is one pass, skipped while another runs.

func (*Service) EnsureFor

func (s *Service) EnsureFor(kind string)

EnsureFor runs a pass in the background when kind's session is about to start without the plugin, or the last pass failed; "" leaves the provider out of the question. A pass already running is not started again.

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) InstallInClaudeProfile

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

InstallInClaudeProfile readies the plugin for one Claude Code profile, which is the release every session loads, and takes the install of the past out of the profile's own plugin set.

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) Problem

func (s *Service) Problem(_ context.Context, _ api.None) (Problem, error)

Problem answers what the last pass could not do over RPC.

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) Retry

func (s *Service) Retry(_ context.Context, _ api.None) (api.None, error)

Retry runs a pass now, after one already running, and answers once it ran, its outcome on api.PluginProblemEvent as every pass's is.

func (*Service) SetEmit

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

SetEmit wires where a pass reports what it could not do (api.PluginProblemEvent). Startup wiring.

func (*Service) SetInUse

func (s *Service) SetInUse(fn func() []string)

SetInUse wires what names the release directories live sessions were spawned with (terminal.Service.PluginReleasesInUse). Startup wiring.

func (*Service) Status

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

Status answers status over RPC.

func (*Service) Watch

func (s *Service) Watch()

Watch runs a pass now and every ensureEvery after; it never returns.

type Status

type Status = api.PluginStatus

Jump to

Keyboard shortcuts

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