swarm

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConversationAgent

type ConversationAgent interface {
	SpaceGranter
	SetSharedSpaces(shared SharedSession)
	Save(ctx context.Context, role, content string) // note: no error to match *agent.Agent
	Generate(ctx context.Context, sessionID, prompt string) (string, error)
}

ConversationAgent is the minimal surface main.go relies on for chat + space wiring.

type Participant

type Participant struct {
	Alias     string
	SessionID string
	Agent     ConversationAgent
	Shared    SharedSession
}

Participant binds an agent-like runner with its own session identity and shared-session handle.

func (*Participant) Join

func (participant *Participant) Join(space string) bool

func (*Participant) Leave

func (participant *Participant) Leave(space string)

func (*Participant) Retrieve

func (participant *Participant) Retrieve(ctx context.Context) ([]memory.MemoryRecord, error)

func (*Participant) Save

func (participant *Participant) Save(ctx context.Context)

type Participants

type Participants map[string]*Participant

type SharedSession

type SharedSession interface {
	Retrieve(ctx context.Context, query string, k int) ([]memory.MemoryRecord, error)
	Leave(space string)
	Join(space string) error
	FlushLocal(ctx context.Context) error
	Spaces() []string
	FlushSpace(ctx context.Context, space string) error
}

SharedSession is a lightweight façade over memory.SharedSession used by swarm participants.

type SpaceGranter

type SpaceGranter interface {
	EnsureSpaceGrants(sessionID string, spaces []string)
}

SpaceGranter is the minimal capability a Participant needs from an Agent.

type Swarm

type Swarm struct {
	*Participants
}

func NewSwarm

func NewSwarm(participants *Participants) *Swarm

func (*Swarm) GetParticipant

func (swarm *Swarm) GetParticipant(id string) *Participant

func (*Swarm) Join

func (swarm *Swarm) Join(id, space string) bool

func (*Swarm) Leave

func (swarm *Swarm) Leave(id, space string)

func (*Swarm) Retrieve

func (swarm *Swarm) Retrieve(ctx context.Context, id string) ([]memory.MemoryRecord, error)

func (*Swarm) Save

func (swarm *Swarm) Save(ctx context.Context) error

Jump to

Keyboard shortcuts

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