ompprofile

package
v0.93.0-rc.14 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 21 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 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

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

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

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

func ConfigDir(slug string) (string, error)

ConfigDir is a profile's agent directory, Personal's included. A profile that does not exist answers ErrProfileGone.

func Delete

func Delete(slug string) error

Delete removes a profile with its login, its sessions and everything omp kept under ~/.omp/profiles/<slug>. Personal cannot be deleted.

func Dir

func Dir(slug string) (string, error)

Dir is the agent directory of a profile lich created. It does not check that the profile exists; ConfigDir does.

func EnsureShared

func EnsureShared(slug string) error

EnsureShared links into a profile the shared entries Personal gained since the profile was made, which runs before every spawn into it.

func Env

func Env(base []string, dir string) []string

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

func IsPersonal(slug string) bool

IsPersonal reports whether slug names the default profile. Empty does too: it is what every session row born before profiles carries.

func MoveConversation

func MoveConversation(conversationID, toSlug string) error

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

func PersonalDir() (string, error)

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

func Root

func Root() (string, error)

Root is where lich keeps its oh-my-pi profile sidecars. The profiles' directories are omp's, under ~/.omp/profiles.

func SessionIn

func SessionIn(dir, conversationID string) (string, bool)

SessionIn locates a conversation's JSONL under one agent directory: one file per session, in a directory named after the cwd it ran in, sessions/<encoded cwd>/<timestamp>_<id>.jsonl.

Types

type BinResolver

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

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

func Create(name string) (Profile, error)

Create makes a profile named name: its agent directory, laid out against Personal's, and its sidecar. It does not log in.

func List

func List() ([]Profile, error)

List is every profile, Personal first and the rest in the order they were created.

func Owner

func Owner(conversationID string) (Profile, string, bool)

Owner is the profile holding an oh-my-pi conversation, and the path of its session file there. A session id is unique, so the first match is the only one.

func Update added in v0.75.0

func Update(slug string, u profilestore.Update) (Profile, error)

Update changes a profile's name, color or image. The slug and the directory stay.

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

func (s *Service) CreateProfile(_ context.Context, opts api.CreateProfileOptions) (Profile, error)

CreateProfile makes a profile and lays it out against Personal. The window logs it in next, in a terminal card (LoginCommand).

func (*Service) DeleteProfile

func (s *Service) DeleteProfile(_ context.Context, opts api.ProfileSlugOptions) (api.None, error)

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

func (s *Service) LoginCommand(_ context.Context, opts api.ProfileSlugOptions) (string, error)

LoginCommand is the command line that logs a profile in from a terminal: it opens omp's own picker of providers.

func (*Service) Profiles

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

Profiles lists every profile with its logins. The statuses are asked for at once, one CLI each.

func (*Service) SetSessions

func (s *Service) SetSessions(inUse func(slug string) int, forget func(slug string) error)

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

func (s *Service) UpdateProfile(_ context.Context, opts api.UpdateProfileOptions) (Profile, error)

UpdateProfile changes a profile's name, color or image and returns it; its directory never moves.

Jump to

Keyboard shortcuts

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