inputqueue

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	QueueCap     int
	MaxTextBytes int
}

Config controls queue admission.

type IDGenerator

type IDGenerator func() string

IDGenerator returns stable queue entry ids.

type Option

type Option func(*Service)

Option customizes a Service.

func WithClock

func WithClock(now func() time.Time) Option

WithClock injects a deterministic clock.

func WithIDGenerator

func WithIDGenerator(generator IDGenerator) Option

WithIDGenerator injects deterministic queue ids.

type Service

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

Service owns validation and admission policy for session busy input.

func New

func New(store Store, cfg Config, opts ...Option) (*Service, error)

New constructs a busy-input queue service.

func (*Service) AdvanceGeneration

func (s *Service) AdvanceGeneration(ctx context.Context, sessionID string) (int64, int, error)

AdvanceGeneration fences older entries and returns the new generation.

func (*Service) Cancel

func (s *Service) Cancel(ctx context.Context, sessionID string, entryID string) (store.SessionInputQueueEntry, error)

Cancel cancels one pending queue entry.

func (*Service) ClaimNext

func (s *Service) ClaimNext(
	ctx context.Context,
	sessionID string,
) (store.SessionInputQueueEntry, bool, error)

ClaimNext leases the next input eligible for dispatch.

func (*Service) ConsumeSteer

func (s *Service) ConsumeSteer(
	ctx context.Context,
	sessionID string,
) (store.SessionInputQueueEntry, bool, error)

ConsumeSteer atomically consumes the current staged steer entry, if any.

func (*Service) CurrentGeneration

func (s *Service) CurrentGeneration(ctx context.Context, sessionID string) (int64, error)

CurrentGeneration reads the current persisted generation for queue fencing.

func (*Service) Enqueue

func (s *Service) Enqueue(
	ctx context.Context,
	sessionID string,
	text string,
	generation int64,
) (store.SessionInputQueueEntry, int, error)

Enqueue appends operator input behind the active prompt turn.

func (*Service) MarkFailed

func (s *Service) MarkFailed(ctx context.Context, sessionID string, entryID string, summary string) error

MarkFailed records failed dispatch.

func (*Service) MarkSent

func (s *Service) MarkSent(ctx context.Context, sessionID string, entryID string) error

MarkSent records successful dispatch.

func (*Service) Release

func (s *Service) Release(ctx context.Context, sessionID string, entryID string) error

Release returns a leased entry to queued state after a dispatch race.

func (*Service) StageSteer

func (s *Service) StageSteer(
	ctx context.Context,
	sessionID string,
	text string,
	generation int64,
) (store.SessionInputQueueEntry, error)

StageSteer stages replacement steering guidance while a turn is active.

type Store

type Store interface {
	store.SessionInputQueueStore
}

Store is the persistence boundary for busy input.

Jump to

Keyboard shortcuts

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