Documentation
¶
Overview ¶
Package ompprofile keeps more than one oh-my-pi login on one machine, the way internal/claudeprofile does for Claude Code. omp has profiles of its own: a name in OMP_PROFILE (or --profile) moves its whole state to ~/.omp/profiles/<name>, with its own agent.db holding the logins, its own sessions and settings, and nothing else in the session reads anything from there. A lich profile is one of those directories, which lich creates and links against Personal's.
The default profile, Personal, is whatever omp reads without lich's help: the named profile in lich's own environment if there is one, else PI_CODING_AGENT_DIR, else ~/.omp/agent.
Index ¶
- Constants
- Variables
- func ConfigDir(slug string) (string, error)
- func Delete(slug string) error
- func Dir(slug string) (string, error)
- func EnsureShared(slug string) error
- func Env(base []string, dir string) []string
- func IsPersonal(slug string) bool
- func MoveConversation(conversationID, toSlug string) error
- func PersonalDir() (string, error)
- func Root() (string, error)
- func SessionIn(dir, conversationID string) (string, bool)
- type BinResolver
- type Info
- type Profile
- type Service
- func (s *Service) CreateProfile(_ context.Context, opts api.CreateProfileOptions) (Profile, error)
- func (s *Service) DeleteProfile(_ context.Context, opts api.ProfileSlugOptions) (api.None, error)
- func (s *Service) LoginCommand(_ context.Context, opts api.ProfileSlugOptions) (string, error)
- func (s *Service) Profiles(_ context.Context, _ api.None) ([]Info, error)
- func (s *Service) SetSessions(inUse func(slug string) int, forget func(slug string) error)
- func (s *Service) UpdateProfile(_ context.Context, opts api.UpdateProfileOptions) (Profile, error)
Constants ¶
const HomeVar = "OMP_PROFILE"
HomeVar is the variable that names omp's profile. Unlike the other providers' it holds the profile's name, not its directory: omp puts that under ~/.omp itself.
const Personal = profilestore.Personal
Personal is the slug of the default profile. It is reserved: no profile lich creates can take it, which is what lets a project setting name Personal explicitly where an empty value means "inherit the global one".
Variables ¶
var ErrProfileGone = profilestore.ErrGone
ErrProfileGone is the error a spawn returns for a session born in a profile that was deleted since. The window matches it to offer a new session in the project's own profile instead.
Functions ¶
func ConfigDir ¶
ConfigDir is a profile's agent directory, Personal's included. A profile that does not exist answers ErrProfileGone.
func Delete ¶
Delete removes a profile with its login, its sessions and everything omp kept under ~/.omp/profiles/<slug>. Personal cannot be deleted.
func Dir ¶
Dir is the agent directory of a profile lich created. It does not check that the profile exists; ConfigDir does.
func EnsureShared ¶
EnsureShared links into a profile the shared entries Personal gained since the profile was made, which runs before every spawn into it.
func Env ¶
Env is base with OMP_PROFILE naming the profile whose agent directory is dir and the variables that would override its login removed.
func IsPersonal ¶
IsPersonal reports whether slug names the default profile. Empty does too: it is what every session row born before profiles carries.
func MoveConversation ¶
MoveConversation moves an oh-my-pi conversation from the profile that holds it to another: its session file and the directory of artifacts beside it (named after the file, holding the sub-agents' sessions and tool output), and a copy of every image blob the session refers to. Resume finds a session only in the active profile's own sessions directory, so the move is what makes the conversation resumable there.
What stays behind is what is not keyed by the id: the prompt history (history.db) and the blobs themselves, which other sessions of the source may still refer to.
func PersonalDir ¶
PersonalDir is the default profile's agent directory: what omp resolves from lich's own environment. A named profile wins outright over the explicit override, then the default, in the precedence `omp config path` was measured to apply (18.8.9).
Types ¶
type BinResolver ¶
BinResolver supplies the omp binary: the configured one, or "" for the default name on PATH. The store implements it.
type Info ¶
type Info = api.ProfileInfo
type Profile ¶
type Profile = profilestore.Profile
Profile is one oh-my-pi login lich knows about. Its Dir is the profile's agent directory (~/.omp/profiles/<slug>/agent): sessions, settings and agent.db.
func ConfigDirs ¶
func ConfigDirs() []Profile
ConfigDirs is every profile, Personal first. Every reader of omp's sessions scans all of them: a conversation lives in exactly one, and which one is what says the profile it belongs to.
func Create ¶
Create makes a profile named name: its agent directory, laid out against Personal's, and its sidecar. It does not log in.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the window's door to the oh-my-pi profiles: listing them with their logins, creating, renaming and deleting them, and the command that logs one in. There is no login lich runs itself: `omp login` is an interactive picker of providers, so a login is only ever offered in a terminal card.
func New ¶
func New(bins BinResolver, emit func(name string, data any)) *Service
New returns a Service that runs the omp binary bins resolves and reports a profile's update through emit.
func (*Service) CreateProfile ¶
CreateProfile makes a profile and lays it out against Personal. The window logs it in next, in a terminal card (LoginCommand).
func (*Service) DeleteProfile ¶
DeleteProfile removes a profile and its logins, and clears every setting that named it, so a project set to it falls back to the global profile. It refuses while a session runs in it. A parked session born in it fails to resume with ErrProfileGone.
func (*Service) LoginCommand ¶
LoginCommand is the command line that logs a profile in from a terminal: it opens omp's own picker of providers.
func (*Service) Profiles ¶
Profiles lists every profile with its logins. The statuses are asked for at once, one CLI each.
func (*Service) SetSessions ¶
SetSessions wires the two questions a delete asks: how many live sessions run in a profile, and how to forget the settings that name it. Startup wiring.
func (*Service) UpdateProfile ¶ added in v0.75.0
UpdateProfile changes a profile's name, color or image and returns it; its directory never moves.