settings

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package settings provides the daemon-facing settings orchestration service.

Index

Constants

View Source
const (
	// WriteTargetGlobalConfig persists to `~/.agh/config.toml`.
	WriteTargetGlobalConfig = aghconfig.WriteTargetGlobalConfig
	// WriteTargetWorkspaceConfig persists to `<workspace>/.agh/config.toml`.
	WriteTargetWorkspaceConfig = aghconfig.WriteTargetWorkspaceConfig
	// WriteTargetGlobalMCPSidecar persists to `~/.agh/mcp.json`.
	WriteTargetGlobalMCPSidecar = aghconfig.WriteTargetGlobalMCPSidecar
	// WriteTargetWorkspaceMCPSidecar persists to `<workspace>/.agh/mcp.json`.
	WriteTargetWorkspaceMCPSidecar = aghconfig.WriteTargetWorkspaceMCPSidecar
	// WriteTargetGlobalAgentFile persists to `~/.agh/agents/<name>/AGENT.md`.
	WriteTargetGlobalAgentFile WriteTargetKind = "global-agent-file"
	// WriteTargetWorkspaceAgentFile persists to `<root>/.agh/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 ErrNotFound = errors.New("settings: not found")

ErrNotFound marks missing settings sections, collections, or items.

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 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
	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
	AgentName       string
	Applied         bool
	NextAction      lifecycle.NextAction
	RestartRequired bool
	RestartScope    string
	Warnings        []string
	PartialFailures []ApplyFailure
	Skipped         bool
	SkippedReason   string
}

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

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 CollectionEnvelope

type CollectionEnvelope struct {
	Collection      CollectionName
	Scope           ScopeKind
	WorkspaceID     string
	AvailableScopes []ScopeKind
	Providers       []ProviderItem
	MCPServers      []MCPServerItem
	Sandboxes       []SandboxItem
	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
	ProviderSecrets []ProviderSecretWrite
	MCPServer       *aghconfig.MCPServer
	MCPSecrets      MCPSecretValues
	Sandbox         *aghconfig.SandboxProfile
	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"
	// CollectionSandboxes exposes execution sandboxes.
	CollectionSandboxes CollectionName = "sandboxes"
	// CollectionHooks exposes config-defined hook declarations.
	CollectionHooks CollectionName = "hooks"
)

type CollectionRequest

type CollectionRequest struct {
	Collection  CollectionName
	Scope       ScopeKind
	WorkspaceID 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(ctx context.Context, snap *aghconfig.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
	GeneralRuntime             GeneralRuntimeProvider
	MemoryRuntime              MemoryRuntimeProvider
	SkillsRuntime              SkillsRuntime
	AutomationRuntime          AutomationRuntimeProvider
	NetworkRuntime             NetworkRuntimeProvider
	ObservabilityRuntime       ObservabilityRuntimeProvider
	Extensions                 ExtensionStatusProvider
	TransportParity            TransportParityProvider
	MCPAuth                    MCPAuthRuntimeProvider
	MCPRuntime                 MCPRuntimeProvider
	RuntimeApplier             ConfigRuntimeApplier
	ProviderSecrets            ProviderSecretStore
	EventSummaries             store.EventSummaryStore
	ApplyRecords               ApplyRecordStore
	RestartActionAvailable     bool
	ConsolidateActionAvailable bool
	LogTailAvailable           bool
	CommandLookPath            func(string) (string, error)
	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 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 {
	Defaults       aghconfig.DefaultsConfig
	Limits         aghconfig.LimitsConfig
	Permissions    aghconfig.PermissionsConfig
	SessionTimeout time.Duration
	HTTP           aghconfig.HTTPConfig
	Daemon         aghconfig.DaemonConfig
}

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      aghconfig.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
}

InstalledExtension summarizes one installed extension for settings surfaces.

type MCPAuthRuntimeProvider

type MCPAuthRuntimeProvider interface {
	MCPAuthStatus(ctx context.Context, server aghconfig.MCPServer) (mcpauth.Status, error)
}

MCPAuthRuntimeProvider returns redacted MCP auth status for settings rows.

type MCPAuthStatus

type MCPAuthStatus = mcpauth.Status

MCPAuthStatus is a redacted remote MCP authentication status.

type MCPRuntimeProvider

type MCPRuntimeProvider interface {
	MCPServerRuntimeStatus(ctx context.Context, server aghconfig.MCPServer) (MCPServerRuntimeStatus, error)
}

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

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 {
	Name           string
	Transport      aghconfig.MCPServerTransport
	Command        string
	Args           []string
	Env            map[string]string
	SecretEnv      map[string]string
	URL            string
	Auth           aghconfig.MCPAuthConfig
	AuthStatus     *mcpauth.Status
	RuntimeStatus  *MCPServerRuntimeStatus
	Scope          ScopeKind
	WorkspaceID    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"
)

type MCPServerRuntimeStatus

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

MCPServerRuntimeStatus is one daemon-backed MCP server probe result.

type MemoryActions

type MemoryActions struct {
	Consolidate ActionMetadata
}

MemoryActions reports memory-section action metadata.

type MemoryHealthStatus

type MemoryHealthStatus struct {
	Available          bool
	FileCount          int
	DreamEnabled       bool
	LastConsolidatedAt *time.Time
}

MemoryHealthStatus summarizes memory runtime state.

type MemoryRuntimeProvider

type MemoryRuntimeProvider interface {
	MemoryHealthStatus(ctx context.Context) (MemoryHealthStatus, error)
}

MemoryRuntimeProvider returns memory runtime metadata.

type MemorySection

type MemorySection struct {
	Config  aghconfig.MemoryConfig
	Health  MemoryHealthStatus
	Actions MemoryActions
}

MemorySection is the memory section read model.

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"`
	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
}

MutationResult reports the semantic outcome of one settings mutation.

type NetworkRuntimeProvider

type NetworkRuntimeProvider interface {
	NetworkRuntimeStatus(ctx context.Context) (NetworkRuntimeStatus, error)
}

NetworkRuntimeProvider returns network runtime metadata.

type NetworkRuntimeStatus

type NetworkRuntimeStatus struct {
	Available       bool
	Enabled         bool
	Status          string
	ListenerHost    string
	ListenerPort    int
	LocalPeers      int
	RemotePeers     int
	Channels        int
	QueuedMessages  int
	QueuedSessions  int
	DeliveryWorkers int
}

NetworkRuntimeStatus summarizes network runtime state.

type NetworkSection

type NetworkSection struct {
	Config  aghconfig.NetworkConfig
	Runtime NetworkRuntimeStatus
	Links   []OperationalLink
}

NetworkSection is the network section read model.

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         aghconfig.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 ProviderAuthStatus

type ProviderAuthStatus struct {
	Mode       aghconfig.ProviderAuthMode
	EnvPolicy  aghconfig.ProviderEnvPolicy
	HomePolicy aghconfig.ProviderHomePolicy
	State      string
	Code       string
	Message    string
	StatusCmd  string
	LoginCmd   string
	LoginEnv   []string
	NativeCLI  *ProviderNativeCLIStatus
}

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 {
	Name             string
	Settings         ProviderSettings
	Default          bool
	CommandAvailable bool
	Credentials      []ProviderCredentialStatus
	AuthStatus       ProviderAuthStatus
	SourceMetadata   SourceMetadata
	Fallback         *ProviderFallback
}

ProviderItem is one provider collection row.

type ProviderNativeCLIStatus

type ProviderNativeCLIStatus = providerauth.NativeCLIStatus

ProviderNativeCLIStatus is a redacted provider-owned CLI availability diagnostic.

type ProviderSecretStore

type ProviderSecretStore interface {
	GetMetadata(ctx context.Context, ref string) (vault.Metadata, error)
	PutSecret(ctx context.Context, ref string, kind string, plaintext string) (vault.Metadata, 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 {
	Command         string
	DisplayName     string
	Models          aghconfig.ProviderModelsConfig
	ModelsSet       bool
	Harness         aghconfig.ProviderHarness
	RuntimeProvider string
	Transport       string
	BaseURL         string
	AuthMode        aghconfig.ProviderAuthMode
	EnvPolicy       aghconfig.ProviderEnvPolicy
	HomePolicy      aghconfig.ProviderHomePolicy
	AuthStatusCmd   string
	AuthLoginCmd    string
	CredentialSlots []aghconfig.ProviderCredentialSlot
}

ProviderSettings is the editable provider overlay payload.

type SandboxItem

type SandboxItem struct {
	Name                string
	Profile             aghconfig.SandboxProfile
	WorkspaceUsageCount int
	SourceMetadata      SourceMetadata
}

SandboxItem is one sandbox collection row.

type ScopeKind

type ScopeKind string

ScopeKind identifies the supported settings scope.

const (
	// ScopeGlobal selects the global AGH home scope.
	ScopeGlobal ScopeKind = "global"
	// ScopeWorkspace selects one workspace-local overlay scope.
	ScopeWorkspace ScopeKind = "workspace"
	// 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 {
	Section         SectionName
	Scope           ScopeKind
	WorkspaceID     string
	AgentName       string
	AvailableScopes []ScopeKind
	General         *GeneralSection
	Memory          *MemorySection
	Skills          *SkillsSection
	Automation      *AutomationSection
	Network         *NetworkSection
	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 config defaults.
	SectionGeneral SectionName = "general"
	// SectionMemory exposes memory and dream settings.
	SectionMemory SectionName = "memory"
	// SectionSkills exposes global skills-engine settings.
	SectionSkills SectionName = "skills"
	// SectionAutomation exposes automation engine settings.
	SectionAutomation SectionName = "automation"
	// SectionNetwork exposes embedded network settings.
	SectionNetwork SectionName = "network"
	// SectionObservability exposes observe and transcript settings.
	SectionObservability SectionName = "observability"
	// SectionHooksExtensions exposes hook declarations plus extension policy.
	SectionHooksExtensions SectionName = "hooks-extensions"
)

type SectionRequest

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

SectionRequest identifies one section read.

type SectionUpdateRequest

type SectionUpdateRequest struct {
	SectionRequest
	General         *GeneralSettings
	Memory          *aghconfig.MemoryConfig
	Skills          *aghconfig.SkillsConfig
	Automation      *AutomationSettings
	Network         *aghconfig.NetworkConfig
	Observability   *aghconfig.ObservabilityConfig
	HooksExtensions *aghconfig.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)
	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) (aghconfig.Config, error)
	ListApplyRecords(ctx context.Context, filter ApplyRecordFilter) ([]ApplyRecord, error)
}

Service is the daemon-facing settings orchestration boundary.

func NewService

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

NewService constructs the daemon-facing settings orchestration service.

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           aghconfig.SkillsConfig
	DiscoveredCount  int
	DisabledCount    int
	RuntimeAvailable bool
	Diagnostics      []skillspkg.SkillDiagnostic
	Links            []OperationalLink
}

SkillsSection is the skills section read model.

type SourceKind

type SourceKind string

SourceKind identifies one semantic resource source.

const (
	// SourceKindBuiltinProvider identifies the builtin provider registry.
	SourceKindBuiltinProvider SourceKind = "builtin-provider"
	// SourceKindGlobalConfig identifies the global TOML config.
	SourceKindGlobalConfig SourceKind = "global-config"
	// SourceKindWorkspaceConfig identifies the workspace TOML config.
	SourceKindWorkspaceConfig SourceKind = "workspace-config"
	// SourceKindGlobalMCPSidecar identifies the global MCP JSON sidecar.
	SourceKindGlobalMCPSidecar SourceKind = "global-mcp-sidecar"
	// SourceKindWorkspaceMCPSidecar identifies the workspace MCP JSON sidecar.
	SourceKindWorkspaceMCPSidecar SourceKind = "workspace-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
	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 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 = aghconfig.WriteTargetKind

WriteTargetKind identifies the semantic persistence target for one mutation.

Jump to

Keyboard shortcuts

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