reflect

package
v0.50.7 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const BuiltinJobName = "reflect-review"

BuiltinJobName is the scheduler builtin name reflect registers under. Exported so gateway wiring and operational tooling refer to one source.

Variables

This section is empty.

Functions

func NewBuiltinHandler added in v0.38.0

func NewBuiltinHandler(cfg Config) (scheduler.OnJobFunc, error)

NewBuiltinHandler returns a scheduler.OnJobFunc that runs one reflect review cycle per fire. Cycle-level failures (store errors, ctx cancellation) surface as errors so the scheduler marks the run errored. Per-agent failures are still logged inside the service and do not fail the run.

Types

type Config

type Config struct {
	StateStore pkgplugins.StateStore
	Memory     memory.Provider
	Store      Store
	SkillStore pkgplugins.SkillStore
	Notifier   pkgplugins.Notifier
	Workspace  string
	Log        *slog.Logger
	Providers  func(api, apiKey, baseURL string) (providers.StreamFunc, error)
	// Services provides per-agent session registries for review candidate listing.
	// When set, reflect uses Registry.ListForReview and Registry.MemoryScope
	// instead of calling memory.SessionManager directly.
	Services agent.ServiceManager
}

Config holds dependencies for the reflect service.

type Service

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

Service runs background conversation review.

func New

func New(cfg Config) *Service

New creates a new reflect service.

func (*Service) ReviewNow

func (s *Service) ReviewNow(ctx context.Context, agentID string) (int, error)

ReviewNow triggers an immediate review cycle for a single agent. Returns the number of sessions reviewed.

func (*Service) RunOnce

func (s *Service) RunOnce(ctx context.Context) error

RunOnce executes a single review cycle across all enabled agents. Returns the first cycle-level error (e.g. listing agents failed, ctx cancelled) so the scheduler can record the run as errored. Per-agent failures are logged inside runCycle and do not surface here.

type Store added in v0.38.0

type Store interface {
	ListEnabledAgents(ctx context.Context) ([]config.Agent, error)
	Snapshot(ctx context.Context, agentID string) (*config.Snapshot, error)
}

Store is the read-only subset of config.Store reflect needs to run a review cycle. Narrowed from config.Store so dispatcher tests can supply a fake without implementing the full config surface; satisfied by config.Store via structural typing.

Jump to

Keyboard shortcuts

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