serve

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 28 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"`
	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 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 ChatMessage

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

ChatMessage is a persisted chat message.

type ComposedAgent

type ComposedAgent struct {
	Name        string    `json:"name"`
	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
}

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 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 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 MCPServerResponse

type MCPServerResponse struct {
	Name      string   `json:"name"`
	Connected bool     `json:"connected"`
	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 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) DeleteAllFromTable added in v0.2.0

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

DeleteAllFromTable removes all rows from the given table.

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) DeleteMemoryItem

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

DeleteMemoryItem removes a memory item by ID.

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) 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) 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) 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) 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) 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) 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) 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) 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) 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) UpdateWorkflowRun

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

UpdateWorkflowRun updates a workflow run status and result.

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"`
	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
}

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 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