session

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package session manages agent sessions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	Name   string
	Agents []agent.Agent
}

Group represents a group of agents

type GroupMode

type GroupMode string

GroupMode represents how agents are grouped

const (
	GroupModeFlat    GroupMode = "flat"
	GroupModeType    GroupMode = "type"
	GroupModeProject GroupMode = "project"
	GroupModeStatus  GroupMode = "status"
)

type Manager

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

Manager coordinates session discovery, monitoring, and lifecycle

func NewManager

func NewManager(cfg *config.Config, st *store.Store, registry *agent.Registry, alertMgr *alert.Manager) *Manager

NewManager creates a new session manager

func (*Manager) ActiveCount

func (m *Manager) ActiveCount() int

ActiveCount returns the number of active (running) agents

func (*Manager) AddAgentForTesting

func (m *Manager) AddAgentForTesting(a agent.Agent)

AddAgentForTesting adds an agent directly (for testing only)

func (*Manager) ChildCount

func (m *Manager) ChildCount(parentID string) int

func (*Manager) FilterByStatus

func (m *Manager) FilterByStatus(status agent.Status) []agent.Agent

FilterByStatus returns agents with the specified status

func (*Manager) FilterByType

func (m *Manager) FilterByType(agentType string) []agent.Agent

FilterByType returns agents of the specified type

func (*Manager) Get

func (m *Manager) Get(id string) (agent.Agent, bool)

Get returns an agent by ID

func (*Manager) GetChildren

func (m *Manager) GetChildren(parentID string) []agent.Agent

func (*Manager) GroupBy

func (m *Manager) GroupBy(mode GroupMode) []Group

GroupBy returns agents grouped by the specified mode

func (*Manager) LastActivityTime

func (m *Manager) LastActivityTime() time.Time

LastActivityTime returns the most recent activity time across all agents

func (*Manager) List

func (m *Manager) List() []agent.Agent

List returns all agents

func (*Manager) ListPrimary

func (m *Manager) ListPrimary() []agent.Agent

func (*Manager) OnEvent

func (m *Manager) OnEvent(fn func(agent.Event))

OnEvent sets the callback for agent events

func (*Manager) Refresh

func (m *Manager) Refresh(ctx context.Context) error

Refresh refreshes all agent data

func (*Manager) Search

func (m *Manager) Search(query string) []agent.Agent

Search searches agents by name

func (*Manager) SendInput

func (m *Manager) SendInput(id string, input string) error

SendInput sends input to an agent

func (*Manager) Spawn

func (m *Manager) Spawn(ctx context.Context, config agent.SpawnConfig) (agent.Agent, error)

Spawn spawns a new agent session

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start starts the session manager

func (*Manager) Stats

func (m *Manager) Stats() *Stats

Stats returns aggregate statistics

func (*Manager) Stop

func (m *Manager) Stop()

Stop stops the session manager

func (*Manager) Terminate

func (m *Manager) Terminate(id string) error

Terminate terminates an agent

type Stats

type Stats struct {
	Total          int
	ByStatus       map[agent.Status]int
	ByType         map[string]int
	ByProject      map[string]int
	TotalTokensIn  int64
	TotalTokensOut int64
	TotalCost      float64
	TotalToolCalls int
	TotalErrors    int
}

Stats holds aggregate statistics

Jump to

Keyboard shortcuts

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