mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-01 12:52:11 +03:00
v3.8.40 cycle integration → main. All test gates green (Unit/Integration/Coverage/Node-compat/Quality-Ratchet). The only red check, 'PR Test Policy', is the test-masking heuristic firing on the cumulative ~57-commit release diff (legitimate assert consolidations already reviewed per-PR — Gemini CLI removal #5246, retired GPT models #5280, provider catalog refreshes); overridden with --admin per the documented release-PR convention. CodeQL/SonarQube advisory scans non-blocking; #5278's code already passed CodeQL on main. Homologated on VPS 192.168.0.15 (v3.8.40 healthy).
24 lines
961 B
TypeScript
24 lines
961 B
TypeScript
import type { CompressionConfig } from "./types.ts";
|
|
import type { CachingDetectionContext } from "./cachingAware.ts";
|
|
import { detectCachingContext, getCacheAwareStrategy } from "./cachingAware.ts";
|
|
|
|
/**
|
|
* #3890: honor the cache-aware `skipSystemPrompt` decision that
|
|
* `getCacheAwareStrategy` already computes but `selectCompressionStrategy`
|
|
* cannot return. In a caching context the system prompt is part of the
|
|
* cacheable prefix, so compressing it breaks the upstream prompt cache.
|
|
*/
|
|
export function resolveCacheAwareConfig(
|
|
config: CompressionConfig,
|
|
body?: Record<string, unknown>,
|
|
context?: CachingDetectionContext
|
|
): CompressionConfig {
|
|
if (!body) return config;
|
|
const ctx = detectCachingContext(body, context);
|
|
const cacheAware = getCacheAwareStrategy(config.defaultMode, ctx);
|
|
if (cacheAware.skipSystemPrompt && config.preserveSystemPrompt === false) {
|
|
return { ...config, preserveSystemPrompt: true };
|
|
}
|
|
return config;
|
|
}
|