(payload: &serde_json::Value)
| 61 | } |
| 62 | |
| 63 | fn map_context_perception_decision(payload: &serde_json::Value) -> HookResult { |
| 64 | match serde_json::from_value::<ContextPerceptionDecision>(payload.clone()) { |
| 65 | Ok(ContextPerceptionDecision::Allow { |
| 66 | injected_context, .. |
| 67 | }) => { |
| 68 | let value = serde_json::to_value(injected_context).ok(); |
| 69 | HookResult::Continue(value) |
| 70 | } |
| 71 | Ok(ContextPerceptionDecision::Block { reason, .. }) => HookResult::Block(reason), |
| 72 | Ok(ContextPerceptionDecision::Refine { |
| 73 | refined_intent, |
| 74 | refined_target, |
| 75 | scope_hints, |
| 76 | }) => HookResult::Continue(Some(serde_json::json!({ |
| 77 | "refined_intent": refined_intent, |
| 78 | "refined_target": refined_target, |
| 79 | "scope_hints": scope_hints |
| 80 | }))), |
| 81 | Err(_) => map_generic_decision(payload.clone()), |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | fn map_memory_recall_decision(payload: &serde_json::Value) -> HookResult { |
| 86 | match serde_json::from_value::<MemoryRecallDecision>(payload.clone()) { |
no test coverage detected