store

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ClusterSourceRun     = "run_cluster"
	ClusterSourceDurable = "durable_cluster"
)
View Source
const (
	MaxEmbeddingTextRunes = 6_000
	MaxEmbeddingTextBytes = 7_000
)

Variables

This section is empty.

Functions

func HumanKeyStableSlug

func HumanKeyStableSlug(key HumanKey) string

func StableHash

func StableHash(value string) string

func SupportsEmbeddingBasis added in v0.4.0

func SupportsEmbeddingBasis(basis string) bool

Types

type ClusterDetail

type ClusterDetail struct {
	Cluster ClusterSummary        `json:"cluster"`
	Members []ClusterMemberDetail `json:"members"`
}

type ClusterDetailOptions

type ClusterDetailOptions struct {
	RepoID        int64
	ClusterID     int64
	Source        string
	IncludeClosed bool
	MemberLimit   int
	BodyChars     int
}

type ClusterMemberDetail

type ClusterMemberDetail struct {
	Thread                Thread            `json:"thread"`
	Role                  string            `json:"role"`
	State                 string            `json:"state"`
	ScoreToRepresentative *float64          `json:"score_to_representative,omitempty"`
	BodySnippet           string            `json:"body_snippet,omitempty"`
	Summaries             map[string]string `json:"summaries,omitempty"`
}

type ClusterMemberOverride

type ClusterMemberOverride struct {
	ClusterID int64  `json:"cluster_id"`
	ThreadID  int64  `json:"thread_id"`
	Number    int    `json:"number"`
	Action    string `json:"action"`
	Reason    string `json:"reason,omitempty"`
}

type ClusterSummary

type ClusterSummary struct {
	ID                     int64  `json:"id"`
	Source                 string `json:"source,omitempty"`
	StableSlug             string `json:"stable_slug"`
	Status                 string `json:"status"`
	Title                  string `json:"title,omitempty"`
	RepresentativeThreadID int64  `json:"representative_thread_id,omitempty"`
	RepresentativeNumber   int    `json:"representative_number,omitempty"`
	RepresentativeKind     string `json:"representative_kind,omitempty"`
	RepresentativeTitle    string `json:"representative_title,omitempty"`
	MemberCount            int    `json:"member_count"`
	UpdatedAt              string `json:"updated_at"`
	ClosedAt               string `json:"closed_at,omitempty"`
}

type ClusterSummaryOptions

type ClusterSummaryOptions struct {
	RepoID        int64
	IncludeClosed bool
	MinSize       int
	Limit         int
	Sort          string
}

type Comment

type Comment struct {
	ID              int64  `json:"id"`
	ThreadID        int64  `json:"thread_id"`
	GitHubID        string `json:"github_id"`
	CommentType     string `json:"comment_type"`
	AuthorLogin     string `json:"author_login,omitempty"`
	AuthorType      string `json:"author_type,omitempty"`
	Body            string `json:"body"`
	IsBot           bool   `json:"is_bot"`
	RawJSON         string `json:"-"`
	CreatedAtGitHub string `json:"created_at_gh,omitempty"`
	UpdatedAtGitHub string `json:"updated_at_gh,omitempty"`
}

type Document

type Document struct {
	ID         int64  `json:"id"`
	ThreadID   int64  `json:"thread_id"`
	Title      string `json:"title"`
	Body       string `json:"body,omitempty"`
	RawText    string `json:"raw_text"`
	DedupeText string `json:"dedupe_text"`
	UpdatedAt  string `json:"updated_at"`
}

type DurableClusterInput

type DurableClusterInput struct {
	StableKey              string
	StableSlug             string
	ClusterType            string
	RepresentativeThreadID int64
	Title                  string
	Members                []DurableClusterMemberInput
}

type DurableClusterMemberInput

type DurableClusterMemberInput struct {
	ThreadID              int64
	Role                  string
	ScoreToRepresentative *float64
}

type EmbeddingTask

type EmbeddingTask struct {
	ThreadID          int64  `json:"thread_id"`
	Number            int    `json:"number"`
	Kind              string `json:"kind"`
	Title             string `json:"title"`
	Text              string `json:"-"`
	ContentHash       string `json:"content_hash"`
	TextTruncated     bool   `json:"text_truncated,omitempty"`
	OriginalTextRunes int    `json:"original_text_runes,omitempty"`
	TextRunes         int    `json:"text_runes,omitempty"`
}

type EmbeddingTaskOptions

type EmbeddingTaskOptions struct {
	RepoID        int64
	Basis         string
	Model         string
	Number        int
	Limit         int
	Force         bool
	IncludeClosed bool
}

type HumanKey

type HumanKey struct {
	Hash     string
	Slug     string
	Checksum string
}

func HumanKeyForValue

func HumanKeyForValue(value string) HumanKey

func HumanKeyFromHash

func HumanKeyFromHash(hash string) HumanKey

type PortablePruneOptions

type PortablePruneOptions struct {
	BodyChars int
	Vacuum    bool
}

type PortablePruneStats

type PortablePruneStats struct {
	DBPath              string   `json:"db_path"`
	ManifestPath        string   `json:"manifest_path,omitempty"`
	SHA256              string   `json:"sha256,omitempty"`
	BodyChars           int      `json:"body_chars"`
	BytesBefore         int64    `json:"bytes_before"`
	BytesAfter          int64    `json:"bytes_after"`
	QuickCheck          string   `json:"quick_check,omitempty"`
	ThreadsPruned       int64    `json:"threads_pruned"`
	CommentsPruned      int64    `json:"comments_pruned"`
	RepositoriesPruned  int64    `json:"repositories_pruned"`
	RawJSONPruned       int64    `json:"raw_json_pruned"`
	FingerprintsPruned  int64    `json:"fingerprints_pruned"`
	DocumentsDeleted    int64    `json:"documents_deleted"`
	DocumentsFTSRebuilt bool     `json:"documents_fts_rebuilt"`
	DroppedTables       []string `json:"dropped_tables,omitempty"`
	DroppedColumns      []string `json:"dropped_columns,omitempty"`
	Vacuumed            bool     `json:"vacuumed"`
}

type PullRequestCache added in v0.2.0

type PullRequestCache struct {
	Detail  PullRequestDetail   `json:"detail"`
	Files   []PullRequestFile   `json:"files"`
	Commits []PullRequestCommit `json:"commits"`
	Checks  []PullRequestCheck  `json:"checks"`
}

type PullRequestCheck added in v0.2.0

type PullRequestCheck struct {
	ID           int64  `json:"id"`
	ThreadID     int64  `json:"thread_id"`
	Name         string `json:"name"`
	Status       string `json:"status,omitempty"`
	Conclusion   string `json:"conclusion,omitempty"`
	DetailsURL   string `json:"details_url,omitempty"`
	WorkflowName string `json:"workflow_name,omitempty"`
	StartedAt    string `json:"started_at,omitempty"`
	CompletedAt  string `json:"completed_at,omitempty"`
	RawJSON      string `json:"raw_json,omitempty"`
	FetchedAt    string `json:"fetched_at"`
}

type PullRequestCommit added in v0.2.0

type PullRequestCommit struct {
	ThreadID    int64  `json:"thread_id"`
	SHA         string `json:"sha"`
	Message     string `json:"message,omitempty"`
	AuthorLogin string `json:"author_login,omitempty"`
	AuthorName  string `json:"author_name,omitempty"`
	CommittedAt string `json:"committed_at,omitempty"`
	HTMLURL     string `json:"html_url,omitempty"`
	RawJSON     string `json:"raw_json,omitempty"`
	FetchedAt   string `json:"fetched_at"`
}

type PullRequestDetail added in v0.2.0

type PullRequestDetail struct {
	ThreadID         int64  `json:"thread_id"`
	RepoID           int64  `json:"repo_id"`
	Number           int    `json:"number"`
	BaseSHA          string `json:"base_sha,omitempty"`
	HeadSHA          string `json:"head_sha,omitempty"`
	HeadRef          string `json:"head_ref,omitempty"`
	HeadRepoFullName string `json:"head_repo_full_name,omitempty"`
	MergeableState   string `json:"mergeable_state,omitempty"`
	Additions        int    `json:"additions"`
	Deletions        int    `json:"deletions"`
	ChangedFiles     int    `json:"changed_files"`
	RawJSON          string `json:"raw_json,omitempty"`
	FetchedAt        string `json:"fetched_at"`
	UpdatedAt        string `json:"updated_at"`
}

type PullRequestFile added in v0.2.0

type PullRequestFile struct {
	ThreadID     int64  `json:"thread_id"`
	Path         string `json:"path"`
	Status       string `json:"status,omitempty"`
	Additions    int    `json:"additions"`
	Deletions    int    `json:"deletions"`
	Changes      int    `json:"changes"`
	PreviousPath string `json:"previous_path,omitempty"`
	Patch        string `json:"patch,omitempty"`
	RawJSON      string `json:"raw_json,omitempty"`
	FetchedAt    string `json:"fetched_at"`
}

type PullRequestReviewThread added in v0.3.3

type PullRequestReviewThread struct {
	ThreadID              int64  `json:"thread_id"`
	ReviewThreadID        string `json:"id"`
	Path                  string `json:"path,omitempty"`
	Line                  int    `json:"line,omitempty"`
	StartLine             int    `json:"start_line,omitempty"`
	IsResolved            bool   `json:"is_resolved"`
	IsOutdated            bool   `json:"is_outdated"`
	ViewerCanResolve      bool   `json:"viewer_can_resolve"`
	ViewerCanUnresolve    bool   `json:"viewer_can_unresolve"`
	ViewerCanReply        bool   `json:"viewer_can_reply"`
	FirstAuthorLogin      string `json:"first_author_login,omitempty"`
	FirstAuthorType       string `json:"first_author_type,omitempty"`
	FirstCommentBody      string `json:"first_comment_body,omitempty"`
	FirstCommentURL       string `json:"first_comment_url,omitempty"`
	FirstCommentCreatedAt string `json:"first_comment_created_at,omitempty"`
	FirstCommentUpdatedAt string `json:"first_comment_updated_at,omitempty"`
	CommentsJSON          string `json:"comments_json"`
	RawJSON               string `json:"-"`
	FetchedAt             string `json:"fetched_at"`
}

type Repository

type Repository struct {
	ID           int64  `json:"id"`
	Owner        string `json:"owner"`
	Name         string `json:"name"`
	FullName     string `json:"full_name"`
	GitHubRepoID string `json:"github_repo_id,omitempty"`
	RawJSON      string `json:"-"`
	UpdatedAt    string `json:"updated_at"`
}

type RunRecord

type RunRecord struct {
	ID         int64  `json:"id"`
	RepoID     int64  `json:"repo_id"`
	Kind       string `json:"kind"`
	Scope      string `json:"scope"`
	Status     string `json:"status"`
	StartedAt  string `json:"started_at"`
	FinishedAt string `json:"finished_at,omitempty"`
	StatsJSON  string `json:"stats_json,omitempty"`
	ErrorText  string `json:"error_text,omitempty"`
}

type SaveDurableClustersResult

type SaveDurableClustersResult struct {
	RunID        int64 `json:"run_id"`
	ClusterCount int   `json:"cluster_count"`
	MemberCount  int   `json:"member_count"`
}

type SearchHit

type SearchHit struct {
	ThreadID    int64   `json:"thread_id"`
	Number      int     `json:"number"`
	Kind        string  `json:"kind"`
	State       string  `json:"state"`
	Title       string  `json:"title"`
	HTMLURL     string  `json:"html_url"`
	AuthorLogin string  `json:"author_login,omitempty"`
	Snippet     string  `json:"snippet"`
	Score       float64 `json:"score,omitempty"`
}

type Status

type Status struct {
	DBPath          string    `json:"db_path"`
	RepositoryCount int       `json:"repository_count"`
	ThreadCount     int       `json:"thread_count"`
	OpenThreadCount int       `json:"open_thread_count"`
	ClusterCount    int       `json:"cluster_count"`
	LastSyncAt      time.Time `json:"last_sync_at,omitempty"`
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func Open

func Open(ctx context.Context, path string) (*Store, error)

func OpenReadOnly

func OpenReadOnly(ctx context.Context, path string) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) CloseClusterLocally

func (s *Store) CloseClusterLocally(ctx context.Context, repoID, clusterID int64, reason string) error

func (*Store) CloseThreadLocally

func (s *Store) CloseThreadLocally(ctx context.Context, repoID int64, number int, reason string) error

func (*Store) ClusterDetail

func (s *Store) ClusterDetail(ctx context.Context, options ClusterDetailOptions) (ClusterDetail, error)

func (*Store) ClusterIDForThreadNumber

func (s *Store) ClusterIDForThreadNumber(ctx context.Context, repoID int64, number int, includeClosed bool) (int64, error)

func (*Store) DB

func (s *Store) DB() *sql.DB

func (*Store) DurableClusterDetail

func (s *Store) DurableClusterDetail(ctx context.Context, options ClusterDetailOptions) (ClusterDetail, error)

func (*Store) ExcludeClusterMemberLocally

func (s *Store) ExcludeClusterMemberLocally(ctx context.Context, repoID, clusterID int64, number int, reason string) (ClusterMemberOverride, error)

func (*Store) IncludeClusterMemberLocally

func (s *Store) IncludeClusterMemberLocally(ctx context.Context, repoID, clusterID int64, number int, reason string) (ClusterMemberOverride, error)

func (*Store) LastSuccessfulListSyncAt added in v0.3.1

func (s *Store) LastSuccessfulListSyncAt(ctx context.Context, repoID int64, state string) (time.Time, error)

func (*Store) LastSuccessfulSyncAt

func (s *Store) LastSuccessfulSyncAt(ctx context.Context, repoID int64) (time.Time, error)

func (*Store) ListClusterSummaries

func (s *Store) ListClusterSummaries(ctx context.Context, options ClusterSummaryOptions) ([]ClusterSummary, error)

func (*Store) ListComments added in v0.2.0

func (s *Store) ListComments(ctx context.Context, threadID int64) ([]Comment, error)

func (*Store) ListDisplayClusterSummaries

func (s *Store) ListDisplayClusterSummaries(ctx context.Context, options ClusterSummaryOptions) ([]ClusterSummary, error)

func (*Store) ListEmbeddingTasks

func (s *Store) ListEmbeddingTasks(ctx context.Context, options EmbeddingTaskOptions) ([]EmbeddingTask, error)

func (*Store) ListRepositories

func (s *Store) ListRepositories(ctx context.Context) ([]Repository, error)

func (*Store) ListRunClusterSummaries

func (s *Store) ListRunClusterSummaries(ctx context.Context, options ClusterSummaryOptions) ([]ClusterSummary, error)

func (*Store) ListRuns

func (s *Store) ListRuns(ctx context.Context, repoID int64, kind string, limit int) ([]RunRecord, error)

func (*Store) ListThreadVectors

func (s *Store) ListThreadVectors(ctx context.Context, repoID int64) ([]ThreadVector, error)

func (*Store) ListThreadVectorsFiltered

func (s *Store) ListThreadVectorsFiltered(ctx context.Context, query ThreadVectorQuery) ([]ThreadVector, error)

func (*Store) ListThreads

func (s *Store) ListThreads(ctx context.Context, repoID int64, includeClosed bool) ([]Thread, error)

func (*Store) ListThreadsFiltered

func (s *Store) ListThreadsFiltered(ctx context.Context, options ThreadListOptions) ([]Thread, error)

func (*Store) ListWorkflowRuns added in v0.2.0

func (s *Store) ListWorkflowRuns(ctx context.Context, repoID int64, options WorkflowRunListOptions) ([]WorkflowRun, error)

func (*Store) MarkOpenThreadClosedFromGitHub

func (s *Store) MarkOpenThreadClosedFromGitHub(ctx context.Context, thread Thread) (bool, error)

func (*Store) Path

func (s *Store) Path() string

func (*Store) PrunePortablePayloads

func (s *Store) PrunePortablePayloads(ctx context.Context, options PortablePruneOptions) (PortablePruneStats, error)

func (*Store) PullRequestCache added in v0.2.0

func (s *Store) PullRequestCache(ctx context.Context, repoID int64, number int) (PullRequestCache, error)

func (*Store) PullRequestChecks added in v0.2.0

func (s *Store) PullRequestChecks(ctx context.Context, threadID int64) ([]PullRequestCheck, error)

func (*Store) PullRequestCommits added in v0.2.0

func (s *Store) PullRequestCommits(ctx context.Context, threadID int64) ([]PullRequestCommit, error)

func (*Store) PullRequestFiles added in v0.2.0

func (s *Store) PullRequestFiles(ctx context.Context, threadID int64) ([]PullRequestFile, error)

func (*Store) PullRequestReviewThreads added in v0.3.3

func (s *Store) PullRequestReviewThreads(ctx context.Context, threadID int64) ([]PullRequestReviewThread, error)

func (*Store) PullRequestReviewThreadsFetchedAt added in v0.3.3

func (s *Store) PullRequestReviewThreadsFetchedAt(ctx context.Context, threadID int64) (string, error)

func (*Store) RecordRun

func (s *Store) RecordRun(ctx context.Context, run RunRecord) (int64, error)

func (*Store) ReopenClusterLocally

func (s *Store) ReopenClusterLocally(ctx context.Context, repoID, clusterID int64) error

func (*Store) ReopenThreadLocally

func (s *Store) ReopenThreadLocally(ctx context.Context, repoID int64, number int) error

func (*Store) RepositoryByFullName

func (s *Store) RepositoryByFullName(ctx context.Context, fullName string) (Repository, error)

func (*Store) RunClusterDetail

func (s *Store) RunClusterDetail(ctx context.Context, options ClusterDetailOptions) (ClusterDetail, error)

func (*Store) SaveCompleteDurableClusters added in v0.4.0

func (s *Store) SaveCompleteDurableClusters(ctx context.Context, repoID int64, inputs []DurableClusterInput) (SaveDurableClustersResult, error)

func (*Store) SaveDurableClusters

func (s *Store) SaveDurableClusters(ctx context.Context, repoID int64, inputs []DurableClusterInput) (SaveDurableClustersResult, error)

func (*Store) SearchDocuments

func (s *Store) SearchDocuments(ctx context.Context, repoID int64, query string, limit int) ([]SearchHit, error)

func (*Store) SearchThreads

func (s *Store) SearchThreads(ctx context.Context, options ThreadSearchOptions) ([]Thread, error)

func (*Store) SetClusterCanonicalLocally

func (s *Store) SetClusterCanonicalLocally(ctx context.Context, repoID, clusterID int64, number int, reason string) (ClusterMemberOverride, error)

func (*Store) Status

func (s *Store) Status(ctx context.Context) (Status, error)

func (*Store) ThreadVectorByNumber

func (s *Store) ThreadVectorByNumber(ctx context.Context, query ThreadVectorQuery, number int) (Thread, ThreadVector, error)

func (*Store) ThreadsByIDs

func (s *Store) ThreadsByIDs(ctx context.Context, repoID int64, ids []int64) (map[int64]Thread, error)

func (*Store) UpsertComment

func (s *Store) UpsertComment(ctx context.Context, comment Comment) (int64, error)

func (*Store) UpsertDocument

func (s *Store) UpsertDocument(ctx context.Context, doc Document) (int64, error)

func (*Store) UpsertPullRequestCache added in v0.2.0

func (s *Store) UpsertPullRequestCache(ctx context.Context, detail PullRequestDetail, files []PullRequestFile, commits []PullRequestCommit, checks []PullRequestCheck, runs []WorkflowRun) error

func (*Store) UpsertPullRequestReviewThreads added in v0.3.3

func (s *Store) UpsertPullRequestReviewThreads(ctx context.Context, threadID int64, fetchedAt string, threads []PullRequestReviewThread) error

func (*Store) UpsertRepository

func (s *Store) UpsertRepository(ctx context.Context, repo Repository) (int64, error)

func (*Store) UpsertThread

func (s *Store) UpsertThread(ctx context.Context, thread Thread) (int64, error)

func (*Store) UpsertThreadVector

func (s *Store) UpsertThreadVector(ctx context.Context, vector ThreadVector) error

func (*Store) WithTx

func (s *Store) WithTx(ctx context.Context, fn func(*Store) error) error

type Thread

type Thread struct {
	ID               int64  `json:"id"`
	RepoID           int64  `json:"repo_id"`
	GitHubID         string `json:"github_id"`
	Number           int    `json:"number"`
	Kind             string `json:"kind"`
	State            string `json:"state"`
	Title            string `json:"title"`
	Body             string `json:"body,omitempty"`
	AuthorLogin      string `json:"author_login,omitempty"`
	AuthorType       string `json:"author_type,omitempty"`
	HTMLURL          string `json:"html_url"`
	LabelsJSON       string `json:"labels_json"`
	AssigneesJSON    string `json:"assignees_json"`
	RawJSON          string `json:"-"`
	ContentHash      string `json:"content_hash"`
	IsDraft          bool   `json:"is_draft"`
	CreatedAtGitHub  string `json:"created_at_gh,omitempty"`
	UpdatedAtGitHub  string `json:"updated_at_gh,omitempty"`
	ClosedAtGitHub   string `json:"closed_at_gh,omitempty"`
	MergedAtGitHub   string `json:"merged_at_gh,omitempty"`
	FirstPulledAt    string `json:"first_pulled_at,omitempty"`
	LastPulledAt     string `json:"last_pulled_at,omitempty"`
	UpdatedAt        string `json:"updated_at"`
	ClosedAtLocal    string `json:"closed_at_local,omitempty"`
	CloseReasonLocal string `json:"close_reason_local,omitempty"`
}

type ThreadListOptions

type ThreadListOptions struct {
	RepoID        int64
	IncludeClosed bool
	Numbers       []int
	Limit         int
}

type ThreadSearchOptions

type ThreadSearchOptions struct {
	RepoID               int64
	Query                string
	Kind                 string
	State                string
	Author               string
	Assignee             string
	Labels               []string
	IncludeLocallyClosed bool
	Limit                int
}

type ThreadVector

type ThreadVector struct {
	ThreadID    int64     `json:"thread_id"`
	Basis       string    `json:"basis"`
	Model       string    `json:"model"`
	Dimensions  int       `json:"dimensions"`
	ContentHash string    `json:"content_hash"`
	Vector      []float64 `json:"vector"`
	Backend     string    `json:"backend"`
	CreatedAt   string    `json:"created_at"`
	UpdatedAt   string    `json:"updated_at"`
}

type ThreadVectorQuery

type ThreadVectorQuery struct {
	RepoID        int64
	Model         string
	Basis         string
	Dimensions    int
	IncludeClosed bool
}

type WorkflowRun added in v0.2.0

type WorkflowRun struct {
	RepoID       int64  `json:"repo_id"`
	RunID        string `json:"run_id"`
	RunNumber    int    `json:"run_number"`
	HeadBranch   string `json:"head_branch,omitempty"`
	HeadSHA      string `json:"head_sha,omitempty"`
	Status       string `json:"status,omitempty"`
	Conclusion   string `json:"conclusion,omitempty"`
	WorkflowName string `json:"workflow_name,omitempty"`
	Event        string `json:"event,omitempty"`
	HTMLURL      string `json:"html_url,omitempty"`
	CreatedAtGH  string `json:"created_at_gh,omitempty"`
	UpdatedAtGH  string `json:"updated_at_gh,omitempty"`
	RawJSON      string `json:"raw_json,omitempty"`
	FetchedAt    string `json:"fetched_at"`
}

type WorkflowRunListOptions added in v0.2.0

type WorkflowRunListOptions struct {
	Branch  string
	HeadSHA string
	Limit   int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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