PolicyShell class
Composes policy hooks in registration order (FR-011).
Each hook can be individually disabled via PolicyHook.enabled.
The shell runs all enabled hooks' beforeToolCall in order; the
first non-allow decision wins. afterToolCall runs in reverse order
(like middleware), so the first-registered hook wraps the others.
Constructors
-
PolicyShell({List<
PolicyHook> ? hooks})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
hooks
→ List<
PolicyHook> -
Registered hooks in registration order.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
afterToolCall(
ToolCallContext ctx, ToolResult result) → Future< ToolResult> -
Runs
afterToolCallon each enabled hook in REVERSE registration order (so the first-registered hook wraps the others). Each hook may modify the result. -
beforeToolCall(
ToolCallContext ctx) → Future< HookDecision> -
Runs
beforeToolCallon each enabled hook in order. Returns the first non-allow decision; if all allow, returns HookDecisionAllow. -
disable(
String id) → void - Disables a hook by id (FR-011 — individually disableable).
-
enable(
String id) → void - Enables a hook by id.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onMissionEnd(
String missionId) → Future< void> - Notifies all hooks of mission end.
-
onMissionStart(
String missionId) → Future< void> - Notifies all hooks of mission start.
-
register(
PolicyHook hook) → void - Registers a hook.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited