approvalqueue

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigFor

func ConfigFor(ctx context.Context, name string) (*llm.ApprovalConfig, bool)

ConfigFor returns the approval config for a tool.

func IsTimedOut added in v0.1.9

func IsTimedOut(row *queueread.QueueRowView, now time.Time) bool

IsTimedOut reports whether a queue row is still pending and its expires_at deadline has elapsed at the given instant. Rows without expires_at are never treated as timed out by the canonical producer.

func MarkSource added in v0.1.9

func MarkSource(ctx context.Context, source string)

MarkSource records the canonical origin label for a host-mediated approval execution path. The value is stored on the shared approval state so the enqueue writer can persist it without trusting downstream callers.

func MarkTool

func MarkTool(ctx context.Context, name string, cfg *llm.ApprovalConfig)

MarkTool attaches approval configuration to a tool name.

func NewTimedOutOutcome added in v0.1.9

func NewTimedOutOutcome(row *queueread.QueueRowView, now time.Time) *api.DecideToolApprovalOutcome

NewTimedOutOutcome builds the canonical timeout outcome for a queue row.

func NewTimedOutPatch added in v0.1.9

func NewTimedOutPatch(row *queueread.QueueRowView, now time.Time) *queuew.ToolApprovalQueue

NewTimedOutPatch builds the canonical queue-row patch for a timeout transition.

func RequiresPrompt

func RequiresPrompt(ctx context.Context, name string) bool

RequiresPrompt reports whether a tool requires prompt-mode approval.

func RequiresQueue

func RequiresQueue(ctx context.Context, name string) bool

RequiresQueue reports whether a tool should be queued for approval.

func SourceFromContext added in v0.1.9

func SourceFromContext(ctx context.Context) string

SourceFromContext returns the canonical source label attached to the current approval state when present.

func WithState

func WithState(ctx context.Context) context.Context

WithState ensures a mutable approval-queue state exists in context.

Types

type State

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

func StateFromContext

func StateFromContext(ctx context.Context) *State

StateFromContext returns the approval-queue state when present.

type SweepInput added in v0.1.9

type SweepInput struct {
	UserID         string
	ConversationID string
}

SweepInput scopes a timeout sweep. All fields are optional.

type SweepOutput added in v0.1.9

type SweepOutput struct {
	Outcomes []*api.DecideToolApprovalOutcome
}

SweepOutput reports canonical timed_out outcomes produced by a sweep.

type Sweeper added in v0.1.9

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

Sweeper transitions due pending approvals into the canonical timed_out state.

func NewSweeper added in v0.1.9

func NewSweeper(lister TimeoutLister, patcher TimeoutPatcher, now TimeoutNow) (*Sweeper, error)

NewSweeper constructs a Sweeper.

func (*Sweeper) Sweep added in v0.1.9

func (s *Sweeper) Sweep(ctx context.Context, in *SweepInput) (*SweepOutput, error)

Sweep transitions all due pending approvals in scope and returns one canonical outcome per transitioned row.

type TimeoutLister added in v0.1.9

type TimeoutLister interface {
	ListToolApprovalQueues(ctx context.Context, in *queueread.QueueRowsInput) ([]*queueread.QueueRowView, error)
}

TimeoutLister enumerates approval-queue rows. It mirrors the canonical queue-read surface so timeout production stays attached to approvalqueue semantics instead of depending on higher-level SDK wiring.

type TimeoutNow added in v0.1.9

type TimeoutNow func() time.Time

TimeoutNow is a clock factory used by Sweeper.

type TimeoutPatcher added in v0.1.9

type TimeoutPatcher interface {
	PatchToolApprovalQueue(ctx context.Context, queue *queuew.ToolApprovalQueue) error
}

TimeoutPatcher applies queue-row patches.

Jump to

Keyboard shortcuts

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