intercept method

Future<SemanticAction?> intercept(
  1. SemanticAction action
)

Intercept an action. If it's ActionTier.safe, the returned future completes immediately with the action unchanged. If it's ActionTier.confirm, the future completes when PolicyDecision.approve or PolicyDecision.deny is called.

Returns null when denied — the caller (typically the UiRenderTool/UiEventChannel) drops the action and emits a policyDenied event (FR-006 acceptance 2).

Implementation

Future<SemanticAction?> intercept(SemanticAction action) {
  if (action.tier != ActionTier.confirm) {
    return Future.value(action);
  }
  final decision = PolicyDecision.forAction(action);
  _pending.add(decision);
  return decision.future.whenComplete(() => _pending.remove(decision));
}