wailskit

package
v1.3.78 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Overview

Package wailskit provides a public facade for the Wails desktop app.

Package wailskit provides a public facade for the Wails desktop app to access internal config and other services without violating Go's internal package rules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCustomEndpoint

func AddCustomEndpoint(vendor, name, protocol, baseURL, apiKey string) error

AddCustomEndpoint adds a new endpoint to a vendor in the config and saves.

func AddMCPServer

func AddMCPServer(values map[string]string) error

AddMCPServer adds a new MCP server configuration. The values map may contain:

  • "name" (required): server name
  • "type": "stdio", "http", "ws" (default: "stdio")
  • "command": executable command (for stdio type)
  • "args": space-separated arguments (for stdio type)
  • "url": server URL (for http/ws type)
  • "headers_*": HTTP headers (keys like "headers_Authorization")
  • "env_*": environment variables (keys like "env_KEY")

func ApplyImpersonation

func ApplyImpersonation(presetID, version string, customHeaders map[string]string) error

ApplyImpersonation applies an impersonation preset and persists to config.

func BindIMAdapter

func BindIMAdapter(name, workingDir string, imMgr interface{ BindAdapterToWorkspace(string, string) error }) error

BindIMAdapter binds an adapter to the current workspace. imMgr may be nil (adapter will be bound but won't be active until manager is initialized).

func DeleteSession

func DeleteSession(id string) error

DeleteSession removes a session by ID.

func FetchModelsForEndpoint

func FetchModelsForEndpoint(vendor, endpoint, apiKey, baseURL string) ([]string, error)

FetchModelsForEndpoint dynamically discovers models from an API endpoint. If the target endpoint fails, tries other endpoints with the same BaseURL within the same vendor. Only reports error if ALL same-domain endpoints fail.

func ForceReauthMCPServer added in v1.3.77

func ForceReauthMCPServer(name string) bool

ForceReauthMCPServer deletes the server-name-specific OAuth credential and triggers a reconnect. The next request will start a fresh OAuth flow.

func GetGlobalConfig

func GetGlobalConfig() *config.Config

GetGlobalConfig returns the current global config.

func GetWorkingDir

func GetWorkingDir() string

GetWorkingDir returns the current working directory.

func LoadConfigForWorkspace

func LoadConfigForWorkspace(workDir string) (*config.Config, error)

LoadConfigForWorkspace loads config for the given workspace.

func LoadSession

func LoadSession(id string) error

func ModelsForEndpoint

func ModelsForEndpoint(vendor, endpointKey string) []string

ModelsForEndpoint returns available model names for a vendor and endpoint key.

func NeedsOnboard

func NeedsOnboard() bool

NeedsOnboard returns true if the config needs first-time setup.

func NewSession

func NewSession() error

func ReadFileContent

func ReadFileContent(path string) (string, error)

ReadFileContent reads a text file and returns its content. For security, it rejects paths outside the working directory when the path is not absolute.

func RebindIMAdapter

func RebindIMAdapter(name, workingDir string, imMgr interface{ BindAdapterToWorkspace(string, string) error }) error

RebindIMAdapter re-binds an adapter to the current workspace, replacing any existing binding to another workspace. imMgr may be nil (adapter will be rebound but won't be active until manager is initialized).

func ReconnectMCPServer

func ReconnectMCPServer(name string) bool

func RemoveIMAdapter

func RemoveIMAdapter(name string) error

RemoveIMAdapter removes an IM adapter by name.

func RemoveMCPServer

func RemoveMCPServer(name string) error

RemoveMCPServer removes an MCP server by name.

func ResolveConfigFilePath

func ResolveConfigFilePath(workDir string) string

ResolveConfigFilePath finds the config file for a workspace directory.

func SaveAPIKey

func SaveAPIKey(vendor, endpoint, apiKey string) error

SaveAPIKey saves an API key for a vendor/endpoint.

func SaveDefaultMode

func SaveDefaultMode(mode string) error

SaveDefaultMode saves the default permission mode.

func SaveIMAdapter

func SaveIMAdapter(name string, values map[string]string) error

SaveIMAdapter creates or updates an IM adapter. The cfg map may contain:

  • "platform" (required): adapter platform (e.g. "telegram", "discord", "slack")
  • "transport": transport type
  • "command": command for stdio transport
  • other keys are stored in the adapter's Extra map

func SetChatBridge

func SetChatBridge(cb *ChatBridge)

SetChatBridge stores the active chat bridge for session management.

func SetConfig

func SetConfig(cfg *config.Config)

SetConfig sets the global config (called after workspace init).

func SetIMAdapterEnabled

func SetIMAdapterEnabled(name string, enabled bool) error

SetIMAdapterEnabled toggles the enabled state of an IM adapter.

func SetMCPServerEnabled

func SetMCPServerEnabled(name string, enabled bool) bool

func TestIMConnection

func TestIMConnection(name string) error

TestIMConnection attempts to validate an IM adapter configuration. It performs a basic connectivity check by verifying the config has the minimum required fields for the given platform.

func UnbindIMAdapter

func UnbindIMAdapter(name string, imMgr interface{ UnbindAdapter(string) error }) error

UnbindIMAdapter removes all bindings for an adapter.

func UpdateConfig

func UpdateConfig(values map[string]interface{}) error

UpdateConfig applies a map of config values and saves.

func VendorNames

func VendorNames() []string

VendorNames returns available vendor names.

Types

type ChatBridge

type ChatBridge struct {

	// UI event emitter — set by app.go via SetEmitEvent
	EmitEvent func(name string, payload ...interface{})

	// IM outbound push — same as Fyne agentBridge.Emitter
	Emitter *im.IMEmitter

	// Callback for emitting events to frontend.
	OnStreamEvent func(eventType string, data json.RawMessage)

	// Callback fired after current session changes so the host can bind IM/runtime state.
	OnSessionChanged func()
	// contains filtered or unexported fields
}

ChatBridge manages the full agent chat loop for the Wails frontend, mirroring the Fyne desktop's AgentBridge tool registration and session management.

func GetChatBridge added in v1.3.68

func GetChatBridge() *ChatBridge

GetChatBridge returns the active chat bridge.

func NewChatBridge

func NewChatBridge() (*ChatBridge, error)

NewChatBridge creates a new chat bridge using the global config.

func (*ChatBridge) AttachTunnelBroker

func (b *ChatBridge) AttachTunnelBroker(broker *tunnel.Broker)

AttachTunnelBroker connects the broker for outbound event push to mobile. All negotiation (session_info, replay, status, announce) is handled by TunnelHost.PrepareOnlineShare — the canonical share bootstrap.

func (*ChatBridge) BindShareCommands

func (b *ChatBridge) BindShareCommands(broker *tunnel.Broker, onLanguage func(string), currentAskUserRequest func() tool.AskUserRequest, clearAskUserRequest func())

func (*ChatBridge) Cancel

func (b *ChatBridge) Cancel()

Cancel stops the current agent run. Mirrors Fyne AgentBridge.Cancel exactly.

func (*ChatBridge) ClearCurrentSession

func (b *ChatBridge) ClearCurrentSession()

ClearCurrentSession resets the current session so next chat creates a fresh one.

func (*ChatBridge) Close

func (b *ChatBridge) Close()

Close cleans up all resources (mirrors Fyne AgentBridge.Close).

func (*ChatBridge) CompleteMCPOAuth added in v1.3.70

func (b *ChatBridge) CompleteMCPOAuth(ctx context.Context, serverName string) error

func (*ChatBridge) ContextWindow

func (b *ChatBridge) ContextWindow() int

ContextWindow returns the current context window size.

func (*ChatBridge) CurrentAskUserRequest

func (b *ChatBridge) CurrentAskUserRequest(requestID string) tool.AskUserRequest

CurrentAskUserRequest returns the pending ask_user request for the given ID, or nil if none exists. Used by HandleMobileAskUserResponse to reconstruct the full response with completion metadata.

func (*ChatBridge) CurrentSession

func (b *ChatBridge) CurrentSession() *session.Session

CurrentSession returns the current session.

func (*ChatBridge) CurrentSessionHistory

func (b *ChatBridge) CurrentSessionHistory() []SessionMessage

func (*ChatBridge) CurrentSessionID

func (b *ChatBridge) CurrentSessionID() string

CurrentSessionID returns the current session ID.

func (*ChatBridge) CurrentSessionTunnelEvents

func (b *ChatBridge) CurrentSessionTunnelEvents() []tunnel.GatewayMessage

func (*ChatBridge) CurrentTunnelActivity

func (b *ChatBridge) CurrentTunnelActivity() string

func (*ChatBridge) CurrentTunnelHistory

func (b *ChatBridge) CurrentTunnelHistory() []tunnel.HistoryEntry

func (*ChatBridge) CurrentTunnelStatus

func (b *ChatBridge) CurrentTunnelStatus() tunnel.StatusData

func (*ChatBridge) CycleReasoningEffort added in v1.3.68

func (b *ChatBridge) CycleReasoningEffort() (string, bool)

func (*ChatBridge) DetachTunnelBroker

func (b *ChatBridge) DetachTunnelBroker()

func (*ChatBridge) Elapsed

func (b *ChatBridge) Elapsed() time.Duration

Elapsed returns time since the current agent run started.

func (*ChatBridge) EnsureSession

func (b *ChatBridge) EnsureSession()

EnsureSession creates a default session if none exists (mirrors Fyne's ensureSession). On first call with no current session, tries to auto-load the most recent workspace session. If that session is locked by another instance, creates a new ephemeral session (auto-deleted if empty on close/switch).

func (*ChatBridge) GetAvailableModels

func (b *ChatBridge) GetAvailableModels() []string

GetAvailableModels returns the list of models available for the current endpoint.

func (*ChatBridge) GetLSPStatus added in v1.3.76

func (b *ChatBridge) GetLSPStatus() LSPStatusResponse

GetLSPStatus returns the detected language server status for the current workspace. The frontend calls this to populate the Settings > Language Servers panel.

func (*ChatBridge) GetModelInfo

func (b *ChatBridge) GetModelInfo() map[string]interface{}

GetModelInfo returns the current model info for the status bar.

func (*ChatBridge) GetPermissionMode

func (b *ChatBridge) GetPermissionMode() string

GetPermissionMode returns the current permission mode string.

func (*ChatBridge) GetTeamBoard added in v1.3.70

func (b *ChatBridge) GetTeamBoard() []swarm.TeamBoardSnapshot

func (*ChatBridge) GetTunnelHost added in v1.3.71

func (b *ChatBridge) GetTunnelHost() *agentruntime.TunnelHost

GetTunnelHost returns the tunnel host (for StartShare).

func (*ChatBridge) HandleMobileApprovalResponse

func (b *ChatBridge) HandleMobileApprovalResponse(data tunnel.ApprovalResponseData)

HandleMobileApprovalResponse processes an approval response received from the mobile client via the tunnel.

func (*ChatBridge) HandleMobileAskUserResponse

func (b *ChatBridge) HandleMobileAskUserResponse(data tunnel.AskUserResponseData, _ tool.AskUserRequest)

HandleMobileAskUserResponse processes an ask_user response received from the mobile client via the tunnel.

func (*ChatBridge) HandleTunnelUserMessage

func (b *ChatBridge) HandleTunnelUserMessage(data tunnel.MessageData) error

func (*ChatBridge) InitAgent

func (b *ChatBridge) InitAgent(_ ...context.Context) error

InitAgent sets up provider, tools, and agent — full parity with Fyne bridge. Called on startup or before the first message if not yet initialized.

func (*ChatBridge) InstallLSPServer added in v1.3.76

func (b *ChatBridge) InstallLSPServer(languageID, optionID string) LSPInstallResult

InstallLSPServer runs the install command for the given language server. If optionID is empty, the recommended option is used. The command runs in the workspace directory.

func (*ChatBridge) IsWorking

func (b *ChatBridge) IsWorking() bool

IsWorking returns true if the agent is currently running.

func (*ChatBridge) LoadSession

func (b *ChatBridge) LoadSession(id string) error

LoadSession loads an existing session by ID.

func (*ChatBridge) Messages added in v1.3.71

func (b *ChatBridge) Messages() []provider.Message

Messages returns the current conversation messages for snapshot/tunnel use. When agent is nil (e.g. after loading a historical session but before sending any message), falls back to the session's persisted messages.

func (*ChatBridge) OnConfigProviderChanged added in v1.3.68

func (b *ChatBridge) OnConfigProviderChanged()

OnConfigProviderChanged syncs Wails bridge state after the config tool changes vendor/endpoint/model/api_key. Updates b.resolved and b.currentSes so the frontend model picker and status bar reflect the new selection. Also recreates the provider so the running agent uses the new LLM backend.

func (*ChatBridge) PendingApprovalRequest

func (b *ChatBridge) PendingApprovalRequest() (string, string, bool)

func (*ChatBridge) PendingAskUserRequest

func (b *ChatBridge) PendingAskUserRequest() (string, tool.AskUserRequest, bool)

func (*ChatBridge) PrepareShareBroker

func (b *ChatBridge) PrepareShareBroker(broker *tunnel.Broker, snapshotProvider func() tunnel.BrokerSnapshot)

func (*ChatBridge) PushErrorToMobile

func (b *ChatBridge) PushErrorToMobile(msg string)

PushErrorToMobile pushes an error message to mobile via tunnel.

func (*ChatBridge) PushSystemMessageToMobile

func (b *ChatBridge) PushSystemMessageToMobile(msg string)

PushSystemMessageToMobile pushes a system message to mobile via tunnel.

func (*ChatBridge) PushUserMessageToMobile

func (b *ChatBridge) PushUserMessageToMobile(msg string)

PushUserMessageToMobile pushes a user message to mobile via tunnel.

func (*ChatBridge) QueueHiddenMessage

func (b *ChatBridge) QueueHiddenMessage(msg string)

QueueHiddenMessage stores a hidden message (mirrors Fyne).

func (*ChatBridge) QueueMessage

func (b *ChatBridge) QueueMessage(msg string)

QueueMessage stores a user message to be sent after the current agent turn.

func (*ChatBridge) ReasoningEffort added in v1.3.68

func (b *ChatBridge) ReasoningEffort() string

func (*ChatBridge) RequestApproval

func (b *ChatBridge) RequestApproval(ctx context.Context, requestID, toolName, input string) permission.Decision

RequestApproval blocks until the user (desktop or mobile) responds to an approval request. It stores a pending channel, pushes the request to a connected tunnel broker, and emits an event so the Wails frontend can show an approval dialog.

func (*ChatBridge) RequestAskUser

func (b *ChatBridge) RequestAskUser(ctx context.Context, requestID string, req tool.AskUserRequest) (tool.AskUserResponse, error)

RequestAskUser blocks until the user (desktop or mobile) responds to a structured questionnaire. It mirrors the Fyne handleAskUser flow.

func (*ChatBridge) ResetAgent

func (b *ChatBridge) ResetAgent()

ResetAgent destroys the current agent, forcing a rebuild on next message.

func (*ChatBridge) ResetCurrentSessionTunnelLedger

func (b *ChatBridge) ResetCurrentSessionTunnelLedger()

func (*ChatBridge) Resolved

func (b *ChatBridge) Resolved() *config.ResolvedEndpoint

Resolved returns the resolved endpoint.

func (*ChatBridge) RespondApproval

func (b *ChatBridge) RespondApproval(requestID, decision string)

RespondApproval delivers a desktop-originated approval decision to the waiting channel. decision is "allow", "deny", or "always_allow".

func (*ChatBridge) RespondAskUser

func (b *ChatBridge) RespondAskUser(requestID string, response tool.AskUserResponse)

RespondAskUser delivers a desktop-originated ask_user response to the waiting channel.

func (*ChatBridge) ResumeSession

func (b *ChatBridge) ResumeSession(id string) error

ResumeSession loads a session and re-initializes the agent for it.

func (*ChatBridge) SendContent

func (b *ChatBridge) SendContent(content []provider.ContentBlock) error

SendContent sends multimodal content to the agent.

func (*ChatBridge) SendHiddenText

func (b *ChatBridge) SendHiddenText(text string) error

SendHiddenText sends a hidden message to the agent without UI display.

func (*ChatBridge) SendMessage

func (b *ChatBridge) SendMessage(userMsg string) error

SendMessage sends a user message and streams events to the frontend. If agent is already running, queues the message for processing after the current turn.

func (*ChatBridge) SendNonUIMessage added in v1.3.64

func (b *ChatBridge) SendNonUIMessage(userMsg string, source string, excludeAdapter string) error

SendNonUIMessage sends a user message originating from a non-desktop source (IM/mobile). It pushes a user_message event to the frontend so the message appears in the chat, but avoids duplicate display on the originating surface. excludeAdapter is the IM adapter name to exclude from echo (prevents IM self-echo).

func (*ChatBridge) SessionStore

func (b *ChatBridge) SessionStore() session.Store

SessionStore returns the session store.

func (*ChatBridge) SetApprovalOverride

func (b *ChatBridge) SetApprovalOverride(toolName string)

SetApprovalOverride persists a tool-level permission override.

func (*ChatBridge) SetPermissionMode

func (b *ChatBridge) SetPermissionMode(modeStr string)

SetPermissionMode updates the agent permission mode at runtime. Mirrors Fyne AgentBridge.SetPermissionMode exactly.

func (*ChatBridge) SetTunnelHost

func (b *ChatBridge) SetTunnelHost(th *agentruntime.TunnelHost)

SetTunnelHost sets the unified tunnel host from InteractiveRuntimeCore.Tunnel.

func (*ChatBridge) StartMCPOAuth added in v1.3.70

func (b *ChatBridge) StartMCPOAuth(ctx context.Context, serverName string, openURL func(string) error) (*MCPOAuthStartResult, error)

func (*ChatBridge) StartNewSession added in v1.3.70

func (b *ChatBridge) StartNewSession() (string, error)

func (*ChatBridge) SwitchModel

func (b *ChatBridge) SwitchModel(model string) error

SwitchModel hot-swaps the model at runtime (mirrors Fyne SwitchModel).

func (*ChatBridge) TokenCount

func (b *ChatBridge) TokenCount() int

TokenCount returns the current token usage.

type DesktopConfig

type DesktopConfig struct {
	WorkDir     string `json:"work_dir,omitempty"`
	WindowW     int    `json:"window_width,omitempty"`
	WindowH     int    `json:"window_height,omitempty"`
	LastSession string `json:"last_session_id,omitempty"`
	Language    string `json:"language,omitempty"`
	// contains filtered or unexported fields
}

DesktopConfig stores window state and preferences, shared with the Fyne desktop. File: ~/.ggcode/desktop-config.json

func LoadDesktopConfig

func LoadDesktopConfig() *DesktopConfig

LoadDesktopConfig reads the shared desktop config file.

func (*DesktopConfig) Save

func (dc *DesktopConfig) Save() error

Save persists the desktop config.

func (*DesktopConfig) SetLastSession

func (dc *DesktopConfig) SetLastSession(id string)

SetLastSession saves the last active session ID.

func (*DesktopConfig) SetWorkDir

func (dc *DesktopConfig) SetWorkDir(dir string)

SetWorkDir saves the work directory.

type EndpointDetails

type EndpointDetails struct {
	DisplayName    string   `json:"displayName"`
	Protocol       string   `json:"protocol"`
	BaseURL        string   `json:"baseUrl"`
	APIKeySet      bool     `json:"apiKeySet"`
	APIKeyMasked   string   `json:"apiKeyMasked"`
	DefaultModel   string   `json:"defaultModel"`
	Models         []string `json:"models"`
	ContextWindow  int      `json:"contextWindow"`
	SupportsVision bool     `json:"supportsVision"`
}

EndpointDetails provides detailed info about a configured endpoint.

func GetEndpointDetails

func GetEndpointDetails(vendor, endpoint string) *EndpointDetails

GetEndpointDetails returns details for a specific vendor endpoint.

type EndpointInfo

type EndpointInfo struct {
	Key         string `json:"key"`
	DisplayName string `json:"displayName"`
}

EndpointInfo describes a vendor endpoint.

func EndpointsForVendor

func EndpointsForVendor(vendor string) []EndpointInfo

EndpointsForVendor returns endpoint info for a vendor.

type EndpointPresetInfo

type EndpointPresetInfo struct {
	ID              string   `json:"id"`
	DisplayName     string   `json:"displayName"`
	Models          []string `json:"models"`
	DefaultEndpoint bool     `json:"defaultEndpoint"`
}

EndpointPresetInfo describes an endpoint preset.

type FileInfo

type FileInfo struct {
	Name     string `json:"name"`
	IsDir    bool   `json:"isDir"`
	Size     int64  `json:"size"`
	Modified int64  `json:"modified"` // Unix timestamp
	Path     string `json:"path"`     // Full path
}

FileInfo describes a file or directory entry.

func ListDirectory

func ListDirectory(dir string, recursive bool) ([]FileInfo, error)

ListDirectory returns entries in the given directory. If recursive is true, it walks subdirectories recursively.

type FullConfig

type FullConfig struct {
	// LLM
	Vendor      string `json:"vendor"`
	Endpoint    string `json:"endpoint"`
	Model       string `json:"model"`
	APIKeySet   bool   `json:"apiKeySet"` // true if key exists (never send key to frontend)
	Language    string `json:"language"`
	ExtraPrompt string `json:"extraPrompt"`
	DefaultMode string `json:"defaultMode"` // auto, allow, confirm
	MaxIter     int    `json:"maxIterations"`
	ProbeCtx    bool   `json:"probeContext"`

	// Impersonation
	ImpersonatePreset        string            `json:"impersonatePreset"`
	ImpersonateCustomVersion string            `json:"impersonateCustomVersion"`
	ImpersonateCustomHeaders map[string]string `json:"impersonateCustomHeaders"`

	// SubAgents
	SubAgentMaxConcurrent int    `json:"subAgentMaxConcurrent"`
	SubAgentTimeout       string `json:"subAgentTimeout"`
	SubAgentShowOutput    bool   `json:"subAgentShowOutput"`

	// Swarm
	SwarmMaxTeammates int    `json:"swarmMaxTeammates"`
	SwarmTimeout      string `json:"swarmTimeout"`
	SwarmInboxSize    int    `json:"swarmInboxSize"`

	// A2A
	A2ADisabled bool   `json:"a2aDisabled"`
	A2APort     int    `json:"a2aPort"`
	A2AHost     string `json:"a2aHost"`

	A2ALANDiscovery bool `json:"a2aLanDiscovery"`

	// Harness
	HarnessAutoRun  string `json:"harnessAutoRun"`
	HarnessAutoInit bool   `json:"harnessAutoInit"`

	// Stream (video capture)
	StreamEncoder string `json:"streamEncoder"`
	StreamFPS     int    `json:"streamFPS"`

	// Knight
	KnightEnabled    bool   `json:"knightEnabled"`
	KnightTrustLevel string `json:"knightTrustLevel"`

	// UI
	SidebarVisible *bool `json:"sidebarVisible"`

	// Workspace
	WorkDir string `json:"workDir"`

	// State
	NeedsSetup bool `json:"needsSetup"`
}

FullConfig is a complete read-only snapshot for the frontend settings page.

func GetFullConfig

func GetFullConfig() (*FullConfig, error)

GetFullConfig returns a complete config snapshot.

type IMAdapterInfo

type IMAdapterInfo struct {
	Name      string                 `json:"name"`
	Enabled   bool                   `json:"enabled"`
	Muted     bool                   `json:"muted"`
	Platform  string                 `json:"platform"`
	Transport string                 `json:"transport"`
	Command   string                 `json:"command"`
	Args      []string               `json:"args,omitempty"`
	Extra     map[string]interface{} `json:"extra,omitempty"`
	Targets   []string               `json:"targets,omitempty"`
	Workspace string                 `json:"workspace,omitempty"` // bound workspace path
	IsCurrent bool                   `json:"isCurrent"`           // bound to current workspace
}

IMAdapterInfo is a frontend-friendly representation of an IM adapter config.

func ListIMAdapters

func ListIMAdapters(workingDir string, imMgr interface {
	AllPersistedBindings() []im.ChannelBinding
	IsMuted(adapterName string) bool
}) ([]IMAdapterInfo, error)

ListIMAdapters returns all configured IM adapters with workspace binding info. imManager may be nil (no runtime bindings available).

type IMPlatformField

type IMPlatformField struct {
	Key         string `json:"key"`
	Label       string `json:"label"`
	Placeholder string `json:"placeholder"`
	Secret      bool   `json:"secret,omitempty"`
}

IMPlatformField describes a configuration field for an IM platform.

type IMPlatformMeta

type IMPlatformMeta struct {
	ID          string            `json:"id"`
	DisplayName string            `json:"displayName"`
	Fields      []IMPlatformField `json:"fields"`
	QRAuth      bool              `json:"qrAuth"`
}

IMPlatformMeta describes a supported IM platform for the frontend.

func GetIMPlatformRegistry

func GetIMPlatformRegistry() []IMPlatformMeta

GetIMPlatformRegistry returns the list of supported IM platforms.

type ImpersonationPresetInfo

type ImpersonationPresetInfo struct {
	ID             string            `json:"id"`
	DisplayName    string            `json:"displayName"`
	DefaultVersion string            `json:"defaultVersion"`
	ExtraHeaders   map[string]string `json:"extraHeaders,omitempty"`
}

ImpersonationPresetInfo describes an impersonation preset for the frontend.

func GetImpersonationPresets

func GetImpersonationPresets() []ImpersonationPresetInfo

GetImpersonationPresets returns the real presets from provider.DefaultImpersonationPresets().

type LSPInstallOption added in v1.3.76

type LSPInstallOption struct {
	ID          string `json:"id"`
	Label       string `json:"label"`
	Binary      string `json:"binary"`
	Recommended bool   `json:"recommended"`
	Scope       string `json:"scope"` // "user", "global", "project"
}

LSPInstallOption is a single installable language server variant.

type LSPInstallResult added in v1.3.76

type LSPInstallResult struct {
	Success bool   `json:"success"`
	Output  string `json:"output"`
}

LSPInstallResult holds the outcome of an install attempt.

type LSPServerStatus added in v1.3.76

type LSPServerStatus struct {
	ID          string `json:"id"`
	DisplayName string `json:"display_name"`
	Available   bool   `json:"available"`
	Binary      string `json:"binary"`
	InstallHint string `json:"install_hint"`
	// Override indicates whether the user configured a custom binary path.
	Override       bool               `json:"override"`
	CanInstall     bool               `json:"can_install"`
	InstallOptions []LSPInstallOption `json:"install_options"`
}

LSPServerStatus is the JSON-serializable status of a single language server.

type LSPStatusResponse added in v1.3.76

type LSPStatusResponse struct {
	Workspace string            `json:"workspace"`
	Languages []LSPServerStatus `json:"languages"`
}

LSPStatusResponse is the full LSP status payload for the frontend.

type LogEntry

type LogEntry struct {
	Seq      int64  `json:"seq"`
	Category string `json:"category"`
	Message  string `json:"message"`
	Time     string `json:"time"`
}

LogEntry represents a single debug log line.

type LogStream

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

LogStream is a ring-buffer of recent log entries that can be toggled on/off from the frontend and drained via polling.

func NewLogStream

func NewLogStream(capacity int) *LogStream

NewLogStream creates a LogStream with the given ring-buffer capacity.

func (*LogStream) Drain

func (s *LogStream) Drain() []LogEntry

Drain returns all entries accumulated since the last Drain call, then clears the pending list. Returns empty slice if nothing new.

func (*LogStream) DrainLogStreamJSON

func (s *LogStream) DrainLogStreamJSON() string

DrainLogStreamJSON is the Wails binding that returns pending logs as JSON.

func (*LogStream) Enable

func (s *LogStream) Enable(on bool)

Enable turns the stream on or off. When enabled, debug.Log output is captured into the ring buffer. When disabled, captures stop but existing entries are preserved.

func (*LogStream) History

func (s *LogStream) History(n int) []LogEntry

History returns the last N entries from the ring buffer.

func (*LogStream) IsEnabled

func (s *LogStream) IsEnabled() bool

IsEnabled returns whether the stream is currently capturing.

func (*LogStream) ToggleLogStream

func (s *LogStream) ToggleLogStream(enabled bool)

ToggleLogStream is the Wails binding to enable/disable log capture.

func (*LogStream) Write

func (s *LogStream) Write(category, message string)

Write appends a log entry. Safe to call from any goroutine. If the stream is disabled, the write is silently dropped.

type MCPOAuthStartResult added in v1.3.70

type MCPOAuthStartResult struct {
	ServerName     string `json:"serverName"`
	AuthorizeURL   string `json:"authorizeUrl"`
	DeviceUserCode string `json:"deviceUserCode,omitempty"`
	OpenError      string `json:"openError,omitempty"`
}

type MCPServerInfo

type MCPServerInfo struct {
	Name          string            `json:"name"`
	Type          string            `json:"type,omitempty"`
	Command       string            `json:"command,omitempty"`
	Args          []string          `json:"args,omitempty"`
	Env           map[string]string `json:"env,omitempty"`
	URL           string            `json:"url,omitempty"`
	Headers       map[string]string `json:"headers,omitempty"`
	Status        string            `json:"status,omitempty"`
	Error         string            `json:"error,omitempty"`
	Disabled      bool              `json:"disabled,omitempty"`
	Connected     bool              `json:"connected,omitempty"`
	OAuthRequired bool              `json:"oauthRequired,omitempty"`
}

MCPServerInfo is a frontend-friendly representation of an MCP server config.

func ListMCPServers

func ListMCPServers() ([]MCPServerInfo, error)

ListMCPServers returns all configured MCP servers.

type ResolvedEndpointInfo

type ResolvedEndpointInfo struct {
	VendorID       string   `json:"vendorId"`
	VendorName     string   `json:"vendorName"`
	EndpointID     string   `json:"endpointId"`
	EndpointName   string   `json:"endpointName"`
	Protocol       string   `json:"protocol"`
	BaseURL        string   `json:"baseUrl"`
	APIKeySet      bool     `json:"apiKeySet"`
	APIKeyMasked   string   `json:"apiKeyMasked"`
	Model          string   `json:"model"`
	Models         []string `json:"models"`
	ContextWindow  int      `json:"contextWindow"`
	SupportsVision bool     `json:"supportsVision"`
}

ResolvedEndpointInfo provides the current resolved LLM endpoint details for the frontend.

func GetResolvedEndpoint

func GetResolvedEndpoint() (*ResolvedEndpointInfo, error)

GetResolvedEndpoint returns the currently resolved active endpoint info.

type SessionInfo

type SessionInfo struct {
	ID        string `json:"id"`
	Title     string `json:"title"`
	Workspace string `json:"workspace"`
	Vendor    string `json:"vendor"`
	Model     string `json:"model"`
	MsgCount  int    `json:"msgCount"`
	UpdatedAt string `json:"updatedAt"`
}

SessionInfo is a lightweight session record for the frontend.

func ListSessions

func ListSessions(workingDir string) ([]SessionInfo, error)

ListSessions returns sessions for the given workspace, sorted by UpdatedAt descending. If workingDir is empty, returns all sessions.

type SessionMessage

type SessionMessage struct {
	ID          string `json:"id,omitempty"`
	TurnID      string `json:"turn_id,omitempty"`
	Role        string `json:"role"`
	Content     string `json:"content"`
	ToolName    string `json:"toolName,omitempty"`
	ToolID      string `json:"toolID,omitempty"`
	ToolArgs    string `json:"toolArgs,omitempty"`
	ToolDisplay string `json:"toolDisplayName,omitempty"`
	ToolDetail  string `json:"toolDetail,omitempty"`
	IsError     bool   `json:"isError,omitempty"`
	Streaming   bool   `json:"streaming,omitempty"`
}

SessionMessage is a message from session history for the frontend.

func GetSessionHistory

func GetSessionHistory() ([]SessionMessage, error)

GetSessionHistory loads messages from the current session.

type TestEndpointResult

type TestEndpointResult struct {
	OK         bool     `json:"ok"`
	Message    string   `json:"message"`
	Models     []string `json:"models,omitempty"`
	ModelCount int      `json:"modelCount"`
}

TestEndpointResult is the result of testing an endpoint connection.

func TestEndpointConnection

func TestEndpointConnection(protocol, baseURL, apiKey string) (*TestEndpointResult, error)

TestEndpointConnection tests an endpoint by fetching its model list.

type VendorPresetInfo

type VendorPresetInfo struct {
	ID          string               `json:"id"`
	DisplayName string               `json:"displayName"`
	Endpoints   []EndpointPresetInfo `json:"endpoints"`
}

VendorPresets returns vendor preset info for onboarding.

func GetVendorPresets

func GetVendorPresets() []VendorPresetInfo

GetVendorPresets returns vendor presets for onboarding.

Jump to

Keyboard shortcuts

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