team

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAgentCycle             = errors.New("team: agent graph cycle")
	ErrAgentExists            = errors.New("team: agent already exists")
	ErrAgentNotFound          = errors.New("team: agent not found")
	ErrConcurrencyLimit       = errors.New("team: concurrency limit reached")
	ErrCorruptState           = errors.New("team: graph state corrupt")
	ErrInvalidAgent           = errors.New("team: invalid agent")
	ErrLeaderApprovalRequired = errors.New("team: leader approval required")
	ErrTaskOwnerMismatch      = errors.New("team: task owner mismatch")
)

Functions

This section is empty.

Types

type AddChildRequest

type AddChildRequest struct {
	ParentID          AgentID
	Child             AgentNode
	MaxActiveChildren int
}

type AgentEdge

type AgentEdge struct {
	ParentID  AgentID   `json:"parent_id"`
	ChildID   AgentID   `json:"child_id"`
	CreatedAt time.Time `json:"created_at"`
}

type AgentID

type AgentID string

type AgentNode

type AgentNode struct {
	ID        AgentID            `json:"id"`
	Name      subagent.AgentName `json:"name,omitempty"`
	Type      subagent.AgentType `json:"type"`
	Status    AgentStatus        `json:"status"`
	CreatedAt time.Time          `json:"created_at"`
	UpdatedAt time.Time          `json:"updated_at"`
	Metadata  map[string]string  `json:"metadata,omitempty"`
}

type AgentStatus

type AgentStatus string
const (
	AgentStatusRunning   AgentStatus = "running"
	AgentStatusCompleted AgentStatus = "completed"
	AgentStatusCancelled AgentStatus = "cancelled"
)

type ClaimNextRequest

type ClaimNextRequest struct {
	PlanID     string
	AgentID    AgentID
	StaleAfter time.Duration
}

type ClaimTaskRequest

type ClaimTaskRequest struct {
	PlanID     string
	TaskID     string
	AgentID    AgentID
	StaleAfter time.Duration
}

type Coordinator

type Coordinator struct {
	// contains filtered or unexported fields
}

func NewCoordinator

func NewCoordinator(tasks taskstate.Store, graph GraphStore, opts CoordinatorOptions) *Coordinator

func (*Coordinator) AddChild

func (c *Coordinator) AddChild(ctx context.Context, parentID AgentID, child AgentNode) error

func (*Coordinator) ApprovePlanExit

func (c *Coordinator) ApprovePlanExit(ctx context.Context, req PlanExitApproval) (taskstate.PlanRef, error)

func (*Coordinator) CancelTask

func (c *Coordinator) CancelTask(ctx context.Context, req TaskOwnerRequest) (taskstate.TaskNode, error)

func (*Coordinator) ClaimNext

func (*Coordinator) ClaimTask

func (*Coordinator) DescendantsBFS

func (c *Coordinator) DescendantsBFS(ctx context.Context, parentID AgentID) ([]AgentNode, error)

func (*Coordinator) ReleaseTask

func (c *Coordinator) ReleaseTask(ctx context.Context, req TaskOwnerRequest) (taskstate.TaskNode, error)

type CoordinatorOptions

type CoordinatorOptions struct {
	LeaderID          AgentID
	MaxActiveChildren int
}

type FileGraphStore

type FileGraphStore struct {
	// contains filtered or unexported fields
}

func NewFileGraphStore

func NewFileGraphStore(path string) *FileGraphStore

func (*FileGraphStore) AddChild

func (s *FileGraphStore) AddChild(ctx context.Context, req AddChildRequest) error

func (*FileGraphStore) DescendantsBFS

func (s *FileGraphStore) DescendantsBFS(ctx context.Context, parentID AgentID) ([]AgentNode, error)

func (*FileGraphStore) ListAgents

func (s *FileGraphStore) ListAgents(ctx context.Context) ([]AgentNode, error)

func (*FileGraphStore) RegisterAgent

func (s *FileGraphStore) RegisterAgent(ctx context.Context, node AgentNode) error

func (*FileGraphStore) SetClock

func (s *FileGraphStore) SetClock(now func() time.Time)

func (*FileGraphStore) UpdateAgentStatus

func (s *FileGraphStore) UpdateAgentStatus(ctx context.Context, id AgentID, status AgentStatus) (AgentNode, error)

type GraphStore

type GraphStore interface {
	RegisterAgent(ctx context.Context, node AgentNode) error
	AddChild(ctx context.Context, req AddChildRequest) error
	UpdateAgentStatus(ctx context.Context, id AgentID, status AgentStatus) (AgentNode, error)
	DescendantsBFS(ctx context.Context, parentID AgentID) ([]AgentNode, error)
}

type PlanExitApproval

type PlanExitApproval struct {
	PlanID  string
	ActorID AgentID
	Approve bool
	Reason  string
}

type TaskOwnerRequest

type TaskOwnerRequest struct {
	PlanID  string
	TaskID  string
	AgentID AgentID
}

Jump to

Keyboard shortcuts

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