(
&self,
session_id: &str,
estimated_prompt_tokens: usize,
)
| 5186 | #[async_trait::async_trait] |
| 5187 | impl a3s_code_core::budget::BudgetGuard for NodeBudgetGuard { |
| 5188 | async fn check_before_llm( |
| 5189 | &self, |
| 5190 | session_id: &str, |
| 5191 | estimated_prompt_tokens: usize, |
| 5192 | ) -> a3s_code_core::budget::BudgetDecision { |
| 5193 | let Some(tsfn) = self.check_before_llm.as_ref() else { |
| 5194 | return a3s_code_core::budget::BudgetDecision::Allow; |
| 5195 | }; |
| 5196 | self.call_decision( |
| 5197 | tsfn, |
| 5198 | serde_json::json!({ |
| 5199 | "sessionId": session_id, |
| 5200 | "estimatedTokens": estimated_prompt_tokens, |
| 5201 | }), |
| 5202 | ) |
| 5203 | } |
| 5204 | |
| 5205 | async fn record_after_llm(&self, session_id: &str, usage: &a3s_code_core::llm::TokenUsage) { |
| 5206 | let Some(tsfn) = self.record_after_llm.as_ref() else { |
nothing calls this directly
no test coverage detected