Documentation
¶
Index ¶
- type AttentionReason
- type Priority
- type ReviewItem
- type ReviewQueue
- func (rq *ReviewQueue) Add(item *ReviewItem) bool
- func (rq *ReviewQueue) Clear()
- func (rq *ReviewQueue) Count() int
- func (rq *ReviewQueue) CountByPriority() map[Priority]int
- func (rq *ReviewQueue) CountByReason() map[AttentionReason]int
- func (rq *ReviewQueue) Get(sessionID string) (*ReviewItem, bool)
- func (rq *ReviewQueue) GetStatistics() ReviewQueueStatistics
- func (rq *ReviewQueue) Has(sessionID string) bool
- func (rq *ReviewQueue) List() []*ReviewItem
- func (rq *ReviewQueue) Next(currentSessionID string) (string, bool)
- func (rq *ReviewQueue) Previous(currentSessionID string) (string, bool)
- func (rq *ReviewQueue) Remove(sessionID string) bool
- func (rq *ReviewQueue) Subscribe(observer ReviewQueueObserver)
- func (rq *ReviewQueue) Unsubscribe(observer ReviewQueueObserver)
- type ReviewQueueObserver
- type ReviewQueueStatistics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttentionReason ¶
type AttentionReason string
AttentionReason describes why a session needs user attention.
const ( ReasonApprovalPending AttentionReason = "approval_pending" // Waiting for approval dialog response ReasonInputRequired AttentionReason = "input_required" // Waiting for user input ReasonErrorState AttentionReason = "error_state" // Error occurred ReasonTestsFailing AttentionReason = "tests_failing" // Tests are failing ReasonIdleTimeout AttentionReason = "idle_timeout" // DEPRECATED: No activity for extended period (use ReasonIdle or ReasonStale) ReasonTaskComplete AttentionReason = "task_complete" // Task completed, waiting for next instruction ReasonUncommittedChanges AttentionReason = "uncommitted_changes" // Uncommitted git changes ready to commit ReasonIdle AttentionReason = "idle" // Session idle, ready for next task (short idle, expected) ReasonStale AttentionReason = "stale" // No output for extended period (may be stuck) ReasonWaitingForUser AttentionReason = "waiting_for_user" // Explicitly waiting for user input (detected prompt) )
func (AttentionReason) String ¶
func (r AttentionReason) String() string
String returns a human-readable description of the attention reason.
type Priority ¶
type Priority int
Priority defines the urgency level of a review item.
func DeterminePriority ¶
func DeterminePriority(reason AttentionReason, detectedStatus detection.DetectedStatus, age time.Duration) Priority
DeterminePriority calculates the priority for a review item based on multiple factors.
func ReasonToPriority ¶
func ReasonToPriority(reason AttentionReason) Priority
ReasonToPriority maps attention reasons to base priority levels.
func (Priority) IsHigherThan ¶
IsHigherThan returns true if p is higher priority than other. Note: LOWER numeric value = HIGHER priority (Urgent=1, Low=4).
func (Priority) IsLowerThan ¶
IsLowerThan returns true if p is lower priority than other. Note: HIGHER numeric value = LOWER priority (Urgent=1, Low=4).
type ReviewItem ¶
type ReviewItem struct {
SessionID string `json:"session_id"`
SessionName string `json:"session_name"`
Reason AttentionReason `json:"reason"`
Priority Priority `json:"priority"`
DetectedAt time.Time `json:"detected_at"`
Context string `json:"context"` // Snippet of relevant output
PatternName string `json:"pattern_name"` // Pattern that matched
Metadata map[string]string `json:"metadata,omitempty"` // Additional metadata
// Session details for rich display (matching Instance fields)
Program string `json:"program"` // Program running (claude, aider, etc.)
Branch string `json:"branch"` // Git branch name
Path string `json:"path"` // Repository path
WorkingDir string `json:"working_dir"` // Working directory
Status string `json:"status"` // Current session status (string form of session.Status)
Tags []string `json:"tags"` // Session tags
Category string `json:"category"` // Session category
DiffStats *git.DiffStats `json:"diff_stats"` // Git diff statistics (nullable)
LastActivity time.Time `json:"last_activity"` // Last meaningful output time (used for sorting and display)
}
ReviewItem represents a session that needs user attention.
type ReviewQueue ¶
type ReviewQueue struct {
// contains filtered or unexported fields
}
ReviewQueue manages sessions that need user attention.
func (*ReviewQueue) Add ¶
func (rq *ReviewQueue) Add(item *ReviewItem) bool
Add adds a session to the review queue or updates it if already present. Returns true if this is a new item, false if it was updated.
func (*ReviewQueue) Count ¶
func (rq *ReviewQueue) Count() int
Count returns the number of items in the queue.
func (*ReviewQueue) CountByPriority ¶
func (rq *ReviewQueue) CountByPriority() map[Priority]int
CountByPriority returns the count of items for each priority level.
func (*ReviewQueue) CountByReason ¶
func (rq *ReviewQueue) CountByReason() map[AttentionReason]int
CountByReason returns the count of items for each attention reason.
func (*ReviewQueue) Get ¶
func (rq *ReviewQueue) Get(sessionID string) (*ReviewItem, bool)
Get retrieves a review item by session ID.
func (*ReviewQueue) GetStatistics ¶
func (rq *ReviewQueue) GetStatistics() ReviewQueueStatistics
GetStatistics returns summary statistics about the review queue.
func (*ReviewQueue) Has ¶
func (rq *ReviewQueue) Has(sessionID string) bool
Has checks if a session is in the review queue.
func (*ReviewQueue) List ¶
func (rq *ReviewQueue) List() []*ReviewItem
List returns all items sorted by priority (most urgent first).
func (*ReviewQueue) Next ¶
func (rq *ReviewQueue) Next(currentSessionID string) (string, bool)
Next returns the session ID of the next review item after the given session ID. If currentSessionID is empty or not found, returns the highest priority item. Returns empty string and false if the queue is empty.
func (*ReviewQueue) Previous ¶
func (rq *ReviewQueue) Previous(currentSessionID string) (string, bool)
Previous returns the session ID of the previous review item before the given session ID. If currentSessionID is empty or not found, returns the highest priority item. Returns empty string and false if the queue is empty.
func (*ReviewQueue) Remove ¶
func (rq *ReviewQueue) Remove(sessionID string) bool
Remove removes a session from the review queue. Returns true if the item was present and removed.
func (*ReviewQueue) Subscribe ¶
func (rq *ReviewQueue) Subscribe(observer ReviewQueueObserver)
Subscribe adds an observer to receive queue update notifications.
func (*ReviewQueue) Unsubscribe ¶
func (rq *ReviewQueue) Unsubscribe(observer ReviewQueueObserver)
Unsubscribe removes an observer from receiving notifications.
type ReviewQueueObserver ¶
type ReviewQueueObserver interface {
OnItemAdded(item *ReviewItem)
OnItemRemoved(sessionID string)
OnQueueUpdated(items []*ReviewItem)
}
ReviewQueueObserver is notified when the review queue changes.