setup

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 55 Imported by: 0

Documentation

Overview

Package setup - tview-based configuration editor

Package setup - LLM configuration editor

Package setup - onboarding wizard

Package setup - tview-based onboarding wizard

Package setup provides the interactive setup wizard for GoClaw.

Package setup provides the interactive setup wizard for GoClaw.

Package setup - tview-based user management editor

Package setup - VoiceLLM configuration editor

Package setup provides setup wizard and configuration editing

Index

Constants

View Source
const (
	LLMChoiceLocalGemma         = "local_gemma"
	LLMChoiceCloudProvider      = "cloud"
	LLMChoiceExistingLlamaCpp   = "existing_llamacpp"
	LLMProviderManagedLlamaCpp  = "llamacpp-managed"
	LLMProviderEndpointLlamaCpp = "llamacpp-endpoint"
)
View Source
const (
	SandboxPresetAssistant  = "assistant"
	SandboxPresetPermissive = "permissive"
	SandboxPresetHardened   = "hardened"
	SandboxPresetCustom     = "custom"
)
View Source
const WizardAgentTypingMaxLen = 80

Variables

This section is empty.

Functions

func ApplySandboxPreset added in v0.1.3

func ApplySandboxPreset(data *WizardData, preset string)

func CheckUpdateWorkspace added in v0.1.13

func CheckUpdateWorkspace(wsPath string) error

func ConfigureWizardForCloudProvider added in v0.1.14

func ConfigureWizardForCloudProvider(data *WizardData, preset *ProviderPreset)

func ConfigureWizardForLlamaCppEndpoint added in v0.1.14

func ConfigureWizardForLlamaCppEndpoint(data *WizardData)

func ConfigureWizardForManagedLlamaCpp added in v0.1.14

func ConfigureWizardForManagedLlamaCpp(data *WizardData, modelID string)

func CreateWorkspace

func CreateWorkspace(wsPath string) error

CreateWorkspace initializes a new workspace at the given path

func DefaultGoclawRoot

func DefaultGoclawRoot() string

DefaultGoclawRoot returns the default GoClaw root directory

func DefaultWorkspacePath

func DefaultWorkspacePath() string

DefaultWorkspacePath returns the default workspace path

func DetectSandboxPreset added in v0.1.3

func DetectSandboxPreset(enabled bool, mode string, execEnabled bool, browserEnabled bool, fileToolsEnabled bool) (preset string, advanced bool)

func EnsureConfigDir

func EnsureConfigDir(configPath string) error

EnsureConfigDir creates the directory for the config file if needed

func ExpandPath

func ExpandPath(path string) string

ExpandPath expands ~ to home directory

func GenerateDefault

func GenerateDefault() error

GenerateDefault outputs a default configuration template to stdout

func GenerateDefaultUsers

func GenerateDefaultUsers(withPassword bool) error

GenerateDefaultUsers outputs a default users.json template to stdout If withPassword is true, generates a random password and includes the hash

func GetConfigPath

func GetConfigPath(openclawImport bool) string

GetConfigPath returns the path where config should be saved GoClaw always uses its own directory, regardless of OpenClaw presence

func GetOpenClawWorkspace

func GetOpenClawWorkspace() string

GetOpenClawWorkspace returns OpenClaw's workspace path from openclaw.json

func GetUsersPath

func GetUsersPath(configPath string) string

GetUsersPath returns the path where users.json should be saved Always alongside goclaw.json

func LoadTemplate

func LoadTemplate(name string) (string, error)

LoadTemplate reads a template file from the embedded filesystem

func LoadTemplateStripped

func LoadTemplateStripped(name string) (string, error)

LoadTemplateStripped reads a template and strips frontmatter

func NormalizeSandboxPreset added in v0.1.3

func NormalizeSandboxPreset(preset string) string

func OpenClawConfigPath

func OpenClawConfigPath() string

OpenClawConfigPath returns the path to OpenClaw's config file

func OpenClawExists

func OpenClawExists() bool

OpenClawExists checks if OpenClaw is installed

func OpenClawGoclawRoot

func OpenClawGoclawRoot() string

OpenClawGoclawRoot returns the path for side-by-side with OpenClaw

func ResolveWizardManagedModel added in v0.1.14

func ResolveWizardManagedModel(data *WizardData) (localllm.ManagedModelSpec, error)

func RunAuto

func RunAuto() error

RunAuto detects mode based on existing config

func RunEdit

func RunEdit() error

RunEdit runs the edit menu (requires existing config, tview-based)

func RunEditorTview

func RunEditorTview() error

RunEditorTview is the entry point for the tview editor

func RunOnboardWizard

func RunOnboardWizard() error

RunOnboardWizard runs the onboarding wizard (calls the tview version)

func RunOnboardWizardTview

func RunOnboardWizardTview() error

RunOnboardWizardTview runs the new tview-based onboarding wizard

func RunUserEditorTview

func RunUserEditorTview() error

RunUserEditorTview is the entry point for the tview user editor

func RunWizard

func RunWizard() error

RunWizard runs the full setup wizard (tview-based)

func SandboxPresetValues added in v0.1.3

func SandboxPresetValues() []string

func SaveWizardConfig added in v0.1.1

func SaveWizardConfig(data *WizardData) error

SaveWizardConfig saves the wizard configuration and users to their respective files. This is the exported version of printWizardConfig for use by the web wizard.

func SaveWizardConfigToPath added in v0.1.1

func SaveWizardConfigToPath(data *WizardData, configPath string) error

SaveWizardConfigToPath saves wizard config and users using an explicit config path. If configPath is empty, the default path is used.

func ShowConfig

func ShowConfig() error

ShowConfig displays the current configuration

func ShowConfigPath

func ShowConfigPath() error

ShowConfigPath displays the path to the configuration file

func StripFrontmatter

func StripFrontmatter(content string) string

StripFrontmatter removes YAML frontmatter from markdown content

func TestConnection

func TestConnection(url string) error

TestConnection tests basic connectivity to a URL

func TestProvider

func TestProvider(preset ProviderPreset, apiKey string) ([]string, error)

TestProvider tests a provider connection and returns available models

func TestTelegramToken

func TestTelegramToken(token string) (string, error)

TestTelegramToken validates a Telegram bot token by calling getMe

func WizardLLMModelDisplay added in v0.1.14

func WizardLLMModelDisplay(data *WizardData) string

Types

type EditorTview

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

EditorTview is the tview-based configuration editor

func NewEditorTview

func NewEditorTview(configPath string) *EditorTview

NewEditorTview creates a new tview editor

func (*EditorTview) Run

func (e *EditorTview) Run() error

Run executes the editor

type LLMEditor

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

LLMEditor handles LLM configuration editing

func NewLLMEditor

func NewLLMEditor(app *forms.TviewApp, cfg *llm.LLMConfig, onSave func(), onBack func()) *LLMEditor

NewLLMEditor creates a new LLM editor

func (*LLMEditor) Show

func (e *LLMEditor) Show()

Show displays the LLM configuration menu

type LocalModelOption added in v0.1.14

type LocalModelOption struct {
	Spec            localllm.ManagedModelSpec
	Recommended     bool
	DefaultSelected bool
	Viable          bool
	Reason          string
}

type LocalModelRecommendations added in v0.1.14

type LocalModelRecommendations struct {
	Profile        localllm.SystemProfile
	Options        []LocalModelOption
	RecommendedID  string
	DefaultModelID string
	Summary        string
}

func BuildLocalModelRecommendations added in v0.1.14

func BuildLocalModelRecommendations() LocalModelRecommendations

func BuildLocalModelRecommendationsForProfile added in v0.1.14

func BuildLocalModelRecommendationsForProfile(profile localllm.SystemProfile) LocalModelRecommendations

type ProviderPreset

type ProviderPreset struct {
	Name               string
	Key                string
	Driver             string // "anthropic", "openai", "ollama", "xai"
	BaseURL            string
	Description        string
	IsLocal            bool
	Synthetic          bool
	SupportsEmbeddings bool
	KnownEmbedModels   []string
	KnownChatModels    []string
	DefaultModel       string
	LlamaCpp           *llm.LlamaCppProviderConfig
}

ProviderPreset defines a predefined LLM provider option

func BuildPresets

func BuildPresets() []ProviderPreset

BuildPresets returns provider presets built from models.json metadata.

func CustomPreset

func CustomPreset(name, baseURL string) ProviderPreset

CustomPreset returns a preset for "Other OpenAI-compatible" providers

func EmbeddingCapablePresets

func EmbeddingCapablePresets() []ProviderPreset

EmbeddingCapablePresets returns only presets that support embeddings

func GetPreset

func GetPreset(key string) *ProviderPreset

GetPreset returns a preset by key, or nil if not found

func LlamaCppManagedPreset added in v0.1.14

func LlamaCppManagedPreset() ProviderPreset

type SandboxPresetWarning added in v0.1.3

type SandboxPresetWarning struct {
	Title   string
	Body    string
	Consent string
}

func SandboxPresetWarningText added in v0.1.3

func SandboxPresetWarningText(preset string) SandboxPresetWarning

type TemplateManifestEntry added in v0.1.13

type TemplateManifestEntry struct {
	Current string
	Known   []string
}

type UserEditorTview

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

UserEditorTview manages the tview-based user management UI

func NewUserEditorTview

func NewUserEditorTview() *UserEditorTview

NewUserEditorTview creates a new tview user editor

func (*UserEditorTview) Run

func (e *UserEditorTview) Run() error

Run executes the user editor

type VoiceLLMEditor

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

VoiceLLMEditor handles VoiceLLM configuration editing

func NewVoiceLLMEditor

func NewVoiceLLMEditor(app *forms.TviewApp, cfg *voicellm.Config, onSave func(), onBack func()) *VoiceLLMEditor

NewVoiceLLMEditor creates a new VoiceLLM editor

func (*VoiceLLMEditor) Show

func (e *VoiceLLMEditor) Show()

Show displays the VoiceLLM configuration menu

type WizardData

type WizardData struct {
	// Config detection
	ConfigExists   bool
	ConfigPath     string
	ExistingConfig *config.Config

	// OpenClaw migration
	OpenClawExists bool
	OpenClawImport bool
	OpenClawConfig map[string]interface{}

	// Workspace
	WorkspacePath string

	// Agent identity
	AgentName   string
	AgentEmoji  string
	AgentTyping string

	// User setup
	UserName              string
	UserDisplayName       string
	UserRole              string
	UserTelegramID        string
	UserWhatsAppID        string
	InitialUserTelegramID string
	InitialUserWhatsAppID string
	UserPassword          string
	UserPasswordConf      string
	UserExistingPwdHash   string // preserved from existing users.json

	// Telegram
	TelegramEnabled bool
	TelegramToken   string

	// WhatsApp
	WhatsAppEnabled bool

	// HTTP
	HTTPEnabled bool
	HTTPListen  string

	// Browser
	BrowserSetup bool

	// Sandboxing
	SandboxEnabled           bool
	SandboxMode              string
	ExecSandboxEnabled       bool
	BrowserSandboxEnabled    bool
	FileToolsSandboxEnabled  bool
	SandboxPreset            string
	SandboxAdvanced          bool
	SandboxConsentPermissive bool
	SandboxConsentAssistant  bool
	SandboxConsentHardened   bool

	// Skills Installation
	SkillsAllowEmbedded bool
	SkillsAllowClawHub  bool
	SkillsAllowLocal    bool

	// LLM
	LLMOnboardingChoice string
	LLMProviderID       string
	LLMProviderName     string
	LLMDriver           string
	LLMAPIKey           string
	LLMBaseURL          string
	LLMModel            string
	LLMManagedModelID   string
	LLMSkipped          bool

	// STT (Speech-to-Text)
	STTEnabled        bool
	STTModel          string
	STTModelAvailable bool // true if model exists (bundled or downloaded)

	// VoiceLLM (Real-time Voice)
	VoiceLLMEnabled bool
	VoiceLLMAPIKey  string
	VoiceLLMVoice   string // Eve, Ara, Rex, Sal, Leo
	// contains filtered or unexported fields
}

WizardData holds all configuration values being edited across wizard steps

func NewWizardData

func NewWizardData() *WizardData

NewWizardData creates a new WizardData with defaults

func (*WizardData) ApplyOpenClawImport added in v0.1.9

func (d *WizardData) ApplyOpenClawImport(enable bool)

func (*WizardData) HasAnyDirty added in v0.1.1

func (d *WizardData) HasAnyDirty(fields ...string) bool

HasAnyDirty returns true if any of the specified fields are dirty

func (*WizardData) IsDirty added in v0.1.1

func (d *WizardData) IsDirty(field string) bool

IsDirty returns true if the field was modified

func (*WizardData) LoadFromDefaults added in v0.1.1

func (d *WizardData) LoadFromDefaults(cfg *config.Config)

LoadFromDefaults seeds WizardData from a fully-defaulted config without marking it as an existing user configuration.

func (*WizardData) LoadFromExisting

func (d *WizardData) LoadFromExisting(cfg *config.Config, path string)

LoadFromExisting populates WizardData from existing config

func (*WizardData) LoadFromOpenClaw

func (d *WizardData) LoadFromOpenClaw()

LoadFromOpenClaw extracts settings from OpenClaw config

func (*WizardData) MarkDirty added in v0.1.1

func (d *WizardData) MarkDirty(fields ...string)

MarkDirty marks the specified fields as modified

func (*WizardData) ResetPairingStage added in v0.1.9

func (d *WizardData) ResetPairingStage()

type WorkspaceTemplateSpec added in v0.1.13

type WorkspaceTemplateSpec struct {
	Name       string
	AutoUpdate bool
}

Directories

Path Synopsis
Package web provides browser-based setup wizard and configuration editor
Package web provides browser-based setup wizard and configuration editor

Jump to

Keyboard shortcuts

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