Skip to content

StageContext

Defined in: packages/engine/src/lib/planner/stage.ts:77

Request-scoped services the Engine gives every stage of a Planner.

readonly optional enumSnapshot?: ActionParameterEnumSnapshot

Defined in: packages/engine/src/lib/planner/stage.ts:106

The Action parameter enum values StageContext.validate checks actions against, captured once from the Vessel catalog in StageContext.origin. A stage that renders enum values for that same catalog (for example into a prompt) should read them from here, so it shows exactly the literals validation accepts even for values whose serialization is not stable across calls. The Engine always sets it; combinators that derive a context must forward it unchanged.


readonly instrument: Instrument

Defined in: packages/engine/src/lib/planner/stage.ts:92

The Engine’s telemetry seam. pipeline wraps every stage with it; a stage reports what happens inside it (for example a model call) with instrument.event. The Engine always sets it, to a no-op when none is configured; combinators that derive a context must forward it unchanged.


readonly logger: Logger

Defined in: packages/engine/src/lib/planner/stage.ts:85

The Engine’s logger. Log through it so stage logs share the Engine’s sink and redaction.


readonly origin: PlanningInput

Defined in: packages/engine/src/lib/planner/stage.ts:94

The untouched input the Engine passed to the first stage.


readonly optional signal?: AbortSignal

Defined in: packages/engine/src/lib/planner/stage.ts:83

Cancels in-flight work for the request. Every stage must honour it so that cancelled requests, and later concurrent combinators, stop spending on work nobody will use.


readonly validate: {(candidate): Result<ValidatedCandidate, EngineError>; (candidate): Result<ValidatedReplylessCandidate, EngineError>; }

Defined in: packages/engine/src/lib/planner/stage.ts:96

Heals and validates a candidate against the request in StageContext.origin.

(candidate): Result<ValidatedCandidate, EngineError>

PlannerCandidate

Result<ValidatedCandidate, EngineError>

(candidate): Result<ValidatedReplylessCandidate, EngineError>

ReplylessCandidate

Result<ValidatedReplylessCandidate, EngineError>