feat: add Copilot optimizer to reduce premium interaction consumption

Implement request classification, tool result merging, compact detection,
deterministic request IDs, and warmup downgrade for Copilot proxy.

The root cause was x-initiator being hardcoded to "user", making Copilot
count every API request (including tool callbacks and agent continuations)
as a separate premium interaction. The optimizer dynamically classifies
requests as "user" or "agent" based on message content analysis.

Closes #1813
This commit is contained in:
Jason
2026-04-05 08:34:10 +08:00
parent bcc14bd07d
commit 2513687184
9 changed files with 1093 additions and 9 deletions
+1
View File
@@ -5,6 +5,7 @@
pub mod body_filter;
pub mod cache_injector;
pub mod circuit_breaker;
pub mod copilot_optimizer;
pub mod error;
pub mod error_mapper;
pub(crate) mod failover_switch;