profiles

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 28 Imported by: 1 module, 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

Index

Constants

View Source
const (
	ManifestFilename    = "distribution.yaml"
	EnvTemplateFilename = ".env.template"
	EnvExampleFilename  = ".env.EXAMPLE"
)
View Source
const NoBundledSkillsMarker = ".no-bundled-skills"

Marker file at a profile root opting out of bundled skill seeding

View Source
const PlaceholderEnv = "# Per-profile secrets for this icebath profile.\n" +
	"# API keys and tokens set here override the shell environment.\n" +
	"# Behavioral settings belong in config.yaml, not here.\n"

Header seeded into the empty env file of a new profile

View Source
const RetiredRequiresKey = "hermes_requires"

Text of a manifest key, default when the value is falsy Version floor key distribution manifests written before the rename carry, read when icebath_requires is unset

Variables

View Source
var CLISubcommands = map[string]bool{
	"chat": true, "model": true, "gateway": true, "whatsapp": true, "login": true, "logout": true,
	"status": true, "cron": true, "doctor": true, "dump": true, "config": true, "pairing": true, "skills": true, "tools": true,
	"mcp": true, "sessions": true, "insights": true, "version": true, "update": true, "uninstall": true,
	"profile": true, "plugins": true, "acp": true,
}

Top level icebath subcommands an alias must not shadow

View Source
var CloneAllDefaultExcludeRoot = map[string]bool{
	"icebath-agent": true, ".worktrees": true, "profiles": true, "bin": true, "node_modules": true,
	".icebath-runtime": true, "node": true, "models": true, "runtimes": true,
}

Root entries of the default home never copied by a full clone

View Source
var CloneAllHistoryExcludeRoot = map[string]bool{
	"state.db": true, "state.db-wal": true, "state.db-shm": true, "sessions": true, "backups": true,
	"state-snapshots": true, "checkpoints": true, "cron": true, "webapp": true,
}

Per profile history and stored Webapp sign in state never copied by a full clone from any source

View Source
var CloneAllStrip = []string{
	"gateway.pid", "gateway_state.json", "processes.json",
	"bot-desktop/launcher.pid", "bot-desktop/env", "bot-desktop/rfb.sock",
	"bot-desktop/lease.json", "bot-desktop/lease.lock",
	"bot-desktop/browser-profile/DevToolsActivePort",
	"bot-desktop/browser-profile/SingletonLock",
	"bot-desktop/browser-profile/SingletonCookie",
	"bot-desktop/browser-profile/SingletonSocket",
}

Runtime files stripped after a full clone so the copy never attaches to the source processes

View Source
var CloneConfigFiles = []string{"config.yaml", ".env", "SOUL.md"}

Files copied by a config clone when the source has them

View Source
var CloneSubdirFiles = []string{"memories/MEMORY.md", "memories/USER.md"}

Memory files copied by a config clone

View Source
var CronDistributionHooks struct {
	LoadJobs             func(ctx context.Context, home string) ([]any, error)
	ImportJobDefinitions func(ctx context.Context, home string, shipped *pyjson.Object, pausedReason string) error
}

Cron store access pkg/cron installs in init for the distribution installer, nil in a binary that does not link it

View Source
var DefaultExportExcludeRoot = func() map[string]bool {
	out := map[string]bool{}
	for _, n := range []string{
		"icebath-agent", ".worktrees", "profiles", "bin", "node_modules", ".icebath-runtime", "node",
		"state.db", "state.db-shm", "state.db-wal", "icebath_state.db",
		"response_store.db", "response_store.db-shm", "response_store.db-wal",
		"gateway.pid", "gateway_state.json", "processes.json", "auth.json", ".env",
		"auth.lock", "active_profile", ".update_check", "source-checks", "errors.log", ".icebath_history",
		"image_cache", "audio_cache", "document_cache", "browser_screenshots", "checkpoints", "sandboxes", "logs",
	} {
		out[n] = true
	}
	for n := range PMRuntimeRootDirs {
		out[n] = true
	}
	return out
}()

Root entries of the default home a full export never carries

View Source
var DefaultExportIncludeRoot = map[string]bool{
	"config.yaml": true, "SOUL.md": true, "MEMORY.md": true, "USER.md": true, "todo.json": true,
	"system_prompt.md": true, "AGENTS.md": true, "CLAUDE.md": true, ".cursorrules": true,
	"skills": true, "cron": true, "scripts": true, "sessions": true, "plugins": true, "memories": true,
	"knowledge": true, "preferences": true,
}

Root entries of the default home a default profile export keeps, everything else at the root is dropped

View Source
var GatewayChannelHooks struct {
	PlatformMembers      func() []string
	PlatformEntries      func(ctx context.Context) ([]map[string]any, error)
	EnvEnableCredentials func() [][2]any
}

Gateway platform facts pkg/gateway installs in init, entries and steps as attribute name mappings

View Source
var GatewayServiceHooks struct {
	ServiceName                   func(ctx context.Context) string
	UserSystemdUnitDir            func(ctx context.Context) string
	SystemUnitDir                 func() string
	LaunchdPlistPath              func(ctx context.Context) string
	PinnedHome                    func(definition string) (string, bool)
	WindowsTaskName               func(ctx context.Context) string
	WindowsTaskRegistered         func(ctx context.Context) bool
	ExecSchtasks                  func(args []string) (int, string, string)
	WindowsStartupEntryPath       func(ctx context.Context) string
	WindowsLegacyStartupEntryPath func(ctx context.Context) string
	ServiceManagerDetect          func() (string, error)
	ServiceManagerGet             func() (ProfileServiceManager, error)
}

Gateway service naming and Windows task facts pkg/gatewaycli installs in init, nil in a binary that does not link it

View Source
var GatewayStatusHooks struct {
	ProfileRunning         func(profileDir string) bool
	ServesNamedProfile     func(name string) bool
	NotifyProfilesChanged  func(name string)
	RecordedServedProfiles func() ([]string, bool, error)
	ExclusiveMaintenance   func(dirs []string) (func(), error)
	PidExists              func(pid int) bool
	ProcessStartTime       func(pid int) (int64, bool)
	TerminatePid           func(pid int, force bool, expectedStart *int64) error
	RecordedHomeConflicts  func(record map[string]any, expectedHome string) bool
	Identify               func(root string) (any, error)
	MigrateProfileIdentity func(root, oldName, newName string) (any, error)
	PurgeProfileIdentity   func(root, name string) (any, error)
}

Gateway runtime facts pkg/gateway installs in init, nil in a binary that does not link it

View Source
var OSCredentialStores = osCredentialStores

Home relative OS credential stores dropped from every profile export

View Source
var PMRuntimeRootDirs = map[string]bool{"installs": true, "tools": true, "cache": true}

Package manager runtime trees at a home root, foreign state an export or import never carries

View Source
var ProfileCredentialPaths = func() map[string]bool {
	paths := []string{
		"auth.json", ".env", "auth/google_oauth.json", ".op.env", "npmrc", ".anthropic_oauth.json",
		"google_token.json", "google_oauth_pending.json", "google_client_secret.json",
		"google_chat_user_tokens", "google_chat_user_client_secret.json", "google_chat_user_oauth_pending.json",
		"google_chat_user_token.json", "google_chat_user_oauth_pending",
		"slack_tokens.json", "webhook_subscriptions.json", "teams_pipeline_store.json",
		"mcp-tokens", "vault", "browser-profile", "browser_auth", "bot-desktop", "webapp",
		"browser-profiles", "browser_profiles", "pairing", "platforms/pairing", "feishu_comment_pairing.json",
		"whatsapp/session", "platforms/whatsapp/session", "matrix/store", "platforms/matrix/store",
		"workspace/meetings/node_token.json", "weixin/accounts", ".copilot_jwt.json", "proxy", "chrome-debug",
		"home", "backups", "state-snapshots",
	}
	paths = append(paths, secretCacheStores...)
	paths = append(paths, osCredentialStores...)
	set := map[string]bool{}
	for _, p := range paths {
		set[p] = true
	}
	return set
}()

Profile relative stores holding credentials, never cloned, exported or shared

View Source
var ProfileDirs = []string{"memories", "sessions", "skills", "skins", "logs", "plans", "workspace", "cron", "home"}

Directories bootstrapped inside every new profile

View Source
var ReservedNames = map[string]bool{"icebath": true, "default": true, "test": true, "tmp": true, "root": true, "sudo": true}

Names that collide with the installation itself or a common system binary

Functions

func ActiveProfilePath

func ActiveProfilePath() string

File recording the sticky active profile of the root home

func BuildAliasMap

func BuildAliasMap() (map[string]string, error)

Map from canonical profile to alias read in one pass over the wrapper directory, custom aliases winning

func CanonValid

func CanonValid(name string) (string, error)

Canonical id of name after normalizing and validating it

func Casefold

func Casefold(s string) string

Casefold is Python str.casefold for profile name comparisons outside the package

func CheckAliasCollision

func CheckAliasCollision(name string) (string, error)

Collision message for an alias name, empty when the name is safe to use

func CreateWrapperScript

func CreateWrapperScript(name, target string) (string, error)

Writes the wrapper alias launching profile target, or the alias itself, returning empty after a printed write failure

func CurrentProfileName

func CurrentProfileName(ctx context.Context) string

Profile the current task runs for, the home override first, then a launcher pinned name, then the process home

func DefaultHome

func DefaultHome() string

Root home owning the profile tree, the configured home itself in custom deployments

func ExistingProfileDir

func ExistingProfileDir(name string) (string, string, error)

Canonical id and directory of an existing profile, a not found error otherwise

func FindAliasForProfile

func FindAliasForProfile(profileName string) (string, error)

Alias of the wrapper launching a profile, empty when none does

func FindOurWrapper

func FindOurWrapper(alias string) (string, error)

Generated wrapper of alias, also a bare pre bat wrapper on Windows, empty when none is ours

func FormatProfileLabel

func FormatProfileLabel(name, displayName string) string

Display name followed by the canonical id in parentheses, the bare id when they match or no name is set

func GetActiveProfile

func GetActiveProfile(root string) string

Sticky active profile name of root, the process root when empty, default when unset or unreadable

func GetActiveProfileName

func GetActiveProfileName(ctx context.Context) string

Profile name of the current home, default for the root, the id under profiles, custom for any other path

func GetProfileDir

func GetProfileDir(name string) (string, error)

Home directory of a profile name, the root home for default

func InvalidProfileNameError

func InvalidProfileNameError(name string) error

Error for a name that fails the profile id grammar, with a suggested valid name

func IsWrapperDirInPath

func IsWrapperDirInPath() (bool, error)

Reports whether the wrapper directory is on PATH

func IterNamedProfileDirs

func IterNamedProfileDirs(liveOnly bool) ([]string, error)

Sorted directories of named profiles carrying identity, skipping tombstoned ones when liveOnly

func ListProfileNames

func ListProfileNames() []string

Default plus every live named profile without reading any profile config

func MigrateProfileConfigIfOutdated

func MigrateProfileConfigIfOutdated(ctx context.Context, profileDir string) error

Migrates a copied config.yaml of a new profile to the current schema, never failing creation over the migration

func MissingProfileError

func MissingProfileError(canon string) error

Error for a profile a command needs but that was never created

func NormalizeProfileName

func NormalizeProfileName(name string) (string, error)

Canonical profile id, lowercase with default matched case insensitively

func NormalizeProfileNameValue

func NormalizeProfileNameValue(name any) (string, error)

Canonical profile id of an untyped value, refusing anything but a string so numeric ids never become directories

func ParkedMarkerPath

func ParkedMarkerPath(home string) string

Marker file whose presence parks a profile out of the host gateway

func ProfileExists

func ProfileExists(name string) bool

Reports whether a live profile exists under name, default always existing

func ProfileExistsError

func ProfileExistsError(canon string) error

Error for creating a profile whose name is taken

func ProfileIsParked

func ProfileIsParked(home string) bool

Whether the parked marker exists, its contents never matter

func ProfileIsStandalone

func ProfileIsStandalone(ctx context.Context, home string) (bool, error)

Whether the home config opts out of the host multiplexer, never true for the default profile

func ProfileMatchesHome

func ProfileMatchesHome(ctx context.Context, name, homeDir string) bool

Reports whether name refers to the profile served from homeDir, the current home when empty

func ProfilePathContainsPrivateStore

func ProfilePathContainsPrivateStore(parts []string) bool

Reports whether parts name a strict ancestor of a credential store

func ProfilePathIsPrivate

func ProfilePathIsPrivate(parts []string) bool

Reports whether parts name a credential store, anything below one, or a root copy of one

func ProfileRootForEnvHome

func ProfileRootForEnvHome(envHome, defaultRoot string) string

Root named by an exported home, the grandparent of a profile shaped value, defaultRoot when unset

func ProfilesRoot

func ProfilesRoot() string

Directory holding every named profile under the root home

func ReadConfigModel

func ReadConfigModel(ctx context.Context, profileDir string) (model, provider any, err error)

Model and provider from the profile config.yaml read raw, nil for an absent file or a failed read

func ReadDistributionMeta

func ReadDistributionMeta(profileDir string) (name, version, source any)

Name, version and source from distribution.yaml, all nil when the file is absent or not a mapping

func RemoveWrapperScript

func RemoveWrapperScript(name string) (bool, error)

Removes the generated wrapper of a profile alias, reporting whether one was removed

func ResetFileCache

func ResetFileCache()

Drops every cached derived value

func ResetStandaloneMemo

func ResetStandaloneMemo()

Clears the standalone memo and the one shot warnings

func ResolveProfileEnv

func ResolveProfileEnv(profileName string) (string, error)

Home path of a profile keeping the configured spelling of the root, an error for a missing named profile

func RetargetActiveProfile

func RetargetActiveProfile(old, new, message string)

Points the sticky active profile from old to new and prints message, swallowing every failure

func SecretCacheStores

func SecretCacheStores() []string

Home relative secret cache stores of home_data_layout, a fresh copy per call

func SetActiveProfile

func SetActiveProfile(name string) error

Sets the sticky active profile, default removing the file

func SetProfileDisplayName

func SetProfileDisplayName(ctx context.Context, profileName, displayName string) (string, error)

Stores or clears a presentation only display name, refusing names over 64 characters

func SharedProfileWarning

func SharedProfileWarning(ctx context.Context, homeDir, projectRoot string) string

Warning when another live install verifiably uses the same home, empty otherwise

func SuggestProfileName

func SuggestProfileName(name string) string

Valid profile id derived from a typed name, my-work when nothing usable remains

func UnknownProfileError

func UnknownProfileError(canon string) error

Error for a delete, rename or export naming no profile, likely a typo

func ValidateAliasName

func ValidateAliasName(name string) error

Error unless name is safe as a wrapper file name under the wrapper directory

func ValidateProfileName

func ValidateProfileName(name string) error

Error unless name is a lowercase profile id outside the reserved names, default passing

func WrapperDir

func WrapperDir() (string, error)

Directory holding alias wrapper scripts

func WrapperPath

func WrapperPath(alias string) (string, error)

Wrapper script path of an alias in the wrapper dir

func WriteManifest

func WriteManifest(ctx context.Context, profileDir string, manifest *DistributionManifest) (string, error)

Atomically writes distribution.yaml, keeping an existing file's mode and creating a new one 0644

func WriteProfileMeta

func WriteProfileMeta(ctx context.Context, profileDir string, upd MetaUpdate) error

Updates profile.yaml in place overwriting only the given fields, the profile directory must exist

Types

type DistributionError

type DistributionError struct{ Msg string }

Install, update and manifest failure of a profile distribution

func (*DistributionError) Error

func (e *DistributionError) Error() string

type DistributionManifest

type DistributionManifest struct {
	Name              string
	Version           string
	Description       string
	IcebathRequires   string
	Author            string
	License           string
	EnvRequires       []EnvRequirement
	DistributionOwned []string
	Source            string
	InstalledAt       string
}

Parsed distribution.yaml plus the source and install stamp recorded after install

func DistributionManifestFromDict

func DistributionManifestFromDict(data any) (*DistributionManifest, error)

Manifest of a parsed YAML root, rejecting a non mapping, a missing name and malformed lists

func NewDistributionManifest

func NewDistributionManifest(name string) *DistributionManifest

Manifest with the dataclass defaults, version 0.1.0

func ReadManifest

func ReadManifest(profileDir string) (*DistributionManifest, error)

Manifest of profileDir, nil without a distribution.yaml and an error when it does not parse

func (*DistributionManifest) ToDict

func (d *DistributionManifest) ToDict() map[string]any

Mapping in on disk key order, optional keys written only when set

type EnvRequirement

type EnvRequirement struct {
	Name        string
	Description string
	Required    bool
	Default     any
}

One env_requires row, Default nil when the manifest gives none

func EnvRequirementFromDict

func EnvRequirementFromDict(data any) (EnvRequirement, error)

Requirement parsed from one env_requires entry, which must be a mapping with a name

func NewEnvRequirement

func NewEnvRequirement(name, description string) EnvRequirement

Requirement with the dataclass defaults, required and without a default

func (EnvRequirement) ToDict

func (r EnvRequirement) ToDict() map[string]any

Mapping of the requirement with required and default written only when they differ from the defaults

type ExistsError

type ExistsError struct{ Msg string }

Profile that already exists, matching fs.ErrExist like Python FileExistsError

func (*ExistsError) Error

func (e *ExistsError) Error() string

func (*ExistsError) Is

func (e *ExistsError) Is(target error) bool

type GatewayOwnershipConflict

type GatewayOwnershipConflict struct{ Msg string }

A profile home whose gateway.lock another holder owns, the gateway OwnershipConflict seen from profiles

func (*GatewayOwnershipConflict) Error

func (e *GatewayOwnershipConflict) Error() string

type MetaUpdate

type MetaUpdate struct {
	Description     *string
	DescriptionAuto *bool
	DisplayName     *string
	PreviousNames   *[]string
}

Fields of profile.yaml to overwrite, nil fields keep their stored value

type NotFoundError

type NotFoundError struct{ Msg string }

Missing profile, matching fs.ErrNotExist like Python FileNotFoundError

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

func (*NotFoundError) Is

func (e *NotFoundError) Is(target error) bool

type ProfileMeta

type ProfileMeta struct {
	Description     string
	DescriptionAuto bool
	DisplayName     string
	BotTitle        string
	PreviousNames   []string
}

Presentation metadata of a profile read from profile.yaml

func ReadProfileMeta

func ReadProfileMeta(profileDir string) ProfileMeta

Profile metadata with empty defaults for a missing or corrupt file, cached by file signature

type ProfileServiceManager

type ProfileServiceManager interface {
	SupportsRuntimeRegistration() bool
	RegisterProfileGateway(name string, startNow bool) error
	UnregisterProfileGateway(name string) error
}

Service manager able to register profile gateways at runtime inside a container

type ServedProfile

type ServedProfile struct {
	Name string
	Home string
}

Profile name and home a gateway serves

func ProfilesToServe

func ProfilesToServe(ctx context.Context, multiplex, includeStandalone, includeParked bool) ([]ServedProfile, error)

Profiles a gateway serves, the active one alone without multiplex, else default plus live named profiles

type ValueError

type ValueError struct{ Msg string }

Invalid input, the Python ValueError of the profile helpers

func (*ValueError) Error

func (e *ValueError) Error() string

Directories

Path Synopsis
Package gatewaycreate has the gateway that serves this terminal create a profile, one request answered by one receipt
Package gatewaycreate has the gateway that serves this terminal create a profile, one request answered by one receipt

Jump to

Keyboard shortcuts

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