MCPcopy Create free account
hub / github.com/AI45Lab/Code / map_context_perception_decision

Function map_context_perception_decision

core/src/ahp/decision.rs:63–83  ·  view source on GitHub ↗
(payload: &serde_json::Value)

Source from the content-addressed store, hash-verified

61}
62
63fn 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
85fn map_memory_recall_decision(payload: &serde_json::Value) -> HookResult {
86 match serde_json::from_value::<MemoryRecallDecision>(payload.clone()) {

Callers 1

map_decisionFunction · 0.85

Calls 2

map_generic_decisionFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected