Documentation
¶
Overview ¶
Package runtime assembles and owns a deployment, its event routing, and transport-neutral sessions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
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.
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.
type DynamicCatalogConfig ¶
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) Attach ¶ added in v0.1.5
func (r *Runtime) Attach( ctx context.Context, pattern event.Pattern, sink event.Sink, opts ...event.AttachOption, ) (func(), error)
Attach subscribes pattern on the runtime's borrowed event router and delivers matching envelopes to sink until the returned stop function is called, ctx is cancelled, the subscription ends, or the sink returns an error (which detaches that attachment). It is the runtime-level entry point for consumers that want run events without resolving the deployment document's event_bus resource themselves — for example UI sinks subscribing to prompt lifecycle events:
detach, err := app.Attach(ctx, session.PatternPromptRequested(), sink) defer detach()
The router is owned by the Runtime: Attach fails with NotAvailable after Close, and every attachment is torn down when the Runtime closes. External attachments inherit the bus default backpressure (DropNewest), so a slow consumer drops envelopes instead of blocking the run pipeline; pass event.WithAttachBackpressure to opt into a different policy for a specific subscription.