Documentation
¶
Overview ¶
Package workspaceinventory provides the narrow, read-only inventory used by cross-project surfaces. It never creates or reconciles Sidecar state.
Index ¶
- func CanonicalPath(path string) string
- func CanonicalProjectPath(path string) string
- type CaptureFunc
- type Collector
- func (c Collector) CollectProject(ctx context.Context, name, root string, allRoots []string, panes []Pane) ProjectResult
- func (c Collector) CollectProjectInventory(ctx context.Context, name, root string) ProjectResult
- func (c Collector) CommitTrackers()
- func (c Collector) ForRefresh(maxCaptures int, claims ...ShellClaims) Collector
- func (c Collector) ListPanes(ctx context.Context) ([]Pane, error)
- func (c Collector) Metrics() MetricsSnapshot
- func (c Collector) RefreshProjectStatus(ctx context.Context, previous ProjectResult, allRoots []string, panes []Pane) ProjectResult
- func (c Collector) SeedTrackers(seed map[string]agentactivity.Tracker) Collector
- func (c Collector) TrackerSnapshot() map[string]agentactivity.Tracker
- func (c Collector) ValidateWorkspace(ctx context.Context, workspace Workspace) error
- func (c Collector) WithDefaults() Collector
- func (c Collector) WithShellClaims(claims ShellClaims) Collector
- type ExecRunner
- type Item
- type Kind
- type MetricsSnapshot
- type Pane
- type ProjectResult
- type RefreshMetrics
- type Runner
- type ShellClaims
- type Workspace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalPath ¶
func CanonicalProjectPath ¶
CanonicalProjectPath resolves a configured checkout to its canonical main worktree when Git's linked-worktree metadata is available. Missing and non-Git paths retain their canonical configured identity so they can still produce an independent error result.
Types ¶
type CaptureFunc ¶ added in v0.98.0
CaptureFunc reads one pane: its capture text and the geometry observed with it. The geometry travels with the capture because a capture's rows alone cannot say where the live grid starts, and a consumer that has to ask separately pairs rows from one instant with a height from another.
type Collector ¶
type Collector struct {
Runner Runner
Capture CaptureFunc
Now func() time.Time
DoneTTL time.Duration
// contains filtered or unexported fields
}
func (Collector) CollectProject ¶
func (c Collector) CollectProject(ctx context.Context, name, root string, allRoots []string, panes []Pane) ProjectResult
CollectProject reads one Git inventory and already-existing Sidecar metadata.
func (Collector) CollectProjectInventory ¶
func (c Collector) CollectProjectInventory(ctx context.Context, name, root string) ProjectResult
CollectProjectInventory reads one project's lightweight Git and existing Sidecar metadata without inspecting tmux or capturing panes. Callers can therefore fan this stage out with the same project bound as the rest of a refresh and paint each result before global shell collision resolution.
func (Collector) CommitTrackers ¶
func (c Collector) CommitTrackers()
CommitTrackers promotes a completed refresh's generation-local activity state. Canceled/stale refreshes are simply never committed.
func (Collector) ForRefresh ¶
func (c Collector) ForRefresh(maxCaptures int, claims ...ShellClaims) Collector
ForRefresh returns a collector sharing provider history with its parent while independently bounding pane captures for one refresh generation.
func (Collector) ListPanes ¶
ListPanes takes the single global tmux inventory used by an Overview refresh.
func (Collector) Metrics ¶
func (c Collector) Metrics() MetricsSnapshot
func (Collector) RefreshProjectStatus ¶
func (c Collector) RefreshProjectStatus(ctx context.Context, previous ProjectResult, allRoots []string, panes []Pane) ProjectResult
RefreshProjectStatus reuses an immutable successful project inventory and refreshes only live tmux/provider evidence. It performs no Git or metadata reads, allowing visible polling to stay cheaper than explicit inventory refreshes.
func (Collector) SeedTrackers ¶ added in v0.96.0
func (c Collector) SeedTrackers(seed map[string]agentactivity.Tracker) Collector
SeedTrackers installs persisted activity as the collector's starting state. Entries already observed in this process win: a live reading is always better evidence than a restored one.
func (Collector) TrackerSnapshot ¶ added in v0.96.0
func (c Collector) TrackerSnapshot() map[string]agentactivity.Tracker
TrackerSnapshot copies committed activity for persistence.
func (Collector) ValidateWorkspace ¶
ValidateWorkspace rechecks a card's exact durable identity without creating, migrating, reconciling, or mutating project state.
func (Collector) WithDefaults ¶
func (Collector) WithShellClaims ¶
func (c Collector) WithShellClaims(claims ShellClaims) Collector
type ExecRunner ¶
type ExecRunner struct{}
type Item ¶ added in v0.98.0
type Item struct {
ID string
ProjectKey, ProjectName string
ProjectRoot string
Kind Kind
Key, Name, Path, Branch string
TaskID string
Provider string
PaneID, TmuxName string
Live, Ambiguous bool
IsMain bool
Agent *agentstatus.Presentation
ObservedAt time.Time
}
Item is the read-only catalog row shared by the Agents board and the global Workspaces browser. Agent is nil for plain shells and worktrees: they are given presentation buckets by the list projection rather than a fabricated semantic state.
func Catalog ¶ added in v0.98.0
func Catalog(result ProjectResult) []Item
Catalog projects a whole project result: every durable shell and Git worktree it holds, agent-backed or not.
type MetricsSnapshot ¶
type MetricsSnapshot struct {
ProjectOps, Captures, MaxCaptures, TrackerCommits int64
}
type ProjectResult ¶
type RefreshMetrics ¶
type RefreshMetrics struct {
// contains filtered or unexported fields
}
RefreshMetrics contains privacy-safe operation and concurrency counters for an in-memory refresh. It never includes project paths, pane IDs, or output.
type ShellClaims ¶
ShellClaims records globally reserved agent-shell sessions and their unique owning project. An empty owner marks a collision that no project may claim.
func BuildShellClaims ¶
func BuildShellClaims(results []ProjectResult) ShellClaims
type Workspace ¶
type Workspace struct {
ID, ProjectKey, ProjectName, ProjectRoot string
Kind Kind
Key, Name, Path, Branch, TaskID string
TmuxName, PaneID, Provider, Namespace string
// Plain marks a workspace collected with no agent evidence at all: a Git
// worktree with no recorded agent. It is the catalog's honest answer to
// "is there an agent here?", and it is what keeps the Agents projection
// identical to what it collected before the catalog carried plain rows.
Plain bool
// IsMain is explicit inventory identity, resolved while collecting Git's
// worktree list. Presentation callers must not guess it from a name.
IsMain bool
// Live and Ambiguous describe session health, which is not the same
// question as agent activity: a plain shell or an agentless worktree can
// own a live pane while having no agent semantics at all. Keeping them
// separate is what lets the catalog carry plain workspaces without
// fabricating an agentstatus value for them.
Live, Ambiguous bool
Presentation agentstatus.Presentation
ObservedAt time.Time
}
func AgentWorkspaces ¶ added in v0.98.0
AgentWorkspaces is the agent-only projection the Kanban board consumes. It excludes exactly the items with no agent evidence and changes nothing else, so the board keeps the full shared semantic matrix it had before the catalog carried plain workspaces.
func (Workspace) HasAgent ¶ added in v0.98.0
HasAgent reports durable or detected agent evidence. A worktree earns it from its recorded `agent` file; a shell earns it from a configured agent type or from live identification, which is why an unidentified shell can still become an agent on a later status poll. Everything else is plain.