settings

package
v0.3.0-beta.36 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WriteTargetGlobalConfig persists to `~/.compozy/config.toml`.
	WriteTargetGlobalConfig = compozyconfig.WriteTargetGlobalConfig
	// WriteTargetProfileConfig persists to `~/.compozy/profiles/<name>/config.toml`.
	WriteTargetProfileConfig = compozyconfig.WriteTargetProfileConfig
	// WriteTargetWorkspaceConfig persists to `<workspace>/.compozy/config.toml`.
	WriteTargetWorkspaceConfig = compozyconfig.WriteTargetWorkspaceConfig
	// WriteTargetWorkspaceProfileConfig identifies the read-only workspace profile config layer.
	WriteTargetWorkspaceProfileConfig WriteTargetKind = "workspace-profile-config"
	// WriteTargetGlobalMCPSidecar persists to `~/.compozy/mcp.json`.
	WriteTargetGlobalMCPSidecar = compozyconfig.WriteTargetGlobalMCPSidecar
	// WriteTargetProfileMCPSidecar persists to `~/.compozy/profiles/<name>/mcp.json`.
	WriteTargetProfileMCPSidecar = compozyconfig.WriteTargetProfileMCPSidecar
	// WriteTargetWorkspaceMCPSidecar persists to `<workspace>/.compozy/mcp.json`.
	WriteTargetWorkspaceMCPSidecar = compozyconfig.WriteTargetWorkspaceMCPSidecar
	// WriteTargetWorkspaceProfileMCPSidecar identifies the read-only workspace profile MCP layer.
	WriteTargetWorkspaceProfileMCPSidecar WriteTargetKind = "workspace-profile-mcp-sidecar"
	// WriteTargetGlobalAgentFile persists to `~/.compozy/agents/<name>/AGENT.md`.
	WriteTargetGlobalAgentFile WriteTargetKind = "global-agent-file"
	// WriteTargetWorkspaceAgentFile persists to `<root>/.compozy/agents/<name>/AGENT.md`.
	WriteTargetWorkspaceAgentFile WriteTargetKind = "workspace-agent-file"
)

Variables

View Source
var ErrConflict = errors.New("settings: conflict")

ErrConflict marks conflicting settings scope or target combinations.

View Source
var ErrForbidden = errors.New("settings: forbidden")

ErrForbidden marks settings operations rejected by policy.

View Source
var ErrMCPServerNameTaken = errors.New("mcp_server_name_taken")
View Source
var ErrNotFound = errors.New("settings: not found")

ErrNotFound marks missing settings sections, collections, or items.

View Source
var ErrUnavailable = errors.New("settings: unavailable")

ErrUnavailable marks a required settings dependency that is not configured.

View Source
var ErrUnprocessable = errors.New("settings: unprocessable")

ErrUnprocessable marks settings requests whose selected resource exists but cannot be processed because its backing state is invalid.

View Source
var ErrValidation = errors.New("settings: validation")

ErrValidation marks malformed settings requests or payloads.

Functions

func WithMutationSource

func WithMutationSource(ctx context.Context, source string) context.Context

WithMutationSource annotates a settings-service context with the public transport or runtime source that initiated a persisted mutation.

Types

type ActionMetadata

type ActionMetadata struct {
	Name      string
	Available bool
	Behavior  MutationBehavior
}

ActionMetadata reports one action trigger's semantic behavior.

type AliasConflictError

type AliasConflictError struct {
	Alias   string
	Owner   string
	Command string
}

AliasConflictError identifies both owners of one workspace alias.

func (*AliasConflictError) Error

func (e *AliasConflictError) Error() string

type ApplyFailure

type ApplyFailure struct {
	Subsystem  string
	Diagnostic diagnosticcontract.DiagnosticItem
}

ApplyFailure reports one subsystem failure after the desired config was written.

type ApplyRecord

type ApplyRecord struct {
	ID          string
	DesiredHash string
	ActiveHash  string
	Generation  int64
	Actor       string
	WriteTarget WriteTargetKind
	WritePath   string
	DiffClass   lifecycle.DiffClass
	Status      lifecycle.Status
	Lifecycle   lifecycle.Lifecycle
	NextAction  lifecycle.NextAction
	Diagnostics []diagnosticcontract.DiagnosticItem
	CreatedAt   time.Time
	AppliedAt   *time.Time
	UpdatedAt   time.Time
}

ApplyRecord is one persisted config_apply_records row.

type ApplyRecordDBSource

type ApplyRecordDBSource interface {
	DB() *sql.DB
}

ApplyRecordDBSource exposes the SQL connection needed by the apply-record repository.

type ApplyRecordFilter

type ApplyRecordFilter struct {
	Status lifecycle.Status
	Actor  string
	Limit  int
}

ApplyRecordFilter selects apply-record history rows.

type ApplyRecordStore

type ApplyRecordStore interface {
	CreateApplyRecord(ctx context.Context, record ApplyRecord) (ApplyRecord, error)
	UpdateApplyRecord(ctx context.Context, record ApplyRecord) (ApplyRecord, error)
	ListApplyRecords(ctx context.Context, filter ApplyRecordFilter) ([]ApplyRecord, error)
	LatestAppliedRecord(ctx context.Context) (*ApplyRecord, error)
}

ApplyRecordStore persists config apply attempts.

func NewConfigApplyRecordRepository

func NewConfigApplyRecordRepository(db *sql.DB, now func() time.Time) ApplyRecordStore

NewConfigApplyRecordRepository creates the SQLite-backed config_apply_records repository.

type ApplyResult

type ApplyResult struct {
	Record          ApplyRecord
	Section         SectionName
	Scope           ScopeKind
	WriteTarget     WriteTargetKind
	WorkspaceID     string
	ProfileName     string
	AgentName       string
	Applied         bool
	NextAction      lifecycle.NextAction
	RestartRequired bool
	RestartScope    string
	Warnings        []string
	PartialFailures []ApplyFailure
	Skipped         bool
	SkippedReason   string
	MCPServer       *MCPServerItem `json:"-"`
}

ApplyResult is the public config-apply outcome returned by mutation, reload, and reconcile paths after the attempt is persisted.

type AttentionSection

type AttentionSection struct {
	Config AttentionSettings
}

AttentionSection is the operator attention section read model.

type AttentionSettings

type AttentionSettings struct {
	Toasts          bool
	Sound           bool
	System          bool
	MutedWorkspaces []string
}

AttentionSettings combines user-wide delivery channels with one profile's workspace mutes.

func (AttentionSettings) Validate

func (s AttentionSettings) Validate() error

type AttentionWorkspaceMuteStore

type AttentionWorkspaceMuteStore interface {
	ListAttentionWorkspaceMutes(ctx context.Context, profileID string) ([]string, error)
	ReplaceAttentionWorkspaceMutes(ctx context.Context, profileID string, workspaceIDs []string) error
}

AttentionWorkspaceMuteStore persists workspace mutes by stable profile owner.

type AutomationRuntimeProvider

type AutomationRuntimeProvider interface {
	AutomationRuntimeStatus(ctx context.Context) (AutomationRuntimeStatus, error)
}

AutomationRuntimeProvider returns automation runtime metadata.

type AutomationRuntimeStatus

type AutomationRuntimeStatus struct {
	Available        bool
	Running          bool
	SchedulerRunning bool
	JobTotal         int
	JobEnabled       int
	TriggerTotal     int
	TriggerEnabled   int
	NextFire         *time.Time
	LastSyncedAt     *time.Time
}

AutomationRuntimeStatus summarizes automation runtime state.

type AutomationSection

type AutomationSection struct {
	Config  AutomationSettings
	Runtime AutomationRuntimeStatus
	Links   []OperationalLink
}

AutomationSection is the automation section read model.

type AutomationSettings

type AutomationSettings struct {
	Enabled           bool
	Timezone          string
	MaxConcurrentJobs int
	DefaultFireLimit  automationmodel.FireLimitConfig
}

AutomationSettings groups the editable automation-engine settings.

type CapabilityStatus

type CapabilityStatus struct {
	Available bool
}

CapabilityStatus reports whether one auxiliary feature is available.

type CmdPaletteCatalog

type CmdPaletteCatalog interface {
	Catalog(context.Context, cmdpalette.CatalogRequest) (cmdpalette.Catalog, error)
}

CmdPaletteCatalog returns the profile/workspace/client command catalog used by shortcut settings.

type CmdPaletteSection

type CmdPaletteSection struct {
	FallbackAgentEnabled bool
	Personalization      bool
	Aliases              map[string]string
}

CmdPaletteSection is the command-palette settings read model.

type CmdPaletteUpdate

type CmdPaletteUpdate struct {
	FallbackAgentEnabled *bool
	Personalization      *bool
	Aliases              *map[string]string
}

CmdPaletteUpdate changes either live command-palette control while preserving omitted values.

type CollectionEnvelope

type CollectionEnvelope struct {
	Collection      CollectionName
	Scope           ScopeKind
	WorkspaceID     string
	ProfileName     string
	AvailableScopes []ScopeKind
	Providers       []ProviderItem
	MCPServers      []MCPServerItem
	Hooks           []HookItem
}

CollectionEnvelope returns one typed collection payload.

type CollectionItemDeleteRequest

type CollectionItemDeleteRequest struct {
	CollectionRequest
	Name   string
	Target TargetSelector
}

CollectionItemDeleteRequest identifies one collection delete.

type CollectionItemPutRequest

type CollectionItemPutRequest struct {
	CollectionRequest
	Name                  string
	Target                TargetSelector
	Provider              *ProviderSettings
	ProviderModelCuration *ProviderModelCurationRequest
	ProviderSecrets       []ProviderSecretWrite
	MCPServer             *compozyconfig.MCPServer
	MCPSecrets            MCPSecretValues
	MCPSecretPreservation MCPSecretPreservation
	MCPEnvPreservation    []string
	Hook                  *hookspkg.HookDecl
}

CollectionItemPutRequest identifies one collection upsert.

type CollectionName

type CollectionName string

CollectionName names one collection-oriented settings resource.

const (
	// CollectionProviders exposes the provider catalog.
	CollectionProviders CollectionName = "providers"
	// CollectionMCPServers exposes the scoped MCP server catalog.
	CollectionMCPServers CollectionName = "mcp-servers"
	// CollectionHooks exposes config-defined hook declarations.
	CollectionHooks CollectionName = "hooks"
)

type CollectionRequest

type CollectionRequest struct {
	Owner       string
	Collection  CollectionName
	Scope       ScopeKind
	WorkspaceID string
	ProfileName string
}

CollectionRequest identifies one collection read.

type ConfigPaths

type ConfigPaths struct {
	HomeDir          string
	GlobalConfig     string
	GlobalMCPSidecar string
	LogFile          string
	DaemonInfo       string
}

ConfigPaths exposes resolved daemon config file locations.

type ConfigRuntimeApplier

type ConfigRuntimeApplier interface {
	// ApplyActiveConfig installs a fully projected next-active snapshot, not the persisted desired config.
	ApplyActiveConfig(ctx context.Context, snap *compozyconfig.Config) []ApplyFailure
}

ConfigRuntimeApplier reconciles a validated config snapshot with daemon-owned runtime state.

type DaemonRuntimeStatus

type DaemonRuntimeStatus struct {
	Available      bool
	Status         string
	PID            int
	StartedAt      time.Time
	UptimeSeconds  int64
	Socket         string
	HTTPHost       string
	HTTPPort       int
	ActiveSessions int
	ActiveAgents   int
	TotalSessions  int
	Version        string
}

DaemonRuntimeStatus summarizes daemon-local runtime state.

type Dependencies

type Dependencies struct {
	WorkspaceResolver           WorkspaceResolver
	ProfileResolver             ProfileResolver
	AttentionWorkspaceMutes     AttentionWorkspaceMuteStore
	GeneralRuntime              GeneralRuntimeProvider
	SkillsRuntime               SkillsRuntime
	AutomationRuntime           AutomationRuntimeProvider
	ObservabilityRuntime        ObservabilityRuntimeProvider
	Extensions                  ExtensionStatusProvider
	TransportParity             TransportParityProvider
	CmdPalette                  CmdPaletteCatalog
	MCPAuth                     MCPAuthRuntimeProvider
	MCPRuntime                  MCPRuntimeProvider
	MCPExtensions               MCPExtensionDefinitionResolver
	MCPExtensionManagement      MCPExtensionManagement
	MCPDefinitionWriter         MCPDefinitionWriter
	MCPDefinitionRetirer        MCPDefinitionRetirer
	ModelCatalog                modelcatalog.Service
	RuntimeApplier              ConfigRuntimeApplier
	ProviderSecrets             ProviderSecretStore
	EventSummaries              store.EventSummaryStore
	ApplyRecords                ApplyRecordStore
	RestartActionAvailable      bool
	LogTailAvailable            bool
	CommandLookPath             func(string) (string, error)
	ProviderAuthCommandResolver authproviders.ProviderAuthCommandResolver
	LookupEnv                   func(string) (string, bool)
}

Dependencies captures the runtime dependencies required by the settings service.

type ExtensionStatusProvider

type ExtensionStatusProvider interface {
	InstalledExtensions(ctx context.Context) ([]InstalledExtension, error)
}

ExtensionStatusProvider returns installed extension summaries.

type GatewaySection

type GatewaySection struct {
	Config compozyconfig.GatewayConfig
}

GatewaySection is the remote gateway section read model.

type GeneralActions

type GeneralActions struct {
	Restart ActionMetadata
}

GeneralActions reports general-section action metadata.

type GeneralRuntimeProvider

type GeneralRuntimeProvider interface {
	GeneralRuntimeStatus(ctx context.Context) (DaemonRuntimeStatus, error)
}

GeneralRuntimeProvider returns general daemon runtime metadata.

type GeneralSection

type GeneralSection struct {
	Runtime     DaemonRuntimeStatus
	ConfigPaths ConfigPaths
	Settings    GeneralSettings
	Actions     GeneralActions
}

GeneralSection is the general section read model.

type GeneralSettings

type GeneralSettings struct {
	FollowUpMode   *string
	Limits         compozyconfig.LimitsConfig
	Permissions    compozyconfig.PermissionsConfig
	SessionTimeout time.Duration
	// IdleReleaseAfter is nil when an update leaves the current value unchanged.
	IdleReleaseAfter *time.Duration
	HTTP             compozyconfig.HTTPConfig
	Daemon           compozyconfig.DaemonConfig
	Redact           compozyconfig.RedactConfig
	Terminal         compozyconfig.TerminalConfig
}

GeneralSettings groups the editable general section config.

type HookItem

type HookItem struct {
	Name           string
	Declaration    hookspkg.HookDecl
	SourceMetadata SourceMetadata
}

HookItem is one config-defined hook collection row.

type HooksExtensionsSection

type HooksExtensionsSection struct {
	Hooks           []HookItem
	Extensions      compozyconfig.ExtensionsConfig
	Installed       []InstalledExtension
	TransportParity TransportParityStatus
}

HooksExtensionsSection is the hooks and extensions section read model.

type InstalledExtension

type InstalledExtension struct {
	Name          string
	Version       string
	Enabled       bool
	State         string
	Health        string
	HealthMessage string
	LastError     string
	RequiresEnv   []string
	MissingEnv    []string
	Palette       *InstalledExtensionPalette
}

InstalledExtension summarizes one installed extension for settings surfaces.

type InstalledExtensionPalette

type InstalledExtensionPalette struct {
	Commands []InstalledExtensionPaletteCommand
	Views    []InstalledExtensionPaletteView
}

InstalledExtensionPalette is the operator-facing palette contribution summary.

type InstalledExtensionPaletteCommand

type InstalledExtensionPaletteCommand struct {
	ID             string
	Title          string
	Bindings       []string
	DefaultBinding string
	DefaultDormant bool
	ConflictWith   string
	Available      bool
	Reason         string
}

InstalledExtensionPaletteCommand reports one command and its effective shortcut state.

type InstalledExtensionPaletteView

type InstalledExtensionPaletteView struct {
	ID        string
	Title     string
	Available bool
	Reason    string
}

InstalledExtensionPaletteView reports one contributed view.

type InvalidAliasError

type InvalidAliasError struct {
	CommandID string
}

InvalidAliasError reports the stable public alias grammar.

func (*InvalidAliasError) Error

func (e *InvalidAliasError) Error() string

type MCPAuthBeginRequest

type MCPAuthBeginRequest struct {
	MCPAuthTargetRequest
	CallbackURL            string
	ApprovedScopes         []string
	ApproveScopeEscalation bool
}

MCPAuthBeginRequest starts one daemon-owned OAuth session.

type MCPAuthExchangeRequest

type MCPAuthExchangeRequest struct {
	MCPAuthTargetRequest
	RedirectURL string
}

MCPAuthExchangeRequest completes one daemon-owned OAuth session.

type MCPAuthRuntimeProvider

type MCPAuthRuntimeProvider interface {
	MCPAuthStatus(ctx context.Context, target mcpauth.Target, server compozyconfig.MCPServer) (mcpauth.Status, error)
	MCPAuthBegin(
		ctx context.Context,
		target mcpauth.Target,
		server compozyconfig.MCPServer,
		callbackURL string,
	) (mcpauth.BeginResult, error)
	MCPAuthBeginStepUp(
		ctx context.Context,
		target mcpauth.Target,
		server compozyconfig.MCPServer,
		callbackURL string,
		approvedScopes []string,
		approved bool,
	) (mcpauth.BeginResult, error)
	MCPAuthExchange(
		ctx context.Context,
		target mcpauth.Target,
		server compozyconfig.MCPServer,
		input mcpauth.ExchangeInput,
	) (mcpauth.Status, error)
	MCPAuthCallbackTarget(callbackURL string) (mcpauth.Target, error)
	MCPAuthCompleteCallback(
		ctx context.Context,
		target mcpauth.Target,
		server compozyconfig.MCPServer,
		callbackURL string,
	) (mcpauth.Status, error)
	MCPAuthInvalidate(target mcpauth.Target) error
	MCPAuthDeleteState(ctx context.Context, target mcpauth.Target) error
	MCPAuthLogout(
		ctx context.Context,
		target mcpauth.Target,
		server compozyconfig.MCPServer,
	) (mcpauth.Status, error)
}

MCPAuthRuntimeProvider owns daemon-mediated MCP OAuth sessions and status.

type MCPAuthStatus

type MCPAuthStatus = mcpauth.Status

MCPAuthStatus is a redacted remote MCP authentication status.

type MCPAuthTargetRequest

type MCPAuthTargetRequest struct {
	Scope       ScopeKind
	WorkspaceID string
	ProfileName string
	Name        string
	Owner       string
}

MCPAuthTargetRequest selects one exact user, profile, or workspace MCP definition.

type MCPDefinitionRetirer

type MCPDefinitionRetirer interface {
	ForgetMCPServer(workspaceID string, serverName string)
}

MCPDefinitionRetirer retires volatile state owned by a deleted workspace MCP definition.

type MCPDefinitionWriter

type MCPDefinitionWriter func(
	homePaths compozyconfig.HomePaths,
	workspaceRoot string,
	name string,
	target compozyconfig.WriteTarget,
	server compozyconfig.MCPServer,
) error

MCPDefinitionWriter persists one MCP definition to its selected config target.

type MCPExtensionDefinition

type MCPExtensionDefinition struct {
	Target   mcpauth.Target
	Server   compozyconfig.MCPServer
	Override extensionmcp.Override
}

MCPExtensionDefinition is an owner-qualified published server with editable override state.

type MCPExtensionDefinitionResolver

type MCPExtensionDefinitionResolver interface {
	ResolveMCPExtensionDefinition(
		context.Context,
		MCPAuthTargetRequest,
	) (mcpauth.Target, compozyconfig.MCPServer, bool, error)
}

MCPExtensionDefinitionResolver reads published extension definitions without probing servers.

type MCPExtensionManagement

type MCPExtensionManagement interface {
	ListMCPExtensionDefinitions(context.Context, MCPAuthTargetRequest) ([]MCPExtensionDefinition, error)
	ValidateManualMCPName(context.Context, MCPAuthTargetRequest) error
	UpdateMCPExtensionOverride(
		context.Context,
		MCPAuthTargetRequest,
		extensionmcp.Override,
	) (MCPExtensionDefinition, error)
}

MCPExtensionManagement reads published definitions and protects retained runtime allocations.

type MCPRuntimeProvider

type MCPRuntimeProvider interface {
	MCPServerRuntimeStatus(
		ctx context.Context,
		target mcpauth.Target,
		server compozyconfig.MCPServer,
	) (MCPServerRuntimeStatus, error)
}

MCPRuntimeProvider returns daemon-observed runtime probe status for settings rows.

type MCPSecretPreservation

type MCPSecretPreservation struct {
	SecretEnv         []string
	OAuthClientSecret bool
}

MCPSecretPreservation identifies existing bindings to retain without revealing their refs.

type MCPSecretValues

type MCPSecretValues struct {
	SecretEnv         map[string]string
	OAuthClientSecret *string
}

MCPSecretValues is the write-only secret material submitted with an MCP server mutation.

func (MCPSecretValues) Empty

func (v MCPSecretValues) Empty() bool

type MCPServerItem

type MCPServerItem struct {
	Owner                  string
	RuntimeName            string
	Override               *extensionmcp.Override
	Name                   string
	Transport              compozyconfig.MCPServerTransport
	Command                string
	Args                   []string
	EnvKeys                []string
	SecretEnvKeys          []string
	URL                    string
	Auth                   compozyconfig.MCPAuthConfig
	ClientSecretConfigured bool
	AuthStatus             *mcpauth.Status
	RuntimeStatus          *MCPServerRuntimeStatus
	Scope                  ScopeKind
	WorkspaceID            string
	ProfileName            string
	CatalogEntry           string
	CatalogVersion         string
	SourceMetadata         SourceMetadata
}

MCPServerItem is one MCP server collection row.

type MCPServerProbeState

type MCPServerProbeState string

MCPServerProbeState reports whether the runtime probe actually touched the server.

const (
	// MCPServerProbeSkipped reports a real preflight state that prevented probing.
	MCPServerProbeSkipped MCPServerProbeState = "skipped"
	// MCPServerProbeSucceeded reports a successful MCP initialize/list-tools probe.
	MCPServerProbeSucceeded MCPServerProbeState = "succeeded"
	// MCPServerProbeFailed reports a failed MCP initialize/list-tools probe.
	MCPServerProbeFailed MCPServerProbeState = "failed"
)

type MCPServerRuntimeState

type MCPServerRuntimeState string

MCPServerRuntimeState reports the daemon-observed MCP server runtime state.

const (
	// MCPServerRuntimeStateReady reports a server that initialized and listed tools.
	MCPServerRuntimeStateReady MCPServerRuntimeState = "ready"
	// MCPServerRuntimeStateConfigError reports a malformed server definition.
	MCPServerRuntimeStateConfigError MCPServerRuntimeState = "config_error"
	// MCPServerRuntimeStateAuthRequired reports a remote server requiring login.
	MCPServerRuntimeStateAuthRequired MCPServerRuntimeState = "auth_required"
	// MCPServerRuntimeStateAuthExpired reports an expired remote auth token.
	MCPServerRuntimeStateAuthExpired MCPServerRuntimeState = "auth_expired"
	// MCPServerRuntimeStateAuthInvalid reports an invalid remote auth token.
	MCPServerRuntimeStateAuthInvalid MCPServerRuntimeState = "auth_invalid"
	// MCPServerRuntimeStateAuthRefreshFailed reports a failed auth refresh.
	MCPServerRuntimeStateAuthRefreshFailed MCPServerRuntimeState = "auth_refresh_failed"
	// MCPServerRuntimeStatePermissionDenied reports a permission failure while probing.
	MCPServerRuntimeStatePermissionDenied MCPServerRuntimeState = "permission_denied"
	// MCPServerRuntimeStateRuntimeUnavailable reports a configured server that could not be reached.
	MCPServerRuntimeStateRuntimeUnavailable MCPServerRuntimeState = "runtime_unavailable"
	// MCPServerRuntimeStateDead reports a durably suppressed server awaiting recovery.
	MCPServerRuntimeStateDead MCPServerRuntimeState = "dead"
)

type MCPServerRuntimeStatus

type MCPServerRuntimeStatus struct {
	Configured      bool
	Initialized     bool
	State           MCPServerRuntimeState
	Probe           MCPServerProbeState
	ToolCount       int
	ProtocolVersion string
	Reason          string
	Diagnostic      string
}

MCPServerRuntimeStatus is one daemon-backed MCP server probe result.

type MutationBehavior

type MutationBehavior string

MutationBehavior classifies how a mutation takes effect at runtime.

const (
	// MutationBehaviorAppliedNow reports a live-applied mutation.
	MutationBehaviorAppliedNow MutationBehavior = "applied_now"
	// MutationBehaviorRestartRequired reports a persisted mutation that needs restart.
	MutationBehaviorRestartRequired MutationBehavior = "restart_required"
	// MutationBehaviorActionTrigger reports a mutation that triggers an action.
	MutationBehaviorActionTrigger MutationBehavior = "action_trigger"
)

type MutationClassification

type MutationClassification struct {
	Behavior        MutationBehavior
	Applied         bool
	RestartRequired bool
	RestartScope    string
	Lifecycle       lifecycle.Lifecycle
	DiffClass       lifecycle.DiffClass
}

MutationClassification reports the classified runtime behavior for one mutation.

func ClassifyMutation

func ClassifyMutation(descriptor MutationDescriptor) (MutationClassification, error)

ClassifyMutation maps one section or collection mutation onto the v1 runtime-apply matrix.

type MutationDescriptor

type MutationDescriptor struct {
	Section       SectionName
	ChangedFields []string
	Action        string
}

MutationDescriptor identifies the changed fields or action behind one mutation.

type MutationResult

type MutationResult struct {
	Section         SectionName      `json:"section"`
	Scope           ScopeKind        `json:"scope"`
	WriteTarget     WriteTargetKind  `json:"write_target,omitempty"`
	WorkspaceID     string           `json:"workspace_id,omitempty"`
	ProfileName     string           `json:"profile,omitempty"`
	AgentName       string           `json:"agent_name,omitempty"`
	Behavior        MutationBehavior `json:"behavior"`
	Applied         bool             `json:"applied"`
	RestartRequired bool             `json:"restart_required"`
	RestartScope    string           `json:"restart_scope,omitempty"`
	Warnings        []string         `json:"warnings,omitempty"`
	Lifecycle       lifecycle.Lifecycle
	DiffClass       lifecycle.DiffClass
	MCPServer       *MCPServerItem `json:"-"`
	// contains filtered or unexported fields
}

MutationResult reports the semantic outcome of one settings mutation.

type ObservabilityRuntimeProvider

type ObservabilityRuntimeProvider interface {
	ObservabilityRuntimeStatus(ctx context.Context) (ObservabilityRuntimeStatus, error)
}

ObservabilityRuntimeProvider returns observability runtime metadata.

type ObservabilityRuntimeStatus

type ObservabilityRuntimeStatus struct {
	Available          bool
	Status             string
	GlobalDBSizeBytes  int64
	SessionDBSizeBytes int64
	ActiveSessions     int
	ActiveAgents       int
	UptimeSeconds      int64
}

ObservabilityRuntimeStatus summarizes observability runtime state.

type ObservabilitySection

type ObservabilitySection struct {
	Config         compozyconfig.ObservabilityConfig
	Runtime        ObservabilityRuntimeStatus
	LogTailSupport CapabilityStatus
}

ObservabilitySection is the observability section read model.

type OperationalLink struct {
	Label string
	Path  string
}

OperationalLink reports one related operational destination.

type OptionalStringList

type OptionalStringList struct {
	Present bool
	Null    bool
	Value   []string
}

OptionalStringList is the settings-domain tri-state for one overlay list.

type PersonaSection

type PersonaSection struct {
	Config compozyconfig.DefaultsConfig
}

PersonaSection is the profile-layerable defaults read model.

type ProfileResolver

type ProfileResolver interface {
	AvailableProfileID(ctx context.Context, name string) (string, error)
}

ProfileResolver resolves an active profile name to its stable owner id.

type ProviderAuthStatus

type ProviderAuthStatus struct {
	Mode       compozyconfig.ProviderAuthMode
	EnvPolicy  compozyconfig.ProviderEnvPolicy
	HomePolicy compozyconfig.ProviderHomePolicy
	State      string
	Code       string
	Message    string
	StatusCmd  string
	Login      authproviders.ProviderLoginDescriptor
}

ProviderAuthStatus is a redacted provider authentication readiness summary.

type ProviderCredentialStatus

type ProviderCredentialStatus struct {
	Name      string
	TargetEnv string
	SecretRef string
	Kind      string
	Required  bool
	Present   bool
	Source    string
}

ProviderCredentialStatus is a redacted launch credential status.

type ProviderFallback

type ProviderFallback struct {
	Source   SourceRef
	Settings ProviderSettings
}

ProviderFallback reports the builtin provider revealed when an overlay is removed.

type ProviderItem

type ProviderItem struct {
	SessionEnvStatus []ProviderCredentialStatus
	Name             string
	Settings         ProviderSettings
	Default          bool
	CommandAvailable bool
	Credentials      []ProviderCredentialStatus
	AuthStatus       ProviderAuthStatus
	SourceMetadata   SourceMetadata
	Fallback         *ProviderFallback
}

ProviderItem is one provider collection row.

type ProviderModelCurationRequest

type ProviderModelCurationRequest struct {
	ProviderID             string
	ModelID                string
	Hidden                 *bool
	Featured               *bool
	Deprecated             *bool
	DefaultReasoningEffort *modelcatalog.ReasoningEffort
	DefaultSpeed           *speedpkg.Speed
}

ProviderModelCurationRequest identifies one global provider-model curation mutation.

type ProviderModelCurationResult

type ProviderModelCurationResult struct {
	Model        modelcatalog.Model
	Apply        ApplyResult
	DefaultSpeed speedpkg.Speed
}

ProviderModelCurationResult reports the applied config generation and effective model row.

type ProviderSecretStore

type ProviderSecretStore interface {
	GetMetadata(ctx context.Context, ref string) (vault.Metadata, error)
	ResolveRef(ctx context.Context, ref string) (string, error)
	PutSecret(ctx context.Context, ref string, kind string, plaintext string) (vault.Metadata, error)
	DeleteSecret(ctx context.Context, ref string) error
}

ProviderSecretStore stores provider-bound secrets and returns redacted metadata.

type ProviderSecretWrite

type ProviderSecretWrite struct {
	Name      string
	SecretRef string
	Kind      string
	Value     string
}

ProviderSecretWrite is one write-only provider secret mutation.

type ProviderSettings

type ProviderSettings struct {
	SessionEnv      compozyconfig.SessionEnv
	SteerCapability compozyconfig.SteerCapability
	Command         string
	// CommandInherited reports the inherited builtin default rather than an authored override.
	CommandInherited bool
	DisplayName      string
	Models           compozyconfig.ProviderModelsConfig
	ModelsSet        bool
	Harness          compozyconfig.ProviderHarness
	RuntimeProvider  string
	Transport        string
	BaseURL          string
	AuthMode         compozyconfig.ProviderAuthMode
	EnvPolicy        compozyconfig.ProviderEnvPolicy
	HomePolicy       compozyconfig.ProviderHomePolicy
	AuthStatusCmd    string
	AuthLoginCmd     string
	AuthLoginCmdSet  bool
	AuthACPMethod    string
	AuthACPMethodSet bool
	CredentialSlots  []compozyconfig.ProviderCredentialSlot
}

ProviderSettings is the editable provider overlay payload.

type RolesSection

type RolesSection struct {
	Config compozyconfig.RolesConfig
}

RolesSection is the background-role routing read model.

type ScopeKind

type ScopeKind string

ScopeKind identifies the supported settings scope.

const (
	// ScopeUser selects the user-wide Compozy home scope.
	ScopeUser ScopeKind = "user"
	// ScopeWorkspace selects one workspace-local overlay scope.
	ScopeWorkspace ScopeKind = "workspace"
	// ScopeProfile selects one personal profile overlay scope.
	ScopeProfile ScopeKind = "profile"
	// ScopeAgent selects one effective agent-local overlay scope.
	ScopeAgent ScopeKind = "agent"
)

func (ScopeKind) Validate

func (s ScopeKind) Validate() error

Validate ensures the requested settings scope is supported.

type SectionEnvelope

type SectionEnvelope struct {
	Marketplace     *compozyconfig.MarketplaceCatalogConfig
	Section         SectionName
	Scope           ScopeKind
	WorkspaceID     string
	ProfileName     string
	AgentName       string
	ClientID        string
	AvailableScopes []ScopeKind
	General         *GeneralSection
	Persona         *PersonaSection
	Roles           *RolesSection
	Skills          *SkillsSection
	Automation      *AutomationSection
	Gateway         *GatewaySection
	WindowManager   *WindowManagerSection
	CmdPalette      *CmdPaletteSection
	Attention       *AttentionSection
	Shell           *ShellSection
	Observability   *ObservabilitySection
	HooksExtensions *HooksExtensionsSection
}

SectionEnvelope returns one typed section payload.

type SectionName

type SectionName string

SectionName names one section-oriented settings resource.

const (
	// SectionGeneral exposes daemon-wide runtime and machine settings.
	SectionGeneral SectionName = "general"
	// SectionPersona exposes profile-layerable agent and provider defaults.
	SectionPersona SectionName = "persona"
	// SectionRoles exposes background role routing settings.
	SectionRoles SectionName = "roles"
	// SectionSkills exposes global skills-engine settings.
	SectionSkills SectionName = "skills"
	// SectionAutomation exposes automation engine settings.
	SectionAutomation SectionName = "automation"
	// SectionGateway exposes remote gateway configuration.
	SectionGateway SectionName = "gateway"
	// SectionWindowManager exposes daemon-owned window behavior defaults.
	SectionWindowManager SectionName = "window-manager"
	// SectionCmdPalette exposes command-palette personalization controls.
	SectionCmdPalette SectionName = "cmd-palette"
	// SectionAttention exposes operator attention delivery settings.
	SectionAttention SectionName = "attention"
	// SectionShell exposes operator shell preferences.
	SectionShell SectionName = "shell"
	// SectionObservability exposes observe and transcript settings.
	SectionObservability SectionName = "observability"
	// SectionHooksExtensions exposes hook declarations plus extension policy.
	SectionHooksExtensions SectionName = "hooks-extensions"
	SectionMarketplace     SectionName = "marketplace"
)

type SectionRequest

type SectionRequest struct {
	Section     SectionName
	Scope       ScopeKind
	WorkspaceID string
	ProfileName string
	AgentName   string
	ClientID    string
}

SectionRequest identifies one section read.

type SectionUpdateRequest

type SectionUpdateRequest struct {
	Marketplace *compozyconfig.MarketplaceCatalogConfig
	SectionRequest
	General                        *GeneralSettings
	Persona                        *compozyconfig.DefaultsConfig
	Roles                          *compozyconfig.RolesConfig
	Skills                         *compozyconfig.SkillsConfig
	SkillSourcesOverride           *SkillSourcesOverride
	Automation                     *AutomationSettings
	Gateway                        *compozyconfig.GatewayConfig
	WindowManager                  *compozyconfig.WindowManagerConfig
	WindowManagerPreserveShortcuts bool
	WindowManagerShortcuts         *map[string]windowmanager.ShortcutBinding
	WindowManagerGlobalShortcuts   *map[string]string
	WindowManagerAliases           *map[string]string
	Overwrite                      bool
	CmdPalette                     *CmdPaletteUpdate
	Attention                      *AttentionSettings
	ReplaceAttentionWorkspaceMutes bool
	Shell                          *compozyconfig.ShellConfig
	Observability                  *compozyconfig.ObservabilityConfig
	HooksExtensions                *compozyconfig.ExtensionsConfig
}

SectionUpdateRequest identifies one section mutation.

type Service

type Service interface {
	GetSection(ctx context.Context, req SectionRequest) (SectionEnvelope, error)
	UpdateSection(ctx context.Context, req SectionUpdateRequest) (MutationResult, error)
	ApplySection(ctx context.Context, req SectionUpdateRequest) (ApplyResult, error)
	ListCollection(ctx context.Context, req CollectionRequest) (CollectionEnvelope, error)
	PutCollectionItem(ctx context.Context, req CollectionItemPutRequest) (MutationResult, error)
	ApplyCollectionItem(ctx context.Context, req CollectionItemPutRequest) (ApplyResult, error)
	ApplyProviderModelCuration(
		ctx context.Context,
		req ProviderModelCurationRequest,
	) (ProviderModelCurationResult, error)
	GetMCPAuthStatus(ctx context.Context, req MCPAuthTargetRequest) (mcpauth.Status, error)
	BeginMCPAuth(ctx context.Context, req MCPAuthBeginRequest) (mcpauth.BeginResult, error)
	ExchangeMCPAuth(ctx context.Context, req MCPAuthExchangeRequest) (mcpauth.Status, error)
	CompleteMCPAuthCallback(ctx context.Context, callbackURL string) (mcpauth.Status, error)
	LogoutMCPAuth(ctx context.Context, req MCPAuthTargetRequest) (mcpauth.Status, error)
	DeleteCollectionItem(ctx context.Context, req CollectionItemDeleteRequest) (MutationResult, error)
	ApplyCollectionDelete(ctx context.Context, req CollectionItemDeleteRequest) (ApplyResult, error)
	Reload(ctx context.Context) (ApplyResult, error)
	ActiveConfig(ctx context.Context) (compozyconfig.Config, error)
	HasPendingConfigRestart(ctx context.Context) (bool, error)
	ListApplyRecords(ctx context.Context, filter ApplyRecordFilter) ([]ApplyRecord, error)
}

Service is the daemon-facing settings orchestration boundary.

func NewService

func NewService(homePaths compozyconfig.HomePaths, deps Dependencies) (Service, error)

NewService constructs the daemon-facing settings orchestration service.

type ShellSection

type ShellSection struct {
	Config compozyconfig.ShellConfig
}

ShellSection is the operator shell-preferences read model.

type SkillSourceInheritance

type SkillSourceInheritance struct {
	Sources       bool
	CustomSources bool
}

SkillSourceInheritance reports which workspace source keys come from a lower config layer.

type SkillSourceItem

type SkillSourceItem struct {
	Slug          string
	Label         string
	Kind          string
	Enabled       bool
	AlwaysOn      bool
	DefaultOn     bool
	WorkspacePath string
	GlobalPath    string
	Path          string
	Roots         []SkillSourceRootItem
}

SkillSourceItem is one configured source convention and its daemon-measured roots.

type SkillSourceRootItem

type SkillSourceRootItem struct {
	RootID        string
	Path          string
	Exists        bool
	Readable      bool
	ScannedCount  *int
	SkillCount    *int
	Truncated     bool
	SkippedLinks  []skillspkg.SkillSourceSkippedLink
	Collisions    []skillspkg.SkillSourceCollision
	Verification  skillspkg.SkillSourceVerification
	NativeReaders []string
}

SkillSourceRootItem is the shared per-root discovery diagnostic read model.

type SkillSourcesOverride

type SkillSourcesOverride struct {
	Sources       OptionalStringList
	CustomSources OptionalStringList
}

SkillSourcesOverride carries independent source-policy mutations for one overlay.

type SkillsDiagnosticsRuntime

type SkillsDiagnosticsRuntime interface {
	SkillDiagnostics(
		ctx context.Context,
		resolved *workspacepkg.ResolvedWorkspace,
		agentName string,
	) ([]skillspkg.SkillDiagnostic, error)
}

SkillsDiagnosticsRuntime optionally exposes resolver diagnostics for settings.

type SkillsRuntime

type SkillsRuntime interface {
	List() []*skillspkg.Skill
	ForAgent(
		ctx context.Context,
		resolved *workspacepkg.ResolvedWorkspace,
		agentName string,
	) ([]*skillspkg.Skill, error)
	SetEnabled(name string, resolved *workspacepkg.ResolvedWorkspace, enabled bool) error
	SetEnabledForAgent(name string, resolved *workspacepkg.ResolvedWorkspace, agentName string, enabled bool) error
}

SkillsRuntime exposes the global skills registry state used by settings.

type SkillsSection

type SkillsSection struct {
	Config           compozyconfig.SkillsConfig
	DiscoveredCount  int
	DisabledCount    int
	RuntimeAvailable bool
	Diagnostics      []skillspkg.SkillDiagnostic
	Sources          []SkillSourceItem
	Inherits         *SkillSourceInheritance
	Links            []OperationalLink
}

SkillsSection is the skills section read model.

type SkillsSourcesRuntime

type SkillsSourcesRuntime interface {
	SkillSourceRoots(
		ctx context.Context,
		resolved *workspacepkg.ResolvedWorkspace,
	) ([]skillspkg.SkillSourceRootStatus, error)
}

SkillsSourcesRuntime optionally exposes daemon-owned per-root discovery measurements.

type SkillsWorkspaceRuntime

type SkillsWorkspaceRuntime interface {
	ForWorkspace(ctx context.Context, resolved *workspacepkg.ResolvedWorkspace) ([]*skillspkg.Skill, error)
}

SkillsWorkspaceRuntime optionally exposes exact profile/workspace projections.

type SourceKind

type SourceKind string

SourceKind identifies one semantic resource source.

const (
	// SourceKindExtension identifies an extension-provided definition.
	SourceKindExtension SourceKind = "extension"
	// SourceKindBuiltinProvider identifies the builtin provider registry.
	SourceKindBuiltinProvider SourceKind = "builtin-provider"
	// SourceKindGlobalConfig identifies the global TOML config.
	SourceKindGlobalConfig SourceKind = "global-config"
	// SourceKindProfileConfig identifies a personal profile TOML config.
	SourceKindProfileConfig SourceKind = "profile-config"
	// SourceKindWorkspaceConfig identifies the workspace TOML config.
	SourceKindWorkspaceConfig SourceKind = "workspace-config"
	// SourceKindWorkspaceProfileConfig identifies a repository profile TOML config.
	SourceKindWorkspaceProfileConfig SourceKind = "workspace-profile-config"
	// SourceKindGlobalMCPSidecar identifies the global MCP JSON sidecar.
	SourceKindGlobalMCPSidecar SourceKind = "global-mcp-sidecar"
	// SourceKindProfileMCPSidecar identifies a personal profile MCP JSON sidecar.
	SourceKindProfileMCPSidecar SourceKind = "profile-mcp-sidecar"
	// SourceKindWorkspaceMCPSidecar identifies the workspace MCP JSON sidecar.
	SourceKindWorkspaceMCPSidecar SourceKind = "workspace-mcp-sidecar"
	// SourceKindWorkspaceProfileMCPSidecar identifies a repository profile MCP sidecar.
	SourceKindWorkspaceProfileMCPSidecar SourceKind = "workspace-profile-mcp-sidecar"
	// SourceKindGlobalAgentFile identifies a global AGENT.md frontmatter source.
	SourceKindGlobalAgentFile SourceKind = "global-agent-file"
	// SourceKindWorkspaceAgentFile identifies a workspace/additional AGENT.md frontmatter source.
	SourceKindWorkspaceAgentFile SourceKind = "workspace-agent-file"
)

type SourceMetadata

type SourceMetadata struct {
	EffectiveSource  SourceRef
	ShadowedSources  []SourceRef
	AvailableTargets []WriteTargetKind
}

SourceMetadata reports precedence and target information for one resource.

type SourceRef

type SourceRef struct {
	Kind        SourceKind
	Scope       ScopeKind
	WorkspaceID string
	ProfileName string
	AgentName   string
}

SourceRef identifies one semantic source for a resolved resource.

type TargetSelector

type TargetSelector string

TargetSelector selects one MCP persistence destination.

const (
	// TargetAuto edits the highest-precedence definition in the selected scope.
	TargetAuto TargetSelector = "auto"
	// TargetConfig edits the TOML-backed source in the selected scope.
	TargetConfig TargetSelector = "config"
	// TargetSidecar edits the sidecar-backed source in the selected scope.
	TargetSidecar TargetSelector = "sidecar"
)

func (TargetSelector) Normalize

func (s TargetSelector) Normalize() TargetSelector

Normalize returns the canonical selector, defaulting an omitted selector to auto.

func (TargetSelector) Validate

func (s TargetSelector) Validate() error

Validate reports malformed MCP target selectors instead of silently selecting auto.

type TransportParityProvider

type TransportParityProvider interface {
	TransportParityStatus(ctx context.Context) (TransportParityStatus, error)
}

TransportParityProvider returns settings transport parity metadata.

type TransportParityStatus

type TransportParityStatus struct {
	Known          bool
	SettingsHTTP   bool
	SettingsUDS    bool
	ExtensionsHTTP bool
	ExtensionsUDS  bool
}

TransportParityStatus reports whether required settings transports are present.

type WindowManagerExtensionDefault

type WindowManagerExtensionDefault struct {
	CommandID    string
	Binding      windowmanager.ShortcutBinding
	Dormant      bool
	ConflictWith string
}

WindowManagerExtensionDefault reserves the response shape populated by extension contributions.

type WindowManagerGlobalShortcut

type WindowManagerGlobalShortcut struct {
	CommandID     string
	IntendedChord string
	ActiveChord   string
	Status        string
	Reason        string
	SettingsURL   string
}

WindowManagerGlobalShortcut projects intended and shell-confirmed global binding state.

type WindowManagerSection

type WindowManagerSection struct {
	Config             compozyconfig.WindowManagerConfig
	Commands           []WindowManagerShortcutCommand
	EffectiveShortcuts map[string]windowmanager.ShortcutBinding
	Aliases            map[string]string
	ExtensionDefaults  []WindowManagerExtensionDefault
	Diagnostics        []windowmanager.ShortcutDiagnostic
	GlobalShortcuts    []WindowManagerGlobalShortcut
}

WindowManagerSection is the window-manager section read model.

type WindowManagerShortcutCommand

type WindowManagerShortcutCommand struct {
	ID      string
	Title   string
	Section string
	Source  string
}

WindowManagerShortcutCommand identifies one bindable command in the current catalog.

type WorkspaceResolver

type WorkspaceResolver interface {
	Resolve(ctx context.Context, idOrNameOrPath string) (workspacepkg.ResolvedWorkspace, error)
	List(ctx context.Context) ([]workspacepkg.Workspace, error)
}

WorkspaceResolver resolves and lists registered workspaces for settings flows.

type WriteTargetKind

type WriteTargetKind = compozyconfig.WriteTargetKind

WriteTargetKind identifies the semantic persistence target for one mutation.

Source Files

Jump to

Keyboard shortcuts

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