ToolGatingHook class
Policy hook that gates tool calls based on the PermissionRegistry (FR-001, FR-002, FR-003, FR-004, FR-012).
- Inheritance
-
- Object
- PolicyHook
- ToolGatingHook
Constructors
- ToolGatingHook({required PermissionRegistry registry, required ApprovalCallback approvalCallback, Duration confirmTimeout = const Duration(seconds: 30)})
Properties
- approvalCallback → ApprovalCallback
-
final
- confirmTimeout → Duration
-
final
- enabled ↔ bool
-
Whether this hook is currently active. Disabled hooks are skipped by
the PolicyShell.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Stable identifier for this hook (e.g.
tool_gating,mission_budget,mission_trace).no setteroverride - registry → PermissionRegistry
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
afterToolCall(
ToolCallContext ctx, ToolResult result) → Future< ToolResult> -
Called after a tool has returned. May modify
result(e.g., the oversized-result guard swaps in an ArtifactReference).inherited -
beforeToolCall(
ToolCallContext ctx) → Future< HookDecision> -
Called before a tool is invoked. Returns a HookDecision that the
shell uses to allow / deny / cancel the call.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onMissionEnd(
String missionId) → Future< void> -
Called once when the mission ends (terminal state).
inherited
-
onMissionStart(
String missionId) → Future< void> -
Called once before the mission starts.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited