consolidation

package
v0.3.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSessionSpawner

func NewSessionSpawner(
	sessions SessionManager,
	resolver workspacepkg.RuntimeResolver,
	memoryEnabled bool,
	resolveRoute SessionRouteResolver,
) 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 func() 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.

type SessionRoute

type SessionRoute struct {
	Enabled         bool
	AgentName       string
	Provider        string
	Model           string
	ReasoningEffort string
	Fallbacks       []compozyconfig.RoleFallback
	BeforeFallback  func(context.Context, int, compozyconfig.RoleFallback) error
}

SessionRoute is the resolved dream-session route supplied by the daemon role resolver.

type SessionRouteResolver

type SessionRouteResolver func(ctx context.Context, workspaceID string) (SessionRoute, error)

SessionRouteResolver resolves the dream route for one effective workspace config.

Jump to

Keyboard shortcuts

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