serve

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package serve provides an HTTP server with a web dashboard and REST API for monitoring and controlling Vega agent orchestration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithMemory

func ContextWithMemory(ctx context.Context, store Store, userID, agent string) context.Context

ContextWithMemory returns a context carrying the store, userID, and agent needed by the memory tools (remember, recall, forget).

func RegisterMemoryTools

func RegisterMemoryTools(interp *dsl.Interpreter)

RegisterMemoryTools registers remember, recall, and forget tools on the interpreter's global tool collection.

Types

type AgentResponse

type AgentResponse struct {
	Name          string   `json:"name"`
	DisplayName   string   `json:"display_name,omitempty"`
	Title         string   `json:"title,omitempty"`
	Avatar        string   `json:"avatar,omitempty"`
	Model         string   `json:"model,omitempty"`
	System        string   `json:"system,omitempty"`
	Tools         []string `json:"tools,omitempty"`
	Team          []string `json:"team,omitempty"`
	ProcessID     string   `json:"process_id,omitempty"`
	ProcessStatus string   `json:"process_status,omitempty"`
	Source        string   `json:"source,omitempty"`
}

AgentResponse is the API representation of an agent definition.

type AgentTemplateResponse added in v0.3.0

type AgentTemplateResponse struct {
	Version     string   `json:"version"`
	Name        string   `json:"name"`
	DisplayName string   `json:"display_name,omitempty"`
	Title       string   `json:"title,omitempty"`
	Model       string   `json:"model"`
	System      string   `json:"system"`
	Tools       []string `json:"tools,omitempty"`
	Team        []string `json:"team,omitempty"`
	ExportedBy  string   `json:"exported_by,omitempty"`
	ExportedAt  string   `json:"exported_at,omitempty"`
}

AgentTemplateResponse is the API representation of a portable agent template.

type BrokerEvent

type BrokerEvent struct {
	Type      string    `json:"type"`
	ProcessID string    `json:"process_id,omitempty"`
	Agent     string    `json:"agent,omitempty"`
	Data      any       `json:"data,omitempty"`
	Timestamp time.Time `json:"timestamp"`
}

BrokerEvent is an event sent via SSE.

type Channel added in v0.3.0

type Channel struct {
	ID           string    `json:"id"`
	Name         string    `json:"name"`
	Description  string    `json:"description"`
	Team         []string  `json:"team"`
	Mode         string    `json:"mode,omitempty"` // "" = default (team-lead responds), "social" = all members respond
	CreatedBy    string    `json:"created_by"`
	CreatedAt    time.Time `json:"created_at"`
	MessageCount int       `json:"message_count"`
}

Channel is a Slack-style group conversation space for a team of agents.

type ChannelEvent added in v0.3.0

type ChannelEvent struct {
	Type      string `json:"type"`
	Channel   string `json:"channel"`
	MessageID int64  `json:"message_id,omitempty"`
	ThreadID  *int64 `json:"thread_id,omitempty"`
	Agent     string `json:"agent,omitempty"`
	Role      string `json:"role,omitempty"`
	Content   string `json:"content,omitempty"`
	Delta     string `json:"delta,omitempty"`
	Metrics   any    `json:"metrics,omitempty"`
}

ChannelEvent is an SSE event for channel activity.

type ChannelMessage added in v0.3.0

type ChannelMessage struct {
	ID         int64     `json:"id"`
	ChannelID  string    `json:"channel_id"`
	ThreadID   *int64    `json:"thread_id,omitempty"`
	Agent      string    `json:"agent,omitempty"`
	Role       string    `json:"role"`
	Content    string    `json:"content"`
	Metadata   string    `json:"metadata,omitempty"`
	CreatedAt  time.Time `json:"created_at"`
	ReplyCount int       `json:"reply_count,omitempty"`
}

ChannelMessage is a message in a channel, optionally part of a thread.

type ChannelPostRequest added in v0.3.0

type ChannelPostRequest struct {
	Message  string `json:"message"`
	ThreadID *int64 `json:"thread_id,omitempty"`
	Agent    string `json:"agent,omitempty"`
}

ChannelPostRequest is the request to post a message to a channel.

type ChatMessage

type ChatMessage struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

ChatMessage is a persisted chat message.

type ChatStatusResponse added in v0.3.0

type ChatStatusResponse struct {
	Streaming bool `json:"streaming"`
}

ChatStatusResponse indicates whether an agent has an active stream.

type CompanyResponse added in v0.3.0

type CompanyResponse struct {
	ID          string                   `json:"id"`
	Name        string                   `json:"name"`
	LogoURL     string                   `json:"logo_url,omitempty"`
	AccentColor string                   `json:"accent_color,omitempty"`
	Siblings    []CompanySiblingResponse `json:"siblings,omitempty"`
}

CompanyResponse is the API representation of company identity.

type CompanySiblingResponse added in v0.3.0

type CompanySiblingResponse struct {
	Name string `json:"name"`
	URL  string `json:"url"`
	Icon string `json:"icon,omitempty"`
}

CompanySiblingResponse is the API representation of a sibling instance.

type ComposedAgent

type ComposedAgent struct {
	Name        string    `json:"name"`
	DisplayName string    `json:"display_name,omitempty"`
	Title       string    `json:"title,omitempty"`
	Avatar      string    `json:"avatar,omitempty"`
	Model       string    `json:"model"`
	Persona     string    `json:"persona,omitempty"`
	Skills      []string  `json:"skills,omitempty"`
	Tools       []string  `json:"tools,omitempty"`
	Team        []string  `json:"team,omitempty"`
	System      string    `json:"system,omitempty"`
	Temperature *float64  `json:"temperature,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
}

ComposedAgent is a persisted agent created via the compose API.

type Config

type Config struct {
	Addr          string
	DBPath        string
	TelegramToken string       // TELEGRAM_BOT_TOKEN; leave empty to disable
	TelegramAgent string       // TELEGRAM_AGENT; defaults to first agent if empty
	Company       *dsl.Company // optional company identity (env var overrides)
}

Config holds server configuration.

type ConnectMCPRequest added in v0.2.1

type ConnectMCPRequest struct {
	Name      string            `json:"name"`
	Env       map[string]string `json:"env,omitempty"`
	Transport string            `json:"transport,omitempty"`
	Command   string            `json:"command,omitempty"`
	Args      []string          `json:"args,omitempty"`
	URL       string            `json:"url,omitempty"`
	Headers   map[string]string `json:"headers,omitempty"`
	Timeout   int               `json:"timeout,omitempty"`
}

ConnectMCPRequest is the request to connect an MCP server.

type ConnectMCPResponse added in v0.2.1

type ConnectMCPResponse struct {
	Name      string   `json:"name"`
	Connected bool     `json:"connected"`
	Tools     []string `json:"tools,omitempty"`
	Error     string   `json:"error,omitempty"`
}

ConnectMCPResponse is returned when an MCP server is connected.

type CreateAgentRequest

type CreateAgentRequest struct {
	Name        string   `json:"name"`
	Model       string   `json:"model"`
	Persona     string   `json:"persona,omitempty"`
	Skills      []string `json:"skills,omitempty"`
	Team        []string `json:"team,omitempty"`
	System      string   `json:"system,omitempty"`
	Temperature *float64 `json:"temperature,omitempty"`
}

CreateAgentRequest is the request to compose a new agent.

type CreateAgentResponse

type CreateAgentResponse struct {
	Name      string   `json:"name"`
	Model     string   `json:"model"`
	Tools     []string `json:"tools,omitempty"`
	ProcessID string   `json:"process_id,omitempty"`
}

CreateAgentResponse is returned when a new agent is composed.

type CreateChannelRequest added in v0.3.0

type CreateChannelRequest struct {
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Team        []string `json:"team"`
}

CreateChannelRequest is the request to create a channel.

type ErrorResponse

type ErrorResponse struct {
	Error   string `json:"error"`
	Details string `json:"details,omitempty"`
}

ErrorResponse is returned on API errors.

type EventBroker

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

EventBroker fans out events to SSE subscribers.

func NewEventBroker

func NewEventBroker() *EventBroker

NewEventBroker creates a new broker.

func (*EventBroker) Close

func (b *EventBroker) Close()

Close closes all subscriber channels, causing SSE handlers to exit.

func (*EventBroker) Publish

func (b *EventBroker) Publish(event BrokerEvent)

Publish sends an event to all subscribers. Non-blocking: if a subscriber's buffer is full, the event is dropped for that subscriber.

func (*EventBroker) Subscribe

func (b *EventBroker) Subscribe() chan BrokerEvent

Subscribe returns a channel that receives events. The caller must call Unsubscribe when done.

func (*EventBroker) Unsubscribe

func (b *EventBroker) Unsubscribe(ch chan BrokerEvent)

Unsubscribe removes a subscriber channel.

type FileContentResponse added in v0.2.0

type FileContentResponse struct {
	Path        string `json:"path"`
	ContentType string `json:"content_type"`
	Content     string `json:"content"`
	Encoding    string `json:"encoding"`
	Size        int64  `json:"size"`
}

FileContentResponse is the response for reading a file's content.

type FileEntry added in v0.2.0

type FileEntry struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	IsDir       bool   `json:"is_dir"`
	Size        int64  `json:"size"`
	ModTime     string `json:"mod_time"`
	ContentType string `json:"content_type,omitempty"`
}

FileEntry represents a file or directory in the workspace.

type FileMetadataResponse added in v0.2.0

type FileMetadataResponse struct {
	Files  []WorkspaceFile `json:"files"`
	Agents []string        `json:"agents"`
}

FileMetadataResponse is the response for file metadata queries.

type InboxItem added in v0.3.0

type InboxItem struct {
	ID         int64      `json:"id"`
	FromAgent  string     `json:"from_agent"`
	Subject    string     `json:"subject"`
	Body       string     `json:"body,omitempty"`
	Priority   string     `json:"priority"`
	Status     string     `json:"status"`
	Resolution string     `json:"resolution,omitempty"`
	CreatedAt  time.Time  `json:"created_at"`
	ResolvedAt *time.Time `json:"resolved_at,omitempty"`
}

InboxItem is a message posted to Hermes's inbox by an agent.

type InputResponse

type InputResponse struct {
	Type        string   `json:"type,omitempty"`
	Description string   `json:"description,omitempty"`
	Required    bool     `json:"required"`
	Default     any      `json:"default,omitempty"`
	Enum        []string `json:"enum,omitempty"`
}

InputResponse describes a workflow input.

type MCPRegistryEntryResponse added in v0.2.1

type MCPRegistryEntryResponse struct {
	Name             string            `json:"name"`
	Description      string            `json:"description"`
	RequiredEnv      []string          `json:"required_env,omitempty"`
	OptionalEnv      []string          `json:"optional_env,omitempty"`
	BuiltinGo        bool              `json:"builtin_go,omitempty"`
	Connected        bool              `json:"connected"`
	ExistingSettings map[string]string `json:"existing_settings,omitempty"`
}

MCPRegistryEntryResponse describes a registry entry for the connections page.

type MCPServerConfig added in v0.3.0

type MCPServerConfig struct {
	Name       string `json:"name"`
	ConfigJSON string `json:"config"`   // JSON-serialized ConnectMCPRequest
	Disabled   bool   `json:"disabled"` // true = persisted but not connected
}

MCPServerConfig is a persisted MCP server connection for auto-reconnect.

type MCPServerConfigResponse added in v0.3.0

type MCPServerConfigResponse struct {
	Name             string            `json:"name"`
	Transport        string            `json:"transport,omitempty"`
	Command          string            `json:"command,omitempty"`
	Args             []string          `json:"args,omitempty"`
	URL              string            `json:"url,omitempty"`
	Headers          map[string]string `json:"headers,omitempty"`
	Timeout          int               `json:"timeout,omitempty"`
	EnvKeys          []string          `json:"env_keys,omitempty"`
	ExistingSettings map[string]string `json:"existing_settings,omitempty"`
	IsRegistry       bool              `json:"is_registry"`
}

MCPServerConfigResponse returns the persisted config for an MCP server, suitable for pre-filling an edit form.

type MCPServerResponse

type MCPServerResponse struct {
	Name      string   `json:"name"`
	Connected bool     `json:"connected"`
	Disabled  bool     `json:"disabled,omitempty"`
	Transport string   `json:"transport,omitempty"`
	URL       string   `json:"url,omitempty"`
	Command   string   `json:"command,omitempty"`
	Tools     []string `json:"tools"`
}

MCPServerResponse is the API representation of an MCP server.

type MemoryItem

type MemoryItem struct {
	ID        int64     `json:"id"`
	UserID    string    `json:"user_id"`
	Agent     string    `json:"agent"`
	Topic     string    `json:"topic"`
	Content   string    `json:"content"`
	Tags      string    `json:"tags"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

MemoryItem is a persisted memory entry for project-aware recall.

type MemoryResponse

type MemoryResponse struct {
	UserID string       `json:"user_id"`
	Agent  string       `json:"agent"`
	Layers []UserMemory `json:"layers"`
}

MemoryResponse is the API representation of user memory.

type MessageResponse

type MessageResponse struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

MessageResponse is a conversation message.

type MetricsResponse

type MetricsResponse struct {
	Iterations   int       `json:"iterations"`
	InputTokens  int       `json:"input_tokens"`
	OutputTokens int       `json:"output_tokens"`
	CostUSD      float64   `json:"cost_usd"`
	ToolCalls    int       `json:"tool_calls"`
	Errors       int       `json:"errors"`
	LastActiveAt time.Time `json:"last_active_at,omitempty"`
}

MetricsResponse is the API representation of process metrics.

type PopulationInfoResponse

type PopulationInfoResponse struct {
	Kind              string   `json:"kind"`
	Name              string   `json:"name"`
	Version           string   `json:"version,omitempty"`
	Description       string   `json:"description,omitempty"`
	Author            string   `json:"author,omitempty"`
	Tags              []string `json:"tags,omitempty"`
	Persona           string   `json:"persona,omitempty"`
	Skills            []string `json:"skills,omitempty"`
	RecommendedSkills []string `json:"recommended_skills,omitempty"`
	SystemPrompt      string   `json:"system_prompt,omitempty"`
	Installed         bool     `json:"installed"`
	InstalledPath     string   `json:"installed_path,omitempty"`
}

PopulationInfoResponse is the API representation of population item details.

type PopulationInstallRequest

type PopulationInstallRequest struct {
	Name string `json:"name"`
}

PopulationInstallRequest is the request to install a population item.

type PopulationInstalledItem

type PopulationInstalledItem struct {
	Kind    string `json:"kind"`
	Name    string `json:"name"`
	Version string `json:"version,omitempty"`
	Path    string `json:"path,omitempty"`
}

PopulationInstalledItem is the API representation of an installed population item.

type PopulationSearchResult

type PopulationSearchResult struct {
	Kind        string   `json:"kind"`
	Name        string   `json:"name"`
	Version     string   `json:"version,omitempty"`
	Description string   `json:"description,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Score       float64  `json:"score,omitempty"`
}

PopulationSearchResult is the API representation of a population search result.

type ProcessDetailResponse

type ProcessDetailResponse struct {
	ProcessResponse
	Messages []MessageResponse `json:"messages"`
}

ProcessDetailResponse includes conversation history.

type ProcessResponse

type ProcessResponse struct {
	ID          string          `json:"id"`
	Agent       string          `json:"agent"`
	Task        string          `json:"task,omitempty"`
	Status      string          `json:"status"`
	StartedAt   time.Time       `json:"started_at"`
	CompletedAt *time.Time      `json:"completed_at,omitempty"`
	ParentID    string          `json:"parent_id,omitempty"`
	SpawnDepth  int             `json:"spawn_depth"`
	SpawnReason string          `json:"spawn_reason,omitempty"`
	Metrics     MetricsResponse `json:"metrics"`
}

ProcessResponse is the API representation of a process.

type ProcessSnapshot

type ProcessSnapshot struct {
	ID           int64      `json:"id"`
	ProcessID    string     `json:"process_id"`
	AgentName    string     `json:"agent_name"`
	Status       string     `json:"status"`
	ParentID     string     `json:"parent_id,omitempty"`
	InputTokens  int        `json:"input_tokens"`
	OutputTokens int        `json:"output_tokens"`
	CostUSD      float64    `json:"cost_usd"`
	StartedAt    time.Time  `json:"started_at"`
	CompletedAt  *time.Time `json:"completed_at,omitempty"`
	SnapshotAt   time.Time  `json:"snapshot_at"`
}

ProcessSnapshot is a point-in-time process state.

type PromptHistoryItem added in v0.3.0

type PromptHistoryItem struct {
	ID        int64     `json:"id"`
	Prompt    string    `json:"prompt"`
	CreatedAt time.Time `json:"created_at"`
}

PromptHistoryItem is a persisted original prompt sent to hermes.

type SQLiteStore

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

SQLiteStore implements Store using modernc.org/sqlite (pure Go).

func NewSQLiteStore

func NewSQLiteStore(path string) (*SQLiteStore, error)

NewSQLiteStore opens or creates a SQLite database at the given path.

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

Close closes the database.

func (*SQLiteStore) CountTable added in v0.2.0

func (s *SQLiteStore) CountTable(table string) (int, error)

CountTable returns the number of rows in the given table.

func (*SQLiteStore) CreateChannel added in v0.3.0

func (s *SQLiteStore) CreateChannel(id, name, description, createdBy string, team []string, mode string) error

CreateChannel creates a new channel.

func (*SQLiteStore) DeleteAllFromTable added in v0.2.0

func (s *SQLiteStore) DeleteAllFromTable(table string) error

DeleteAllFromTable removes all rows from the given table.

func (*SQLiteStore) DeleteChannel added in v0.3.0

func (s *SQLiteStore) DeleteChannel(name string) error

DeleteChannel removes a channel by name.

func (*SQLiteStore) DeleteChatMessages

func (s *SQLiteStore) DeleteChatMessages(agent string) error

DeleteChatMessages removes all chat messages for an agent.

func (*SQLiteStore) DeleteComposedAgent

func (s *SQLiteStore) DeleteComposedAgent(name string) error

DeleteComposedAgent removes a composed agent by name.

func (*SQLiteStore) DeleteMCPServer added in v0.3.0

func (s *SQLiteStore) DeleteMCPServer(name string) error

DeleteMCPServer removes a persisted MCP server connection.

func (*SQLiteStore) DeleteMemoryItem

func (s *SQLiteStore) DeleteMemoryItem(id int64) error

DeleteMemoryItem removes a memory item by ID.

func (*SQLiteStore) DeletePromptHistory added in v0.3.0

func (s *SQLiteStore) DeletePromptHistory(id int64) error

DeletePromptHistory removes a prompt history entry by ID.

func (*SQLiteStore) DeleteResolvedInboxItems added in v0.3.0

func (s *SQLiteStore) DeleteResolvedInboxItems() (int64, error)

DeleteResolvedInboxItems removes all resolved inbox items and their replies.

func (*SQLiteStore) DeleteScheduledJob

func (s *SQLiteStore) DeleteScheduledJob(name string) error

DeleteScheduledJob removes a scheduled job by name.

func (*SQLiteStore) DeleteSetting added in v0.2.0

func (s *SQLiteStore) DeleteSetting(key string) error

DeleteSetting removes a setting by key.

func (*SQLiteStore) DeleteUserMemory

func (s *SQLiteStore) DeleteUserMemory(userID, agent string) error

DeleteUserMemory removes all memory for a user+agent.

func (*SQLiteStore) FindChannelForAgents added in v0.3.0

func (s *SQLiteStore) FindChannelForAgents(agent1, agent2 string) (string, string, error)

FindChannelForAgents returns the first channel where both agents are team members.

func (*SQLiteStore) GetChannel added in v0.3.0

func (s *SQLiteStore) GetChannel(name string) (*Channel, error)

GetChannel returns a channel by name.

func (*SQLiteStore) GetChannelByName added in v0.3.0

func (s *SQLiteStore) GetChannelByName(name string) (*dsl.ChannelInfo, error)

GetChannelByName returns minimal channel info for the dsl.ChannelBackend interface.

func (*SQLiteStore) GetInboxItem added in v0.3.0

func (s *SQLiteStore) GetInboxItem(id int64) (*InboxItem, error)

GetInboxItem returns a single inbox item by ID.

func (*SQLiteStore) GetSetting added in v0.2.0

func (s *SQLiteStore) GetSetting(key string) (*Setting, error)

GetSetting returns a setting by key.

func (*SQLiteStore) GetUserMemory

func (s *SQLiteStore) GetUserMemory(userID, agent string) ([]UserMemory, error)

GetUserMemory returns all memory layers for a user+agent.

func (*SQLiteStore) Init

func (s *SQLiteStore) Init() error

Init creates the schema tables.

func (*SQLiteStore) InsertChannelMessage added in v0.3.0

func (s *SQLiteStore) InsertChannelMessage(channelID, agent, role, content string, threadID *int64, metadata string) (int64, error)

InsertChannelMessage inserts a message into a channel and returns its ID.

func (*SQLiteStore) InsertChatMessage

func (s *SQLiteStore) InsertChatMessage(agent, role, content string) error

InsertChatMessage persists a chat message for an agent.

func (*SQLiteStore) InsertComposedAgent

func (s *SQLiteStore) InsertComposedAgent(a ComposedAgent) error

InsertComposedAgent persists a composed agent definition.

func (*SQLiteStore) InsertEvent

func (s *SQLiteStore) InsertEvent(e StoreEvent) error

InsertEvent records an orchestration event.

func (*SQLiteStore) InsertInboxItem added in v0.3.0

func (s *SQLiteStore) InsertInboxItem(fromAgent, subject, body, priority string) (int64, error)

InsertInboxItem creates a new inbox item and returns its ID.

func (*SQLiteStore) InsertMemoryItem

func (s *SQLiteStore) InsertMemoryItem(item MemoryItem) (int64, error)

InsertMemoryItem saves a memory item and returns its ID.

func (*SQLiteStore) InsertProcessSnapshot

func (s *SQLiteStore) InsertProcessSnapshot(snap ProcessSnapshot) error

InsertProcessSnapshot records a process state snapshot.

func (*SQLiteStore) InsertPromptHistory added in v0.3.0

func (s *SQLiteStore) InsertPromptHistory(prompt string) (int64, error)

InsertPromptHistory records an original user prompt to hermes.

func (*SQLiteStore) InsertWorkflowRun

func (s *SQLiteStore) InsertWorkflowRun(r WorkflowRun) error

InsertWorkflowRun records a workflow execution.

func (*SQLiteStore) InsertWorkspaceFile added in v0.2.0

func (s *SQLiteStore) InsertWorkspaceFile(f WorkspaceFile) error

InsertWorkspaceFile records a file write by an agent.

func (*SQLiteStore) ListChannelMessages added in v0.3.0

func (s *SQLiteStore) ListChannelMessages(channelID string, limit int) ([]ChannelMessage, error)

ListChannelMessages returns top-level messages for a channel with reply counts.

func (*SQLiteStore) ListChannels added in v0.3.0

func (s *SQLiteStore) ListChannels() ([]Channel, error)

ListChannels returns all channels.

func (*SQLiteStore) ListChannelsForAgent added in v0.3.0

func (s *SQLiteStore) ListChannelsForAgent(agent string) ([]dsl.ChannelInfo, error)

ListChannelsForAgent returns channels where the agent is a team member.

func (*SQLiteStore) ListChatMessages

func (s *SQLiteStore) ListChatMessages(agent string) ([]ChatMessage, error)

ListChatMessages returns all chat messages for an agent, oldest first.

func (*SQLiteStore) ListComposedAgents

func (s *SQLiteStore) ListComposedAgents() ([]ComposedAgent, error)

ListComposedAgents returns all composed agents.

func (*SQLiteStore) ListEvents

func (s *SQLiteStore) ListEvents(limit int) ([]StoreEvent, error)

ListEvents returns recent events, newest first.

func (*SQLiteStore) ListInboxItems added in v0.3.0

func (s *SQLiteStore) ListInboxItems(status string, limit int) ([]InboxItem, error)

ListInboxItems returns inbox items filtered by status.

func (*SQLiteStore) ListMCPServers added in v0.3.0

func (s *SQLiteStore) ListMCPServers() ([]MCPServerConfig, error)

ListMCPServers returns all persisted MCP server configs.

func (*SQLiteStore) ListMemoryItemsByTopic

func (s *SQLiteStore) ListMemoryItemsByTopic(userID, agent, topic string) ([]MemoryItem, error)

ListMemoryItemsByTopic returns memory items for a given user+agent+topic.

func (*SQLiteStore) ListProcessSnapshots

func (s *SQLiteStore) ListProcessSnapshots() ([]ProcessSnapshot, error)

ListProcessSnapshots returns the latest snapshot per process.

func (*SQLiteStore) ListPromptHistory added in v0.3.0

func (s *SQLiteStore) ListPromptHistory(limit int) ([]PromptHistoryItem, error)

ListPromptHistory returns prompt history entries, newest first.

func (*SQLiteStore) ListScheduledJobs

func (s *SQLiteStore) ListScheduledJobs() ([]ScheduledJob, error)

ListScheduledJobs returns all scheduled jobs.

func (*SQLiteStore) ListSettings added in v0.2.0

func (s *SQLiteStore) ListSettings() ([]Setting, error)

ListSettings returns all settings.

func (*SQLiteStore) ListThreadMessages added in v0.3.0

func (s *SQLiteStore) ListThreadMessages(channelID string, threadID int64) ([]ChannelMessage, error)

ListThreadMessages returns all replies in a thread.

func (*SQLiteStore) ListWorkflowRuns

func (s *SQLiteStore) ListWorkflowRuns(limit int) ([]WorkflowRun, error)

ListWorkflowRuns returns recent workflow runs.

func (*SQLiteStore) ListWorkspaceFileAgents added in v0.2.0

func (s *SQLiteStore) ListWorkspaceFileAgents() ([]string, error)

ListWorkspaceFileAgents returns distinct agent names that have written files.

func (*SQLiteStore) ListWorkspaceFiles added in v0.2.0

func (s *SQLiteStore) ListWorkspaceFiles(agent string) ([]WorkspaceFile, error)

ListWorkspaceFiles returns workspace file records, optionally filtered by agent.

func (*SQLiteStore) RecentChannelMessages added in v0.3.0

func (s *SQLiteStore) RecentChannelMessages(channelID string, limit int) ([]dsl.ChannelMessage, error)

RecentChannelMessages returns the last N messages in a channel (lightweight, for status checks).

func (*SQLiteStore) ResetData added in v0.3.0

func (s *SQLiteStore) ResetData() error

ResetData clears all transient data but preserves settings.

func (*SQLiteStore) ResolveInboxItem added in v0.3.0

func (s *SQLiteStore) ResolveInboxItem(id int64, resolution string) error

ResolveInboxItem marks an inbox item as resolved.

func (*SQLiteStore) SearchMemoryItems

func (s *SQLiteStore) SearchMemoryItems(userID, agent, query string, limit int) ([]MemoryItem, error)

SearchMemoryItems searches memory items by keyword via LIKE across topic, content, and tags.

func (*SQLiteStore) SearchPromptHistory added in v0.3.0

func (s *SQLiteStore) SearchPromptHistory(query string, limit int) ([]PromptHistoryItem, error)

SearchPromptHistory searches prompt history by keyword via LIKE.

func (*SQLiteStore) SetMCPServerDisabled added in v0.3.0

func (s *SQLiteStore) SetMCPServerDisabled(name string, disabled bool) error

SetMCPServerDisabled enables or disables a persisted MCP server.

func (*SQLiteStore) UpdateChannelTeam added in v0.3.0

func (s *SQLiteStore) UpdateChannelTeam(name string, team []string) error

UpdateChannelTeam updates the team members of a channel.

func (*SQLiteStore) UpdateWorkflowRun

func (s *SQLiteStore) UpdateWorkflowRun(runID string, status string, result string) error

UpdateWorkflowRun updates a workflow run status and result.

func (*SQLiteStore) UpsertMCPServer added in v0.3.0

func (s *SQLiteStore) UpsertMCPServer(name, configJSON string) error

UpsertMCPServer persists an MCP server connection config.

func (*SQLiteStore) UpsertScheduledJob

func (s *SQLiteStore) UpsertScheduledJob(job ScheduledJob) error

UpsertScheduledJob creates or replaces a scheduled job.

func (*SQLiteStore) UpsertSetting added in v0.2.0

func (s *SQLiteStore) UpsertSetting(st Setting) error

UpsertSetting creates or updates a setting.

func (*SQLiteStore) UpsertUserMemory

func (s *SQLiteStore) UpsertUserMemory(userID, agent, layer, content string) error

UpsertUserMemory creates or replaces a memory layer for a user+agent.

func (*SQLiteStore) Vacuum added in v0.2.0

func (s *SQLiteStore) Vacuum()

Vacuum reclaims unused space in the database.

type ScheduledJob

type ScheduledJob struct {
	Name      string    `json:"name"`
	Cron      string    `json:"cron"`
	AgentName string    `json:"agent"`
	Message   string    `json:"message"`
	Enabled   bool      `json:"enabled"`
	CreatedAt time.Time `json:"created_at"`
}

ScheduledJob is a persisted recurring agent trigger.

type Scheduler

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

Scheduler runs cron jobs that send messages to agents. It implements dsl.SchedulerBackend.

func NewScheduler

func NewScheduler(
	interp *dsl.Interpreter,
	persist func(job dsl.ScheduledJob) error,
	remove func(name string) error,
) *Scheduler

NewScheduler creates a Scheduler. The persist and remove callbacks are called after successfully adding/removing a job so it can be saved to permanent storage. Either may be nil if persistence is not needed.

func (*Scheduler) AddJob

func (s *Scheduler) AddJob(job dsl.ScheduledJob) error

AddJob adds a job to the cron runner and persists it. If a job with the same name already exists it is replaced.

func (*Scheduler) ListJobs

func (s *Scheduler) ListJobs() []dsl.ScheduledJob

ListJobs returns a snapshot of all current jobs.

func (*Scheduler) RemoveJob

func (s *Scheduler) RemoveJob(name string) error

RemoveJob removes a job from the cron runner and calls the remove callback.

func (*Scheduler) Start

func (s *Scheduler) Start(ctx context.Context)

Start begins the cron runner and blocks until ctx is cancelled.

type Server

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

Server is the HTTP server for the Vega dashboard and REST API.

func New

func New(interp *dsl.Interpreter, cfg Config) *Server

New creates a new Server.

func (*Server) Start

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

Start initializes the store, wires callbacks, registers routes, and listens for HTTP requests. It blocks until ctx is cancelled.

type Setting added in v0.2.0

type Setting struct {
	Key       string    `json:"key"`
	Value     string    `json:"value"`
	Sensitive bool      `json:"sensitive"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Setting is a persisted key-value configuration entry.

type SpawnTreeNodeResponse

type SpawnTreeNodeResponse struct {
	ProcessID   string                  `json:"process_id"`
	AgentName   string                  `json:"agent_name"`
	Task        string                  `json:"task,omitempty"`
	Status      string                  `json:"status"`
	SpawnDepth  int                     `json:"spawn_depth"`
	SpawnReason string                  `json:"spawn_reason,omitempty"`
	StartedAt   time.Time               `json:"started_at"`
	Children    []SpawnTreeNodeResponse `json:"children,omitempty"`
}

SpawnTreeNodeResponse is the API representation of a spawn tree node.

type StatsResponse

type StatsResponse struct {
	TotalProcesses           int     `json:"total_processes"`
	RunningProcesses         int     `json:"running_processes"`
	CompletedProcesses       int     `json:"completed_processes"`
	FailedProcesses          int     `json:"failed_processes"`
	TotalInputTokens         int     `json:"total_input_tokens"`
	TotalOutputTokens        int     `json:"total_output_tokens"`
	TotalCacheCreationTokens int     `json:"total_cache_creation_tokens"`
	TotalCacheReadTokens     int     `json:"total_cache_read_tokens"`
	TotalCostUSD             float64 `json:"total_cost_usd"`
	TotalToolCalls           int     `json:"total_tool_calls"`
	TotalErrors              int     `json:"total_errors"`
	Uptime                   string  `json:"uptime"`
}

StatsResponse contains aggregate metrics.

type Store

type Store interface {
	// Init creates tables if they don't exist.
	Init() error

	// Close closes the store.
	Close() error

	// InsertEvent records an orchestration event.
	InsertEvent(e StoreEvent) error

	// InsertProcessSnapshot records a process state snapshot.
	InsertProcessSnapshot(s ProcessSnapshot) error

	// InsertWorkflowRun records a workflow execution.
	InsertWorkflowRun(r WorkflowRun) error

	// UpdateWorkflowRun updates a workflow run status.
	UpdateWorkflowRun(runID string, status string, result string) error

	// ListEvents returns recent events, newest first.
	ListEvents(limit int) ([]StoreEvent, error)

	// ListProcessSnapshots returns the latest snapshot per process.
	ListProcessSnapshots() ([]ProcessSnapshot, error)

	// ListWorkflowRuns returns recent workflow runs.
	ListWorkflowRuns(limit int) ([]WorkflowRun, error)

	// InsertComposedAgent persists a composed agent definition.
	InsertComposedAgent(a ComposedAgent) error

	// ListComposedAgents returns all composed agents.
	ListComposedAgents() ([]ComposedAgent, error)

	// DeleteComposedAgent removes a composed agent by name.
	DeleteComposedAgent(name string) error

	// InsertChatMessage persists a chat message.
	InsertChatMessage(agent, role, content string) error

	// ListChatMessages returns chat history for an agent.
	ListChatMessages(agent string) ([]ChatMessage, error)

	// DeleteChatMessages removes all chat messages for an agent.
	DeleteChatMessages(agent string) error

	// UpsertUserMemory creates or updates a memory layer for a user+agent.
	UpsertUserMemory(userID, agent, layer, content string) error

	// GetUserMemory returns all memory layers for a user+agent.
	GetUserMemory(userID, agent string) ([]UserMemory, error)

	// DeleteUserMemory removes all memory for a user+agent.
	DeleteUserMemory(userID, agent string) error

	// InsertMemoryItem saves a memory item.
	InsertMemoryItem(item MemoryItem) (int64, error)

	// SearchMemoryItems searches memory items by keyword across topic, content, and tags.
	SearchMemoryItems(userID, agent, query string, limit int) ([]MemoryItem, error)

	// DeleteMemoryItem removes a memory item by ID.
	DeleteMemoryItem(id int64) error

	// ListMemoryItemsByTopic returns memory items for a given user+agent+topic.
	ListMemoryItemsByTopic(userID, agent, topic string) ([]MemoryItem, error)

	// UpsertScheduledJob creates or replaces a scheduled job.
	UpsertScheduledJob(job ScheduledJob) error

	// DeleteScheduledJob removes a scheduled job by name.
	DeleteScheduledJob(name string) error

	// ListScheduledJobs returns all scheduled jobs.
	ListScheduledJobs() ([]ScheduledJob, error)

	// InsertWorkspaceFile records a file write by an agent.
	InsertWorkspaceFile(f WorkspaceFile) error

	// ListWorkspaceFiles returns workspace file records, optionally filtered by agent.
	ListWorkspaceFiles(agent string) ([]WorkspaceFile, error)

	// ListWorkspaceFileAgents returns distinct agent names that have written files.
	ListWorkspaceFileAgents() ([]string, error)

	// UpsertSetting creates or updates a setting.
	UpsertSetting(s Setting) error

	// GetSetting returns a setting by key.
	GetSetting(key string) (*Setting, error)

	// ListSettings returns all settings.
	ListSettings() ([]Setting, error)

	// DeleteSetting removes a setting by key.
	DeleteSetting(key string) error

	// CreateChannel creates a new channel.
	CreateChannel(id, name, description, createdBy string, team []string, mode string) error

	// GetChannel returns a channel by name.
	GetChannel(name string) (*Channel, error)

	// GetChannelByName returns minimal channel info for the dsl.ChannelBackend interface.
	GetChannelByName(name string) (*dsl.ChannelInfo, error)

	// ListChannelsForAgent returns channels where the agent is a team member.
	ListChannelsForAgent(agent string) ([]dsl.ChannelInfo, error)

	// ListChannels returns all channels.
	ListChannels() ([]Channel, error)

	// DeleteChannel removes a channel by name.
	DeleteChannel(name string) error

	// UpdateChannelTeam updates the team members of a channel.
	UpdateChannelTeam(name string, team []string) error

	// FindChannelForAgents returns the channel where both agents are team members.
	FindChannelForAgents(agent1, agent2 string) (channelID string, channelName string, err error)

	// InsertInboxItem creates a new inbox item.
	InsertInboxItem(fromAgent, subject, body, priority string) (int64, error)

	// ListInboxItems returns inbox items filtered by status.
	ListInboxItems(status string, limit int) ([]InboxItem, error)

	// GetInboxItem returns a single inbox item by ID.
	GetInboxItem(id int64) (*InboxItem, error)

	// ResolveInboxItem marks an inbox item as resolved.
	ResolveInboxItem(id int64, resolution string) error

	// DeleteResolvedInboxItems removes all resolved inbox items and their replies.
	DeleteResolvedInboxItems() (int64, error)

	// InsertChannelMessage inserts a message into a channel.
	InsertChannelMessage(channelID, agent, role, content string, threadID *int64, metadata string) (int64, error)

	// ListChannelMessages returns top-level messages for a channel with reply counts.
	ListChannelMessages(channelID string, limit int) ([]ChannelMessage, error)

	// RecentChannelMessages returns the last N messages (lightweight, for status checks).
	RecentChannelMessages(channelID string, limit int) ([]dsl.ChannelMessage, error)

	// ListThreadMessages returns all replies in a thread.
	ListThreadMessages(channelID string, threadID int64) ([]ChannelMessage, error)

	// ResetData clears all transient data (chat, memory, agents, files, etc.)
	// but preserves settings and prompt history.
	ResetData() error

	// InsertPromptHistory records an original user prompt to hermes.
	InsertPromptHistory(prompt string) (int64, error)

	// ListPromptHistory returns prompt history entries, newest first.
	ListPromptHistory(limit int) ([]PromptHistoryItem, error)

	// SearchPromptHistory searches prompt history by keyword.
	SearchPromptHistory(query string, limit int) ([]PromptHistoryItem, error)

	// DeletePromptHistory removes a prompt history entry by ID.
	DeletePromptHistory(id int64) error
}

Store persists events and process snapshots for historical queries.

type StoreEvent

type StoreEvent struct {
	ID        int64     `json:"id"`
	Type      string    `json:"type"`
	ProcessID string    `json:"process_id"`
	AgentName string    `json:"agent_name"`
	Timestamp time.Time `json:"timestamp"`
	Data      string    `json:"data"`
	Result    string    `json:"result,omitempty"`
	Error     string    `json:"error,omitempty"`
}

StoreEvent is a persisted orchestration event.

type TelegramBot

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

TelegramBot handles incoming Telegram messages via long polling and routes them to a vega agent, storing history in the same store as the HTTP chat API.

func NewTelegramBot

func NewTelegramBot(token, agentName string, interp *dsl.Interpreter, store Store, onExchange func(userID, agent, userMsg, response string)) (*TelegramBot, error)

NewTelegramBot creates a TelegramBot connected to the given token. onExchange is called after each successful exchange for async memory extraction.

func (*TelegramBot) Start

func (t *TelegramBot) Start(ctx context.Context)

Start runs the long-polling loop until ctx is cancelled.

type UpdateAgentRequest added in v0.3.0

type UpdateAgentRequest struct {
	Name        *string  `json:"name,omitempty"`
	Model       *string  `json:"model,omitempty"`
	System      *string  `json:"system,omitempty"`
	Team        []string `json:"team,omitempty"`
	Temperature *float64 `json:"temperature,omitempty"`
}

UpdateAgentRequest is the request to update an existing composed agent.

type UserMemory

type UserMemory struct {
	UserID    string    `json:"user_id"`
	Agent     string    `json:"agent"`
	Layer     string    `json:"layer"`
	Content   string    `json:"content"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

UserMemory is a persisted memory layer for a user+agent pair.

type WorkflowResponse

type WorkflowResponse struct {
	Name        string                   `json:"name"`
	Description string                   `json:"description,omitempty"`
	Steps       int                      `json:"steps"`
	Inputs      map[string]InputResponse `json:"inputs,omitempty"`
}

WorkflowResponse is the API representation of a workflow definition.

type WorkflowRun

type WorkflowRun struct {
	ID        int64     `json:"id"`
	RunID     string    `json:"run_id"`
	Workflow  string    `json:"workflow"`
	Inputs    string    `json:"inputs"`
	Status    string    `json:"status"`
	Result    string    `json:"result,omitempty"`
	StartedAt time.Time `json:"started_at"`
}

WorkflowRun is a persisted workflow execution.

type WorkflowRunRequest

type WorkflowRunRequest struct {
	Inputs map[string]any `json:"inputs"`
}

WorkflowRunRequest is the request to launch a workflow.

type WorkflowRunResponse

type WorkflowRunResponse struct {
	RunID  string `json:"run_id"`
	Status string `json:"status"`
}

WorkflowRunResponse is returned when a workflow is launched.

type WorkspaceFile added in v0.2.0

type WorkspaceFile struct {
	ID          int64     `json:"id"`
	Path        string    `json:"path"`
	Agent       string    `json:"agent"`
	ProcessID   string    `json:"process_id"`
	Operation   string    `json:"operation"`
	Description string    `json:"description,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
}

WorkspaceFile tracks a file written by an agent.

Jump to

Keyboard shortcuts

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