types

package
v0.3.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package types defines core data structures for Drover

Package types defines core data structures for Drover

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conversation

type Conversation struct {
	ID        string             `json:"id" db:"id"`
	TaskID    string             `json:"task_id" db:"task_id"`
	Worktree  string             `json:"worktree,omitempty" db:"worktree"`
	Status    ConversationStatus `json:"status" db:"status"`
	CreatedAt int64              `json:"created_at" db:"created_at"`
	UpdatedAt int64              `json:"updated_at" db:"updated_at"`

	// Metadata
	TurnCount       int    `json:"turn_count" db:"turn_count"`
	TotalTokens     int    `json:"total_tokens" db:"total_tokens"`
	LastMessageAt   int64  `json:"last_message_at" db:"last_message_at"`
	CompressionType string `json:"compression_type,omitempty" db:"compression_type"` // "none", "zstd"
}

Conversation represents a conversation with an AI agent

type ConversationContext

type ConversationContext struct {
	ConversationID string              `json:"conversation_id"`
	TaskID         string              `json:"task_id"`
	Turns          []*ConversationTurn `json:"turns"`
	TotalTokens    int                 `json:"total_tokens"`
	TokenBudget    int                 `json:"token_budget"`
	LoadedAt       int64               `json:"loaded_at"`
}

ConversationContext represents the context loaded for a conversation

type ConversationRole

type ConversationRole string

ConversationRole represents the role of a message sender

const (
	ConversationRoleUser      ConversationRole = "user"
	ConversationRoleAssistant ConversationRole = "assistant"
	ConversationRoleSystem    ConversationRole = "system"
	ConversationRoleTool      ConversationRole = "tool"
)

type ConversationSearchResult

type ConversationSearchResult struct {
	Turn        *ConversationTurn `json:"turn"`
	Rank        float64           `json:"rank"`
	MatchCount  int               `json:"match_count"`
	Highlighted string            `json:"highlighted,omitempty"` // Search term highlights
}

ConversationSearchResult represents a search result from FTS5

type ConversationStats

type ConversationStats struct {
	TotalTurns       int     `json:"total_turns"`
	UserTurns        int     `json:"user_turns"`
	AssistantTurns   int     `json:"assistant_turns"`
	ToolTurns        int     `json:"tool_turns"`
	TotalTokens      int     `json:"total_tokens"`
	AvgTokensPerTurn float64 `json:"avg_tokens_per_turn"`
	StorageBytes     int64   `json:"storage_bytes"`
	Duration         int64   `json:"duration"` // in seconds
}

ConversationStats represents statistics about a conversation

type ConversationStatus

type ConversationStatus string

ConversationStatus represents the state of a conversation

const (
	ConversationStatusActive    ConversationStatus = "active"
	ConversationStatusPaused    ConversationStatus = "paused"
	ConversationStatusCompleted ConversationStatus = "completed"
	ConversationStatusFailed    ConversationStatus = "failed"
)

type ConversationTurn

type ConversationTurn struct {
	ID             string           `json:"id" db:"id"`
	ConversationID string           `json:"conversation_id" db:"conversation_id"`
	TurnNumber     int              `json:"turn_number" db:"turn_number"`
	Role           ConversationRole `json:"role" db:"role"`
	Content        string           `json:"content" db:"content"` // May be compressed

	// Tool use fields (only populated when role == "tool")
	ToolUseID  string `json:"tool_use_id,omitempty" db:"tool_use_id"`
	ToolName   string `json:"tool_name,omitempty" db:"tool_name"`
	ToolInput  string `json:"tool_input,omitempty" db:"tool_input"`
	ToolResult string `json:"tool_result,omitempty" db:"tool_result"` // May be compressed

	// Token usage
	TokensUsed int   `json:"tokens_used,omitempty" db:"tokens_used"`
	CreatedAt  int64 `json:"created_at" db:"created_at"`

	// Metadata
	Compressed bool `json:"-" db:"compressed"` // Internal flag indicating content is compressed
}

ConversationTurn represents a single message or tool use in a conversation

type ConversationTurnFTS

type ConversationTurnFTS struct {
	RowID    int64  `json:"row_id"`
	TurnID   string `json:"turn_id"`
	Content  string `json:"content"`
	ToolName string `json:"tool_name"`
	Role     string `json:"role"`
}

ConversationTurnFTS represents the FTS5 searchable version of a turn

type Epic

type Epic struct {
	ID          string     `json:"id" db:"id"`
	Title       string     `json:"title" db:"title"`
	Description string     `json:"description" db:"description"`
	Status      EpicStatus `json:"status" db:"status"`
	CreatedAt   int64      `json:"created_at" db:"created_at"`
}

Epic groups related tasks

type EpicStatus

type EpicStatus string

EpicStatus represents the state of an epic

const (
	EpicStatusOpen   EpicStatus = "open"
	EpicStatusClosed EpicStatus = "closed"
)

type EpicStatusSummary

type EpicStatusSummary struct {
	Epic       Epic    `json:"epic"`
	TotalTasks int     `json:"total_tasks"`
	Completed  int     `json:"completed"`
	Progress   float64 `json:"progress"`
}

EpicStatusSummary summarizes a single epic

type GuidanceMessage

type GuidanceMessage struct {
	ID        string `json:"id"`
	TaskID    string `json:"task_id"`
	Message   string `json:"message"`
	CreatedAt int64  `json:"created_at"`
	Delivered bool   `json:"delivered"`
}

GuidanceMessage represents a hint or guidance message for a task

type ProjectStatus

type ProjectStatus struct {
	Total      int          `json:"total"`
	Ready      int          `json:"ready"`
	Claimed    int          `json:"claimed"`
	InProgress int          `json:"in_progress"`
	Blocked    int          `json:"blocked"`
	Completed  int          `json:"completed"`
	Failed     int          `json:"failed"`
	Epics      []EpicStatus `json:"epics"`
}

ProjectStatus summarizes the current state of all tasks

type Task

type Task struct {
	ID             string      `json:"id" db:"id"`
	Title          string      `json:"title" db:"title"`
	Description    string      `json:"description" db:"description"`
	EpicID         string      `json:"epic_id" db:"epic_id"`
	ParentID       string      `json:"parent_id,omitempty" db:"parent_id"`             // Parent task ID for sub-tasks
	SequenceNumber int         `json:"sequence_number,omitempty" db:"sequence_number"` // Position among siblings (1-indexed)
	Type           TaskType    `json:"type" db:"type"`                                 // Task type (feature, bug, etc.)
	Priority       int         `json:"priority" db:"priority"`
	Status         TaskStatus  `json:"status" db:"status"`
	Attempts       int         `json:"attempts" db:"attempts"`
	MaxAttempts    int         `json:"max_attempts" db:"max_attempts"`
	LastError      string      `json:"last_error" db:"last_error"`
	ClaimedBy      string      `json:"claimed_by" db:"claimed_by"`
	ClaimedAt      *int64      `json:"claimed_at" db:"claimed_at"`
	Operator       string      `json:"operator" db:"operator"`                   // The operator/user who created or claimed this task
	Verdict        TaskVerdict `json:"verdict" db:"verdict"`                     // Structured outcome verdict
	VerdictReason  string      `json:"verdict_reason" db:"verdict_reason"`       // Reason for verdict
	TestMode       string      `json:"test_mode,omitempty" db:"test_mode"`       // Test execution mode (strict/lenient/disabled)
	TestScope      string      `json:"test_scope,omitempty" db:"test_scope"`     // Test scope (all/diff/skip)
	TestCommand    string      `json:"test_command,omitempty" db:"test_command"` // Custom test command
	CreatedAt      int64       `json:"created_at" db:"created_at"`
	UpdatedAt      int64       `json:"updated_at" db:"updated_at"`
	// ExecutionContext is not persisted in DB - it's set at runtime for execution
	ExecutionContext *TaskExecutionContext `json:"-" db:"-"` // Runtime execution context (guidance, worktree path, etc.)
}

Task represents a unit of work for an AI agent

type TaskCheckpoint

type TaskCheckpoint struct {
	TaskID        string     `json:"task_id"`
	State         TaskStatus `json:"state"`
	WorkerPID     int        `json:"worker_pid"`
	StartedAt     int64      `json:"started_at"`
	LastHeartbeat int64      `json:"last_heartbeat"`
	Attempt       int        `json:"attempt"`
	Output        string     `json:"output,omitempty"`
}

TaskCheckpoint represents the execution state of a task for crash recovery

type TaskDependency

type TaskDependency struct {
	TaskID    string `json:"task_id" db:"task_id"`
	BlockedBy string `json:"blocked_by" db:"blocked_by"`
}

TaskDependency represents a blocked-by relationship

type TaskExecutionContext

type TaskExecutionContext struct {
	Guidance     []*GuidanceMessage `json:"guidance,omitempty"`      // Pending guidance messages
	WorktreePath string             `json:"worktree_path,omitempty"` // Path to the worktree
}

TaskExecutionContext provides additional context for task execution

type TaskStatus

type TaskStatus string

TaskStatus represents the current state of a task

const (
	TaskStatusReady      TaskStatus = "ready"
	TaskStatusClaimed    TaskStatus = "claimed"
	TaskStatusInProgress TaskStatus = "in_progress"
	TaskStatusPaused     TaskStatus = "paused"
	TaskStatusBlocked    TaskStatus = "blocked"
	TaskStatusCompleted  TaskStatus = "completed"
	TaskStatusFailed     TaskStatus = "failed"
	TaskStatusCancelled  TaskStatus = "cancelled"
)

type TaskType

type TaskType string

TaskType represents the type of work a task represents

const (
	TaskTypeFeature  TaskType = "feature"  // New feature implementation
	TaskTypeBug      TaskType = "bug"      // Bug fix
	TaskTypeRefactor TaskType = "refactor" // Code refactoring
	TaskTypeTest     TaskType = "test"     // Test writing/fixing
	TaskTypeDocs     TaskType = "docs"     // Documentation
	TaskTypeResearch TaskType = "research" // Research/investigation
	TaskTypeFix      TaskType = "fix"      // Fix task (created for blockers)
	TaskTypeOther    TaskType = "other"    // Other type
)

type TaskVerdict

type TaskVerdict string

TaskVerdict represents the structured outcome of a task execution

const (
	TaskVerdictPass    TaskVerdict = "pass"    // Task completed successfully
	TaskVerdictFail    TaskVerdict = "fail"    // Task failed
	TaskVerdictBlocked TaskVerdict = "blocked" // Task was blocked
	TaskVerdictUnknown TaskVerdict = "unknown" // Verdict could not be determined
)

Jump to

Keyboard shortcuts

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