Documentation
¶
Index ¶
- func Run(version string) error
- type AgentInfo
- type App
- func (a *App) CloseSession(sessionID string)
- func (a *App) CreateSession(agentName string) (*SessionInfo, error)
- func (a *App) DeleteMCP(name string) error
- func (a *App) DeleteSkill(name string) error
- func (a *App) DeleteTool(name string) error
- func (a *App) GetConfig() *userconfig.Config
- func (a *App) GetCost(sessionID string) *CostInfo
- func (a *App) GetMCPStatus() []MCPStatus
- func (a *App) GetPersona(agent string) Persona
- func (a *App) GetSessions() []SessionInfo
- func (a *App) GetThemes() []ThemeInfo
- func (a *App) KMGraph() (*KMGraphData, error)
- func (a *App) KMHealth() KMHealth
- func (a *App) KMIndex(path, typ string) error
- func (a *App) KMPickDirectory() (string, error)
- func (a *App) KMStatus() (*KMStats, error)
- func (a *App) ListAgents() []AgentInfo
- func (a *App) ListMCP() []MCPDoc
- func (a *App) ListSkills() []SkillDoc
- func (a *App) ListTools() []ToolDoc
- func (a *App) NewMCPTemplate() string
- func (a *App) NewSkillTemplate() string
- func (a *App) NewToolTemplate() string
- func (a *App) OpenFile() (*FileResult, error)
- func (a *App) RespondToolApproval(requestID string, approved bool)
- func (a *App) SaveAPIKey(provider, key string) error
- func (a *App) SaveConfig(provider, model, baseURL string) error
- func (a *App) SaveMCP(oldName, content string) error
- func (a *App) SavePersona(agent string, p Persona) error
- func (a *App) SaveSkill(oldName, content string) error
- func (a *App) SaveTool(oldName, content string) error
- func (a *App) SendMessage(sessionID, message string) error
- func (a *App) Startup(ctx context.Context)
- func (a *App) StopGeneration(sessionID string)
- func (a *App) SwitchAgent(sessionID, agentName string) error
- type CostInfo
- type FileResult
- type KMGraphData
- type KMHealth
- type KMLink
- type KMNode
- type KMStats
- type MCPDoc
- type MCPStatus
- type Message
- type Persona
- type Session
- type SessionInfo
- type SkillDoc
- type ThemeInfo
- type ToolCall
- type ToolDoc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentInfo ¶
type AgentInfo struct {
Name string `json:"name"`
Description string `json:"description"`
Model string `json:"model"`
Path string `json:"path"`
Builtin bool `json:"builtin"`
Category string `json:"category"` // "hub", "spoke", "standalone"
}
AgentInfo describes an available agent.
type App ¶
type App struct {
// contains filtered or unexported fields
}
App manages the desktop application state.
func (*App) CloseSession ¶
func (*App) CreateSession ¶
func (a *App) CreateSession(agentName string) (*SessionInfo, error)
func (*App) DeleteSkill ¶ added in v0.2.0
DeleteSkill removes a user-authored skill MD file by name.
func (*App) DeleteTool ¶ added in v0.2.0
DeleteTool removes a user-authored tool MD file by name.
func (*App) GetConfig ¶
func (a *App) GetConfig() *userconfig.Config
func (*App) GetMCPStatus ¶
func (*App) GetPersona ¶ added in v0.2.0
GetPersona returns the stored persona for an agent (zero value if unset).
func (*App) GetSessions ¶
func (a *App) GetSessions() []SessionInfo
func (*App) KMGraph ¶ added in v0.2.0
func (a *App) KMGraph() (*KMGraphData, error)
KMGraph returns the graph nodes and links for visualization.
func (*App) KMIndex ¶ added in v0.2.0
KMIndex kicks off indexing of path in the background. type is "auto" (repo if a .git exists, else docs), "repo", or "docs". Progress is reported to the frontend via events: "kmIndexProgress" {current,total,file}, "kmIndexDone" {message}, and "kmIndexError" {error}.
func (*App) KMPickDirectory ¶ added in v0.2.0
KMPickDirectory opens a native folder picker for choosing what to index.
func (*App) KMStatus ¶ added in v0.2.0
KMStatus returns knowledge base stats (chunks/documents/repos).
func (*App) ListAgents ¶
func (*App) ListSkills ¶ added in v0.2.0
ListSkills returns all user-authored skill MD files in ~/.config/m/skills.
func (*App) ListTools ¶ added in v0.2.0
ListTools returns all user-authored tool MD files in ~/.config/m/tools.
func (*App) NewMCPTemplate ¶ added in v0.2.0
NewMCPTemplate returns starter MD for a new MCP server.
func (*App) NewSkillTemplate ¶ added in v0.2.0
NewSkillTemplate returns starter MD for a new skill.
func (*App) NewToolTemplate ¶ added in v0.2.0
NewToolTemplate returns starter MD for a new shell tool.
func (*App) OpenFile ¶
func (a *App) OpenFile() (*FileResult, error)
OpenFile opens a native file picker and returns the file path and content.
func (*App) RespondToolApproval ¶ added in v0.2.0
RespondToolApproval is called from the frontend to answer a pending tool-approval request. Unknown or already-answered ids are ignored.
func (*App) SaveAPIKey ¶
func (*App) SaveConfig ¶
func (*App) SaveMCP ¶ added in v0.2.0
SaveMCP validates and writes an MCP server MD file. oldName is the file's previous name (empty for new servers); a rename removes the old file.
func (*App) SavePersona ¶ added in v0.2.0
SavePersona persists the persona for an agent. An empty persona deletes the stored file so the agent reverts to its default behaviour.
func (*App) SaveSkill ¶ added in v0.2.0
SaveSkill validates and writes a skill MD file. oldName is the file's previous name (empty for new skills); a rename removes the old file.
func (*App) SaveTool ¶ added in v0.2.0
SaveTool validates and writes a tool MD file. oldName is the file's previous name (empty for new tools); if the tool was renamed, the old file is removed. Returns a descriptive error when the content doesn't parse or validate.
func (*App) SendMessage ¶
func (*App) StopGeneration ¶
func (*App) SwitchAgent ¶
type CostInfo ¶
type CostInfo struct {
InputTokens int `json:"inputTokens"`
OutputTokens int `json:"outputTokens"`
Cost float64 `json:"cost"`
Model string `json:"model"`
}
CostInfo shows token usage and cost.
type FileResult ¶
type FileResult struct {
Path string `json:"path"`
Name string `json:"name"`
Content string `json:"content"`
}
FileResult is returned by OpenFile.
type KMGraphData ¶ added in v0.2.0
KMGraphData is the node/edge payload from GET /api/graph.
type KMHealth ¶ added in v0.2.0
type KMHealth struct {
Available bool `json:"available"`
BaseURL string `json:"baseUrl"`
Error string `json:"error,omitempty"`
}
KMHealth reports whether the knowledge-master HTTP server is reachable.
type KMLink ¶ added in v0.2.0
type KMLink struct {
Source string `json:"source"`
Target string `json:"target"`
Type string `json:"type"`
}
KMLink is one graph edge from GET /api/graph.
type KMNode ¶ added in v0.2.0
type KMNode struct {
ID string `json:"id"`
Type string `json:"type"`
Label string `json:"label"`
Category string `json:"category,omitempty"`
Source string `json:"source,omitempty"`
}
KMNode is one graph vertex from GET /api/graph.
type KMStats ¶ added in v0.2.0
type KMStats struct {
Chunks int `json:"chunks"`
Documents int `json:"documents"`
Repos int `json:"repos"`
}
KMStats mirrors GET /api/v1/status.
type MCPDoc ¶ added in v0.2.0
type MCPDoc struct {
Name string `json:"name"`
Description string `json:"description"`
Transport string `json:"transport"`
Path string `json:"path"`
Content string `json:"content"`
Error string `json:"error,omitempty"`
}
MCPDoc is a user-authored MCP server MD file surfaced to the MCP tab.
type MCPStatus ¶
type MCPStatus struct {
Name string `json:"name"`
Transport string `json:"transport"`
Installed bool `json:"installed"`
}
MCPStatus describes an MCP server's state.
type Message ¶
type Message struct {
ID string `json:"id"`
Role string `json:"role"`
Content string `json:"content"`
Timestamp int64 `json:"timestamp"`
ToolCalls []ToolCall `json:"toolCalls,omitempty"`
}
Message represents a chat message for the frontend.
type Persona ¶ added in v0.2.0
type Persona struct {
Instructions string `json:"instructions"` // free-form custom guidance
Tone string `json:"tone"` // "", concise, friendly, formal, playful, direct
Verbosity string `json:"verbosity"` // "", terse, balanced, detailed
Temperature *float64 `json:"temperature,omitempty"` // nil = use the agent's default
}
Persona is a per-agent behaviour overlay. It is stored in user config keyed by agent name and composed into the system prompt at session start, so users can tweak how any agent behaves — including bundled ones like "m" — without editing the agent's MD file.
type Session ¶
type Session struct {
ID string `json:"id"`
Agent string `json:"agent"`
Model string `json:"model"`
CreatedAt int64 `json:"createdAt"`
Messages []Message `json:"messages"`
// contains filtered or unexported fields
}
Session wraps an engine.Session with desktop-specific state.
type SessionInfo ¶
type SessionInfo struct {
ID string `json:"id"`
Agent string `json:"agent"`
Model string `json:"model"`
Messages int `json:"messages"`
CreatedAt int64 `json:"createdAt"`
Preview string `json:"preview"` // first user message
}
SessionInfo is a summary for the session list.
type SkillDoc ¶ added in v0.2.0
type SkillDoc struct {
Name string `json:"name"`
Description string `json:"description"`
Tools []string `json:"tools"`
Path string `json:"path"`
Content string `json:"content"`
Error string `json:"error,omitempty"`
}
SkillDoc is a user-authored skill MD file surfaced to the Skills tab.
type ThemeInfo ¶
type ThemeInfo struct {
Name string `json:"name"`
BG string `json:"bg"`
BGPanel string `json:"bgPanel"`
BGInput string `json:"bgInput"`
Border string `json:"border"`
User string `json:"user"`
Assistant string `json:"assistant"`
Tool string `json:"tool"`
Error string `json:"error"`
Accent string `json:"accent"`
Text string `json:"text"`
Muted string `json:"muted"`
}
ThemeInfo describes a desktop theme.
type ToolCall ¶
type ToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
Input string `json:"input"`
Output string `json:"output,omitempty"`
Error string `json:"error,omitempty"`
Duration int64 `json:"duration"` // milliseconds
Status string `json:"status"` // "running", "done", "error", "declined"
}
ToolCall represents a tool execution.
type ToolDoc ¶ added in v0.2.0
type ToolDoc struct {
Name string `json:"name"`
Description string `json:"description"`
Runtime string `json:"runtime"`
Path string `json:"path"`
Content string `json:"content"`
Error string `json:"error,omitempty"` // parse error, if any
}
ToolDoc is a user-authored tool MD file surfaced to the Tools tab.