serve

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Overview

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

Package serve provides the HTTP server, REST API, and embedded React frontend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithDomainStore added in v0.4.0

func ContextWithDomainStore(ctx context.Context, store *SQLiteStore) context.Context

ContextWithDomainStore returns a context carrying the domain store.

func ContextWithMemory

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

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

func RegisterDomainTools added in v0.4.0

func RegisterDomainTools(interp *dsl.Interpreter)

RegisterDomainTools registers job tracking, follow-up, production rate, and all V2 domain tools on the interpreter.

func RegisterMemoryTools

func RegisterMemoryTools(interp *dsl.Interpreter)

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

Types

type AgentResponse

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

AgentResponse is the API representation of an agent definition.

type AgentTemplateResponse added in v0.3.0

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

AgentTemplateResponse is the API representation of a portable agent template.

type BrokerEvent

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

BrokerEvent is an event sent via SSE.

type Budget added in v0.4.0

type Budget struct {
	ID              int64     `json:"id"`
	Year            int       `json:"year"`
	Name            string    `json:"name"`
	RevenueTarget   float64   `json:"revenue_target"`
	TotalOverhead   float64   `json:"total_overhead"`
	BillableHours   float64   `json:"billable_hours"`
	HourlyRate      float64   `json:"hourly_rate"`
	OwnerSalary     float64   `json:"owner_salary"`
	TargetMarginPct float64   `json:"target_margin_pct"`
	Notes           string    `json:"notes"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
}

Budget represents an annual budget.

type BudgetLine added in v0.4.0

type BudgetLine struct {
	ID            int64   `json:"id"`
	BudgetID      int64   `json:"budget_id"`
	CostCode      string  `json:"cost_code"`
	Description   string  `json:"description"`
	Category      string  `json:"category"`
	AnnualAmount  float64 `json:"annual_amount"`
	MonthlyAmount float64 `json:"monthly_amount"`
	Notes         string  `json:"notes"`
}

BudgetLine represents a line item in a budget.

type CalendarEvent added in v0.4.0

type CalendarEvent struct {
	ID         int64     `json:"id"`
	Title      string    `json:"title"`
	EventType  string    `json:"event_type"`
	Date       string    `json:"date"`
	StartTime  string    `json:"start_time"`
	EndTime    string    `json:"end_time"`
	CrewID     int64     `json:"crew_id"`
	JobID      int64     `json:"job_id"`
	CustomerID int64     `json:"customer_id"`
	PropertyID int64     `json:"property_id"`
	Status     string    `json:"status"`
	Notes      string    `json:"notes"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

CalendarEvent represents a scheduled event on the calendar.

type Channel added in v0.3.0

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

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

type ChannelPostRequest added in v0.3.0

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

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

type ChatMessage

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

ChatMessage is a persisted chat message.

type ChatStatusResponse added in v0.3.0

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

ChatStatusResponse indicates whether an agent has an active stream.

type CompanyResponse added in v0.3.0

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

CompanyResponse is the API representation of company identity.

type CompanySiblingResponse added in v0.3.0

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

CompanySiblingResponse is the API representation of a sibling instance.

type ComposedAgent

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

ComposedAgent is a persisted agent created via the compose API.

type Config

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

Config holds server configuration.

type 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 CostCode added in v0.4.0

type CostCode struct {
	ID            int64  `json:"id"`
	Code          string `json:"code"`
	Name          string `json:"name"`
	Division      string `json:"division"`
	DivisionGroup string `json:"division_group"`
	Active        bool   `json:"active"`
}

CostCode represents a cost code for budgeting.

type CreateAgentRequest

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

CreateAgentRequest is the request to compose a new agent.

type CreateAgentResponse

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

CreateAgentResponse is returned when a new agent is composed.

type CreateChannelRequest added in v0.3.0

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

CreateChannelRequest is the request to create a channel.

type Crew added in v0.4.0

type Crew struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	ForemanID   int64  `json:"foreman_id"`
	MemberIDs   string `json:"member_ids"`
	Truck       string `json:"truck"`
	Specialties string `json:"specialties"`
	Active      bool   `json:"active"`
}

Crew represents a work crew.

type CrewMember added in v0.4.0

type CrewMember struct {
	ID         int64     `json:"id"`
	Name       string    `json:"name"`
	Role       string    `json:"role"`
	Phone      string    `json:"phone"`
	Email      string    `json:"email"`
	HourlyRate float64   `json:"hourly_rate"`
	Skills     string    `json:"skills"`
	Active     bool      `json:"active"`
	Notes      string    `json:"notes"`
	CreatedAt  time.Time `json:"created_at"`
}

CrewMember represents an individual crew member.

type Customer added in v0.4.0

type Customer struct {
	ID            int64     `json:"id"`
	Name          string    `json:"name"`
	ContactName   string    `json:"contact_name"`
	Email         string    `json:"email"`
	Phone         string    `json:"phone"`
	Address       string    `json:"address"`
	City          string    `json:"city"`
	State         string    `json:"state"`
	Zip           string    `json:"zip"`
	Source        string    `json:"source"`
	Status        string    `json:"status"`
	Tags          string    `json:"tags"`
	Notes         string    `json:"notes"`
	PaymentMethod string    `json:"payment_method"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Customer represents a customer in the CRM.

type ErrorResponse

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

ErrorResponse is returned on API errors.

type Estimate added in v0.4.0

type Estimate struct {
	ID         int64     `json:"id"`
	CustomerID int64     `json:"customer_id"`
	PropertyID int64     `json:"property_id"`
	JobID      int64     `json:"job_id"`
	Title      string    `json:"title"`
	Status     string    `json:"status"`
	LineItems  string    `json:"line_items"`
	Subtotal   float64   `json:"subtotal"`
	Tax        float64   `json:"tax"`
	Total      float64   `json:"total"`
	MarginPct  float64   `json:"margin_pct"`
	DepositPct float64   `json:"deposit_pct"`
	ValidUntil string    `json:"valid_until"`
	Notes      string    `json:"notes"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

Estimate represents a project estimate/quote.

type EventBroker

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

EventBroker fans out events to SSE subscribers.

func NewEventBroker

func NewEventBroker() *EventBroker

NewEventBroker creates a new broker.

func (*EventBroker) Close

func (b *EventBroker) Close()

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

func (*EventBroker) Publish

func (b *EventBroker) Publish(event BrokerEvent)

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

func (*EventBroker) Subscribe

func (b *EventBroker) Subscribe() chan BrokerEvent

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

func (*EventBroker) Unsubscribe

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

Unsubscribe removes a subscriber channel.

type FileContentResponse added in v0.2.0

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

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

type FileEntry added in v0.2.0

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

FileEntry represents a file or directory in the workspace.

type FileMetadataResponse added in v0.2.0

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

FileMetadataResponse is the response for file metadata queries.

type FollowUp added in v0.4.0

type FollowUp struct {
	ID          int64      `json:"id"`
	Agent       string     `json:"agent"`
	TargetType  string     `json:"target_type"` // lead, invoice, customer, job
	TargetName  string     `json:"target_name"` // human-readable name
	Action      string     `json:"action"`      // call, text, email, visit, reminder
	DueDate     string     `json:"due_date"`    // YYYY-MM-DD
	Status      string     `json:"status"`      // pending, done, skipped
	Notes       string     `json:"notes,omitempty"`
	CreatedAt   time.Time  `json:"created_at"`
	CompletedAt *time.Time `json:"completed_at,omitempty"`
}

FollowUp is a scheduled action for an agent (sales follow-up, payment reminder, etc.).

type InboxItem added in v0.3.0

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

InboxItem is a message posted to 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 Invoice added in v0.4.0

type Invoice struct {
	ID             int64     `json:"id"`
	InvoiceNumber  string    `json:"invoice_number"`
	CustomerID     int64     `json:"customer_id"`
	JobID          int64     `json:"job_id"`
	EstimateID     int64     `json:"estimate_id"`
	Status         string    `json:"status"`
	LineItems      string    `json:"line_items"`
	Subtotal       float64   `json:"subtotal"`
	Tax            float64   `json:"tax"`
	Total          float64   `json:"total"`
	DepositApplied float64   `json:"deposit_applied"`
	AmountDue      float64   `json:"amount_due"`
	IssuedDate     string    `json:"issued_date"`
	DueDate        string    `json:"due_date"`
	PaidDate       string    `json:"paid_date"`
	PaymentMethod  string    `json:"payment_method"`
	Notes          string    `json:"notes"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
}

Invoice represents a customer invoice.

type Item added in v0.4.0

type Item struct {
	ID        int64     `json:"id"`
	Name      string    `json:"name"`
	Category  string    `json:"category"`
	Unit      string    `json:"unit"`
	Cost      float64   `json:"cost"`
	Price     float64   `json:"price"`
	Supplier  string    `json:"supplier"`
	SKU       string    `json:"sku"`
	Taxable   bool      `json:"taxable"`
	Active    bool      `json:"active"`
	Notes     string    `json:"notes"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Item represents a catalog item (material, service, etc.).

type Job added in v0.4.0

type Job struct {
	ID              int64     `json:"id"`
	ExternalID      string    `json:"external_id,omitempty"` // SynkedUp project ID
	CustomerName    string    `json:"customer_name"`
	PropertyAddress string    `json:"property_address,omitempty"`
	JobType         string    `json:"job_type"` // patio, retaining_wall, planting, irrigation, maintenance, etc.
	Stage           string    `json:"stage"`    // lead_captured → pnl_updated (16 stages)
	OwnerAgent      string    `json:"owner_agent"`
	Notes           string    `json:"notes,omitempty"`
	EstimateTotal   float64   `json:"estimate_total,omitempty"`
	ActualTotal     float64   `json:"actual_total,omitempty"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
}

Job tracks a job through the landscaping lifecycle stages.

type MCPRegistryEntryResponse added in v0.2.1

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

MCPRegistryEntryResponse describes a registry entry for the connections page.

type MCPServerConfig added in v0.3.0

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

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

type MCPServerConfigResponse added in v0.3.0

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

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

type MCPServerResponse

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

MCPServerResponse is the API representation of an MCP server.

type MemoryItem

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

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

type MemoryResponse

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

MemoryResponse is the API representation of user memory.

type MessageResponse

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

MessageResponse is a conversation message.

type MetricsResponse

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

MetricsResponse is the API representation of process metrics.

type PopulationInfoResponse

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

PopulationInfoResponse is the API representation of population item details.

type PopulationInstallRequest

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

PopulationInstallRequest is the request to install a population item.

type PopulationInstalledItem

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

PopulationInstalledItem is the API representation of an installed population item.

type PopulationSearchResult

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

PopulationSearchResult is the API representation of a population search result.

type ProcessDetailResponse

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

ProcessDetailResponse includes conversation history.

type ProcessResponse

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

ProcessResponse is the API representation of a process.

type ProcessSnapshot

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

ProcessSnapshot is a point-in-time process state.

type ProductionRate added in v0.4.0

type ProductionRate struct {
	ID                    int64     `json:"id"`
	JobType               string    `json:"job_type"`
	Unit                  string    `json:"unit"` // sq_ft, lin_ft, cu_yd, each
	EstimatedHoursPerUnit float64   `json:"estimated_hours_per_unit"`
	ActualHoursPerUnit    float64   `json:"actual_hours_per_unit"`
	JobName               string    `json:"job_name,omitempty"`
	Notes                 string    `json:"notes,omitempty"`
	RecordedAt            time.Time `json:"recorded_at"`
}

ProductionRate tracks estimate accuracy for a job type.

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 Property added in v0.4.0

type Property struct {
	ID            int64     `json:"id"`
	CustomerID    int64     `json:"customer_id"`
	Address       string    `json:"address"`
	City          string    `json:"city"`
	State         string    `json:"state"`
	Zip           string    `json:"zip"`
	LotSizeSqft   float64   `json:"lot_size_sqft"`
	LawnSqft      float64   `json:"lawn_sqft"`
	BedSqft       float64   `json:"bed_sqft"`
	HardscapeSqft float64   `json:"hardscape_sqft"`
	Tags          string    `json:"tags"`
	Notes         string    `json:"notes"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Property represents a customer's property.

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

func (s *SQLiteStore) Close() error

Close closes the database.

func (*SQLiteStore) CompleteFollowUp added in v0.4.0

func (s *SQLiteStore) CompleteFollowUp(id int64, status string) error

CompleteFollowUp marks a follow-up as done or skipped.

func (*SQLiteStore) CountTable added in v0.2.0

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

CountTable returns the number of rows in the given table.

func (*SQLiteStore) CreateChannel added in v0.3.0

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

CreateChannel creates a new channel.

func (*SQLiteStore) DeleteAllFromTable added in v0.2.0

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

DeleteAllFromTable removes all rows from the given table.

func (*SQLiteStore) DeleteBudgetLine added in v0.4.0

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

DeleteBudgetLine removes a budget line item by ID.

func (*SQLiteStore) DeleteCalendarEvent added in v0.4.0

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

DeleteCalendarEvent removes a calendar event by ID.

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) DeleteCustomer added in v0.4.0

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

DeleteCustomer removes a customer by ID.

func (*SQLiteStore) DeleteMCPServer added in v0.3.0

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

DeleteMCPServer removes a persisted MCP server connection.

func (*SQLiteStore) DeleteMemoryItem

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

DeleteMemoryItem removes a memory item by ID.

func (*SQLiteStore) DeletePromptHistory added in v0.3.0

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

DeletePromptHistory removes a prompt history entry by ID.

func (*SQLiteStore) DeleteProperty added in v0.4.0

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

DeleteProperty removes a property by ID.

func (*SQLiteStore) DeleteResolvedInboxItems added in v0.3.0

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

DeleteResolvedInboxItems removes all resolved inbox items and their replies.

func (*SQLiteStore) DeleteScheduledJob

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

DeleteScheduledJob removes a scheduled job by name.

func (*SQLiteStore) DeleteSetting added in v0.2.0

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

DeleteSetting removes a setting by key.

func (*SQLiteStore) DeleteUserMemory

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

DeleteUserMemory removes all memory for a user+agent.

func (*SQLiteStore) FindChannelForAgents added in v0.3.0

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

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

func (*SQLiteStore) GetBudget added in v0.4.0

func (s *SQLiteStore) GetBudget(id int64) (*Budget, error)

GetBudget returns a single budget by ID.

func (*SQLiteStore) GetBudgetByYear added in v0.4.0

func (s *SQLiteStore) GetBudgetByYear(year int) (*Budget, error)

GetBudgetByYear returns the budget for a given year.

func (*SQLiteStore) GetCalendarEvent added in v0.4.0

func (s *SQLiteStore) GetCalendarEvent(id int64) (*CalendarEvent, error)

GetCalendarEvent returns a single calendar event by ID.

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) GetCrew added in v0.4.0

func (s *SQLiteStore) GetCrew(id int64) (*Crew, error)

GetCrew returns a single crew by ID.

func (*SQLiteStore) GetCrewMember added in v0.4.0

func (s *SQLiteStore) GetCrewMember(id int64) (*CrewMember, error)

GetCrewMember returns a single crew member by ID.

func (*SQLiteStore) GetCustomer added in v0.4.0

func (s *SQLiteStore) GetCustomer(id int64) (*Customer, error)

GetCustomer returns a single customer by ID.

func (*SQLiteStore) GetEstimate added in v0.4.0

func (s *SQLiteStore) GetEstimate(id int64) (*Estimate, error)

GetEstimate returns a single estimate by ID.

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) GetInvoice added in v0.4.0

func (s *SQLiteStore) GetInvoice(id int64) (*Invoice, error)

GetInvoice returns a single invoice by ID.

func (*SQLiteStore) GetItem added in v0.4.0

func (s *SQLiteStore) GetItem(id int64) (*Item, error)

GetItem returns a single catalog item by ID.

func (*SQLiteStore) GetJob added in v0.4.0

func (s *SQLiteStore) GetJob(id int64) (*Job, error)

GetJob returns a single job by ID.

func (*SQLiteStore) GetProductionRateAverage added in v0.4.0

func (s *SQLiteStore) GetProductionRateAverage(jobType string) (avgEstimated, avgActual float64, count int, err error)

GetProductionRateAverage returns the average actual hours/unit for a job type.

func (*SQLiteStore) GetProductionRates added in v0.4.0

func (s *SQLiteStore) GetProductionRates(jobType string, limit int) ([]ProductionRate, error)

GetProductionRates returns rate history for a job type, newest first.

func (*SQLiteStore) GetProperty added in v0.4.0

func (s *SQLiteStore) GetProperty(id int64) (*Property, error)

GetProperty returns a single property by ID.

func (*SQLiteStore) GetSalesLead added in v0.4.0

func (s *SQLiteStore) GetSalesLead(id int64) (*SalesLead, error)

GetSalesLead returns a single sales lead by ID.

func (*SQLiteStore) GetSetting added in v0.2.0

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

GetSetting returns a setting by key.

func (*SQLiteStore) GetUserMemory

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

GetUserMemory returns all memory layers for a user+agent.

func (*SQLiteStore) GetVendor added in v0.4.0

func (s *SQLiteStore) GetVendor(id int64) (*Vendor, error)

GetVendor returns a single vendor by ID.

func (*SQLiteStore) Init

func (s *SQLiteStore) Init() error

Init creates the schema tables.

func (*SQLiteStore) InitDomainTables added in v0.4.0

func (s *SQLiteStore) InitDomainTables() error

InitDomainTables creates the domain-specific tables.

func (*SQLiteStore) InitDomainTablesV2 added in v0.4.0

func (s *SQLiteStore) InitDomainTablesV2() error

InitDomainTablesV2 creates additional domain tables (customers, properties, crews, etc.).

func (*SQLiteStore) InsertBudget added in v0.4.0

func (s *SQLiteStore) InsertBudget(b Budget) (int64, error)

InsertBudget creates a new budget record.

func (*SQLiteStore) InsertBudgetLine added in v0.4.0

func (s *SQLiteStore) InsertBudgetLine(l BudgetLine) (int64, error)

InsertBudgetLine creates a new budget line item.

func (*SQLiteStore) InsertCalendarEvent added in v0.4.0

func (s *SQLiteStore) InsertCalendarEvent(e CalendarEvent) (int64, error)

InsertCalendarEvent creates a new calendar event.

func (*SQLiteStore) InsertChannelMessage added in v0.3.0

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

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

func (*SQLiteStore) InsertChatMessage

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

InsertChatMessage persists a chat message for an agent.

func (*SQLiteStore) InsertComposedAgent

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

InsertComposedAgent persists a composed agent definition.

func (*SQLiteStore) InsertCostCode added in v0.4.0

func (s *SQLiteStore) InsertCostCode(c CostCode) (int64, error)

InsertCostCode creates a new cost code record.

func (*SQLiteStore) InsertCrew added in v0.4.0

func (s *SQLiteStore) InsertCrew(c Crew) (int64, error)

InsertCrew creates a new crew record.

func (*SQLiteStore) InsertCrewMember added in v0.4.0

func (s *SQLiteStore) InsertCrewMember(m CrewMember) (int64, error)

InsertCrewMember creates a new crew member record.

func (*SQLiteStore) InsertCustomer added in v0.4.0

func (s *SQLiteStore) InsertCustomer(c Customer) (int64, error)

InsertCustomer creates a new customer record.

func (*SQLiteStore) InsertEstimate added in v0.4.0

func (s *SQLiteStore) InsertEstimate(e Estimate) (int64, error)

InsertEstimate creates a new estimate record.

func (*SQLiteStore) InsertEvent

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

InsertEvent records an orchestration event.

func (*SQLiteStore) InsertFollowUp added in v0.4.0

func (s *SQLiteStore) InsertFollowUp(f FollowUp) (int64, error)

InsertFollowUp creates a new follow-up action.

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) InsertInvoice added in v0.4.0

func (s *SQLiteStore) InsertInvoice(i Invoice) (int64, error)

InsertInvoice creates a new invoice record.

func (*SQLiteStore) InsertItem added in v0.4.0

func (s *SQLiteStore) InsertItem(i Item) (int64, error)

InsertItem creates a new catalog item.

func (*SQLiteStore) InsertJob added in v0.4.0

func (s *SQLiteStore) InsertJob(j Job) (int64, error)

InsertJob creates a new job record.

func (*SQLiteStore) InsertMemoryItem

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

InsertMemoryItem saves a memory item and returns its ID.

func (*SQLiteStore) InsertProcessSnapshot

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

InsertProcessSnapshot records a process state snapshot.

func (*SQLiteStore) InsertProductionRate added in v0.4.0

func (s *SQLiteStore) InsertProductionRate(p ProductionRate) (int64, error)

InsertProductionRate records an estimate-vs-actual data point.

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) InsertProperty added in v0.4.0

func (s *SQLiteStore) InsertProperty(p Property) (int64, error)

InsertProperty creates a new property record.

func (*SQLiteStore) InsertSalesLead added in v0.4.0

func (s *SQLiteStore) InsertSalesLead(l SalesLead) (int64, error)

InsertSalesLead creates a new sales lead record.

func (*SQLiteStore) InsertVendor added in v0.4.0

func (s *SQLiteStore) InsertVendor(v Vendor) (int64, error)

InsertVendor creates a new vendor record.

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) 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) ListBudgetLines added in v0.4.0

func (s *SQLiteStore) ListBudgetLines(budgetID int64) ([]BudgetLine, error)

ListBudgetLines returns all line items for a given budget.

func (*SQLiteStore) ListBudgetYears added in v0.4.0

func (s *SQLiteStore) ListBudgetYears() ([]int, error)

ListBudgetYears returns distinct budget years in descending order.

func (*SQLiteStore) ListCalendarEvents added in v0.4.0

func (s *SQLiteStore) ListCalendarEvents(date string, limit int) ([]CalendarEvent, error)

ListCalendarEvents returns events for a specific date.

func (*SQLiteStore) ListCalendarEventsByCrew added in v0.4.0

func (s *SQLiteStore) ListCalendarEventsByCrew(crewID int64, date string, limit int) ([]CalendarEvent, error)

ListCalendarEventsByCrew returns events for a specific crew on a given date.

func (*SQLiteStore) ListCalendarEventsByRange added in v0.4.0

func (s *SQLiteStore) ListCalendarEventsByRange(startDate, endDate string, limit int) ([]CalendarEvent, error)

ListCalendarEventsByRange returns events within a date range (inclusive).

func (*SQLiteStore) ListChannelMessages added in v0.3.0

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

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

func (*SQLiteStore) ListChannels added in v0.3.0

func (s *SQLiteStore) ListChannels(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) ListCostCodes added in v0.4.0

func (s *SQLiteStore) ListCostCodes(division string, limit int) ([]CostCode, error)

ListCostCodes returns cost codes optionally filtered by division.

func (*SQLiteStore) ListCrewMembers added in v0.4.0

func (s *SQLiteStore) ListCrewMembers(role string, activeOnly bool, limit int) ([]CrewMember, error)

ListCrewMembers returns crew members filtered by role and active status.

func (*SQLiteStore) ListCrews added in v0.4.0

func (s *SQLiteStore) ListCrews(activeOnly bool, limit int) ([]Crew, error)

ListCrews returns crews optionally filtered by active status.

func (*SQLiteStore) ListCustomers added in v0.4.0

func (s *SQLiteStore) ListCustomers(limit int) ([]Customer, error)

ListCustomers returns recent customers ordered by updated_at.

func (*SQLiteStore) ListDivisions added in v0.4.0

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

ListDivisions returns distinct division names from cost codes.

func (*SQLiteStore) ListEstimates added in v0.4.0

func (s *SQLiteStore) ListEstimates(status string, limit int) ([]Estimate, error)

ListEstimates returns estimates optionally filtered by status.

func (*SQLiteStore) ListEstimatesByCustomer added in v0.4.0

func (s *SQLiteStore) ListEstimatesByCustomer(customerID int64, limit int) ([]Estimate, error)

ListEstimatesByCustomer returns estimates for a given customer.

func (*SQLiteStore) ListEvents

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

ListEvents returns recent events, newest first.

func (*SQLiteStore) ListFollowUpsByAgent added in v0.4.0

func (s *SQLiteStore) ListFollowUpsByAgent(agent, status string, limit int) ([]FollowUp, error)

ListFollowUpsByAgent returns all follow-ups for an agent.

func (*SQLiteStore) ListFollowUpsDue added in v0.4.0

func (s *SQLiteStore) ListFollowUpsDue(agent, asOfDate string, limit int) ([]FollowUp, error)

ListFollowUpsDue returns pending follow-ups due on or before the given date.

func (*SQLiteStore) ListInboxItems added in v0.3.0

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

func (*SQLiteStore) ListInvoices added in v0.4.0

func (s *SQLiteStore) ListInvoices(status string, limit int) ([]Invoice, error)

ListInvoices returns invoices optionally filtered by status.

func (*SQLiteStore) ListInvoicesByCustomer added in v0.4.0

func (s *SQLiteStore) ListInvoicesByCustomer(customerID int64, limit int) ([]Invoice, error)

ListInvoicesByCustomer returns invoices for a given customer.

func (*SQLiteStore) ListItems added in v0.4.0

func (s *SQLiteStore) ListItems(category string, activeOnly bool, limit int) ([]Item, error)

ListItems returns catalog items filtered by category and active status.

func (*SQLiteStore) ListJobs added in v0.4.0

func (s *SQLiteStore) ListJobs(limit int) ([]Job, error)

ListJobs returns recent jobs across all stages.

func (*SQLiteStore) ListJobsByStage added in v0.4.0

func (s *SQLiteStore) ListJobsByStage(stage string, limit int) ([]Job, error)

ListJobsByStage returns jobs in a given lifecycle stage.

func (*SQLiteStore) ListMCPServers added in v0.3.0

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

ListMCPServers returns all persisted MCP server configs.

func (*SQLiteStore) ListMemoryItemsByTopic

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

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

func (*SQLiteStore) ListProcessSnapshots

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

ListProcessSnapshots returns the latest snapshot per process.

func (*SQLiteStore) ListPromptHistory added in v0.3.0

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

ListPromptHistory returns prompt history entries, newest first.

func (*SQLiteStore) ListPropertiesByCustomer added in v0.4.0

func (s *SQLiteStore) ListPropertiesByCustomer(customerID int64, limit int) ([]Property, error)

ListPropertiesByCustomer returns properties for a given customer.

func (*SQLiteStore) ListSalesLeads added in v0.4.0

func (s *SQLiteStore) ListSalesLeads(status string, limit int) ([]SalesLead, error)

ListSalesLeads returns sales leads optionally filtered by status.

func (*SQLiteStore) ListSalesLeadsByAssignee added in v0.4.0

func (s *SQLiteStore) ListSalesLeadsByAssignee(assignee string, limit int) ([]SalesLead, error)

ListSalesLeadsByAssignee returns sales leads assigned to a specific person.

func (*SQLiteStore) ListScheduledJobs

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

ListScheduledJobs returns all scheduled jobs.

func (*SQLiteStore) ListSettings added in v0.2.0

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

ListSettings returns all settings.

func (*SQLiteStore) ListThreadMessages added in v0.3.0

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

ListThreadMessages returns the original message and all replies in a thread.

func (*SQLiteStore) ListVendors added in v0.4.0

func (s *SQLiteStore) ListVendors(activeOnly bool, limit int) ([]Vendor, error)

ListVendors returns vendors optionally filtered by active status.

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) 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) 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) SearchCustomers added in v0.4.0

func (s *SQLiteStore) SearchCustomers(query string, limit int) ([]Customer, error)

SearchCustomers searches customers by name, contact_name, email, phone, tags, and notes.

func (*SQLiteStore) SearchItems added in v0.4.0

func (s *SQLiteStore) SearchItems(query string, limit int) ([]Item, error)

SearchItems searches catalog items by name, category, supplier, sku, and notes.

func (*SQLiteStore) SearchJobs added in v0.4.0

func (s *SQLiteStore) SearchJobs(query string, limit int) ([]Job, error)

SearchJobs searches jobs by customer name or job type.

func (*SQLiteStore) SearchMemoryItems

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

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

func (*SQLiteStore) SearchPromptHistory added in v0.3.0

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

SearchPromptHistory searches prompt history by keyword via LIKE.

func (*SQLiteStore) SearchVendors added in v0.4.0

func (s *SQLiteStore) SearchVendors(query string, limit int) ([]Vendor, error)

SearchVendors searches vendors by name, contact_name, specialty, and notes.

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) UpdateBudget added in v0.4.0

func (s *SQLiteStore) UpdateBudget(b Budget) error

UpdateBudget updates all fields of a budget by ID.

func (*SQLiteStore) UpdateCalendarEvent added in v0.4.0

func (s *SQLiteStore) UpdateCalendarEvent(e CalendarEvent) error

UpdateCalendarEvent updates all fields of a calendar event by ID.

func (*SQLiteStore) UpdateChannelTeam added in v0.3.0

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

UpdateChannelTeam updates the team members of a channel.

func (*SQLiteStore) UpdateCrew added in v0.4.0

func (s *SQLiteStore) UpdateCrew(c Crew) error

UpdateCrew updates all fields of a crew by ID.

func (*SQLiteStore) UpdateCrewMember added in v0.4.0

func (s *SQLiteStore) UpdateCrewMember(m CrewMember) error

UpdateCrewMember updates all fields of a crew member by ID.

func (*SQLiteStore) UpdateCustomer added in v0.4.0

func (s *SQLiteStore) UpdateCustomer(c Customer) error

UpdateCustomer updates all fields of a customer by ID.

func (*SQLiteStore) UpdateEstimate added in v0.4.0

func (s *SQLiteStore) UpdateEstimate(e Estimate) error

UpdateEstimate updates all fields of an estimate by ID.

func (*SQLiteStore) UpdateEstimateStatus added in v0.4.0

func (s *SQLiteStore) UpdateEstimateStatus(id int64, status string) error

UpdateEstimateStatus changes just the status of an estimate.

func (*SQLiteStore) UpdateInvoice added in v0.4.0

func (s *SQLiteStore) UpdateInvoice(i Invoice) error

UpdateInvoice updates all fields of an invoice by ID.

func (*SQLiteStore) UpdateInvoiceStatus added in v0.4.0

func (s *SQLiteStore) UpdateInvoiceStatus(id int64, status, paidDate, paymentMethod string) error

UpdateInvoiceStatus updates the status and payment details of an invoice.

func (*SQLiteStore) UpdateItem added in v0.4.0

func (s *SQLiteStore) UpdateItem(i Item) error

UpdateItem updates all fields of a catalog item by ID.

func (*SQLiteStore) UpdateJobStage added in v0.4.0

func (s *SQLiteStore) UpdateJobStage(id int64, stage, ownerAgent, notes string) error

UpdateJobStage advances a job to a new lifecycle stage.

func (*SQLiteStore) UpdateJobTotals added in v0.4.0

func (s *SQLiteStore) UpdateJobTotals(id int64, estimateTotal, actualTotal float64) error

UpdateJobTotals sets estimate and actual totals for job costing.

func (*SQLiteStore) UpdateProperty added in v0.4.0

func (s *SQLiteStore) UpdateProperty(p Property) error

UpdateProperty updates all fields of a property by ID.

func (*SQLiteStore) UpdateSalesLead added in v0.4.0

func (s *SQLiteStore) UpdateSalesLead(l SalesLead) error

UpdateSalesLead updates all fields of a sales lead by ID.

func (*SQLiteStore) UpdateVendor added in v0.4.0

func (s *SQLiteStore) UpdateVendor(v Vendor) error

UpdateVendor updates all fields of a vendor by ID.

func (*SQLiteStore) UpdateWorkflowRun

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

UpdateWorkflowRun updates a workflow run status and result.

func (*SQLiteStore) UpsertMCPServer added in v0.3.0

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

UpsertMCPServer persists an MCP server connection config.

func (*SQLiteStore) UpsertScheduledJob

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

UpsertScheduledJob creates or replaces a scheduled job.

func (*SQLiteStore) UpsertSetting added in v0.2.0

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

UpsertSetting creates or updates a setting.

func (*SQLiteStore) UpsertUserMemory

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

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

func (*SQLiteStore) Vacuum added in v0.2.0

func (s *SQLiteStore) Vacuum()

Vacuum reclaims unused space in the database.

type SalesLead added in v0.4.0

type SalesLead struct {
	ID              int64     `json:"id"`
	CustomerID      int64     `json:"customer_id"`
	Name            string    `json:"name"`
	Phone           string    `json:"phone"`
	Email           string    `json:"email"`
	Source          string    `json:"source"`
	Status          string    `json:"status"`
	EstimatedValue  float64   `json:"estimated_value"`
	JobType         string    `json:"job_type"`
	PropertyAddress string    `json:"property_address"`
	AssignedTo      string    `json:"assigned_to"`
	LostReason      string    `json:"lost_reason"`
	Notes           string    `json:"notes"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
}

SalesLead represents a sales pipeline lead.

type ScheduledJob

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

ScheduledJob is a persisted recurring agent trigger.

type Scheduler

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

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

func NewScheduler

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

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

func (*Scheduler) AddJob

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

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

func (*Scheduler) ListJobs

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

ListJobs returns a snapshot of all current jobs.

func (*Scheduler) RemoveJob

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

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

func (*Scheduler) Start

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

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

type Server

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

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

func New

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

New creates a new Server.

func (*Server) Start

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

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

type Setting added in v0.2.0

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

Setting is a persisted key-value configuration entry.

type SpawnTreeNodeResponse

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

SpawnTreeNodeResponse is the API representation of a spawn tree node.

type StatsResponse

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

StatsResponse contains aggregate metrics.

type Store

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

	// Close closes the store.
	Close() error

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Store persists events and process snapshots for historical queries.

type StoreEvent

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

StoreEvent is a persisted orchestration event.

type TelegramBot

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

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

func NewTelegramBot

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

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

func (*TelegramBot) Start

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

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

type UpdateAgentRequest added in v0.3.0

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

UpdateAgentRequest is the request to update an existing composed agent.

type UserMemory

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

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

type Vendor added in v0.4.0

type Vendor struct {
	ID            int64     `json:"id"`
	Name          string    `json:"name"`
	ContactName   string    `json:"contact_name"`
	Phone         string    `json:"phone"`
	Email         string    `json:"email"`
	Address       string    `json:"address"`
	Specialty     string    `json:"specialty"`
	PaymentTerms  string    `json:"payment_terms"`
	AccountNumber string    `json:"account_number"`
	Active        bool      `json:"active"`
	Notes         string    `json:"notes"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Vendor represents a supplier or subcontractor.

type WorkflowResponse

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

WorkflowResponse is the API representation of a workflow definition.

type WorkflowRun

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

WorkflowRun is a persisted workflow execution.

type WorkflowRunRequest

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

WorkflowRunRequest is the request to launch a workflow.

type WorkflowRunResponse

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

WorkflowRunResponse is returned when a workflow is launched.

type WorkspaceFile added in v0.2.0

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

WorkspaceFile tracks a file written by an agent.

Jump to

Keyboard shortcuts

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