controller

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventNameLLMMessageAdd        = "llm:message:add"
	EventNameLLMMessageUpdate     = "llm:message:update"
	EventNameLLMConsumptionUpdate = "llm:consumption:update"
)

Variables

View Source
var (
	RuntimeEventsEmit = runtime.EventsEmit

	RuntimeScreenGetAll      = runtime.ScreenGetAll
	RuntimeWindowShow        = runtime.WindowShow
	RuntimeWindowGetSize     = runtime.WindowGetSize
	RuntimeWindowSetSize     = runtime.WindowSetSize
	RuntimeWindowSetMaxSize  = runtime.WindowSetMaxSize
	RuntimeWindowSetPosition = runtime.WindowSetPosition
	RuntimeWindowCenter      = runtime.WindowCenter

	RuntimeOpenMultipleFilesDialog = runtime.OpenMultipleFilesDialog

	RuntimeHide = runtime.Hide
	RuntimeQuit = runtime.Quit
)

Runtime functions that are used in the controller package. These functions can be overridden in tests or other packages if needed.

Functions

func GetOptions

func GetOptions(c *Controller, icon []byte, assets embed.FS) *options.App

Types

type ApplicationConfig

type ApplicationConfig struct {
	Config        model.Config
	ActiveProfile model.Profile

	//only for wails to generate TypeScript types
	Z mcp.Tool
}

type AssetMeta

type AssetMeta struct {
	Path     string
	Url      string
	MimeType string
}

type Controller

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

func BuildFromConfig

func BuildFromConfig(cfg *model.Config, lastState string, buildMode bool) (ctrl *Controller, err error)

func (*Controller) AppMounted

func (c *Controller) AppMounted()

AppMounted is called when the frontend application is mounted (decided by the frontend itself)

func (*Controller) GetApplicationConfig

func (c *Controller) GetApplicationConfig() ApplicationConfig

func (*Controller) GetAssetMeta

func (c *Controller) GetAssetMeta(path string) (AssetMeta, error)

func (*Controller) GetAvailableProfiles

func (c *Controller) GetAvailableProfiles() map[string]model.ProfileMeta

func (*Controller) GetCurrentConversation

func (c *Controller) GetCurrentConversation() LLMMessages

func (*Controller) GetDebugConfig

func (c *Controller) GetDebugConfig() model.DebugConfig

func (*Controller) GetLastState

func (c *Controller) GetLastState() string

func (*Controller) HistoryGetCount

func (c *Controller) HistoryGetCount() (int, error)

func (*Controller) HistoryGetLast

func (c *Controller) HistoryGetLast(skip, limit int) ([]history.Entry, error)

func (*Controller) HistorySearch

func (c *Controller) HistorySearch(query string) ([]history.Entry, error)

func (*Controller) IsAppMounted

func (c *Controller) IsAppMounted() bool

func (*Controller) LLMApproveToolCall

func (c *Controller) LLMApproveToolCall(callId, message string)

func (*Controller) LLMAsk

func (c *Controller) LLMAsk(args LLMAskArgs) (result LLMAskResult, err error)

func (*Controller) LLMInterrupt

func (c *Controller) LLMInterrupt() (err error)

func (*Controller) LLMRejectToolCall

func (c *Controller) LLMRejectToolCall(callId, message string)

func (*Controller) LLMWait

func (c *Controller) LLMWait() (result LLMAskResult, err error)

func (*Controller) ListMcpTools

func (c *Controller) ListMcpTools() (map[string][]mcp.Tool, error)

func (*Controller) Log

func (c *Controller) Log(level string, jsonArgs string)

func (*Controller) OpenFileDialog

func (c *Controller) OpenFileDialog(args OpenFileDialogArgs) ([]string, error)

func (*Controller) Restart

func (c *Controller) Restart(state string)

func (*Controller) SetActiveProfile

func (c *Controller) SetActiveProfile(profileName string) (model.Profile, error)

func (*Controller) SetBuiltinTools

func (c *Controller) SetBuiltinTools(config builtin.BuiltIns)

func (*Controller) SetMcpTools

func (c *Controller) SetMcpTools(config map[string]iMcp.Server)

func (*Controller) Shutdown

func (c *Controller) Shutdown()

func (*Controller) TriggerRestart

func (c *Controller) TriggerRestart()

type LLMAskArgs

type LLMAskArgs struct {
	History LLMMessages
}

type LLMAskResult

type LLMAskResult struct {
	Content     string
	Consumption common.ConsumptionSummary
}

type LLMMessage

type LLMMessage struct {
	Id           string
	Role         string
	ContentParts []LLMMessageContentPart
	Created      int64
}

type LLMMessageCall

type LLMMessageCall struct {
	Id        string
	Function  string
	Arguments string
	Meta      LLMMessageCallMeta
	Result    *LLMMessageCallResult
}

type LLMMessageCallMeta

type LLMMessageCallMeta struct {
	BuiltIn bool
	Custom  bool
	Mcp     bool

	NeedsApproval bool

	ToolName        string
	ToolDescription string
}

type LLMMessageCallResult

type LLMMessageCallResult struct {
	Content    string
	Error      string
	DurationMs int64

	//only for wails to generate TypeScript types
	V mcp.CallToolResult
	W mcp.TextContent
	X mcp.ImageContent
	Y mcp.AudioContent
	Z mcp.EmbeddedResource
}

type LLMMessageContentPart

type LLMMessageContentPart struct {
	Type    LLMMessageContentPartType
	Content string
	Call    LLMMessageCall
}

type LLMMessageContentPartType

type LLMMessageContentPartType string
const (
	LLMMessageContentPartTypeAttachment LLMMessageContentPartType = "attachment"
	LLMMessageContentPartTypeText       LLMMessageContentPartType = "text"
	LLMMessageContentPartTypeToolCall   LLMMessageContentPartType = "tool"
)

type LLMMessages

type LLMMessages []LLMMessage

func (LLMMessages) ToMessageContent

func (m LLMMessages) ToMessageContent() ([]llms.MessageContent, error)

type OpenFileDialogArgs

type OpenFileDialogArgs struct {
	Title string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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