who

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: BSD-3-Clause Imports: 10 Imported by: ? 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 who answers "who holds this, and who is waiting for it?" from the agentsync lease store and the agentscope snapshot, with each session's reachable SendMessage name. It is the ONE implementation: the CLI (`agentscope who`) and the gRPC method both call Ask.

It never says "nobody" for something it could not read: an unreadable lease store is ErrUnreadable, and only a clean read that finds nothing is ErrNotFound.

Index

Constants

View Source
const (
	RoleHolder  = "holder"
	RoleQueued  = "queued"
	RoleSession = "session" // a session matched by id that holds and awaits nothing
)

Roles of a Party.

View Source
const DefaultIdle = 15 * time.Minute

DefaultIdle is agentsync's default idle limit, used only to say whether a lease is takeable.

Variables

View Source
var (
	// ErrNotFound: the stores were read cleanly and hold nothing for the query.
	ErrNotFound = errors.New("who: nothing found")
	// ErrUnreadable: a store could not be read, so no answer, not "nobody".
	ErrUnreadable = errors.New("who: unreadable")
	// ErrBadQuery: the query is neither an owner/repo nor a session id prefix.
	ErrBadQuery = errors.New("who: the query is neither owner/repo nor a session id prefix (4+ hex characters)")
)

Functions

func Render

func Render(w io.Writer, r Result)

Render prints a Result for a terminal.

Types

type Party

type Party struct {
	Role     string `json:"role"`
	Position int    `json:"position,omitempty"` // 1-based place in the line, queued only
	Resource string `json:"resource,omitempty"`
	Session  string `json:"session"`
	Short    string `json:"short"`
	Note     string `json:"note,omitempty"`
	// State is active, idle, no-transcript, or unknown (not in the snapshot).
	State     string      `json:"state"`
	SubAgents int         `json:"subAgents"`
	Reach     names.Reach `json:"reach"`
	// Since is when the lease was acquired, or the place in line was taken.
	Since    time.Time `json:"since,omitempty"`
	Expires  time.Time `json:"expires,omitempty"`
	Takeable bool      `json:"takeable,omitempty"`
}

Party is one session in the answer.

type Result

type Result struct {
	Query   string  `json:"query"`
	Kind    string  `json:"kind"` // resource or session
	Parties []Party `json:"parties"`
}

Result is the answer. Parties are the holder(s) first, then the line in first-come order.

func Ask

func Ask(snap model.Snapshot, claudeDir, q string, now time.Time) (Result, error)

Ask answers q: an owner/repo, or the start of a session id.

Jump to

Keyboard shortcuts

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