api

package
v0.407.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 54 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"`
	ResolvedMaxTokens    int64               `json:"resolvedMaxTokens,omitempty"` // effective value after auto-budget resolution
	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 BackgroundSessionManager added in v0.302.0

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

BackgroundSessionManager runs agent sessions in background goroutines that are independent of HTTP connections. Clients can connect and disconnect at any time; the session keeps running and new subscribers receive a replay of the buffered events followed by live updates.

func NewBackgroundSessionManager added in v0.302.0

func NewBackgroundSessionManager() *BackgroundSessionManager

NewBackgroundSessionManager creates a manager and starts the background cleanup goroutine that purges stale completed sessions.

func (*BackgroundSessionManager) Cancel added in v0.302.0

func (m *BackgroundSessionManager) Cancel(sessionID string)

Cancel cancels the background run for sessionID. No-op if unknown.

func (*BackgroundSessionManager) IsBusy added in v0.302.0

func (m *BackgroundSessionManager) IsBusy(sessionID string) bool

IsBusy reports whether the session is actively processing (not yet done).

func (*BackgroundSessionManager) IsRunning added in v0.302.0

func (m *BackgroundSessionManager) IsRunning(sessionID string) bool

IsRunning reports whether the session has an active (or recently completed) background run whose replay buffer is still available.

func (*BackgroundSessionManager) Submit added in v0.302.0

func (m *BackgroundSessionManager) Submit(
	sessionID string,
	agentRunFn func(ctx context.Context) (<-chan agent.AgentEvent, error),
) error

Submit starts an agent run for sessionID in the background. agentRunFn is called with a background-derived context and must return the event channel produced by agent.Service.Run(). Returns agent.ErrSessionBusy if the session is already actively running.

func (*BackgroundSessionManager) Subscribe added in v0.302.0

func (m *BackgroundSessionManager) Subscribe(sessionID string) (events <-chan agent.AgentEvent, unsubscribe func(), ok bool)

Subscribe returns:

  • events: a channel that first delivers buffered events then live events.
  • unsubscribe: call this when done to remove the subscriber (safe to call multiple times; if the session is already done it is a no-op).
  • ok: false when no session with that ID exists in the manager.

If the session is already done the channel is closed after the replay.

type BrowserInstallInfo added in v0.291.0

type BrowserInstallInfo struct {
	Type        string `json:"type"`
	Label       string `json:"label"`
	Executable  string `json:"executable"`
	UserDataDir string `json:"userDataDir,omitempty"`
}

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"`
	CanReason               bool     `json:"canReason"`
	SupportsReasoningEffort bool     `json:"supportsReasoningEffort"`
}

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) IsTLS added in v0.302.0

func (s *Server) IsTLS() bool

IsTLS reports whether the server is configured to use TLS.

func (*Server) PandoApp added in v0.303.0

func (s *Server) PandoApp() *app.App

PandoApp returns the underlying app.App instance. This is used by serve/app/desktop commands to set up the IPC bus after the server is created.

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
	// Querier overrides the db.Querier passed to app.New. When non-nil it is
	// used instead of db.New(cfg.DB). Secondary instances supply a DBProxy here
	// so all writes are forwarded to the primary via ZMQ RPC.
	Querier     db.Querier
	CWD         string
	StaticFS    fs.FS
	OpenUI      bool
	UIBaseURL   string
	TLSCertFile string
	TLSKeyFile  string
	StartupMode string

	// IPC identity fields populated by Bootstrap so the /api/ipc/status
	// endpoint can report them without re-reading the lock file.
	InstanceID string
	Role       string
	PubPort    int
	RPCPort    int
}

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"`
	EvaluatorEnabled bool   `json:"evaluator_enabled"`
	JudgeModel       string `json:"judge_model"`
}

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"`
	EvaluatorEnabled *bool   `json:"evaluator_enabled,omitempty"`
	JudgeModel       *string `json:"judge_model,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

	SourcegraphEnabled bool   `json:"sourcegraphEnabled"`
	SourcegraphToken   string `json:"sourcegraphToken"` // masked

	Context7Enabled bool `json:"context7Enabled"`

	BrowserType        string `json:"browserType"`
	BrowserExecutable  string `json:"browserExecutable"`
	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