engine

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package engine is the supervisor: it owns run creation, subprocess execution, the auto-execution of run_command operations, response acceptance, and terminal handling. Every state change goes through the run log; every refusal goes through the guard.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	SkillDir          string
	RunsDir           string
	SupervisorVersion string
	// Stderr receives subprocess diagnostics (compile errors etc.).
	Stderr *os.File
}

Engine binds a skill directory to a runs directory.

func New

func New(skillDir string) (*Engine, error)

New creates an engine rooted at the skill directory; run logs live in <skillDir>/.yield/runs.

func NewWithRunsDir added in v0.1.20

func NewWithRunsDir(skillDir, runsDir string) (*Engine, error)

NewWithRunsDir creates an engine whose durable run state is stored outside the workflow directory. Tests use this to avoid leaving local state behind.

func (*Engine) Continue added in v0.1.20

func (e *Engine) Continue(runID string) (*Progress, error)

Continue recovers a run after a response was committed but the process stopped before the next frontier was recorded.

func (*Engine) ListRuns

func (e *Engine) ListRuns() ([]string, error)

ListRuns returns known run IDs, newest last.

func (*Engine) Log

func (e *Engine) Log(runID string) (*runlog.Log, error)

Log opens a run's log for inspection.

func (*Engine) Pending added in v0.1.20

func (e *Engine) Pending(runID string) (*protocol.RequestEnvelope, error)

Pending returns the current unanswered operation without changing the run.

func (*Engine) Replay

func (e *Engine) Replay(runID string) (*Progress, error)

Replay re-executes the program against the full journal and verifies it reproduces the run's recorded frontier — the determinism check.

func (*Engine) Respond added in v0.1.20

func (e *Engine) Respond(runID string, result json.RawMessage) (*Progress, error)

Respond binds a bare result to the frontier observed when the call began. The frontier is checked again under the run lock before the result is used.

func (*Engine) RespondAt added in v0.1.20

func (e *Engine) RespondAt(runID string, expected *protocol.RequestEnvelope, result json.RawMessage) (*Progress, error)

RespondAt binds a result only if expected is still the current frontier.

func (*Engine) Resume

func (e *Engine) Resume(runID string, respBytes []byte, migrate bool) (*Progress, error)

Resume validates and accepts a response for the pending operation, then advances. migrate=true explicitly rebinds the run to the current skill digest (the migrate_digest mechanism; divergence detection remains the safety net).

func (*Engine) StartRun

func (e *Engine) StartRun(input json.RawMessage) (*Progress, error)

StartRun creates a run bound to the current skill digest and advances to the first agent-facing operation or terminal.

type Progress

type Progress struct {
	RunID    string
	Envelope *protocol.RequestEnvelope
	Terminal *protocol.TerminalOutcome
}

Advance's result: either the next operation for the agent, or a terminal status.

Jump to

Keyboard shortcuts

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