api

package
v0.266.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmbeddedWebUI added in v0.230.0

func EmbeddedWebUI() (fs.FS, error)

Types

type AgentConfigItem added in v0.70.0

type AgentConfigItem struct {
	Name                 string              `json:"name"`
	Model                models.ModelID      `json:"model"`
	MaxTokens            int64               `json:"maxTokens"`
	ReasoningEffort      string              `json:"reasoningEffort"`
	ThinkingMode         config.ThinkingMode `json:"thinkingMode,omitempty"`
	AutoCompact          bool                `json:"autoCompact"`
	AutoCompactThreshold float64             `json:"autoCompactThreshold"`
}

AgentConfigItem is the JSON representation of a single agent configuration.

type ChatRequest

type ChatRequest struct {
	SessionID string `json:"sessionId"`
	Prompt    string `json:"prompt"`
	Model     string `json:"model,omitempty"`
}

type ChatResponse

type ChatResponse struct {
	SessionID string `json:"sessionId"`
	MessageID string `json:"messageId"`
	Response  string `json:"response"`
}

type CreateCronJobRequest added in v0.244.0

type CreateCronJobRequest struct {
	Name     string   `json:"name"`
	Schedule string   `json:"schedule"`
	Prompt   string   `json:"prompt"`
	Enabled  bool     `json:"enabled"`
	Engine   string   `json:"engine,omitempty"`
	Model    string   `json:"model,omitempty"`
	WorkDir  string   `json:"workDir,omitempty"`
	Tags     []string `json:"tags,omitempty"`
	Timeout  string   `json:"timeout,omitempty"`
}

CreateCronJobRequest is the body for POST /api/v1/cronjobs.

type CreateTaskRequest added in v0.60.0

type CreateTaskRequest struct {
	Prompt       string   `json:"prompt"`
	WorkDir      string   `json:"work_dir,omitempty"`
	Model        string   `json:"model,omitempty"`
	Engine       string   `json:"engine,omitempty"`
	Tags         []string `json:"tags,omitempty"`
	Dependencies []string `json:"dependencies,omitempty"`
	Background   bool     `json:"background"`
}

CreateTaskRequest is the body for POST /api/v1/orchestrator/tasks.

type CronJobResponse added in v0.244.0

type CronJobResponse struct {
	Name     string    `json:"name"`
	Schedule string    `json:"schedule"`
	Enabled  bool      `json:"enabled"`
	Prompt   string    `json:"prompt,omitempty"`
	Engine   string    `json:"engine,omitempty"`
	Model    string    `json:"model,omitempty"`
	WorkDir  string    `json:"workDir,omitempty"`
	Tags     []string  `json:"tags,omitempty"`
	Timeout  string    `json:"timeout,omitempty"`
	NextRun  time.Time `json:"nextRun,omitempty"`
}

CronJobResponse is the JSON representation of a cronjob returned by the API.

type EvaluatorMetrics added in v0.60.0

type EvaluatorMetrics struct {
	TotalSessions  int64   `json:"total_sessions"`
	TotalTemplates int64   `json:"total_templates"`
	AvgReward      float64 `json:"avg_reward"`
	ActiveSkills   int64   `json:"active_skills"`
	IsEnabled      bool    `json:"is_enabled"`
}

EvaluatorMetrics is the JSON representation of aggregated evaluator statistics.

type EvaluatorSessionResponse added in v0.60.0

type EvaluatorSessionResponse struct {
	ID              string  `json:"id"`
	SessionID       string  `json:"session_id"`
	TemplateID      string  `json:"template_id,omitempty"`
	Reward          float64 `json:"reward"`
	SuccessScore    float64 `json:"success_score"`
	EfficiencyScore float64 `json:"efficiency_score"`
	MessageCount    int64   `json:"message_count"`
	EvaluatedAt     int64   `json:"evaluated_at"`
}

EvaluatorSessionResponse is the JSON representation of a evaluated session score.

type ExecRequest added in v0.60.0

type ExecRequest struct {
	Command   string `json:"command"`
	Dir       string `json:"dir,omitempty"`
	SessionID string `json:"session_id,omitempty"`
}

type ExecResponse added in v0.60.0

type ExecResponse struct {
	Output    string `json:"output"`
	Error     string `json:"error,omitempty"`
	ExitCode  int    `json:"exit_code"`
	SessionID string `json:"session_id,omitempty"`
	Shell     string `json:"shell,omitempty"`
	Dir       string `json:"dir,omitempty"`
}

type ExtensionsConfigResponse added in v0.70.0

type ExtensionsConfigResponse struct {
	Skills        config.SkillsConfig        `json:"skills"`
	SkillsCatalog config.SkillsCatalogConfig `json:"skillsCatalog"`
	Lua           config.LuaConfig           `json:"lua"`
}

ExtensionsConfigResponse groups Skills, SkillsCatalog, and Lua engine configuration.

type InstalledSkillResponse added in v0.200.0

type InstalledSkillResponse struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Version     string `json:"version"`
	Source      string `json:"source"`  // "owner/repo" from lock, or "(local)"
	Scope       string `json:"scope"`   // "global", "project", or "(local)"
	Active      bool   `json:"active"`  // loaded in SkillManager
	SkillID     string `json:"skillId"` // from lock, may be empty
}

InstalledSkillResponse represents a skill installed on disk.

type LSPConfigItem added in v0.70.0

type LSPConfigItem struct {
	Language  string   `json:"language"`
	Disabled  bool     `json:"disabled"`
	Command   string   `json:"command"`
	Args      []string `json:"args"`
	Languages []string `json:"languages"`
}

LSPConfigItem is the JSON representation of a single LSP configuration entry.

type LogEntry added in v0.60.0

type LogEntry struct {
	ID        string `json:"id"`
	Timestamp string `json:"timestamp"`
	Level     string `json:"level"`
	Source    string `json:"source"`
	Message   string `json:"message"`
	Details   string `json:"details,omitempty"`
}

LogEntry is the JSON representation of a log message returned by the API.

type MCPServerConfigItem added in v0.70.0

type MCPServerConfigItem struct {
	Name    string            `json:"name"`
	Command string            `json:"command"`
	Args    []string          `json:"args"`
	Env     []string          `json:"env"`
	Type    config.MCPType    `json:"type"`
	URL     string            `json:"url"`
	Headers map[string]string `json:"headers"`
	Tools   []MCPToolInfo     `json:"tools"`
}

MCPServerConfigItem is the JSON representation of a single MCP server entry.

type MCPToolInfo added in v0.100.0

type MCPToolInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

MCPToolInfo is a lightweight tool descriptor returned alongside server config.

type ModelInfo added in v0.60.0

type ModelInfo struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Provider    string   `json:"provider"`
	AccountID   string   `json:"accountId,omitempty"`
	Description string   `json:"description"`
	Badges      []string `json:"badges"`
}

ModelInfo describes a model available for selection.

type ProviderConfigItem added in v0.70.0

type ProviderConfigItem struct {
	Name     string `json:"name"`
	APIKey   string `json:"apiKey"` // masked in GET responses
	BaseURL  string `json:"baseUrl"`
	Disabled bool   `json:"disabled"`
	UseOAuth bool   `json:"useOAuth"`
}

ProviderConfigItem is the JSON representation of a provider configuration.

type ProviderConfigUpdateRequest added in v0.70.0

type ProviderConfigUpdateRequest struct {
	Providers []ProviderConfigItem `json:"providers"`
}

ProviderConfigUpdateRequest is the body for PUT /api/v1/config/providers. APIKey is only applied if non-empty.

type ProviderStatus added in v0.60.0

type ProviderStatus struct {
	Name      string `json:"name"`
	Enabled   bool   `json:"enabled"`
	HasAPIKey bool   `json:"has_api_key"`
	BaseURL   string `json:"base_url,omitempty"`
	UseOAuth  bool   `json:"use_oauth,omitempty"`
}

ProviderStatus describes a configured provider and whether it has an API key set.

type ProviderTypeInfo added in v0.254.0

type ProviderTypeInfo struct {
	Type                 string `json:"type"`
	DisplayName          string `json:"displayName"`
	RequiresAPIKey       bool   `json:"requiresAPIKey"`
	RequiresBaseURL      bool   `json:"requiresBaseUrl"`
	SupportsOAuth        bool   `json:"supportsOAuth"`
	SupportsExtraHeaders bool   `json:"supportsExtraHeaders"`
}

ProviderTypeInfo describes a supported provider type and its requirements.

type Server

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

func NewServer

func NewServer(ctx context.Context, cfg ServerConfig) (*Server, error)

func (*Server) GetToken

func (s *Server) GetToken() string

func (*Server) InjectRuntimeConfig added in v0.230.0

func (s *Server) InjectRuntimeConfig(html []byte) []byte

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) Start

func (s *Server) Start() error

type ServerConfig

type ServerConfig struct {
	Host      string
	Port      int
	Version   string
	DB        *sql.DB
	CWD       string
	StaticFS  fs.FS
	OpenUI    bool
	UIBaseURL string
}

type ServicesConfigResponse added in v0.70.0

type ServicesConfigResponse struct {
	Mesnada      config.MesnadaConfig      `json:"mesnada"`
	Remembrances config.RemembrancesConfig `json:"remembrances"`
	Snapshots    config.SnapshotsConfig    `json:"snapshots"`
	Server       config.APIServerConfig    `json:"server"`
}

ServicesConfigResponse groups Mesnada, Remembrances, Snapshots, and API Server configuration.

type SettingsResponse added in v0.60.0

type SettingsResponse struct {
	HomeDirectory    string `json:"home_directory"`
	WorkingDirectory string `json:"working_directory"`
	DefaultModel     string `json:"default_model"`
	DefaultProvider  string `json:"default_provider"`
	Theme            string `json:"theme"`
	Debug            bool   `json:"debug"`
	LogFile          string `json:"log_file,omitempty"`
	AutoCompact      bool   `json:"auto_compact"`
	SkillsEnabled    bool   `json:"skills_enabled"`
	DataDirectory    string `json:"data_directory"`
	LLMCacheEnabled  bool   `json:"llm_cache_enabled"`
}

SettingsResponse is the JSON representation of current application settings.

type SettingsUpdateRequest added in v0.60.0

type SettingsUpdateRequest struct {
	DefaultModel    *string `json:"default_model,omitempty"`
	DefaultProvider *string `json:"default_provider,omitempty"`
	Theme           *string `json:"theme,omitempty"`
	Debug           *bool   `json:"debug,omitempty"`
	AutoCompact     *bool   `json:"auto_compact,omitempty"`
	SkillsEnabled   *bool   `json:"skills_enabled,omitempty"`
	LLMCacheEnabled *bool   `json:"llm_cache_enabled,omitempty"`
}

SettingsUpdateRequest contains the fields that can be updated via PUT /api/v1/settings.

type SkillResponse added in v0.60.0

type SkillResponse struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Description string  `json:"description"`
	TaskType    string  `json:"task_type"`
	Confidence  float64 `json:"confidence"`
	Uses        int64   `json:"uses"`
}

SkillResponse is the JSON representation of a skill library entry.

type SnapshotResponse added in v0.60.0

type SnapshotResponse struct {
	ID         string    `json:"id"`
	Name       string    `json:"name"`
	SessionID  string    `json:"session_id"`
	Type       string    `json:"type"`
	Status     string    `json:"status"`
	WorkingDir string    `json:"working_dir"`
	CreatedAt  time.Time `json:"created_at"`
	Size       int64     `json:"size"`
	FilesCount int       `json:"files_count"`
}

SnapshotResponse is the JSON representation of a snapshot for the web-UI.

type TaskResponse added in v0.60.0

type TaskResponse struct {
	ID          string                    `json:"id"`
	Name        string                    `json:"name"`
	Agent       string                    `json:"agent"`
	Model       string                    `json:"model"`
	Status      string                    `json:"status"`
	Progress    int                       `json:"progress"`
	Tokens      int                       `json:"tokens"`
	Output      string                    `json:"output,omitempty"`
	CurrentTool string                    `json:"current_tool,omitempty"`
	ToolCalls   []*mesnadaModels.ToolCall `json:"tool_calls,omitempty"`
	CreatedAt   time.Time                 `json:"created_at"`
	UpdatedAt   time.Time                 `json:"updated_at"`
}

TaskResponse is the JSON representation of an orchestrator task returned by the API.

type TemplateResponse added in v0.60.0

type TemplateResponse struct {
	ID        string  `json:"id"`
	Name      string  `json:"name"`
	Section   string  `json:"section"`
	UCBScore  float64 `json:"ucb_score"`
	WinRate   float64 `json:"win_rate"`
	Uses      int64   `json:"uses"`
	IsDefault bool    `json:"is_default"`
}

TemplateResponse is the JSON representation of a prompt template with UCB stats.

type ToolsConfigResponse added in v0.70.0

type ToolsConfigResponse struct {
	FetchEnabled   bool `json:"fetchEnabled"`
	FetchMaxSizeMB int  `json:"fetchMaxSizeMB"`

	GoogleSearchEnabled  bool   `json:"googleSearchEnabled"`
	GoogleAPIKey         string `json:"googleApiKey"` // masked
	GoogleSearchEngineID string `json:"googleSearchEngineId"`

	BraveSearchEnabled bool   `json:"braveSearchEnabled"`
	BraveAPIKey        string `json:"braveApiKey"` // masked

	PerplexitySearchEnabled bool   `json:"perplexitySearchEnabled"`
	PerplexityAPIKey        string `json:"perplexityApiKey"` // masked

	ExaSearchEnabled bool   `json:"exaSearchEnabled"`
	ExaAPIKey        string `json:"exaApiKey"` // masked

	Context7Enabled bool `json:"context7Enabled"`

	BrowserEnabled     bool   `json:"browserEnabled"`
	BrowserHeadless    bool   `json:"browserHeadless"`
	BrowserTimeout     int    `json:"browserTimeout"`
	BrowserUserDataDir string `json:"browserUserDataDir"`
	BrowserMaxSessions int    `json:"browserMaxSessions"`
}

ToolsConfigResponse is the GET response for /api/v1/config/tools. API keys are masked.

type UpdateCronJobRequest added in v0.244.0

type UpdateCronJobRequest struct {
	Enabled  *bool    `json:"enabled,omitempty"`
	Prompt   *string  `json:"prompt,omitempty"`
	Schedule *string  `json:"schedule,omitempty"`
	Engine   *string  `json:"engine,omitempty"`
	Model    *string  `json:"model,omitempty"`
	WorkDir  *string  `json:"workDir,omitempty"`
	Tags     []string `json:"tags,omitempty"`
	Timeout  *string  `json:"timeout,omitempty"`
}

UpdateCronJobRequest is the body for PUT /api/v1/cronjobs/{name}.

Jump to

Keyboard shortcuts

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