manifest

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnvProjectorVars = map[string]bool{"state_dir": true, "host_skills_dir": true}

EnvProjectorVars is the CLOSED set of projector-time variables a loop.json env value may reference as ${name}; the projector substitutes each to a real path at render time. Anything else lowercase in ${...} is rejected (the env injection lock — a value can never name an arbitrary projector internal).

Functions

func LoopsForHost

func LoopsForHost(fsys fs.FS, host string) ([]string, error)

func SubstituteEnvValue

func SubstituteEnvValue(value string, vars map[string]string) string

SubstituteEnvValue resolves the closed projector variables in a (pre-validated) env value; the runtime ${VAR:-default} refs pass through verbatim for bash to expand when env.sh is sourced. The projector supplies vars keyed by EnvProjectorVars names.

Types

type BindingManifest

type BindingManifest struct {
	SchemaVersion    int               `json:"schema_version"`
	Name             string            `json:"name"`
	Host             string            `json:"host"`
	Loop             string            `json:"loop"`
	ProjectionPath   string            `json:"projection_path"`
	RuntimeSurface   string            `json:"runtime_surface"`
	LifecycleMapping map[string]string `json:"lifecycle_mapping"`
	Reconcile        []string          `json:"reconcile"`
}

func BindingsForHost

func BindingsForHost(fsys fs.FS, host string) ([]BindingManifest, error)

func LoadBinding

func LoadBinding(fsys fs.FS, host, loop string) (BindingManifest, error)

type EnvVar

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type HookOptions

type HookOptions struct {
	Remind  bool `json:"remind"`
	Nudge   bool `json:"nudge"`
	Compact bool `json:"compact"`
}

type LoopAssets

type LoopAssets struct {
	Guide        string   `json:"guide"`
	Env          string   `json:"env"`
	RuntimeFiles []string `json:"runtime_files,omitempty"`
	Skills       []string `json:"skills"`
	Subagents    []string `json:"subagents"`
}

type LoopManifest

type LoopManifest struct {
	SchemaVersion int        `json:"schema_version"`
	Name          string     `json:"name"`
	Version       string     `json:"version,omitempty"`
	Description   string     `json:"description,omitempty"`
	Surfaces      Surfaces   `json:"surfaces"`
	Assets        LoopAssets `json:"assets"`
	// Store, when present and Native, declares that the loop is backed by a native `mnemon` store
	// (the projector ensures it via the mnemon CLI when --store is set). Declarative replacement for
	// the hardcoded loop.Name == "memory" gate (PD4); absent = not store-backed.
	Store *LoopStore `json:"store,omitempty"`
	// StateDirs are loop state directories the projector creates under the loop's state dir at
	// install (declarative replacement for the hardcoded skill-loop scaffolding; PD4). Each is a
	// safe relative path (no absolute, no "..").
	StateDirs []string `json:"state_dirs,omitempty"`
	// Env are the loop's extra runtime env vars, rendered into the runtime env.sh as
	// `export NAME="VALUE"` (declarative replacement for the hardcoded per-loop env switch; PD4).
	// Names are namespaced (^MNEMON_...) and values use a CLOSED shell-safe grammar — closed
	// projector variables (${state_dir}, ${host_skills_dir}) the projector substitutes, runtime bash
	// refs ${VAR} / ${VAR:-default}, and safe literals — so an external package can never inject
	// shell into a sourced file (the env injection lock).
	Env []EnvVar `json:"env,omitempty"`
	// HookOptions declares the loop's per-loop hook timing intent (declarative replacement for the
	// hardcoded codex/claude hookOptions switch; PD4). A host applies it per its own semantics:
	// codex uses all three bits directly; claude uses Remind as the default (operator --remind
	// overrides) and keeps nudge/compact operator-flag-driven. Absent = the loop has no hooks.
	HookOptions *HookOptions `json:"hook_options,omitempty"`
}

func LoadLoop

func LoadLoop(fsys fs.FS, loop string) (LoopManifest, error)

func (LoopManifest) HasHooks

func (l LoopManifest) HasHooks() bool

HasHooks reports whether the loop declares any hook timing — the declarative replacement for the projector's `loop.Name == "memory" || loop.Name == "skill"` hooks-enabled gates.

type LoopStore

type LoopStore struct {
	Native bool `json:"native"`
}

type Surfaces

type Surfaces struct {
	Projection  []string `json:"projection"`
	Observation []string `json:"observation"`
}

type ValidationResult

type ValidationResult struct {
	Lines []string
}

func ValidateFS

func ValidateFS(fsys fs.FS) (ValidationResult, error)

ValidateFS validates the loop/host/binding manifests rooted at fsys ("loops/", "hosts/", "bindings/" — no "harness/" prefix). An absent loops directory is tolerated (nothing to validate), so validating an external root that carries no harness assets passes trivially.

Jump to

Keyboard shortcuts

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