heartbeat

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager owns a Store and runs a background loop that fires due heartbeats. Create one with New, register an OnFire callback, then call Run in a goroutine.

func New

func New(store schema.Store, opts ...Opt) (*Manager, error)

New creates a Manager backed by the given store.

func (*Manager) ListPrompts

func (m *Manager) ListPrompts(_ context.Context) ([]llm.Prompt, error)

ListPrompts returns nil and satisfies the llm.Connector interface.

func (*Manager) ListResources

func (m *Manager) ListResources(_ context.Context) ([]llm.Resource, error)

ListResources returns nil and satisfies the llm.Connector interface.

func (*Manager) ListTools

func (m *Manager) ListTools(_ context.Context) ([]llm.Tool, error)

ListTools returns the heartbeat tools and satisfies the llm.Connector interface.

func (*Manager) Run

func (m *Manager) Run(ctx context.Context) error

Run starts the maturity-check loop and blocks until ctx is cancelled. It returns nil when ctx is done and satisfies the llm.Connector interface.

type Opt

type Opt func(*Manager) error

Opt is a functional option for configuring a Manager.

func WithLogger

func WithLogger(l *slog.Logger) Opt

WithLogger sets the logger used for error reporting inside the run loop.

func WithOnFire

func WithOnFire(fn func(context.Context, *schema.Heartbeat)) Opt

WithOnFire registers a callback invoked for each heartbeat as it matures. Only one callback can be active; later calls overwrite earlier ones.

func WithPollInterval

func WithPollInterval(d time.Duration) Opt

WithPollInterval sets how often the Manager polls for due heartbeats. The default is 10 s.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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