Documentation
¶
Index ¶
- Constants
- Variables
- func ClampWeeks(w int) int
- func ConnectPool(ctx context.Context, databaseURL string) (*pgxpool.Pool, error)
- func Migrate(ctx context.Context, pool *pgxpool.Pool, logger *slog.Logger) error
- type AgentDetail
- type AgentSession
- type ApprovalGate
- type AuditEntry
- type AuditLogEntry
- type BotComment
- type DailyBucket
- type DashboardStats
- type DocReference
- type Document
- type FeedbackSignal
- type FeedbackStats
- type FindingSummary
- type HealthAlert
- type HealthMetrics
- type Issue
- type PhaseQuerier
- type RecentComment
- type RecentFeedback
- type RepoEvent
- type RoundTripBucket
- type SafetyStats
- type SimilarDocument
- type SimilarIssue
- type StaleSession
- type Store
- func (s *Store) CheckAndRecordDelivery(ctx context.Context, deliveryID string) (bool, error)
- func (s *Store) CleanupOldDeliveries(ctx context.Context, olderThan time.Duration) (int64, error)
- func (s *Store) CleanupOldEvents(ctx context.Context, olderThan time.Duration) (int64, error)
- func (s *Store) ClearPendingPromotion(ctx context.Context, id int64) error
- func (s *Store) CountEvents(ctx context.Context, repo string) (int64, error)
- func (s *Store) CountRecentReferencesInvolving(ctx context.Context, repo, docTitle string, since time.Time) (int, error)
- func (s *Store) CountReferencesTo(ctx context.Context, repo, targetType, targetID string) (int, error)
- func (s *Store) CreateApprovalGate(ctx context.Context, gate ApprovalGate) (int64, error)
- func (s *Store) CreateAuditEntry(ctx context.Context, entry AuditEntry) error
- func (s *Store) CreateSession(ctx context.Context, sess AgentSession) (int64, error)
- func (s *Store) CreateTriageSession(ctx context.Context, ts TriageSession) error
- func (s *Store) DeleteDocumentsByVersion(ctx context.Context, repo string, docTypes []string, version string) (int64, error)
- func (s *Store) ExistingIssueNumbers(ctx context.Context, repo string) (map[int]bool, error)
- func (s *Store) FindReferencesTo(ctx context.Context, repo, targetType, targetID string) ([]DocReference, error)
- func (s *Store) FindSimilarBlockedIssues(ctx context.Context, repo string, embedding []float32, limit int) ([]SimilarIssue, error)
- func (s *Store) FindSimilarDocuments(ctx context.Context, repo string, docTypes []string, embedding []float32, ...) ([]SimilarDocument, error)
- func (s *Store) FindSimilarIssues(ctx context.Context, repo string, embedding []float32, excludeNumber int, ...) ([]SimilarIssue, error)
- func (s *Store) GetAgentSessionDetail(ctx context.Context, repo string, issueNumber int) (*AgentDetail, error)
- func (s *Store) GetDailyAgentCounts(ctx context.Context, repo string) ([]DailyBucket, error)
- func (s *Store) GetDailyFeedbackCounts(ctx context.Context, repo string) ([]DailyBucket, error)
- func (s *Store) GetDailyTriageCounts(ctx context.Context, repo string) ([]DailyBucket, error)
- func (s *Store) GetDashboardStats(ctx context.Context, repo string) (*DashboardStats, error)
- func (s *Store) GetFeedbackStats(ctx context.Context, repo string) (*FeedbackStats, error)
- func (s *Store) GetHealthMetrics(ctx context.Context, repo string) (*HealthMetrics, error)
- func (s *Store) GetPendingGate(ctx context.Context, sessionID int64) (*ApprovalGate, error)
- func (s *Store) GetRecentFindings(ctx context.Context, repo string, since time.Time) (*SynthesisFindings, error)
- func (s *Store) GetSession(ctx context.Context, repo string, issueNumber int) (*AgentSession, error)
- func (s *Store) GetSessionByShadow(ctx context.Context, shadowRepo string, shadowIssueNumber int) (*AgentSession, error)
- func (s *Store) GetTriageSessionByShadow(ctx context.Context, shadowRepo string, shadowIssueNumber int) (*TriageSession, error)
- func (s *Store) GetTriageSessionDetail(ctx context.Context, repo string, issueNumber int) (*TriageDetail, error)
- func (s *Store) GetWeeklyTrends(ctx context.Context, repo string, weeks int) (*WeeklyTrends, error)
- func (s *Store) HasBotCommented(ctx context.Context, repo string, issueNumber int) (bool, error)
- func (s *Store) HasTriageSession(ctx context.Context, repo string, issueNumber int) (bool, error)
- func (s *Store) IsPaused(ctx context.Context, repo string) (bool, error)
- func (s *Store) ListBotComments(ctx context.Context, repo string) ([]BotComment, error)
- func (s *Store) ListDocumentsByType(ctx context.Context, repo string, docTypes []string) ([]Document, error)
- func (s *Store) ListEvents(ctx context.Context, repo string, since time.Time, eventTypes []string, ...) ([]RepoEvent, error)
- func (s *Store) ListPendingPromotions(ctx context.Context) ([]TriageSession, error)
- func (s *Store) ListStaleSessions(ctx context.Context, staleDuration time.Duration) ([]StaleSession, error)
- func (s *Store) MarkPendingPromotion(ctx context.Context, id int64) error
- func (s *Store) MarkSessionComplete(ctx context.Context, id int64) error
- func (s *Store) MarkTriageSessionClosed(ctx context.Context, id int64) error
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) Pool() *pgxpool.Pool
- func (s *Store) RecentDocumentsByType(ctx context.Context, repo string, docTypes []string, since time.Time) ([]Document, error)
- func (s *Store) RecentIssuesWithEmbeddings(ctx context.Context, repo string, since time.Time) ([]Issue, error)
- func (s *Store) RecordBotComment(ctx context.Context, comment BotComment) error
- func (s *Store) RecordEvent(ctx context.Context, event RepoEvent) error
- func (s *Store) RecordEvents(ctx context.Context, events []RepoEvent) error
- func (s *Store) RecordFeedbackSignal(ctx context.Context, sig FeedbackSignal) error
- func (s *Store) RecordReferences(ctx context.Context, repo, sourceType, sourceID string, refs []DocReference) error
- func (s *Store) ResolveApprovalGate(ctx context.Context, id int64, status string, approver string) error
- func (s *Store) SetPaused(ctx context.Context, repo string, paused bool, by string) error
- func (s *Store) UpdateIssueLabels(ctx context.Context, repo string, number int, labels []string) error
- func (s *Store) UpdateReactions(ctx context.Context, repo string, issueNumber, thumbsUp, thumbsDown int) error
- func (s *Store) UpdateSessionStage(ctx context.Context, id int64, stage string, sessionCtx map[string]any, ...) error
- func (s *Store) UpsertDocument(ctx context.Context, doc Document) error
- func (s *Store) UpsertIssue(ctx context.Context, issue Issue) error
- type SynthesisFindings
- type SynthesisStats
- type TriageDetail
- type TriageSession
- type WeeklyAgents
- type WeeklyFeedback
- type WeeklyPhases
- type WeeklyResponse
- type WeeklySynthesis
- type WeeklyTrends
- type WeeklyTriage
Constants ¶
const ( DocTypeUpstreamRelease = "upstream_release" DocTypeLearning = "triage_learning" )
Document type constants.
const ( StageNew = "new" StageClarifying = "clarifying" StageResearching = "researching" StageReviewPending = "review_pending" StageRevision = "revision" StageApproved = "approved" StageComplete = "complete" StageContextBrief = "context_brief" )
Agent session stage constants.
const ( GateClarification = "clarification_approval" GateResearch = "research_approval" GatePR = "pr_approval" GatePromotePublic = "promote_to_public" )
Approval gate type constants.
const ( ApprovalPending = "pending" ApprovalApproved = "approved" ApprovalRejected = "rejected" ApprovalRevisionRequested = "revision_requested" )
Approval status constants.
const ( ApprovalModeManual = "manual" // always require human approval (default) ApprovalModeConfidence = "confidence" // auto-approve if quality score >= threshold )
ApprovalMode controls how the agent handles the review gate.
const ( RecencyRecentMonths = 6 RecencyMidMonths = 12 )
const EmbeddingDim = 768
Variables ¶
var AllSeedableDocTypes = append( append(append([]string{"troubleshooting", "configuration"}, EnhancementDocTypes...), UpstreamDocTypes...), DocTypeLearning, )
AllSeedableDocTypes is the union of all valid doc_type values for the seed command.
var EnhancementDocTypes = []string{"roadmap", "adr", "research"}
EnhancementDocTypes lists the document types that Phase 4a searches for enhancement context.
var UpstreamDocTypes = []string{DocTypeUpstreamRelease, "upstream_issue"}
UpstreamDocTypes lists the document types for upstream dependency docs (e.g. Electron release notes, version-tagged issues).
Functions ¶
func ClampWeeks ¶
ClampWeeks normalises a week count to [1, 52], defaulting 0 or negative to 12.
func ConnectPool ¶
ConnectPool creates a new pgxpool connection pool from a database URL.
func Migrate ¶ added in v0.1.1
Migrate applies any pending SQL migrations embedded under migrations/. Applied migrations are tracked in schema_migrations by filename. Each file is applied inside a transaction. Missing migrations are applied in sorted filename order; filename 005 is intentionally skipped per project history. A session-level PostgreSQL advisory lock serialises concurrent invocations so that overlapping Cloud Run deployments can't race on the migration.
Types ¶
type AgentDetail ¶
type AgentDetail struct {
ID int64 `json:"id"`
Repo string `json:"repo"`
IssueNumber int `json:"issue_number"`
ShadowRepo string `json:"shadow_repo"`
ShadowIssue int `json:"shadow_issue"`
Stage string `json:"stage"`
RoundTripCount int `json:"round_trip_count"`
AuditLog []AuditLogEntry `json:"audit_log"`
CreatedAt string `json:"created_at"`
}
AgentDetail holds full detail for a single agent session including its audit log.
type AgentSession ¶
type AgentSession struct {
ID int64
Repo string
IssueNumber int
ShadowRepo string
ShadowIssueNumber int
Stage string
Context map[string]any
RoundTripCount int
CreatedAt time.Time
UpdatedAt time.Time
}
AgentSession tracks an agentic issue-resolution session.
type ApprovalGate ¶
type ApprovalGate struct {
ID int64
SessionID int64
GateType string
Status string
Approver string
CreatedAt time.Time
ResolvedAt *time.Time
}
ApprovalGate represents a human-in-the-loop checkpoint in the agent workflow.
type AuditEntry ¶
type AuditEntry struct {
ID int64
SessionID int64
ActionType string
InputHash string
OutputSummary string
SafetyCheckPassed bool
ConfidenceScore float32
QualityScore *int // holdout judge score (0-100), nil if not evaluated
CreatedAt time.Time
}
AuditEntry records a single action taken by the agent for auditability.
type AuditLogEntry ¶
type AuditLogEntry struct {
ActionType string `json:"action_type"`
OutputSummary string `json:"output_summary"`
SafetyPassed bool `json:"safety_passed"`
ConfidenceScore float64 `json:"confidence_score"`
CreatedAt string `json:"created_at"`
}
AuditLogEntry records a single action taken by the agent, for dashboard drill-down. Named AuditLogEntry to avoid collision with the AuditEntry type in models.go.
type BotComment ¶
type BotComment struct {
ID int64
Repo string
IssueNumber int
CommentID int64
PhasesRun []string
ThumbsUp int
ThumbsDown int
CreatedAt time.Time
}
BotComment tracks a bot comment on a GitHub issue.
type DailyBucket ¶
DailyBucket holds a date string and an event count for time-series charts.
type DashboardStats ¶
type DashboardStats struct {
TotalComments int `json:"total_comments"`
TotalThumbsUp int `json:"total_thumbs_up"`
TotalThumbsDown int `json:"total_thumbs_down"`
PhaseBreakdown map[string]int `json:"phase_breakdown"`
DocumentCounts map[string]int `json:"document_counts"`
IssueCount int `json:"issue_count"`
RecentComments []RecentComment `json:"recent_comments"`
SafetyStats *SafetyStats `json:"safety_stats"`
RoundTripDistribution []RoundTripBucket `json:"round_trip_distribution"`
PhaseHitRate map[string]float64 `json:"phase_hit_rate"`
FeedbackStats *FeedbackStats `json:"feedback_stats"`
SynthesisStats *SynthesisStats `json:"synthesis_stats"`
DailyTriageCounts []DailyBucket `json:"daily_triage_counts"`
DailyAgentCounts []DailyBucket `json:"daily_agent_counts"`
DailyFeedbackCounts []DailyBucket `json:"daily_feedback_counts"`
}
DashboardStats holds aggregated statistics for the dashboard.
type DocReference ¶
type DocReference struct {
ID int64
Repo string
SourceType string
SourceID string
TargetType string
TargetID string
Relationship string
}
DocReference represents a cross-reference between documents, issues, or PRs.
func ExtractReferences ¶
func ExtractReferences(content string) []DocReference
ExtractReferences finds issue and ADR references in text content using regex.
type Document ¶
type Document struct {
ID int64
Repo string
DocType string
Title string
Content string
Metadata map[string]any
Embedding []float32 `json:"-"` // internal vector; never serialized over JSON APIs
CreatedAt time.Time
UpdatedAt time.Time
}
Document represents a documentation chunk (troubleshooting, roadmap, ADR, research).
type FeedbackSignal ¶
type FeedbackSignal struct {
ID int64
Repo string
IssueNumber int
SignalType string
Details map[string]any
CreatedAt time.Time
}
FeedbackSignal records a user feedback event (edit fill or @mention).
type FeedbackStats ¶
type FeedbackStats struct {
TotalEditSignals int `json:"total_edit_signals"`
TotalMentions int `json:"total_mentions"`
FillRate *float64 `json:"fill_rate"`
RecentFeedback []RecentFeedback `json:"recent_feedback"`
}
FeedbackStats holds aggregated feedback signal statistics.
type FindingSummary ¶
type FindingSummary struct {
Title string `json:"title"`
Severity string `json:"severity"`
Evidence []string `json:"evidence"`
Suggestion string `json:"suggestion,omitempty"`
}
FindingSummary is a condensed representation of a synthesis finding.
type HealthAlert ¶
type HealthAlert struct {
Metric string `json:"metric"`
Current float64 `json:"current"`
Threshold float64 `json:"threshold"`
Message string `json:"message"`
}
HealthAlert represents a single threshold violation detected by the health monitor.
func EvaluateThresholds ¶
func EvaluateThresholds(m *HealthMetrics) []HealthAlert
EvaluateThresholds checks health metrics against degradation thresholds and returns any alerts. This is a pure function with no side effects.
type HealthMetrics ¶
type HealthMetrics struct {
ConfidenceRecent7d *float64 `json:"confidence_recent_7d"`
ConfidenceAllTime *float64 `json:"confidence_all_time"`
StuckSessionCount int `json:"stuck_session_count"`
TotalRecentSessions int `json:"total_recent_sessions"`
CheckedAt string `json:"checked_at"`
}
HealthMetrics holds operational health metrics queried from existing tables.
type Issue ¶
type Issue struct {
ID int64
Repo string
Number int
Title string
Summary string
State string
Labels []string
Milestone *string
Embedding []float32 `json:"-"` // internal vector; never serialized over JSON APIs
CreatedAt time.Time
UpdatedAt time.Time
ClosedAt *time.Time
}
Issue represents a GitHub issue with its embedding.
type PhaseQuerier ¶
type PhaseQuerier interface {
FindSimilarDocuments(ctx context.Context, repo string, docTypes []string, embedding []float32, limit int) ([]SimilarDocument, error)
FindSimilarIssues(ctx context.Context, repo string, embedding []float32, excludeNumber int, limit int) ([]SimilarIssue, error)
}
PhaseQuerier defines the database operations that triage phases require.
type RecentComment ¶
type RecentComment struct {
Repo string `json:"repo"`
IssueNumber int `json:"issue_number"`
CommentID int64 `json:"comment_id"`
PhasesRun []string `json:"phases_run"`
ThumbsUp int `json:"thumbs_up"`
ThumbsDown int `json:"thumbs_down"`
CreatedAt string `json:"created_at"`
}
RecentComment represents a recent bot comment for the dashboard.
type RecentFeedback ¶
type RecentFeedback struct {
Repo string `json:"repo"`
IssueNumber int `json:"issue_number"`
SignalType string `json:"signal_type"`
CreatedAt string `json:"created_at"`
}
RecentFeedback represents a recent feedback signal for the dashboard.
type RepoEvent ¶
type RepoEvent struct {
ID int64
Repo string
EventType string
SourceRef string
Summary string
Areas []string
Metadata map[string]any
CreatedAt time.Time
}
RepoEvent represents a recorded repository event in the journal.
type RoundTripBucket ¶
RoundTripBucket represents a count of sessions with a given round-trip count.
type SafetyStats ¶
type SafetyStats struct {
TotalActions int `json:"total_actions"`
Passed int `json:"passed"`
AvgConfidence *float64 `json:"avg_confidence"`
}
SafetyStats holds aggregated safety check statistics.
type SimilarDocument ¶
SimilarDocument is returned from similarity search with a distance score.
func ApplyHatBoost ¶ added in v0.1.1
func ApplyHatBoost(docs []SimilarDocument, keywords []string, boost float64) []SimilarDocument
ApplyHatBoost rescales distances downward (closer) for documents whose title or content contains any of the boost keywords (case-insensitive). Returns a new slice ordered ascending by the adjusted distance.
This is a soft rerank — documents without a keyword match keep their original distance. The adjusted distance is clamped at 0.
If keywords is empty or boost <= 0, the original slice is returned unchanged (same ordering, same distances).
func ApplyVersionBoost ¶ added in v0.1.1
func ApplyVersionBoost(docs []SimilarDocument, targetVersion string, exactBoost, adjacentBoost float64) []SimilarDocument
ApplyVersionBoost rescales distances downward for documents whose electron_version metadata matches or is adjacent to the target version. Returns a new slice ordered ascending by the adjusted distance.
type SimilarIssue ¶
SimilarIssue is returned from similarity search with a distance score.
func ApplyRecencyBoost ¶ added in v0.1.1
func ApplyRecencyBoost(issues []SimilarIssue, recentBoost, midBoost float64) []SimilarIssue
ApplyRecencyBoost rescales distances downward (closer) for recent issues. Issues created within RecencyRecentMonths get recentBoost subtracted; issues within RecencyMidMonths get midBoost subtracted. Returns a new slice ordered ascending by the adjusted distance.
type StaleSession ¶
type StaleSession struct {
ID int64
ShadowRepo string
ShadowIssueNumber int
SessionType string // "agent" or "triage"
}
StaleSession holds the minimum info needed to close a stale shadow issue.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides database operations for the triage bot.
func (*Store) CheckAndRecordDelivery ¶
CheckAndRecordDelivery atomically checks if a webhook delivery ID has been seen before and records it if not. Returns true if the delivery was already recorded (duplicate).
func (*Store) CleanupOldDeliveries ¶
CleanupOldDeliveries deletes webhook delivery records older than the given duration. Returns the number of rows deleted.
func (*Store) CleanupOldEvents ¶
CleanupOldEvents deletes events older than the given duration (retention policy).
func (*Store) ClearPendingPromotion ¶ added in v0.1.1
ClearPendingPromotion removes the pending-promotion marker, used after a successful retry.
func (*Store) CountEvents ¶
CountEvents returns the total number of events for a repo.
func (*Store) CountRecentReferencesInvolving ¶
func (s *Store) CountRecentReferencesInvolving(ctx context.Context, repo, docTitle string, since time.Time) (int, error)
CountRecentReferencesInvolving returns the count of references created since the given time where the document appears as either a source (by title) or a target (by target_id). This lets callers determine whether a document is actively being discussed in recent issues or PRs.
func (*Store) CountReferencesTo ¶
func (s *Store) CountReferencesTo(ctx context.Context, repo, targetType, targetID string) (int, error)
CountReferencesTo returns the count of references to a given target.
func (*Store) CreateApprovalGate ¶
CreateApprovalGate inserts a new approval gate and returns its ID.
func (*Store) CreateAuditEntry ¶
func (s *Store) CreateAuditEntry(ctx context.Context, entry AuditEntry) error
CreateAuditEntry inserts a new audit log entry.
func (*Store) CreateSession ¶
CreateSession inserts a new agent session and returns its ID.
func (*Store) CreateTriageSession ¶
func (s *Store) CreateTriageSession(ctx context.Context, ts TriageSession) error
CreateTriageSession inserts a new triage session record.
func (*Store) DeleteDocumentsByVersion ¶ added in v0.1.1
func (s *Store) DeleteDocumentsByVersion(ctx context.Context, repo string, docTypes []string, version string) (int64, error)
DeleteDocumentsByVersion deletes all documents for a repo and doc types where metadata->>'electron_version' matches the given version string.
func (*Store) ExistingIssueNumbers ¶ added in v0.1.1
ExistingIssueNumbers returns the set of issue numbers already stored for a repo.
func (*Store) FindReferencesTo ¶
func (s *Store) FindReferencesTo(ctx context.Context, repo, targetType, targetID string) ([]DocReference, error)
FindReferencesTo returns all documents/issues that reference the given target.
func (*Store) FindSimilarBlockedIssues ¶ added in v0.1.1
func (s *Store) FindSimilarBlockedIssues(ctx context.Context, repo string, embedding []float32, limit int) ([]SimilarIssue, error)
FindSimilarBlockedIssues returns open issues that carry the "blocked" label and whose embedding is near the given vector, ordered by ascending cosine distance.
func (*Store) FindSimilarDocuments ¶
func (s *Store) FindSimilarDocuments(ctx context.Context, repo string, docTypes []string, embedding []float32, limit int) ([]SimilarDocument, error)
FindSimilarDocuments returns the top-k documents closest to the given embedding, filtered by repo and doc types.
func (*Store) FindSimilarIssues ¶
func (s *Store) FindSimilarIssues(ctx context.Context, repo string, embedding []float32, excludeNumber int, limit int) ([]SimilarIssue, error)
FindSimilarIssues returns the top-k issues closest to the given embedding, excluding the specified issue number.
func (*Store) GetAgentSessionDetail ¶
func (s *Store) GetAgentSessionDetail(ctx context.Context, repo string, issueNumber int) (*AgentDetail, error)
GetAgentSessionDetail returns full detail for the agent session matching repo+issueNumber, including all audit log entries. It returns nil if no session is found.
func (*Store) GetDailyAgentCounts ¶
GetDailyAgentCounts returns a 30-day time series of agent session counts.
func (*Store) GetDailyFeedbackCounts ¶
GetDailyFeedbackCounts returns a 30-day time series of feedback signal counts.
func (*Store) GetDailyTriageCounts ¶
GetDailyTriageCounts returns a 30-day time series of triage session counts.
func (*Store) GetDashboardStats ¶
GetDashboardStats retrieves aggregated triage statistics for a given repo.
func (*Store) GetFeedbackStats ¶
GetFeedbackStats returns aggregated feedback statistics for the dashboard.
func (*Store) GetHealthMetrics ¶
GetHealthMetrics queries operational health metrics from existing tables. Each query is independent; partial results are returned if individual queries fail.
func (*Store) GetPendingGate ¶
GetPendingGate retrieves the oldest pending approval gate for a session.
func (*Store) GetRecentFindings ¶
func (s *Store) GetRecentFindings(ctx context.Context, repo string, since time.Time) (*SynthesisFindings, error)
GetRecentFindings returns classified synthesis findings from the most recent briefing_posted events for the given repo (up to the last 4 briefings).
func (*Store) GetSession ¶
func (s *Store) GetSession(ctx context.Context, repo string, issueNumber int) (*AgentSession, error)
GetSession retrieves an agent session by repo and issue number.
func (*Store) GetSessionByShadow ¶
func (s *Store) GetSessionByShadow(ctx context.Context, shadowRepo string, shadowIssueNumber int) (*AgentSession, error)
GetSessionByShadow retrieves an agent session by shadow repo and shadow issue number.
func (*Store) GetTriageSessionByShadow ¶
func (s *Store) GetTriageSessionByShadow(ctx context.Context, shadowRepo string, shadowIssueNumber int) (*TriageSession, error)
GetTriageSessionByShadow returns the triage session for a given shadow issue, or nil if not found.
func (*Store) GetTriageSessionDetail ¶
func (s *Store) GetTriageSessionDetail(ctx context.Context, repo string, issueNumber int) (*TriageDetail, error)
GetTriageSessionDetail returns full detail for the triage session matching repo+issueNumber. It returns nil if no session is found.
func (*Store) GetWeeklyTrends ¶
GetWeeklyTrends returns multi-metric weekly time-series data for the given repo. Each query is independent; partial results are returned if individual queries fail.
func (*Store) HasBotCommented ¶
HasBotCommented checks if the bot has already commented on the given issue.
func (*Store) HasTriageSession ¶
HasTriageSession returns true if a triage session already exists for the given issue.
func (*Store) ListBotComments ¶
ListBotComments returns all bot comments for a given repo.
func (*Store) ListDocumentsByType ¶
func (s *Store) ListDocumentsByType(ctx context.Context, repo string, docTypes []string) ([]Document, error)
ListDocumentsByType returns all documents of the given types for a repo.
func (*Store) ListEvents ¶
func (s *Store) ListEvents(ctx context.Context, repo string, since time.Time, eventTypes []string, limit int) ([]RepoEvent, error)
ListEvents returns events for a repo within a time window, ordered by created_at DESC.
func (*Store) ListPendingPromotions ¶ added in v0.1.1
func (s *Store) ListPendingPromotions(ctx context.Context) ([]TriageSession, error)
ListPendingPromotions returns open triage sessions that have a pending promotion marker set, ordered oldest-first so the cleanup cron attempts them in the order the maintainer approved them.
func (*Store) ListStaleSessions ¶
func (s *Store) ListStaleSessions(ctx context.Context, staleDuration time.Duration) ([]StaleSession, error)
ListStaleSessions returns agent and triage sessions with open shadow issues that haven't been acted on within the given duration.
func (*Store) MarkPendingPromotion ¶ added in v0.1.1
MarkPendingPromotion stamps a triage session so a later cleanup pass can re-attempt the promotion of a received `lgtm` that failed to post on the source repo (typically a cold-start TLS handshake timeout against api.github.com).
func (*Store) MarkSessionComplete ¶
MarkSessionComplete sets an agent session's stage to "complete".
func (*Store) MarkTriageSessionClosed ¶
MarkTriageSessionClosed sets the closed_at timestamp on a triage session.
func (*Store) Pool ¶
Pool returns the underlying connection pool. Used by integration tests for cleanup.
func (*Store) RecentDocumentsByType ¶
func (s *Store) RecentDocumentsByType(ctx context.Context, repo string, docTypes []string, since time.Time) ([]Document, error)
RecentDocumentsByType returns documents of the given types ingested since the given time.
func (*Store) RecentIssuesWithEmbeddings ¶
func (s *Store) RecentIssuesWithEmbeddings(ctx context.Context, repo string, since time.Time) ([]Issue, error)
RecentIssuesWithEmbeddings returns issues opened within the time window that have embeddings.
func (*Store) RecordBotComment ¶
func (s *Store) RecordBotComment(ctx context.Context, comment BotComment) error
RecordBotComment records that the bot commented on an issue.
func (*Store) RecordEvent ¶
RecordEvent inserts a single event into the journal.
func (*Store) RecordEvents ¶
RecordEvents inserts a batch of events into the journal.
func (*Store) RecordFeedbackSignal ¶
func (s *Store) RecordFeedbackSignal(ctx context.Context, sig FeedbackSignal) error
RecordFeedbackSignal inserts a feedback signal row.
func (*Store) RecordReferences ¶
func (s *Store) RecordReferences(ctx context.Context, repo, sourceType, sourceID string, refs []DocReference) error
RecordReferences inserts cross-references for a source document or issue.
func (*Store) ResolveApprovalGate ¶
func (s *Store) ResolveApprovalGate(ctx context.Context, id int64, status string, approver string) error
ResolveApprovalGate updates the status, approver, and resolved_at timestamp of an approval gate.
func (*Store) UpdateIssueLabels ¶ added in v0.1.1
func (s *Store) UpdateIssueLabels(ctx context.Context, repo string, number int, labels []string) error
UpdateIssueLabels replaces the labels column for an issue without touching the embedding or any other field. Returns nil if the row does not exist (label events can arrive before the issue has been embedded; the next opened/edited event will populate the row).
func (*Store) UpdateReactions ¶
func (s *Store) UpdateReactions(ctx context.Context, repo string, issueNumber, thumbsUp, thumbsDown int) error
UpdateReactions updates the thumbs up/down counts for a bot comment.
func (*Store) UpdateSessionStage ¶
func (s *Store) UpdateSessionStage(ctx context.Context, id int64, stage string, sessionCtx map[string]any, roundTrips int) error
UpdateSessionStage updates the stage, context, and round-trip count for a session.
func (*Store) UpsertDocument ¶
UpsertDocument inserts or updates a document and its embedding.
func (*Store) UpsertIssue ¶
UpsertIssue inserts or updates an issue and its embedding. If issue.CreatedAt is set (non-zero), it is used as the issue creation timestamp; otherwise the database default (now()) applies. On conflict, created_at is never overwritten.
type SynthesisFindings ¶
type SynthesisFindings struct {
AsOf string `json:"as_of"`
Clusters []FindingSummary `json:"clusters"`
Drift []FindingSummary `json:"drift"`
Upstream []FindingSummary `json:"upstream"`
}
SynthesisFindings holds classified findings from recent synthesis briefings.
type SynthesisStats ¶ added in v0.1.1
type SynthesisStats struct {
TotalBriefings int `json:"total_briefings"`
TotalFindings int `json:"total_findings"`
FindingsByType map[string]int `json:"findings_by_type"`
RecentBriefing string `json:"recent_briefing,omitempty"`
ProposalsAccepted int `json:"proposals_accepted"`
ProposalsRejected int `json:"proposals_rejected"`
}
SynthesisStats tracks synthesis briefing activity.
type TriageDetail ¶
type TriageDetail struct {
ID int64 `json:"id"`
Repo string `json:"repo"`
IssueNumber int `json:"issue_number"`
ShadowRepo string `json:"shadow_repo"`
ShadowIssue int `json:"shadow_issue"`
TriageComment string `json:"triage_comment"`
PhasesRun []string `json:"phases_run"`
Promoted bool `json:"promoted"`
CreatedAt string `json:"created_at"`
}
TriageDetail holds full detail for a single triage session.
type TriageSession ¶
type TriageSession struct {
ID int64
Repo string
IssueNumber int
ShadowRepo string
ShadowIssueNumber int
TriageComment string
PhasesRun []string
CreatedAt time.Time
PendingPromotionAt *time.Time
}
TriageSession tracks a shadow issue created for triage review.
type WeeklyAgents ¶
type WeeklyAgents struct {
Week string `json:"week"`
Total int `json:"total"`
Approved int `json:"approved"`
Rejected int `json:"rejected"`
Pending int `json:"pending"`
Complete int `json:"complete"`
}
WeeklyAgents tracks agent session outcomes per week.
type WeeklyFeedback ¶
type WeeklyFeedback struct {
Week string `json:"week"`
EditFills int `json:"edit_fills"`
Mentions int `json:"mentions"`
}
WeeklyFeedback tracks feedback signals per week.
type WeeklyPhases ¶
type WeeklyPhases struct {
Week string `json:"week"`
MissingInfo float64 `json:"missing_info"`
DocSearch float64 `json:"doc_search"`
EnhancementContext float64 `json:"enhancement_context"`
}
WeeklyPhases tracks phase hit rates per week.
type WeeklyResponse ¶
WeeklyResponse tracks average response time per week.
type WeeklySynthesis ¶
type WeeklySynthesis struct {
Week string `json:"week"`
Briefings int `json:"briefings"`
Findings int `json:"findings"`
}
WeeklySynthesis tracks synthesis output per week.
type WeeklyTrends ¶
type WeeklyTrends struct {
Repo string `json:"repo"`
Weeks int `json:"weeks"`
Triage []WeeklyTriage `json:"triage"`
Phases []WeeklyPhases `json:"phases"`
Response []WeeklyResponse `json:"response_time"`
Agents []WeeklyAgents `json:"agents"`
Synthesis []WeeklySynthesis `json:"synthesis"`
Feedback []WeeklyFeedback `json:"feedback"`
}
WeeklyTrends holds multi-metric weekly time-series data for trend reports.