Documentation
¶
Overview ¶
Package stage sequences the five-stage loop (SPEC §1): it runs an arc's current stage through the model seam and advances it, and decides whether the relay may auto-launch the next stage under the autonomy level (SPEC §6). A stage's work splits into two pure halves — Request (gate the model class and render the prompt) and Apply (record the response and advance) — so a relay can emit the prompt on one process invocation and apply the reply on the next. Execute composes them for the synchronous Mock/API path. The critic runs cold: the injected Prompter withholds the builder's transcript (SPEC §1).
Index ¶
- func Apply(arc *adh.Arc, resp model.Response)
- func AutoAdvances(s adh.Stage, lvl authority.Level) bool
- func Execute(ctx context.Context, client Client, prompter Prompter, arc *adh.Arc, ...) error
- func Request(prompter Prompter, arc *adh.Arc, ground *critic.Grounding, ...) (model.Request, error)
- type Client
- type Prompter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply records resp in the arc's history and advances the arc to the next stage (SPEC §1). It mutates arc in place. Apply's precondition is that the arc is not at ops — Request refuses ops, so a pending turn never parks there — and the ok guard makes ops a safe no-op advance rather than blanking the stage.
**The strategy default serves the mock drive only, and that is why it survives while the relay path refuses.** `adh run` without --relay completes through model.Mock, whose strategy reply is "mock strategy output"; nothing on that path parses a resolution, because critic.ParseReply has one caller and it is relay.Resume. So this default is not a policy about unanswered questions — it is the only place that path gets a resolution at all, and without it a mock-driven arc reaches close with none and is refused by CanClose.
The relay path is where a human or agent actually chooses, and there an omitted `resolution:` line is EINVALID rather than a silent code change (see critic.parseStrategyReply). A reader seeing a refusal in one path and a default in the other should read it as the two paths asking different questions, not as a bug in one.
func AutoAdvances ¶
AutoAdvances reports whether, after completing stage s at autonomy level lvl, the relay may launch the next stage without a human. Ops always stops (the ship is a human-gated irreversible action); below L2 every transition stops.
func Execute ¶
func Execute( ctx context.Context, client Client, prompter Prompter, arc *adh.Arc, judgment authority.JudgmentRoles, ) error
Execute runs the arc's current stage through client and advances it, composing the two pure halves: Request gates and renders, client.Complete answers, Apply records and advances. It mutates arc in place. Ops is refused by Request. The critic's grounding is nil here: Execute drives the synchronous Mock/API path and the relayed resume, where the rendered critic prompt is not consumed by a reasoner — the relay's grounded emit is handled by the step command via Request.
func Request ¶
func Request( prompter Prompter, arc *adh.Arc, ground *critic.Grounding, class authority.ModelClass, judgment authority.JudgmentRoles, ) (model.Request, error)
Request builds the model request for the arc's current stage. It enforces the model-gate (SPEC §5.1) against class and renders the prompt via prompter, passing ground (the critic's working set, §19.1; nil for other stages). It is pure: no I/O, no mutation of arc. Ops has no model step (it ships via close), so Request refuses it with EINVALID. The gate is checked before the prompt is rendered, so a gated stage never produces a prompt.
Types ¶
type Client ¶
type Client interface {
Complete(ctx context.Context, req model.Request) (model.Response, error)
ModelClass() authority.ModelClass
}
Client is the model seam the stages need, declared here at the point of use and satisfied by model.Mock, model.Relay, and the real client. ModelClass reports the capability tier the binding runs at, so the gate can be enforced.
type Prompter ¶
Prompter renders the prompt for an arc's current stage. It is declared here at the point of use and satisfied by *prompt.Renderer; the critic's prompt is cold by construction, since the renderer withholds the builder's transcript. ground is the critic's repository-owned working set (§19.1); it is nil for every other stage and for an ungrounded critic.