library

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: 22 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 library is lich's own library of skills and MCP servers: what lich holds in <config>/lich/library, what each provider has installed in its own config that is not there yet (found.go), moving one in, turning each item on or off per provider and per profile, and handing the ones on to a session (deliver.go).

The library is shared by every profile; the switches live in lich.db, one settings key per item, provider and profile. A switch never stored is off: an item reaches only the providers it was moved in from until someone turns it on elsewhere.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delivery

type Delivery struct {
	// PluginDir is a Claude Code plugin holding the skills, for --plugin-dir.
	PluginDir string
	// SkillsDir is the folder of skills, for opencode's skills.paths.
	SkillsDir string
	// OMPConfig is an omp --config overlay naming SkillsDir.
	OMPConfig string
	// CrushSkills is the folder for CRUSH_SKILLS_DIR: Crush's own global
	// skills and the library's, since the variable replaces Crush's search.
	CrushSkills string
	// MCP are the servers for the providers that take them at spawn.
	MCP map[string]Server
}

Delivery is what one spawn hands its provider.

type Server

type Server struct {
	Type    string            `json:"type,omitempty"`
	Command string            `json:"command,omitempty"`
	Args    []string          `json:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty"`
	URL     string            `json:"url,omitempty"`
}

Server is one MCP server as the library keeps it.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the library over one config directory.

func New

func New(settings Settings, emit func(name string, data any), profiles func(string) []api.Profile, pluginDir func() string) *Service

New returns the library, reporting changes through emit.

func (*Service) Deliver

func (s *Service) Deliver(provider, profile, profileDir string) Delivery

Deliver works out provider's items for a session in profile (its slug, "" for Personal), whose own config directory is profileDir ("" for Personal's), and writes what the provider can only read from its config. A failure costs the session those items, never its spawn.

func (*Service) List

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

List answers the library, what the providers hold beside it and lich's own plugin, over RPC.

func (*Service) MoveIn

func (s *Service) MoveIn(_ context.Context, opts api.LibraryItemOptions) (api.None, error)

MoveIn copies a found item into the library, turns it off in every provider it was found in, and turns it on in lich for those providers, over RPC.

func (*Service) On

func (s *Service) On(kind, name, provider, profile string) bool

On is whether item reaches provider's sessions in profile ("" for the provider as a whole): the profile's own switch once it was set, else the provider's, which a move in sets for every profile at once.

func (*Service) Seen

func (s *Service) Seen(_ context.Context, opts api.LibrarySeenOptions) (api.None, error)

Seen records every item of kind found now as seen, over RPC.

func (*Service) Set

Set turns an item on or off for a provider, or one of its profiles, over RPC; it reaches the provider's next session.

func (*Service) Watch

func (s *Service) Watch(ctx context.Context)

Watch reports on api.LibraryChangedEvent each time what the providers hold beside the library changes, until ctx ends.

type Settings

type Settings interface {
	GetSetting(ctx context.Context, opts api.GetSettingOptions) (string, error)
	SetSetting(ctx context.Context, opts api.SetSettingOptions) (api.None, error)
}

Settings is where the switches are kept: the store's global settings.

Jump to

Keyboard shortcuts

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