Documentation
¶
Overview ¶
Package web provides browser-based setup wizard and configuration editor
Package web provides browser-based setup wizard and configuration editor ¶
Package web provides browser-based setup wizard and configuration editor ¶
Package web provides browser-based setup wizard and configuration editor ¶
Package web provides browser-based setup wizard and configuration editor.
Package web provides browser-based setup wizard and configuration editor ¶
Package web provides browser-based setup wizard and configuration editor ¶
Package web provides browser-based setup wizard and configuration editor ¶
Package web provides browser-based setup wizard and configuration editor
Index ¶
- Variables
- func DefaultConfigPath() string
- func GetFormDef(sectionID string) *forms.FormDef
- func RegisterFormDef(sectionID string, getter FormDefGetter)
- func RegisterSetupRoutes(srv HTTPServer, configPath string, a2aRuntime A2ARuntimeProvider) error
- func RenderFormHTML(def forms.FormDef, _ string) (template.HTML, error)
- func RunWebEditor(configPath string) error
- func RunWebEditorWithOptions(configPath string, devMode bool) error
- func RunWebWizard(configPath string) error
- func RunWebWizardWithOptions(configPath string, devMode bool) error
- func ValidateAllSectionContractsStrict() error
- type A2APeerRequest
- type A2APeersAPI
- func (a *A2APeersAPI) HandleConfig(w http.ResponseWriter, r *http.Request)
- func (a *A2APeersAPI) HandlePairing(w http.ResponseWriter, r *http.Request)
- func (a *A2APeersAPI) HandlePeer(w http.ResponseWriter, r *http.Request)
- func (a *A2APeersAPI) HandlePeers(w http.ResponseWriter, r *http.Request)
- func (a *A2APeersAPI) HandlePing(w http.ResponseWriter, r *http.Request)
- func (a *A2APeersAPI) HandleRuntime(w http.ResponseWriter, r *http.Request)
- type A2APingRequest
- type A2ARuntimeProvider
- type API
- func (a *API) HandleApply(w http.ResponseWriter, r *http.Request)
- func (a *API) HandleGetConfig(w http.ResponseWriter, r *http.Request)
- func (a *API) HandleGetDrivers(w http.ResponseWriter, r *http.Request)
- func (a *API) HandleGetModels(w http.ResponseWriter, r *http.Request)
- func (a *API) HandleGetPresets(w http.ResponseWriter, r *http.Request)
- func (a *API) HandleGetProviders(w http.ResponseWriter, r *http.Request)
- func (a *API) HandleGetSections(w http.ResponseWriter, r *http.Request)
- func (a *API) HandleLocalLLM(w http.ResponseWriter, r *http.Request)
- func (a *API) HandleSection(w http.ResponseWriter, r *http.Request)
- func (a *API) HandleSectionAction(w http.ResponseWriter, r *http.Request)
- type APIResponse
- type CreateUserRequest
- type FormDefGetter
- type HTTPServer
- type Handlers
- type PairingAPI
- type SectionCategory
- type SectionItem
- type SectionType
- type Server
- type SetPasswordRequest
- type TemplateData
- type UpdateOwnerPairingRequest
- type UpdateUserRequest
- type UserResponse
- type UsersAPI
- func (u *UsersAPI) HandleCreateUser(w http.ResponseWriter, r *http.Request)
- func (u *UsersAPI) HandleListUsers(w http.ResponseWriter, r *http.Request)
- func (u *UsersAPI) HandleRoles(w http.ResponseWriter, r *http.Request)
- func (u *UsersAPI) HandleUpdateOwnerPairing(w http.ResponseWriter, r *http.Request)
- func (u *UsersAPI) HandleUser(w http.ResponseWriter, r *http.Request)
- type WizardAPI
- func (w *WizardAPI) HandleFinish(rw http.ResponseWriter, r *http.Request)
- func (w *WizardAPI) HandleGetModels(rw http.ResponseWriter, r *http.Request)
- func (w *WizardAPI) HandleGetState(rw http.ResponseWriter, r *http.Request)
- func (w *WizardAPI) HandleGetStep(rw http.ResponseWriter, r *http.Request)
- func (w *WizardAPI) HandlePairingAction(rw http.ResponseWriter, r *http.Request)
- func (w *WizardAPI) HandlePrevStep(rw http.ResponseWriter, r *http.Request)
- func (w *WizardAPI) HandleSubmitStep(rw http.ResponseWriter, r *http.Request)
- func (w *WizardAPI) Reset()
- type WizardState
- type WizardStep
Constants ¶
This section is empty.
Variables ¶
var EditorSections = []SectionCategory{ { Title: "Configuration", Items: []SectionItem{ {ID: "llm", Label: "Model Chains", ConfigPath: "/llm", Type: SectionTypeFormDef, Expandable: true}, {ID: "llm-providers", Label: "LLM Providers", ConfigPath: "/llm", Type: SectionTypeFormDef}, {ID: "local-llm", Label: "Local LLM", ConfigPath: "/llm", Type: SectionTypeCustom}, {ID: "voicellm", Label: "VoiceLLM", ConfigPath: "/voicellm", Type: SectionTypeFormDef}, {ID: "acp", Label: "Coding Agents", ConfigPath: "/acp", Type: SectionTypeFormDef}, {ID: "a2a", Label: "A2A Networking", ConfigPath: "/a2a", Type: SectionTypeFormDef}, {ID: "gateway", Label: "Gateway", ConfigPath: "/", Type: SectionTypeFormDef}, {ID: "session", Label: "Session", ConfigPath: "/session", Type: SectionTypeFormDef}, }, }, { Title: "Channels", Items: []SectionItem{ {ID: "telegram", Label: "Telegram", ConfigPath: "/channels/telegram", Type: SectionTypeFormDef}, {ID: "http", Label: "HTTP Server", ConfigPath: "/channels/http", Type: SectionTypeFormDef}, {ID: "whatsapp", Label: "WhatsApp", ConfigPath: "/channels/whatsapp", Type: SectionTypeFormDef}, }, }, { Title: "Services", Items: []SectionItem{ {ID: "transcript", Label: "Transcript", ConfigPath: "/transcript", Type: SectionTypeFormDef}, {ID: "memorygraph", Label: "Memory Graph", ConfigPath: "/memoryGraph", Type: SectionTypeFormDef}, {ID: "stt", Label: "Speech-to-Text", ConfigPath: "/stt", Type: SectionTypeFormDef}, {ID: "skills", Label: "Skills", ConfigPath: "/skills", Type: SectionTypeFormDef}, {ID: "cron", Label: "Cron", ConfigPath: "/cron", Type: SectionTypeFormDef}, {ID: "tools", Label: "Tools", ConfigPath: "/tools", Type: SectionTypeFormDef}, }, }, { Title: "System", Items: []SectionItem{ {ID: "sandbox", Label: "Sandbox", ConfigPath: "/sandbox", Type: SectionTypeFormDef}, {ID: "auth", Label: "Auth", ConfigPath: "/auth", Type: SectionTypeFormDef}, {ID: "a2a-peers", Label: "A2A Peers", ConfigPath: "/a2a", Type: SectionTypeCustom}, {ID: "users", Label: "Users", ConfigPath: "/", Type: SectionTypeCustom}, {ID: "roles", Label: "Roles", ConfigPath: "/roles", Type: SectionTypeFormDef}, {ID: "media", Label: "Media", ConfigPath: "/media", Type: SectionTypeFormDef}, }, }, }
EditorSections defines the full sidebar structure for the configuration editor. Some sections may be filtered out at runtime based on mode/capabilities.
var ErrNoUIAvailable = fmt.Errorf("no UI available")
ErrNoUIAvailable is returned when neither webview nor browser is available
var WizardSteps = []WizardStep{
{ID: "welcome", Title: "Welcome to GoClaw", Description: "Let's get you set up with your personal AI assistant."},
{ID: "agent", Title: "Agent Identity", Description: "Set your assistant name, emoji, and typing style."},
{ID: "workspace", Title: "Workspace", Description: "Choose where GoClaw will store files and configurations."},
{ID: "user", Title: "Owner Account", Description: "Create your owner account for authentication."},
{ID: "channels", Title: "Communication Channels", Description: "Configure how you'll interact with GoClaw."},
{ID: "pairing", Title: "Channel Pairing", Description: "Pair each enabled owner channel before you continue."},
{ID: "llm", Title: "LLM Provider", Description: "Choose between a managed local model, a cloud provider, or an existing llama.cpp server."},
{ID: "voice", Title: "Voice Settings", Description: "Configure speech-to-text and voice LLM (optional)."},
{ID: "security", Title: "Security & Skills", Description: "Configure sandboxing and skill installation sources."},
{ID: "review", Title: "Review & Finish", Description: "Review your settings and complete the setup."},
}
WizardSteps defines all steps in the setup wizard
Functions ¶
func DefaultConfigPath ¶
func DefaultConfigPath() string
DefaultConfigPath returns the default config path
func GetFormDef ¶
GetFormDef returns the FormDef for a section, or nil if not found
func RegisterFormDef ¶
func RegisterFormDef(sectionID string, getter FormDefGetter)
RegisterFormDef allows dynamic registration of FormDef getters
func RegisterSetupRoutes ¶
func RegisterSetupRoutes(srv HTTPServer, configPath string, a2aRuntime A2ARuntimeProvider) error
RegisterSetupRoutes registers setup wizard and editor routes on the main HTTP server
func RenderFormHTML ¶
RenderFormHTML converts a FormDef into Bootstrap-oriented HTML with data hooks. The returned markup is hydrated by the setup jQuery runtime.
func RunWebEditor ¶
RunWebEditor runs the browser-based config editor Returns ErrNoUIAvailable if neither webview nor browser works
func RunWebEditorWithOptions ¶
RunWebEditorWithOptions runs the browser-based config editor with options
func RunWebWizard ¶
RunWebWizard runs the browser-based setup wizard Returns ErrNoUIAvailable if neither webview nor browser works
func RunWebWizardWithOptions ¶
RunWebWizardWithOptions runs the browser-based setup wizard with options
func ValidateAllSectionContractsStrict ¶
func ValidateAllSectionContractsStrict() error
ValidateAllSectionContractsStrict validates all setup/editor section contracts. It enforces JSON-pointer config roots and strict JSON-key dotted FormDef paths.
Types ¶
type A2APeerRequest ¶ added in v0.1.14
type A2APeersAPI ¶ added in v0.1.14
type A2APeersAPI struct {
// contains filtered or unexported fields
}
func NewA2APeersAPI ¶ added in v0.1.14
func NewA2APeersAPI(configPath string, runtime A2ARuntimeProvider) *A2APeersAPI
func (*A2APeersAPI) HandleConfig ¶ added in v0.1.14
func (a *A2APeersAPI) HandleConfig(w http.ResponseWriter, r *http.Request)
func (*A2APeersAPI) HandlePairing ¶ added in v0.1.14
func (a *A2APeersAPI) HandlePairing(w http.ResponseWriter, r *http.Request)
func (*A2APeersAPI) HandlePeer ¶ added in v0.1.14
func (a *A2APeersAPI) HandlePeer(w http.ResponseWriter, r *http.Request)
func (*A2APeersAPI) HandlePeers ¶ added in v0.1.14
func (a *A2APeersAPI) HandlePeers(w http.ResponseWriter, r *http.Request)
func (*A2APeersAPI) HandlePing ¶ added in v0.1.14
func (a *A2APeersAPI) HandlePing(w http.ResponseWriter, r *http.Request)
func (*A2APeersAPI) HandleRuntime ¶ added in v0.1.14
func (a *A2APeersAPI) HandleRuntime(w http.ResponseWriter, r *http.Request)
type A2APingRequest ¶ added in v0.1.14
type A2APingRequest struct {
PeerID string `json:"peerId"`
}
type A2ARuntimeProvider ¶ added in v0.1.14
type A2ARuntimeProvider interface {
GetA2AStatus() a2a.Status
ListA2APeers(filter string) []a2a.PeerRecord
GetA2APairingPayload() a2a.PairingPayload
PingA2APeer(ctx context.Context, target string) (a2a.PingResult, error)
A2APeerRegistry() *a2apeers.Registry
RefreshA2ATrustedPeers()
}
type API ¶
type API struct {
// contains filtered or unexported fields
}
API provides JSON API handlers for the setup wizard and editor
func NewAPI ¶
func NewAPI(configPath string, applyCaller configapply.Caller, sections []SectionCategory) *API
NewAPI creates a new API handler
func (*API) HandleApply ¶
func (a *API) HandleApply(w http.ResponseWriter, r *http.Request)
HandleApply determines how saved config should take effect.
func (*API) HandleGetConfig ¶
func (a *API) HandleGetConfig(w http.ResponseWriter, r *http.Request)
HandleGetConfig returns the full configuration as JSON
func (*API) HandleGetDrivers ¶ added in v0.1.3
func (a *API) HandleGetDrivers(w http.ResponseWriter, r *http.Request)
HandleGetDrivers returns supported runtime LLM drivers from the llm registry.
func (*API) HandleGetModels ¶
func (a *API) HandleGetModels(w http.ResponseWriter, r *http.Request)
HandleGetModels returns full model details for a provider alias
func (*API) HandleGetPresets ¶
func (a *API) HandleGetPresets(w http.ResponseWriter, r *http.Request)
HandleGetPresets returns available LLM provider presets from models.json
func (*API) HandleGetProviders ¶
func (a *API) HandleGetProviders(w http.ResponseWriter, r *http.Request)
HandleGetProviders returns configured LLM provider aliases with metadata
func (*API) HandleGetSections ¶
func (a *API) HandleGetSections(w http.ResponseWriter, r *http.Request)
HandleGetSections returns the sidebar sections structure
func (*API) HandleLocalLLM ¶ added in v0.1.14
func (a *API) HandleLocalLLM(w http.ResponseWriter, r *http.Request)
func (*API) HandleSection ¶
func (a *API) HandleSection(w http.ResponseWriter, r *http.Request)
HandleSection handles GET (fetch section config) and POST (save section config)
func (*API) HandleSectionAction ¶ added in v0.1.8
func (a *API) HandleSectionAction(w http.ResponseWriter, r *http.Request)
HandleSectionAction runs a form action for a section.
type APIResponse ¶
type APIResponse struct {
Success bool `json:"success"`
Data interface{} `json:"data,omitempty"`
Errors map[string]string `json:"errors,omitempty"`
Message string `json:"message,omitempty"`
}
APIResponse is the standard JSON response format
type CreateUserRequest ¶
type CreateUserRequest struct {
Username string `json:"username"`
Name string `json:"name"`
Role string `json:"role"`
TelegramID string `json:"telegram_id,omitempty"`
WhatsAppID string `json:"whatsapp_id,omitempty"`
Password string `json:"password,omitempty"`
ACPAllowed *bool `json:"acpAllowed,omitempty"`
Thinking *bool `json:"thinking,omitempty"`
ThinkingLevel *string `json:"thinking_level,omitempty"`
Sandbox *bool `json:"sandbox,omitempty"`
}
CreateUserRequest represents a request to create a new user
type FormDefGetter ¶
FormDefGetter is a function that returns a FormDef for a config section
type HTTPServer ¶
type HTTPServer interface {
Mux() *http.ServeMux
WrapHandler(h http.HandlerFunc) http.HandlerFunc
Users() *user.Registry
}
HTTPServer interface for integration with main HTTP server
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
Handlers provides HTTP handlers for the setup wizard and editor
func NewHandlers ¶
NewHandlers creates new setup handlers
func (*Handlers) HandleEdit ¶
func (h *Handlers) HandleEdit(w http.ResponseWriter, r *http.Request)
HandleEdit serves the configuration editor page
func (*Handlers) HandleWizard ¶
func (h *Handlers) HandleWizard(w http.ResponseWriter, r *http.Request)
HandleWizard serves the wizard page
type PairingAPI ¶ added in v0.1.9
type PairingAPI struct{}
func NewPairingAPI ¶ added in v0.1.9
func NewPairingAPI() *PairingAPI
func (*PairingAPI) HandleAction ¶ added in v0.1.9
func (p *PairingAPI) HandleAction(w http.ResponseWriter, r *http.Request)
type SectionCategory ¶
type SectionCategory struct {
Title string `json:"title"`
Items []SectionItem `json:"items"`
}
SectionCategory groups related section items
func EditorSectionsForMode ¶ added in v0.1.14
func EditorSectionsForMode(enableA2APeers bool) []SectionCategory
func GetSectionsJSON ¶
func GetSectionsJSON(enableA2APeers bool) []SectionCategory
GetSectionsJSON returns the sections structure for JavaScript consumption
type SectionItem ¶
type SectionItem struct {
ID string `json:"id"` // Unique identifier
Label string `json:"label"` // Display name
ConfigPath string `json:"configPath"` // JSON Pointer in config (e.g., "/channels/telegram")
Type SectionType `json:"type"` // formdef or custom
Expandable bool `json:"expandable"` // Has nested items (LLM providers)
}
SectionItem represents a single menu item in the editor sidebar
func FindSection ¶
func FindSection(categories []SectionCategory, id string) *SectionItem
FindSection looks up a section by ID across all categories.
type SectionType ¶
type SectionType string
SectionType indicates how a section should be rendered
const ( // SectionTypeFormDef renders section using FormDef to HTML conversion SectionTypeFormDef SectionType = "formdef" // SectionTypeCustom uses custom UI (e.g., Users CRUD) SectionTypeCustom SectionType = "custom" )
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the ephemeral HTTP server for standalone setup wizard
func (*Server) WaitForCompletion ¶
func (s *Server) WaitForCompletion()
WaitForCompletion blocks until the server is signaled to shut down
type SetPasswordRequest ¶
type SetPasswordRequest struct {
Password string `json:"password"`
}
SetPasswordRequest represents a request to set a user's password
type TemplateData ¶
type TemplateData struct {
StandaloneMode bool // true for standalone setup process
WizardMode bool // true when rendering wizard page
EditMode bool // true when rendering setup editor page
User *user.User // authenticated user (nil in standalone mode)
Title string
Categories []SectionCategory // sidebar categories
Content template.HTML // main content
AssetVersion string
}
TemplateData holds common data for all templates
type UpdateOwnerPairingRequest ¶ added in v0.1.9
type UpdateOwnerPairingRequest struct {
TelegramID string `json:"telegram_id,omitempty"`
WhatsAppID string `json:"whatsapp_id,omitempty"`
}
UpdateOwnerPairingRequest stages resolved owner channel identities at save time.
type UpdateUserRequest ¶
type UpdateUserRequest struct {
Name string `json:"name"`
Role string `json:"role"`
TelegramID string `json:"telegram_id,omitempty"`
WhatsAppID string `json:"whatsapp_id,omitempty"`
Password *string `json:"password,omitempty"`
ClearPassword bool `json:"clear_password,omitempty"`
ACPAllowed *bool `json:"acpAllowed,omitempty"`
Thinking *bool `json:"thinking,omitempty"`
ThinkingLevel *string `json:"thinking_level,omitempty"`
Sandbox *bool `json:"sandbox,omitempty"`
}
UpdateUserRequest represents a request to update a user
type UserResponse ¶
type UserResponse struct {
Username string `json:"username"`
Name string `json:"name"`
Role string `json:"role"`
TelegramID string `json:"telegram_id,omitempty"`
WhatsAppID string `json:"whatsapp_id,omitempty"`
HasPassword bool `json:"has_password"`
ACPAllowed *bool `json:"acpAllowed,omitempty"`
Thinking *bool `json:"thinking,omitempty"`
ThinkingLevel *string `json:"thinking_level,omitempty"`
Sandbox *bool `json:"sandbox,omitempty"`
}
UserResponse represents a user in API responses (without password hash)
type UsersAPI ¶
type UsersAPI struct {
// contains filtered or unexported fields
}
UsersAPI provides API endpoints for user management
func NewUsersAPI ¶
NewUsersAPI creates a new users API handler
func (*UsersAPI) HandleCreateUser ¶
func (u *UsersAPI) HandleCreateUser(w http.ResponseWriter, r *http.Request)
HandleCreateUser creates a new user (POST /setup/api/users)
func (*UsersAPI) HandleListUsers ¶
func (u *UsersAPI) HandleListUsers(w http.ResponseWriter, r *http.Request)
HandleListUsers returns all users (GET /setup/api/users)
func (*UsersAPI) HandleRoles ¶
func (u *UsersAPI) HandleRoles(w http.ResponseWriter, r *http.Request)
HandleRoles returns available roles (GET /setup/api/roles)
func (*UsersAPI) HandleUpdateOwnerPairing ¶ added in v0.1.9
func (u *UsersAPI) HandleUpdateOwnerPairing(w http.ResponseWriter, r *http.Request)
HandleUpdateOwnerPairing applies staged owner channel identities.
func (*UsersAPI) HandleUser ¶
func (u *UsersAPI) HandleUser(w http.ResponseWriter, r *http.Request)
HandleUser handles GET, PUT, DELETE for a specific user
type WizardAPI ¶
type WizardAPI struct {
// contains filtered or unexported fields
}
WizardAPI provides API endpoints for the wizard
func NewWizardAPI ¶
func NewWizardAPI(configPath string, _ configapply.Caller) *WizardAPI
NewWizardAPI creates a new wizard API handler
func (*WizardAPI) HandleFinish ¶
func (w *WizardAPI) HandleFinish(rw http.ResponseWriter, r *http.Request)
HandleFinish saves the final configuration
func (*WizardAPI) HandleGetModels ¶
func (w *WizardAPI) HandleGetModels(rw http.ResponseWriter, r *http.Request)
HandleGetModels returns available models for a provider
func (*WizardAPI) HandleGetState ¶
func (w *WizardAPI) HandleGetState(rw http.ResponseWriter, r *http.Request)
HandleGetState returns the current wizard state
func (*WizardAPI) HandleGetStep ¶
func (w *WizardAPI) HandleGetStep(rw http.ResponseWriter, r *http.Request)
HandleGetStep returns the FormDef and current data for a specific step
func (*WizardAPI) HandlePairingAction ¶ added in v0.1.9
func (w *WizardAPI) HandlePairingAction(rw http.ResponseWriter, r *http.Request)
HandlePairingAction handles wizard pairing start/status/cancel requests.
func (*WizardAPI) HandlePrevStep ¶
func (w *WizardAPI) HandlePrevStep(rw http.ResponseWriter, r *http.Request)
HandlePrevStep goes back to the previous step
func (*WizardAPI) HandleSubmitStep ¶
func (w *WizardAPI) HandleSubmitStep(rw http.ResponseWriter, r *http.Request)
HandleSubmitStep validates and saves data for the current step
type WizardState ¶
type WizardState struct {
Step int `json:"step"`
Data *setup.WizardData `json:"data"`
PairingSessions map[string]string `json:"-"`
// contains filtered or unexported fields
}
WizardState holds the current wizard session state
type WizardStep ¶
type WizardStep struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
}
WizardStep defines a single step in the setup wizard