Documentation
¶
Overview ¶
Package runnernode runs leased execution sandboxes on an independently enrolled Linux host. Agent reasoning and all controller credentials stay on the server.
Index ¶
- func ServeSandbox(ctx context.Context, in io.Reader, out io.Writer) error
- func ServeSandboxWithHeartbeat(ctx context.Context, in io.Reader, out io.Writer, timeout time.Duration) error
- type Config
- type DockerExecutor
- func (d *DockerExecutor) CleanupOrphans(ctx context.Context) error
- func (d *DockerExecutor) DockerArgs(id string, spec runner.RunSpec, plan runnerfiles.Plan, roots map[string]string, ...) ([]string, error)
- func (d *DockerExecutor) Start(ctx context.Context, id string, spec runner.RunSpec, plan runnerfiles.Plan, ...) (Sandbox, error)
- type Executor
- type KubernetesConfig
- type KubernetesExecutor
- func (k *KubernetesExecutor) ClaimWarm(ctx context.Context, id string, spec runner.RunSpec, plan runnerfiles.Plan) (*warmPod, error)
- func (k *KubernetesExecutor) CleanupOrphans(ctx context.Context) error
- func (k *KubernetesExecutor) Pod(id string, spec runner.RunSpec, plan runnerfiles.Plan, roots map[string]string) (map[string]any, error)
- func (k *KubernetesExecutor) PoolStatus() runner.PoolStatus
- func (k *KubernetesExecutor) PrepareExecution(ctx context.Context, id string, spec runner.RunSpec, plan runnerfiles.Plan, ...) Sandbox
- func (k *KubernetesExecutor) RunPool(ctx context.Context)
- func (k *KubernetesExecutor) Start(ctx context.Context, id string, spec runner.RunSpec, plan runnerfiles.Plan, ...) (Sandbox, error)
- func (k *KubernetesExecutor) UpdatePool(policy runner.PoolPolicy)
- type LocalSession
- type MCPOverride
- type Node
- type ProcessExecutor
- type Sandbox
- type SandboxReply
- type SandboxRequest
- type SharedMount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServeSandbox ¶
ServeSandbox runs a single session until EOF or close. stdout must be reserved for JSON lines; all diagnostics belong on stderr.
Types ¶
type Config ¶
type Config struct {
ServerURL string `json:"server_url"`
Name string `json:"name"`
DataDir string `json:"data_dir"`
WorkspaceDir string `json:"workspace_dir,omitempty"`
Capabilities runner.Capabilities `json:"capabilities"`
AllowedImages []string `json:"allowed_images,omitempty"`
ImageOverride string `json:"image_override,omitempty"`
MCPOverrides map[string]MCPOverride `json:"mcp_overrides,omitempty"`
Env map[string]string `json:"env,omitempty"`
DockerBinary string `json:"docker_binary,omitempty"`
Executor string `json:"executor,omitempty"`
DockerHostDataDir string `json:"docker_host_data_dir,omitempty"`
DockerNetwork string `json:"docker_network,omitempty"`
Kubernetes KubernetesConfig `json:"kubernetes,omitempty"`
// UnsafeProcess executes on the host without OS isolation. Development only.
UnsafeProcess bool `json:"unsafe_process,omitempty"`
AllowInsecureHTTP bool `json:"allow_insecure_http,omitempty"`
SandboxBinary string `json:"sandbox_binary,omitempty"`
}
func LoadConfig ¶
type DockerExecutor ¶
type DockerExecutor struct {
Binary string
SandboxBinary string
NodeID string
DataDir string
HostDataDir string
Network string
Log io.Writer
}
func (*DockerExecutor) CleanupOrphans ¶
func (d *DockerExecutor) CleanupOrphans(ctx context.Context) error
CleanupOrphans is called before polling with a new boot ID. A process restart cannot inherit old leases, even if Docker kept its containers running.
func (*DockerExecutor) DockerArgs ¶
func (d *DockerExecutor) DockerArgs(id string, spec runner.RunSpec, plan runnerfiles.Plan, roots map[string]string, gpus []string) ([]string, error)
DockerArgs keeps all host-side authority in the daemon. The session receives no socket, credentials, host PID namespace, privileged mode or host network.
type KubernetesConfig ¶
type KubernetesConfig struct {
Binary string `json:"binary,omitempty"`
Namespace string `json:"namespace"`
WorkspacePVC string `json:"workspace_pvc"`
WorkspaceSubPath string `json:"workspace_sub_path,omitempty"`
ServiceAccount string `json:"service_account,omitempty"`
ImagePullSecrets []string `json:"image_pull_secrets,omitempty"`
NodeSelector map[string]string `json:"node_selector,omitempty"`
}
type KubernetesExecutor ¶
type KubernetesExecutor struct {
Config KubernetesConfig
WorkspaceDir, NodeID, SandboxBinary string
MaxPods int
Log io.Writer
// contains filtered or unexported fields
}
The manager alone has API credentials. Every execution receives only its PVC subdirectories and scratch volumes, with no service account token or hostPath.
func (*KubernetesExecutor) ClaimWarm ¶ added in v0.7.0
func (k *KubernetesExecutor) ClaimWarm(ctx context.Context, id string, spec runner.RunSpec, plan runnerfiles.Plan) (*warmPod, error)
Claim removes a clean Pod from the idle set exactly once. Task files are supplied only after ownership is assigned. A used Pod never returns to idle.
func (*KubernetesExecutor) CleanupOrphans ¶
func (k *KubernetesExecutor) CleanupOrphans(ctx context.Context) error
func (*KubernetesExecutor) PoolStatus ¶ added in v0.7.0
func (k *KubernetesExecutor) PoolStatus() runner.PoolStatus
func (*KubernetesExecutor) PrepareExecution ¶ added in v0.7.0
func (*KubernetesExecutor) RunPool ¶ added in v0.7.0
func (k *KubernetesExecutor) RunPool(ctx context.Context)
func (*KubernetesExecutor) UpdatePool ¶ added in v0.7.0
func (k *KubernetesExecutor) UpdatePool(policy runner.PoolPolicy)
type LocalSession ¶
type LocalSession struct {
// contains filtered or unexported fields
}
LocalSession is only constructed inside the sandbox subprocess. Using it in the host daemon would execute untrusted tools on the host and is prohibited.
func OpenLocalSession ¶
func (*LocalSession) Call ¶
func (s *LocalSession) Call(ctx context.Context, c runner.ToolCall) SandboxReply
func (*LocalSession) Close ¶
func (s *LocalSession) Close() error
type MCPOverride ¶
type MCPOverride struct {
Command *string `json:"command,omitempty"`
Args *[]string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
URL *string `json:"url,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
WorkingDir *string `json:"working_dir,omitempty"`
}
MCPOverride is an explicit per-node replacement for controller-local settings. It never mounts arbitrary host paths. Dependencies belong in the runtime image.
type Node ¶
type Node struct {
Config Config
HTTP *http.Client
Executor Executor
Log *log.Logger
// contains filtered or unexported fields
}
Node holds only transport/lifecycle state. Tool code runs in Executor's isolated subprocess. HTTP is injectable for TLS-pinned deployments and protocol tests.
type ProcessExecutor ¶
ProcessExecutor is explicitly unsafe: it isolates process lifetimes and env, but has the host user's complete filesystem/network authority. Tests/dev only.
type Sandbox ¶
type Sandbox interface {
Request(context.Context, SandboxRequest) (SandboxReply, error)
Stop() error
}
type SandboxReply ¶
type SandboxReply struct {
EnvironmentTools toolenv.Inventory `json:"environment_tools,omitempty"`
ID string `json:"id"`
Result tool.Result `json:"result"`
MCPTools []runner.ToolDefinition `json:"mcp_tools,omitempty"`
Notifications []tool.Notification `json:"notifications,omitempty"`
Error string `json:"error,omitempty"`
Executed bool `json:"executed,omitempty"`
}
type SandboxRequest ¶
type SandboxRequest struct {
ID string `json:"id"`
Method string `json:"method"`
SessionID string `json:"session_id,omitempty"`
Spec *runner.RunSpec `json:"spec,omitempty"`
Call *runner.ToolCall `json:"call,omitempty"`
CancelID string `json:"cancel_id,omitempty"`
}
SandboxRequest is the private, attached stdin/stdout protocol, not a public listener. Only the host runner sends requests; credentials are never included.
type SharedMount ¶ added in v0.8.0
type SharedMount struct {
}
SharedMount is an administrator provisioned mapping, never a host path taken from a session. Path is the manager's mount of PVC/SubPath. Keep mappings narrow (tasks, skills, drafts), excluding controller databases and credentials.