usage

package
v0.68.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: AGPL-3.0 Imports: 11 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 usage persists provider-reported LLM usage outside the turn path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

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

Hook accepts observations without waiting for PostgreSQL. The queue bounds shutdown loss to 1024 accepted records. Under sustained database overload, excess observations are deliberately dropped rather than delaying a turn.

func New

func New(db *pgxpool.Pool) *Hook

func (*Hook) Close

func (h *Hook) Close() error

Close stops admission, then drains the bounded queue before returning. It is called after agent runtimes stop, while the database pool is still available.

func (*Hook) DroppedCount

func (h *Hook) DroppedCount() int64

func (*Hook) Name

func (*Hook) Name() string

func (*Hook) OnPostLLMCall

func (h *Hook) OnPostLLMCall(_ context.Context, hctx *hooks.PostLLMCallContext)

func (*Hook) PendingCallCount

func (h *Hook) PendingCallCount(sessionID string) int64

PendingCallCount reports accepted observations that have not finished their database write. It is session-scoped so callers can distinguish a complete zero-usage session from one whose accounting is still in flight.

func (*Hook) Priority

func (*Hook) Priority() int

func (*Hook) QueueDepth

func (h *Hook) QueueDepth() int

func (*Hook) SetDropObserver

func (h *Hook) SetDropObserver(fn func())

SetDropObserver installs a non-blocking callback for queue drops.

func (*Hook) Start

func (h *Hook) Start()

Start owns the one background writer for this process-lifetime core hook.

Jump to

Keyboard shortcuts

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