runtime

package
v0.1.0-beta.10 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package runtime aggregates the agent runtime's process-wide state into a single handle the gateway hangs off via SetAgentRuntime. Centralising the run store, approval registry, sandbox, dev server, and active LLM provider lets downstream consumers (HTTP API, CLI, dispatcher) pull every collaborator from one place rather than threading four setters through the API server.

The package lives below pkg/agent (rather than alongside it) because pkg/agent already imports pkg/mcp; placing Runtime here lets us import pkg/agent/sandbox + compose + persist + dev/devserver without taking pkg/mcp into the closure of those packages. The gateway holds *Runtime as an opaque mcp.AgentRuntime — consumers type-assert to read the components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runtime

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

Runtime is the agent runtime aggregate. Construct with NewRuntime; late-binding components (ChatModel, DevServer) plug in via setters once their upstream factories have run. All accessors are safe for concurrent use.

func NewRuntime

func NewRuntime(store *persist.Store, reg *compose.Registry, sb *sandbox.Sandbox) *Runtime

NewRuntime constructs a Runtime with the load-bearing components the dispatcher and HTTP handlers need at process start. The ChatModel and DevServer plug in later once the API server has resolved them.

func (*Runtime) AgentRuntimeMarker

func (*Runtime) AgentRuntimeMarker()

AgentRuntimeMarker satisfies the mcp.AgentRuntime interface so the Gateway can hold *Runtime opaquely without the agent → mcp → agent import cycle. The method is intentionally empty — the marker exists purely to keep the Gateway's accessor type-safe.

func (*Runtime) ApprovalRegistry

func (r *Runtime) ApprovalRegistry() *compose.Registry

ApprovalRegistry returns the in-process approval-gate registry.

func (*Runtime) ChatModel

func (r *Runtime) ChatModel() agent.ChatModel

ChatModel returns the active LLM provider, or nil if none is wired. Callers should treat nil as "llm() unavailable" and surface a clear error rather than panicking.

func (*Runtime) DevServer

func (r *Runtime) DevServer() *devserver.Server

DevServer returns the agent IDE dev server, or nil when not wired.

func (*Runtime) RunStore

func (r *Runtime) RunStore() *persist.Store

RunStore returns the JSONL run-event ledger. Nil only when NewRuntime was called without one (defensive — callers should always pass a real store).

func (*Runtime) Sandbox

func (r *Runtime) Sandbox() *sandbox.Sandbox

Sandbox returns the goja sandbox used to execute TypeScript skills.

func (*Runtime) SetChatModel

func (r *Runtime) SetChatModel(m agent.ChatModel)

SetChatModel installs (or replaces) the LLM provider exposed to skills via the sandbox's llm() binding. Plumbed late because the provider is built by the API-server stage of gateway construction, after the runtime aggregate already exists.

func (*Runtime) SetDevServer

func (r *Runtime) SetDevServer(d *devserver.Server)

SetDevServer installs the agent IDE dev server. nil disables the /api/agent/dev/* routes, which then return 503.

Jump to

Keyboard shortcuts

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