Observable Gate
class ObservableGate(delegate: ExtractionGate, listener: DiceEventListener = DiceEventListener.DEV_NULL) : ExtractionGate
Decorator that adds event emission to any ExtractionGate.
Delegates the evaluation to the wrapped gate and then, depending on the GateDecision, emits the matching routing event through the supplied DiceEventListener. The delegate's GateEvaluation is always returned unchanged — the decorator fires events, it never alters the decision.
Event mapping:
GateDecision.Persist → nothing emitted; the persist signal fires at the save boundary and emitting one here would double-emit it.
Each emitted event carries the full Proposition. Wrap the listener in SafeDiceEventListener so a throwing listener cannot abort the gate run; this decorator does not handle exceptions itself.
Example usage:
val gate = ObservableGate(confidenceGate, SafeDiceEventListener(myListener))
val evaluation = gate.evaluate(proposition, gateContext)Content copied to clipboard