MissionTraceRecorder class
Records the mission trace (FR-007, FR-008, FR-009).
Single-mission by design. One recorder instance records exactly one
mission: it is constructed for a fixed missionId and asserts that every
onMissionStart/afterToolCall it sees belongs to that mission. A
PolicyShell running multiple missions should hold one recorder per
mission (mirroring MissionBudgetHook's per-mission trackers).
Append-only — records are captured in afterToolCall under Dart's
single-isolate model (FR-009), so no pending-map or lock is needed. The
final MissionTrace is materialized via materialize when the mission
ends.
- Inheritance
-
- Object
- PolicyHook
- MissionTraceRecorder
Constructors
Properties
-
allowlist
→ Set<
String> -
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 - inputHash → String
-
final
- missionId → String
-
final
-
planSteps
→ List<
String> -
final
- provider → String?
-
final
- recordCount → int
-
Number of tool-call records captured so far.
no setter
- 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).override -
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
-
materialize(
{Object? outcome, ToolCallStatus status = ToolCallStatus.completed}) → MissionTrace - Materializes the final MissionTrace (FR-007).
-
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).
override
-
onMissionStart(
String missionId) → Future< void> -
Called once before the mission starts.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited