Skip to content
1 min read · 103 words

Type Alias: DispatchPipelineMiddlewareFn

ts
type DispatchPipelineMiddlewareFn = (
  ctx: DispatchContext,
  next: NextFn,
) => void | Promise<void>;

Middleware function signature for the input and output pipelines in @nhtio/adk!DispatchRunner.

Parameters

ParameterType
ctxDispatchContext
nextNextFn

Returns

void | Promise<void>

Remarks

Receives the active @nhtio/adk!DispatchContext and a next callback to advance the pipeline. Middleware can inspect ctx.isSignalled to bail early when an earlier middleware or the executor has called ctx.ack() / ctx.nack(), and ctx.aborted for external cancellation. Use ctx.iteration and ctx.toolCallCount(checksum) to implement iteration bounds and checksum-repeat bounds in your own middleware — the runner itself does not impose either.