consolidation

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: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DreamingCuratorAgentName is the dedicated default agent for memory dreaming.
	DreamingCuratorAgentName = "dreaming-curator"
)

Variables

This section is empty.

Functions

func NewSessionSpawner

func NewSessionSpawner(
	sessions SessionManager,
	resolver workspacepkg.RuntimeResolver,
	cfg *aghconfig.Config,
) memory.SessionSpawner

NewSessionSpawner creates dream sessions against one or more eligible workspaces.

Types

type Runtime

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

Runtime owns dream scheduling, trigger behavior, and session spawning.

func NewRuntime

func NewRuntime(
	enabled bool,
	service Service,
	spawner memory.SessionSpawner,
	interval time.Duration,
	logger *slog.Logger,
	lastConsolidatedAt func() (time.Time, error),
) *Runtime

NewRuntime constructs a dream runtime that can be started by the daemon.

func (*Runtime) Enabled

func (r *Runtime) Enabled() bool

Enabled reports whether dream consolidation is available.

func (*Runtime) EnqueueCheck

func (r *Runtime) EnqueueCheck(reason string, workspaceRef string)

EnqueueCheck requests a background dream check without blocking.

func (*Runtime) LastConsolidatedAt

func (r *Runtime) LastConsolidatedAt() (time.Time, error)

LastConsolidatedAt returns the most recent lock timestamp.

func (*Runtime) Shutdown

func (r *Runtime) Shutdown()

Shutdown stops the background dream check loop.

func (*Runtime) Start

func (r *Runtime) Start(parent context.Context)

Start launches the background dream check loop when the runtime is configured.

func (*Runtime) Trigger

func (r *Runtime) Trigger(ctx context.Context, workspace string) (bool, string, error)

Trigger runs dream consolidation immediately when enabled and gates pass.

type Service

type Service interface {
	ShouldRun() (bool, error)
	Run(ctx context.Context, spawn memory.SessionSpawner, workspace string) error
}

Service evaluates dream gates and coordinates lock-aware consolidation runs.

type ServiceFactory

type ServiceFactory func(opts ...memory.Option) Service

ServiceFactory constructs a consolidation service using memory package options.

type SessionManager

type SessionManager interface {
	Create(ctx context.Context, opts session.CreateOpts) (*session.Session, error)
	ListAll(ctx context.Context) ([]*session.Info, error)
	Prompt(ctx context.Context, id string, msg string) (<-chan acp.AgentEvent, error)
	Stop(ctx context.Context, id string) error
}

SessionManager is the session lifecycle surface needed to spawn dream sessions.

Jump to

Keyboard shortcuts

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