Documentation
¶
Index ¶
- Constants
- Variables
- func AttachmentChunks(input turninput.Message) iter.Seq[libacp.SessionUpdate]
- type Config
- type Event
- type InteractiveFunc
- type Registry
- func (r *Registry) AttachIfRunning(ctx context.Context, sid libacp.SessionID, viewer Viewer) (*Turn, bool, error)
- func (r *Registry) Cancel(sid libacp.SessionID) bool
- func (r *Registry) Close() error
- func (r *Registry) Enqueue(sid libacp.SessionID, input turninput.Message, notice *libacp.SessionUpdate) (bool, error)
- func (r *Registry) Get(sid libacp.SessionID) (TurnStatus, bool)
- func (r *Registry) List() []TurnStatus
- func (r *Registry) ReapIdle(_ context.Context) error
- func (r *Registry) Start(sid libacp.SessionID, fn TurnFunc, viewer Viewer) (*Turn, bool, error)
- func (r *Registry) StartIfIdle(sid libacp.SessionID, fn TurnFunc, viewer Viewer) (*Turn, bool, error)
- func (r *Registry) StartInteractive(sid libacp.SessionID, fn InteractiveFunc, viewer Viewer) (*Turn, bool, error)
- func (r *Registry) Stop(sid libacp.SessionID) bool
- type Result
- type Turn
- type TurnFunc
- type TurnStatus
- type Viewer
Constants ¶
const ( DefaultTurnDeadline = 15 * time.Minute DefaultGraceWindow = 60 * time.Second DefaultJournalSize = 512 )
const ( StateRunning = "running" StateGrace = "grace" StateFinished = "finished" )
Variables ¶
var ErrClosed = errors.New("nativeturn: registry is closed")
Functions ¶
func AttachmentChunks ¶
AttachmentChunks gives live and replayed attachments the same position within their message, including when two attachments have identical bytes.
Types ¶
type Event ¶
type Event struct {
Seq uint64
Update libacp.SessionNotification
}
type InteractiveFunc ¶
type InteractiveFunc func(ctx context.Context, emit func(context.Context, libacp.SessionNotification), first *turninput.Message, pending turninput.Pending) Result
The first invocation uses the original prompt. A subsequent invocation starts a follow-up with first as its user message. Both consume input at model boundaries.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) AttachIfRunning ¶
func (*Registry) Enqueue ¶
func (r *Registry) Enqueue(sid libacp.SessionID, input turninput.Message, notice *libacp.SessionUpdate) (bool, error)
Enqueue returns false if the turn has already finished. The caller can then submit a regular prompt once its outstanding prompt response has arrived.
func (*Registry) List ¶
func (r *Registry) List() []TurnStatus
func (*Registry) StartIfIdle ¶
func (*Registry) StartInteractive ¶
func (r *Registry) StartInteractive(sid libacp.SessionID, fn InteractiveFunc, viewer Viewer) (*Turn, bool, error)
StartInteractive gives the active conversation exclusive ownership of queued user input.
type Result ¶
type Result struct {
StopReason libacp.StopReason
Err error
}