setup

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 22 Imported by: 0 modules, 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 (
	VoiceModuleTTS = "tts"
	VoiceModuleSTT = "stt"
)
View Source
const CurrentVersion = 3
View Source
const DaemonUnitName = "matrixclawd.service"
View Source
const FutureVoiceModuleRealtime = "realtime_voice"

Realtime voice is intentionally not exposed as a configurable module yet. Keep the concept documented here so it can be added later when there is a client/runtime capable of testing bidirectional audio.

Variables

View Source
var ErrConfigNotFound = errors.New("setup config not found")
View Source
var ErrDraftNotFound = errors.New("setup draft not found")
View Source
var ErrUnsupportedConfigVersion = errors.New("unsupported setup config version")

Functions

func BoolString

func BoolString(v bool) string

func ClientBootstrapsFromConfig

func ClientBootstrapsFromConfig(cfg Config) (map[string]ClientBootstrap, error)

func DaemonEnvironmentFilePath

func DaemonEnvironmentFilePath(setupPath string) string

func DefaultAssistantSystemPrompt

func DefaultAssistantSystemPrompt() string

func DefaultConfigPath

func DefaultConfigPath() (string, error)

func DefaultDBPath

func DefaultDBPath() string

func ImportDaemonEnvironmentFile

func ImportDaemonEnvironmentFile(setupPath string, cfg Config) error

func InitializeAssistantSystemPrompt

func InitializeAssistantSystemPrompt(current string) string

func InitializeAssistantSystemPromptForConfig

func InitializeAssistantSystemPromptForConfig(current string, cfg Config) string

func InitializeAssistantSystemPromptForDraft

func InitializeAssistantSystemPromptForDraft(current string, draft Draft) string

func InitializeAssistantSystemPromptWithContext

func InitializeAssistantSystemPromptWithContext(current string, promptContext AssistantPromptContext) string

func MaskSecret

func MaskSecret(value string) string

func ParseBool

func ParseBool(v string) bool

func ProviderAPIKeyPreview

func ProviderAPIKeyPreview(provider ProviderConfig) string

func ProviderCompactStatus

func ProviderCompactStatus(item ProviderSetupItem) string

func ProviderDisplayName

func ProviderDisplayName(item ProviderSetupItem) string

func ProviderDisplayStatus

func ProviderDisplayStatus(item ProviderSetupItem) string

func ProviderDraftConfigured

func ProviderDraftConfigured(provider ProviderDraft) bool

func ProviderFormCommandID added in v0.1.9

func ProviderFormCommandID(id ProviderFormFieldID) string

func ProviderFormToolUseModeStatus added in v0.1.1

func ProviderFormToolUseModeStatus(mode providers.ToolUseMode) string

func ProviderFormToolUseModes added in v0.1.1

func ProviderFormToolUseModes() []providers.ToolUseMode

func ProviderRequiredMessage added in v0.1.9

func ProviderRequiredMessage(field ProviderFormField) string

func ProviderRequiredStatus added in v0.1.9

func ProviderRequiredStatus(value string) string

func ResolvedProviderAPIKey

func ResolvedProviderAPIKey(provider ProviderConfig) (string, bool)

Types

type ApplyResult

type ApplyResult struct {
	Config   Config
	Path     string
	Summary  Summary
	Warnings []string
}

type AssistantConfig

type AssistantConfig struct {
	Name               string `json:"name,omitempty"`
	SystemPrompt       string `json:"system_prompt,omitempty"`
	CustomInstructions string `json:"custom_instructions,omitempty"`
}

type AssistantPromptContext

type AssistantPromptContext struct {
	HTTPAddr              string
	DBPath                string
	Timezone              string
	AutostartOnBoot       bool
	TelegramEnabled       bool
	TelegramProviderSetup bool
	ActiveProviderID      string
	ConfiguredProviders   int
}

type AssistantSummary

type AssistantSummary struct {
	Name   string
	Status string
}

type ClientBootstrap

type ClientBootstrap struct {
	Enabled     bool
	Values      map[string]string
	Int64Values map[string]int64
}

type ClientsConfig

type ClientsConfig struct {
	Terminal TerminalConfig `json:"terminal"`
	Telegram TelegramConfig `json:"telegram"`
}

type Config

type Config struct {
	Version          int              `json:"version"`
	CompletedAt      time.Time        `json:"completed_at"`
	ActiveProviderID string           `json:"active_provider_id,omitempty"`
	Assistant        AssistantConfig  `json:"assistant,omitempty"`
	Providers        []ProviderConfig `json:"providers,omitempty"`
	Daemon           DaemonConfig     `json:"daemon"`
	Clients          ClientsConfig    `json:"clients"`
	Modules          ModulesConfig    `json:"modules,omitempty"`
}

func (Config) ExternalAgentConfig added in v0.1.6

func (cfg Config) ExternalAgentConfig(id string) ExternalAgentConfig

type DaemonConfig

type DaemonConfig struct {
	HTTPAddr        string `json:"http_addr"`
	DBPath          string `json:"db_path"`
	Timezone        string `json:"timezone,omitempty"`
	APIToken        string `json:"api_token,omitempty"`
	AutostartOnBoot bool   `json:"autostart_on_boot"`
}

type DaemonSummary

type DaemonSummary struct {
	Status        string
	HTTPAddr      string
	DBPath        string
	Timezone      string
	Autostart     bool
	RuntimeStatus string
	Installed     bool
	Running       bool
	Enabled       bool
	Warning       string
}

type Draft

type Draft struct {
	ActiveProviderID      string
	AssistantName         string
	AssistantSystemPrompt string
	AssistantCustomPrompt string
	Providers             []ProviderDraft
	HTTPAddr              string
	DBPath                string
	Timezone              string
	AutostartOnBoot       string
	TelegramEnabled       string
	TelegramBotToken      string
	TelegramAllowedUID    string
	TelegramProviderSetup string
}

func DeleteProviderDraft

func DeleteProviderDraft(draft Draft, providerID string) Draft

func UpsertProviderDraft

func UpsertProviderDraft(draft Draft, provider ProviderDraft) Draft

type ExternalAgentConfig added in v0.1.6

type ExternalAgentConfig struct {
	Enabled bool   `json:"enabled,omitempty"`
	Path    string `json:"path,omitempty"`
}

type FileStore

type FileStore struct {
	// contains filtered or unexported fields
}

func NewFileStore

func NewFileStore(path string) *FileStore

func (*FileStore) ClearDraft

func (s *FileStore) ClearDraft() error

func (*FileStore) Load

func (s *FileStore) Load() (Config, error)

func (*FileStore) LoadDraft

func (s *FileStore) LoadDraft() (Draft, error)

func (*FileStore) Path

func (s *FileStore) Path() string

func (*FileStore) Save

func (s *FileStore) Save(cfg Config) error

func (*FileStore) SaveDraft

func (s *FileStore) SaveDraft(draft Draft) error

type ModulesConfig added in v0.1.6

type ModulesConfig struct {
	ExternalAgents map[string]ExternalAgentConfig `json:"external_agents,omitempty"`
	TextToSpeech   VoiceModuleConfig              `json:"tts,omitempty"`
	SpeechToText   VoiceModuleConfig              `json:"stt,omitempty"`
}

type ProviderConfig

type ProviderConfig struct {
	ID              string                `json:"id"`
	CatalogID       string                `json:"catalog_id,omitempty"`
	Name            string                `json:"name"`
	Type            string                `json:"type"`
	APIKey          string                `json:"api_key"`
	APIKeyEnv       string                `json:"api_key_env,omitempty"`
	BaseURL         string                `json:"base_url,omitempty"`
	Model           string                `json:"model"`
	MaxOutputTokens int64                 `json:"max_output_tokens,omitempty"`
	ReasoningEffort string                `json:"reasoning_effort,omitempty"`
	ToolUseMode     providers.ToolUseMode `json:"tool_use_mode,omitempty"`
}

func ActiveProviderConfig

func ActiveProviderConfig(cfg Config) (ProviderConfig, bool)

func ProviderConfigWithResolvedAPIKey

func ProviderConfigWithResolvedAPIKey(provider ProviderConfig) (ProviderConfig, bool)

type ProviderDraft

type ProviderDraft struct {
	ID                  string
	CatalogID           string
	Name                string
	Type                string
	APIKey              string
	APIKeyEnv           string
	BaseURL             string
	Model               string
	ToolUseMode         providers.ToolUseMode
	MaxOutputTokens     string
	ReasoningEffort     string
	HasStoredAPIKey     bool
	StoredAPIKeyPreview string
}

func ConfiguredProviders

func ConfiguredProviders(draft Draft) []ProviderDraft

func FindProviderDraft

func FindProviderDraft(draft Draft, providerID string) (ProviderDraft, bool)

type ProviderFormChoice added in v0.1.9

type ProviderFormChoice struct {
	ID       string
	Title    string
	Status   string
	Value    string
	Selected bool
}

type ProviderFormField added in v0.1.1

type ProviderFormField struct {
	ID        ProviderFormFieldID
	Label     string
	Value     string
	Status    string
	Options   []string
	Choices   []ProviderFormChoice
	Required  bool
	Sensitive bool
	Editable  bool
	Picker    bool
}

type ProviderFormFieldID added in v0.1.1

type ProviderFormFieldID string
const (
	ProviderFormFieldName            ProviderFormFieldID = "name"
	ProviderFormFieldBaseURL         ProviderFormFieldID = "base_url"
	ProviderFormFieldAPIKey          ProviderFormFieldID = "api_key"
	ProviderFormFieldModel           ProviderFormFieldID = "model"
	ProviderFormFieldReasoningEffort ProviderFormFieldID = "reasoning_effort"
	ProviderFormFieldToolUse         ProviderFormFieldID = "tool_use"
)

func ProviderFormFieldIDFromCommand added in v0.1.9

func ProviderFormFieldIDFromCommand(value string) (ProviderFormFieldID, bool)

type ProviderFormSpec added in v0.1.1

type ProviderFormSpec struct {
	ID           string
	CatalogID    string
	Type         string
	Custom       bool
	Capabilities providers.Capabilities
	Fields       []ProviderFormField
}

func ProviderFormSpecForDraft added in v0.1.1

func ProviderFormSpecForDraft(provider ProviderDraft) ProviderFormSpec

func ProviderFormSpecForSetupItem added in v0.1.1

func ProviderFormSpecForSetupItem(item ProviderSetupItem) ProviderFormSpec

func ProviderFormSpecFromInput added in v0.1.1

func ProviderFormSpecFromInput(input ProviderFormSpecInput) ProviderFormSpec

func (ProviderFormSpec) Field added in v0.1.1

type ProviderFormSpecInput added in v0.1.1

type ProviderFormSpecInput struct {
	ID                  string
	CatalogID           string
	Name                string
	Type                string
	APIKey              string
	BaseURL             string
	BaseURLOptions      []providers.BaseURLOption
	Model               string
	ReasoningEffort     string
	ToolUseMode         providers.ToolUseMode
	HasStoredAPIKey     bool
	StoredAPIKeyPreview string

	Custom            bool
	CustomKnown       bool
	Capabilities      providers.Capabilities
	CapabilitiesKnown bool
}

type ProviderFormState added in v0.1.9

type ProviderFormState struct {
	Name            string
	BaseURL         string
	Model           string
	APIKey          string
	ReasoningEffort string
	ToolUseMode     providers.ToolUseMode
}

func (ProviderFormState) Field added in v0.1.9

func (state ProviderFormState) Field(commandID string) string

func (ProviderFormState) ToSetupUpdate added in v0.1.9

func (state ProviderFormState) ToSetupUpdate(providerType string, active bool) ProviderSetupUpdate

func (ProviderFormState) ValidationMessage added in v0.1.9

func (state ProviderFormState) ValidationMessage(requireAPIKey bool) string

func (ProviderFormState) WithDefaultProviderOptions added in v0.1.9

func (state ProviderFormState) WithDefaultProviderOptions(capabilities providers.Capabilities) ProviderFormState

func (ProviderFormState) WithDefaultToolProfile added in v0.1.9

func (state ProviderFormState) WithDefaultToolProfile(providerType string) ProviderFormState

func (ProviderFormState) WithField added in v0.1.9

func (state ProviderFormState) WithField(commandID string, value string) ProviderFormState

type ProviderFormViewField added in v0.1.9

type ProviderFormViewField struct {
	ID              ProviderFormFieldID
	CommandID       string
	Label           string
	Status          string
	RequiredMessage string
	Sensitive       bool
	Picker          bool
	Accent          bool
}

func ProviderFormViewFields added in v0.1.9

func ProviderFormViewFields(spec ProviderFormSpec, options ProviderFormViewOptions) []ProviderFormViewField

type ProviderFormViewOptions added in v0.1.9

type ProviderFormViewOptions struct {
	APIKeyStatus       string
	ShowRequiredStatus bool
}

type ProviderModelsResponse added in v0.1.1

type ProviderModelsResponse struct {
	Models []string `json:"models"`
}

type ProviderOption

type ProviderOption struct {
	ID              string
	Name            string
	Type            string
	Implemented     bool
	RequiresBaseURL bool
	Capabilities    providers.Capabilities
	DefaultBaseURL  string
	BaseURLOptions  []providers.BaseURLOption
	DefaultModel    string
	APIKeyEnv       string
	Notes           string
}

type ProviderSetupItem

type ProviderSetupItem struct {
	ID              string                    `json:"id"`
	CatalogID       string                    `json:"catalog_id,omitempty"`
	Name            string                    `json:"name"`
	Type            string                    `json:"type"`
	Status          string                    `json:"status"`
	Configured      bool                      `json:"configured"`
	Active          bool                      `json:"active"`
	Implemented     bool                      `json:"implemented"`
	RequiresBaseURL bool                      `json:"requires_base_url,omitempty"`
	Capabilities    providers.Capabilities    `json:"capabilities,omitempty"`
	BaseURL         string                    `json:"base_url,omitempty"`
	BaseURLOptions  []providers.BaseURLOption `json:"base_url_options,omitempty"`
	Model           string                    `json:"model,omitempty"`
	ReasoningEffort string                    `json:"reasoning_effort,omitempty"`
	ToolUseMode     providers.ToolUseMode     `json:"tool_use_mode,omitempty"`
	DefaultModel    string                    `json:"default_model,omitempty"`
	APIKeyPreview   string                    `json:"api_key_preview,omitempty"`
	Notes           string                    `json:"notes,omitempty"`
}

func ProviderSetupItemsFromConfig

func ProviderSetupItemsFromConfig(cfg Config, options []ProviderOption) []ProviderSetupItem

func ProviderSetupItemsFromDraft

func ProviderSetupItemsFromDraft(draft Draft, options []ProviderOption) []ProviderSetupItem

type ProviderSetupListResponse

type ProviderSetupListResponse struct {
	Providers []ProviderSetupItem `json:"providers"`
}

type ProviderSetupOKResponse

type ProviderSetupOKResponse struct {
	OK bool `json:"ok"`
}

type ProviderSetupResponse

type ProviderSetupResponse struct {
	Provider ProviderSetupItem `json:"provider"`
}

type ProviderSetupUpdate

type ProviderSetupUpdate struct {
	Name            string                `json:"name,omitempty"`
	Type            string                `json:"type,omitempty"`
	APIKey          string                `json:"api_key,omitempty"`
	BaseURL         string                `json:"base_url,omitempty"`
	Model           string                `json:"model,omitempty"`
	ReasoningEffort string                `json:"reasoning_effort,omitempty"`
	ToolUseMode     providers.ToolUseMode `json:"tool_use_mode,omitempty"`
	Active          bool                  `json:"active,omitempty"`
}

type ProviderSummary

type ProviderSummary struct {
	ID            string
	Name          string
	Model         string
	Status        string
	APIKeyPreview string
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewDefaultService

func NewDefaultService() (*Service, error)

func NewService

func NewService(store Store) *Service

func (*Service) AllowProviderSetupForClient

func (s *Service) AllowProviderSetupForClient(client string) (bool, error)

func (*Service) Apply

func (s *Service) Apply(draft Draft) (ApplyResult, error)

func (*Service) ApplyContext

func (s *Service) ApplyContext(ctx context.Context, draft Draft) (ApplyResult, error)

func (*Service) BuiltInProviderDraft

func (s *Service) BuiltInProviderDraft(draft Draft, providerID string) (ProviderDraft, error)

func (*Service) ConfigureProviderContext

func (s *Service) ConfigureProviderContext(ctx context.Context, providerID string, update ProviderSetupUpdate) (ProviderSetupItem, error)

func (*Service) DeleteProviderContext

func (s *Service) DeleteProviderContext(ctx context.Context, providerID string) error

func (*Service) Draft

func (s *Service) Draft() (Draft, error)

func (*Service) EnsureDaemonAPIToken

func (s *Service) EnsureDaemonAPIToken() (Config, error)

func (*Service) EnsureDaemonContext

func (s *Service) EnsureDaemonContext(ctx context.Context) (DaemonSummary, error)

func (*Service) ExternalAgentConfig added in v0.1.6

func (s *Service) ExternalAgentConfig(id string) ExternalAgentConfig

func (*Service) IsConfigured

func (s *Service) IsConfigured() (bool, error)

func (*Service) Load

func (s *Service) Load() (Config, error)

func (*Service) NewCustomProviderDraft

func (s *Service) NewCustomProviderDraft(draft Draft, providerType string) (ProviderDraft, error)

func (*Service) Path

func (s *Service) Path() string

func (*Service) ProviderModels

func (s *Service) ProviderModels(ctx context.Context, provider ProviderDraft) ([]string, error)

func (*Service) ProviderModelsContext added in v0.1.1

func (s *Service) ProviderModelsContext(ctx context.Context, providerID string, update ProviderSetupUpdate) ([]string, error)

func (*Service) ProviderOptions

func (s *Service) ProviderOptions() []ProviderOption

func (*Service) ProviderSetupItems

func (s *Service) ProviderSetupItems() ([]ProviderSetupItem, error)

func (*Service) RestartDaemonContext

func (s *Service) RestartDaemonContext(ctx context.Context) (DaemonSummary, error)

func (*Service) SaveDraft

func (s *Service) SaveDraft(draft Draft) error

func (*Service) SaveRuntimeConfigContext

func (s *Service) SaveRuntimeConfigContext(ctx context.Context, draft Draft) (ApplyResult, error)

func (*Service) Summary

func (s *Service) Summary() (Summary, error)

func (*Service) SummaryContext

func (s *Service) SummaryContext(ctx context.Context) (Summary, error)

func (*Service) UpdateExternalAgent added in v0.1.6

func (s *Service) UpdateExternalAgent(id string, update ExternalAgentConfig) (Config, error)

func (*Service) UpdateVoiceModule added in v0.1.9

func (s *Service) UpdateVoiceModule(id string, update VoiceModuleUpdate) ([]VoiceModuleDescriptor, error)

func (*Service) VoiceModules added in v0.1.9

func (s *Service) VoiceModules() ([]VoiceModuleDescriptor, error)

type Store

type Store interface {
	Load() (Config, error)
	Save(cfg Config) error
	LoadDraft() (Draft, error)
	SaveDraft(draft Draft) error
	ClearDraft() error
	Path() string
}

type Summary

type Summary struct {
	Assistant AssistantSummary
	Provider  ProviderSummary
	Daemon    DaemonSummary
	Telegram  TelegramSummary
}

func SummaryFromConfig

func SummaryFromConfig(cfg Config) Summary

func SummaryFromDraft

func SummaryFromDraft(d Draft) Summary

type TelegramConfig

type TelegramConfig struct {
	Enabled            bool   `json:"enabled"`
	BotToken           string `json:"bot_token,omitempty"`
	AllowedUserID      string `json:"allowed_user_id,omitempty"`
	AllowProviderSetup bool   `json:"allow_provider_setup,omitempty"`
}

type TelegramSummary

type TelegramSummary struct {
	Status   string
	Username string
	Warning  string
}

type TerminalConfig

type TerminalConfig struct {
	Enabled bool `json:"enabled"`
}

type TimezoneOption

type TimezoneOption struct {
	ID     string
	Name   string
	Offset string
	Label  string
}

func TimezoneOptions

func TimezoneOptions(now time.Time) []TimezoneOption

type VoiceModelOption added in v0.1.9

type VoiceModelOption struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Size         string `json:"size,omitempty"`
	RAM          string `json:"ram,omitempty"`
	Description  string `json:"description,omitempty"`
	Default      bool   `json:"default,omitempty"`
	LanguageCode string `json:"language_code,omitempty"`
	LanguageName string `json:"language_name,omitempty"`
	Quality      string `json:"quality,omitempty"`
	Installed    bool   `json:"installed,omitempty"`
	Path         string `json:"path,omitempty"`
}

type VoiceModuleConfig added in v0.1.9

type VoiceModuleConfig struct {
	Enabled    bool                           `json:"enabled,omitempty"`
	ProviderID string                         `json:"provider_id,omitempty"`
	Providers  map[string]VoiceProviderConfig `json:"providers,omitempty"`
}

type VoiceModuleDescriptor added in v0.1.9

type VoiceModuleDescriptor struct {
	ID           string                `json:"id"`
	Title        string                `json:"title"`
	Enabled      bool                  `json:"enabled"`
	ProviderID   string                `json:"provider_id"`
	ProviderName string                `json:"provider_name"`
	Local        bool                  `json:"local"`
	Status       string                `json:"status"`
	Config       VoiceProviderConfig   `json:"config,omitempty"`
	Providers    []VoiceProviderOption `json:"providers,omitempty"`
}

func VoiceModuleDescriptors added in v0.1.9

func VoiceModuleDescriptors(modules ModulesConfig) []VoiceModuleDescriptor

type VoiceModuleUpdate added in v0.1.9

type VoiceModuleUpdate struct {
	Enabled        *bool                `json:"enabled,omitempty"`
	ProviderID     string               `json:"provider_id,omitempty"`
	ProviderConfig *VoiceProviderConfig `json:"provider_config,omitempty"`
}

type VoiceModulesResponse added in v0.1.9

type VoiceModulesResponse struct {
	Modules []VoiceModuleDescriptor `json:"modules"`
}

type VoiceProviderActionRequest added in v0.1.9

type VoiceProviderActionRequest struct {
	Action  string `json:"action"`
	ModelID string `json:"model_id,omitempty"`
}

type VoiceProviderActionResponse added in v0.1.9

type VoiceProviderActionResponse struct {
	Provider VoiceProviderOption `json:"provider"`
}

type VoiceProviderConfig added in v0.1.9

type VoiceProviderConfig struct {
	ModelID     string `json:"model_id,omitempty"`
	VoiceID     string `json:"voice_id,omitempty"`
	Language    string `json:"language,omitempty"`
	Autostart   bool   `json:"autostart,omitempty"`
	RuntimeMode string `json:"runtime_mode,omitempty"`
	BinaryPath  string `json:"binary_path,omitempty"`
	Endpoint    string `json:"endpoint,omitempty"`
	Threads     int    `json:"threads,omitempty"`
}

type VoiceProviderOption added in v0.1.9

type VoiceProviderOption struct {
	ID            string              `json:"id"`
	Name          string              `json:"name"`
	Local         bool                `json:"local"`
	Status        string              `json:"status,omitempty"`
	CatalogStatus string              `json:"catalog_status,omitempty"`
	CatalogDetail string              `json:"catalog_detail,omitempty"`
	Endpoint      string              `json:"endpoint,omitempty"`
	Downloaded    bool                `json:"downloaded,omitempty"`
	ModelPath     string              `json:"model_path,omitempty"`
	RuntimeState  string              `json:"runtime_state,omitempty"`
	RuntimeDetail string              `json:"runtime_detail,omitempty"`
	RuntimeRSS    uint64              `json:"runtime_rss_bytes,omitempty"`
	Config        VoiceProviderConfig `json:"config,omitempty"`
	Models        []VoiceModelOption  `json:"models,omitempty"`
}

Jump to

Keyboard shortcuts

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