swarm

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 3 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

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