Class: Insika::Middleware
- Inherits:
-
Object
- Object
- Insika::Middleware
- Defined in:
- lib/insika/middleware.rb
Overview
A link in the chain (stage 4). A Middleware MODIFIES the TurnState,
short-circuits, and has operational effect (rate limit, tracing, cost) — it
does NOT decide tool/skill permission (that is Policy). Short-circuit =
NOT calling nxt and setting state.halt_reason. Setting halt_reason AND
calling nxt is a contract violation (the Executor prioritizes halt_reason on
the way back).
Concurrency: it runs on the task's fiber; IO (e.g. a tracing exporter)
must be async off the path (Async { ... } fire-and-forget) or accept
the latency in the turn. No timeout of its own (covered by the turn timeout).
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#call(state, &nxt) ⇒ Object
15 16 17 |
# File 'lib/insika/middleware.rb', line 15 def call(state, &nxt) nxt.call(state) # default link: pass-through end |