runctx

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package runctx provides runtime context types and rendering for agent instruction files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(rc *RuntimeContext) string

Render produces a markdown document describing the runtime context. Sections for optional fields (Grants, Services, etc.) are only included when their corresponding slice is non-empty or pointer is non-nil.

Types

type AllowedHost added in v0.4.0

type AllowedHost struct {
	Host  string
	Rules []string // human-readable rule summaries, e.g. "allow GET /repos/*"
}

AllowedHost describes a host that the run is allowed to access, optionally with per-path rules that restrict specific methods/paths.

type BuildOptions added in v0.7.0

type BuildOptions struct {
	// WorkspaceMode is the resolved workspace mode ("bind"/"volume"). Empty is
	// treated as bind. Sourced from the resolved run options, not cfg, because a
	// --workspace-mode CLI flag can override the moat.yaml value.
	WorkspaceMode config.WorkspaceMode
	// DockerMode is the resolved Docker mode ("host"/"dind"). Empty means Docker
	// is not enabled for this run.
	DockerMode deps.DockerMode
}

BuildOptions carries resolved run facts that are not derivable from the moat.yaml Config alone — they come from CLI overrides or runtime resolution at container-creation time.

type Docker added in v0.7.0

type Docker struct {
	Mode string // "dind" (Docker-in-Docker) or "host" (mounted host socket)
}

Docker describes Docker access available inside the container.

type Grant

type Grant struct {
	Name        string
	Description string
}

Grant describes a credential grant available inside the container.

type MCPServer

type MCPServer struct {
	Name        string
	Description string
}

MCPServer describes an MCP server available to the agent.

type NetworkPolicy

type NetworkPolicy struct {
	Policy       string
	AllowedHosts []AllowedHost
}

NetworkPolicy describes the network access policy for the run.

type Port

type Port struct {
	Name          string
	ContainerPort int
	EnvHostPort   string
}

Port describes a port mapping from the container to the host.

type RuntimeContext

type RuntimeContext struct {
	RunID           string
	Agent           string
	Workspace       string
	WorkspaceMode   string // "bind" or "volume"; empty is treated as bind
	Grants          []Grant
	Services        []Service
	Tools           []string // installed non-service, non-docker dependencies
	Docker          *Docker  // non-nil when Docker access is available
	Ports           []Port
	NetworkPolicy   *NetworkPolicy
	MCPServers      []MCPServer
	HasDependencies bool // true when the config declares any dependencies
}

RuntimeContext holds the information about a moat run that is rendered into agent instruction files (CLAUDE.md, AGENTS.md, etc.).

func BuildFromConfig

func BuildFromConfig(cfg *config.Config, runID string, opts BuildOptions) *RuntimeContext

BuildFromConfig constructs a RuntimeContext from a moat config, run ID, and resolved run options.

type Service

type Service struct {
	Name    string
	Version string
	EnvURL  string
}

Service describes an infrastructure service available to the run.

Jump to

Keyboard shortcuts

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