Help us shape the future of Go! Take the 2026 Go Developer Survey

relay

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package relay is the shared engine for the out-of-band model relay (SPEC §1-2): it emits a stage's prompt and parks a pending turn, then on a later invocation validates the operator's reply and advances the arc. The `step` and `run` command shells both drive it, so there is one relay implementation. It is pure with respect to I/O: it mutates the arc and reports an Outcome, while the shell owns the reads (the diff that grounds the critic, the footprint after an execution turn) and the writes (persisting the arc, printing the outcome).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind int

Kind is what a relay step did.

const (
	// Awaiting means a prompt was emitted and the arc is parked for a reply.
	Awaiting Kind = iota
	// Gap means the critic is ungrounded — the environment did not teach it, so no
	// prompt was emitted (§19.1, exit 12); the shell reports the routing gap.
	Gap
	// Advanced means a reply was applied and the arc moved on a stage.
	Advanced
)

type Outcome

type Outcome struct {
	Kind   Kind
	Prompt string

	// Ungrounded reports that a critic prompt was emitted with nothing from the
	// repository behind it — no routed context unit and no proof packet — so the
	// review will run on the model's own priors.
	//
	// It is not a Gap and must not become one. A Gap is an arc that *declared* a
	// footprint against a store that has units and still routed nothing, which means
	// the routing failed; that blocks with exit 12. This is an arc with no footprint,
	// or a repository with no context store, and refusing those would make adh
	// unusable on a repository that has not adopted the store. The decision to allow
	// it is right and documented in critic.ForStage.
	//
	// **What was missing is the record, not the refusal.** critic.HasGrounding
	// computes this and, outside the Gap branch, its answer was dropped — so a review
	// grounded in six routed units and one grounded in nothing reached Ops as the
	// same artifact. That is the third instance in this repo of a distinction the
	// code computes and discards; the other two were Critic.Deny and Dispose.
	//
	// Reported at emit rather than at eval because emit is when it is actionable: the
	// operator receiving the prompt can still add a context unit or declare a label.
	// By eval the review has happened.
	Ungrounded bool
}

Outcome is the result of a relay step: its Kind and, for Awaiting, the emitted prompt.

func Emit

func Emit(
	arc *adh.Arc,
	storeDir string,
	in *critic.Inputs,
	renderer stage.Prompter,
	class authority.ModelClass,
	judgment authority.JudgmentRoles,
) (Outcome, error)

Emit renders the arc's current stage prompt and parks it as a pending turn, grounding the critic from in (the shell supplies the diff). Re-emitting an already-open turn for the same stage is idempotent. It returns Gap without a prompt when the critic is ungrounded (§19.1). class/judgment gate the model (§5.1). It mutates arc.Pending; the shell persists the arc.

func Resume

func Resume(
	ctx context.Context,
	arc *adh.Arc,
	replyText string,
	renderer stage.Prompter,
	judgment authority.JudgmentRoles,
) (Outcome, error)

Resume validates replyText against the current stage's contract (critic.ParseReply) and advances the arc one stage, clearing the pending turn. A malformed reply is rejected before any state changes, so it never advances the arc (§19.2). A strategy reply's chosen resolution is applied (§12) and a critic reply's findings are recorded. It does not capture the execution footprint — that needs the worktree, so the shell does it after an execution turn. It mutates arc; the shell persists it.

Jump to

Keyboard shortcuts

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