store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterSourceRun     = "run_cluster"
	ClusterSourceDurable = "durable_cluster"
)

Variables

This section is empty.

Functions

func HumanKeyStableSlug

func HumanKeyStableSlug(key HumanKey) string

func StableHash

func StableHash(value string) string

Types

type ClusterDetail

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

type ClusterDetailOptions

type ClusterDetailOptions struct {
	RepoID        int64
	ClusterID     int64
	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"`
}

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"`
	BodyChars           int      `json:"body_chars"`
	BytesBefore         int64    `json:"bytes_before"`
	BytesAfter          int64    `json:"bytes_after"`
	ThreadsPruned       int64    `json:"threads_pruned"`
	RepositoriesPruned  int64    `json:"repositories_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 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"`
}

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) 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) 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) 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) 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) 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) 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
	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
}

Jump to

Keyboard shortcuts

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