config

package
v0.1.0-alpha.41 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: GPL-3.0 Imports: 16 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

Overview

Package config defines startup defaults, versioned settings, and durable settings storage.

Index

Constants

View Source
const (
	// AutopilotSpeechOff disables autonomous spoken check-ins.
	AutopilotSpeechOff = "off"
	// AutopilotSpeechQuiet uses long gaps between autonomous lines.
	AutopilotSpeechQuiet = "quiet"
	// AutopilotSpeechNatural is the default conversational cadence.
	AutopilotSpeechNatural = "natural"
	// AutopilotSpeechTalkative uses shorter gaps between autonomous lines.
	AutopilotSpeechTalkative = "talkative"
	// AutopilotSpeechCustom uses the saved custom speech bounds.
	AutopilotSpeechCustom = "custom"

	// AutopilotMotionSteady changes semantic targets infrequently.
	AutopilotMotionSteady = "steady"
	// AutopilotMotionNatural is the default motion-evolution cadence.
	AutopilotMotionNatural = "natural"
	// AutopilotMotionDynamic changes semantic targets more frequently.
	AutopilotMotionDynamic = "dynamic"
	// AutopilotMotionCustom uses the saved custom motion bounds.
	AutopilotMotionCustom = "custom"
	// AutopilotMotionScaled uses the numbered 1-8 motion-change-rate preference.
	AutopilotMotionScaled = "scaled"

	// AutopilotSpeechMotionChatOnly prevents autonomous speech turns from
	// changing motion.
	AutopilotSpeechMotionChatOnly = "chat_only"
	// AutopilotSpeechMotionStyle lets autonomous speech adjust speed or area
	// while preserving the current pattern.
	AutopilotSpeechMotionStyle = "style_only"
	// AutopilotSpeechMotionFull lets autonomous speech select enabled patterns.
	AutopilotSpeechMotionFull = "full_motion"

	// AutopilotMinimumIntervalSeconds is the hard floor for either clock.
	AutopilotMinimumIntervalSeconds = 8
	// AutopilotMaximumSpeechSeconds caps custom spoken-check-in intervals.
	AutopilotMaximumSpeechSeconds = 600
	// AutopilotMaximumMotionSeconds caps custom motion-change intervals.
	AutopilotMaximumMotionSeconds = 300
	// AutopilotDefaultSpeechMinSeconds is the lower natural speech bound.
	AutopilotDefaultSpeechMinSeconds = 35
	// AutopilotDefaultSpeechMaxSeconds is the upper natural speech bound.
	AutopilotDefaultSpeechMaxSeconds = 120
	// AutopilotDefaultMotionMinSeconds is the lower natural motion bound.
	AutopilotDefaultMotionMinSeconds = 20
	// AutopilotDefaultMotionMaxSeconds is the upper natural motion bound.
	AutopilotDefaultMotionMaxSeconds = 60

	// AutopilotMinimumArcMinutes accepts any positive whole-minute buildup.
	// The model cadence remains independently bounded, so a short buildup does
	// not permit faster model calls or motion outside the user's limits.
	AutopilotMinimumArcMinutes = 1
	// AutopilotMaximumArcMinutes is only a time.Duration overflow guard, not a
	// product-level session limit. It is roughly 292 years.
	AutopilotMaximumArcMinutes = 153_722_867
	// AutopilotDefaultArcMinutes is the first-run buildup duration.
	AutopilotDefaultArcMinutes = 30
)
View Source
const (
	// ReencodeCodecH264 always plays, which is why it is the default.
	ReencodeCodecH264 = "h264"
	// ReencodeCodecH265 halves the file at equal quality but depends on the
	// viewer's OS, browser, and hardware decode.
	ReencodeCodecH265 = "h265"
)

Re-encode targets. Code-owned enums rather than free text, because these become FFmpeg arguments.

View Source
const (
	// MinReencodeCRF is near-lossless and very large.
	MinReencodeCRF = 18
	// MaxReencodeCRF is where compression artifacts become obvious.
	MaxReencodeCRF = 30
	// DefaultReencodeCRFH264 is the x264 default quality point.
	DefaultReencodeCRFH264 = 23
	// DefaultReencodeCRFH265 matches roughly the same visual quality on the
	// x265 scale, which is offset from x264's by about five points.
	DefaultReencodeCRFH265 = 28
	// MinReencodeAudioKbps and MaxReencodeAudioKbps bound AAC output.
	//
	// FFmpeg's native AAC encoder caps a frame at 6144 bits per channel. At
	// 48 kHz with 1024 samples per frame that permits 288 kbps per channel, or
	// 576 kbps for stereo. This setting is a target: the encoder may use less,
	// and lower sample rates or channel counts have lower effective ceilings.
	MinReencodeAudioKbps = 96
	MaxReencodeAudioKbps = 576
	// DefaultReencodeAudioKbps balances size and quality for stereo speech and
	// most soundtracks. Music being re-encoded is the case for raising it.
	DefaultReencodeAudioKbps = 192
	// DefaultReencodePreset balances encode time against size.
	DefaultReencodePreset = "medium"
)

Bounds for the re-encode dials. CRF is exposed over the range where the number still means something; outside it the encoder is either wasting space or visibly destroying detail.

View Source
const (
	// CurrentSettingsVersion is the latest on-disk settings schema version.
	CurrentSettingsVersion = 2

	// DefaultServerPort is the local HTTP port used by fresh settings.
	DefaultServerPort = 49717
)
View Source
const (
	// DispatchOwnerCloudREST selects backend-owned Handy Cloud REST dispatch.
	DispatchOwnerCloudREST = "cloud_rest"
	// DispatchOwnerBrowserBluetooth selects browser-owned Bluetooth dispatch.
	DispatchOwnerBrowserBluetooth = "browser_bluetooth"
	// DispatchOwnerIntiface selects backend-owned Intiface dispatch.
	DispatchOwnerIntiface = "intiface"

	// DefaultIntifaceServerAddress is the default local Intiface WebSocket endpoint.
	DefaultIntifaceServerAddress = "ws://127.0.0.1:12345"

	// FirmwareAPIRequirementRequired records the firmware v4/API v3 requirement.
	FirmwareAPIRequirementRequired = "firmware_v4_api_v3_required"

	// ApplicationIDSourceBundled uses MagicHandy's bundled API v3 application ID.
	ApplicationIDSourceBundled = "bundled_app_id"
	// ApplicationIDSourceDeveloperOverride uses a developer-supplied application ID.
	ApplicationIDSourceDeveloperOverride = "developer_override"

	// BundledAPIApplicationID is MagicHandy's public API v3 application identifier.
	BundledAPIApplicationID = "rQoTWeMPrklUYcfdSXYYhS_9z.jAVNwy"

	// DiagnosticsVerbosityNormal records ordinary diagnostics output.
	DiagnosticsVerbosityNormal = "normal"
	// DiagnosticsVerbosityDebug records verbose diagnostics output.
	DiagnosticsVerbosityDebug = "debug"
	// DiagnosticsVerbosityTrace records the most verbose diagnostics output.
	DiagnosticsVerbosityTrace = "trace"

	// ChatStartupPrevious restores the most recently active retained chat.
	ChatStartupPrevious = "previous"
	// ChatStartupNew starts each process with a new unsaved chat.
	ChatStartupNew = "new"
)
View Source
const (
	// LLMProviderLlamaCPP is the primary managed Windows/NVIDIA local LLM path.
	LLMProviderLlamaCPP = "llama_cpp"
	// LLMProviderOllama is the secondary externally managed local LLM path.
	LLMProviderOllama = "ollama"

	// LlamaCPPModeManaged starts and owns a configured llama-server process.
	LlamaCPPModeManaged = "managed"
	// LlamaCPPModeExternal connects to a user-managed llama-server process.
	LlamaCPPModeExternal = "external"
	// LLMManagedLoadStartup loads a managed llama.cpp model in the background
	// when the app starts, avoiding a cold first chat or Autopilot decision.
	LLMManagedLoadStartup = "startup"
	// LLMManagedLoadOnDemand leaves the managed model unloaded until requested,
	// saving idle RAM and VRAM at the cost of cold-request latency.
	LLMManagedLoadOnDemand = "on_demand"

	// PromptSetMagicHandyMotionV1 is the default chat and motion JSON contract.
	PromptSetMagicHandyMotionV1 = "magichandy_motion_v1"
	// PromptSetMagicHandyMotionV1ES is the built-in Spanish prompt set.
	PromptSetMagicHandyMotionV1ES = "magichandy_motion_v1_es"
	// PromptSetMagicHandyMotionV1PTBR is the built-in Brazilian Portuguese prompt set.
	PromptSetMagicHandyMotionV1PTBR = "magichandy_motion_v1_pt_br"
	// PromptSetMagicHandyMotionV1ZHHans is the built-in Simplified Chinese prompt set.
	PromptSetMagicHandyMotionV1ZHHans = "magichandy_motion_v1_zh_hans"
	// PromptSetMagicHandyMotionV1JA is the built-in Japanese prompt set.
	PromptSetMagicHandyMotionV1JA = "magichandy_motion_v1_ja"

	// LLMChatVoiceUtility keeps the original neutral motion-assistant register.
	LLMChatVoiceUtility = "utility"
	// LLMChatVoiceWarm is a flirtatious companion voice, suggestive at most.
	LLMChatVoiceWarm = "warm"
	// LLMChatVoiceIntimate is a first-person partner voice with sensual language.
	LLMChatVoiceIntimate = "intimate"
	// LLMChatVoiceExplicit permits direct erotic language (STGPT-RV parity).
	LLMChatVoiceExplicit = "explicit"

	// LLMReactionStyleNeutral composes no style block at all, so a persona left
	// on the default produces a byte-identical prompt to having no persona.
	LLMReactionStyleNeutral = "neutral"
	// LLMReactionStylePlayful teases lightly and initiates.
	LLMReactionStylePlayful = "playful"
	// LLMReactionStyleTender is attentive, reassuring, unhurried.
	LLMReactionStyleTender = "tender"
	// LLMReactionStyleDominant leads and says what happens next. It shapes reply
	// wording only: no style may claim authority over the device.
	LLMReactionStyleDominant = "dominant"
	// LLMReactionStyleSubmissive follows, asks, and defers.
	LLMReactionStyleSubmissive = "submissive"
	// LLMReactionStyleTeasing withholds and draws things out.
	LLMReactionStyleTeasing = "teasing"

	// LLMUserAnatomyPenis selects penis-specific prompt vocabulary.
	LLMUserAnatomyPenis = "penis"
	// LLMUserAnatomyVagina selects vagina/vulva-specific prompt vocabulary.
	LLMUserAnatomyVagina = "vagina"
	// LLMUserAnatomyCustom uses the separately saved custom wording.
	LLMUserAnatomyCustom = "custom"
	// MaxLLMCustomAnatomyChars matches the reviewed STGPT-RV prompt setting.
	MaxLLMCustomAnatomyChars = 120
	// MaxLLMPersonaDescriptionChars bounds user-authored prompt context.
	MaxLLMPersonaDescriptionChars = 500

	// DefaultLlamaCPPBaseURL is the default llama-server OpenAI-compatible URL.
	DefaultLlamaCPPBaseURL = "http://127.0.0.1:8080"
	// DefaultOllamaBaseURL is the default local Ollama daemon URL.
	DefaultOllamaBaseURL = "http://127.0.0.1:11434"
	// DefaultLLMModel is a placeholder model name users replace with a local model.
	DefaultLLMModel = "local-model"
	// DefaultLLMRequestTimeoutMillis caps one chat or repair pass.
	DefaultLLMRequestTimeoutMillis = 120000
	// DefaultLLMMaxOutputTokens bounds compact intent JSON generation.
	DefaultLLMMaxOutputTokens = 256
	// DefaultLlamaCPPContextSize balances the measured prompt size against
	// managed-runner RAM and VRAM allocation.
	DefaultLlamaCPPContextSize = 32768

	// LLMReasoningAuto leaves thinking behavior to the provider and model.
	LLMReasoningAuto = "auto"
	// LLMReasoningOff disables thinking when the provider/template supports it.
	LLMReasoningOff = "off"

	// LLMMotionModeDynamic lets the model author bounded motion geometry directly.
	LLMMotionModeDynamic = "dynamic"
	// LLMMotionModePattern lets the model select from enabled library patterns.
	LLMMotionModePattern = "pattern"
	// LLMMotionModeLayered edits persistent continuous modulation layers.
	LLMMotionModeLayered = "layered"
	// LLMMotionModeCreativeV2 generates asymmetric strokes and localized rebounds.
	LLMMotionModeCreativeV2 = "creative_v2"
	// LLMMotionModeOff keeps the model chat-only.
	LLMMotionModeOff = "off"
)
View Source
const (
	// VoiceProviderNone disables one voice role.
	VoiceProviderNone = "none"
	// VoiceProviderCustom runs the stored raw worker command unchanged.
	VoiceProviderCustom = "custom"
	// VoiceTTSProviderElevenLabs selects the bundled ElevenLabs worker.
	VoiceTTSProviderElevenLabs = "elevenlabs"
	// VoiceTTSProviderFasterQwen selects the scripted Faster Qwen3-TTS module.
	VoiceTTSProviderFasterQwen = "faster_qwen3_tts"
	// VoiceTTSProviderChatterbox selects the scripted Chatterbox TTS module.
	VoiceTTSProviderChatterbox = "chatterbox_tts"
	// VoiceTTSProviderOpenAICompat selects an external compatible TTS server.
	VoiceTTSProviderOpenAICompat = "openai_compatible"
	// VoiceASRProviderParakeet selects managed local Parakeet.
	VoiceASRProviderParakeet = "parakeet_managed"
	// VoiceASRProviderOpenAICompat selects an external compatible ASR server.
	VoiceASRProviderOpenAICompat = "openai_compatible"
	// DefaultParakeetServerPort is the managed local ASR port.
	DefaultParakeetServerPort = 8990
	// ParakeetSourceApp uses the runner and model installed by MagicHandy.
	ParakeetSourceApp = "app_managed"
	// ParakeetSourceCustom uses user-supplied local runner and model paths.
	ParakeetSourceCustom = "custom_local"
	// DefaultElevenLabsVoiceID is the stock Rachel voice.
	DefaultElevenLabsVoiceID = "21m00Tcm4TlvDq8ikWAM"
	// DefaultElevenLabsModelID is the default multilingual model.
	DefaultElevenLabsModelID = "eleven_multilingual_v2"
	// DefaultTTSServerPort is the first managed local TTS port.
	DefaultTTSServerPort = 8991
	// DefaultTTSBaseURL is the loopback endpoint used by the first TTS module.
	DefaultTTSBaseURL = "http://127.0.0.1:8991"
	// DefaultTTSResponseFormat is broadly playable and supports header repair.
	DefaultTTSResponseFormat = "wav"
	// DefaultTTSHealthPath is used by Faster Qwen and most compatible servers.
	DefaultTTSHealthPath = "/health"
	// DefaultChatterboxHealthPath reports whether the model actually loaded.
	DefaultChatterboxHealthPath = "/api/model-info"
	// DefaultFasterQwenModel limits VRAM relative to the 1.7B model.
	DefaultFasterQwenModel = "Qwen/Qwen3-TTS-12Hz-0.6B-Base"
	// DefaultFasterQwenVoice names the single reference configured by the script.
	DefaultFasterQwenVoice = "default"
	// DefaultFasterQwenSeed matches the pinned runner's documented examples.
	DefaultFasterQwenSeed uint32 = 1337
	// TTSSeedModeFixed reuses the saved seed for repeatable synthesis.
	TTSSeedModeFixed = "fixed"
	// TTSSeedModeVaried selects a fresh seed for each synthesis request.
	TTSSeedModeVaried = "varied"
	// ChatSpeechInterrupt cancels queued and active speech when the user sends a
	// new chat turn, freeing a shared local GPU for the LLM.
	ChatSpeechInterrupt = "interrupt"
	// ChatSpeechFinishCurrent lets existing speech finish before the shared GPU
	// is fully available to a local LLM.
	ChatSpeechFinishCurrent = "finish_current"
	// TTSToneNatural preserves the cloned reference delivery without an extra
	// model instruction. It is the backward-compatible default.
	TTSToneNatural = "natural"
	// TTSToneWarm asks for a warmer, more intimate delivery.
	TTSToneWarm = "warm"
	// TTSTonePlayful asks for lively, teasing expression.
	TTSTonePlayful = "playful"
	// TTSToneTender asks for a soft, reassuring delivery.
	TTSToneTender = "tender"
	// TTSToneCommanding asks for confident, deliberate emphasis.
	TTSToneCommanding = "commanding"
	// TTSToneExcited asks for energetic pitch and pacing variation.
	TTSToneExcited = "excited"
	// TTSToneCustom uses the user's saved instruction verbatim.
	TTSToneCustom = "custom"
	// DefaultTTSTonePreset preserves pre-feature voice output.
	DefaultTTSTonePreset = TTSToneNatural
	// DefaultChatterboxModel selects the reviewed Turbo model.
	DefaultChatterboxModel = "chatterbox-turbo"
	// DefaultChatterboxVoice is bundled by the pinned server checkout.
	DefaultChatterboxVoice = "Emily.wav"
	// TTSDeviceAuto lets a scripted server select its best available backend.
	TTSDeviceAuto = "auto"
	// TTSDeviceCUDA selects an NVIDIA CUDA runtime.
	TTSDeviceCUDA = "cuda"
	// TTSDeviceCPU selects a compatibility CPU runtime.
	TTSDeviceCPU = "cpu"
	// VoiceInputModeHandsFree keeps listening and segments phrases at silence.
	VoiceInputModeHandsFree = "hands_free"
	// VoiceInputModeHold records only while the microphone control is held.
	VoiceInputModeHold = "hold"
	// DefaultVoiceInputSensitivity balances quiet speech against room noise.
	DefaultVoiceInputSensitivity = 55
	// DefaultVoiceInputSilenceMillis closes a phrase after this quiet period.
	DefaultVoiceInputSilenceMillis = 900
)
View Source
const (
	HandyModelOriginal  = "handy_original"
	HandyModel2Standard = "handy_2_standard"
	HandyModel2Pro      = "handy_2_pro"
)

Handy model profiles calibrate the semantic speed control against published full-travel and normal operating-speed specifications. They do not select a transport, enable overclocking, or claim undocumented acceleration limits.

View Source
const (
	// MotionStyleGentle favors slow full strokes and longer segments.
	MotionStyleGentle = "gentle"
	// MotionStyleBalanced is the default mixed profile.
	MotionStyleBalanced = "balanced"
	// MotionStyleIntense favors pulse patterns, higher speeds, faster changes.
	MotionStyleIntense = "intense"
)

Motion style preferences bias the deterministic mode planners directly (never only prompt text): pattern weights, speed bias, and segment pacing.

View Source
const (
	// LocaleEnglish is the default interface and prompt-catalog locale.
	LocaleEnglish = "en"
	// LocaleSpanish selects Spanish.
	LocaleSpanish = "es"
	// LocalePortugueseBrazil selects Brazilian Portuguese.
	LocalePortugueseBrazil = "pt-BR"
	// LocaleSimplifiedChinese selects Simplified Chinese.
	LocaleSimplifiedChinese = "zh-Hans"
	// LocaleJapanese selects Japanese.
	LocaleJapanese = "ja"
	// UpdateCheckAutomatic checks GitHub Releases after the UI connects.
	UpdateCheckAutomatic = "automatic"
	// UpdateCheckManual only contacts GitHub after an explicit user action.
	UpdateCheckManual = "manual"
	// NotificationCategoryApp stores routine command feedback in notification history.
	NotificationCategoryApp = "app"
	// NotificationCategorySystem stores core and device availability changes.
	NotificationCategorySystem = "system"
	// NotificationCategoryLibrary stores media scan and processing results.
	NotificationCategoryLibrary = "library"
	// NotificationCategoryVoice stores managed voice worker alerts.
	NotificationCategoryVoice = "voice"
	// NotificationCategoryUpdates stores available-release notices.
	NotificationCategoryUpdates = "updates"
)
View Source
const (
	// ThemeSteelAzure is the default MagicHandy visual system.
	ThemeSteelAzure = "steel-azure"

	ThemeCarbonEmerald    = "carbon-emerald"
	ThemeCarbonStealth    = "carbon-stealth"
	ThemePlatinum         = "platinum"
	ThemePolarFrost       = "polar-frost"
	ThemeSage             = "sage"
	ThemeAmberPhosphor    = "amber-phosphor"
	ThemeGreenPhosphor    = "green-phosphor"
	ThemePaperwhiteCRT    = "paperwhite-crt"
	ThemeCyberMidnight    = "cyber-midnight"
	ThemeDeepViolet       = "deep-violet"
	ThemeHighContrast     = "high-contrast"
	ThemeIcebergSlate     = "iceberg-slate"
	ThemeMidnightGraphite = "midnight-graphite"
	ThemeMoonlight        = "moonlight-lavender"
	ThemeNordicDusk       = "nordic-dusk"
	ThemeObsidianTeal     = "obsidian-teal"
	ThemeObsidianViolet   = "obsidian-violet"
	ThemeOceanTrench      = "ocean-trench"
	ThemeSolarisAmber     = "solaris-amber"
	ThemeWarmTitanium     = "warm-titanium"
	ThemeZenithMonochrome = "zenith-monochrome"
)

Theme constants identify the visual systems bundled with MagicHandy.

View Source
const MaxPeakRoundingMillis = 200

MaxPeakRoundingMillis bounds how far a rounded corner reaches. Beyond this the fillet stops being a softened peak and becomes a different stroke shape.

View Source
const MaxScriptOffsetMillis = 2000

MaxScriptOffsetMillis bounds the paired-script calibration offset. Two seconds covers authoring bias, display presentation latency, and device actuation lag together; beyond that the pairing itself is wrong.

View Source
const MaxScriptSmoothingPercent = 5

MaxScriptSmoothingPercent bounds jitter removal. Above this the filter stops removing noise and starts removing strokes.

Variables

DefaultNotificationCategories keeps routine feedback and successful library work out of the bell while retaining operational and release alerts.

Functions

func IsSupportedLocale

func IsSupportedLocale(locale string) bool

IsSupportedLocale reports whether locale has bundled UI and prompt catalogs.

func IsSupportedUITheme

func IsSupportedUITheme(theme string) bool

IsSupportedUITheme reports whether theme has a bundled CSS token set.

func LLMChatVoices

func LLMChatVoices() []string

LLMChatVoices lists the reply registers in escalation order. Exported so the persona store validates against the same list the settings form offers, rather than keeping a second copy that can drift from this one.

func LLMReactionStyles

func LLMReactionStyles() []string

LLMReactionStyles lists the reaction styles, neutral first because it is the default and the only one that composes nothing.

func LlamaCPPContextSizes

func LlamaCPPContextSizes() []int

LlamaCPPContextSizes lists the reviewed managed-runner context allocations. Callers receive a new slice so the settings catalog cannot be mutated.

func PromptSetForLocale

func PromptSetForLocale(locale string) (string, bool)

PromptSetForLocale maps a supported reply locale to its built-in prompt set.

func ReencodePresets

func ReencodePresets() []string

ReencodePresets returns the accepted encoder presets.

func ResolveDataDir

func ResolveDataDir(explicit string) (string, error)

ResolveDataDir returns the configured app data directory.

func ResolveTTSTonePrompt

func ResolveTTSTonePrompt(settings VoiceSettings) string

ResolveTTSTonePrompt maps a saved preset to the instruction sent only to instruction-capable TTS providers. Natural intentionally resolves empty so existing Faster Qwen installations retain their previous behavior.

func SupportedUIThemes

func SupportedUIThemes() []string

SupportedUIThemes returns the ordered settings catalog. The default remains first; callers receive a copy so the validation catalog cannot be mutated.

func TTSTonePresets

func TTSTonePresets() []string

TTSTonePresets returns the backend-authoritative tone choices in UI order.

func ValidLLMChatVoice

func ValidLLMChatVoice(voice string) bool

ValidLLMChatVoice reports whether a reply register is one this build composes.

func ValidLLMReactionStyle

func ValidLLMReactionStyle(style string) bool

ValidLLMReactionStyle reports whether a reaction style is one this build composes.

Types

type AutopilotSettings

type AutopilotSettings struct {
	SpeechCadence         string `json:"speech_cadence"`
	SpeechMinSeconds      int    `json:"speech_min_seconds"`
	SpeechMaxSeconds      int    `json:"speech_max_seconds"`
	MotionCadence         string `json:"motion_cadence"`
	MotionChangeLevel     int    `json:"motion_change_level"`
	MotionMinSeconds      int    `json:"motion_min_seconds"`
	MotionMaxSeconds      int    `json:"motion_max_seconds"`
	AdaptiveSpeechTiming  bool   `json:"adaptive_speech_timing"`
	AdaptiveMotionTiming  bool   `json:"adaptive_motion_timing"`
	SpeechMotionAuthority string `json:"speech_motion_authority"`
	// SessionTracking lets the model see elapsed session time, speed history,
	// and backend-measured phrase sameness (age, reconsiderations, and holds).
	// Inert input: it informs decisions and authorizes nothing. Off removes the
	// facts from the prompt entirely rather than sending zeros.
	SessionTracking bool `json:"session_tracking"`
	// SessionArc enables the visible elapsed-session fill bar supplied to the
	// model as pacing context. It is a separate switch from SessionTracking
	// because knowing how long a session has run and asking the model to pace
	// along a configured buildup are different choices.
	//
	// The buildup positions intent inside the user's existing speed band. It never
	// widens the band, the focus range, or any capability gate.
	SessionArc        bool `json:"session_arc"`
	SessionArcMinutes int  `json:"session_arc_minutes"`
}

AutopilotSettings contains durable user preferences. Scheduler deadlines, pending model decisions, and playback acknowledgements are runtime state and never belong in the settings document.

func DefaultAutopilotSettings

func DefaultAutopilotSettings() AutopilotSettings

DefaultAutopilotSettings returns the conservative first-run profile.

func (AutopilotSettings) MotionWindow

func (s AutopilotSettings) MotionWindow() (minimum int, maximum int)

MotionWindow returns the effective motion-evolution bounds.

func (AutopilotSettings) SpeechWindow

func (s AutopilotSettings) SpeechWindow() (minimum int, maximum int, enabled bool)

SpeechWindow returns the effective bounds and whether autonomous speech is enabled.

type ChatSettings

type ChatSettings struct {
	StartupBehavior   string `json:"startup_behavior"`
	KeepUnsavedOnExit bool   `json:"keep_unsaved_on_exit"`
}

ChatSettings controls process-start restoration. Saved chats are always retained; preserving an unsaved current chat is an explicit privacy choice.

type Config

type Config struct {
	Server Server
}

Config is the top-level application configuration.

func Default

func Default() Config

Default returns the built-in configuration used when no settings file exists.

type DeviceSettings

type DeviceSettings struct {
	HSPDispatchOwner         string `json:"hsp_dispatch_owner"`
	IntifaceServerAddress    string `json:"intiface_server_address"`
	FirmwareAPIRequirement   string `json:"firmware_api_requirement"`
	APIApplicationIDSource   string `json:"api_application_id_source"`
	APIApplicationIDOverride string `json:"api_application_id_override,omitempty"`
	HandyConnectionKey       string `json:"handy_connection_key,omitempty"`
}

DeviceSettings contains device transport configuration.

type DeviceUpdate

type DeviceUpdate struct {
	HSPDispatchOwner         string  `json:"hsp_dispatch_owner"`
	IntifaceServerAddress    string  `json:"intiface_server_address"`
	FirmwareAPIRequirement   string  `json:"firmware_api_requirement"`
	APIApplicationIDSource   string  `json:"api_application_id_source"`
	APIApplicationIDOverride string  `json:"api_application_id_override"`
	HandyConnectionKey       *string `json:"handy_connection_key,omitempty"`
}

DeviceUpdate is the API write payload for device settings.

type DiagnosticsSettings

type DiagnosticsSettings struct {
	Verbosity string `json:"verbosity"`
}

DiagnosticsSettings contains logging and diagnostics verbosity settings.

type LLMMotionCapabilities

type LLMMotionCapabilities struct {
	// Motion is the master gate: off makes the model chat-only.
	Motion bool `json:"motion"`
	// Patterns lets the model curate enabled library patterns.
	Patterns bool `json:"patterns"`
	// AreaFocus lets the model focus motion on a named zone (tip/shaft/base).
	AreaFocus bool `json:"area_focus"`
	// ExperimentalPatterns includes experimental-tagged patterns in the
	// model's catalog. They stay visible and playable in the library UI
	// regardless — this only gates model access.
	ExperimentalPatterns bool `json:"experimental_patterns"`
}

LLMMotionCapabilities is the user-selected checkbox list of control methods the model may use. Enforcement is server-side: disabled methods are neither advertised in the prompt nor honored if the model emits them. Stop and all user controls are unaffected — these gates only ever restrict the model.

func DefaultLLMMotionCapabilities

func DefaultLLMMotionCapabilities() LLMMotionCapabilities

DefaultLLMMotionCapabilities matches the pre-gate behavior plus area focus; experimental patterns are opt-in.

type LLMSettings

type LLMSettings struct {
	Provider             string `json:"provider"`
	LlamaCPPMode         string `json:"llama_cpp_mode"`
	ManagedLoadPolicy    string `json:"managed_load_policy"`
	LlamaCPPBaseURL      string `json:"llama_cpp_base_url"`
	LlamaCPPContextSize  int    `json:"llama_cpp_context_size"`
	OllamaBaseURL        string `json:"ollama_base_url"`
	OllamaModelsPath     string `json:"ollama_models_path,omitempty"`
	Model                string `json:"model"`
	PromptSet            string `json:"prompt_set"`
	RequestTimeoutMillis int    `json:"request_timeout_ms"`
	MaxOutputTokens      int    `json:"max_output_tokens"`
	ReasoningMode        string `json:"reasoning_mode"`
	// ChatVoice selects how sexual the model's reply register may be. It only
	// shapes prompt composition; the motion contract and every motion safety
	// gate are identical at every level.
	ChatVoice string `json:"chat_voice"`
	// UserAnatomy controls code-owned vocabulary independently of the partner
	// persona. CustomAnatomy and PersonaDescription are quoted as data when
	// composed into a non-utility chat prompt.
	UserAnatomy        string `json:"user_anatomy"`
	CustomAnatomy      string `json:"custom_anatomy"`
	PersonaDescription string `json:"persona_description"`
	// MotionGenerationMode selects the single model-facing motion vocabulary.
	// Dynamic geometry and pattern IDs are never advertised together.
	MotionGenerationMode string `json:"motion_generation_mode"`
	// MotionCapabilities gates which motion control methods the model may
	// use. A nil pointer means "never saved" and resolves to the defaults, so
	// older payloads keep today's behavior; an explicit all-false is a valid
	// saved choice (chat-only model).
	MotionCapabilities *LLMMotionCapabilities `json:"motion_capabilities,omitempty"`
}

LLMSettings contains local model provider settings.

func (LLMSettings) Capabilities

func (s LLMSettings) Capabilities() LLMMotionCapabilities

Capabilities resolves the saved motion-capability gates, applying defaults for payloads that predate the field.

type LLMUpdate

type LLMUpdate struct {
	Provider             string  `json:"provider"`
	LlamaCPPMode         string  `json:"llama_cpp_mode"`
	ManagedLoadPolicy    *string `json:"managed_load_policy,omitempty"`
	LlamaCPPBaseURL      string  `json:"llama_cpp_base_url"`
	LlamaCPPContextSize  *int    `json:"llama_cpp_context_size,omitempty"`
	OllamaBaseURL        string  `json:"ollama_base_url"`
	OllamaModelsPath     string  `json:"ollama_models_path,omitempty"`
	Model                string  `json:"model"`
	PromptSet            string  `json:"prompt_set"`
	RequestTimeoutMillis int     `json:"request_timeout_ms"`
	MaxOutputTokens      *int    `json:"max_output_tokens,omitempty"`
	ReasoningMode        *string `json:"reasoning_mode,omitempty"`
	// ChatVoice replaces the saved voice when present; omitted preserves the
	// current persisted value (older clients keep working).
	ChatVoice *string `json:"chat_voice,omitempty"`
	// UserAnatomy, CustomAnatomy, and PersonaDescription preserve saved values
	// when omitted by an older settings client.
	UserAnatomy        *string `json:"user_anatomy,omitempty"`
	CustomAnatomy      *string `json:"custom_anatomy,omitempty"`
	PersonaDescription *string `json:"persona_description,omitempty"`
	// MotionGenerationMode replaces the saved model motion vocabulary when
	// present; omission preserves compatibility with older settings clients.
	MotionGenerationMode *string `json:"motion_generation_mode,omitempty"`
	// MotionCapabilities replaces the saved gates when present; omitted
	// preserves the current persisted values (older clients keep working).
	MotionCapabilities *LLMMotionCapabilities `json:"motion_capabilities,omitempty"`
}

LLMUpdate is the settings API write shape. New tuning fields are pointers so older clients that omit them preserve the current persisted values.

func LLMUpdateFromSettings

func LLMUpdateFromSettings(settings LLMSettings) LLMUpdate

LLMUpdateFromSettings creates a complete write payload from a settings view.

type LabsSettings

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

LabsSettings is an opt-in workspace available in every release. Omitted settings from an older installation remain disabled.

type LoadStatus

type LoadStatus struct {
	DataDir                string `json:"data_dir"`
	SettingsPath           string `json:"settings_path"`
	DatastorePath          string `json:"datastore_path"`
	DatastoreRecoveredPath string `json:"datastore_recovered_path,omitempty"`
	LegacySettingsPath     string `json:"legacy_settings_path,omitempty"`
	LegacyArchivedPath     string `json:"legacy_archived_path,omitempty"`
	Source                 string `json:"source"`
	UsingDefaults          bool   `json:"using_defaults"`
	Recovered              bool   `json:"recovered"`
	Migrated               bool   `json:"migrated"`
	Imported               bool   `json:"imported,omitempty"`
	Message                string `json:"message,omitempty"`
	LoadedAt               string `json:"loaded_at"`
}

LoadStatus describes how settings were loaded without exposing setting values.

type MediaSettings

type MediaSettings struct {
	LibraryPaths []string `json:"library_paths"`
	// AutoScanOnStartup starts a background scan after the core has opened its
	// persistent domains. RemoveMissingOnScan controls whether a fully
	// enumerated root drops absent rows immediately or retains them as missing.
	// An unavailable or partial root is always preserved regardless of policy.
	AutoScanOnStartup   bool `json:"auto_scan_on_startup"`
	RemoveMissingOnScan bool `json:"remove_missing_on_scan"`
	// ScriptOffsetMillis shifts a paired script against its video. Positive
	// delays the script, negative advances it. Some offset is not a defect the
	// app can remove: scripts are authored against a particular sense of "on
	// the beat", displays add their own presentation latency, and the device
	// takes real time to move. This is the calibration control for that
	// remainder, not a substitute for correct clock alignment.
	ScriptOffsetMillis int `json:"script_offset_ms"`
	// ScriptSmoothingPercent removes authored extrema below this prominence.
	// Zero is off, which is the default: the paired script plays exactly as
	// authored unless the user asks for something else.
	ScriptSmoothingPercent int `json:"script_smoothing_percent"`
	// PeakRoundingMillis rounds each direction change over this window, moving
	// a hand-authored triangle toward a sine. Zero is off.
	PeakRoundingMillis int `json:"peak_rounding_ms"`
	// FFmpegPath points at an external FFmpeg the user supplies. Empty means
	// absent, which is a supported state: every feature that needs it says so
	// rather than half-working. ffprobe is resolved beside it.
	FFmpegPath string `json:"ffmpeg_path"`
	// ConvertH265ForCompatibility declares that HEVC does not play in this
	// browser. The default assumes it does, because most current setups decode
	// it; Firefox is the common exception. Turning this on both makes H.265 a
	// conversion candidate and forces re-encodes to H.264 — see
	// ReencodeCodecFor, which owns that interlock so no caller can half-apply it.
	ConvertH265ForCompatibility bool `json:"convert_h265_for_compatibility"`
	// ReencodeCodec is the target when a remux cannot fix the file.
	ReencodeCodec string `json:"reencode_codec"`
	// ReencodeCRFH264 and ReencodeCRFH265 are separate because the two scales
	// are not the same number: carrying one value across a codec change would
	// silently move quality in whichever direction the user did not ask for.
	ReencodeCRFH264 int `json:"reencode_crf_h264"`
	ReencodeCRFH265 int `json:"reencode_crf_h265"`
	// ReencodePreset trades encoding time for file size at equal quality.
	ReencodePreset string `json:"reencode_preset"`
	// ReencodeAudioKbps applies only when the source audio is not already AAC.
	ReencodeAudioKbps int `json:"reencode_audio_kbps"`
	// GenerateThumbnailsOnScan and ConvertIncompatibleOnScan ride any scan,
	// including an opted-in startup scan.
	GenerateThumbnailsOnScan  bool `json:"generate_thumbnails_on_scan"`
	ConvertIncompatibleOnScan bool `json:"convert_incompatible_on_scan"`
	// ShowSupersededOriginals reveals rows hidden because a converted copy of
	// the same basename exists beside them.
	ShowSupersededOriginals bool `json:"show_superseded_originals"`
}

MediaSettings contains user-selected roots and video catalog scan policy. Paths are not secrets, but the scanner never accepts them from media routes.

func (MediaSettings) ReencodeCRF

func (s MediaSettings) ReencodeCRF() int

ReencodeCRF returns the quality point for the effective codec.

func (MediaSettings) ReencodeCodecFor

func (s MediaSettings) ReencodeCodecFor() string

ReencodeCodecFor resolves the effective re-encode target. It exists so the compatibility toggle cannot be half-applied: a user who has just declared that H.265 does not play here must never get an H.265 file back, which is an hour of encoding spent arriving at another file that will not play.

type MediaUpdate

type MediaUpdate struct {
	LibraryPaths                *[]string `json:"library_paths,omitempty"`
	AutoScanOnStartup           *bool     `json:"auto_scan_on_startup,omitempty"`
	RemoveMissingOnScan         *bool     `json:"remove_missing_on_scan,omitempty"`
	ScriptOffsetMillis          *int      `json:"script_offset_ms,omitempty"`
	ScriptSmoothingPercent      *int      `json:"script_smoothing_percent,omitempty"`
	PeakRoundingMillis          *int      `json:"peak_rounding_ms,omitempty"`
	FFmpegPath                  *string   `json:"ffmpeg_path,omitempty"`
	ConvertH265ForCompatibility *bool     `json:"convert_h265_for_compatibility,omitempty"`
	ReencodeCodec               *string   `json:"reencode_codec,omitempty"`
	ReencodeCRFH264             *int      `json:"reencode_crf_h264,omitempty"`
	ReencodeCRFH265             *int      `json:"reencode_crf_h265,omitempty"`
	ReencodePreset              *string   `json:"reencode_preset,omitempty"`
	ReencodeAudioKbps           *int      `json:"reencode_audio_kbps,omitempty"`
	GenerateThumbnailsOnScan    *bool     `json:"generate_thumbnails_on_scan,omitempty"`
	ConvertIncompatibleOnScan   *bool     `json:"convert_incompatible_on_scan,omitempty"`
	ShowSupersededOriginals     *bool     `json:"show_superseded_originals,omitempty"`
}

MediaUpdate patches only the submitted media settings. Filter controls save independently from the general Settings form, so omitted fields must retain the latest durable values rather than being reset by a stale form snapshot.

type MotionSettings

type MotionSettings struct {
	SpeedMinPercent      int    `json:"speed_min_percent"`
	SpeedMaxPercent      int    `json:"speed_max_percent"`
	StrokeMinPercent     int    `json:"stroke_min_percent"`
	StrokeMaxPercent     int    `json:"stroke_max_percent"`
	ReverseDirection     bool   `json:"reverse_direction"`
	ApplyVideoSpeedLimit bool   `json:"apply_video_speed_limit"`
	Style                string `json:"style"`
	HandyModel           string `json:"handy_model"`
}

MotionSettings contains semantic motion defaults and the selected physical calibration profile. The profile changes semantic timing only; raw device coordinates and transport payloads remain outside the engine.

type PublicDeviceSettings

type PublicDeviceSettings struct {
	HSPDispatchOwner         string `json:"hsp_dispatch_owner"`
	IntifaceServerAddress    string `json:"intiface_server_address"`
	FirmwareAPIRequirement   string `json:"firmware_api_requirement"`
	APIApplicationIDSource   string `json:"api_application_id_source"`
	APIApplicationIDOverride string `json:"api_application_id_override,omitempty"`
	ConnectionKeySet         bool   `json:"connection_key_set"`
}

PublicDeviceSettings is the API-safe device settings view.

type PublicSettings

type PublicSettings struct {
	Version     int                       `json:"version"`
	Server      ServerSettings            `json:"server"`
	UI          UISettings                `json:"ui"`
	Labs        LabsSettings              `json:"labs"`
	Media       MediaSettings             `json:"media"`
	Device      PublicDeviceSettings      `json:"device"`
	Motion      MotionSettings            `json:"motion"`
	Autopilot   AutopilotSettings         `json:"autopilot"`
	LLM         LLMSettings               `json:"llm"`
	Voice       PublicVoiceSettings       `json:"voice"`
	Chat        ChatSettings              `json:"chat"`
	Diagnostics DiagnosticsSettings       `json:"diagnostics"`
	Options     PublicSettingsOptionHints `json:"options"`
}

PublicSettings is the API-safe settings view. It intentionally omits secrets.

type PublicSettingsOptionHints

type PublicSettingsOptionHints struct {
	HSPDispatchOwners       []string `json:"hsp_dispatch_owners"`
	APIApplicationIDSources []string `json:"api_application_id_sources"`
	DiagnosticsVerbosities  []string `json:"diagnostics_verbosities"`
	MotionStyles            []string `json:"motion_styles"`
	HandyModels             []string `json:"handy_models"`
	AutopilotSpeechCadences []string `json:"autopilot_speech_cadences"`
	AutopilotMotionCadences []string `json:"autopilot_motion_cadences"`
	AutopilotAuthorities    []string `json:"autopilot_speech_motion_authorities"`
	LLMProviders            []string `json:"llm_providers"`
	LlamaCPPModes           []string `json:"llama_cpp_modes"`
	LLMManagedLoadPolicies  []string `json:"llm_managed_load_policies"`
	LlamaCPPContextSizes    []int    `json:"llama_cpp_context_sizes"`
	LLMReasoningModes       []string `json:"llm_reasoning_modes"`
	LLMMaxOutputTokens      []int    `json:"llm_max_output_tokens"`
	LLMMotionModes          []string `json:"llm_motion_modes"`
	LLMChatVoices           []string `json:"llm_chat_voices"`
	LLMUserAnatomies        []string `json:"llm_user_anatomies"`
	LLMReactionStyles       []string `json:"llm_reaction_styles"`
	PromptSets              []string `json:"prompt_sets"`
	TTSProviders            []string `json:"tts_providers"`
	ASRProviders            []string `json:"asr_providers"`
	ParakeetSources         []string `json:"parakeet_sources"`
	TTSDevices              []string `json:"tts_devices"`
	TTSTonePresets          []string `json:"tts_tone_presets"`
	ChatSpeechPolicies      []string `json:"chat_speech_policies"`
	ChatStartupBehaviors    []string `json:"chat_startup_behaviors"`
	Locales                 []string `json:"locales"`
	Themes                  []string `json:"themes"`
}

PublicSettingsOptionHints lists valid option values for settings clients.

type PublicVoiceSettings

type PublicVoiceSettings struct {
	Enabled            bool     `json:"enabled"`
	TTSProvider        string   `json:"tts_provider"`
	ASRProvider        string   `json:"asr_provider"`
	TTSWorkerPath      string   `json:"tts_worker_path,omitempty"`
	TTSWorkerArgs      []string `json:"tts_worker_args,omitempty"`
	ASRWorkerPath      string   `json:"asr_worker_path,omitempty"`
	ASRWorkerArgs      []string `json:"asr_worker_args,omitempty"`
	SpeakReplies       bool     `json:"speak_replies"`
	ChatSpeechPolicy   string   `json:"chat_speech_policy"`
	ElevenLabsVoiceID  string   `json:"elevenlabs_voice_id,omitempty"`
	ElevenLabsModelID  string   `json:"elevenlabs_model_id,omitempty"`
	TTSAutoLaunch      bool     `json:"tts_auto_launch"`
	TTSBaseURL         string   `json:"tts_base_url,omitempty"`
	TTSModel           string   `json:"tts_model,omitempty"`
	TTSVoice           string   `json:"tts_voice,omitempty"`
	TTSResponseFormat  string   `json:"tts_response_format,omitempty"`
	TTSHealthPath      string   `json:"tts_health_path,omitempty"`
	TTSModuleRoot      string   `json:"tts_module_root,omitempty"`
	TTSServerPort      int      `json:"tts_server_port,omitempty"`
	TTSReferenceWAV    string   `json:"tts_reference_wav,omitempty"`
	TTSReferenceText   string   `json:"tts_reference_text,omitempty"`
	TTSLanguage        string   `json:"tts_language,omitempty"`
	TTSDevice          string   `json:"tts_device,omitempty"`
	TTSSeed            uint32   `json:"tts_seed"`
	TTSSeedMode        string   `json:"tts_seed_mode"`
	TTSTonePreset      string   `json:"tts_tone_preset"`
	TTSTonePrompt      string   `json:"tts_tone_prompt,omitempty"`
	ParakeetServerPath string   `json:"parakeet_server_path,omitempty"`
	ParakeetModelPath  string   `json:"parakeet_model_path,omitempty"`
	ParakeetServerPort int      `json:"parakeet_port,omitempty"`
	ParakeetSource     string   `json:"parakeet_source"`
	ASRBaseURL         string   `json:"asr_base_url,omitempty"`
	ASRModel           string   `json:"asr_model,omitempty"`
	InputMode          string   `json:"input_mode"`
	InputSensitivity   int      `json:"input_sensitivity"`
	InputSilenceMillis int      `json:"input_silence_ms"`
	InputNoiseSuppress bool     `json:"input_noise_suppression"`
	ElevenLabsKeySet   bool     `json:"elevenlabs_key_set"`
	OpenAITTSKeySet    bool     `json:"openai_tts_key_set"`
}

PublicVoiceSettings is the API-safe voice view; the ElevenLabs key is reduced to a set/unset flag.

type Server

type Server struct {
	Address string
}

Server contains local HTTP server settings.

type ServerSettings

type ServerSettings struct {
	Port int `json:"port"`
}

ServerSettings contains local HTTP server settings.

type Settings

type Settings struct {
	Version     int                 `json:"version"`
	Server      ServerSettings      `json:"server"`
	UI          UISettings          `json:"ui"`
	Labs        LabsSettings        `json:"labs"`
	Media       MediaSettings       `json:"media"`
	Device      DeviceSettings      `json:"device"`
	Motion      MotionSettings      `json:"motion"`
	Autopilot   AutopilotSettings   `json:"autopilot"`
	LLM         LLMSettings         `json:"llm"`
	Voice       VoiceSettings       `json:"voice"`
	Chat        ChatSettings        `json:"chat"`
	Diagnostics DiagnosticsSettings `json:"diagnostics"`
}

Settings is the versioned on-disk application settings schema.

func DefaultSettings

func DefaultSettings() Settings

DefaultSettings returns the current built-in settings.

func MigrateSettings

func MigrateSettings(settings Settings, sourceVersion int) (Settings, bool, error)

MigrateSettings moves older settings schema versions to the current version.

func NormalizeSettings

func NormalizeSettings(settings Settings) (Settings, error)

NormalizeSettings validates settings and fills any invalid version metadata.

func (Settings) ApplyUpdate

func (s Settings) ApplyUpdate(update SettingsUpdate) (Settings, error)

ApplyUpdate merges a settings API payload into the current settings.

func (Settings) Public

func (s Settings) Public() PublicSettings

Public returns an API-safe settings view with secrets redacted.

type SettingsUpdate

type SettingsUpdate struct {
	Server             ServerSettings      `json:"server"`
	UI                 *UISettings         `json:"ui,omitempty"`
	Labs               *LabsSettings       `json:"labs,omitempty"`
	Media              *MediaUpdate        `json:"media,omitempty"`
	Device             DeviceUpdate        `json:"device"`
	Motion             MotionSettings      `json:"motion"`
	Autopilot          *AutopilotSettings  `json:"autopilot,omitempty"`
	LLM                LLMUpdate           `json:"llm"`
	Voice              VoiceUpdate         `json:"voice"`
	Chat               *ChatSettings       `json:"chat,omitempty"`
	Diagnostics        DiagnosticsSettings `json:"diagnostics"`
	ClearConnectionKey bool                `json:"clear_connection_key"`
}

SettingsUpdate is the payload accepted by the settings API.

type Store

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

Store owns the process-local settings snapshot and durable settings row.

func OpenStore

func OpenStore(dataDir string) (*Store, error)

OpenStore loads settings from dataDir and falls back to defaults safely.

func (*Store) Close

func (s *Store) Close() error

Close releases the settings store database handle.

func (*Store) DataDir

func (s *Store) DataDir() string

DataDir returns the resolved settings directory.

func (*Store) Datastore

func (s *Store) Datastore() *dbstore.DB

Datastore returns the process-owned database for sibling runtime modules. Borrowers must not close it; Store.Close remains the single owner boundary.

func (*Store) Path

func (s *Store) Path() string

Path returns the durable settings file path.

func (*Store) PublicSnapshot

func (s *Store) PublicSnapshot() (PublicSettings, LoadStatus)

PublicSnapshot returns the current redacted settings and load status.

func (*Store) Save

func (s *Store) Save(next Settings) (Settings, error)

Save validates, writes, and publishes the next settings snapshot.

func (*Store) Snapshot

func (s *Store) Snapshot() (Settings, LoadStatus)

Snapshot returns the current settings and load status.

func (*Store) Update

func (s *Store) Update(mutate func(Settings) (Settings, error)) (previous Settings, saved Settings, err error)

Update atomically derives, validates, writes, and publishes settings from the latest snapshot. All runtime read-modify-write paths should use Update rather than constructing a replacement from a separately acquired Snapshot.

type UISettings

type UISettings struct {
	Locale                 string   `json:"locale"`
	Theme                  string   `json:"theme"`
	SetupCompleted         bool     `json:"setup_completed"`
	UpdateCheckMode        string   `json:"update_check_mode,omitempty"`
	NotificationCategories []string `json:"notification_categories"`
}

UISettings contains presentation preferences shared by every browser client.

type VoiceSettings

type VoiceSettings struct {
	Enabled     bool   `json:"enabled"`
	TTSProvider string `json:"tts_provider"`
	ASRProvider string `json:"asr_provider"`

	// The raw command fields remain the lossless custom-provider escape hatch
	// and act as explicit worker-binary overrides for first-party providers.
	TTSWorkerPath string   `json:"tts_worker_path,omitempty"`
	TTSWorkerArgs []string `json:"tts_worker_args,omitempty"`
	ASRWorkerPath string   `json:"asr_worker_path,omitempty"`
	ASRWorkerArgs []string `json:"asr_worker_args,omitempty"`

	ElevenLabsVoiceID string `json:"elevenlabs_voice_id,omitempty"`
	ElevenLabsModelID string `json:"elevenlabs_model_id,omitempty"`

	TTSAutoLaunch     bool   `json:"tts_auto_launch"`
	TTSBaseURL        string `json:"tts_base_url,omitempty"`
	TTSModel          string `json:"tts_model,omitempty"`
	TTSVoice          string `json:"tts_voice,omitempty"`
	TTSResponseFormat string `json:"tts_response_format,omitempty"`
	TTSHealthPath     string `json:"tts_health_path,omitempty"`
	TTSModuleRoot     string `json:"tts_module_root,omitempty"`
	TTSServerPort     int    `json:"tts_server_port,omitempty"`
	TTSReferenceWAV   string `json:"tts_reference_wav,omitempty"`
	TTSReferenceText  string `json:"tts_reference_text,omitempty"`
	TTSLanguage       string `json:"tts_language,omitempty"`
	TTSDevice         string `json:"tts_device,omitempty"`
	TTSSeed           uint32 `json:"tts_seed"`
	TTSSeedMode       string `json:"tts_seed_mode"`
	TTSTonePreset     string `json:"tts_tone_preset"`
	TTSTonePrompt     string `json:"tts_tone_prompt,omitempty"`

	ParakeetServerPath string `json:"parakeet_server_path,omitempty"`
	ParakeetModelPath  string `json:"parakeet_model_path,omitempty"`
	ParakeetServerPort int    `json:"parakeet_port,omitempty"`
	ParakeetSource     string `json:"parakeet_source"`
	ASRBaseURL         string `json:"asr_base_url,omitempty"`
	ASRModel           string `json:"asr_model,omitempty"`
	InputMode          string `json:"input_mode"`
	InputSensitivity   int    `json:"input_sensitivity"`
	InputSilenceMillis int    `json:"input_silence_ms"`
	InputNoiseSuppress bool   `json:"input_noise_suppression"`

	// SpeakReplies enqueues each displayed chat reply to the running TTS
	// worker in lockstep (ADR 0003: a spoken reply is always also shown).
	SpeakReplies bool `json:"speak_replies"`
	// ChatSpeechPolicy controls whether a new interactive message interrupts
	// pending speech. This matters when TTS and the LLM share one local GPU.
	ChatSpeechPolicy string `json:"chat_speech_policy"`
	// ElevenLabsAPIKey is a private credential like the Handy connection
	// key: stored at rest, handed to the TTS worker process only via a
	// private environment variable, never returned by any read API.
	ElevenLabsAPIKey string `json:"elevenlabs_api_key,omitempty"`
	// OpenAITTSAPIKey is an optional bearer credential for a compatible
	// endpoint. Managed loopback modules leave it empty.
	OpenAITTSAPIKey string `json:"openai_tts_api_key,omitempty"`
}

VoiceSettings configures the optional voice worker processes (ADR 0003). Voice is off by default; first-party and custom workers all speak the versioned protocol. Paths are not secrets — the same trust model as other optional local worker executables.

type VoiceUpdate

type VoiceUpdate struct {
	Enabled            bool     `json:"enabled"`
	TTSProvider        string   `json:"tts_provider"`
	ASRProvider        string   `json:"asr_provider"`
	TTSWorkerPath      string   `json:"tts_worker_path"`
	TTSWorkerArgs      []string `json:"tts_worker_args"`
	ASRWorkerPath      string   `json:"asr_worker_path"`
	ASRWorkerArgs      []string `json:"asr_worker_args"`
	SpeakReplies       bool     `json:"speak_replies"`
	ChatSpeechPolicy   *string  `json:"chat_speech_policy,omitempty"`
	ElevenLabsVoiceID  string   `json:"elevenlabs_voice_id"`
	ElevenLabsModelID  string   `json:"elevenlabs_model_id"`
	TTSAutoLaunch      *bool    `json:"tts_auto_launch,omitempty"`
	TTSBaseURL         string   `json:"tts_base_url"`
	TTSModel           string   `json:"tts_model"`
	TTSVoice           string   `json:"tts_voice"`
	TTSResponseFormat  string   `json:"tts_response_format"`
	TTSHealthPath      string   `json:"tts_health_path"`
	TTSModuleRoot      string   `json:"tts_module_root"`
	TTSServerPort      int      `json:"tts_server_port"`
	TTSReferenceWAV    string   `json:"tts_reference_wav"`
	TTSReferenceText   string   `json:"tts_reference_text"`
	TTSLanguage        string   `json:"tts_language"`
	TTSDevice          string   `json:"tts_device"`
	TTSSeed            *uint32  `json:"tts_seed,omitempty"`
	TTSSeedMode        *string  `json:"tts_seed_mode,omitempty"`
	TTSTonePreset      *string  `json:"tts_tone_preset,omitempty"`
	TTSTonePrompt      *string  `json:"tts_tone_prompt,omitempty"`
	ParakeetServerPath string   `json:"parakeet_server_path"`
	ParakeetModelPath  string   `json:"parakeet_model_path"`
	ParakeetServerPort int      `json:"parakeet_port"`
	ParakeetSource     *string  `json:"parakeet_source,omitempty"`
	ASRBaseURL         string   `json:"asr_base_url"`
	ASRModel           string   `json:"asr_model"`
	InputMode          *string  `json:"input_mode,omitempty"`
	InputSensitivity   *int     `json:"input_sensitivity,omitempty"`
	InputSilenceMillis *int     `json:"input_silence_ms,omitempty"`
	InputNoiseSuppress *bool    `json:"input_noise_suppression,omitempty"`
	ElevenLabsAPIKey   *string  `json:"elevenlabs_api_key,omitempty"`
	ClearElevenLabsKey bool     `json:"clear_elevenlabs_key"`
	OpenAITTSAPIKey    *string  `json:"openai_tts_api_key,omitempty"`
	ClearOpenAITTSKey  bool     `json:"clear_openai_tts_key"`
}

VoiceUpdate is the API write payload for voice settings. A nil API key keeps the stored secret; ClearElevenLabsKey removes it.

Jump to

Keyboard shortcuts

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