Help us shape the future of Go! Take the 2026 Go Developer Survey

runtime

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package runtime assembles and owns a deployment, its event routing, and transport-neutral sessions.

Index

Constants

This section is empty.

Variables

View Source
var ErrBuilderUsed = errdefs.Conflictf("runtime Builder has already been used")

ErrBuilderUsed reports an attempted registration or Build after a Builder's single construction attempt has started.

Functions

This section is empty.

Types

type Builder

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

Builder transactionally assembles one Runtime over a resource registry. It is single-use.

func NewBuilder

func NewBuilder(reg *resource.Registry) *Builder

NewBuilder creates a Runtime builder over a resource registry. The registry must already hold every resource factory the document references (event bus, checkpoint store, tool assemblies, engines, hooks, ...).

func (*Builder) Build

func (b *Builder) Build(ctx context.Context, doc deploy.Document) (*Runtime, error)

Build constructs one fully started Runtime. A Builder may be used for exactly one Build attempt.

func (*Builder) WithHostFactory

func (b *Builder) WithHostFactory(decorator HostFactoryDecorator) error

WithHostFactory installs a decorator over the runtime's base host factory. It is rejected when nil or after Build starts.

func (*Builder) WithLoader

func (b *Builder) WithLoader(loader *resource.Loader) error

WithLoader installs the deployment-level loader used to materialize {"file":…} / {"embed":…} settings subtrees and agent engine/hook settings. It is rejected after Build starts.

type Config

type Config struct {
	// EventBus names the deployment resource providing event.Bus.
	EventBus string
	// CheckpointStore names the deployment resource providing
	// agent.CheckpointStore; empty keeps checkpoints as a host no-op.
	CheckpointStore string
	// Sessions configures the runtime-owned session manager.
	Sessions       SessionConfig
	DynamicCatalog *DynamicCatalogConfig
}

Config is the strictly decoded deploy.Document.Runtime subtree.

func DecodeConfig

func DecodeConfig(doc deploy.Document) (Config, error)

DecodeConfig strictly decodes and validates the runtime subtree.

type DynamicCatalogConfig

type DynamicCatalogConfig struct {
	Tools map[string]string
}

DynamicCatalogConfig maps agent IDs to tool.Assembly resource names; the reserved "default" key is the fallback for agents without an explicit entry. The injection policy itself lives in each tool.Assembly's dynamic settings — the runtime only wires the assembly and creates per-session views.

type HostFactoryDecorator

type HostFactoryDecorator func(session.HostFactory) (session.HostFactory, error)

HostFactoryDecorator wraps the runtime's built-in base host factory. The decorator receives the base factory (event publishing, interrupts, ask-user, checkpointing) and MUST delegate anything it does not override back to it — the canonical shape is agent.HostFuncs{Inner: base, ...}.

type Runtime

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

Runtime owns the complete application object graph built by Builder.

func (*Runtime) Close

func (r *Runtime) Close() error

Close stops new session work, waits for active turns, and releases all owned objects. Concurrent callers wait for and receive the same aggregate result.

func (*Runtime) Sessions

func (r *Runtime) Sessions() *session.Manager

Sessions returns the runtime-owned transport-neutral session manager.

type SessionConfig

type SessionConfig struct {
	IdleTimeout             time.Duration
	SinkBuffer              int
	SpeculativeBufferEvents int
	SpeculativeBufferBytes  int
	DeliveryConcurrency     int
	MaxSessions             int
	Resume                  bool
}

SessionConfig configures the runtime-owned session manager.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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