Documentation
¶
Overview ¶
Package localconfig owns Sol's single-user configuration and credentials. It has no provider transport or project-directory discovery.
Index ¶
Constants ¶
const APIKeyMode = "api-key"
const Version = 2
Version is the current on-disk configuration schema version.
Variables ¶
This section is empty.
Functions ¶
func DefaultPath ¶
DefaultPath resolves only the OS user config directory, never the project.
Types ¶
type APIKeyCredential ¶
type APIKeyCredential struct {
Key string `json:"key"`
}
APIKeyCredential holds one explicitly configured provider key.
type CommitStore ¶
type CommitStore interface {
Store
UpdateWithCommit(context.Context, func(*Config) (context.Context, error)) (Config, error)
}
CommitStore supports transactions which accept an irreversible remote effect. Lock acquisition and the callback use the caller's context. The callback may supply a fresh bounded context for committing an accepted effect independently of caller cancellation. Ordinary configuration changes use Store.Update.
type Config ¶
type Config struct {
Providers map[string]ProviderAuth `json:"providers"`
DefaultModel *ModelSelection `json:"default_model,omitempty"`
}
Config is the complete local configuration snapshot. Providers is initialized even when the file is absent. Credentials are not safe for display.
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore persists the complete record using private atomic writes and a stable advisory lock. Load and Update coordinate across independent processes.
func NewFileStore ¶
NewFileStore requires an explicit absolute path in a Sol-owned directory. The containing directory is made private. Construction does not access files.
func (*FileStore) UpdateWithCommit ¶
func (s *FileStore) UpdateWithCommit(ctx context.Context, change func(*Config) (context.Context, error)) (Config, error)
UpdateWithCommit requires a bounded commit context from a successful callback. Returning an error leaves the file unchanged. The caller owns context cleanup.
type ModelSelection ¶
ModelSelection persists the model and deliberate authentication method together. Auth is api-key or a named OAuth method belonging to the selected provider.
func (ModelSelection) Validate ¶
func (m ModelSelection) Validate() error
type OAuthCredential ¶
type OAuthCredential struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresAt time.Time `json:"expires_at"`
AccountID string `json:"account_id,omitempty"`
}
OAuthCredential holds refreshable tokens and optional account-routing metadata.
type ProviderAuth ¶
type ProviderAuth struct {
APIKey *APIKeyCredential `json:"api_key,omitempty"`
OAuth map[string]OAuthCredential `json:"oauth,omitempty"`
}
ProviderAuth keeps API-key and named OAuth methods independently configurable.