effects

package
v0.7.2 Latest Latest
Warning

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

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

Documentation

Overview

Package effects defines the interface for dashboard side effects (daemon IPC, session store queries) and provides the production implementation.

Keeping effects behind an interface allows unit tests to inject fakes without a running daemon or real ledger on disk.

The full production implementation lives in cli_client.go. This file retains only the Client interface definition so it acts as the package's single import point for callers that only need the type.

Index

Constants

View Source
const DefaultRefreshInterval = 5 * time.Second

DefaultRefreshInterval is how often the dashboard polls for new data.

Variables

This section is empty.

Functions

func LoadCodeIndexStatsCmd

func LoadCodeIndexStatsCmd(c Client, gen int) tea.Cmd

LoadCodeIndexStatsCmd returns a tea.Cmd that fetches code index statistics asynchronously and wraps the result in CodeIndexStatsLoadedMsg.

func LoadDaemonStatusCmd

func LoadDaemonStatusCmd(c Client, gen int) tea.Cmd

LoadDaemonStatusCmd returns a tea.Cmd that fetches the daemon status asynchronously and wraps the result in DaemonStatusLoadedMsg.

func LoadInstancesCmd

func LoadInstancesCmd(c Client, gen int) tea.Cmd

LoadInstancesCmd returns a tea.Cmd that fetches active AI coworker instances asynchronously and wraps the result in InstancesLoadedMsg.

func LoadMurmursCmd

func LoadMurmursCmd(c Client, gen int) tea.Cmd

LoadMurmursCmd returns a tea.Cmd that fetches murmur entries asynchronously and wraps the result in MurmursLoadedMsg.

func LoadSessionsCmd

func LoadSessionsCmd(c Client, gen int) tea.Cmd

LoadSessionsCmd returns a tea.Cmd that fetches recent sessions asynchronously and wraps the result in SessionsLoadedMsg.

func LoadStoredErrorsCmd

func LoadStoredErrorsCmd(c Client, gen int) tea.Cmd

LoadStoredErrorsCmd returns a tea.Cmd that fetches unviewed stored errors asynchronously and wraps the result in StoredErrorsLoadedMsg.

func LoadTeamContextsCmd

func LoadTeamContextsCmd(c Client, gen int) tea.Cmd

LoadTeamContextsCmd returns a tea.Cmd that fetches team context metadata asynchronously and wraps the result in TeamContextsLoadedMsg.

func LoadTeamDiscussionsCmd

func LoadTeamDiscussionsCmd(c Client, gen int) tea.Cmd

LoadTeamDiscussionsCmd returns a tea.Cmd that fetches team discussion previews asynchronously and wraps the result in TeamDiscussionsLoadedMsg.

func LoadWhisperHistoryCmd

func LoadWhisperHistoryCmd(c Client, gen int) tea.Cmd

LoadWhisperHistoryCmd returns a tea.Cmd that fetches recent whisper history asynchronously and wraps the result in WhisperHistoryLoadedMsg.

func RefreshTickCmd

func RefreshTickCmd(gen int, interval time.Duration) tea.Cmd

RefreshTickCmd returns a tea.Cmd that sleeps for interval and then emits a RefreshTickMsg carrying gen. The root model uses gen to avoid acting on ticks that belong to a superseded refresh cycle.

Types

type Client

type Client interface {
	// GetDaemonStatus returns the current daemon status snapshot.
	// Never returns an error for "daemon not running" — it returns a StatusData
	// with Running=false instead, so callers can distinguish gracefully.
	GetDaemonStatus() (*daemon.StatusData, error)

	// ListSessions returns recent sessions from the project ledger.
	// Returns nil, nil when no ledger path is available.
	ListSessions() ([]session.SessionInfo, error)

	// ListMurmurs returns murmur entries from team context workspace paths.
	// Returns nil, nil on any filesystem error.
	ListMurmurs() ([]domain.MurmurEntry, error)

	// ListTeamDiscussions returns team discussion preview entries from memory/
	// directories in team context paths.
	// Returns nil, nil on any filesystem error.
	ListTeamDiscussions() ([]domain.TeamDiscussion, error)

	// ListInstances returns active AI coworker instances from the daemon.
	// Returns nil, nil when the daemon is offline.
	ListInstances() ([]daemon.InstanceInfo, error)

	// ListStoredErrors returns unviewed stored errors from the daemon.
	// Returns nil, nil when the daemon is offline.
	ListStoredErrors() ([]daemon.StoredError, error)

	// ListTeamContexts returns metadata about all synced team context workspaces,
	// loaded directly from disk (daemon-independent).
	// Returns nil, nil when no team contexts are found.
	ListTeamContexts() ([]domain.TeamContextEntry, error)

	// LoadCodeIndexStats returns code index statistics.
	// Prefers daemon-reported stats; falls back to reading the ledger cache directory
	// when the daemon is offline.
	// Returns nil, nil when no index data is available.
	LoadCodeIndexStats() (*daemon.CodeDBStats, error)

	// ListWhisperHistory returns recent whispers delivered by the daemon.
	// Fetches from the daemon's WhisperHistory IPC endpoint.
	// Returns nil, nil when the daemon is offline.
	ListWhisperHistory() ([]domain.WhisperHistoryEntry, error)

	// BuildSessionURL constructs the canonical web URL for a session name.
	// Returns empty string when required config (endpoint, repo_id) is unavailable.
	BuildSessionURL(sessionName string) string
}

Client is the contract the dashboard uses to fetch live data. All methods are synchronous; callers must run them inside tea.Cmd goroutines so the TUI event loop never blocks.

func NewCLIClient

func NewCLIClient() Client

NewCLIClient returns a production Client wired to the real daemon and ledger.

type CodeIndexStatsLoadedMsg

type CodeIndexStatsLoadedMsg struct {
	Stats *daemon.CodeDBStats
	Gen   int
	Err   error
}

CodeIndexStatsLoadedMsg is sent when the code index statistics fetch completes.

type DaemonStatusLoadedMsg

type DaemonStatusLoadedMsg struct {
	Data *daemon.StatusData
	Gen  int
	Err  error
}

DaemonStatusLoadedMsg is sent to the BubbleTea model when a daemon status fetch completes. Gen matches the Store.Generation at the time the load was started; the model discards this message if its generation has advanced.

type InstancesLoadedMsg

type InstancesLoadedMsg struct {
	Instances []daemon.InstanceInfo
	Gen       int
	Err       error
}

InstancesLoadedMsg is sent when the active AI coworker instance list fetch completes.

type MurmursLoadedMsg

type MurmursLoadedMsg struct {
	Murmurs []domain.MurmurEntry
	Gen     int
	Err     error
}

MurmursLoadedMsg is sent when the murmur list fetch completes.

type RefreshTickMsg

type RefreshTickMsg struct {
	Gen int
}

RefreshTickMsg is sent by the background refresh timer. It signals the root model to start a new data-fetch cycle.

type SessionsLoadedMsg

type SessionsLoadedMsg struct {
	Sessions []session.SessionInfo
	Gen      int
	Err      error
}

SessionsLoadedMsg is sent when the session list fetch completes.

type StoredErrorsLoadedMsg

type StoredErrorsLoadedMsg struct {
	Errors []daemon.StoredError
	Gen    int
	Err    error
}

StoredErrorsLoadedMsg is sent when the stored error list fetch completes.

type TeamContextsLoadedMsg

type TeamContextsLoadedMsg struct {
	TeamContexts []domain.TeamContextEntry
	Gen          int
	Err          error
}

TeamContextsLoadedMsg is sent when the team context metadata fetch completes.

type TeamDiscussionsLoadedMsg

type TeamDiscussionsLoadedMsg struct {
	Discussions []domain.TeamDiscussion
	Gen         int
	Err         error
}

TeamDiscussionsLoadedMsg is sent when the team discussion fetch completes.

type WhisperHistoryLoadedMsg

type WhisperHistoryLoadedMsg struct {
	Entries []domain.WhisperHistoryEntry
	Gen     int
	Err     error
}

WhisperHistoryLoadedMsg is sent when the whisper history fetch completes.

Jump to

Keyboard shortcuts

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