agentrunner

package
v0.0.0-...-9268282 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 20 Imported by: 0 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

Overview

Package agentrunner runs an optional agent process outside the relay daemon.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicate        = errors.New("agent runner: duplicate event")
	ErrUnauthorizedRoom = errors.New("agent runner: unauthorized room")
	ErrQueueFull        = errors.New("agent runner: room queue full")
	ErrStopped          = errors.New("agent runner: stopped")
)

Functions

func RunProcess

func RunProcess(ctx context.Context, opts ProcessOptions, prompt string) (string, error)

func Serve

func Serve(ctx context.Context, opts ServiceOptions) error

Types

type Handler

type Handler func(context.Context, []Mention) error

type Mention

type Mention struct {
	Room      string `json:"room"`
	EventID   string `json:"event_id"`
	Author    string `json:"author"`
	Prompt    string `json:"prompt"`
	Root      string `json:"root"`
	Kind      int    `json:"kind"`
	CreatedAt int64  `json:"created_at"`
}

type Options

type Options struct {
	AllowedRooms []string
	QueueLimit   int
	StatePath    string
	Handle       Handler
	OnError      func(error)
}

type Permission

type Permission struct {
	Title   string
	Details string
	Options []PermissionOption
}

type PermissionOption

type PermissionOption struct {
	ID   string `json:"optionId"`
	Name string `json:"name"`
	Kind string `json:"kind"`
}

type ProcessOptions

type ProcessOptions struct {
	Command    string
	Args       []string
	Env        []string
	CWD        string
	Protocol   string
	Progress   func(string)
	Permission func(context.Context, Permission) (string, error)
}

type RelayClient

type RelayClient struct {
	URL, Secret, PubKey string
	Rooms               []string
	OnEvent             func(event.Event)
	OnReady             func()
	OnError             func(error)
	// contains filtered or unexported fields
}

func (*RelayClient) Mention

func (c *RelayClient) Mention(e event.Event) (Mention, bool)

func (*RelayClient) Publish

func (c *RelayClient) Publish(ctx context.Context, e event.Event) (event.Event, error)

func (*RelayClient) ResolveRoot

func (c *RelayClient) ResolveRoot(ctx context.Context, room, id string) (string, error)

func (*RelayClient) Run

func (c *RelayClient) Run(ctx context.Context) error

type Runner

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

func New

func New(opts Options) (*Runner, error)

func (*Runner) Cancel

func (r *Runner) Cancel(room string) error

func (*Runner) CancelFrom

func (r *Runner) CancelFrom(room, author string) bool

func (*Runner) Drain

func (r *Runner) Drain(ctx context.Context) error

Drain waits until queued work has finished, or the caller cancels.

func (*Runner) Enqueue

func (r *Runner) Enqueue(m Mention) error

func (*Runner) Start

func (r *Runner) Start(ctx context.Context)

func (*Runner) Stop

func (r *Runner) Stop()

type ServiceOptions

type ServiceOptions struct {
	RelayURL, Secret, StatePath string
	Rooms                       []string
	Process                     ProcessOptions
	Timeout                     time.Duration
	Log                         func(error)
}

Jump to

Keyboard shortcuts

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