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

Method fire_post_response

core/src/agent/hook_runtime.rs:77–102  ·  view source on GitHub ↗

Fire PostResponse hook event after the agent loop completes.

(
        &self,
        session_id: &str,
        response_text: &str,
        tool_calls_count: usize,
        usage: &TokenUsage,
        duration_ms: u64,
    )

Source from the content-addressed store, hash-verified

75
76 /// Fire PostResponse hook event after the agent loop completes.
77 pub(super) async fn fire_post_response(
78 &self,
79 session_id: &str,
80 response_text: &str,
81 tool_calls_count: usize,
82 usage: &TokenUsage,
83 duration_ms: u64,
84 ) {
85 if let Some(he) = &self.config.hook_engine {
86 let event = HookEvent::PostResponse(PostResponseEvent {
87 session_id: session_id.to_string(),
88 response_text: response_text.to_string(),
89 tool_calls_count,
90 usage: TokenUsageInfo {
91 prompt_tokens: usage.prompt_tokens as i32,
92 completion_tokens: usage.completion_tokens as i32,
93 total_tokens: usage.total_tokens as i32,
94 },
95 duration_ms,
96 });
97 let he = Arc::clone(he);
98 tokio::spawn(async move {
99 let _ = he.fire(&event).await;
100 });
101 }
102 }
103
104 /// Fire OnError hook event when an error occurs.
105 pub(super) async fn fire_on_error(

Callers 1

Calls 1

fireMethod · 0.45

Tested by

no test coverage detected