Documentation
¶
Overview ¶
Package waterfall provides generic middleware chains matching core/waterfall. Agent, tool, approval, plan, and goal interception share an onion model: handlers run in registration order, may modify a shared payload, and control continuation. Calling next enters downstream middleware; omitting it short-circuits. Handlers may transform downstream errors and run post-processing after next returns. Each handler may call next only once; repeated calls panic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain[T any] struct { // contains filtered or unexported fields }
Chain is an ordered middleware chain.
func New ¶
New builds a chain in the supplied order. Even an empty chain uses a nonnil slice so later Use calls do not mistake it for an uninitialized zero value.
func (*Chain[T]) Run ¶
Run starts at the first handler. Errors stop execution; omitting next short-circuits with the handler's own return value.
func (*Chain[T]) RunSafe ¶
RunSafe converts chain panics into errors. Use it at external callback boundaries so one injected tool panic cannot crash the whole turn.
func (*Chain[T]) RunWithTerminal ¶
RunWithTerminal runs a per-call terminal inside the middleware chain without mutating it.