Documentation
¶
Overview ¶
Package profile owns durable profile identity, selection, resolution, and crash-convergent lifecycle operations.
Index ¶
- Variables
- func NormalizeIdentity(color, icon, emoji string) (string, string, string, error)
- func NormalizeName(name string) (string, error)
- type ArchivePlan
- type ArchiveResult
- type AutomationReconciler
- type CreateInput
- type CredentialAsk
- type CredentialRequirement
- type DeclaredInput
- type DeclaredSeed
- type DeletePlan
- type DeleteResult
- type DesktopPartitionCatalog
- type Error
- type Event
- type EventRecorder
- type IdentityPatch
- type Lens
- type LifecycleOp
- type Manager
- func (m *Manager) Archive(ctx context.Context, name, planRevision string) (ArchiveResult, error)
- func (m *Manager) AvailableProfileID(ctx context.Context, name string) (string, error)
- func (m *Manager) Create(ctx context.Context, in CreateInput) (Profile, error)
- func (m *Manager) CreateDeclared(ctx context.Context, in DeclaredInput) (Profile, error)
- func (m *Manager) Delete(ctx context.Context, name, planRevision string) (DeleteResult, error)
- func (m *Manager) EnsureAvailableID(ctx context.Context, profileID string) error
- func (m *Manager) EnsureAvailableName(ctx context.Context, name string) error
- func (m *Manager) GetByName(ctx context.Context, name string) (Profile, error)
- func (m *Manager) GetWithCounts(ctx context.Context, name string) (WithCounts, error)
- func (m *Manager) HasDeclaredCreation(ctx context.Context, extension, name, profileID string) (bool, error)
- func (m *Manager) HasDeclaredMarker(ctx context.Context, extension, name string) (bool, error)
- func (m *Manager) List(ctx context.Context) (profiles []WithCounts, err error)
- func (m *Manager) ListNames(ctx context.Context) (names []string, err error)
- func (m *Manager) ListOps(ctx context.Context) (ops []LifecycleOp, err error)
- func (m *Manager) ListSelections(ctx context.Context) ([]Selection, error)
- func (m *Manager) PrepareArchive(ctx context.Context, name string) (ArchivePlan, error)
- func (m *Manager) PrepareDelete(ctx context.Context, name string) (DeletePlan, error)
- func (m *Manager) PrepareRename(ctx context.Context, name, newName string) (RenamePlan, error)
- func (m *Manager) ProfileName(ctx context.Context, profileID string) (string, error)
- func (m *Manager) PutSelection(ctx context.Context, selection Selection) error
- func (m *Manager) Recover(ctx context.Context) error
- func (m *Manager) Rename(ctx context.Context, name string, opts RenameOptions) (RenameResult, error)
- func (m *Manager) Resolve(ctx context.Context, in ResolveInput) (Resolution, error)
- func (m *Manager) RetryOp(ctx context.Context, opID string) (LifecycleOp, error)
- func (m *Manager) SelectionStore() SelectionStore
- func (m *Manager) Unarchive(ctx context.Context, name string) (UnarchiveResult, error)
- func (m *Manager) UpdateIdentity(ctx context.Context, name string, patch IdentityPatch) (Profile, error)
- type Option
- func WithAutomationReconciler(reconciler AutomationReconciler) Option
- func WithClock(now func() time.Time) Option
- func WithDesktopPartitionCatalog(catalog DesktopPartitionCatalog) Option
- func WithEntropy(entropy io.Reader) Option
- func WithEventRecorder(recorder EventRecorder) Option
- func WithHomePaths(paths compozyconfig.HomePaths) Option
- func WithLogger(logger *slog.Logger) Option
- func WithPlacementCatalog(catalog PlacementCatalog) Option
- func WithStore(store *globaldb.GlobalDB) Option
- func WithUserJournalRemover(remover UserJournalRemover) Option
- type PersonaDefaults
- type PlacementCatalog
- type PlacementRef
- type Profile
- type ReadScope
- type RemovalSummary
- type RenameOptions
- type RenamePlan
- type RenameResult
- type RepoChoice
- type RepoFolderRef
- type RepoRenameOutcome
- type Resolution
- type ResolutionNote
- type ResolutionSource
- type ResolveInput
- type Selection
- type SelectionLens
- type SelectionStore
- type State
- type UnarchiveResult
- type UserJournalRemover
- type WithCounts
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("profile not found") ErrArchived = errors.New("profile archived") ErrNameInvalid = errors.New("profile name invalid") ErrNameTaken = errors.New("profile name taken") ErrNameReserved = errors.New("profile name reserved") ErrPermanent = errors.New("profile is permanent") ErrOwnsWork = errors.New("profile owns work") ErrSessionsRunning = errors.New("profile sessions are running") ErrPlanStale = errors.New("profile plan is stale") ErrSessionConflict = errors.New("profile session conflict") ErrApprovalsPending = errors.New("profile approvals are pending") ErrInvalidInput = errors.New("profile input is invalid") )
Functions ¶
func NormalizeIdentity ¶
NormalizeIdentity trims identity fields, lowercases the color, applies the default color and icon, and validates the shared profile identity shape.
func NormalizeName ¶
NormalizeName trims and validates a profile name, returning the canonical grammar-safe form (lowercase, 32 characters or fewer) for manifests and other boundaries that bind to profiles by name.
Types ¶
type ArchivePlan ¶
type ArchiveResult ¶
type AutomationReconciler ¶
type CreateInput ¶
type CredentialAsk ¶
type CredentialAsk struct{ Provider, Slot string }
type CredentialRequirement ¶
type DeclaredInput ¶
type DeclaredInput struct {
Extension string
Name string
Seed DeclaredSeed
}
type DeclaredSeed ¶
type DeclaredSeed struct {
Color, Icon, Emoji string
Defaults PersonaDefaults
CredentialAsks []CredentialAsk
}
type DeletePlan ¶
type DeletePlan struct {
Revision string
Removed RemovalSummary
SelectionsToSweep int
ApprovalBlockers []string
}
type DeleteResult ¶
type DeleteResult struct {
Removed RemovalSummary
SweptSelections int
}
type DesktopPartitionCatalog ¶
type DesktopPartitionCatalog interface {
CountDesktopPartitions(ctx context.Context, profileID string) (int, error)
PurgeDesktopPartitions(ctx context.Context, profileID string) error
}
DesktopPartitionCatalog reports and removes the window arrangements one profile owns across every workspace. Desktops live outside the catalog database, so the count feeds the delete preview and the removal runs as a journaled finalize step.
type Event ¶
type Event struct {
Name string `json:"name"`
ProfileID string `json:"profile_id"`
ProfileName string `json:"profile_name"`
ProfileState State `json:"-"`
PreviousProfileName string `json:"previous_profile_name,omitempty"`
OperationID string `json:"operation_id,omitempty"`
Error string `json:"error,omitempty"`
}
Event is the profile lifecycle payload persisted as an event summary and streamed to clients over the logs stream. The tags are load-bearing: the marshaled form lands in the public `content` field of every log event, so it follows the same snake_case shape as the rest of that wire.
type EventRecorder ¶
type EventRecorder interface{ RecordProfileEvent(Event) }
type IdentityPatch ¶
type IdentityPatch struct{ Color, Icon, Emoji *string }
type Lens ¶
type Lens struct {
Kind SelectionLens
WorkspaceID string
}
type LifecycleOp ¶
type LifecycleOp struct{ ID, Kind, Profile, Status, Step, Error string }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) AvailableProfileID ¶
AvailableProfileID resolves an active profile name to its stable owner ID.
func (*Manager) CreateDeclared ¶
func (*Manager) EnsureAvailableID ¶
EnsureAvailableID rejects profiles that cannot safely own new runtime work.
func (*Manager) EnsureAvailableName ¶
EnsureAvailableName rejects profiles that cannot safely own new runtime work.
func (*Manager) GetWithCounts ¶
GetWithCounts returns one profile with its ownership and credential summary.
func (*Manager) HasDeclaredCreation ¶
func (m *Manager) HasDeclaredCreation(ctx context.Context, extension, name, profileID string) (bool, error)
HasDeclaredCreation requires confirmed provenance for the current profile identity.
func (*Manager) HasDeclaredMarker ¶
HasDeclaredMarker reports a prior binding or creation during this installation lifetime.
func (*Manager) List ¶
func (m *Manager) List(ctx context.Context) (profiles []WithCounts, err error)
func (*Manager) ListNames ¶
ListNames returns the profile names needed by lightweight ownership diagnostics.
func (*Manager) ListOps ¶
func (m *Manager) ListOps(ctx context.Context) (ops []LifecycleOp, err error)
func (*Manager) ListSelections ¶
func (*Manager) PrepareArchive ¶
func (*Manager) PrepareDelete ¶
func (*Manager) PrepareRename ¶
func (*Manager) ProfileName ¶
ProfileName resolves the current profile name for one stable profile id.
func (*Manager) PutSelection ¶
func (*Manager) Rename ¶
func (m *Manager) Rename( ctx context.Context, name string, opts RenameOptions, ) (RenameResult, error)
func (*Manager) Resolve ¶
func (m *Manager) Resolve(ctx context.Context, in ResolveInput) (Resolution, error)
func (*Manager) SelectionStore ¶
func (m *Manager) SelectionStore() SelectionStore
func (*Manager) UpdateIdentity ¶
type Option ¶
func WithAutomationReconciler ¶
func WithAutomationReconciler(reconciler AutomationReconciler) Option
func WithDesktopPartitionCatalog ¶
func WithDesktopPartitionCatalog(catalog DesktopPartitionCatalog) Option
func WithEntropy ¶
func WithEventRecorder ¶
func WithEventRecorder(recorder EventRecorder) Option
func WithHomePaths ¶
func WithHomePaths(paths compozyconfig.HomePaths) Option
func WithLogger ¶
func WithPlacementCatalog ¶
func WithPlacementCatalog(catalog PlacementCatalog) Option
func WithUserJournalRemover ¶
func WithUserJournalRemover(remover UserJournalRemover) Option
type PersonaDefaults ¶
type PersonaDefaults struct{ Agent, Provider string }
type PlacementCatalog ¶
type PlacementCatalog interface {
PlacementsForProfile(context.Context, string) ([]PlacementRef, error)
}
PlacementCatalog reports extension resources that bind to one profile name.
type PlacementRef ¶
type PlacementRef struct{ Extension, Resource, ProfileName string }
type RemovalSummary ¶
type RenameOptions ¶
type RenameOptions struct {
NewName string
Repos RepoChoice
PlanRevision string
}
type RenamePlan ¶
type RenamePlan struct {
Revision string
MachineFolders []string
RepoCandidates []RepoFolderRef
DormantPlacements []PlacementRef
VaultRefRewrites int
}
type RenameResult ¶
type RenameResult struct {
RepoResults []RepoRenameOutcome
DormantPlacements []PlacementRef
}
type RepoChoice ¶
func (RepoChoice) Validate ¶
func (r RepoChoice) Validate() error
type RepoFolderRef ¶
type RepoFolderRef struct{ WorkspaceID, WorkspaceName, Path string }
type RepoRenameOutcome ¶
type Resolution ¶
type Resolution struct {
Profile Profile
Source ResolutionSource
Note ResolutionNote
}
type ResolutionNote ¶
type ResolutionNote string
const ( ResolutionNoteNone ResolutionNote = "" ResolutionNoteArchivedRememberedFallback ResolutionNote = "archived_remembered_fallback" ResolutionNoteNoRememberedChoice ResolutionNote = "no_remembered_choice" )
type ResolutionSource ¶
type ResolutionSource string
const ( ResolutionSourceFlag ResolutionSource = "flag" ResolutionSourceEnv ResolutionSource = "env" ResolutionSourceRemembered ResolutionSource = "remembered" ResolutionSourceSession ResolutionSource = "session" ResolutionSourceDefault ResolutionSource = "default" )
type ResolveInput ¶
type Selection ¶
type Selection struct {
Lens SelectionLens
WorkspaceID string
ProfileID string
}
type SelectionLens ¶
type SelectionLens string
const ( SelectionLensWorkspace SelectionLens = "workspace" SelectionLensGlobal SelectionLens = "global" )
type SelectionStore ¶
type UnarchiveResult ¶
type UserJournalRemover ¶
type WithCounts ¶
type WithCounts struct {
Profile
WorkItems int
NeedsSetup bool
CredentialRequirements []CredentialRequirement
}