control

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package control is deploy's control-plane composition root beneath main.

The package owns the wiring between the operator controller, the durable store, and the Warden fleet view: the lifecycle hooks that turn controller events into durable receipts, the persistence-fault gate that refuses operator work while PostgreSQL is unreachable, and the projection of controller and fleet state into the WebUI snapshot contract.

Core produces every snapshot the browser renders, so the operator-visible identity is a Runtime setting rather than something the presentation layer discovers: WithBrand supplies the product and agent names this package stamps into each snapshot.

Callers may rely on Runtime satisfying the operator transport's backend contract, including webui.ISnapshotProvider, and on every operator-visible mutation being proven durable before it is acknowledged. Runtime owns no HTTP surface, no agent harness, and no schema; those belong to httpapi, operator, and store respectively.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(settings *runtimeOptions) error

Option changes one public Runtime policy.

func WithBrand

func WithBrand(brand webui.Brand) Option

WithBrand replaces the stock deploy identity in the snapshots this runtime produces. Unset Brand fields keep their stock values.

type Runtime

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

Runtime is the user-facing control-plane composition root below main.

func NewRuntime

func NewRuntime(
	controlStore *store.Store,
	fleetClient *fleet.Client,
	controller *operator.Controller,
	labels map[string]map[string]string,
	persistence *deployv1.PersistenceTiming,
	version string,
	functionalOptions ...Option,
) (*Runtime, error)

NewRuntime installs durable lifecycle hooks on the controller.

func (*Runtime) Abort

func (r *Runtime) Abort(ctx context.Context) error

Abort stops the current agent turn without discarding its persisted session.

func (*Runtime) AbortRun

func (r *Runtime) AbortRun(ctx context.Context, sessionID, runID string) error

AbortRun stops only the execution identified by the browser snapshot.

func (*Runtime) Health

func (r *Runtime) Health(ctx context.Context) error

Health checks the durable dependency and any sticky write fault that must be repaired before accepting more work.

func (*Runtime) RecordFleetContext

func (r *Runtime) RecordFleetContext(parent context.Context, snapshot fleet.Snapshot)

RecordFleetContext persists one coalesced Warden observation within the owning fleet worker's lifecycle so shutdown cannot leave a database callback running after the store closes.

func (*Runtime) ResolveApproval

func (r *Runtime) ResolveApproval(id, decision string) error

ResolveApproval records one first-answer-wins operator decision. Approving a mutation fails closed without Warden quorum; rejection is always possible.

func (*Runtime) Send

func (r *Runtime) Send(ctx context.Context, prompt string) (string, error)

Send starts or queues one operator request after proving the database is up.

func (*Runtime) SendToClaw

func (r *Runtime) SendToClaw(
	ctx context.Context,
	sessionID, expectedRunID, prompt string,
	delivery deployv1.HarnessDelivery,
) (string, error)

SendToClaw fences a browser message to the rendered harness session and run. An active run is steered in place; an idle completed run becomes a new turn in the same harness session.

func (*Runtime) Snapshot

func (r *Runtime) Snapshot(ctx context.Context) (*deployv1.WebUISnapshot, error)

Snapshot implements webui.ISnapshotProvider.

func (*Runtime) Subscribe

func (r *Runtime) Subscribe() (<-chan struct{}, func())

Subscribe reports transient run/approval changes. The HTTP event stream also polls snapshots so fleet changes cannot be missed.

Jump to

Keyboard shortcuts

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