Documentation
¶
Index ¶
- Variables
- type LoopConfig
- type LoopStats
- type Runner
- func (r *Runner) RunLoop(ctx context.Context, cfg LoopConfig) (LoopStats, error)
- func (r *Runner) RunOnce(ctx context.Context) (protocol.ChatMessage, error)
- func (r *Runner) SetCanceller(c *turncancel.Canceller)
- func (r *Runner) SetSteering(inbox *steering.Inbox)
- func (r *Runner) SetSteeringRejector(rejector channel.SteeringRejector)
- type TaskSource
- type TurnExecutor
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingTaskSource = errors.New("runtime: task source required") ErrMissingTurnExecutor = errors.New("runtime: turn executor required") )
Functions ¶
This section is empty.
Types ¶
type LoopConfig ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func NewRunner ¶
func NewRunner(source TaskSource, executor TurnExecutor) (*Runner, error)
func (*Runner) SetCanceller ¶
func (r *Runner) SetCanceller(c *turncancel.Canceller)
SetCanceller wires a turn canceller so an out-of-band cancel control can abort the in-flight turn (keyed by task id).
func (*Runner) SetSteering ¶ added in v0.0.2
SetSteering wires the inbox that delivers a user's mid-turn message into the turn already running on its thread. Without one, such a message simply waits its turn as before.
The rejector is taken from the task source when it implements channel.SteeringRejector, so a transport that can talk back to the sender tells it when an interjection missed its turn. SetSteeringRejector overrides.
func (*Runner) SetSteeringRejector ¶ added in v0.0.2
func (r *Runner) SetSteeringRejector(rejector channel.SteeringRejector)
SetSteeringRejector overrides how a missed steering message is reported.
type TaskSource ¶
TaskSource is the ingress half of the transport seam (channel.Receiver).
type TurnExecutor ¶
type TurnExecutor interface {
Run(ctx context.Context, addr protocol.MessageAddress, user protocol.ChatMessage) (protocol.ChatMessage, error)
}