session

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package session is parley's reference client engine. A Session is one end of one channel; it drives the handshake, seals and opens messages, and runs the non-blocking model the spec describes — Send posts and returns, Poll collects what has arrived — over any parley.Relay. It implements parley.Session.

A Session expects one call in flight at a time (the natural shape for an MCP host, which dispatches tools sequentially). Send and Poll from separate goroutines on the same Session are not supported; two different Sessions are fully independent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

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

A Session is one agent's end of one channel. Whether this node opened or joined is captured entirely by which constructor ran (responder vs initiator, recorded in hs) and whether a topic was set — there is no separate role flag.

func New

func New(self noise.Keypair, relay parley.Relay, host string) *Session

New returns a session that speaks through relay and mints invites pointing at host, the relay's public name (e.g. "parley.chat").

func (*Session) Close

func (s *Session) Close(ctx context.Context, outcome string) error

func (*Session) Join

func (s *Session) Join(ctx context.Context, in parley.Invite) error

func (*Session) Open

func (s *Session) Open(ctx context.Context, topic string) (parley.Invite, error)

func (*Session) Peer

func (s *Session) Peer() parley.Peer

func (*Session) Poll added in v0.1.1

func (s *Session) Poll(ctx context.Context, wait time.Duration) ([]parley.Message, error)

func (*Session) Send added in v0.1.1

func (s *Session) Send(ctx context.Context, text string) error

Jump to

Keyboard shortcuts

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