Versions in this module Expand all Collapse all v0 v0.3.0 Oct 22, 2026 Changes in this version + var ErrJournalTampered = errors.New("controller: refusing a journal that failed hash-chain verification") + var ErrUnansweredToolCall = errors.New(...) + func ForkWithComputeInstance(parent, child eventlog.Store, atSeq int64, instance string) error + func LatestComputeInstance(recs []eventlog.Record, sameHarness func(recorded string) bool) (instance string, seq int64) + func VerifyForkPrefix(parent eventlog.Store, atSeq int64) error + func VerifyJournal(log eventlog.Store) error type Option + func WithComputeInstance(instance string, sameHarness func(recorded string) bool) Option + func WithDurableDedup(declared func(tool string) bool) Option + func WithModelDefault(model string) Option + func WithModelPolicy(policy api.ModelPolicy) Option v0.2.0 Oct 16, 2026 Changes in this version + var ErrApprovalBlocked = errors.New("controller: unresolved approval blocks a new execution") + var ErrApprovalReceiptReport = errors.New("controller: approval receipts are host owned") + var ErrApprovalUnavailable = errors.New("controller: approval requires STATELESS_REPLAY") + var ErrHarnessDescribeFailed = errors.New("controller: describe harness failed") + var ErrHarnessMismatch = errors.New("controller: harness does not match recorded invocation") + var ErrHarnessVersionMismatch = errors.New("controller: harness version does not match recorded invocation") + var ErrIncompleteInvocation = fmt.Errorf("%w: incomplete invocation", ErrInvalidExecutionLog) + var ErrInheritedToolIntent = fmt.Errorf("%w: inherited tool intent cannot be resumed", ErrInvalidExecutionLog) + var ErrInvalidApprovalCall = errors.New("controller: invalid approval call identity") + var ErrInvalidApprovalDecision = errors.New("controller: invalid approval decision") + var ErrInvalidExecutionLog = errors.New("controller: invalid execution log") + var ErrMissingIdempotencyKey = errors.New("controller: CONTROLLER_MEDIATED tool call requires an idempotency key") + var ErrMissingSessionUID = errors.New("controller: a session UID is required") + var ErrMissingToolExecutor = errors.New("controller: no tool executor configured") + var ErrReplayDiverged = errors.New("controller: replay diverged from the journal") + var ErrReplayInvokedModel = errors.New("controller: replay invoked the model (I1 violated)") + var ErrSinkClosed = errors.New("controller: invocation sink is closed") + var ErrUnmediatedToolCall = errors.New("controller: ToolCall requires a host-mediated tier") + func Approve(log eventlog.Store, decision api.ApprovalDecision) (eventlog.Record, error) + func CanPlace(harness api.Capabilities, runtime api.RuntimeCapabilities) bool + func Fork(parent, child eventlog.Store, atSeq int64) error + func ResumeInvocation(log eventlog.Store) (*api.ExecutionStart, error) + type ApprovalState struct + Call *api.ToolCall + Completed bool + Decision *eventlog.Record + ExecutionID string + Head int64 + Inherited bool + Invocation *api.ExecutionStart + Receipt *eventlog.Record + Request *eventlog.Record + func InspectApproval(log eventlog.Store, throughSeq int64) (*ApprovalState, error) + type Controller struct + func New(log eventlog.Store, model ModelFunc, opts ...Option) (*Controller, error) + func (c *Controller) Exec(ctx context.Context, har api.Harness, inputs []api.Message, ...) (err error) + func (c *Controller) Head() (int64, error) + func (c *Controller) ModelInvocations() int + func (c *Controller) Outputs() ([]string, error) + func (c *Controller) Replay(ctx context.Context, har api.Harness) (outputs []string, err error) + func (c *Controller) Resume(ctx context.Context, har api.Harness) (resumed bool, err error) + func (c *Controller) ToolInvocations() int + type ModelFunc func(ctx context.Context, req api.ModelRequest) (api.ModelResponse, error) + type Observer struct + OnDelta func(api.Delta) + OnRecord func(eventlog.Record) + type Option func(*Controller) + func WithFence(token int64) Option + func WithHarness(name string) Option + func WithLogger(logger *slog.Logger) Option + func WithObserver(o Observer) Option + func WithSessionUID(sessionUID string) Option + func WithStart(config []byte, resumeFromSeq int64) Option + func WithStreamingModel(fn StreamFunc) Option + func WithToolExecutor(tool ToolFunc) Option + type StreamFunc func(ctx context.Context, req api.ModelRequest, onChunk func(string)) (api.ModelResponse, error) + type ToolCallContext struct + SessionUID string + type ToolFunc func(ctx context.Context, scope ToolCallContext, call api.ToolCall) (api.ToolResult, error)