managedtarget

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package managedtarget resolves a caller-facing shell name into one host-shaped Sidecar-owned target. Resolve is state-free: callers supply the candidates they are authorized to expose. List/Candidates load that universe from a Sidecar state directory so the CLI and the TUI cannot disagree.

Index

Constants

View Source
const (
	KindShell    = "shell"
	KindWorktree = "worktree"
)

Variables

This section is empty.

Functions

func ObserveWorktreeOrphans added in v1.15.0

func ObserveWorktreeOrphans(ctx context.Context, projects []Project, opts ObserveOptions) shellliveness.OrphanObservation

ObserveWorktreeOrphans gathers the evidence for projects. A tmux server with no sessions is an empty listing, not a failure: `no server running` means there is nothing live to be orphaned.

Git is asked only when there is something to judge. Every verdict needs a directory that is gone, so a pass with no live worktree session in a missing directory (and no caller asking for root verdicts) never spawns git at all. That keeps the common `agent list` free of a git process per project.

func WorktreeOrphans added in v1.15.0

func WorktreeOrphans(ctx context.Context, projects []Project, opts ObserveOptions) shellliveness.OrphanPlan

WorktreeOrphans is ObserveWorktreeOrphans followed by the decision.

Types

type Error

type Error struct {
	Kind    ErrorKind
	Message string
}

func (*Error) Error

func (e *Error) Error() string

type ErrorKind

type ErrorKind string
const (
	NotFound  ErrorKind = "not_found"
	Ambiguous ErrorKind = "ambiguous"
)

type ObserveOptions added in v1.15.0

type ObserveOptions struct {
	// WantRoots asks for root verdicts even when no session is suspect, for a
	// caller (`shell list`) that marks shells rather than sessions.
	WantRoots bool
}

ObserveOptions says how much evidence a caller needs.

type Project added in v1.15.0

type Project struct {
	Key, Path, Dir string
	Worktrees      []string
}

Project is the registered-project facts the candidate scan needs. Callers that already loaded the registry (the CLI) pass this; List loads it from stateDir.

func LoadProjects added in v1.15.0

func LoadProjects(stateDir string) ([]Project, error)

LoadProjects reads every registered project under stateDir/projects.

type Query

type Query struct{ Host, Project, Namespace, Value string }

type Target

type Target struct {
	Host, Project, ProjectRoot, Kind, Session, Name, Namespace, WorkDir, WorktreeRoot, ManifestPath string
	Priority                                                                                        int
}

func Candidates added in v1.15.0

func Candidates(ctx context.Context, stateDir string, projects []Project) ([]Target, error)

Candidates is every shell and worktree session the given projects own, each worktree root listed exactly once.

Shell records belong to the project whose manifest holds them. Worktree roots do not, because several registered projects can see the same directory. Each root therefore has one owner, chosen by how strongly a project claims it: created worktree, then the project's own checkout, then the first project that merely discovered it through Git.

func List added in v1.15.0

func List(ctx context.Context, stateDir, projectKey string) ([]Target, error)

List is every managed shell and worktree in stateDir, or only projectKey when that is set. Empty projectKey means every registered project. This is the universe agent list and agent broadcast share.

func Resolve

func Resolve(candidates []Target, q Query) (Target, error)

Resolve prefers exact durable session identity over display name. Every filter is exact; an empty field means the caller has not scoped that axis.

Jump to

Keyboard shortcuts

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