inbox

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInboxClosed = errors.New("inbox closed")
	ErrInboxFull   = errors.New("inbox full")
)

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Type    string // "file", "skill", "raw"
	Ref     string // e.g. "@/tmp/targets.txt", "@scan"
	Content string
	Error   string
}

type Buffered

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

func NewBuffered

func NewBuffered(capacity int) *Buffered

func (*Buffered) ActiveProducers

func (b *Buffered) ActiveProducers() int

func (*Buffered) Close

func (b *Buffered) Close()

func (*Buffered) Closed

func (b *Buffered) Closed() bool

func (*Buffered) Drain

func (b *Buffered) Drain() []Message

func (*Buffered) Len

func (b *Buffered) Len() int

func (*Buffered) Push

func (b *Buffered) Push(msg Message) error

func (*Buffered) RegisterProducer

func (b *Buffered) RegisterProducer(name string) *ProducerHandle

func (*Buffered) Wait

func (b *Buffered) Wait(ctx context.Context) bool

type Expander

type Expander struct {
	ReadFile    func(path string) (string, error)
	LookupSkill func(name string) (string, bool)
	MaxFileSize int
}

func (*Expander) Expand

func (e *Expander) Expand(msg Message) Message

type Inbox

type Inbox interface {
	Push(msg Message) error
	Drain() []Message
	Close()
	Closed() bool
	Len() int
	Wait(ctx context.Context) bool
	RegisterProducer(name string) *ProducerHandle
	ActiveProducers() int
}

type Message

type Message struct {
	ChatMessage provider.ChatMessage
	Origin      Origin
	Priority    Priority
	Attachments []Attachment
	Meta        map[string]any
	CreatedAt   time.Time
}

func FromChatMessage

func FromChatMessage(msg provider.ChatMessage, origin Origin) Message

func NewMessage

func NewMessage(origin Origin, role, content string) Message

func NewSystemMessage

func NewSystemMessage(content string) Message

func NewUserMessage

func NewUserMessage(content string) Message

func (Message) ToChatMessages

func (m Message) ToChatMessages() []provider.ChatMessage

ToChatMessages converts an inbox Message to LLM-compatible ChatMessages. User-origin messages with no attachments pass through unchanged. All other origins get a metadata envelope so the LLM knows the source.

func (Message) WithPriority

func (m Message) WithPriority(p Priority) Message

type Origin

type Origin string
const (
	OriginUser    Origin = "user"
	OriginPeer    Origin = "peer"
	OriginSession Origin = "session"
	OriginSystem  Origin = "system"
)

type Priority

type Priority int
const (
	PriorityLow    Priority = -10
	PriorityNormal Priority = 0
	PriorityHigh   Priority = 10
)

type ProducerHandle

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

func (*ProducerHandle) Done

func (h *ProducerHandle) Done()

Jump to

Keyboard shortcuts

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