Feature: Implement V0 Episodic Context Manager

- Re-wrote the monolithic string-based context manipulation logic into an elegant, immutable Episodic IR pipeline.
- Implemented four non-destructive degradation processors: `HistorySquashingProcessor`, `ToolMaskingProcessor`, `BlobDegradationProcessor`, and `SemanticCompressionProcessor`.
- Added dynamic configuration knobs (`budget` and `strategies`) to precisely tune the retention algorithms.
- Implemented a power-user `incrementalGc` flag for maximum context preservation beneath the ceiling.
- Enforced strict typing across the new pipeline, replacing unsafe casts with robust mapping interfaces.
- Added `powerUserProfile` to support features for those wanting a bit
  more quality at the cost of tokens.
This commit is contained in:
Your Name
2026-04-03 20:43:19 +00:00
parent 06173c0885
commit 1f567965d2
39 changed files with 2612 additions and 2315 deletions
+2 -1
View File
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import type { PartListUnion, Part } from '@google/genai';
import type { PartListUnion, Part, Content } from '@google/genai';
import type { ContentGenerator } from '../core/contentGenerator.js';
import { debugLogger } from './debugLogger.js';
@@ -139,6 +139,7 @@ export async function calculateRequestTokenCount(
request: PartListUnion,
contentGenerator: ContentGenerator,
model: string,
history?: readonly Content[],
): Promise<number> {
const parts: Part[] = Array.isArray(request)
? request.map((p) => (typeof p === 'string' ? { text: p } : p))