Documentation
¶
Overview ¶
Package serve provides an HTTP server with a web dashboard and REST API for monitoring and controlling Vega agent orchestration.
Package serve provides the HTTP server, REST API, and embedded React frontend.
Index ¶
- Constants
- Variables
- func BearerTokenFrom(ctx context.Context) string
- func ContextWithMemory(ctx context.Context, store Store, userID, agent string) context.Context
- func ContextWithRecall(ctx context.Context, ledger *RecallLedger) context.Context
- func InjectMira(interp *dsl.Interpreter, cfg MiraConfig) error
- func LoadCORSConfig() map[string]bool
- func MCPSettingKey(serverName, envKey string) string
- func MiraAgent(cfg MiraConfig) *dsl.Agent
- func NextRun(cronExpr string, after time.Time) *time.Time
- func RegisterMemoryTools(interp *dsl.Interpreter)
- func RegisterWikiMemoryTools(interp *dsl.Interpreter)
- func WithBearerToken(ctx context.Context, token string) context.Context
- func WithClaims(ctx context.Context, c AuthClaims) context.Context
- type ActivityFilter
- type ActivityLogResponse
- type AddTaskCommentRequest
- type AgentBrainFile
- type AgentBudget
- type AgentBudgetResponse
- type AgentHealth
- type AgentIdentity
- type AgentResponse
- type AgentRoutineResponse
- type AgentSpendResponse
- type AgentStatsResponse
- type AgentStatus
- type AgentTemplateResponse
- type AgentToolsResponse
- type AuthClaims
- type AuthConfig
- type BackfillReport
- type BlobStore
- type BrokerEvent
- type CallerResolver
- type Channel
- type ChannelEvent
- type ChannelMessage
- type ChannelPostRequest
- type ChatMessage
- type ChatResponseReviewer
- type ChatStatusResponse
- type CompanyResponse
- type CompanySiblingResponse
- type ComposedAgent
- type Config
- type ConfigAgentInfo
- type ConfigMCPInfo
- type ConfigResponse
- type ConfigSettingsInfo
- type ConfigUploadResult
- type ConnectMCPRequest
- type ConnectMCPResponse
- type CreateAgentRequest
- type CreateAgentResponse
- type CreateChannelRequest
- type CreateRoutineRequest
- type CreateTaskRequest
- type DBKind
- type DiscordBot
- type DiscordBotConfig
- type DiscordBotStatus
- type ErrorResponse
- type EventBroker
- type ExtraSystemProvider
- type FileContentResponse
- type FileEntry
- type FileMetadataResponse
- type FilesystemBlobStore
- type GmailStatus
- type IdentityResponse
- type InboxItem
- type InputResponse
- type InviteDTO
- type LinkTaskProcessRequest
- type LocalAppHost
- func (h *LocalAppHost) Deploy(ctx context.Context, spec tools.AppSpec) (tools.AppDeployment, error)
- func (h *LocalAppHost) Destroy(ctx context.Context, id string) error
- func (h *LocalAppHost) List(ctx context.Context) ([]tools.AppDeployment, error)
- func (h *LocalAppHost) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *LocalAppHost) SetBaseURL(u string)
- func (h *LocalAppHost) SetSigner(s *capabilitySigner)
- type MCPRegistryEntryResponse
- type MCPServerConfig
- type MCPServerConfigResponse
- type MCPServerResponse
- type MemoryItem
- type MemoryLink
- type MemoryPage
- type MemoryResponse
- type MemoryScope
- type MemoryType
- type MessageResponse
- type MetricsResponse
- type MigrationReport
- type MiraConfig
- type PeeringStatusResponse
- type PopulationInfoResponse
- type PopulationInstallRequest
- type PopulationInstalledItem
- type PopulationSearchResult
- type PostgresStore
- func (s *PostgresStore) AddTaskComment(taskID, author, content string) (int64, error)
- func (s *PostgresStore) AgentSpendInPeriod(agentName string, from, to time.Time) (float64, error)
- func (s *PostgresStore) AssignTask(id, assignee string) error
- func (s *PostgresStore) ChatUnreadCounts(userID string) (map[string]int, error)
- func (s *PostgresStore) ClaimTask(id, assignee string) error
- func (s *PostgresStore) Close() error
- func (s *PostgresStore) CreateChannel(id, name, description, createdBy string, team []string, mode string) error
- func (s *PostgresStore) DeleteAgentBrainFile(agentName, id string) error
- func (s *PostgresStore) DeleteChannel(name string) error
- func (s *PostgresStore) DeleteChatMessages(agent string) error
- func (s *PostgresStore) DeleteComposedAgent(name string) error
- func (s *PostgresStore) DeleteInboxItem(id int64) error
- func (s *PostgresStore) DeleteMCPServer(name string) error
- func (s *PostgresStore) DeleteMemoryItem(id int64) error
- func (s *PostgresStore) DeleteMemoryPage(scope MemoryScope, scopeID, userID, path string) error
- func (s *PostgresStore) DeletePromptHistory(id int64) error
- func (s *PostgresStore) DeleteResolvedInboxItems() (int64, error)
- func (s *PostgresStore) DeleteScheduledJob(name string) error
- func (s *PostgresStore) DeleteSetting(key string) error
- func (s *PostgresStore) DeleteTask(id string) error
- func (s *PostgresStore) DeleteUserMemory(userID, agent string) error
- func (s *PostgresStore) FindChannelForAgents(agent1, agent2 string) (string, string, error)
- func (s *PostgresStore) GetAgentBrainFile(agentName, id string) (*AgentBrainFile, error)
- func (s *PostgresStore) GetAgentBudget(agentName string) (*AgentBudget, error)
- func (s *PostgresStore) GetChannel(name string) (*Channel, error)
- func (s *PostgresStore) GetChannelByName(name string) (*dsl.ChannelInfo, error)
- func (s *PostgresStore) GetInboxItem(id int64) (*InboxItem, error)
- func (s *PostgresStore) GetMemoryPage(scope MemoryScope, scopeID, userID, path string) (*MemoryPage, error)
- func (s *PostgresStore) GetScheduledJobByID(id string) (*ScheduledJob, error)
- func (s *PostgresStore) GetSetting(key string) (*Setting, error)
- func (s *PostgresStore) GetTask(id string) (*Task, error)
- func (s *PostgresStore) GetUserMemory(userID, agent string) ([]UserMemory, error)
- func (s *PostgresStore) Init() error
- func (s *PostgresStore) InsertAgentBrainFile(f AgentBrainFile) error
- func (s *PostgresStore) InsertChannelMessage(channelID, agent, role, content string, threadID *int64, ...) (int64, error)
- func (s *PostgresStore) InsertChatMessage(agent, role, content string, activities []vega.ToolActivity) error
- func (s *PostgresStore) InsertComposedAgent(a ComposedAgent) error
- func (s *PostgresStore) InsertEvent(e StoreEvent) error
- func (s *PostgresStore) InsertInboxItem(fromAgent, subject, body, priority string) (int64, error)
- func (s *PostgresStore) InsertMemoryItem(item MemoryItem) (int64, error)
- func (s *PostgresStore) InsertProcessSnapshot(snap ProcessSnapshot) error
- func (s *PostgresStore) InsertPromptHistory(prompt string) (int64, error)
- func (s *PostgresStore) InsertResolvedInboxItem(fromAgent, subject, body, resolution string) (int64, error)
- func (s *PostgresStore) InsertTask(t Task) error
- func (s *PostgresStore) InsertWorkflowRun(r WorkflowRun) error
- func (s *PostgresStore) InsertWorkspaceFile(f WorkspaceFile) error
- func (s *PostgresStore) LinkTaskProcess(taskID, processID string) error
- func (s *PostgresStore) ListAgentBrainFiles(agentName string) ([]AgentBrainFile, error)
- func (s *PostgresStore) ListAllChannels() ([]dsl.ChannelInfo, error)
- func (s *PostgresStore) ListAllMemoryItems() ([]MemoryItem, error)
- func (s *PostgresStore) ListAllUserMemory() ([]UserMemory, error)
- func (s *PostgresStore) ListChannelMessages(channelID string, limit int) ([]ChannelMessage, error)
- func (s *PostgresStore) ListChannels(userID string) ([]Channel, error)
- func (s *PostgresStore) ListChannelsForAgent(agent string) ([]dsl.ChannelInfo, error)
- func (s *PostgresStore) ListChatMessages(agent string) ([]ChatMessage, error)
- func (s *PostgresStore) ListComposedAgents() ([]ComposedAgent, error)
- func (s *PostgresStore) ListEvents(limit int) ([]StoreEvent, error)
- func (s *PostgresStore) ListInboxItems(status string, limit int) ([]InboxItem, error)
- func (s *PostgresStore) ListMCPServers() ([]MCPServerConfig, error)
- func (s *PostgresStore) ListMemoryItemsByTopic(userID, agent, topic string) ([]MemoryItem, error)
- func (s *PostgresStore) ListMemoryLinks(scope MemoryScope, scopeID, userID string) ([]MemoryLink, error)
- func (s *PostgresStore) ListMemoryPages(scope MemoryScope, scopeID, userID, pathPrefix string) ([]MemoryPage, error)
- func (s *PostgresStore) ListMemoryScopeIDs(scope MemoryScope, userID string) ([]string, error)
- func (s *PostgresStore) ListMyTasks(assignee string, status []string, limit int) ([]Task, error)
- func (s *PostgresStore) ListProcessSnapshots() ([]ProcessSnapshot, error)
- func (s *PostgresStore) ListPromptHistory(limit int) ([]PromptHistoryItem, error)
- func (s *PostgresStore) ListScheduledJobs() ([]ScheduledJob, error)
- func (s *PostgresStore) ListSettings() ([]Setting, error)
- func (s *PostgresStore) ListTaskComments(taskID string) ([]TaskComment, error)
- func (s *PostgresStore) ListTaskProcesses(taskID string) ([]string, error)
- func (s *PostgresStore) ListTasks(f TaskFilter) ([]Task, error)
- func (s *PostgresStore) ListThreadMessages(channelID string, threadID int64) ([]ChannelMessage, error)
- func (s *PostgresStore) ListUnassignedTasks(limit int) ([]Task, error)
- func (s *PostgresStore) ListWorkflowRuns(limit int) ([]WorkflowRun, error)
- func (s *PostgresStore) ListWorkspaceFileAgents() ([]string, error)
- func (s *PostgresStore) ListWorkspaceFiles(agent string) ([]WorkspaceFile, error)
- func (s *PostgresStore) MarkChannelRead(channelID, userID string) error
- func (s *PostgresStore) MarkChatRead(agent, userID string) error
- func (s *PostgresStore) MarkScheduledJobRun(name string, at time.Time) error
- func (s *PostgresStore) PeeringStore() peering.Store
- func (s *PostgresStore) RecentChannelMessages(channelID string, limit int) ([]dsl.ChannelMessage, error)
- func (s *PostgresStore) ReconcileOrphanedWorkflowRuns() (int64, error)
- func (s *PostgresStore) RenameMemoryPage(scope MemoryScope, scopeID, userID, oldPath, newPath string) error
- func (s *PostgresStore) ReplaceMemoryLinks(scope MemoryScope, scopeID, userID, fromPath string, toPaths []string) error
- func (s *PostgresStore) ResetData() error
- func (s *PostgresStore) ResolveInboxItem(id int64, resolution string) error
- func (s *PostgresStore) SearchEvents(filter ActivityFilter) ([]StoreEvent, int, error)
- func (s *PostgresStore) SearchMemoryItems(userID, agent, query string, limit int) ([]MemoryItem, error)
- func (s *PostgresStore) SearchMemoryItemsByType(userID, agent, query string, typ MemoryType, limit int) ([]MemoryItem, error)
- func (s *PostgresStore) SearchMemoryPages(scope MemoryScope, scopeID, userID, query string, limit int) ([]MemoryPage, error)
- func (s *PostgresStore) SearchPromptHistory(query string, limit int) ([]PromptHistoryItem, error)
- func (s *PostgresStore) SetMCPServerDisabled(name string, disabled bool) error
- func (s *PostgresStore) SweepRetention(policy RetentionPolicy) (RetentionSweepResult, error)
- func (s *PostgresStore) TaskStatsByAssignee() (map[string]AgentStatsResponse, error)
- func (s *PostgresStore) TriageInboxItems(ids []int64, threshold int) ([]int64, error)
- func (s *PostgresStore) UpdateChannelMeta(currentName string, newName, newDescription *string) error
- func (s *PostgresStore) UpdateChannelTeam(name string, team []string) error
- func (s *PostgresStore) UpdateTask(id string, u TaskUpdate) error
- func (s *PostgresStore) UpdateTaskStatus(id, status string) error
- func (s *PostgresStore) UpdateWorkflowRun(runID, status, result string) error
- func (s *PostgresStore) UpdateWorkflowRunSteps(runID string, stepsJSON string) error
- func (s *PostgresStore) UpsertAgentBudget(b AgentBudget) error
- func (s *PostgresStore) UpsertMCPServer(name, configJSON string) error
- func (s *PostgresStore) UpsertMemoryPage(p MemoryPage) error
- func (s *PostgresStore) UpsertScheduledJob(job ScheduledJob) error
- func (s *PostgresStore) UpsertSetting(st Setting) error
- func (s *PostgresStore) UpsertUserMemory(userID, agent, layer, content string) error
- type ProcessDetailResponse
- type ProcessResponse
- type ProcessSnapshot
- type PromptHistoryItem
- type RecallEntry
- type RecallLedger
- type RecallSource
- type RetentionPolicy
- type RetentionSweepResult
- type RoutineFrequency
- type SQLiteStore
- func (s *SQLiteStore) AddTaskComment(taskID, author, content string) (int64, error)
- func (s *SQLiteStore) AgentSpendInPeriod(agentName string, from, to time.Time) (float64, error)
- func (s *SQLiteStore) AssignTask(id, assignee string) error
- func (s *SQLiteStore) ChatUnreadCounts(userID string) (map[string]int, error)
- func (s *SQLiteStore) ClaimTask(id, assignee string) error
- func (s *SQLiteStore) Close() error
- func (s *SQLiteStore) CountTable(table string) (int, error)
- func (s *SQLiteStore) CreateChannel(id, name, description, createdBy string, team []string, mode string) error
- func (s *SQLiteStore) DeleteAgentBrainFile(agentName, id string) error
- func (s *SQLiteStore) DeleteAllFromTable(table string) error
- func (s *SQLiteStore) DeleteChannel(name string) error
- func (s *SQLiteStore) DeleteChatMessages(agent string) error
- func (s *SQLiteStore) DeleteComposedAgent(name string) error
- func (s *SQLiteStore) DeleteInboxItem(id int64) error
- func (s *SQLiteStore) DeleteMCPServer(name string) error
- func (s *SQLiteStore) DeleteMemoryItem(id int64) error
- func (s *SQLiteStore) DeleteMemoryPage(scope MemoryScope, scopeID, userID, path string) error
- func (s *SQLiteStore) DeletePromptHistory(id int64) error
- func (s *SQLiteStore) DeleteResolvedInboxItems() (int64, error)
- func (s *SQLiteStore) DeleteScheduledJob(name string) error
- func (s *SQLiteStore) DeleteSetting(key string) error
- func (s *SQLiteStore) DeleteTask(id string) error
- func (s *SQLiteStore) DeleteUserMemory(userID, agent string) error
- func (s *SQLiteStore) FindChannelForAgents(agent1, agent2 string) (string, string, error)
- func (s *SQLiteStore) GetAgentBrainFile(agentName, id string) (*AgentBrainFile, error)
- func (s *SQLiteStore) GetAgentBudget(agentName string) (*AgentBudget, error)
- func (s *SQLiteStore) GetChannel(name string) (*Channel, error)
- func (s *SQLiteStore) GetChannelByName(name string) (*dsl.ChannelInfo, error)
- func (s *SQLiteStore) GetInboxItem(id int64) (*InboxItem, error)
- func (s *SQLiteStore) GetMemoryPage(scope MemoryScope, scopeID, userID, path string) (*MemoryPage, error)
- func (s *SQLiteStore) GetScheduledJobByID(id string) (*ScheduledJob, error)
- func (s *SQLiteStore) GetSetting(key string) (*Setting, error)
- func (s *SQLiteStore) GetTask(id string) (*Task, error)
- func (s *SQLiteStore) GetUserMemory(userID, agent string) ([]UserMemory, error)
- func (s *SQLiteStore) Init() error
- func (s *SQLiteStore) InsertAgentBrainFile(f AgentBrainFile) error
- func (s *SQLiteStore) InsertChannelMessage(channelID, agent, role, content string, threadID *int64, ...) (int64, error)
- func (s *SQLiteStore) InsertChatMessage(agent, role, content string, activities []vega.ToolActivity) error
- func (s *SQLiteStore) InsertComposedAgent(a ComposedAgent) error
- func (s *SQLiteStore) InsertEvent(e StoreEvent) error
- func (s *SQLiteStore) InsertInboxItem(fromAgent, subject, body, priority string) (int64, error)
- func (s *SQLiteStore) InsertMemoryItem(item MemoryItem) (int64, error)
- func (s *SQLiteStore) InsertProcessSnapshot(snap ProcessSnapshot) error
- func (s *SQLiteStore) InsertPromptHistory(prompt string) (int64, error)
- func (s *SQLiteStore) InsertResolvedInboxItem(fromAgent, subject, body, resolution string) (int64, error)
- func (s *SQLiteStore) InsertTask(t Task) error
- func (s *SQLiteStore) InsertWorkflowRun(r WorkflowRun) error
- func (s *SQLiteStore) InsertWorkspaceFile(f WorkspaceFile) error
- func (s *SQLiteStore) LinkTaskProcess(taskID, processID string) error
- func (s *SQLiteStore) ListAgentBrainFiles(agentName string) ([]AgentBrainFile, error)
- func (s *SQLiteStore) ListAllChannels() ([]dsl.ChannelInfo, error)
- func (s *SQLiteStore) ListAllMemoryItems() ([]MemoryItem, error)
- func (s *SQLiteStore) ListAllUserMemory() ([]UserMemory, error)
- func (s *SQLiteStore) ListChannelMessages(channelID string, limit int) ([]ChannelMessage, error)
- func (s *SQLiteStore) ListChannels(userID string) ([]Channel, error)
- func (s *SQLiteStore) ListChannelsForAgent(agent string) ([]dsl.ChannelInfo, error)
- func (s *SQLiteStore) ListChatMessages(agent string) ([]ChatMessage, error)
- func (s *SQLiteStore) ListComposedAgents() ([]ComposedAgent, error)
- func (s *SQLiteStore) ListEvents(limit int) ([]StoreEvent, error)
- func (s *SQLiteStore) ListInboxItems(status string, limit int) ([]InboxItem, error)
- func (s *SQLiteStore) ListMCPServers() ([]MCPServerConfig, error)
- func (s *SQLiteStore) ListMemoryItemsByTopic(userID, agent, topic string) ([]MemoryItem, error)
- func (s *SQLiteStore) ListMemoryLinks(scope MemoryScope, scopeID, userID string) ([]MemoryLink, error)
- func (s *SQLiteStore) ListMemoryPages(scope MemoryScope, scopeID, userID, pathPrefix string) ([]MemoryPage, error)
- func (s *SQLiteStore) ListMemoryScopeIDs(scope MemoryScope, userID string) ([]string, error)
- func (s *SQLiteStore) ListMyTasks(assignee string, status []string, limit int) ([]Task, error)
- func (s *SQLiteStore) ListProcessSnapshots() ([]ProcessSnapshot, error)
- func (s *SQLiteStore) ListPromptHistory(limit int) ([]PromptHistoryItem, error)
- func (s *SQLiteStore) ListScheduledJobs() ([]ScheduledJob, error)
- func (s *SQLiteStore) ListSettings() ([]Setting, error)
- func (s *SQLiteStore) ListTaskComments(taskID string) ([]TaskComment, error)
- func (s *SQLiteStore) ListTaskProcesses(taskID string) ([]string, error)
- func (s *SQLiteStore) ListTasks(f TaskFilter) ([]Task, error)
- func (s *SQLiteStore) ListThreadMessages(channelID string, threadID int64) ([]ChannelMessage, error)
- func (s *SQLiteStore) ListUnassignedTasks(limit int) ([]Task, error)
- func (s *SQLiteStore) ListWorkflowRuns(limit int) ([]WorkflowRun, error)
- func (s *SQLiteStore) ListWorkspaceFileAgents() ([]string, error)
- func (s *SQLiteStore) ListWorkspaceFiles(agent string) ([]WorkspaceFile, error)
- func (s *SQLiteStore) MarkChannelRead(channelID, userID string) error
- func (s *SQLiteStore) MarkChatRead(agent, userID string) error
- func (s *SQLiteStore) MarkScheduledJobRun(name string, at time.Time) error
- func (s *SQLiteStore) PeeringStore() peering.Store
- func (s *SQLiteStore) PendingInboxCount() (int, error)
- func (s *SQLiteStore) RecentChannelMessages(channelID string, limit int) ([]dsl.ChannelMessage, error)
- func (s *SQLiteStore) ReconcileOrphanedWorkflowRuns() (int64, error)
- func (s *SQLiteStore) RenameMemoryPage(scope MemoryScope, scopeID, userID, oldPath, newPath string) error
- func (s *SQLiteStore) ReplaceMemoryLinks(scope MemoryScope, scopeID, userID, fromPath string, toPaths []string) error
- func (s *SQLiteStore) ResetData() error
- func (s *SQLiteStore) ResolveInboxItem(id int64, resolution string) error
- func (s *SQLiteStore) SearchEvents(filter ActivityFilter) ([]StoreEvent, int, error)
- func (s *SQLiteStore) SearchMemoryItems(userID, agent, query string, limit int) ([]MemoryItem, error)
- func (s *SQLiteStore) SearchMemoryItemsByType(userID, agent, query string, typ MemoryType, limit int) ([]MemoryItem, error)
- func (s *SQLiteStore) SearchMemoryPages(scope MemoryScope, scopeID, userID, query string, limit int) ([]MemoryPage, error)
- func (s *SQLiteStore) SearchPromptHistory(query string, limit int) ([]PromptHistoryItem, error)
- func (s *SQLiteStore) SetMCPServerDisabled(name string, disabled bool) error
- func (s *SQLiteStore) SweepRetention(policy RetentionPolicy) (RetentionSweepResult, error)
- func (s *SQLiteStore) TaskStatsByAssignee() (map[string]AgentStatsResponse, error)
- func (s *SQLiteStore) TriageInboxItems(ids []int64, threshold int) ([]int64, error)
- func (s *SQLiteStore) UpdateChannelMeta(currentName string, newName, newDescription *string) error
- func (s *SQLiteStore) UpdateChannelTeam(name string, team []string) error
- func (s *SQLiteStore) UpdateTask(id string, u TaskUpdate) error
- func (s *SQLiteStore) UpdateTaskStatus(id, status string) error
- func (s *SQLiteStore) UpdateWorkflowRun(runID string, status string, result string) error
- func (s *SQLiteStore) UpdateWorkflowRunSteps(runID string, stepsJSON string) error
- func (s *SQLiteStore) UpsertAgentBudget(b AgentBudget) error
- func (s *SQLiteStore) UpsertMCPServer(name, configJSON string) error
- func (s *SQLiteStore) UpsertMemoryPage(p MemoryPage) error
- func (s *SQLiteStore) UpsertScheduledJob(job ScheduledJob) error
- func (s *SQLiteStore) UpsertSetting(st Setting) error
- func (s *SQLiteStore) UpsertUserMemory(userID, agent, layer, content string) error
- func (s *SQLiteStore) Vacuum()
- type Schedule
- type ScheduledJob
- type Scheduler
- type Server
- func (s *Server) AddDiscordBot(parent context.Context, token, agent, label string, allowedUsers []string) (*DiscordBotConfig, error)
- func (s *Server) AddTelegramBot(parent context.Context, token, agent, label string) (*TelegramBotConfig, error)
- func (s *Server) BuildMCPEnvMap(serverName string, reqEnv map[string]string) map[string]string
- func (s *Server) DiscordBotsSnapshot() []DiscordBotStatus
- func (s *Server) Interpreter() *dsl.Interpreter
- func (s *Server) PersistMCPServer(req ConnectMCPRequest)
- func (s *Server) RefreshToolSettings()
- func (s *Server) RegisterAppHost(h tools.AppHost)
- func (s *Server) RegisterReplyTarget(agentName string, target dsl.ReplyTarget)
- func (s *Server) RegisterRoute(pattern string, handler http.HandlerFunc)
- func (s *Server) RemoveDiscordBot(id string) error
- func (s *Server) RemoveTelegramBot(id string) error
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Store() Store
- func (s *Server) TelegramBotsSnapshot() []TelegramBotStatus
- func (s *Server) UnregisterReplyTarget(agentName string)
- func (s *Server) WithCallerResolver(r CallerResolver) *Server
- type Setting
- type SpawnTreeNodeResponse
- type StatsResponse
- type Store
- type StoreEvent
- type Task
- type TaskComment
- type TaskDetailResponse
- type TaskFilter
- type TaskUpdate
- type TelegramBot
- type TelegramBotConfig
- type TelegramBotStatus
- type TenantConfigResponse
- type ToggleAgentToolRequest
- type UpdateAgentBudgetRequest
- type UpdateAgentRequest
- type UpdateChannelRequest
- type UpdateRoutineRequest
- type UpdateTenantConfigRequest
- type UserMemory
- type WorkflowResponse
- type WorkflowRun
- type WorkflowRunRequest
- type WorkflowRunResponse
- type WorkspaceFile
Constants ¶
const ( TaskStatusTodo = "todo" TaskStatusDoing = "doing" TaskStatusBlocked = "blocked" TaskStatusDone = "done" TaskStatusCanceled = "canceled" )
Task status / priority constants. Free-form strings are accepted by the store on insert (so apps can extend), but UpdateTask validates the enum to catch typos in the active path agents use most.
const ( TaskPriorityLow = "low" TaskPriorityNormal = "normal" TaskPriorityHigh = "high" TaskPriorityUrgent = "urgent" )
Variables ¶
var BuiltinFrontendFS = func() fs.FS { sub, err := fs.Sub(frontendFS, "frontend/dist") if err != nil { return nil } return sub }()
BuiltinFrontendFS exposes govega's bundled React build as an fs.FS rooted at the dist directory. Apps embedding govega/serve can either pass this (the default) or their own fs.FS via Config.FrontendFS to ship a custom UI.
var IntroPrompt = "" /* 201-byte string literal not displayed */
IntroPrompt is the synthetic user turn sent to a newly-created agent to generate its first assistant message (the "introduce yourself" turn from govega#63). Held in a var rather than a const so a tenant-specific config surface can override it later without an API change.
Functions ¶
func BearerTokenFrom ¶ added in v0.6.0
BearerTokenFrom returns the raw Authorization bearer token the auth middleware validated for this request, if any. Tools that need to call back into the user's own product as that user (e.g. a save_chapter MCP tool calling the product's REST API) read the token here and pass it through, so identity remains a single JWT for the duration of the chat turn. Returns "" when no middleware stashed a token (self-hosted mode, or a code path that never touched authMiddleware).
func ContextWithMemory ¶
ContextWithMemory returns a context carrying the store, userID, and agent needed by the memory tools (remember, recall, forget).
func ContextWithRecall ¶ added in v0.7.13
func ContextWithRecall(ctx context.Context, ledger *RecallLedger) context.Context
ContextWithRecall attaches a RecallLedger to ctx so tools and helpers running under it can record what they used.
func InjectMira ¶ added in v0.7.0
func InjectMira(interp *dsl.Interpreter, cfg MiraConfig) error
InjectMira registers the curator on the interpreter. The wiki memory tools must already be registered via RegisterWikiMemoryTools — Mira's tool list refers to them by name.
func LoadCORSConfig ¶ added in v0.5.1
LoadCORSConfig reads VEGA_ALLOWED_ORIGINS (comma-separated exact-match list), falling back to the legacy APEX_ALLOWED_ORIGINS with a deprecation warning. Empty/unset → nil → no cross-origin allowed.
func MCPSettingKey ¶ added in v0.6.0
MCPSettingKey is the public form of mcpSettingKey, for product integrations that persist their own per-server settings (Vapi etc.).
func MiraAgent ¶ added in v0.7.0
func MiraAgent(cfg MiraConfig) *dsl.Agent
MiraAgent returns the dsl.Agent definition for the curator.
func NextRun ¶ added in v0.6.0
NextRun returns the next fire time at or after `after` for the supplied cron expression, or nil if the expression cannot be parsed.
func RegisterMemoryTools ¶
func RegisterMemoryTools(interp *dsl.Interpreter)
RegisterMemoryTools registers remember, recall, and forget tools on the interpreter's global tool collection.
func RegisterWikiMemoryTools ¶ added in v0.7.0
func RegisterWikiMemoryTools(interp *dsl.Interpreter)
RegisterWikiMemoryTools registers the wiki-style memory tools on the interpreter's tool collection: memory_read, memory_list, memory_search, memory_write, memory_append, memory_edit, memory_delete, memory_rename. Refs govega#71.
Tools share the same context wiring as the legacy remember/recall/ forget tools (memoryFromContext); they coexist with those during the migration window.
func WithBearerToken ¶ added in v0.6.0
WithBearerToken attaches a raw bearer token to ctx. Exposed for product middleware that authenticates by means other than the bundled JWT path but still wants downstream tools to be able to call back with the same credential.
func WithClaims ¶ added in v0.6.0
func WithClaims(ctx context.Context, c AuthClaims) context.Context
WithClaims attaches AuthClaims to ctx using the same key authMiddleware uses. Provided so products that authenticate users outside the JWT middleware (e.g. a trusted reverse proxy that has already verified a session cookie) can inject identity that downstream handlers consume uniformly via ClaimsFrom.
Callers are responsible for verifying the claim — govega does no additional validation here.
Types ¶
type ActivityFilter ¶ added in v0.6.0
type ActivityFilter struct {
// Query is a substring matched against type, agent_name, data,
// result, and error (case-insensitive LIKE). Empty means no text
// filter.
Query string
// Type narrows to one event type (e.g. "process.failed").
Type string
// Agent narrows to one agent_name.
Agent string
// From and To bound the timestamp range. Zero values are unbounded.
From time.Time
To time.Time
// Limit caps the number of events returned. Defaults to 100; max 500.
Limit int
// Offset skips that many matching events (paginate alongside Limit).
Offset int
}
ActivityFilter is the search filter for the activity log endpoint (refs govega#33). All fields are optional — a zero-value filter returns the most recent events.
type ActivityLogResponse ¶ added in v0.6.0
type ActivityLogResponse struct {
Events []StoreEvent `json:"events"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
ActivityLogResponse is the wire shape for /api/v1/activity, the searchable activity log endpoint (refs govega#33). Carries the page of events plus a total match count so the FE can render pagination without a follow-up count query.
type AddTaskCommentRequest ¶ added in v0.6.0
type AddTaskCommentRequest struct {
Author string `json:"author,omitempty"`
Content string `json:"content"`
}
AddTaskCommentRequest is the body of POST /api/v1/tasks/{id}/comments.
type AgentBrainFile ¶ added in v0.6.0
type AgentBrainFile struct {
ID string `json:"id"`
AgentName string `json:"agent_id"` // FE calls this agent_id
Name string `json:"name"`
MimeType string `json:"mime_type,omitempty"`
SizeBytes int64 `json:"size_bytes"`
CreatedAt time.Time `json:"created_at"`
// Content is never JSON-serialized — only used internally for upload/download.
Content []byte `json:"-"`
}
AgentBrainFile is a per-agent knowledge attachment uploaded via `POST /api/v1/agents/{name}/brain` (refs govega#43). Content is stored inline as a SQLite blob — fine for the FE's MVP (an attachment list, no RAG). Move to an object store if/when retrieval-at-chat-time lands.
type AgentBudget ¶ added in v0.6.0
type AgentBudget struct {
AgentName string `json:"agent"`
BudgetCap *float64 `json:"budget_cap"`
SoftAlertThreshold float64 `json:"soft_alert_threshold"`
Enabled bool `json:"enabled"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
AgentBudget is the persisted per-agent budget record (refs govega#47). period_start / period_end / observed_spend aren't fields — period is always the current calendar month UTC, and observed_spend is the existing AgentSpendInPeriod rollup. The response surface composes those at read time.
type AgentBudgetResponse ¶ added in v0.6.0
type AgentBudgetResponse struct {
Agent string `json:"agent"`
BudgetCap *float64 `json:"budget_cap"`
SoftAlertThreshold float64 `json:"soft_alert_threshold"`
Enabled bool `json:"enabled"`
ObservedSpend float64 `json:"observed_spend"`
PeriodStart time.Time `json:"period_start"`
PeriodEnd time.Time `json:"period_end"`
}
AgentBudgetResponse is the wire shape for the per-agent budget endpoints (refs govega#47). Composes the persisted cap + threshold + enabled state with the current-period observed_spend rollup so the FE renders the budget tab in one round-trip.
budget_cap is nullable: null means "no cap configured." A null cap or enabled=false both disable the hard cutoff; soft_alert_threshold still drives the warning band when a cap is set.
type AgentHealth ¶ added in v0.6.0
type AgentHealth string
AgentHealth is an orthogonal "is anything wrong?" axis. Lifecycle status answers "where is this in its life," health answers "is anything wrong with how it's running."
const ( AgentHealthUnknown AgentHealth = "unknown" AgentHealthHealthy AgentHealth = "healthy" AgentHealthDegraded AgentHealth = "degraded" AgentHealthUnhealthy AgentHealth = "unhealthy" )
type AgentIdentity ¶ added in v0.5.0
type AgentIdentity struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Title string `json:"title,omitempty"`
}
AgentIdentity is the public identity of a meta-agent.
type AgentResponse ¶
type AgentResponse struct {
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Title string `json:"title,omitempty"`
// Description is a short paragraph of body text describing the agent's
// purpose. User-facing — distinct from `system` (the LLM-facing prompt).
Description string `json:"description,omitempty"`
Avatar string `json:"avatar,omitempty"`
// Icon is a Lucide icon name; pairs with AvatarGradient for the
// frontend's circular agent badge.
Icon string `json:"icon,omitempty"`
// AvatarGradient is a 2-stop CSS color array, e.g. ["#EF4444", "#DC2626"].
AvatarGradient []string `json:"avatar_gradient,omitempty"`
// IsOrchestrator is true when this agent is the tenant's configured
// orchestrator (the "main agent" — Iris by default, renamable per
// tenant). Lets frontends mark the orchestrator with special
// affordances ("talk to your orchestrator" surface) without
// hardcoding the name.
IsOrchestrator bool `json:"is_orchestrator,omitempty"`
// IsBuilder is true when this agent is the tenant's configured
// builder (Hera by default; in Apex tenants this is always "apex").
// Internal meta-agent — typically filtered out of public listings.
IsBuilder bool `json:"is_builder,omitempty"`
Model string `json:"model,omitempty"`
System string `json:"system,omitempty"`
Tools []string `json:"tools,omitempty"`
Team []string `json:"team,omitempty"`
Triggers []dsl.TriggerDef `json:"triggers,omitempty"`
ProcessID string `json:"process_id,omitempty"`
// Status is the high-level agent lifecycle state. Always present.
Status AgentStatus `json:"status"`
// Health is the orthogonal "is anything wrong?" signal. Always present.
Health AgentHealth `json:"health"`
Streaming bool `json:"streaming,omitempty"`
Source string `json:"source,omitempty"`
// CreatedAt is when the agent was first persisted (composed agents) or
// the server start time (YAML agents). Pointer so untracked agents omit.
CreatedAt *time.Time `json:"created_at,omitempty"`
// UpdatedAt is the last time the agent definition changed.
UpdatedAt *time.Time `json:"updated_at,omitempty"`
// LastActivity is the most recent moment the agent's running process
// did work (last token, last tool call). Nil if the agent has never run.
LastActivity *time.Time `json:"last_activity,omitempty"`
// Stats is the per-agent kanban task summary. Always present; zero
// values mean "no tasks" rather than "not implemented."
Stats AgentStatsResponse `json:"stats"`
// ReportsTo lists the agents whose `team` includes this agent — i.e.
// the agent's supervisors. Inverse direction of `team`. Computed from
// the document at request time.
ReportsTo []string `json:"reports_to,omitempty"`
}
AgentResponse is the API representation of an agent definition.
type AgentRoutineResponse ¶ added in v0.6.0
type AgentRoutineResponse struct {
ID string `json:"id"`
Agent string `json:"agent"`
Title string `json:"title"`
Instructions string `json:"instructions"`
Schedule Schedule `json:"schedule"`
// Cron is the derived expression — exposed for FE debugging and for
// jobs created via DSL/legacy paths where the structured Schedule
// can't be reconstructed.
Cron string `json:"cron"`
Enabled bool `json:"enabled"`
LastRunAt *time.Time `json:"last_run_at"`
NextRunAt *time.Time `json:"next_run_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
AgentRoutineResponse is the wire shape returned by the per-agent schedules endpoints. Mirrors apex-host-mgmt's AgentRoutine type so the FE can render the Routines tab without any client-side conversion.
type AgentSpendResponse ¶ added in v0.6.0
type AgentSpendResponse struct {
Agent string `json:"agent"`
ObservedSpend float64 `json:"observed_spend"`
Period string `json:"period"`
PeriodStart time.Time `json:"period_start"`
PeriodEnd time.Time `json:"period_end"`
}
AgentSpendResponse is the wire shape for the per-agent spend rollup endpoint (refs govega#47). Aggregates cost_usd across the latest snapshot of every process for the agent within the queried period.
type AgentStatsResponse ¶ added in v0.6.0
type AgentStatsResponse struct {
AssignedTasks int `json:"assigned_tasks"`
CompletedTasks int `json:"completed_tasks"`
SuccessRate *float64 `json:"success_rate"`
}
AgentStatsResponse aggregates per-agent kanban task counters. Computed from the tasks table at request time. SuccessRate is nil if there are no terminal tasks (done + canceled = 0) so the frontend can render a "—" rather than a misleading 0%.
type AgentStatus ¶ added in v0.6.0
type AgentStatus string
AgentStatus is the high-level lifecycle state of an agent surfaced to the API. Distinct from the underlying vega.Process state machine: this answers "should the user think this agent is busy / broken?" rather than "what state is the underlying conversation in?".
govega's process model has no provisioning/paused/stopping concepts (those are deployment-tier states), so this enum is intentionally a subset of the apex-host-mgmt mental model. New states will be added additively as govega's lifecycle grows.
const ( // AgentStatusIdle: agent is defined but has no active work in flight. // Includes "never spawned," "pending spawn," and "completed last task." AgentStatusIdle AgentStatus = "idle" // AgentStatusRunning: process is actively working on a task right now. AgentStatusRunning AgentStatus = "running" // AgentStatusError: last terminal state was a failure or timeout. AgentStatusError AgentStatus = "error" // AgentStatusProvisioning: agent record exists but the underlying // environment isn't ready to accept work yet (workspace setup, // dependency install, MCP boot, first-run hooks). RESERVED — govega // currently creates agents synchronously and never emits this value. // Frontends can handle it today as future-stable for when async // creation lands; until then the POST /agents response duration // covers the provisioning window. (refs #53) AgentStatusProvisioning AgentStatus = "provisioning" )
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"`
Description string `json:"description,omitempty"`
Avatar string `json:"avatar,omitempty"`
Icon string `json:"icon,omitempty"`
AvatarGradient []string `json:"avatar_gradient,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 AgentToolsResponse ¶ added in v0.6.0
AgentToolsResponse is the response from a per-agent tool toggle. It returns the agent's full current tool list so the FE can confirm the new state without a follow-up GET.
type AuthClaims ¶ added in v0.5.1
AuthClaims is the validated identity injected into request context. Handlers retrieve it via ClaimsFrom(r.Context()).
func ClaimsFrom ¶ added in v0.5.1
func ClaimsFrom(ctx context.Context) (AuthClaims, bool)
ClaimsFrom returns the validated claims attached to ctx, if any. ok==false means the request did not pass through authMiddleware (or the middleware was in self-hosted no-auth mode).
type AuthConfig ¶ added in v0.5.1
type AuthConfig struct {
// Issuer is the expected `iss` claim (WorkOS issuer URL in production).
Issuer string
// TenantID is the expected `aud` claim. Empty disables auth (self-hosted).
TenantID string
// Keyfunc supplies the public key for signature verification. In
// production this is a JWKS-backed Keyfunc; in tests it can return a
// fixed *rsa.PublicKey.
Keyfunc jwt.Keyfunc
}
AuthConfig is consumed by authMiddleware. Issuer + TenantID match the iss and aud claims; Keyfunc returns the public key for signature verification.
func LoadAuthConfig ¶ added in v0.5.1
func LoadAuthConfig(ctx context.Context) (AuthConfig, error)
LoadAuthConfig builds an AuthConfig from environment. VEGA_TENANT_ID empty => self-hosted pass-through (zero-valued config). Otherwise VEGA_JWT_ISSUER and VEGA_JWKS_URL are required.
The legacy APEX_-prefixed names (APEX_TENANT_ID, APEX_JWT_ISSUER, APEX_JWKS_URL) are still honored as a fallback, with a one-time deprecation warning per process so existing apex deployments keep working while operators migrate.
The Keyfunc is backed by MicahParks/keyfunc/v3, which auto-refreshes the JWKS in the background; pass ctx to bound its lifetime to the server.
func (AuthConfig) Verify ¶ added in v0.5.1
func (cfg AuthConfig) Verify(token, requirePurpose string) (jwt.MapClaims, error)
Verify validates a JWT against this AuthConfig's issuer/audience/key expectations and returns its claims. It is the seam for handlers that live outside the /api/v1 middleware (e.g. the Gmail OAuth handoff, which arrives via redirect with a query-param token).
requirePurpose, if non-empty, additionally requires the token's "purpose" claim to match exactly. Pass "" to skip the check (e.g. for plain access-token validation).
Returns an error on any validation failure, including when called on a zero-valued AuthConfig (self-hosted mode) — callers must not treat an unconfigured Verify as success.
type BackfillReport ¶ added in v0.7.13
type BackfillReport struct {
JustApplied bool
AlreadyApplied bool
PagesWritten int
UsersTouched int
}
BackfillReport summarises what a backfill run did. UsersTouched counts the number of distinct user_ids that received a user-scope page.
type BlobStore ¶ added in v0.6.0
type BlobStore interface {
// Put writes content under key, overwriting any existing value.
Put(key string, content []byte) error
// Get returns the content stored at key, or os.ErrNotExist when
// the key has no value.
Get(key string) ([]byte, error)
// Delete removes the value at key. Returns nil whether the key
// existed or not — idempotent.
Delete(key string) error
}
BlobStore is the abstract object-storage surface for content that shouldn't live in the relational database — today, agent brain files (govega#43), eventually chat attachments (#48) and anything else that outgrows BLOB / BYTEA inline storage (refs govega#61 phase 5).
The interface is deliberately narrow: opaque key, bytes in, bytes out. Keys are caller-chosen (the brain handler uses each file's `brain_<hex>` id) so this interface doesn't need to invent its own naming scheme.
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 CallerResolver ¶ added in v0.7.13
CallerResolver enriches a context with the identity of the user a piece of background work is being run on behalf of, so downstream code (LLM clients, tools) can look up per-user credentials.
Background paths — the scheduler tick, Telegram inbound, peering inbound — don't pass through HTTP auth middleware, so they have no AuthClaims or BYOK key attached to ctx. They call a registered CallerResolver to get an enriched context with the same shape an authenticated HTTP request would carry.
userID names the apex/govega user the work belongs to. A resolver MAY ignore the argument and use a configured default — useful for single-user-per-tenant deployments where every background op is run as the tenant owner.
A nil resolver is a no-op: callers MUST treat nil as "leave ctx unchanged" rather than calling. This keeps self-hosted deployments (no BYOK, no per-user keys) working without any resolver registered.
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"`
UpdatedAt time.Time `json:"updated_at"`
MessageCount int `json:"message_count"`
UnreadCount int `json:"unread_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"`
Sender string `json:"sender,omitempty"`
Role string `json:"role,omitempty"`
Content string `json:"content,omitempty"`
Delta string `json:"delta,omitempty"`
// Tool-call fields — parity with ChatStreamEvent. Already on the wire
// in the channel stream; documenting them on the schema (refs #55).
ToolCallID string `json:"tool_call_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
Arguments map[string]any `json:"arguments,omitempty"`
Result string `json:"result,omitempty"`
DurationMs int64 `json:"duration_ms,omitempty"`
Error string `json:"error,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"`
Sender string `json:"sender,omitempty"`
Role string `json:"role"`
Content string `json:"content"`
Metadata string `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
// Icon / AvatarGradient are echoed from the sending agent so channel
// UIs don't need a separate /api/v1/agents lookup to render identity.
Icon string `json:"icon,omitempty"`
AvatarGradient []string `json:"avatar_gradient,omitempty"`
// Thread summary fields — populated for top-level messages (ThreadID nil).
ReplyCount int `json:"reply_count,omitempty"`
LatestReplyAt *time.Time `json:"latest_reply_at,omitempty"`
// ReplySenders is the distinct list of sender names across all replies
// in the thread. Lets the channel list show "Riley and Alex replied"
// without a follow-up fetch per thread.
ReplySenders []string `json:"reply_senders,omitempty"`
// ToolActivities captures completed tool calls from the assistant
// turn that produced this message. Empty for user messages.
ToolActivities []vega.ToolActivity `json:"tool_activities,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 {
ID int64 `json:"id"`
Role string `json:"role"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
// ToolActivities captures completed tool calls from the assistant
// turn that produced this message. Empty for user messages; populated
// for assistant messages that invoked tools during streaming.
ToolActivities []vega.ToolActivity `json:"tool_activities,omitempty"`
}
ChatMessage is a persisted chat message.
type ChatResponseReviewer ¶ added in v0.8.15
type ChatResponseReviewer func(ctx context.Context, agentName, baseAgent, userID, response string) string
ChatResponseReviewer screens a generated chat reply before delivery. See Config.ChatResponseReviewer. It returns the text to deliver, or "" for a no-op (deliver the original unchanged).
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"`
Description string `json:"description,omitempty"`
Avatar string `json:"avatar,omitempty"`
Icon string `json:"icon,omitempty"`
AvatarGradient []string `json:"avatar_gradient,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"`
Triggers []dsl.TriggerDef `json:"triggers,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ComposedAgent is a persisted agent created via the compose API.
type Config ¶
type Config struct {
// Version is the govega build version (e.g. "v0.7.15"), surfaced to
// the UI via GET /api/v1/tenant/config. Set by the CLI from the
// ldflags-injected main.version; empty ("dev") when unset.
Version string
Addr string
DBPath string
// DBKind picks the persistence backend. Defaults to SQLite when empty.
DBKind DBKind
// DBURL is the Postgres connection URL when DBKind == "postgres"
// (e.g. postgres://user:pass@host:5432/db?sslmode=require). Ignored
// for SQLite.
DBURL string
// BlobDir, when non-empty, enables the FilesystemBlobStore at the
// supplied path (refs govega#61 phase 5). When empty, blob-bearing
// resources (agent brain files) keep their content inline in the
// relational DB — preserving the zero-config default. Set this on
// hosted Postgres deployments so brain content stays out of the
// DB and on the filesystem (or, future, an S3-compatible store).
BlobDir string
TelegramToken string // TELEGRAM_BOT_TOKEN; leave empty to disable
TelegramAgent string // TELEGRAM_AGENT; defaults to first agent if empty
DiscordToken string // DISCORD_BOT_TOKEN; leave empty to disable
DiscordAgent string // DISCORD_AGENT; defaults to orchestrator if empty
Company *dsl.Company // optional company identity (env var overrides)
// PublicURL is the externally-reachable base URL of this server (no
// trailing slash), used to build OAuth redirect URIs that match what
// operators register in their identity-provider consoles, and the
// workspace deliverable links agents hand to users. When empty, the
// PUBLIC_URL env var is honored so embedders that don't wire this
// field still report reachable links on hosted instances; the OAuth
// redirect URI is otherwise inferred from the incoming request's Host
// header and X-Forwarded-Proto — which works for laptops but not
// behind some reverse proxies. Set this on any deployed instance.
PublicURL string
// Orchestrator/Builder identify the meta-agents used for routing,
// scheduling, and UI affordances. Default to "iris"/"hera" — apps
// embedding govega can override to rebrand.
Orchestrator dsl.IrisConfig
Builder dsl.HeraConfig
// FrontendFS lets a downstream consumer embed its own React build
// instead of govega's bundled UI. When nil, the bundled frontend is
// served from serve/builtinui.
FrontendFS fs.FS
// Store, when non-nil, is used as the persistence layer instead of
// opening a SQLite database from DBPath. Useful for tests (in-memory
// or temp-file stores) and for embedding products that want to
// supply a different backend.
Store Store
// Middleware is applied between govega's authMiddleware and the mux
// (i.e. as the innermost layer before route handlers run). Embedding
// products use this to inject identity from non-JWT sources via
// WithClaims, enforce shared-secret headers from trusted proxies,
// stash request-scoped data in the context, etc.
//
// The slice is composed left-to-right: Middleware[0] wraps everything
// inside it, so the first entry runs outermost relative to the rest.
Middleware []func(http.Handler) http.Handler
// SessionedAgents names agents that should get per-session isolation. For
// such an agent, a chat URL of the form "<agent>:<session>" spawns a
// per-session clone with its own process and chat thread (and, when the
// product sets per-request claims, its own memory namespace) instead of
// collapsing to the base agent. Products set this for a guest-facing agent
// so each guest link is an isolated conversation. Nil/empty preserves the
// single-thread-per-agent behavior for every agent.
SessionedAgents map[string]bool
// ExtraSystemProvider, when non-nil, supplies additional system-prompt
// content on every chat turn — appended after the standard
// memory/project/company blocks. Use this to inject per-session
// context that the agent's static configuration can't express,
// e.g. looking up a per-book writing norm from an external service
// based on the cloned agent name. Return "" for a no-op.
//
// The callback runs on the chat hot path: keep it fast and cache
// where appropriate.
ExtraSystemProvider ExtraSystemProvider
// ChatResponseReviewer, when non-nil, receives the final assistant reply
// for a NON-STREAMING chat turn and returns the text actually delivered to
// (and persisted for) the user — unchanged if safe, or rewritten/redacted.
// Embedding products use this as a second-pass disclosure screen on
// guest-facing agents. It runs only on the non-streaming /chat path, so an
// agent that must be reviewed should be reachable only via /chat (not
// /chat/stream). Return "" for a no-op (keep the original).
//
// Runs on the chat hot path after generation: keep it reasonably fast.
ChatResponseReviewer ChatResponseReviewer
// WrapPeeringDispatcher, when non-nil, wraps the peering Dispatcher
// before it is wired to the AIRE node. Embedding products use this to
// add subject-keyed authorization (e.g. a LYRA gate verifying
// on-behalf-of credentials via peering.CallerAwareDispatcher) around
// the standard interpreter-backed dispatch. Applied only when peering
// is enabled (VEGA_PEERING_ADDR).
WrapPeeringDispatcher func(peering.Dispatcher) peering.Dispatcher
// OrchestratorExtraTools are additional tool names granted to the
// orchestrator's allow-list, on top of the built-in extras. Embedding
// products use this to expose a host-registered tool (e.g. a
// search_my_memory tool over an external memory store) to the agent the
// user actually chats with — registering the tool on the interpreter is
// not enough on its own, since a custom tool must also be in the agent's
// allow-list to be callable. The names must already be registered on the
// interpreter before Start.
OrchestratorExtraTools []string
}
Config holds server configuration.
type ConfigAgentInfo ¶ added in v0.4.0
type ConfigAgentInfo struct {
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Model string `json:"model"`
Tools []string `json:"tools,omitempty"`
Team []string `json:"team,omitempty"`
Source string `json:"source"` // "yaml", "composed", or "builtin"
}
ConfigAgentInfo is a summary of an agent for the config endpoint.
type ConfigMCPInfo ¶ added in v0.4.0
type ConfigMCPInfo struct {
Name string `json:"name"`
Connected bool `json:"connected"`
Transport string `json:"transport,omitempty"`
}
ConfigMCPInfo describes a connected MCP server.
type ConfigResponse ¶ added in v0.4.0
type ConfigResponse struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Agents []ConfigAgentInfo `json:"agents"`
MCPServers []ConfigMCPInfo `json:"mcp_servers"`
Settings *ConfigSettingsInfo `json:"settings,omitempty"`
}
ConfigResponse returns the current running configuration.
type ConfigSettingsInfo ¶ added in v0.4.0
type ConfigSettingsInfo struct {
DefaultModel string `json:"default_model,omitempty"`
}
ConfigSettingsInfo surfaces key settings.
type ConfigUploadResult ¶ added in v0.4.0
type ConfigUploadResult struct {
Name string `json:"name,omitempty"`
AgentsCreated []string `json:"agents_created,omitempty"`
AgentsUpdated []string `json:"agents_updated,omitempty"`
AgentsSkipped []string `json:"agents_skipped,omitempty"`
MCPConnected []string `json:"mcp_connected,omitempty"`
MCPFailed []string `json:"mcp_failed,omitempty"`
Errors []string `json:"errors,omitempty"`
}
ConfigUploadResult describes the outcome of a YAML config upload.
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"`
DisplayName string `json:"display_name,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Avatar string `json:"avatar,omitempty"`
Icon string `json:"icon,omitempty"`
AvatarGradient []string `json:"avatar_gradient,omitempty"`
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"`
Triggers []dsl.TriggerDef `json:"triggers,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"`
// Mode: "" (default — team-lead responds), "social" (all members
// respond to every message), or "reactive" (members respond when
// work-relevant). Defaults to "" if omitted.
Mode string `json:"mode,omitempty"`
}
CreateChannelRequest is the request to create a channel.
type CreateRoutineRequest ¶ added in v0.6.0
type CreateRoutineRequest struct {
Title string `json:"title"`
Instructions string `json:"instructions"`
Schedule Schedule `json:"schedule"`
// Enabled defaults to true when omitted.
Enabled *bool `json:"enabled,omitempty"`
}
CreateRoutineRequest is the POST body for creating a routine on an agent.
type CreateTaskRequest ¶ added in v0.6.0
type CreateTaskRequest struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
Status string `json:"status,omitempty"`
Priority string `json:"priority,omitempty"`
Assignee string `json:"assignee,omitempty"`
Tags string `json:"tags,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
DueAt *time.Time `json:"due_at,omitempty"`
}
CreateTaskRequest is the body of POST /api/v1/tasks.
type DBKind ¶ added in v0.6.0
type DBKind string
DBKind selects the persistence backend (refs govega#61). Empty / "sqlite" stays the zero-config default and reads/writes a single file from DBPath. "postgres" routes through DBURL and is the right choice for hosted, multi-writer deployments where SQLite's single-writer model bites.
type DiscordBot ¶ added in v0.7.15
type DiscordBot struct {
// contains filtered or unexported fields
}
DiscordBot handles incoming Discord messages via the gateway websocket and routes them to a vega agent, storing history in the same store as the HTTP chat API. It responds to all direct messages and, in guild channels, only when the bot is mentioned.
func NewDiscordBot ¶ added in v0.7.15
func NewDiscordBot(token, agentName string, interp *dsl.Interpreter, store Store, company *dsl.Company, onExchange func(ctx context.Context, userID, agent, userMsg, response string), onIncoming func(agentName string, target dsl.ReplyTarget)) (*DiscordBot, error)
NewDiscordBot creates a DiscordBot connected to the given token. It does not open the gateway session — call Open for that. onExchange is called after each successful exchange (the serve layer wires it to the memory curator).
func (*DiscordBot) Open ¶ added in v0.7.15
func (d *DiscordBot) Open() error
Open connects the gateway session and begins receiving events.
func (*DiscordBot) SetAllowedUsers ¶ added in v0.7.17
func (d *DiscordBot) SetAllowedUsers(ids []string)
SetAllowedUsers restricts which Discord user IDs the bot will respond to. An empty list means open access.
func (*DiscordBot) SetCallerResolver ¶ added in v0.7.15
func (d *DiscordBot) SetCallerResolver(r CallerResolver)
SetCallerResolver registers a CallerResolver applied to the dispatch context before SendToAgent on every inbound Discord message. Pass nil to clear.
func (*DiscordBot) Stop ¶ added in v0.7.15
func (d *DiscordBot) Stop()
Stop closes the gateway session.
type DiscordBotConfig ¶ added in v0.7.15
type DiscordBotConfig struct {
ID string `json:"id"`
Token string `json:"token"`
Agent string `json:"agent"`
Label string `json:"label,omitempty"`
// AllowedUsers restricts which Discord user IDs may talk to the bot.
// Empty means open access (backward compatible). Set it to lock the bot
// to its owner so strangers in shared guilds can't share the owner's
// conversation.
AllowedUsers []string `json:"allowed_users,omitempty"`
}
DiscordBotConfig persists the user's choice for a single bot. ID is the bot's numeric snowflake, derived from the token (see discordBotIDFromToken) so it's stable and knowable without opening a gateway session. Label is optional, lets users distinguish bots in the UI.
type DiscordBotStatus ¶ added in v0.7.15
type DiscordBotStatus struct {
ID string `json:"id"`
Label string `json:"label,omitempty"`
Agent string `json:"agent"`
Running bool `json:"running"`
}
DiscordBotStatus is the public-safe view of a single bot — no token.
type ErrorResponse ¶
ErrorResponse is returned on API errors.
type EventBroker ¶
type EventBroker struct {
// contains filtered or unexported fields
}
EventBroker fans out events to SSE subscribers.
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 ExtraSystemProvider ¶ added in v0.6.0
ExtraSystemProvider returns additional system-prompt content for a given chat session. See Config.ExtraSystemProvider for details.
- agentName is the full (possibly cloned) name, e.g. "guide:user_abc:my-book".
- baseAgent is the un-namespaced agent name, e.g. "guide".
- userID is the authenticated user (empty in self-hosted mode).
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 FilesystemBlobStore ¶ added in v0.6.0
type FilesystemBlobStore struct {
// contains filtered or unexported fields
}
FilesystemBlobStore writes blobs as files under a base directory. Used for dev / single-host installs. Keys are passed through filepath.Clean and rejected if they would escape the base — same protection the brain handler already does on filenames, applied belt-and-braces here so this layer is safe on its own.
func NewFilesystemBlobStore ¶ added in v0.6.0
func NewFilesystemBlobStore(dir string) (*FilesystemBlobStore, error)
NewFilesystemBlobStore returns a store rooted at dir. The directory is created with 0700 if missing.
func (*FilesystemBlobStore) Delete ¶ added in v0.6.0
func (fs *FilesystemBlobStore) Delete(key string) error
type GmailStatus ¶ added in v0.5.1
type GmailStatus struct {
Connected bool `json:"connected"`
HasClientID bool `json:"has_client_id"`
HasClientSecret bool `json:"has_client_secret"`
HasRefreshToken bool `json:"has_refresh_token"`
}
GmailStatus describes the current Gmail builtin server state for the integrations API. The fields mirror the keys we read at runtime.
type IdentityResponse ¶ added in v0.5.0
type IdentityResponse struct {
Orchestrator AgentIdentity `json:"orchestrator"`
Builder AgentIdentity `json:"builder"`
ProductName string `json:"product_name"`
}
IdentityResponse describes the configured meta-agent identities so the frontend can render role names without hardcoding "iris"/"hera".
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"`
TriageCount int `json:"triage_count"`
LastTriagedAt *time.Time `json:"last_triaged_at,omitempty"`
}
InboxItem is a message posted to Iris'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 InviteDTO ¶ added in v0.7.13
InviteDTO is the shape both sides exchange to set up a peer relationship. All three fields are required for the recipient to dial back and prove possession of the shared secret. Format is intentionally JSON so users can copy-paste over any secure channel (Signal, encrypted email, etc.).
type LinkTaskProcessRequest ¶ added in v0.6.0
type LinkTaskProcessRequest struct {
ProcessID string `json:"process_id"`
}
LinkTaskProcessRequest is the body of POST /api/v1/tasks/{id}/processes.
type LocalAppHost ¶ added in v0.8.8
type LocalAppHost struct {
// contains filtered or unexported fields
}
LocalAppHost is the vendor-neutral default AppHost: it hosts apps on the Vega machine itself and reverse-proxies them under /apps/<name>/ on the Vega server. Because it rides the server the user already reaches, it works with zero external vendor for local dev, self-hosted-remote, and (routed through the edge) v39a. Static apps are served straight from the workspace; dynamic apps run as a subprocess and are proxied.
See docs/app-hosting-design.md. Visibility enforcement (capability tokens) is layered on separately (Phase 2 of #116); this type handles hosting + routing.
func NewLocalAppHost ¶ added in v0.8.8
func NewLocalAppHost(workspace string) *LocalAppHost
NewLocalAppHost roots the host at the given workspace directory.
func (*LocalAppHost) Deploy ¶ added in v0.8.8
func (h *LocalAppHost) Deploy(ctx context.Context, spec tools.AppSpec) (tools.AppDeployment, error)
Deploy hosts an app. Empty spec.Command ⇒ static file serving from the source dir; otherwise the command is started as a subprocess and proxied.
func (*LocalAppHost) Destroy ¶ added in v0.8.8
func (h *LocalAppHost) Destroy(ctx context.Context, id string) error
Destroy stops and removes a deployment.
func (*LocalAppHost) List ¶ added in v0.8.8
func (h *LocalAppHost) List(ctx context.Context) ([]tools.AppDeployment, error)
List returns the active deployments.
func (*LocalAppHost) ServeHTTP ¶ added in v0.8.8
func (h *LocalAppHost) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP dispatches /apps/<name>/… to the matching deployment: a file server for static apps, a reverse proxy for dynamic ones.
func (*LocalAppHost) SetBaseURL ¶ added in v0.8.8
func (h *LocalAppHost) SetBaseURL(u string)
SetBaseURL records the externally-reachable base URL used to build app URLs. Called once the listener has resolved its address.
func (*LocalAppHost) SetSigner ¶ added in v0.8.8
func (h *LocalAppHost) SetSigner(s *capabilitySigner)
SetSigner wires the capability-token signer. When set, app URLs are signed and the /apps/ route is gated; nil keeps open mode.
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"`
// Icon is a Lucide icon name for the FE's integrations grid
// (refs govega#44). Empty for entries that haven't been tagged.
Icon string `json:"icon,omitempty"`
// Category groups integrations on the FE. Suggested taxonomy:
// communication, dev_tools, crm, project_mgmt, cloud, data,
// productivity, web. Empty for uncategorized.
Category string `json:"category,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"`
// Editable is true only when the server has a stored config row (i.e. it
// was added via the UI/API). Servers auto-connected from the built-in
// registry via env vars have no editable config; the FE hides Edit for
// them and shows they're configured via the environment instead.
Editable bool `json:"editable"`
}
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"`
Type MemoryType `json:"type"`
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 MemoryLink ¶ added in v0.7.0
type MemoryLink struct {
Scope MemoryScope `json:"scope"`
ScopeID string `json:"scope_id"`
UserID string `json:"user_id"`
FromPath string `json:"from_path"`
ToPath string `json:"to_path"`
}
MemoryLink is a directed link between two memory pages, extracted from a page's content at write time. Drives the graph endpoint.
type MemoryPage ¶ added in v0.7.0
type MemoryPage struct {
Scope MemoryScope `json:"scope"`
ScopeID string `json:"scope_id"`
UserID string `json:"user_id"`
Path string `json:"path"`
Content string `json:"content"`
Frontmatter string `json:"frontmatter,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
MemoryPage is a single page in a wiki-style memory store. Path is a logical slash-separated address (e.g. "MEMORY.md", "topics/sushi.md"), not a filesystem path. Refs govega#71.
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 MemoryScope ¶ added in v0.7.0
type MemoryScope string
MemoryScope distinguishes a shared-user wiki from a per-agent working-notes wiki. Refs govega#71.
const ( // MemoryScopeUser is the shared wiki for a user, readable and // writable by every agent that talks to them. ScopeID equals UserID. MemoryScopeUser MemoryScope = "user" // MemoryScopeAgent is an agent's private working notes about a // specific user. ScopeID is the agent name; UserID is the user the // notes pertain to. MemoryScopeAgent MemoryScope = "agent" )
type MemoryType ¶ added in v0.5.1
type MemoryType string
MemoryType discriminates between memory categories so the agent can retrieve the right kind for the moment. Mirrors the four-class scheme used by Claude Code's auto-memory system.
const ( // MemoryTypeUser captures stable facts about who the user is, their // role, and how they prefer to work. MemoryTypeUser MemoryType = "user" // MemoryTypeFeedback captures corrections and confirmations the user // has given the agent (rules of engagement, validated approaches). MemoryTypeFeedback MemoryType = "feedback" // MemoryTypeProject captures context about ongoing work, decisions, // and motivations behind the current task. MemoryTypeProject MemoryType = "project" // MemoryTypeReference captures pointers to external systems and // documents — the catch-all default when no other type fits. MemoryTypeReference MemoryType = "reference" )
func (MemoryType) Validate ¶ added in v0.5.1
func (t MemoryType) Validate() error
Validate reports whether the type is one of the four canonical values. Empty strings and case variants are rejected so a typo at the boundary fails fast rather than silently becoming a fifth type.
type MessageResponse ¶
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 MigrationReport ¶ added in v0.7.0
type MigrationReport struct {
JustApplied bool
AlreadyApplied bool
PagesWritten int
Users int
AgentsTouched int
}
MigrationReport summarizes what a migration run did. PagesWritten counts shared + agent pages combined. Exactly one of JustApplied / AlreadyApplied is true.
type MiraConfig ¶ added in v0.7.0
type MiraConfig struct {
Name string
DisplayName string
Title string
Model string
FallbackModel string
}
MiraConfig holds the configurable bits of the curator agent. Mirror of HeraConfig / IrisConfig.
func DefaultMiraConfig ¶ added in v0.7.0
func DefaultMiraConfig() MiraConfig
DefaultMiraConfig returns the standard Mira persona.
type PeeringStatusResponse ¶ added in v0.7.13
type PeeringStatusResponse struct {
Enabled bool `json:"enabled"`
NodeID string `json:"node_id"`
ListenAddr string `json:"listen_addr"`
PeerCount int `json:"peer_count"`
}
PeeringStatusResponse is what the header pill polls. NodeID is shown read-only in the modal so the user can share it during peer setup.
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 PostgresStore ¶ added in v0.6.0
type PostgresStore struct {
// contains filtered or unexported fields
}
PostgresStore implements Store on top of Postgres.
func NewPostgresStore ¶ added in v0.6.0
func NewPostgresStore(url string) (*PostgresStore, error)
NewPostgresStore opens a connection pool against the supplied URL (postgres:// scheme). Pings once to fail fast on a bad URL.
func (*PostgresStore) AddTaskComment ¶ added in v0.6.0
func (s *PostgresStore) AddTaskComment(taskID, author, content string) (int64, error)
func (*PostgresStore) AgentSpendInPeriod ¶ added in v0.6.0
func (*PostgresStore) AssignTask ¶ added in v0.6.0
func (s *PostgresStore) AssignTask(id, assignee string) error
func (*PostgresStore) ChatUnreadCounts ¶ added in v0.6.0
func (s *PostgresStore) ChatUnreadCounts(userID string) (map[string]int, error)
func (*PostgresStore) ClaimTask ¶ added in v0.6.0
func (s *PostgresStore) ClaimTask(id, assignee string) error
func (*PostgresStore) Close ¶ added in v0.6.0
func (s *PostgresStore) Close() error
Close shuts down the connection pool.
func (*PostgresStore) CreateChannel ¶ added in v0.6.0
func (s *PostgresStore) CreateChannel(id, name, description, createdBy string, team []string, mode string) error
func (*PostgresStore) DeleteAgentBrainFile ¶ added in v0.6.0
func (s *PostgresStore) DeleteAgentBrainFile(agentName, id string) error
func (*PostgresStore) DeleteChannel ¶ added in v0.6.0
func (s *PostgresStore) DeleteChannel(name string) error
func (*PostgresStore) DeleteChatMessages ¶ added in v0.6.0
func (s *PostgresStore) DeleteChatMessages(agent string) error
func (*PostgresStore) DeleteComposedAgent ¶ added in v0.6.0
func (s *PostgresStore) DeleteComposedAgent(name string) error
func (*PostgresStore) DeleteInboxItem ¶ added in v0.7.13
func (s *PostgresStore) DeleteInboxItem(id int64) error
DeleteInboxItem removes a single inbox item by id. Cascading FK on inbox_replies handles reply cleanup. Returns sql.ErrNoRows when no row matched.
func (*PostgresStore) DeleteMCPServer ¶ added in v0.8.0
func (s *PostgresStore) DeleteMCPServer(name string) error
DeleteMCPServer removes a persisted MCP server connection.
func (*PostgresStore) DeleteMemoryItem ¶ added in v0.6.0
func (s *PostgresStore) DeleteMemoryItem(id int64) error
func (*PostgresStore) DeleteMemoryPage ¶ added in v0.7.0
func (s *PostgresStore) DeleteMemoryPage(scope MemoryScope, scopeID, userID, path string) error
func (*PostgresStore) DeletePromptHistory ¶ added in v0.6.0
func (s *PostgresStore) DeletePromptHistory(id int64) error
func (*PostgresStore) DeleteResolvedInboxItems ¶ added in v0.6.0
func (s *PostgresStore) DeleteResolvedInboxItems() (int64, error)
func (*PostgresStore) DeleteScheduledJob ¶ added in v0.6.0
func (s *PostgresStore) DeleteScheduledJob(name string) error
func (*PostgresStore) DeleteSetting ¶ added in v0.6.0
func (s *PostgresStore) DeleteSetting(key string) error
func (*PostgresStore) DeleteTask ¶ added in v0.6.0
func (s *PostgresStore) DeleteTask(id string) error
func (*PostgresStore) DeleteUserMemory ¶ added in v0.6.0
func (s *PostgresStore) DeleteUserMemory(userID, agent string) error
func (*PostgresStore) FindChannelForAgents ¶ added in v0.6.0
func (s *PostgresStore) FindChannelForAgents(agent1, agent2 string) (string, string, error)
func (*PostgresStore) GetAgentBrainFile ¶ added in v0.6.0
func (s *PostgresStore) GetAgentBrainFile(agentName, id string) (*AgentBrainFile, error)
func (*PostgresStore) GetAgentBudget ¶ added in v0.6.0
func (s *PostgresStore) GetAgentBudget(agentName string) (*AgentBudget, error)
func (*PostgresStore) GetChannel ¶ added in v0.6.0
func (s *PostgresStore) GetChannel(name string) (*Channel, error)
func (*PostgresStore) GetChannelByName ¶ added in v0.6.0
func (s *PostgresStore) GetChannelByName(name string) (*dsl.ChannelInfo, error)
func (*PostgresStore) GetInboxItem ¶ added in v0.6.0
func (s *PostgresStore) GetInboxItem(id int64) (*InboxItem, error)
func (*PostgresStore) GetMemoryPage ¶ added in v0.7.0
func (s *PostgresStore) GetMemoryPage(scope MemoryScope, scopeID, userID, path string) (*MemoryPage, error)
func (*PostgresStore) GetScheduledJobByID ¶ added in v0.6.0
func (s *PostgresStore) GetScheduledJobByID(id string) (*ScheduledJob, error)
func (*PostgresStore) GetSetting ¶ added in v0.6.0
func (s *PostgresStore) GetSetting(key string) (*Setting, error)
func (*PostgresStore) GetTask ¶ added in v0.6.0
func (s *PostgresStore) GetTask(id string) (*Task, error)
func (*PostgresStore) GetUserMemory ¶ added in v0.6.0
func (s *PostgresStore) GetUserMemory(userID, agent string) ([]UserMemory, error)
func (*PostgresStore) Init ¶ added in v0.6.0
func (s *PostgresStore) Init() error
Init applies pending goose migrations from the embedded serve/migrations/postgres/ tree (refs govega#62). Replaces the pre-goose monolithic-schema approach. Idempotent — re-running on a current database advances goose_db_version by nothing.
func (*PostgresStore) InsertAgentBrainFile ¶ added in v0.6.0
func (s *PostgresStore) InsertAgentBrainFile(f AgentBrainFile) error
func (*PostgresStore) InsertChannelMessage ¶ added in v0.6.0
func (s *PostgresStore) InsertChannelMessage(channelID, agent, role, content string, threadID *int64, metadata, sender string, activities []vega.ToolActivity) (int64, error)
func (*PostgresStore) InsertChatMessage ¶ added in v0.6.0
func (s *PostgresStore) InsertChatMessage(agent, role, content string, activities []vega.ToolActivity) error
func (*PostgresStore) InsertComposedAgent ¶ added in v0.6.0
func (s *PostgresStore) InsertComposedAgent(a ComposedAgent) error
func (*PostgresStore) InsertEvent ¶ added in v0.6.0
func (s *PostgresStore) InsertEvent(e StoreEvent) error
func (*PostgresStore) InsertInboxItem ¶ added in v0.6.0
func (s *PostgresStore) InsertInboxItem(fromAgent, subject, body, priority string) (int64, error)
func (*PostgresStore) InsertMemoryItem ¶ added in v0.6.0
func (s *PostgresStore) InsertMemoryItem(item MemoryItem) (int64, error)
func (*PostgresStore) InsertProcessSnapshot ¶ added in v0.6.0
func (s *PostgresStore) InsertProcessSnapshot(snap ProcessSnapshot) error
func (*PostgresStore) InsertPromptHistory ¶ added in v0.6.0
func (s *PostgresStore) InsertPromptHistory(prompt string) (int64, error)
func (*PostgresStore) InsertResolvedInboxItem ¶ added in v0.7.13
func (s *PostgresStore) InsertResolvedInboxItem(fromAgent, subject, body, resolution string) (int64, error)
InsertResolvedInboxItem inserts an item already marked resolved. Used for auto-success dispatch outcomes that don't need orchestrator triage. Mirrors the sqlite implementation.
func (*PostgresStore) InsertTask ¶ added in v0.6.0
func (s *PostgresStore) InsertTask(t Task) error
func (*PostgresStore) InsertWorkflowRun ¶ added in v0.6.0
func (s *PostgresStore) InsertWorkflowRun(r WorkflowRun) error
func (*PostgresStore) InsertWorkspaceFile ¶ added in v0.6.0
func (s *PostgresStore) InsertWorkspaceFile(f WorkspaceFile) error
func (*PostgresStore) LinkTaskProcess ¶ added in v0.6.0
func (s *PostgresStore) LinkTaskProcess(taskID, processID string) error
func (*PostgresStore) ListAgentBrainFiles ¶ added in v0.6.0
func (s *PostgresStore) ListAgentBrainFiles(agentName string) ([]AgentBrainFile, error)
func (*PostgresStore) ListAllChannels ¶ added in v0.6.0
func (s *PostgresStore) ListAllChannels() ([]dsl.ChannelInfo, error)
func (*PostgresStore) ListAllMemoryItems ¶ added in v0.7.0
func (s *PostgresStore) ListAllMemoryItems() ([]MemoryItem, error)
ListAllMemoryItems is a migration helper — see SQLiteStore counterpart.
func (*PostgresStore) ListAllUserMemory ¶ added in v0.7.0
func (s *PostgresStore) ListAllUserMemory() ([]UserMemory, error)
ListAllUserMemory is a migration helper — see SQLiteStore counterpart.
func (*PostgresStore) ListChannelMessages ¶ added in v0.6.0
func (s *PostgresStore) ListChannelMessages(channelID string, limit int) ([]ChannelMessage, error)
func (*PostgresStore) ListChannels ¶ added in v0.6.0
func (s *PostgresStore) ListChannels(userID string) ([]Channel, error)
func (*PostgresStore) ListChannelsForAgent ¶ added in v0.6.0
func (s *PostgresStore) ListChannelsForAgent(agent string) ([]dsl.ChannelInfo, error)
func (*PostgresStore) ListChatMessages ¶ added in v0.6.0
func (s *PostgresStore) ListChatMessages(agent string) ([]ChatMessage, error)
func (*PostgresStore) ListComposedAgents ¶ added in v0.6.0
func (s *PostgresStore) ListComposedAgents() ([]ComposedAgent, error)
func (*PostgresStore) ListEvents ¶ added in v0.6.0
func (s *PostgresStore) ListEvents(limit int) ([]StoreEvent, error)
func (*PostgresStore) ListInboxItems ¶ added in v0.6.0
func (s *PostgresStore) ListInboxItems(status string, limit int) ([]InboxItem, error)
func (*PostgresStore) ListMCPServers ¶ added in v0.8.0
func (s *PostgresStore) ListMCPServers() ([]MCPServerConfig, error)
ListMCPServers returns all persisted MCP server configs.
func (*PostgresStore) ListMemoryItemsByTopic ¶ added in v0.6.0
func (s *PostgresStore) ListMemoryItemsByTopic(userID, agent, topic string) ([]MemoryItem, error)
func (*PostgresStore) ListMemoryLinks ¶ added in v0.7.0
func (s *PostgresStore) ListMemoryLinks(scope MemoryScope, scopeID, userID string) ([]MemoryLink, error)
func (*PostgresStore) ListMemoryPages ¶ added in v0.7.0
func (s *PostgresStore) ListMemoryPages(scope MemoryScope, scopeID, userID, pathPrefix string) ([]MemoryPage, error)
func (*PostgresStore) ListMemoryScopeIDs ¶ added in v0.7.13
func (s *PostgresStore) ListMemoryScopeIDs(scope MemoryScope, userID string) ([]string, error)
func (*PostgresStore) ListMyTasks ¶ added in v0.6.0
func (*PostgresStore) ListProcessSnapshots ¶ added in v0.6.0
func (s *PostgresStore) ListProcessSnapshots() ([]ProcessSnapshot, error)
func (*PostgresStore) ListPromptHistory ¶ added in v0.6.0
func (s *PostgresStore) ListPromptHistory(limit int) ([]PromptHistoryItem, error)
func (*PostgresStore) ListScheduledJobs ¶ added in v0.6.0
func (s *PostgresStore) ListScheduledJobs() ([]ScheduledJob, error)
func (*PostgresStore) ListSettings ¶ added in v0.6.0
func (s *PostgresStore) ListSettings() ([]Setting, error)
func (*PostgresStore) ListTaskComments ¶ added in v0.6.0
func (s *PostgresStore) ListTaskComments(taskID string) ([]TaskComment, error)
func (*PostgresStore) ListTaskProcesses ¶ added in v0.6.0
func (s *PostgresStore) ListTaskProcesses(taskID string) ([]string, error)
func (*PostgresStore) ListTasks ¶ added in v0.6.0
func (s *PostgresStore) ListTasks(f TaskFilter) ([]Task, error)
func (*PostgresStore) ListThreadMessages ¶ added in v0.6.0
func (s *PostgresStore) ListThreadMessages(channelID string, threadID int64) ([]ChannelMessage, error)
func (*PostgresStore) ListUnassignedTasks ¶ added in v0.6.0
func (s *PostgresStore) ListUnassignedTasks(limit int) ([]Task, error)
func (*PostgresStore) ListWorkflowRuns ¶ added in v0.6.0
func (s *PostgresStore) ListWorkflowRuns(limit int) ([]WorkflowRun, error)
func (*PostgresStore) ListWorkspaceFileAgents ¶ added in v0.6.0
func (s *PostgresStore) ListWorkspaceFileAgents() ([]string, error)
func (*PostgresStore) ListWorkspaceFiles ¶ added in v0.6.0
func (s *PostgresStore) ListWorkspaceFiles(agent string) ([]WorkspaceFile, error)
func (*PostgresStore) MarkChannelRead ¶ added in v0.6.0
func (s *PostgresStore) MarkChannelRead(channelID, userID string) error
func (*PostgresStore) MarkChatRead ¶ added in v0.6.0
func (s *PostgresStore) MarkChatRead(agent, userID string) error
func (*PostgresStore) MarkScheduledJobRun ¶ added in v0.6.0
func (s *PostgresStore) MarkScheduledJobRun(name string, at time.Time) error
func (*PostgresStore) PeeringStore ¶ added in v0.7.13
func (s *PostgresStore) PeeringStore() peering.Store
PeeringStore returns a peering.Store backed by the same database. Mirror of SQLiteStore.PeeringStore. The peering tables are created by goose migration 00004_peering.sql which has already run by the time this is called.
func (*PostgresStore) RecentChannelMessages ¶ added in v0.6.0
func (s *PostgresStore) RecentChannelMessages(channelID string, limit int) ([]dsl.ChannelMessage, error)
func (*PostgresStore) ReconcileOrphanedWorkflowRuns ¶ added in v0.8.0
func (s *PostgresStore) ReconcileOrphanedWorkflowRuns() (int64, error)
ReconcileOrphanedWorkflowRuns marks runs stuck at 'running' as interrupted — at boot, any 'running' row died with the previous server.
func (*PostgresStore) RenameMemoryPage ¶ added in v0.7.0
func (s *PostgresStore) RenameMemoryPage(scope MemoryScope, scopeID, userID, oldPath, newPath string) error
func (*PostgresStore) ReplaceMemoryLinks ¶ added in v0.7.0
func (s *PostgresStore) ReplaceMemoryLinks(scope MemoryScope, scopeID, userID, fromPath string, toPaths []string) error
func (*PostgresStore) ResetData ¶ added in v0.6.0
func (s *PostgresStore) ResetData() error
ResetData clears every transient table but preserves settings + mcp_servers. Mirrors SQLiteStore.ResetData behavior.
func (*PostgresStore) ResolveInboxItem ¶ added in v0.6.0
func (s *PostgresStore) ResolveInboxItem(id int64, resolution string) error
func (*PostgresStore) SearchEvents ¶ added in v0.6.0
func (s *PostgresStore) SearchEvents(filter ActivityFilter) ([]StoreEvent, int, error)
func (*PostgresStore) SearchMemoryItems ¶ added in v0.6.0
func (s *PostgresStore) SearchMemoryItems(userID, agent, query string, limit int) ([]MemoryItem, error)
func (*PostgresStore) SearchMemoryItemsByType ¶ added in v0.6.0
func (s *PostgresStore) SearchMemoryItemsByType(userID, agent, query string, typ MemoryType, limit int) ([]MemoryItem, error)
func (*PostgresStore) SearchMemoryPages ¶ added in v0.7.0
func (s *PostgresStore) SearchMemoryPages(scope MemoryScope, scopeID, userID, query string, limit int) ([]MemoryPage, error)
func (*PostgresStore) SearchPromptHistory ¶ added in v0.6.0
func (s *PostgresStore) SearchPromptHistory(query string, limit int) ([]PromptHistoryItem, error)
func (*PostgresStore) SetMCPServerDisabled ¶ added in v0.8.0
func (s *PostgresStore) SetMCPServerDisabled(name string, disabled bool) error
SetMCPServerDisabled enables or disables a persisted MCP server.
func (*PostgresStore) SweepRetention ¶ added in v0.8.0
func (s *PostgresStore) SweepRetention(policy RetentionPolicy) (RetentionSweepResult, error)
SweepRetention deletes rows older than the per-table retention windows.
func (*PostgresStore) TaskStatsByAssignee ¶ added in v0.6.0
func (s *PostgresStore) TaskStatsByAssignee() (map[string]AgentStatsResponse, error)
func (*PostgresStore) TriageInboxItems ¶ added in v0.7.13
func (s *PostgresStore) TriageInboxItems(ids []int64, threshold int) ([]int64, error)
TriageInboxItems mirrors the sqlite implementation: increment-on-read for pending items, auto-resolve on threshold. See store_sqlite.go for the rationale.
func (*PostgresStore) UpdateChannelMeta ¶ added in v0.6.0
func (s *PostgresStore) UpdateChannelMeta(currentName string, newName, newDescription *string) error
func (*PostgresStore) UpdateChannelTeam ¶ added in v0.6.0
func (s *PostgresStore) UpdateChannelTeam(name string, team []string) error
func (*PostgresStore) UpdateTask ¶ added in v0.6.0
func (s *PostgresStore) UpdateTask(id string, u TaskUpdate) error
func (*PostgresStore) UpdateTaskStatus ¶ added in v0.6.0
func (s *PostgresStore) UpdateTaskStatus(id, status string) error
func (*PostgresStore) UpdateWorkflowRun ¶ added in v0.6.0
func (s *PostgresStore) UpdateWorkflowRun(runID, status, result string) error
func (*PostgresStore) UpdateWorkflowRunSteps ¶ added in v0.8.0
func (s *PostgresStore) UpdateWorkflowRunSteps(runID string, stepsJSON string) error
UpdateWorkflowRunSteps replaces the per-step checkpoint JSON on a run.
func (*PostgresStore) UpsertAgentBudget ¶ added in v0.6.0
func (s *PostgresStore) UpsertAgentBudget(b AgentBudget) error
func (*PostgresStore) UpsertMCPServer ¶ added in v0.8.0
func (s *PostgresStore) UpsertMCPServer(name, configJSON string) error
UpsertMCPServer persists an MCP server connection config.
func (*PostgresStore) UpsertMemoryPage ¶ added in v0.7.0
func (s *PostgresStore) UpsertMemoryPage(p MemoryPage) error
func (*PostgresStore) UpsertScheduledJob ¶ added in v0.6.0
func (s *PostgresStore) UpsertScheduledJob(job ScheduledJob) error
func (*PostgresStore) UpsertSetting ¶ added in v0.6.0
func (s *PostgresStore) UpsertSetting(st Setting) error
func (*PostgresStore) UpsertUserMemory ¶ added in v0.6.0
func (s *PostgresStore) UpsertUserMemory(userID, agent, layer, content string) error
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 iris.
type RecallEntry ¶ added in v0.7.13
type RecallEntry struct {
Scope MemoryScope `json:"scope"`
Path string `json:"path"`
Source RecallSource `json:"source"`
At time.Time `json:"at"`
}
RecallEntry is a single recall event in a turn's ledger. The fields are JSON-friendly so the chat handler can serialize the list directly into the response payload.
type RecallLedger ¶ added in v0.7.13
type RecallLedger struct {
// contains filtered or unexported fields
}
RecallLedger collects RecallEntry values during a single turn so the chat handler can surface them in the response payload. Safe for concurrent appends — the active-injection collector runs on the request goroutine but memory_read can fire from a tool-loop goroutine. Refs govega#100.
func NewRecallLedger ¶ added in v0.7.13
func NewRecallLedger() *RecallLedger
NewRecallLedger returns a fresh ledger ready to accept entries.
func RecallFromContext ¶ added in v0.7.13
func RecallFromContext(ctx context.Context) *RecallLedger
RecallFromContext returns the ledger attached to ctx, or nil when none is present. Callers must nil-check before appending; both RecallLedger.Add and Entries tolerate a nil receiver so callers can be tidy.
func (*RecallLedger) Add ¶ added in v0.7.13
func (l *RecallLedger) Add(e RecallEntry)
Add appends an entry. Stamps At with time.Now if the caller didn't fill it — the ledger is the authoritative timeline so callers shouldn't have to plumb a clock through every call site.
func (*RecallLedger) Entries ¶ added in v0.7.13
func (l *RecallLedger) Entries() []RecallEntry
Entries returns a copy of the recorded entries in append order.
type RecallSource ¶ added in v0.7.13
type RecallSource string
RecallSource indicates how a memory page made it into the agent's context for the current turn. "read" means the agent explicitly called memory_read; "active" means the page's `active: true` flag caused its body to be injected into the system prompt. Both flow to the same UI surface — the user sees "remembered from X" regardless of mechanism, which is the point: the experience is "Vega remembered," not "Vega read." Refs govega#100.
const ( RecallSourceRead RecallSource = "read" RecallSourceActive RecallSource = "active" )
type RetentionPolicy ¶ added in v0.8.0
type RetentionPolicy struct {
Events time.Duration
Snapshots time.Duration
ChatMessages time.Duration
}
StoreEvent is a persisted orchestration event. RetentionPolicy sets per-table retention windows for SweepRetention. A zero duration keeps that table's rows forever.
type RetentionSweepResult ¶ added in v0.8.0
RetentionSweepResult reports rows deleted per table by one sweep.
type RoutineFrequency ¶ added in v0.6.0
type RoutineFrequency string
RoutineFrequency mirrors the apex-host-mgmt frontend's RoutineFrequency enum (refs govega#52). Server-side conversion to cron lets the FE work with structured fields instead of parsing cron itself.
const ( FrequencyDaily RoutineFrequency = "daily" FrequencyWeekdays RoutineFrequency = "weekdays" FrequencyWeekly RoutineFrequency = "weekly" FrequencyBiweekly RoutineFrequency = "biweekly" FrequencyMonthly RoutineFrequency = "monthly" FrequencyCustom RoutineFrequency = "custom" )
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) AddTaskComment ¶ added in v0.6.0
func (s *SQLiteStore) AddTaskComment(taskID, author, content string) (int64, error)
AddTaskComment appends a comment and bumps the task's updated_at so list ordering reflects activity.
func (*SQLiteStore) AgentSpendInPeriod ¶ added in v0.6.0
AgentSpendInPeriod sums cost_usd across the latest snapshot of every process for agentName, optionally bounded by [from, to). Zero from/to is treated as unbounded on that side. Used by the per-agent spend rollup endpoint (refs govega#47) so the FE doesn't have to fan out /processes per agent to render the observed_spend column.
func (*SQLiteStore) AssignTask ¶ added in v0.6.0
func (s *SQLiteStore) AssignTask(id, assignee string) error
AssignTask sets the assignee without changing status. Used by the orchestrator to route an unassigned task to a worker; the worker decides when to start (claim_task → status='doing').
func (*SQLiteStore) ChatUnreadCounts ¶ added in v0.4.0
func (s *SQLiteStore) ChatUnreadCounts(userID string) (map[string]int, error)
ChatUnreadCounts returns a map of agent name → unread message count for DMs.
func (*SQLiteStore) ClaimTask ¶ added in v0.6.0
func (s *SQLiteStore) ClaimTask(id, assignee string) error
ClaimTask atomically assigns a task to the caller and moves it to 'doing'. The two updates happen in one transaction so a heartbeat crash mid-claim can't leave the board in a half-state.
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) DeleteAgentBrainFile ¶ added in v0.6.0
func (s *SQLiteStore) DeleteAgentBrainFile(agentName, id string) error
DeleteAgentBrainFile removes a brain file from agentName. Returns sql.ErrNoRows when the file doesn't exist on the agent.
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) DeleteInboxItem ¶ added in v0.7.13
func (s *SQLiteStore) DeleteInboxItem(id int64) error
DeleteInboxItem removes a single inbox item (and any replies) by id. Returns sql.ErrNoRows if nothing was deleted so HTTP handlers can map to 404.
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) DeleteMemoryPage ¶ added in v0.7.0
func (s *SQLiteStore) DeleteMemoryPage(scope MemoryScope, scopeID, userID, path string) error
DeleteMemoryPage removes one page and cascades through memory_links (rows where the page appears as from_path or to_path are also dropped). Missing page is a no-op.
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 (the cron-runner key).
func (*SQLiteStore) DeleteSetting ¶ added in v0.2.0
func (s *SQLiteStore) DeleteSetting(key string) error
DeleteSetting removes a setting by key.
func (*SQLiteStore) DeleteTask ¶ added in v0.6.0
func (s *SQLiteStore) DeleteTask(id string) error
DeleteTask removes a task and its comments / process links. The schema declares ON DELETE CASCADE, but SQLite enforces FKs only when the per-connection `foreign_keys` pragma is on — this codebase doesn't enable it globally, so we cascade by hand inside a transaction.
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) GetAgentBrainFile ¶ added in v0.6.0
func (s *SQLiteStore) GetAgentBrainFile(agentName, id string) (*AgentBrainFile, error)
GetAgentBrainFile returns one file (content included) when it belongs to agentName; returns nil, nil otherwise.
func (*SQLiteStore) GetAgentBudget ¶ added in v0.6.0
func (s *SQLiteStore) GetAgentBudget(agentName string) (*AgentBudget, error)
GetAgentBudget returns the persisted budget row for agentName, or (nil, nil) when the agent has no row. Refs govega#47.
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) GetMemoryPage ¶ added in v0.7.0
func (s *SQLiteStore) GetMemoryPage(scope MemoryScope, scopeID, userID, path string) (*MemoryPage, error)
GetMemoryPage returns one page, or nil when not found.
func (*SQLiteStore) GetScheduledJobByID ¶ added in v0.6.0
func (s *SQLiteStore) GetScheduledJobByID(id string) (*ScheduledJob, error)
GetScheduledJobByID returns one job by its server-generated id (or by name for legacy rows). Returns nil, nil when the row doesn't exist.
func (*SQLiteStore) GetSetting ¶ added in v0.2.0
func (s *SQLiteStore) GetSetting(key string) (*Setting, error)
GetSetting returns a setting by key.
func (*SQLiteStore) GetTask ¶ added in v0.6.0
func (s *SQLiteStore) GetTask(id string) (*Task, error)
GetTask returns a task by id, or (nil, nil) if not found.
func (*SQLiteStore) GetUserMemory ¶
func (s *SQLiteStore) GetUserMemory(userID, agent string) ([]UserMemory, error)
GetUserMemory returns all memory layers for a user+agent.
func (*SQLiteStore) InsertAgentBrainFile ¶ added in v0.6.0
func (s *SQLiteStore) InsertAgentBrainFile(f AgentBrainFile) error
InsertAgentBrainFile persists an agent-scoped knowledge attachment (refs govega#43). Content is stored inline; callers must enforce size limits before invoking.
func (*SQLiteStore) InsertChannelMessage ¶ added in v0.3.0
func (s *SQLiteStore) InsertChannelMessage(channelID, agent, role, content string, threadID *int64, metadata, sender string, activities []vega.ToolActivity) (int64, error)
InsertChannelMessage inserts a message into a channel and returns its ID. Pass nil for `activities` when there are no tool calls to record.
func (*SQLiteStore) InsertChatMessage ¶
func (s *SQLiteStore) InsertChatMessage(agent, role, content string, activities []vega.ToolActivity) error
InsertChatMessage persists a chat message for an agent. Pass nil activities for user messages or for assistant messages with no tool calls. The streaming path passes the result of CollectToolActivities so reloaded history reproduces the live tool-call timeline.
func (*SQLiteStore) InsertComposedAgent ¶
func (s *SQLiteStore) InsertComposedAgent(a ComposedAgent) error
InsertComposedAgent persists a composed agent definition. CreatedAt is preserved on update (UPSERT path); UpdatedAt is set to NOW if zero so callers can omit it on the happy path.
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. If a row already exists with the same (user_id, agent, type, content), its tags are merged (union of comma-separated values) and updated_at advances rather than inserting a duplicate. Items missing a Type are stored as MemoryTypeReference so legacy callers continue to work.
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 iris.
func (*SQLiteStore) InsertResolvedInboxItem ¶ added in v0.7.13
func (s *SQLiteStore) InsertResolvedInboxItem(fromAgent, subject, body, resolution string) (int64, error)
InsertResolvedInboxItem inserts an item already marked resolved. Used for auto-success dispatch outcomes that don't need orchestrator triage.
func (*SQLiteStore) InsertTask ¶ added in v0.6.0
func (s *SQLiteStore) InsertTask(t Task) error
InsertTask creates a new task. If Status/Priority are empty, defaults apply (todo / normal). CreatedAt and UpdatedAt are set by SQLite if not provided.
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) LinkTaskProcess ¶ added in v0.6.0
func (s *SQLiteStore) LinkTaskProcess(taskID, processID string) error
LinkTaskProcess associates a process with a task. Idempotent — re-linking the same process is a no-op so callers (and retries) don't have to check.
func (*SQLiteStore) ListAgentBrainFiles ¶ added in v0.6.0
func (s *SQLiteStore) ListAgentBrainFiles(agentName string) ([]AgentBrainFile, error)
ListAgentBrainFiles returns metadata only (no content) for every brain file on agentName, oldest first.
func (*SQLiteStore) ListAllChannels ¶ added in v0.4.0
func (s *SQLiteStore) ListAllChannels() ([]dsl.ChannelInfo, error)
ListAllChannels returns all channels as ChannelInfo (for the dsl.ChannelBackend interface).
func (*SQLiteStore) ListAllMemoryItems ¶ added in v0.7.0
func (s *SQLiteStore) ListAllMemoryItems() ([]MemoryItem, error)
ListAllMemoryItems returns every row in memory_items. Migration helper (govega#71). Ordered by (user_id, agent, topic, created_at).
func (*SQLiteStore) ListAllUserMemory ¶ added in v0.7.0
func (s *SQLiteStore) ListAllUserMemory() ([]UserMemory, error)
ListAllUserMemory returns every row in user_memory. Migration helper (govega#71). Iteration order is (user_id, agent, layer) ascending so the migration's grouping logic sees adjacent rows.
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 count + latest reply timestamp + distinct reply senders, so the channel UI can render thread indicators without an N+1 fetch.
func (*SQLiteStore) ListChannels ¶ added in v0.3.0
func (s *SQLiteStore) ListChannels(userID string) ([]Channel, error)
ListChannels returns all channels with unread counts for the given user.
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)
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) ListMemoryLinks ¶ added in v0.7.0
func (s *SQLiteStore) ListMemoryLinks(scope MemoryScope, scopeID, userID string) ([]MemoryLink, error)
ListMemoryLinks returns every link under (scope, scopeID, userID).
func (*SQLiteStore) ListMemoryPages ¶ added in v0.7.0
func (s *SQLiteStore) ListMemoryPages(scope MemoryScope, scopeID, userID, pathPrefix string) ([]MemoryPage, error)
ListMemoryPages returns every page under (scope, scopeID, userID), optionally filtered by path prefix. Ordered by updated_at DESC.
func (*SQLiteStore) ListMemoryScopeIDs ¶ added in v0.7.13
func (s *SQLiteStore) ListMemoryScopeIDs(scope MemoryScope, userID string) ([]string, error)
ListMemoryScopeIDs returns every distinct scope_id under (scope, userID), ordered alphabetically. Used to enumerate agent wikis for a user.
func (*SQLiteStore) ListMyTasks ¶ added in v0.6.0
ListMyTasks returns tasks assigned to a specific agent, optionally filtered by status. Convenience wrapper over ListTasks for the agent tool layer; ordering matches ListTasks (newest-updated first).
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) ListTaskComments ¶ added in v0.6.0
func (s *SQLiteStore) ListTaskComments(taskID string) ([]TaskComment, error)
ListTaskComments returns comments oldest-first (chronological).
func (*SQLiteStore) ListTaskProcesses ¶ added in v0.6.0
func (s *SQLiteStore) ListTaskProcesses(taskID string) ([]string, error)
ListTaskProcesses returns process IDs linked to a task, oldest-first.
func (*SQLiteStore) ListTasks ¶ added in v0.6.0
func (s *SQLiteStore) ListTasks(f TaskFilter) ([]Task, error)
ListTasks returns tasks matching the filter, newest-updated first.
func (*SQLiteStore) ListThreadMessages ¶ added in v0.3.0
func (s *SQLiteStore) ListThreadMessages(channelID string, threadID int64) ([]ChannelMessage, error)
ListThreadMessages returns the original message and all replies in a thread.
func (*SQLiteStore) ListUnassignedTasks ¶ added in v0.6.0
func (s *SQLiteStore) ListUnassignedTasks(limit int) ([]Task, error)
ListUnassignedTasks returns tasks with empty assignee — the routing queue the orchestrator triages.
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) MarkChannelRead ¶ added in v0.4.0
func (s *SQLiteStore) MarkChannelRead(channelID, userID string) error
MarkChannelRead updates the read cursor for a channel so unread count resets.
func (*SQLiteStore) MarkChatRead ¶ added in v0.4.0
func (s *SQLiteStore) MarkChatRead(agent, userID string) error
MarkChatRead updates the read cursor for a DM conversation so unread count resets.
func (*SQLiteStore) MarkScheduledJobRun ¶ added in v0.6.0
func (s *SQLiteStore) MarkScheduledJobRun(name string, at time.Time) error
MarkScheduledJobRun stamps last_run_at = now for the given job name. Best-effort — a failure just means the next-run computation will be slightly stale; the cron runner is the source of truth for firing.
func (*SQLiteStore) PeeringStore ¶ added in v0.7.13
func (s *SQLiteStore) PeeringStore() peering.Store
PeeringStore returns a peering.Store backed by the same database. Used by the orchestrator-to-orchestrator federation layer to share storage without bloating the main Store interface.
func (*SQLiteStore) PendingInboxCount ¶ added in v0.4.0
func (s *SQLiteStore) PendingInboxCount() (int, error)
ListInboxItems returns inbox items filtered by status. PendingInboxCount returns the number of pending inbox items (cheap query, no LLM needed).
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) ReconcileOrphanedWorkflowRuns ¶ added in v0.8.0
func (s *SQLiteStore) ReconcileOrphanedWorkflowRuns() (int64, error)
ReconcileOrphanedWorkflowRuns marks runs stuck at 'running' as interrupted — at boot, any 'running' row died with the previous server.
func (*SQLiteStore) RenameMemoryPage ¶ added in v0.7.0
func (s *SQLiteStore) RenameMemoryPage(scope MemoryScope, scopeID, userID, oldPath, newPath string) error
RenameMemoryPage moves a page from oldPath to newPath and rewrites every link where oldPath appears as from_path or to_path. Atomic.
Note: newPath must not already exist — this fails the page insert at the unique constraint. Callers who want overwrite semantics should delete the destination first.
func (*SQLiteStore) ReplaceMemoryLinks ¶ added in v0.7.0
func (s *SQLiteStore) ReplaceMemoryLinks(scope MemoryScope, scopeID, userID, fromPath string, toPaths []string) error
ReplaceMemoryLinks atomically replaces the out-edges from fromPath with one row per (fromPath, to) in toPaths. Empty toPaths clears.
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) SearchEvents ¶ added in v0.6.0
func (s *SQLiteStore) SearchEvents(filter ActivityFilter) ([]StoreEvent, int, error)
SearchEvents matches the activity-log query against the events table (refs govega#33). Search is a case-insensitive substring scan over type, agent_name, data, result, and error — LIKE-based rather than FTS5 to keep the schema migration cost down. At today's data volumes the index scan on (timestamp, agent_name) plus a per-row LIKE pass is well within the latency budget; the API shape is the same once FTS5 lands.
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) SearchMemoryItemsByType ¶ added in v0.5.1
func (s *SQLiteStore) SearchMemoryItemsByType(userID, agent, query string, typ MemoryType, limit int) ([]MemoryItem, error)
SearchMemoryItemsByType is SearchMemoryItems narrowed to a single MemoryType.
func (*SQLiteStore) SearchMemoryPages ¶ added in v0.7.0
func (s *SQLiteStore) SearchMemoryPages(scope MemoryScope, scopeID, userID, query string, limit int) ([]MemoryPage, error)
SearchMemoryPages does a case-insensitive substring search across path and content, ranked by updated_at DESC.
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) SweepRetention ¶ added in v0.8.0
func (s *SQLiteStore) SweepRetention(policy RetentionPolicy) (RetentionSweepResult, error)
SweepRetention deletes rows older than the per-table retention windows. Timestamps are bound as time.Time — the driver stores and compares them in RFC3339 text form consistently with the insert paths.
func (*SQLiteStore) TaskStatsByAssignee ¶ added in v0.6.0
func (s *SQLiteStore) TaskStatsByAssignee() (map[string]AgentStatsResponse, error)
TaskStatsByAssignee returns kanban task counters grouped by assignee. One round-trip per call regardless of how many agents — used by the agents API to avoid an N+1 query when listing.
Excludes empty assignees (would lump all unassigned tasks under ""). SuccessRate is nil when (done + canceled) == 0, since "0%" would be misleading for an agent that just hasn't finished anything yet.
func (*SQLiteStore) TriageInboxItems ¶ added in v0.7.13
func (s *SQLiteStore) TriageInboxItems(ids []int64, threshold int) ([]int64, error)
TriageInboxItems is the cost-control backstop for the orchestrator's inbox loop. Each id that is currently pending gets its triage_count incremented and last_triaged_at stamped; anything whose post-increment count reaches `threshold` is auto-resolved with a synthetic resolution. Returns the ids that flipped to resolved on this call.
Implementation is intentionally a few small queries rather than one CTE — sqlite + postgres both run this, and we want it to behave identically. Volume per call is bounded by the orchestrator's list_inbox page (≤ 50), so the cost is negligible.
func (*SQLiteStore) UpdateChannelMeta ¶ added in v0.6.0
func (s *SQLiteStore) UpdateChannelMeta(currentName string, newName, newDescription *string) error
UpdateChannelMeta partially updates a channel's display fields (name, description). Pass nil/empty to leave a field unchanged. Bumps updated_at. Returns sql.ErrNoRows if the channel doesn't exist.
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 and bumps updated_at.
func (*SQLiteStore) UpdateTask ¶ added in v0.6.0
func (s *SQLiteStore) UpdateTask(id string, u TaskUpdate) error
UpdateTask applies a partial update. Returns sql.ErrNoRows-equivalent if the id doesn't exist (caller maps to 404). Validates the status enum.
func (*SQLiteStore) UpdateTaskStatus ¶ added in v0.6.0
func (s *SQLiteStore) UpdateTaskStatus(id, status string) error
UpdateTaskStatus is a focused setter used by the agent tool layer. Wraps UpdateTask so the validation lives in one place.
func (*SQLiteStore) UpdateWorkflowRun ¶
func (s *SQLiteStore) UpdateWorkflowRun(runID string, status string, result string) error
UpdateWorkflowRun updates a workflow run status and result.
func (*SQLiteStore) UpdateWorkflowRunSteps ¶ added in v0.8.0
func (s *SQLiteStore) UpdateWorkflowRunSteps(runID string, stepsJSON string) error
UpdateWorkflowRunSteps replaces the per-step checkpoint JSON on a run.
func (*SQLiteStore) UpsertAgentBudget ¶ added in v0.6.0
func (s *SQLiteStore) UpsertAgentBudget(b AgentBudget) error
UpsertAgentBudget creates or replaces a budget row. created_at is preserved on update via COALESCE so the field stays meaningful.
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) UpsertMemoryPage ¶ added in v0.7.0
func (s *SQLiteStore) UpsertMemoryPage(p MemoryPage) error
UpsertMemoryPage inserts a page if absent, or replaces Content + Frontmatter + advances updated_at on conflict. CreatedAt is preserved across updates by leaving created_at out of the DO UPDATE clause.
func (*SQLiteStore) UpsertScheduledJob ¶
func (s *SQLiteStore) UpsertScheduledJob(job ScheduledJob) error
UpsertScheduledJob creates or replaces a scheduled job. The Name field is the legacy primary key (cron runner + DSL lookup); ID defaults to Name for backwards compatibility when callers don't supply it.
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 Schedule ¶ added in v0.6.0
type Schedule struct {
Frequency RoutineFrequency `json:"frequency"`
Time string `json:"time"` // HH:mm 24h
Timezone string `json:"timezone"` // IANA, e.g. America/New_York
DaysOfWeek []int `json:"days_of_week,omitempty"`
DayOfMonth *int `json:"day_of_month,omitempty"`
// Cron is set when Frequency == custom; otherwise it's the derived
// expression returned on read for debugging.
Cron string `json:"cron,omitempty"`
}
Schedule is the structured representation of when a routine fires. The frontend models it directly; cron is derived server-side via ToCron.
Fields are honored by frequency:
- daily / weekdays: time, timezone
- weekly / biweekly: time, timezone, days_of_week
- monthly: time, timezone, day_of_month
- custom: cron (raw) — the other fields are echoed for display only.
Biweekly degrades to weekly today — the cron grammar can't express "every other week" natively. Worker-side parity gating is left for a follow-up.
type ScheduledJob ¶
type ScheduledJob struct {
// ID is the server-generated stable identifier. For rows created
// before the routines migration, ID == Name (backfilled by the
// migration).
ID string `json:"id"`
// Name is the cron-runner key + DSL lookup key. For new routines the
// API sets Name == ID; legacy rows keep their original slug.
Name string `json:"name"`
// Title is the user-facing display label (e.g. "Daily standup
// reminder"). Empty for legacy rows; falls back to Name in API
// responses.
Title string `json:"title,omitempty"`
Cron string `json:"cron"`
// ScheduleJSON is the marshalled Schedule struct as supplied by the
// FE. Empty when the row was created via the DSL or the legacy flat
// API; in that case responses synthesize a `Custom` schedule that
// echoes Cron.
ScheduleJSON string `json:"-"`
AgentName string `json:"agent"`
Message string `json:"message"`
Enabled bool `json:"enabled"`
LastRunAt *time.Time `json:"last_run_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ScheduledJob is a persisted recurring agent trigger. The legacy fields (Name, Cron, Message) drive the cron runner and the DSL tools; the newer ones (ID, Title, ScheduleJSON, LastRunAt, UpdatedAt) back the per-agent Routines CRUD surface added for govega#52.
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 ¶
RemoveJob removes a job from the cron runner and calls the remove callback.
func (*Scheduler) SetCallerResolver ¶ added in v0.7.13
func (s *Scheduler) SetCallerResolver(r CallerResolver)
SetCallerResolver registers a CallerResolver that runs at every job fire to enrich the dispatch context with the scheduling user's identity and per-user credentials. Pass nil to clear.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the HTTP server for the Vega dashboard and REST API.
func (*Server) AddDiscordBot ¶ added in v0.7.15
func (s *Server) AddDiscordBot(parent context.Context, token, agent, label string, allowedUsers []string) (*DiscordBotConfig, error)
AddDiscordBot validates and persists a new bot, then starts it. allowedUsers (may be nil) restricts which Discord user IDs the bot responds to; nil/empty means open access.
func (*Server) AddTelegramBot ¶ added in v0.5.1
func (s *Server) AddTelegramBot(parent context.Context, token, agent, label string) (*TelegramBotConfig, error)
AddTelegramBot validates and persists a new bot, then starts it. reuseLabel determines what label to assign when the user didn't supply one (e.g. "env" for the legacy env-var bot).
func (*Server) BuildMCPEnvMap ¶ added in v0.6.0
BuildMCPEnvMap is the public wrapper for buildMCPEnvMap so product integrations can hydrate the env map their builtin server reads.
func (*Server) DiscordBotsSnapshot ¶ added in v0.7.15
func (s *Server) DiscordBotsSnapshot() []DiscordBotStatus
DiscordBotsSnapshot lists all configured bots (running or not) with non-sensitive fields. The token is never returned.
func (*Server) Interpreter ¶ added in v0.6.0
func (s *Server) Interpreter() *dsl.Interpreter
Interpreter returns the underlying dsl.Interpreter so integrations can access the tool registry, agent set, etc.
func (*Server) PersistMCPServer ¶ added in v0.6.0
func (s *Server) PersistMCPServer(req ConnectMCPRequest)
PersistMCPServer is the public wrapper for persistMCPServer so product integrations register their server-config so autoConnectPersistedServers reconnects after a restart.
func (*Server) RefreshToolSettings ¶ added in v0.6.0
func (s *Server) RefreshToolSettings()
RefreshToolSettings is the public wrapper for refreshToolSettings.
func (*Server) RegisterAppHost ¶ added in v0.8.8
RegisterAppHost wires a custom app-hosting provider (e.g. a Fly-backed host contributed by v39a-vega), overriding the default LocalAppHost. Must be called before Start.
func (*Server) RegisterReplyTarget ¶ added in v0.5.1
func (s *Server) RegisterReplyTarget(agentName string, target dsl.ReplyTarget)
RegisterReplyTarget binds a ReplyTarget to an agent name. Subsequent async dispatch completions originating from this agent will push their response through the given target. Re-registering the same agent name replaces the previous target.
func (*Server) RegisterRoute ¶ added in v0.6.0
func (s *Server) RegisterRoute(pattern string, handler http.HandlerFunc)
RegisterRoute mounts an HTTP handler on the server's mux. Must be called before Start. Routes outside /api/v1/* are not gated by the bearer-JWT middleware — useful for service-to-service webhooks that authenticate themselves (shared secret in a header, signed JWT in a query param, etc.).
Conflicts with existing patterns surface as a panic from net/http when the mux is built — same behavior as govega's own route registrations.
func (*Server) RemoveDiscordBot ¶ added in v0.7.15
RemoveDiscordBot stops a bot and drops it from the persisted list.
func (*Server) RemoveTelegramBot ¶ added in v0.5.1
RemoveTelegramBot stops a bot and drops it from the persisted list.
func (*Server) Start ¶
Start initializes the store, wires callbacks, registers routes, and listens for HTTP requests. It blocks until ctx is cancelled.
func (*Server) Store ¶ added in v0.6.0
Store returns the persistence store. Integrations use this to persist their settings (API keys, shared secrets, per-tenant config) under the MCPSettingKey namespace.
func (*Server) TelegramBotsSnapshot ¶ added in v0.5.1
func (s *Server) TelegramBotsSnapshot() []TelegramBotStatus
TelegramBotsSnapshot lists all configured bots (running or not) with non-sensitive fields. The token is never returned.
func (*Server) UnregisterReplyTarget ¶ added in v0.5.1
UnregisterReplyTarget removes a previously-registered target. Safe to call when no target is registered.
func (*Server) WithCallerResolver ¶ added in v0.7.13
func (s *Server) WithCallerResolver(r CallerResolver) *Server
WithCallerResolver registers a CallerResolver on s. The resolver is applied to background-work dispatch contexts (scheduler tick, Telegram inbound, peering inbound) so they carry caller identity and per-user credentials downstream. MUST be called before Start — registration is not propagated to already-running subsystems.
Pass nil to clear. A nil resolver leaves background ctx unchanged.
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
// UpdateWorkflowRunSteps replaces the per-step checkpoint JSON on a
// workflow run so interrupted runs show where they died.
UpdateWorkflowRunSteps(runID string, stepsJSON string) error
// ReconcileOrphanedWorkflowRuns marks runs stuck at status='running'
// as 'interrupted'. Called at boot: runs execute in-process, so any
// 'running' row at startup died with the previous server. Returns
// the number of runs reconciled.
ReconcileOrphanedWorkflowRuns() (int64, error)
// ListEvents returns recent events, newest first.
ListEvents(limit int) ([]StoreEvent, error)
// SearchEvents returns events matching the filter, newest first.
// Used by the activity log endpoint (refs govega#33). totalCount is
// the unpaginated match count so the FE can render a hit total
// without re-querying.
SearchEvents(filter ActivityFilter) (events []StoreEvent, totalCount int, err 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. `activities` is the
// list of completed tool calls captured during the streaming turn
// that produced this message; pass nil for user messages or any
// message without tool calls.
InsertChatMessage(agent, role, content string, activities []vega.ToolActivity) 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
// SweepRetention deletes rows older than the per-table retention
// windows. A zero duration keeps that table's rows forever. Returns
// the number of rows deleted per table.
SweepRetention(policy RetentionPolicy) (RetentionSweepResult, error)
// UpsertMCPServer persists an MCP server connection config so it
// auto-reconnects on restart.
UpsertMCPServer(name, configJSON string) error
// DeleteMCPServer removes a persisted MCP server connection.
DeleteMCPServer(name string) error
// ListMCPServers returns all persisted MCP server configs.
ListMCPServers() ([]MCPServerConfig, error)
// SetMCPServerDisabled enables or disables a persisted MCP server.
// Errors when no server with that name exists.
SetMCPServerDisabled(name string, disabled bool) error
// UpsertMemoryPage creates a page if absent, or overwrites Content +
// Frontmatter + advances UpdatedAt on conflict (PK = scope, scope_id,
// user_id, path). CreatedAt is preserved across updates. Refs govega#71.
UpsertMemoryPage(p MemoryPage) error
// GetMemoryPage returns one page, or nil when not found.
GetMemoryPage(scope MemoryScope, scopeID, userID, path string) (*MemoryPage, error)
// ListMemoryPages returns every page under (scope, scopeID, userID).
// When pathPrefix is non-empty, results are filtered to paths that
// start with the prefix. Ordered by updated_at DESC.
ListMemoryPages(scope MemoryScope, scopeID, userID, pathPrefix string) ([]MemoryPage, error)
// DeleteMemoryPage removes one page. Also clears any link rows where
// the page appears as from_path or to_path.
DeleteMemoryPage(scope MemoryScope, scopeID, userID, path string) error
// RenameMemoryPage moves a page from oldPath to newPath, and rewrites
// every link row that referenced oldPath (as from_path or to_path) to
// point at newPath. Atomic: either both succeed or neither does.
RenameMemoryPage(scope MemoryScope, scopeID, userID, oldPath, newPath string) error
// SearchMemoryPages does a case-insensitive substring search across
// path and content, ranked by updated_at DESC. Limit defaults to 25.
SearchMemoryPages(scope MemoryScope, scopeID, userID, query string, limit int) ([]MemoryPage, error)
// ReplaceMemoryLinks replaces the set of out-edges from fromPath
// atomically: removes existing rows where from_path = fromPath,
// inserts one row per (fromPath, to) in toPaths. Empty toPaths just
// clears the out-edges. Refs govega#71.
ReplaceMemoryLinks(scope MemoryScope, scopeID, userID, fromPath string, toPaths []string) error
// ListMemoryLinks returns every link under (scope, scopeID, userID).
ListMemoryLinks(scope MemoryScope, scopeID, userID string) ([]MemoryLink, error)
// ListMemoryScopeIDs returns every distinct scope_id that has at least
// one page under (scope, userID). Used by the graph endpoint to
// enumerate per-agent wikis when scope=all.
ListMemoryScopeIDs(scope MemoryScope, userID string) ([]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. If an item already exists with the
// same (user_id, agent, type, content), its tags are merged and updated_at
// advances rather than inserting a duplicate row. Items missing a Type are
// stored as MemoryTypeReference.
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)
// SearchMemoryItemsByType is like SearchMemoryItems but additionally
// filters to a single MemoryType.
SearchMemoryItemsByType(userID, agent, query string, typ MemoryType, limit int) ([]MemoryItem, error)
// DeleteMemoryItem removes a memory item by ID.
DeleteMemoryItem(id int64) error
// ListAllUserMemory returns every row in user_memory. Bulk-load helper
// used by the wiki-memory migration (govega#71). Removed once the
// legacy user_memory table is dropped.
ListAllUserMemory() ([]UserMemory, error)
// ListAllMemoryItems returns every row in memory_items. Bulk-load
// helper for the wiki-memory migration. Removed alongside the table.
ListAllMemoryItems() ([]MemoryItem, 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)
// GetScheduledJobByID returns one job by its server-generated id.
// Returns nil, nil when not found.
GetScheduledJobByID(id string) (*ScheduledJob, error)
// MarkScheduledJobRun stamps the supplied time on last_run_at.
MarkScheduledJobRun(name string, at time.Time) error
// GetAgentBudget returns the persisted budget record for agentName,
// or nil when the agent has no row yet (i.e. budget is implicitly
// "no cap, soft-alert threshold default, disabled"). Refs govega#47.
GetAgentBudget(agentName string) (*AgentBudget, error)
// UpsertAgentBudget creates or replaces a per-agent budget row.
// CreatedAt is preserved on update; UpdatedAt advances. Refs govega#47.
UpsertAgentBudget(b AgentBudget) error
// AgentSpendInPeriod returns the sum of cost_usd across the latest
// snapshot of every process for agentName whose started_at falls
// inside [from, to). When from/to are zero, the bound is treated
// as unbounded on that side.
AgentSpendInPeriod(agentName string, from, to time.Time) (float64, error)
// InsertAgentBrainFile persists an attachment for the given agent.
// content is read in-memory; callers must enforce size limits.
InsertAgentBrainFile(f AgentBrainFile) error
// ListAgentBrainFiles returns the metadata for every brain file
// attached to agentName. Content is not loaded.
ListAgentBrainFiles(agentName string) ([]AgentBrainFile, error)
// GetAgentBrainFile returns one brain file, content included.
// Returns nil, nil when the file doesn't exist or doesn't belong to
// the agent.
GetAgentBrainFile(agentName, id string) (*AgentBrainFile, error)
// DeleteAgentBrainFile removes a brain file. Returns an error if the
// file doesn't exist on the given agent.
DeleteAgentBrainFile(agentName, id string) 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)
// ListAllChannels returns all channels as ChannelInfo.
ListAllChannels() ([]dsl.ChannelInfo, error)
// ListChannelsForAgent returns channels where the agent is a team member.
ListChannelsForAgent(agent string) ([]dsl.ChannelInfo, error)
// ListChannels returns all channels with unread counts for the given user.
ListChannels(userID string) ([]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
// UpdateChannelMeta partially updates a channel's display fields.
// Pass nil to leave a field unchanged; empty-string pointer clears.
// Returns sql.ErrNoRows if the channel doesn't exist.
UpdateChannelMeta(currentName string, newName, newDescription *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)
// InsertResolvedInboxItem creates an inbox item that is already resolved.
// Used by the success path of classifyDispatchOutcome so "Task
// completed by X" entries skip the pending queue and land directly in
// Done — keeps the orchestrator's working set focused on items that
// actually need a decision. The resolution string is required and
// surfaces in the UI's Done column.
InsertResolvedInboxItem(fromAgent, subject, body, resolution 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)
// DeleteInboxItem removes a single inbox item (and its replies) by id,
// regardless of status. Returns sql.ErrNoRows if no item matches.
DeleteInboxItem(id int64) error
// TriageInboxItems increments triage_count + stamps last_triaged_at
// for each pending id, then auto-resolves any whose post-increment
// count is >= threshold. Returns the ids that were auto-aged on
// this call so callers can log/report. Already-resolved items and
// unknown ids are silently ignored. The threshold guard is what
// stops the orchestrator burning tokens re-reading items it can't
// decide every heartbeat.
TriageInboxItems(ids []int64, threshold int) ([]int64, error)
// InsertChannelMessage inserts a message into a channel.
InsertChannelMessage(channelID, agent, role, content string, threadID *int64, metadata, sender string, activities []vega.ToolActivity) (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)
// MarkChannelRead updates the read cursor for a channel.
MarkChannelRead(channelID, userID string) error
// MarkChatRead updates the read cursor for a DM conversation.
MarkChatRead(agent, userID string) error
// ChatUnreadCounts returns agent → unread message count for DMs.
ChatUnreadCounts(userID string) (map[string]int, 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 iris.
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
// InsertTask creates a new task.
InsertTask(t Task) error
// GetTask returns a task by id, or (nil, nil) if not found.
GetTask(id string) (*Task, error)
// ListTasks returns tasks matching the filter, newest-updated first.
ListTasks(f TaskFilter) ([]Task, error)
// UpdateTask applies a partial update.
UpdateTask(id string, u TaskUpdate) error
// DeleteTask removes a task and its comments / process links.
DeleteTask(id string) error
// AddTaskComment appends a comment and bumps the task's updated_at.
AddTaskComment(taskID, author, content string) (int64, error)
// ListTaskComments returns comments oldest-first.
ListTaskComments(taskID string) ([]TaskComment, error)
// LinkTaskProcess associates a process with a task (idempotent).
LinkTaskProcess(taskID, processID string) error
// ListTaskProcesses returns process IDs linked to a task.
ListTaskProcesses(taskID string) ([]string, error)
// ListMyTasks returns tasks assigned to a specific agent.
ListMyTasks(assignee string, status []string, limit int) ([]Task, error)
// ListUnassignedTasks returns tasks with empty assignee.
ListUnassignedTasks(limit int) ([]Task, error)
// UpdateTaskStatus is a focused setter for the agent tool layer.
UpdateTaskStatus(id, status string) error
// AssignTask sets the assignee without changing status.
AssignTask(id, assignee string) error
// ClaimTask atomically sets assignee to caller and status to 'doing'.
ClaimTask(id, assignee string) error
// TaskStatsByAssignee returns per-assignee kanban task counters in a
// single query. Used by the agents API to surface "how productive is
// this agent" stats. Empty assignees are excluded.
TaskStatsByAssignee() (map[string]AgentStatsResponse, error)
}
Store persists events and process snapshots for historical queries.
type StoreEvent ¶
type Task ¶ added in v0.6.0
type Task struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Status string `json:"status"`
Priority string `json:"priority"`
Assignee string `json:"assignee"`
Tags string `json:"tags"`
CreatedBy string `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DueAt *time.Time `json:"due_at,omitempty"`
}
Task is a unit of work that lives independently of any single agent run. A Process executes; a Task is something a human (or, later, the orchestrator) chooses to work on. One Task may be fulfilled by zero or many Processes.
type TaskComment ¶ added in v0.6.0
type TaskComment struct {
ID int64 `json:"id"`
TaskID string `json:"task_id"`
Author string `json:"author"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
}
TaskComment is an entry on a task's activity feed.
type TaskDetailResponse ¶ added in v0.6.0
type TaskDetailResponse struct {
Task
Comments []TaskComment `json:"comments"`
Processes []string `json:"processes"`
}
TaskDetailResponse is GET /api/v1/tasks/{id}: the task plus its activity feed and any processes that have been spawned to fulfill it.
type TaskFilter ¶ added in v0.6.0
type TaskFilter struct {
Status []string
Assignee []string
Tag []string // matches if task tags overlap any of these
Limit int // 0 = no limit
Offset int
}
TaskFilter narrows ListTasks; an empty filter returns all tasks.
type TaskUpdate ¶ added in v0.6.0
type TaskUpdate struct {
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
Status *string `json:"status,omitempty"`
Priority *string `json:"priority,omitempty"`
Assignee *string `json:"assignee,omitempty"`
Tags *string `json:"tags,omitempty"`
DueAt *time.Time `json:"due_at,omitempty"`
}
TaskUpdate is a partial-update payload — nil pointer = unchanged.
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, company *dsl.Company, onExchange func(ctx context.Context, userID, agent, userMsg, response string), onIncoming func(agentName string, target dsl.ReplyTarget)) (*TelegramBot, error)
NewTelegramBot creates a TelegramBot connected to the given token. onExchange is called after each successful exchange (the serve layer wires it to the memory curator). onIncoming (optional) is called for each inbound message with the per-user clone agent name and a ReplyTarget that will push to this user's chat — the serve layer registers it on the server's reply-target map so dispatch-complete callbacks can find it.
func (*TelegramBot) SetAllowedUsers ¶ added in v0.7.17
func (t *TelegramBot) SetAllowedUsers(ids []string)
SetAllowedUsers restricts which Telegram user IDs the bot will respond to. An empty list means open access.
func (*TelegramBot) SetCallerResolver ¶ added in v0.7.13
func (t *TelegramBot) SetCallerResolver(r CallerResolver)
SetCallerResolver registers a CallerResolver applied to the dispatch context before SendToAgent on every inbound Telegram message. Pass nil to clear.
func (*TelegramBot) Start ¶
func (t *TelegramBot) Start(ctx context.Context)
Start runs the long-polling loop until ctx is cancelled.
type TelegramBotConfig ¶ added in v0.5.1
type TelegramBotConfig struct {
ID string `json:"id"`
Token string `json:"token"`
Agent string `json:"agent"`
Label string `json:"label,omitempty"`
// AllowedUsers restricts which Telegram numeric user IDs may talk to the
// bot. Empty means open access (backward compatible). Set it to lock the
// bot to its owner so strangers can't share the owner's conversation.
AllowedUsers []string `json:"allowed_users,omitempty"`
}
TelegramBotConfig persists the user's choice for a single bot. ID is the numeric prefix of the token ("123456789:AAEhBO..." → "123456789") which is stable per bot and not sensitive on its own. Label is optional, lets users distinguish e.g. "Personal" vs "Work" bots in the UI.
type TelegramBotStatus ¶ added in v0.5.1
type TelegramBotStatus struct {
ID string `json:"id"`
Label string `json:"label,omitempty"`
Agent string `json:"agent"`
Running bool `json:"running"`
}
TelegramBotStatus is the public-safe view of a single bot — no token.
type TenantConfigResponse ¶ added in v0.6.0
type TenantConfigResponse struct {
OrchestratorName string `json:"orchestrator_name"`
OrchestratorDisplay string `json:"orchestrator_display"`
OrchestratorTitle string `json:"orchestrator_title"`
ProductName string `json:"product_name,omitempty"`
AccentColor string `json:"accent_color,omitempty"`
LogoURL string `json:"logo_url,omitempty"`
// Version is the govega build version. Read-only — ignored on PUT.
Version string `json:"version,omitempty"`
}
TenantConfigResponse is the unified shape returned by GET /api/v1/tenant/config. Carries both the orchestrator identity (read off s.cfg.Orchestrator — the live values after settings overrides have been applied at boot) and the branding fields read directly from the settings table.
type ToggleAgentToolRequest ¶ added in v0.6.0
type ToggleAgentToolRequest struct {
Enabled bool `json:"enabled"`
}
ToggleAgentToolRequest is the PATCH body for the per-agent tool enable/disable surface (refs govega#44). Single-tool granularity so toggling two tools in quick succession can't race against a read-modify-write of the full tools array.
type UpdateAgentBudgetRequest ¶ added in v0.6.0
type UpdateAgentBudgetRequest struct {
BudgetCap *float64 `json:"budget_cap,omitempty"`
SoftAlertThreshold *float64 `json:"soft_alert_threshold,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
UpdateAgentBudgetRequest is the partial-PUT body. Pointer fields distinguish "omitted" (leave unchanged) from "set to empty". Pass a non-nil pointer to a nil BudgetCap to clear the cap; pass nil to leave it. Threshold defaults to 0.8 on first write.
type UpdateAgentRequest ¶ added in v0.3.0
type UpdateAgentRequest struct {
Name *string `json:"name,omitempty"`
DisplayName *string `json:"display_name,omitempty"`
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
Avatar *string `json:"avatar,omitempty"`
Icon *string `json:"icon,omitempty"`
AvatarGradient []string `json:"avatar_gradient,omitempty"`
Model *string `json:"model,omitempty"`
System *string `json:"system,omitempty"`
Team []string `json:"team,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
// Triggers replaces the agent's reactive triggers when non-nil. An empty
// (non-nil) slice clears them; nil leaves them unchanged.
Triggers []dsl.TriggerDef `json:"triggers,omitempty"`
}
UpdateAgentRequest is the request to update an existing composed agent. Pointer-typed fields distinguish "not set" (omit, leave unchanged) from "set to empty" (clear). Slice fields use len() == 0 to mean unchanged.
type UpdateChannelRequest ¶ added in v0.6.0
type UpdateChannelRequest struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
}
UpdateChannelRequest is the request to partially update a channel's display fields. Pointer fields distinguish "not set" (omit, leave unchanged) from "set to empty."
type UpdateRoutineRequest ¶ added in v0.6.0
type UpdateRoutineRequest struct {
Title *string `json:"title,omitempty"`
Instructions *string `json:"instructions,omitempty"`
Schedule *Schedule `json:"schedule,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
UpdateRoutineRequest is the PATCH body. Pointer-typed fields distinguish "omitted" (leave unchanged) from "set to empty".
type UpdateTenantConfigRequest ¶ added in v0.6.0
type UpdateTenantConfigRequest struct {
OrchestratorName *string `json:"orchestrator_name,omitempty"`
OrchestratorDisplay *string `json:"orchestrator_display,omitempty"`
OrchestratorTitle *string `json:"orchestrator_title,omitempty"`
AccentColor *string `json:"accent_color,omitempty"`
LogoURL *string `json:"logo_url,omitempty"`
}
UpdateTenantConfigRequest is the partial-PUT body. Pointer fields distinguish "omitted" (leave unchanged) from "set to empty". The orchestrator slug stays a pointer so the FE can rename without also bumping display/title.
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"`
// Steps is a JSON array of per-step checkpoints ([]dsl.StepEvent),
// updated as the run progresses.
Steps string `json:"steps,omitempty"`
}
WorkflowRun is a persisted workflow execution.
type WorkflowRunRequest ¶
WorkflowRunRequest is the request to launch a workflow.
type WorkflowRunResponse ¶
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.
Source Files
¶
- agent_intro.go
- apphost_local.go
- auth.go
- blob_store.go
- bot_allowlist.go
- bot_commands.go
- bot_exchange.go
- bot_images.go
- broker.go
- caller.go
- capability.go
- channel_reactive.go
- channel_stream.go
- cors.go
- discord.go
- dispatch_url_extract.go
- doc.go
- embed.go
- gmail_handoff.go
- handlers_activity.go
- handlers_agent_budget.go
- handlers_agent_spend.go
- handlers_agent_tools.go
- handlers_api.go
- handlers_brain.go
- handlers_channels.go
- handlers_config.go
- handlers_files.go
- handlers_integrations.go
- handlers_memory.go
- handlers_peering.go
- handlers_population.go
- handlers_routines.go
- handlers_sse.go
- handlers_tasks.go
- handlers_tenant_config.go
- memory_curator.go
- memory_pages.go
- memory_tools.go
- memory_wiki_backfill.go
- memory_wiki_compact.go
- memory_wiki_inject.go
- memory_wiki_migrate.go
- memory_wiki_tools.go
- oauth_gcal.go
- oauth_gmail.go
- orchestrator_override.go
- peering_boot.go
- peering_tools.go
- project_context.go
- reactive_boot.go
- reactive_classifier.go
- reactive_handlers.go
- recall.go
- reply_targets.go
- retention.go
- schedule.go
- scheduler.go
- server.go
- store.go
- store_factory.go
- store_postgres.go
- store_postgres_migrate.go
- store_sqlite.go
- store_tasks.go
- telegram.go
- telegram_format.go
- transcribe.go
- types.go
- workflow_steps.go