agentbroadcast

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 7 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 agentbroadcast plans and delivers one prompt to a set of live managed agents. It is the application core behind sidecar agent broadcast and the Broadcast to agents modal; both are thin callers of Plan and Send.

Index

Constants

View Source
const (
	ScopeProject = "project"
	ScopeAll     = "all"

	OutcomeWouldSend Outcome = "would_send"
	OutcomeSubmitted Outcome = "submitted"
	OutcomeSkipped   Outcome = "skipped"
	OutcomeUnknown   Outcome = "unknown"

	// ReasonExcluded is the verdict a row carries when the caller deselected
	// it: nothing was attempted and nothing refused it. The modal reads it to
	// keep a deselection out of the result notifications — the user already
	// knows, having just unchecked the box.
	ReasonExcluded = "excluded"
)

Variables

This section is empty.

Functions

func CandidatesFromState

func CandidatesFromState(stateDir string) func(context.Context, PlanRequest) ([]managedtarget.Target, error)

CandidatesFromState is the Plan candidate source for both the CLI verb and the TUI modal: one scan of stateDir, filtered by the request's scope.

func Envelope

func Envelope(sender, text string) string

Envelope prefixes delivered text so a receiving agent can tell a broadcast from its own user typing. sender is already framed: `"shell" in project` or `the user`.

func RecipientID

func RecipientID(row Recipient) string

RecipientID is the stable checklist key for a plan row.

Types

type Outcome

type Outcome string

type Plan

type Plan struct {
	Scope              Scope       `json:"scope"`
	Raw                bool        `json:"raw,omitempty"`
	FromUser           bool        `json:"-"`
	SenderName         string      `json:"-"`
	SenderProject      string      `json:"-"`
	Recipients         []Recipient `json:"recipients"`
	ShellsWithoutAgent int         `json:"shellsWithoutAgent"`
}

func (Plan) WithRequested

func (p Plan) WithRequested(keep func(Recipient) bool) Plan

WithRequested treats keep=true rows as would_send (so Send will attempt them and Prompt may refuse again) and keep=false would_send rows as skipped. Already-skipped unchecked rows keep their reason.

type PlanRequest

type PlanRequest struct {
	// ScopeKind is "project", "all", or empty when --to alone is the set.
	// Candidates still needs a search universe: empty/--to-only means all
	// registered projects, matching agent prompt TARGET resolution.
	ScopeKind     string // "project" | "all" | ""
	Project       string
	To            []string
	Exclude       []string
	Status        []agentcontrol.Status // empty => PromptableStates()
	IncludeSelf   bool
	SenderSession string // SIDECAR_SHELL tmux name; dropped unless IncludeSelf
	SenderName    string
	SenderProject string
	FromUser      bool // TUI: envelope says "the user"
	Raw           bool
}

type Reason

type Reason struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Recipient

type Recipient struct {
	Target  agentcontrol.Target         `json:"target"`
	Agent   agentcontrol.AgentState     `json:"agent"`
	Outcome Outcome                     `json:"outcome"`
	Reason  *Reason                     `json:"reason,omitempty"`
	Receipt *agentcontrol.PromptReceipt `json:"receipt,omitempty"`
}

type Result

type Result struct {
	Text       string      `json:"text"`
	Scope      Scope       `json:"scope"`
	Recipients []Recipient `json:"recipients"`
	Summary    Summary     `json:"summary"`
}

type Scope

type Scope struct {
	Kind    string `json:"kind,omitempty"`
	Project string `json:"project,omitempty"`
}

type Service

type Service struct {
	Control agentcontrol.Service
	// Candidates returns the same enumeration agent list uses: every managed
	// shell/worktree the scope can see, one row per pane. Injected so this
	// package does not import internal/cli.
	Candidates func(ctx context.Context, req PlanRequest) ([]managedtarget.Target, error)
}

func (Service) Plan

func (s Service) Plan(ctx context.Context, req PlanRequest) (Plan, error)

Plan discovers managed shells in scope and records a would_send or skipped verdict per identified agent. It does not write to any pane.

func (Service) Send

func (s Service) Send(ctx context.Context, plan Plan, text string) (Result, error)

Send fans out Control.Prompt to every would_send row. A refusing target does not stop the others. There is no path to Start or Launch.

type Summary

type Summary struct {
	Submitted          int `json:"submitted"`
	Skipped            int `json:"skipped"`
	Unknown            int `json:"unknown"`
	ShellsWithoutAgent int `json:"shellsWithoutAgent"`
}

Jump to

Keyboard shortcuts

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