Documentation
¶
Overview ¶
Package models defines shared types used across the Samverk system.
Index ¶
Constants ¶
const SchemaVersion = "1.0.0"
SchemaVersion is the current issue schema version.
Variables ¶
This section is empty.
Functions ¶
func RenderFrontmatter ¶
func RenderFrontmatter(fm *IssueFrontmatter, markdown string) string
RenderFrontmatter produces an issue body with YAML frontmatter followed by markdown.
Types ¶
type AgentType ¶
type AgentType string
AgentType identifies which agent pool should handle an issue.
const ( AgentTypeOrchestrator AgentType = "orchestrator" AgentTypeDispatcher AgentType = "dispatcher" AgentTypeCodeGen AgentType = "code-gen" AgentTypeTest AgentType = "test" AgentTypeDocs AgentType = "docs" AgentTypeResearch AgentType = "research" AgentTypeQC AgentType = "qc" AgentTypeHuman AgentType = "human" )
type Complexity ¶
type Complexity string
Complexity hints at whether work should run locally or in the cloud.
const ( ComplexityLocal Complexity = "local" ComplexityCloud Complexity = "cloud" ComplexityAmbiguous Complexity = "ambiguous" )
type CostRecord ¶
type CostRecord struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Provider string `json:"provider"`
Model string `json:"model"`
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
CostUSD float64 `json:"cost_usd"` // 0 for local models
CreatedAt time.Time `json:"created_at"`
}
CostRecord tracks token usage for a single API call.
type CostSummary ¶
type CostSummary struct {
TotalInputTokens int `json:"total_input_tokens"`
TotalOutputTokens int `json:"total_output_tokens"`
TotalCostUSD float64 `json:"total_cost_usd"`
RecordCount int `json:"record_count"`
}
CostSummary aggregates cost data over a time period.
type IssueFrontmatter ¶
type IssueFrontmatter struct {
SchemaVersion string `yaml:"schema_version"`
Type IssueType `yaml:"type"`
AgentType AgentType `yaml:"agent_type"`
Priority Priority `yaml:"priority"`
ParentIssue int `yaml:"parent_issue,omitempty"`
DependsOn []int `yaml:"depends_on,omitempty"`
EstimatedTokens int `yaml:"estimated_tokens,omitempty"`
ActualTokens int `yaml:"actual_tokens,omitempty"`
ModelUsed string `yaml:"model_used,omitempty"`
}
IssueFrontmatter represents the YAML frontmatter parsed from an issue body.
type ParseResult ¶
type ParseResult struct {
Frontmatter *IssueFrontmatter
Body string // markdown after the closing ---
}
ParseResult holds the parsed frontmatter and remaining body text.
func ParseFrontmatter ¶
func ParseFrontmatter(body string) (*ParseResult, error)
ParseFrontmatter extracts YAML frontmatter from an issue body. The frontmatter must be delimited by --- on its own line at the start of the body. Returns error if frontmatter is present but malformed. Returns nil Frontmatter (no error) if no frontmatter block exists.
type Session ¶
type Session struct {
ID string `json:"id"`
IssueNumber int `json:"issue_number"`
AgentType string `json:"agent_type"` // e.g., "code-gen", "qc", "research"
Provider string `json:"provider"` // e.g., "ollama", "claude", "openai"
Model string `json:"model"` // e.g., "qwen2.5-coder:7b"
Status SessionStatus `json:"status"`
StartedAt time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Session represents a unit of agent work on an issue.
type SessionStatus ¶
type SessionStatus string
SessionStatus represents the lifecycle state of a work session.
const ( SessionStatusPending SessionStatus = "pending" SessionStatusActive SessionStatus = "active" SessionStatusCompleted SessionStatus = "completed" SessionStatusFailed SessionStatus = "failed" SessionStatusCancelled SessionStatus = "cancelled" )