local

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package local implements the agentsessions api.Runtime compute SPI as a filesystem-only backend — the honest "plain pod" counterpart to runtime/substrate. It captures no RAM/process state: the event log IS the durable state, so resume is realized by STATELESS_REPLAY (the host replays the journal into a fresh incarnation). Capabilities report MemorySnapshot=false, which is what makes CanPlace meaningful — a REQUIRES_MEMORY_SNAPSHOT harness is refused here and accepted on substrate (honest degradation across two backends behind one SPI).

The harness runs behind a real harnesswire gRPC server on a unix socket: Create returns an incarnation whose Address the placement layer dials via Harness.Connect — the SAME transport substrate uses — so determinism holds over the wire for local exactly as it will for substrate. Describe exposes the harness's static contract IN-PROCESS so the placement gate runs before Create.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

Backend implements api.Runtime by serving a single harness over a unix socket (M0). Later the harness is selected per SessionSpec.Harness/Image from a registry.

func New

func New(harness api.Harness, opts ...Option) *Backend

New builds a backend that serves harness.

func (*Backend) Capabilities

func (b *Backend) Capabilities() api.RuntimeCapabilities

Capabilities reports a filesystem-only backend: no memory snapshot, CoW fork, attestation, or GPU state. MemorySnapshot=false is the degradation counterpart that makes CanPlace meaningful.

func (*Backend) Close

func (b *Backend) Close() error

Close stops the shared harness server and removes its socket. Callers own the backend lifetime.

func (*Backend) Create

func (b *Backend) Create(ctx context.Context, s *api.SessionSpec) (inc api.Incarnation, err error)

Create provisions an incarnation: it ensures the harness server is up and returns the unix-socket address the placement layer dials via Harness.Connect.

func (*Backend) Describe

func (b *Backend) Describe(ctx context.Context) (api.Descriptor, error)

Describe returns the placed harness's static contract. The placement layer reads it IN-PROCESS to gate CanPlace before Create — placement must not provision compute to learn a harness's needs.

func (*Backend) Fork

func (b *Backend) Fork(ctx context.Context, ref api.SnapshotRef, opts api.ForkOpts) (inc api.Incarnation, err error)

Fork is a replay-fork: a fresh incarnation for the child, whose log prefix is copied by controller.Fork. Same shape as substrate's replay-fork — a filesystem-only backend has no clone-from-memory-snapshot path.

func (*Backend) Restore

func (b *Backend) Restore(ctx context.Context, ref api.SnapshotRef) (inc api.Incarnation, err error)

Restore re-provisions a fresh in-process incarnation; the host reconstructs harness-visible state by replaying the journal (STATELESS_REPLAY). The placement layer mints a new fence so the fresh incarnation supersedes any zombie writer.

func (*Backend) Snapshot

func (b *Backend) Snapshot(ctx context.Context, in api.Incarnation, kind api.SnapshotKind) (ref api.SnapshotRef, err error)

Snapshot is filesystem-only: the event log is the durable state, so there is nothing beyond it to capture. Only EXTERNAL (cold/suspend) is meaningful, and it just names the session so Restore can re-provision; Memory=false marks it as STATELESS_REPLAY. LOCAL (warm) is unsupported, mirroring substrate's inverse (substrate supports memory, not warm-local).

func (*Backend) Status

func (b *Backend) Status(ctx context.Context, in api.Incarnation) (api.ComputeState, error)

Status reports the compute-lifecycle state. The in-process backend keeps no separate compute state machine — the log and placement layer are the lifecycle authority — so a known incarnation is LIVE.

func (*Backend) Stop

func (b *Backend) Stop(ctx context.Context, in api.Incarnation) error

Stop tears the incarnation down. In-process there is no sandbox or socket to close; the worker is freed by the process, so this is a no-op that keeps the SPI contract.

type Option

type Option func(*Backend)

Option configures a local Backend.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger enables structured operational logs.

Jump to

Keyboard shortcuts

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