bbstore

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogLineFor

func LogLineFor(row bbapi.TimelineRow) (string, string, bool)

Types

type ComposerContext

type ComposerContext struct {
	Project     string
	Environment string
	Provider    string
	Model       string
	Reasoning   string
	Permission  string
}

ComposerContext is what the app shows around its composer: where the thread runs, which model answers, and how much it is allowed to do.

type DemoStore

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

DemoStore serves an invented workspace. It exists so the screenshots in this repository can be regenerated by anyone, from data that belongs to nobody, without a bb server running.

func NewDemoStore

func NewDemoStore() *DemoStore

NewDemoStore builds a workspace that looks like a working day: something running, a couple of things waiting on an answer, and a pile of finished work.

func (*DemoStore) Activity

func (s *DemoStore) Activity(taskID int64) (bool, string)

Activity reports a running thread as working, for the indicator.

func (*DemoStore) Context

func (s *DemoStore) Context(taskID int64) ComposerContext

Context is the execution the composer shows for a demo thread.

func (*DemoStore) CountTasksByProject

func (s *DemoStore) CountTasksByProject(project string) (int, error)

func (*DemoStore) CountTasksByStatus

func (s *DemoStore) CountTasksByStatus(status string) (int, error)

func (*DemoStore) GetLatestLogPerTask

func (s *DemoStore) GetLatestLogPerTask(taskIDs []int64) (map[int64]*db.TaskLog, error)

func (*DemoStore) GetTask

func (s *DemoStore) GetTask(id int64) (*db.Task, error)

func (*DemoStore) GetTaskLogCount

func (s *DemoStore) GetTaskLogCount(taskID int64) (int, error)

func (*DemoStore) GetTaskLogs

func (s *DemoStore) GetTaskLogs(taskID int64, limit int) ([]*db.TaskLog, error)

func (*DemoStore) ListProjects

func (s *DemoStore) ListProjects() ([]*db.Project, error)

func (*DemoStore) ListTasks

func (s *DemoStore) ListTasks(opts db.ListTasksOptions) ([]*db.Task, error)

func (*DemoStore) MarkOpened

func (s *DemoStore) MarkOpened(taskID int64) error

func (*DemoStore) SearchTasks

func (s *DemoStore) SearchTasks(query string, limit int) ([]*db.Task, error)

type Store

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

Store serves the board from bb. It holds threads in memory rather than in a local table so there is exactly one source of truth: nothing here is written back, and anything stale is replaced by the next refresh.

The cache exists because the UI asks for the task list on every tick, and a round trip per frame would be visible.

func New

func New(client *bbapi.Client) *Store

func (*Store) Activity

func (s *Store) Activity(taskID int64) (bool, string)

Activity reports whether a thread is working and what it is doing, for the indicator the thread view shows while a turn is in flight.

func (*Store) Context

func (s *Store) Context(taskID int64) ComposerContext

Context reads the execution options bb would apply to the next message.

func (*Store) CountTasksByProject

func (s *Store) CountTasksByProject(projectName string) (int, error)

func (*Store) CountTasksByStatus

func (s *Store) CountTasksByStatus(status string) (int, error)

func (*Store) Err

func (s *Store) Err() error

Err reports the most recent refresh failure, if the board is showing stale data because bb went away.

func (*Store) GetLatestLogPerTask

func (s *Store) GetLatestLogPerTask(taskIDs []int64) (map[int64]*db.TaskLog, error)

func (*Store) GetTask

func (s *Store) GetTask(id int64) (*db.Task, error)

func (*Store) GetTaskLogCount

func (s *Store) GetTaskLogCount(taskID int64) (int, error)

func (*Store) GetTaskLogs

func (s *Store) GetTaskLogs(taskID int64, limit int) ([]*db.TaskLog, error)

func (*Store) ListProjects

func (s *Store) ListProjects() ([]*db.Project, error)

func (*Store) ListTasks

func (s *Store) ListTasks(opts db.ListTasksOptions) ([]*db.Task, error)

func (*Store) MarkOpened

func (s *Store) MarkOpened(taskID int64) error

MarkOpened records which thread the user is reading. Only that thread's conversation is fetched, because a timeline per thread per tick would be a hundred requests a second for no one's benefit.

func (*Store) OpenTask

func (s *Store) OpenTask() int64

func (*Store) ProjectIDForName

func (s *Store) ProjectIDForName(name string) (string, error)

ProjectIDForName resolves the project name a board row carries back to bb's project id.

func (*Store) Refresh

func (s *Store) Refresh() error

Refresh pulls threads and projects and rebuilds the cache.

func (*Store) RefreshOpenLogs

func (s *Store) RefreshOpenLogs()

RefreshOpenLogs re-reads the conversation of whichever thread is on screen.

func (*Store) SearchFiles

func (s *Store) SearchFiles(taskID int64, query string, limit int) []bbapi.ProjectFile

SearchFiles asks bb to match paths, so a large repository costs one request rather than a full tree in memory.

func (*Store) SearchTasks

func (s *Store) SearchTasks(query string, limit int) ([]*db.Task, error)

func (*Store) Skills

func (s *Store) Skills(taskID int64) []bbapi.Skill

Skills lists the project's skills, cached because the catalogue is large and does not change while a message is being typed.

func (*Store) TaskID

func (s *Store) TaskID(threadID string) int64

TaskID assigns a stable board number to a thread, so a row keeps its number for the life of the session.

func (*Store) ThreadID

func (s *Store) ThreadID(taskID int64) (string, error)

ThreadID maps a board row back to the thread it came from.

func (*Store) Watch

func (s *Store) Watch(stop <-chan struct{}, onChange func())

Watch keeps the cache current from bb's change feed, so the board reacts as the app does instead of waiting out a poll interval. It reconnects with backoff and refreshes on every reconnect, because changes that landed while the socket was down are not replayed.

Jump to

Keyboard shortcuts

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