Versions in this module Expand all Collapse all v0 v0.1.0 Jun 14, 2026 Changes in this version + var ErrConflict = errors.New("event store: optimistic concurrency conflict") + var ErrTierUnavailable = errors.New("sandbox tier unavailable") + var ErrUnsupported = errors.New("runtime: unsupported action type") + func Fork[S, R any](ctx context.Context, def loop.Definition[S, R], source []event.Envelope, ...) (outcome.Outcome[R], []event.Envelope, error) + func IsReplayDivergenceError(err error) bool + func Respond(ctx context.Context, store EventStore, id event.LoopID, ...) error + func Shadow[S, R any](ctx context.Context, def loop.Definition[S, R], source []event.Envelope, ...) ([]event.Envelope, error) + type ArtifactStore interface + Get func(ctx context.Context, key string) ([]byte, error) + Put func(ctx context.Context, loopID event.LoopID, seq uint64, data []byte) (string, error) + type ChildResult struct + ErrDetail string + LoopID event.LoopID + OutcomeKind string + RespJSON []byte + Spend budget.Spend + type ChildSpawner interface + ResumeChild func(ctx context.Context, opts RunnerOptions, childID event.LoopID, ...) ChildResult + SpawnChild func(ctx context.Context, opts RunnerOptions, parentID event.LoopID, depth int, ...) ChildResult + type Clock interface + Now func() time.Time + type CompactionPlan struct + DropRanges [][2]int + Offloads []OffloadSpec + Strategy string + Summaries []SummarySpec + type ContextManager interface + ApplyPlanJSON func(planJSON []byte, msgs []model.Message) []model.Message + Plan func(ledger *ctxmgr.Ledger, msgs []model.Message) (planJSON []byte, needed bool) + StrategyName func() string + type ErrForkBeyondLog struct + At uint64 + LastSeq uint64 + func (e *ErrForkBeyondLog) Error() string + type EventStore interface + Append func(ctx context.Context, id event.LoopID, expectedLastSeq uint64, ...) error + LatestSnapshot func(ctx context.Context, id event.LoopID) (event.Snapshot, bool, error) + List func(ctx context.Context, f ListFilter) ([]LoopMeta, error) + Load func(ctx context.Context, id event.LoopID, fromSeq uint64) iter.Seq2[event.Envelope, error] + SaveSnapshot func(ctx context.Context, snap event.Snapshot) error + type ForkSpec struct + At uint64 + Overrides Overrides + type ListFilter struct + Limit int + Offset int + ParentID string + Status string + type LoopMeta struct + CreatedAt time.Time + ID event.LoopID + LastSeq uint64 + Name string + ParentID string + Status string + type ModelProvider interface + Complete func(ctx context.Context, req model.Request) (model.Response, error) + Stream func(ctx context.Context, req model.Request) (StreamReader, error) + type NoopTelemetry struct + func (NoopTelemetry) OnEvent(event.Envelope) + func (NoopTelemetry) RecordSpend(event.LoopID, budget.Spend, string) + func (NoopTelemetry) SpanEnd(SpanID, SpanAttrs, time.Duration, error) + func (NoopTelemetry) SpanStart(SpanKind, event.LoopID, SpanAttrs) SpanID + type OffloadSpec struct + ArtifactKey string + MessageIndex int + type Overrides struct + Model string + Provider ModelProvider + SystemPatch string + Tools ToolExecutor + type PolicyMode int + const PolicyModeDenyAction + const PolicyModeTerminate + type RealClock struct + func (RealClock) Now() time.Time + type ReplayDivergenceError struct + Got [32]byte + Seq uint64 + Want [32]byte + func (e *ReplayDivergenceError) Error() string + type Runner struct + func NewRunner[S, R any](def loop.Definition[S, R], opts RunnerOptions) *Runner[S, R] + func (r *Runner[S, R]) Interrupt(id event.LoopID) + func (r *Runner[S, R]) Replay(ctx context.Context, id event.LoopID) (Trajectory[S], error) + func (r *Runner[S, R]) Resume(ctx context.Context, id event.LoopID) (outcome.Outcome[R], error) + func (r *Runner[S, R]) Start(ctx context.Context, input any) (outcome.Outcome[R], error) + func (r *Runner[S, R]) StartWithParent(ctx context.Context, request []byte, parentID event.LoopID, depth int) (outcome.Outcome[R], event.LoopID, error) + type RunnerOptions struct + ArtifactStore ArtifactStore + Budget budget.Budget + Clock Clock + Convergence *converge.Config + CtxMgr ContextManager + MaxIterations int + Policy *policy.Grant + PolicyMode PolicyMode + PricingTable model.Table + Provider ModelProvider + Seed int64 + SnapshotEvery int + Spawner ChildSpawner + Store EventStore + StreamObserver StreamObserver + Telemetry Telemetry + TokenEstimator TokenEstimator + Tools ToolExecutor + type Sandbox interface + Run func(ctx context.Context, spec SandboxSpec) (SandboxResult, error) + type SandboxResult struct + Output []byte + Stderr []byte + type SandboxSpec struct + Caps []policy.Capability + Fn func(ctx context.Context, input []byte) ([]byte, error) + Input []byte + MemoryLimitPages uint32 + Module []byte + type SpanAttrs struct + ActionType string + CostUSD float64 + InputTokens int64 + Iteration int + Model string + Outcome string + OutputTokens int64 + Tool string + type SpanID [16]byte + type SpanKind string + const SpanKindAction + const SpanKindIteration + const SpanKindRun + type StreamObserver func(loopID event.LoopID, chunk event.StreamChunk) + type StreamReader interface + Close func() error + Recv func() (event.StreamChunk, error) + type SummarySpec struct + Content string + InsertAfter int + type Telemetry interface + OnEvent func(ev event.Envelope) + RecordSpend func(loopID event.LoopID, spend budget.Spend, actionType string) + SpanEnd func(id SpanID, attrs SpanAttrs, elapsed time.Duration, err error) + SpanStart func(kind SpanKind, loopID event.LoopID, attrs SpanAttrs) SpanID + type Tier string + const TierContainer + const TierInProc + const TierWASM + type TokenEstimator func(req model.Request) int64 + type ToolDescriptor struct + Description string + Name string + RequiredCapabilities []string + Schema []byte + Semantics action.ReplaySemantics + Tier Tier + type ToolExecutor interface + Describe func() []ToolDescriptor + Execute func(ctx context.Context, call ToolRequest) (ToolResult, error) + type ToolMux struct + func NewToolMux(executors ...ToolExecutor) (*ToolMux, error) + func (m *ToolMux) Describe() []ToolDescriptor + func (m *ToolMux) Execute(ctx context.Context, call ToolRequest) (ToolResult, error) + func (m *ToolMux) RegisterSandbox(tier Tier, s Sandbox) + type ToolRequest struct + Args []byte + IdempotencyKey string + Tool string + type ToolResult struct + IsError bool + Result []byte + type Trajectory struct + Events []event.Envelope + FinalState S + Outcome outcome.Outcome[S]