Skip to content
1 min read · 110 words

Function: orderingGuardTurnMiddleware()

ts
function orderingGuardTurnMiddleware(
  options: OrderingGuardOptions,
): TurnPipelineMiddlewareFn;

Defined in: src/batteries/validation/middleware.ts:427

Builds a @nhtio/adk!TurnPipelineMiddlewareFn running the same ordering-guard core as orderingGuardDispatchMiddleware, once per turn before the first executor call.

Parameters

ParameterTypeDescription
optionsOrderingGuardOptionsSame shape and validation as orderingGuardDispatchMiddleware.

Returns

TurnPipelineMiddlewareFn

A turn-pipeline middleware function with the same enforce/mutate semantics.

Remarks

TurnContext has no nack() — only abort() — so the default onViolation: 'nack' behavior maps to ctx.abort(error) here rather than a dispatch-style nack; onViolation: 'throw' still throws in both middleware. This asymmetry is a real, documented difference between the two contexts, not an inconsistency.