models

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxFilterStatusCount   = 10
	MaxFilterTagsCount     = 20
	MaxFilterMetadataCount = 50
	MaxFilterLimit         = 1000
)

Constants for validation limits

Variables

This section is empty.

Functions

func ParseTimeString

func ParseTimeString(timeStr string) (time.Time, error)

Helper method to parse time strings from API requests

Types

type AISummary

type AISummary struct {
	// Content fields
	CurrentActivity string      `json:"current_activity,omitempty"`
	History         []Milestone `json:"history,omitempty"` // Renamed from Milestones

	// Metadata
	LastUpdated         time.Time `json:"last_updated"`
	UpdateCount         int       `json:"update_count"`
	NextUpdateAtMessage int       `json:"next_update_at_message"`

	// Legacy fields for backward compatibility
	Title            string    `json:"title,omitempty"`
	Description      string    `json:"description,omitempty"`
	KeyPoints        []string  `json:"key_points,omitempty"`
	TechnicalDetails []string  `json:"technical_details,omitempty"`
	Outcomes         []string  `json:"outcomes,omitempty"`
	GeneratedAt      time.Time `json:"generated_at,omitempty"`
	GeneratedBy      string    `json:"generated_by,omitempty"`
	Error            string    `json:"error,omitempty"`
}

AISummary represents AI-generated session summary

type ClaudeNotification

type ClaudeNotification struct {
	ID                     string    `json:"id" db:"id"`
	SessionID              string    `json:"session_id" db:"session_id"`
	Timestamp              time.Time `json:"timestamp" db:"timestamp"`
	Type                   string    `json:"type" db:"type"`
	Level                  string    `json:"level" db:"level"` // info|warning|error
	Message                string    `json:"message" db:"message"`
	SystemNotificationSent bool      `json:"system_notification_sent" db:"system_notification_sent"`
}

ClaudeNotification represents a notification from Claude

type Config

type Config struct {
	Server                    ServerConfig                    `yaml:"server"`
	Storage                   StorageConfig                   `yaml:"storage"`
	Database                  DatabaseConfig                  `yaml:"database"`
	ToolSummarization         ToolSummarizationConfig         `yaml:"tool_summarization"`
	MessageExtraction         MessageExtractionConfig         `yaml:"message_extraction"`
	ConversationSummarization ConversationSummarizationConfig `yaml:"conversation_summarization"`
	SDK                       SDKConfig                       `yaml:"sdk"`
}

Config represents the complete application configuration

type ConversationSummarizationConfig

type ConversationSummarizationConfig struct {
	Enabled            bool   `yaml:"enabled"`
	LLMCommand         string `yaml:"llm_command"`
	UpdateInterval     int    `yaml:"update_interval"` // update every N messages
	CurrentWindow      int    `yaml:"current_window"`  // messages for current activity
	RecentWindow       int    `yaml:"recent_window"`   // messages for recent context
	MaxInputTokens     int    `yaml:"max_input_tokens"`
	MilestoneDetection bool   `yaml:"milestone_detection"`
}

ConversationSummarizationConfig holds configuration for conversation summarization

type DatabaseConfig

type DatabaseConfig struct {
	Path         string `yaml:"path"`
	MaxOpenConns int    `yaml:"max_open_conns"`
	MaxIdleConns int    `yaml:"max_idle_conns"`
}

DatabaseConfig holds database-specific configuration

type Event

type Event struct {
	ID              string          `json:"id" db:"id"`
	SessionID       string          `json:"session_id" db:"session_id"`
	Type            EventType       `json:"type" db:"type"`
	Timestamp       time.Time       `json:"timestamp" db:"timestamp"`
	Source          string          `json:"source" db:"source"`
	Data            json.RawMessage `json:"data" db:"data"`
	CorrelationID   string          `json:"correlation_id,omitempty" db:"correlation_id"`
	TranscriptIndex int             `json:"transcript_index,omitempty" db:"transcript_index"`
	CreatedAt       time.Time       `json:"created_at" db:"created_at"`
	// Additional fields from events package
	TranscriptPath string        `json:"transcript_path,omitempty" db:"-"`
	TranscriptUUID string        `json:"transcript_uuid,omitempty" db:"transcript_uuid"`
	ParentUUID     string        `json:"parent_uuid,omitempty" db:"parent_uuid"`
	Metadata       EventMetadata `json:"metadata" db:"-"`
}

Event represents any system event

func (*Event) GetDataAsMap

func (e *Event) GetDataAsMap() (map[string]any, error)

GetDataAsMap returns the Data field as a map[string]any

func (*Event) SetDataFromMap

func (e *Event) SetDataFromMap(data map[string]any) error

SetDataFromMap sets the Data field from a map[string]any

type EventMetadata

type EventMetadata struct {
	Version       string            `json:"version"`
	Source        string            `json:"source"` // hook name
	Environment   map[string]string `json:"environment,omitempty"`
	CorrelationID string            `json:"correlation_id,omitempty"`
}

EventMetadata contains metadata about an event

func (*EventMetadata) Scan

func (em *EventMetadata) Scan(value interface{}) error

Scan implements sql.Scanner for EventMetadata

func (EventMetadata) Value

func (em EventMetadata) Value() (driver.Value, error)

Value implements driver.Valuer for EventMetadata

type EventType

type EventType string

EventType represents the type of event

const (
	EventTypeNotification EventType = "notification"
	EventTypeToolUse      EventType = "tool_use"
	EventTypeMessage      EventType = "message"
	EventTypeError        EventType = "error"
	EventTypeStateChange  EventType = "state_change"
	EventTypeTranscript   EventType = "transcript"
	// Additional event types from events package
	EventStop         EventType = "stop"
	EventPreToolUse   EventType = "pretooluse"
	EventPostToolUse  EventType = "posttooluse"
	EventSubagentStop EventType = "subagentstop"
)

type ExpirationConfig

type ExpirationConfig struct {
	TestDataTTL     time.Duration `yaml:"test_data_ttl"`
	CleanupInterval time.Duration `yaml:"cleanup_interval"`
	StaleDataTTL    time.Duration `yaml:"stale_data_ttl"`
	TestSessionTTL  time.Duration `yaml:"test_session_ttl"`
}

ExpirationConfig defines data expiration settings

type Filter

type Filter struct {
	StartTime *time.Time        `json:"start_time,omitempty"`
	EndTime   *time.Time        `json:"end_time,omitempty"`
	Status    []string          `json:"status,omitempty"`
	Tags      []string          `json:"tags,omitempty"`
	Metadata  map[string]string `json:"metadata,omitempty"`
	OrderBy   string            `json:"order_by,omitempty"`
	Limit     int               `json:"limit,omitempty"`
	Offset    int               `json:"offset,omitempty"`
}

Filter represents common query filters

func (*Filter) Validate

func (f *Filter) Validate() error

Validate validates the filter constraints

type GitStatus

type GitStatus struct {
	Repository string `json:"repository"`
	Status     string `json:"status"`
	HasChanges bool   `json:"hasChanges"`
	IsClean    bool   `json:"isClean"`
}

GitStatus represents git repository status

type Identifiable

type Identifiable struct {
	ID   string `json:"id" db:"id"`
	UUID string `json:"uuid,omitempty" db:"uuid"`
}

Identifiable provides common ID fields

type JSONField

type JSONField[T any] struct {
	Data T
}

JSONField is a generic type for JSON database fields

func (*JSONField[T]) Scan

func (j *JSONField[T]) Scan(value interface{}) error

func (JSONField[T]) Value

func (j JSONField[T]) Value() (driver.Value, error)

type Message

type Message struct {
	ID         string          `json:"id" db:"id"`
	SessionID  string          `json:"session_id" db:"session_id"`
	Role       MessageRole     `json:"role" db:"role"`
	Content    string          `json:"content" db:"content"`
	Timestamp  time.Time       `json:"timestamp" db:"timestamp"`
	TokenCount int             `json:"token_count,omitempty" db:"token_count"`
	Metadata   MessageMetadata `json:"metadata,omitempty" db:"metadata"`
}

Message represents a Claude conversation message

type MessageExtractionConfig

type MessageExtractionConfig struct {
	Enabled       bool `yaml:"enabled"`
	CheckInterval int  `yaml:"check_interval"` // seconds
	Incremental   bool `yaml:"incremental"`    // use file offset tracking
}

MessageExtractionConfig holds configuration for message extraction

type MessageMetadata

type MessageMetadata struct {
	Model           string   `json:"model,omitempty"`
	Temperature     float64  `json:"temperature,omitempty"`
	ToolCalls       []string `json:"tool_calls,omitempty"`
	ParentMessageID string   `json:"parent_message_id,omitempty"`
}

MessageMetadata contains additional message details

type MessageRole

type MessageRole string

MessageRole represents the role of a message sender

const (
	MessageRoleUser      MessageRole = "user"
	MessageRoleAssistant MessageRole = "assistant"
	MessageRoleSystem    MessageRole = "system"
)

type MessageStats

type MessageStats struct {
	TotalMessages     int       `json:"total_messages"`
	UserMessages      int       `json:"user_messages"`
	AssistantMessages int       `json:"assistant_messages"`
	LastExtraction    time.Time `json:"last_extraction,omitempty"`
}

MessageStats tracks message extraction statistics

type Metadata

type Metadata map[string]interface{}

Metadata holds arbitrary session metadata

func (*Metadata) Scan

func (m *Metadata) Scan(value interface{}) error

Scan implements sql.Scanner for database retrieval

func (Metadata) Value

func (m Metadata) Value() (driver.Value, error)

Value implements driver.Valuer for database storage

type Milestone

type Milestone struct {
	Timestamp time.Time `json:"timestamp"`
	Summary   string    `json:"summary"`        // Changed from Description to Summary to match frontend
	Type      string    `json:"type,omitempty"` // feature|fix|refactor|test|docs
}

Milestone represents a key accomplishment

type Notification

type Notification struct {
	ID                     string                 `json:"id" db:"id"`
	SessionID              string                 `json:"session_id" db:"session_id"`
	Type                   string                 `json:"type" db:"type"`
	Title                  string                 `json:"title" db:"title"`
	Body                   string                 `json:"body" db:"body"`
	Level                  string                 `json:"level" db:"level"` // info|warning|error
	Timestamp              time.Time              `json:"timestamp" db:"timestamp"`
	SystemNotificationSent bool                   `json:"system_notification_sent" db:"system_notification_sent"`
	Metadata               map[string]interface{} `json:"metadata,omitempty" db:"metadata"`
	Actions                []NotificationAction   `json:"actions,omitempty" db:"-"`
}

Notification represents a user-facing notification

type NotificationAction

type NotificationAction struct {
	Label   string `json:"label"`
	Action  string `json:"action"`
	Primary bool   `json:"primary"`
}

NotificationAction represents an action button in a notification

type NotificationConfig

type NotificationConfig struct {
	Enabled     bool            `yaml:"enabled"`
	MaxRetries  int             `yaml:"max_retries"`
	RetryDelay  time.Duration   `yaml:"retry_delay"`
	Preferences map[string]bool `yaml:"preferences"` // Per-type enable/disable
}

NotificationConfig holds notification settings

type NotificationInput

type NotificationInput struct {
	Type     string                 `json:"type"`
	Title    string                 `json:"title"`
	Body     string                 `json:"body"`
	Metadata map[string]interface{} `json:"metadata"`
}

NotificationInput represents input for creating a notification

type NotificationPreferences

type NotificationPreferences map[EventType]bool

NotificationPreferences stores user notification settings

func (NotificationPreferences) ShouldNotify

func (np NotificationPreferences) ShouldNotify(eventType EventType) bool

ShouldNotify checks if a notification should be sent for an event type

type NotificationRequest

type NotificationRequest struct {
	Timestamp              string `json:"timestamp"`
	Type                   string `json:"type"`
	Level                  string `json:"level"`
	Message                string `json:"message"`
	SystemNotificationSent bool   `json:"system_notification_sent"`
}

NotificationRequest represents the request to log a notification

type NotificationSettings

type NotificationSettings struct {
	BrowserEnabled bool   `json:"browser_enabled" db:"browser_enabled"`
	NtfyEnabled    bool   `json:"ntfy_enabled" db:"ntfy_enabled"`
	NtfyURL        string `json:"ntfy_url" db:"ntfy_url"`
	NtfyTopic      string `json:"ntfy_topic" db:"ntfy_topic"`
}

NotificationSettings represents user notification preferences

func (*NotificationSettings) Scan

func (ns *NotificationSettings) Scan(value interface{}) error

Scan implements sql.Scanner for NotificationSettings

func (NotificationSettings) Value

func (ns NotificationSettings) Value() (driver.Value, error)

Value implements driver.Valuer for NotificationSettings

type Page

type Page[T any] struct {
	Items    []T  `json:"items"`
	Total    int  `json:"total"`
	Page     int  `json:"page"`
	PageSize int  `json:"page_size"`
	HasNext  bool `json:"has_next"`
	HasPrev  bool `json:"has_prev"`
}

Page represents paginated results

type PerformanceMetrics

type PerformanceMetrics struct {
	AvgToolDurationMs      float64 `json:"avg_tool_duration_ms"`
	TotalFileReads         int     `json:"total_file_reads"`
	ModificationEfficiency float64 `json:"modification_efficiency"`
}

PerformanceMetrics contains performance analytics

type Result

type Result[T any] struct {
	Data  T      `json:"data,omitempty"`
	Error string `json:"error,omitempty"`
	Ok    bool   `json:"ok"`
}

Result represents a generic operation result

type SDKConfig

type SDKConfig struct {
	Enabled        bool       `yaml:"enabled"`
	NodeExecutable string     `yaml:"node_executable"`
	ScriptPath     string     `yaml:"script_path"`
	Options        SDKOptions `yaml:"options"`
}

SDKConfig holds configuration for Claude Code SDK integration

type SDKOptions

type SDKOptions struct {
	MaxTurns     int      `yaml:"max_turns"`
	AllowedTools []string `yaml:"allowed_tools"`
}

SDKOptions holds SDK-specific options

type ServerConfig

type ServerConfig struct {
	APIPort       int           `yaml:"api_port"`
	WebSocketPort int           `yaml:"websocket_port"`
	ReadTimeout   time.Duration `yaml:"read_timeout"`
	WriteTimeout  time.Duration `yaml:"write_timeout"`
}

ServerConfig holds HTTP/WebSocket server settings

type Session

type Session struct {
	// Core fields
	ID               string     `json:"id" db:"id"`
	Type             string     `json:"type" db:"type"` // "claude_session" or "oneshot_job"
	PID              int        `json:"pid" db:"pid"`
	Repo             string     `json:"repo" db:"repo"`
	Branch           string     `json:"branch" db:"branch"`
	TmuxKey          string     `json:"tmux_key" db:"tmux_key"`
	WorkingDirectory string     `json:"working_directory" db:"working_directory"`
	User             string     `json:"user" db:"user"`
	Status           string     `json:"status" db:"status"` // running|stopped|completed|failed|idle|error
	StartedAt        time.Time  `json:"started_at" db:"started_at"`
	EndedAt          *time.Time `json:"ended_at,omitempty" db:"ended_at"`
	LastActivity     time.Time  `json:"last_activity" db:"last_activity"`

	// Grove Flow Job specific fields
	PlanName      string `json:"plan_name,omitempty" db:"plan_name"`
	PlanDirectory string `json:"plan_directory,omitempty" db:"plan_directory"`
	JobTitle      string `json:"job_title,omitempty" db:"job_title"`
	JobFilePath   string `json:"job_file_path,omitempty" db:"job_file_path"`

	// ClaudeSessionID stores the original UUID of a claude_code session when it's
	// managed by a grove-flow interactive_agent job.
	ClaudeSessionID string `json:"claude_session_id,omitempty" db:"claude_session_id"`
	Provider        string `json:"provider,omitempty" db:"provider"`

	// Test mode
	IsTest    bool `json:"is_test" db:"is_test"`
	IsDeleted bool `json:"-" db:"is_deleted"` // Keep as internal field

	// JSON-marshaled fields
	ToolStats      *ToolStatistics `json:"tool_stats" db:"tool_stats"`
	SessionSummary *Summary        `json:"session_summary" db:"session_summary"` // Use the structured Summary type

	// Related data (populated on demand, not in main table)
	Tools         []ToolExecution      `json:"tools" db:"-"`
	Notifications []ClaudeNotification `json:"notifications" db:"-"`
	Subagents     []SubagentExecution  `json:"subagents" db:"-"`
}

Session represents a complete Claude session or a grove-flow job

func SessionFromClaudeSession

func SessionFromClaudeSession(cs interface{}) *Session

Helper method to convert ClaudeSession (old) to Session (new)

type SessionCompleteRequest

type SessionCompleteRequest struct {
	EndedAt         string         `json:"ended_at"`
	DurationSeconds int            `json:"duration_seconds"`
	ExitStatus      string         `json:"exit_status"` // completed|terminated|error
	SessionSummary  map[string]any `json:"session_summary"`
	Recommendations []string       `json:"recommendations,omitempty"`
}

SessionCompleteRequest represents the request to mark a session complete

type SessionCreateRequest

type SessionCreateRequest struct {
	SessionID        string `json:"session_id"`
	PID              int    `json:"pid"`
	Repo             string `json:"repo"`
	Branch           string `json:"branch"`
	TmuxKey          string `json:"tmux_key"`
	WorkingDirectory string `json:"working_directory"`
	User             string `json:"user"`
	StartedAt        string `json:"started_at"`
	Status           string `json:"status"`
}

SessionCreateRequest represents the request to create a new session

type SessionSummary

type SessionSummary struct {
	TotalTools         int                `json:"total_tools"`
	FilesModified      int                `json:"files_modified"`
	CommandsExecuted   int                `json:"commands_executed"`
	ErrorsCount        int                `json:"errors_count"`
	NotificationsSent  int                `json:"notifications_sent"`
	PerformanceMetrics PerformanceMetrics `json:"performance_metrics"`
	Recommendations    []string           `json:"recommendations"`
}

SessionSummary contains overall session analytics (for internal use)

type SessionUpdateRequest

type SessionUpdateRequest struct {
	Status          string          `json:"status,omitempty"`
	LastActivity    string          `json:"last_activity,omitempty"`
	ToolStats       *ToolStatistics `json:"tool_stats,omitempty"`
	CurrentActivity string          `json:"current_activity,omitempty"`
}

SessionUpdateRequest represents the request to update a session

type SimpleNotification

type SimpleNotification struct {
	Title    string   `json:"title"`
	Message  string   `json:"message"`
	Priority string   `json:"priority"`
	Tags     []string `json:"tags,omitempty"`
}

SimpleNotification represents a basic notification for external systems

type StorageConfig

type StorageConfig struct {
	Environment      string           `yaml:"environment"` // "production", "development", "test"
	StateFile        string           `yaml:"state_file"`
	TmuxConfigDir    string           `yaml:"tmux_config_dir"`
	TmuxSessionsFile string           `yaml:"tmux_sessions_file"`
	TestMode         TestModeConfig   `yaml:"test_mode"`
	Expiration       ExpirationConfig `yaml:"expiration"`
}

StorageConfig defines storage configuration options

type Subagent

type Subagent struct {
	ID              string         `json:"id" db:"id"`
	ParentSessionID string         `json:"parent_session_id" db:"parent_session_id"`
	TaskDescription string         `json:"task_description" db:"task_description"`
	TaskType        string         `json:"task_type" db:"task_type"` // search|implementation|debugging|analysis
	StartedAt       time.Time      `json:"started_at" db:"started_at"`
	CompletedAt     time.Time      `json:"completed_at" db:"completed_at"`
	DurationMs      int64          `json:"duration_ms" db:"duration_ms"`
	DurationSeconds int            `json:"duration_seconds" db:"duration_seconds"` // For backward compatibility
	ToolCallCount   int            `json:"tool_call_count" db:"tool_call_count"`
	Success         bool           `json:"success" db:"success"`
	Status          string         `json:"status" db:"status"` // completed|failed|timeout
	Error           string         `json:"error,omitempty" db:"error"`
	Result          map[string]any `json:"result,omitempty" db:"result"`
	ResultSummary   map[string]any `json:"result_summary,omitempty" db:"result_summary"`
}

Subagent tracks subagent completions

type SubagentExecution

type SubagentExecution = Subagent

SubagentExecution is an alias for Subagent to maintain compatibility

type SubagentRequest

type SubagentRequest struct {
	SubagentID      string         `json:"subagent_id"`
	ParentSessionID string         `json:"parent_session_id"`
	TaskDescription string         `json:"task_description"`
	TaskType        string         `json:"task_type"`
	CompletedAt     string         `json:"completed_at"`
	DurationSeconds int            `json:"duration_seconds"`
	Status          string         `json:"status"`
	Result          SubagentResult `json:"result"`
}

SubagentRequest represents the request to track a subagent

type SubagentResult

type SubagentResult struct {
	ToolCalls         int      `json:"tool_calls"`
	FilesRead         int      `json:"files_read"`
	FilesModified     int      `json:"files_modified"`
	SuccessIndicators []string `json:"success_indicators"`
	PerformanceScore  float64  `json:"performance_score"`
}

SubagentResult contains subagent execution results

type Summary

type Summary struct {
	// Summary statistics
	TotalTools         int                    `json:"total_tools"`
	FilesModified      int                    `json:"files_modified"`
	CommandsExecuted   int                    `json:"commands_executed"`
	ErrorsCount        int                    `json:"errors_count"`
	NotificationsSent  int                    `json:"notifications_sent"`
	PerformanceMetrics map[string]interface{} `json:"performance_metrics,omitempty"`
	Recommendations    []string               `json:"recommendations,omitempty"`

	// AI-generated summary
	AISummary    *AISummary    `json:"ai_summary,omitempty"`
	MessageStats *MessageStats `json:"message_stats,omitempty"`
}

Summary represents the overall session summary including AI analysis

func (*Summary) Scan

func (s *Summary) Scan(value interface{}) error

func (*Summary) Value

func (s *Summary) Value() (driver.Value, error)

Summary's Value/Scan methods for database storage

type SummaryConfig

type SummaryConfig = ConversationSummarizationConfig

SummaryConfig is an alias for ConversationSummarizationConfig to maintain compatibility while reducing duplication

type TestModeConfig

type TestModeConfig struct {
	Enabled          bool   `yaml:"enabled"`
	EphemeralStorage bool   `yaml:"ephemeral_storage"`
	AutoCleanup      bool   `yaml:"auto_cleanup"`
	TestPrefix       string `yaml:"test_prefix"`
	ForceDelete      bool   `yaml:"force_delete"`
}

TestModeConfig defines test-specific settings

type Timestamps

type Timestamps struct {
	CreatedAt time.Time  `json:"created_at" db:"created_at"`
	UpdatedAt time.Time  `json:"updated_at" db:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at,omitempty" db:"deleted_at"`
}

Timestamps provides common time tracking fields

type TmuxSession

type TmuxSession struct {
	Key         string `json:"key"`
	Path        string `json:"path"`
	Repository  string `json:"repository"`
	Description string `json:"description,omitempty"`
}

TmuxSession represents a tmux session configuration

type Tool

type Tool struct {
	ID            string          `json:"id" db:"id"`
	SessionID     string          `json:"session_id" db:"session_id"`
	Name          string          `json:"name" db:"name"`
	Status        ToolStatus      `json:"status" db:"status"`
	StartTime     time.Time       `json:"start_time" db:"start_time"`
	EndTime       *time.Time      `json:"end_time,omitempty" db:"end_time"`
	Duration      *time.Duration  `json:"duration,omitempty" db:"duration"`
	Input         json.RawMessage `json:"input,omitempty" db:"input"`
	Output        json.RawMessage `json:"output,omitempty" db:"output"`
	Error         string          `json:"error,omitempty" db:"error"`
	Metadata      ToolMetadata    `json:"metadata,omitempty" db:"metadata"`
	Approved      bool            `json:"approved" db:"approved"`
	BlockedReason string          `json:"blocked_reason,omitempty" db:"blocked_reason"`
	CreatedAt     time.Time       `json:"created_at" db:"created_at"`
	UpdatedAt     time.Time       `json:"updated_at" db:"updated_at"`
}

Tool represents a tool execution

type ToolExecution

type ToolExecution struct {
	ID            string             `json:"id" db:"id"`
	SessionID     string             `json:"session_id" db:"session_id"`
	StartedAt     time.Time          `json:"started_at" db:"started_at"`
	CompletedAt   *time.Time         `json:"completed_at,omitempty" db:"completed_at"`
	ToolName      string             `json:"tool_name" db:"tool_name"`
	Parameters    map[string]any     `json:"parameters" db:"parameters"`
	Approved      bool               `json:"approved" db:"approved"`
	BlockedReason string             `json:"blocked_reason,omitempty" db:"blocked_reason"`
	Success       *bool              `json:"success,omitempty" db:"success"`
	DurationMs    *int64             `json:"duration_ms,omitempty" db:"duration_ms"`
	ResultSummary *ToolResultSummary `json:"result_summary,omitempty" db:"result_summary"`
	Error         string             `json:"error,omitempty" db:"error"`
}

ToolExecution represents a single tool execution (simplified version for state package)

type ToolHookData

type ToolHookData struct {
	SessionID string          `json:"session_id"`
	ToolName  string          `json:"tool_name"`
	HookType  string          `json:"hook_type"` // "pre" or "post"
	Input     json.RawMessage `json:"input,omitempty"`
	Output    json.RawMessage `json:"output,omitempty"`
	Error     string          `json:"error,omitempty"`
	Timestamp time.Time       `json:"timestamp"`
}

ToolHookData represents data passed to tool hooks

type ToolLogRequest

type ToolLogRequest struct {
	Timestamp     string         `json:"timestamp"`
	ToolName      string         `json:"tool_name"`
	Parameters    map[string]any `json:"parameters"`
	Approved      bool           `json:"approved"`
	BlockedReason string         `json:"blocked_reason,omitempty"`
}

ToolLogRequest represents the request to log tool usage

type ToolMetadata

type ToolMetadata struct {
	RetryCount    int                    `json:"retry_count,omitempty"`
	ParentToolID  string                 `json:"parent_tool_id,omitempty"`
	Tags          []string               `json:"tags,omitempty"`
	ResourcesUsed map[string]interface{} `json:"resources_used,omitempty"`
	ResultSummary *ToolResultSummary     `json:"result_summary,omitempty"`
}

ToolMetadata contains additional tool execution details

type ToolResultSummary

type ToolResultSummary struct {
	ModifiedFiles   []string `json:"modified_files,omitempty"`
	CommandExitCode *int     `json:"command_exit_code,omitempty"`
	OutputSizeBytes int64    `json:"output_size_bytes,omitempty"`
	FilesRead       []string `json:"files_read,omitempty"`
	SearchMatches   int      `json:"search_matches,omitempty"`
	AISummary       string   `json:"ai_summary,omitempty"`
}

ToolResultSummary contains summary of tool execution results

type ToolStat

type ToolStat struct {
	Count        int           `json:"count"`
	SuccessCount int           `json:"success_count"`
	TotalTime    time.Duration `json:"total_time"`
	AvgTime      time.Duration `json:"avg_time"`
	LastUsed     time.Time     `json:"last_used"`
}

ToolStat represents statistics for a specific tool

type ToolStatistics

type ToolStatistics struct {
	TotalCalls          int     `json:"total_calls" db:"total_calls"`
	BashCommands        int     `json:"bash_commands" db:"bash_commands"`
	FileModifications   int     `json:"file_modifications" db:"file_modifications"`
	FileReads           int     `json:"file_reads" db:"file_reads"`
	SearchOperations    int     `json:"search_operations" db:"search_operations"`
	AverageToolDuration float64 `json:"avg_tool_duration_ms" db:"avg_tool_duration_ms"`
}

ToolStatistics tracks tool usage metrics

func (*ToolStatistics) Scan

func (ts *ToolStatistics) Scan(value interface{}) error

Scan implements sql.Scanner for ToolStatistics

func (*ToolStatistics) Value

func (ts *ToolStatistics) Value() (driver.Value, error)

Value implements driver.Valuer for ToolStatistics

type ToolStats

type ToolStats struct {
	TotalExecutions     int                  `json:"total_executions"`
	SuccessfulCount     int                  `json:"successful_count"`
	FailedCount         int                  `json:"failed_count"`
	TotalDuration       time.Duration        `json:"total_duration"`
	ByTool              map[string]*ToolStat `json:"by_tool"`
	MostUsed            string               `json:"most_used"`
	LastExecution       time.Time            `json:"last_execution"`
	BashCommands        int                  `json:"bash_commands"`
	FileModifications   int                  `json:"file_modifications"`
	FileReads           int                  `json:"file_reads"`
	SearchOperations    int                  `json:"search_operations"`
	AverageToolDuration float64              `json:"avg_tool_duration_ms"`
}

ToolStats aggregates tool usage statistics

func (*ToolStats) Scan

func (ts *ToolStats) Scan(value interface{}) error

Scan implements sql.Scanner for ToolStats

func (*ToolStats) Value

func (ts *ToolStats) Value() (driver.Value, error)

Value implements driver.Valuer for ToolStats

type ToolStatus

type ToolStatus string

ToolStatus represents the execution status

const (
	ToolStatusPending   ToolStatus = "pending"
	ToolStatusRunning   ToolStatus = "running"
	ToolStatusSuccess   ToolStatus = "success"
	ToolStatusFailed    ToolStatus = "failed"
	ToolStatusCancelled ToolStatus = "cancelled"
	ToolStatusBlocked   ToolStatus = "blocked"
)

type ToolSummarizationConfig

type ToolSummarizationConfig struct {
	Enabled       bool     `yaml:"enabled"`
	LLMCommand    string   `yaml:"llm_command"`
	MaxOutputSize int      `yaml:"max_output_size"`
	ToolWhitelist []string `yaml:"tool_whitelist"`
}

ToolSummarizationConfig holds configuration for LLM-based tool output summarization

type ToolUpdateRequest

type ToolUpdateRequest struct {
	CompletedAt   string             `json:"completed_at"`
	DurationMs    int64              `json:"duration_ms"`
	Success       bool               `json:"success"`
	ResultSummary *ToolResultSummary `json:"result_summary,omitempty"`
	Error         string             `json:"error,omitempty"`
}

ToolUpdateRequest represents the request to update tool completion

type ToolValidation

type ToolValidation struct {
	ToolName    string                 `json:"tool_name"`
	IsValid     bool                   `json:"is_valid"`
	Errors      []string               `json:"errors,omitempty"`
	Warnings    []string               `json:"warnings,omitempty"`
	Suggestions []string               `json:"suggestions,omitempty"`
	Context     map[string]interface{} `json:"context,omitempty"`
}

ToolValidation represents pre-execution validation

type TranscriptEntry

type TranscriptEntry struct {
	Index     int                    `json:"index"`
	Type      TranscriptEntryType    `json:"type"`
	Timestamp time.Time              `json:"timestamp"`
	Content   string                 `json:"content"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
	SessionID string                 `json:"session_id,omitempty"`
}

TranscriptEntry represents a single entry in the transcript

type TranscriptEntryType

type TranscriptEntryType string

TranscriptEntryType categorizes transcript entries

const (
	TranscriptTypeUser      TranscriptEntryType = "user"
	TranscriptTypeAssistant TranscriptEntryType = "assistant"
	TranscriptTypeSystem    TranscriptEntryType = "system"
	TranscriptTypeTool      TranscriptEntryType = "tool"
	TranscriptTypeError     TranscriptEntryType = "error"
)

type TranscriptParserConfig

type TranscriptParserConfig struct {
	BufferSize    int           `json:"buffer_size"`
	FlushInterval time.Duration `json:"flush_interval"`
	MaxBatchSize  int           `json:"max_batch_size"`
	ParseWorkers  int           `json:"parse_workers"`
}

TranscriptParserConfig configuration

Jump to

Keyboard shortcuts

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