config

package
v0.1.0-alpha.73 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: GPL-3.0 Imports: 20 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
	// AutopilotAutoTimingMinSeconds is the shortest horizon a hosted planner
	// may choose under auto timing: the shared interval floor.
	AutopilotAutoTimingMinSeconds = AutopilotMinimumIntervalSeconds
	// AutopilotAutoTimingMaxSeconds is the longest horizon a hosted planner may
	// choose under auto timing: the longest custom motion window.
	AutopilotAutoTimingMaxSeconds = AutopilotMaximumMotionSeconds

	// 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 (
	LinkedFailureStopAll         = "stop_all"
	LinkedFailureContinueHealthy = "continue_healthy"
)

Linked session fault policies never change Emergency Stop behavior.

View Source
const (
	// DeviceOutputHandy drives The Handy alone.
	DeviceOutputHandy = "handy"
	// DeviceOutputCoyote drives a DG-LAB Coyote alone (ADR 0044).
	DeviceOutputCoyote = "coyote"
	// DeviceOutputHandyCoyote drives both from the same frame.
	DeviceOutputHandyCoyote = "handy_coyote"
)

Device outputs. The output chooses what the shared motion frame drives; the dispatch owner still chooses how the Handy is reached when it is included.

View Source
const (
	EstimFollowStroke   = "stroke"
	EstimFollowSpeed    = "speed"
	EstimFollowPosition = "position"
)

Coyote conversion profiles: what the shared frame shapes beneath the user's strength. None of them maps position to channel strength.

View Source
const (
	EstimMaxStrength          = 200
	EstimDefaultMaxStrength   = 30
	EstimMinFrequencyHz       = 1
	EstimMaxFrequencyHz       = 100
	EstimDefaultMinHz         = 40
	EstimDefaultMaxHz         = 100
	EstimMaxBalance           = 100
	EstimMaxTimingOffsetMs    = 300
	EstimMaxDeviceBalance     = 255
	EstimDefaultFreqBalance   = 160
	EstimDefaultIntensityBias = 0
)

Coyote setting ranges.

View Source
const (
	// FreestyleFeelGentle is slow, long, calm strokes.
	FreestyleFeelGentle = "gentle"
	// FreestyleFeelBalanced is the default mixed feel.
	FreestyleFeelBalanced = "balanced"
	// FreestyleFeelIntense is quick, lively strokes.
	FreestyleFeelIntense = "intense"
	// FreestyleFeelCustom keeps the user's own control values.
	FreestyleFeelCustom = "custom"

	// FreestyleAccentEven times both directions alike.
	FreestyleAccentEven = "even"
	// FreestyleAccentTip makes strokes toward the tip quicker.
	FreestyleAccentTip = "tip"
	// FreestyleAccentBase makes strokes toward the base quicker.
	FreestyleAccentBase = "base"

	// FreestyleShapeSteady keeps the chosen pace for the whole session.
	FreestyleShapeSteady = "steady"
	// FreestyleShapeBuild starts slow and builds to the chosen pace over the
	// shape duration, then holds it.
	FreestyleShapeBuild = "build"
	// FreestyleShapeWaves rises and falls in slow waves of a few minutes.
	FreestyleShapeWaves = "waves"
	// FreestyleShapeEdge builds toward the chosen pace, backs off into
	// unhurried teasing, and builds again.
	FreestyleShapeEdge = "edge"
	// FreestyleShapeCooldown eases down over the shape duration and then
	// comes to rest, ending Freestyle.
	FreestyleShapeCooldown = "cooldown"

	// FreestyleMinimumShapeMinutes bounds Slow build and Cooldown.
	FreestyleMinimumShapeMinutes = 1
	// FreestyleMaximumShapeMinutes bounds Slow build and Cooldown.
	FreestyleMaximumShapeMinutes = 240
	// FreestyleDefaultShapeMinutes is the first-run shape duration.
	FreestyleDefaultShapeMinutes = 15
)
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 (
	LLMProviderChatGPT    = "chatgpt"
	LLMProviderOpenAI     = "openai"
	LLMProviderOpenRouter = "openrouter"
	LLMProviderCompatible = "compatible"
	ContextConversation   = "conversation"
	ContextTechnical      = "technical"
)

Hosted providers and context policies are independent of saved local defaults.

View Source
const (
	MotionPlannerLocal     = "local"
	MotionPlannerChatGPT   = "chatgpt"
	MotionPlannerDecisions = "decisions"
)

Motion planning can retain local behavior or select separately billed APIs.

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"
	// DispatchOwnerNativeBluetooth selects the host-owned BLE worker.
	DispatchOwnerNativeBluetooth = "native_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 (
	// LLMReplyLengthShort asks for one or two short sentences per reply.
	LLMReplyLengthShort = "short"
	// LLMReplyLengthBalanced composes no length instruction: the prompts'
	// own pacing, as tuned.
	LLMReplyLengthBalanced = "balanced"
	// LLMReplyLengthDetailed allows three to five sentences when the moment
	// calls for it, with room in the output budget to finish them.
	LLMReplyLengthDetailed = "detailed"
	// DetailedReplyMinOutputTokens keeps a detailed reply and its motion JSON
	// from running into the output cap.
	DetailedReplyMinOutputTokens = 512
)

Reply lengths steer how long chat replies run. They shape prose only; the motion contract and every motion gate are identical at every length.

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 (
	VibrationFollowSpeed  = "speed"
	VibrationFollowDepth  = "depth"
	VibrationFollowSteady = "steady"
)

Vibration conversion profiles: what the vibration level follows.

View Source
const (
	VibrationDepthBase = "base"
	VibrationDepthTip  = "tip"
)

Vibration depth ends, in the frame's semantic coordinates: base is position 0, tip is position 100.

View Source
const (
	VibrationDefaultCeilingPercent = 40
	VibrationMaxTimingOffsetMs     = 300
)

Vibration setting ranges and defaults.

View Source
const DeviceOutputNone = "none"

DeviceOutputNone leaves the shared engine idle for chat-only use.

View Source
const DeviceVibrator = "vibrator"

DeviceVibrator is a Buttplug vibrator reached through Intiface Central. It follows the shared motion frame through a conversion profile; the model never controls its intensity.

View Source
const MaxHandys = 8

MaxHandys bounds the saved inventory and concurrent transport resources. The original Handy remains the compatibility instance named "handy".

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 IsHandyConnectionID

func IsHandyConnectionID(id string) bool

IsHandyConnectionID recognizes opaque instance IDs, never physical IDs.

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 LLMReplyLengths

func LLMReplyLengths() []string

LLMReplyLengths lists the reply lengths from shortest to longest.

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 UsesCoyote

func UsesCoyote(output string) bool

UsesCoyote reports whether output includes the Coyote.

func UsesHandy

func UsesHandy(output string) bool

UsesHandy reports whether output includes The Handy.

func ValidConnectionID

func ValidConnectionID(id string) bool

ValidConnectionID excludes the reserved local connection and unsafe IDs.

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.

func ValidLLMReplyLength

func ValidLLMReplyLength(length string) bool

ValidLLMReplyLength reports whether a reply length 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"`
	// AutoMotionTiming lets a hosted Autopilot planner choose how long each
	// stretch plays before it is reconsidered, inside the auto-timing bounds.
	// Local planning ignores it and keeps the Motion change rate window.
	AutoMotionTiming bool `json:"auto_motion_timing"`
	// PrepareNextDecision plans an external planner's next motion decision as
	// soon as a stretch begins, for that stretch's end, so the change is ready
	// at the boundary. Chat, settings changes and Stop discard it. Local
	// planning ignores it and keeps planning just before the boundary.
	PrepareNextDecision bool `json:"prepare_next_decision"`
	// 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 DeviceOptionsPatch

type DeviceOptionsPatch struct {
	LinkedFailurePolicy      *string         `json:"linked_failure_policy,omitempty"`
	IntifaceServerAddress    *string         `json:"intiface_server_address,omitempty"`
	APIApplicationIDSource   *string         `json:"api_application_id_source,omitempty"`
	APIApplicationIDOverride *string         `json:"api_application_id_override,omitempty"`
	ClearConnectionKey       bool            `json:"clear_connection_key,omitempty"`
	Estim                    *EstimPatch     `json:"estim,omitempty"`
	Vibration                *VibrationPatch `json:"vibration,omitempty"`
}

DeviceOptionsPatch changes individual device options as Settings > Devices edits them, so each one saves when it changes. A nil field keeps its value. A new Handy connection key keeps its own explicit save; this patch can only forget the saved one. The device list and the playback set keep their connection endpoint.

type DeviceSettings

type DeviceSettings struct {
	HandyConnections []HandyConnection `json:"handy_connections,omitempty"`
	// NativeBluetoothAddress is a private hardware identifier, never a public setting.
	NativeBluetoothAddress string   `json:"native_bluetooth_address,omitempty"`
	ConfiguredDevices      []string `json:"configured_devices"`
	// PlaybackDevices is the playback participant set. Nil migrates the legacy
	// Output; an explicitly empty set means chat only.
	PlaybackDevices     []string `json:"playback_devices"`
	LinkedFailurePolicy string   `json:"linked_failure_policy"`
	// Output is the legacy projection of the Handy and Coyote members, kept in
	// step with PlaybackDevices for older clients and older versions.
	Output                   string `json:"output"`
	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.

func (DeviceSettings) ChangeConnection

func (d DeviceSettings) ChangeConnection(device, action string) (DeviceSettings, error)

ChangeConnection applies one inventory or participation edit atomically. Adding never includes a device in playback; removing also excludes it.

func (DeviceSettings) HandyConnection

func (d DeviceSettings) HandyConnection(id string) (HandyConnection, bool)

HandyConnection finds an additional instance by its opaque ID.

func (DeviceSettings) HasDevice

func (d DeviceSettings) HasDevice(device string) bool

HasDevice checks the saved inventory, independent of connection state and playback participation. Nil migrates the old output-only configuration; an explicitly empty list must survive save and reload.

func (DeviceSettings) PlaybackSet

func (d DeviceSettings) PlaybackSet() []string

PlaybackSet returns the playback participants in run-clock order.

func (DeviceSettings) Plays

func (d DeviceSettings) Plays(device string) bool

Plays reports whether device takes part in the next playback run.

func (DeviceSettings) PrivateDeviceValues

func (d DeviceSettings) PrivateDeviceValues() []string

PrivateDeviceValues provides credentials and hardware IDs to redactors.

func (DeviceSettings) WithLegacyOutput

func (d DeviceSettings) WithLegacyOutput(output string) DeviceSettings

WithLegacyOutput applies an output written by an older client: it sets the Handy and Coyote members and never removes any other playing device.

func (DeviceSettings) WithPlaybackDevices

func (d DeviceSettings) WithPlaybackDevices(devices []string) DeviceSettings

WithPlaybackDevices replaces the playback set and keeps the legacy output in step with it.

func (DeviceSettings) WithPlaybackOutput

func (d DeviceSettings) WithPlaybackOutput(output string) DeviceSettings

WithPlaybackOutput retains existing connections. This also supports older clients that select an output before explicitly adding its connection.

type DeviceUpdate

type DeviceUpdate struct {
	ConfiguredDevices []string `json:"configured_devices,omitempty"`
	// PlaybackDevices replaces the playback set; nil keeps it, and an empty
	// set means chat only.
	PlaybackDevices     *[]string `json:"playback_devices,omitempty"`
	LinkedFailurePolicy string    `json:"linked_failure_policy,omitempty"`
	// Output is the legacy participation write. It is preserved when an older
	// client omits it, and changes only the Handy and Coyote members.
	Output                   string  `json:"output,omitempty"`
	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 EstimPatch

type EstimPatch struct {
	MaxStrengthA       *int    `json:"max_strength_a,omitempty"`
	MaxStrengthB       *int    `json:"max_strength_b,omitempty"`
	Follow             *string `json:"follow,omitempty"`
	FrequencyMinHz     *int    `json:"frequency_min_hz,omitempty"`
	FrequencyMaxHz     *int    `json:"frequency_max_hz,omitempty"`
	Balance            *int    `json:"balance,omitempty"`
	SwapChannels       *bool   `json:"swap_channels,omitempty"`
	TimingOffsetMillis *int    `json:"timing_offset_ms,omitempty"`
	FrequencyBalanceA  *int    `json:"frequency_balance_a,omitempty"`
	FrequencyBalanceB  *int    `json:"frequency_balance_b,omitempty"`
	IntensityBalanceA  *int    `json:"intensity_balance_a,omitempty"`
	IntensityBalanceB  *int    `json:"intensity_balance_b,omitempty"`
	ForgetDevice       bool    `json:"forget_device,omitempty"`
}

EstimPatch changes individual Coyote settings. The safety notes keep their own endpoint; ForgetDevice clears the remembered address.

type EstimSettings

type EstimSettings struct {
	SafetyAcknowledged bool   `json:"safety_acknowledged"`
	MaxStrengthA       int    `json:"max_strength_a"`
	MaxStrengthB       int    `json:"max_strength_b"`
	Follow             string `json:"follow"`
	FrequencyMinHz     int    `json:"frequency_min_hz"`
	FrequencyMaxHz     int    `json:"frequency_max_hz"`
	Balance            int    `json:"balance"`
	SwapChannels       bool   `json:"swap_channels"`
	TimingOffsetMillis int    `json:"timing_offset_ms"`
	FrequencyBalanceA  int    `json:"frequency_balance_a"`
	FrequencyBalanceB  int    `json:"frequency_balance_b"`
	IntensityBalanceA  int    `json:"intensity_balance_a"`
	IntensityBalanceB  int    `json:"intensity_balance_b"`
	RememberedAddress  string `json:"remembered_address,omitempty"`
}

EstimSettings configures DG-LAB Coyote output. The strength ceilings are written to the device itself (BF) on every connection; MagicHandy never raises channel strength on its own, so these are the user's hard limits. RememberedAddress lets recent Coyote firmware reconnect without pairing mode; it is a hardware identifier, never shown to non-host clients.

func DefaultEstimSettings

func DefaultEstimSettings() EstimSettings

DefaultEstimSettings returns first-run Coyote settings: low ceilings, the stroke profile and DG-LAB's commonly used balance values.

func (EstimSettings) Public

Public returns the API view.

type EstimUpdate

type EstimUpdate struct {
	SafetyAcknowledged bool   `json:"safety_acknowledged"`
	MaxStrengthA       int    `json:"max_strength_a"`
	MaxStrengthB       int    `json:"max_strength_b"`
	Follow             string `json:"follow"`
	FrequencyMinHz     int    `json:"frequency_min_hz"`
	FrequencyMaxHz     int    `json:"frequency_max_hz"`
	Balance            int    `json:"balance"`
	SwapChannels       bool   `json:"swap_channels"`
	TimingOffsetMillis int    `json:"timing_offset_ms"`
	FrequencyBalanceA  int    `json:"frequency_balance_a"`
	FrequencyBalanceB  int    `json:"frequency_balance_b"`
	IntensityBalanceA  int    `json:"intensity_balance_a"`
	IntensityBalanceB  int    `json:"intensity_balance_b"`
	ForgetDevice       bool   `json:"forget_device"`
}

EstimUpdate is the settings API write shape. ForgetDevice clears the remembered address; the server alone records a new one after connecting.

type FreestyleSettings

type FreestyleSettings struct {
	// Feel names a preset for the control values below, or custom.
	Feel           string `json:"feel"`
	PacePercent    int    `json:"pace_percent"`
	LengthPercent  int    `json:"length_percent"`
	FocusPercent   int    `json:"focus_percent"`
	RoamingPercent int    `json:"roaming_percent"`
	VarietyPercent int    `json:"variety_percent"`
	Accent         string `json:"accent"`
	// Shape is the visible, user-chosen session arc.
	Shape        string `json:"shape"`
	ShapeMinutes int    `json:"shape_minutes"`
}

FreestyleSettings are Freestyle's durable preferences. The running stream reads them live; its session clock, seed and control ramps are runtime state and never belong in the settings document. Every value shapes motion inside the saved speed and stroke limits; none of them can widen those limits.

func DefaultFreestyleSettings

func DefaultFreestyleSettings() FreestyleSettings

DefaultFreestyleSettings returns the first-run Freestyle preferences.

func FreestyleFeelPreset

func FreestyleFeelPreset(feel string) (FreestyleSettings, bool)

FreestyleFeelPreset returns the control values a named feel stands for. The shape is not part of a feel. Values sit on the UI's quarter steps.

type HandyConnection

type HandyConnection struct {
	ID                     string `json:"id"`
	Name                   string `json:"name"`
	Method                 string `json:"method"`
	HandyModel             string `json:"handy_model"`
	ConnectionKey          string `json:"connection_key,omitempty"`
	NativeBluetoothAddress string `json:"native_bluetooth_address,omitempty"`
}

HandyConnection is an additional, independently connected Handy. The primary instance retains the original settings and API for compatibility.

type HandyConnectionPatch

type HandyConnectionPatch struct {
	Name               *string `json:"name,omitempty"`
	Method             *string `json:"method,omitempty"`
	HandyModel         *string `json:"handy_model,omitempty"`
	ConnectionKey      *string `json:"connection_key,omitempty"`
	ClearConnectionKey bool    `json:"clear_connection_key,omitempty"`
}

HandyConnectionPatch names only the fields changed by the host.

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 {
	RequestRole                 string                 `json:"-"`
	Connections                 []ModelConnection      `json:"connections,omitempty"`
	ConversationConnectionID    string                 `json:"conversation_connection_id,omitempty"`
	RetryRefusalLocally         bool                   `json:"retry_refusal_locally,omitempty"`
	HostedResponseRepairEnabled *bool                  `json:"hosted_response_repair_enabled,omitempty"`
	ActiveConnection            *ModelConnection       `json:"-"`
	MotionPlanner               MotionPlannerSettings  `json:"motion_planner"`
	MotionReviewer              MotionReviewerSettings `json:"motion_reviewer"`
	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"`
	// ReplyLength steers how long chat replies run; balanced leaves the
	// prompt unchanged.
	ReplyLength string `json:"reply_length"`
	// 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 defaults, named providers, and model role settings.

func (LLMSettings) Capabilities

func (s LLMSettings) Capabilities() LLMMotionCapabilities

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

func (LLMSettings) ChatMaxOutputTokens

func (s LLMSettings) ChatMaxOutputTokens(replyLength string) int

ChatMaxOutputTokens is the output budget for one chat reply at the given reply length: the saved cap, raised for detailed replies so they can finish inside the JSON contract.

func (LLMSettings) ConnectionByID

func (s LLMSettings) ConnectionByID(id string) (ModelConnection, bool)

ConnectionByID resolves a named hosted connection from saved settings.

func (LLMSettings) ConversationSettings

func (s LLMSettings) ConversationSettings() LLMSettings

ConversationSettings resolves the role without changing saved local choices.

func (LLMSettings) HostedResponseRepair

func (s LLMSettings) HostedResponseRepair() bool

HostedResponseRepair defaults on for settings saved before this option existed. It affects hosted interactive chat only; local generation keeps its own policy.

func (LLMSettings) IsHosted

func (s LLMSettings) IsHosted() bool

IsHosted identifies runtime settings that use a hosted protocol adapter.

func (LLMSettings) LocalSettings

func (s LLMSettings) LocalSettings() LLMSettings

LocalSettings resolves the saved local defaults before any hosted role view has replaced Provider and Model. Call it on the persisted settings snapshot.

func (LLMSettings) ModelRouting

func (s LLMSettings) ModelRouting() ModelRoutingSnapshot

ModelRouting reports resolved destinations without exposing credentials.

func (LLMSettings) PlanningSettings

func (s LLMSettings) PlanningSettings() (LLMSettings, error)

PlanningSettings resolves the explicitly assigned motion model role.

func (LLMSettings) ReviewerSettings

func (s LLMSettings) ReviewerSettings() (LLMSettings, error)

ReviewerSettings resolves an existing named connection, keeping credentials in the same protected storage as the other model roles.

func (LLMSettings) WithConnection

func (s LLMSettings) WithConnection(connection ModelConnection) LLMSettings

WithConnection creates a runtime view, leaving saved local defaults intact.

func (LLMSettings) WithModel

func (s LLMSettings) WithModel(model string) LLMSettings

WithModel selects a temporary model without changing the endpoint binding.

type LLMUpdate

type LLMUpdate struct {
	Connections                 *[]ModelConnection      `json:"connections,omitempty"`
	ConversationConnectionID    *string                 `json:"conversation_connection_id,omitempty"`
	RetryRefusalLocally         *bool                   `json:"retry_refusal_locally,omitempty"`
	HostedResponseRepairEnabled *bool                   `json:"hosted_response_repair_enabled,omitempty"`
	MotionPlanner               *MotionPlannerSettings  `json:"motion_planner,omitempty"`
	MotionReviewer              *MotionReviewerSettings `json:"motion_reviewer,omitempty"`
	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"`
	// ReplyLength replaces the saved length when present; omitted preserves it.
	ReplyLength *string `json:"reply_length,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 ModelConnection

type ModelConnection struct {
	ID                  string   `json:"id"`
	Name                string   `json:"name"`
	Provider            string   `json:"provider"`
	BaseURL             string   `json:"base_url"`
	Model               string   `json:"model"`
	ReasoningEffort     string   `json:"reasoning_effort,omitempty"`
	ContextWindow       int      `json:"context_window,omitempty"`
	HistorySize         string   `json:"history_size,omitempty"`
	OutputMode          string   `json:"output_mode"`
	SupportedParameters []string `json:"supported_parameters,omitempty"`
	AllowFallbacks      bool     `json:"allow_fallbacks"`
	AllowedProviders    []string `json:"allowed_providers,omitempty"`
	DataCollection      string   `json:"data_collection"`
	ZeroDataRetention   bool     `json:"zero_data_retention"`
	NoAuthentication    bool     `json:"no_authentication,omitempty"`
}

ModelConnection separates endpoint/protocol/model capabilities from roles. Credentials are bound to this ID, provider, and endpoint in host storage. The reserved local connection uses the existing local fields losslessly.

func (ModelConnection) ConversationWindow

func (c ModelConnection) ConversationWindow() (contextSize, messages, historyBytes int)

ConversationWindow is an application budget, not a claim about a provider's maximum context. History may be shorter than the total request budget, leaving room for a rich motion state without sending a longer conversation. Omitted history settings preserve existing connections' behavior. Neither setting changes local-model defaults. Byte budgets assume one input token per byte.

func (ModelConnection) Normalize

func (c ModelConnection) Normalize() ModelConnection

Normalize applies endpoint and routing defaults without introducing a secret.

func (ModelConnection) Validate

func (c ModelConnection) Validate() error

Validate checks the public connection and capability policy.

type ModelRoute

type ModelRoute struct {
	Kind          string `json:"kind"`
	Provider      string `json:"provider"`
	ConnectionID  string `json:"connection_id,omitempty"`
	Model         string `json:"model"`
	EndpointHost  string `json:"endpoint_host,omitempty"`
	ContextPolicy string `json:"context_policy"`
	State         string `json:"state"`
}

ModelRoute describes a saved destination, not credential or inference readiness. It is projected from the same runtime resolution used by chat and Autopilot.

type ModelRoutingSnapshot

type ModelRoutingSnapshot struct {
	Chat       ModelRoute  `json:"chat"`
	Autopilot  ModelRoute  `json:"autopilot"`
	LocalRetry *ModelRoute `json:"local_retry,omitempty"`
	Reviewer   *ModelRoute `json:"reviewer,omitempty"`
}

ModelRoutingSnapshot is the public projection of both saved model roles.

type MotionPlannerSettings

type MotionPlannerSettings struct {
	Provider      string `json:"provider"`
	Model         string `json:"model"`
	ConnectionID  string `json:"connection_id,omitempty"`
	ContextPolicy string `json:"context_policy"`
}

MotionPlannerSettings assigns a model independently from its context policy. Credentials and verified accounts live outside settings and exports.

type MotionReviewerSettings

type MotionReviewerSettings struct {
	Enabled      bool   `json:"enabled"`
	ConnectionID string `json:"connection_id,omitempty"`
}

MotionReviewerSettings opts local chat and Autopilot into a second opinion. The primary model always finishes first; the reviewer cannot start motion.

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 {
	HandyConnections         []PublicHandyConnection `json:"handy_connections"`
	ConfiguredDevices        []string                `json:"configured_devices"`
	PlaybackDevices          []string                `json:"playback_devices"`
	LinkedFailurePolicy      string                  `json:"linked_failure_policy"`
	Output                   string                  `json:"output"`
	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 PublicEstimSettings

type PublicEstimSettings struct {
	SafetyAcknowledged bool   `json:"safety_acknowledged"`
	MaxStrengthA       int    `json:"max_strength_a"`
	MaxStrengthB       int    `json:"max_strength_b"`
	Follow             string `json:"follow"`
	FrequencyMinHz     int    `json:"frequency_min_hz"`
	FrequencyMaxHz     int    `json:"frequency_max_hz"`
	Balance            int    `json:"balance"`
	SwapChannels       bool   `json:"swap_channels"`
	TimingOffsetMillis int    `json:"timing_offset_ms"`
	FrequencyBalanceA  int    `json:"frequency_balance_a"`
	FrequencyBalanceB  int    `json:"frequency_balance_b"`
	IntensityBalanceA  int    `json:"intensity_balance_a"`
	IntensityBalanceB  int    `json:"intensity_balance_b"`
	RememberedDevice   bool   `json:"remembered_device"`
}

PublicEstimSettings is the API view: the remembered address becomes a flag.

type PublicHandyConnection

type PublicHandyConnection struct {
	ID               string `json:"id"`
	Name             string `json:"name"`
	Method           string `json:"method"`
	HandyModel       string `json:"handy_model"`
	ConnectionKeySet bool   `json:"connection_key_set"`
	RememberedDevice bool   `json:"remembered_device"`
}

PublicHandyConnection exposes connection settings without credentials or hardware IDs.

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"`
	Estim        PublicEstimSettings       `json:"estim"`
	Vibration    VibrationSettings         `json:"vibration"`
	Motion       MotionSettings            `json:"motion"`
	Freestyle    FreestyleSettings         `json:"freestyle"`
	Autopilot    AutopilotSettings         `json:"autopilot"`
	LLM          LLMSettings               `json:"llm"`
	ModelRouting ModelRoutingSnapshot      `json:"model_routing"`
	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 {
	DeviceOutputs           []string `json:"device_outputs"`
	EstimFollowModes        []string `json:"estim_follow_modes"`
	VibrationFollowModes    []string `json:"vibration_follow_modes"`
	HSPDispatchOwners       []string `json:"hsp_dispatch_owners"`
	APIApplicationIDSources []string `json:"api_application_id_sources"`
	DiagnosticsVerbosities  []string `json:"diagnostics_verbosities"`
	MotionStyles            []string `json:"motion_styles"`
	FreestyleFeels          []string `json:"freestyle_feels"`
	FreestyleAccents        []string `json:"freestyle_accents"`
	FreestyleShapes         []string `json:"freestyle_shapes"`
	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"`
	LLMReplyLengths         []string `json:"llm_reply_lengths"`
	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"`
	Estim       EstimSettings       `json:"estim"`
	Vibration   VibrationSettings   `json:"vibration"`
	Motion      MotionSettings      `json:"motion"`
	Freestyle   FreestyleSettings   `json:"freestyle"`
	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) AddHandyConnection

func (s Settings) AddHandyConnection(id string, patch HandyConnectionPatch) (Settings, error)

AddHandyConnection saves an excluded, disconnected instance.

func (Settings) ApplyDeviceOptionsPatch

func (s Settings) ApplyDeviceOptionsPatch(patch DeviceOptionsPatch) (Settings, error)

ApplyDeviceOptionsPatch returns the settings with the patch applied and validated. An invalid result is an error and leaves the settings unchanged.

func (Settings) ApplyUpdate

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

ApplyUpdate merges a settings API payload into the current settings.

func (Settings) EffectiveMotion

func (s Settings) EffectiveMotion() MotionSettings

EffectiveMotion uses the most conservative normalized travel-speed profile of participating Handys. Calibration is shared because there is one timeline: Standard (125mm/400mm/s), Pro (125mm/450mm/s), Original (110mm/400mm/s). This ordering also holds at the profiles' minimum speeds.

func (Settings) PatchHandyConnection

func (s Settings) PatchHandyConnection(id string, patch HandyConnectionPatch) (Settings, error)

PatchHandyConnection updates an instance without mutating its input.

func (Settings) Public

func (s Settings) Public() PublicSettings

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

func (Settings) RemoveHandyConnection

func (s Settings) RemoveHandyConnection(id string) (Settings, error)

RemoveHandyConnection removes an instance from inventory and playback.

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"`
	Estim              *EstimUpdate        `json:"estim,omitempty"`
	Vibration          *VibrationSettings  `json:"vibration,omitempty"`
	Motion             MotionSettings      `json:"motion"`
	Freestyle          *FreestyleSettings  `json:"freestyle,omitempty"`
	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.

func (*Store) UpdateContext

func (s *Store) UpdateContext(ctx context.Context, mutate func(Settings) (Settings, error)) (previous Settings, saved Settings, err error)

UpdateContext rejects canceled queued writes and binds the durable transaction to the caller's authority lifetime. After commit, publication still completes so the in-memory snapshot cannot diverge from the durable settings row.

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"`
	// RuntimeUpdateMode is automatic when MagicHandy may install the llama.cpp
	// runtime its release pins as soon as it starts; manual only notifies.
	RuntimeUpdateMode      string   `json:"runtime_update_mode,omitempty"`
	NotificationCategories []string `json:"notification_categories"`
	// Omitted by older clients; nil retains the default visible shortcut.
	ShowRemoteNavigation *bool `json:"show_remote_navigation,omitempty"`
}

UISettings contains presentation preferences shared by every browser client.

type VibrationPatch

type VibrationPatch struct {
	Follow             *string `json:"follow,omitempty"`
	DepthEnd           *string `json:"depth_end,omitempty"`
	MinimumPercent     *int    `json:"minimum_percent,omitempty"`
	CeilingPercent     *int    `json:"ceiling_percent,omitempty"`
	TimingOffsetMillis *int    `json:"timing_offset_ms,omitempty"`
}

VibrationPatch changes individual vibrator settings.

type VibrationSettings

type VibrationSettings struct {
	Follow             string `json:"follow"`
	DepthEnd           string `json:"depth_end"`
	MinimumPercent     int    `json:"minimum_percent"`
	CeilingPercent     int    `json:"ceiling_percent"`
	TimingOffsetMillis int    `json:"timing_offset_ms"`
}

VibrationSettings configures vibrator output. The ceiling caps the live intensity the user raises from the connection manager; the live intensity itself starts at 0 on every connection and is never persisted.

func DefaultVibrationSettings

func DefaultVibrationSettings() VibrationSettings

DefaultVibrationSettings starts low and follows stroke speed.

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