File size: 2,544 Bytes
e249429
 
 
 
 
 
d23b1fc
e249429
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
 * AgentFrame compaction backend for DeepSeek Harness.
 *
 * Replaces the default LLM-summarization compaction with AgentFrame's
 * dual-track compression:
 *   1. Semantic track (MemoryDirector): LLM decides which tokens matter
 *   2. Physical track (AbsorbedMLA + INT4): 28.4x KV compression
 *
 * @module @deepseek-ai/dsh-compaction-agentframe
 */
import { Context } from '@deepseek-ai/cordis';
import z from '@deepseek-ai/schemastery';
import { CompactionEngine, type CompactionResult, type CompactionTrigger } from '@deepseek-ai/dsh-compaction';
/** AgentFrame compaction configuration. */
export interface AgentFrameCompactionConfig {
    /** Enable semantic compaction via MemoryDirector. */
    semantic: boolean;
    /** Target retention ratio after compaction (0.2 = keep 20%). */
    retainRatio: number;
    /** Enable physical KV compression accounting. */
    physical: boolean;
    /** Approximate bytes per token for accounting. */
    bytesPerToken: number;
    /** Auto compaction on pressure. */
    auto: boolean;
}
/**
 * AgentFrameCompactionEngine
 *
 * A minimal, self-contained implementation of the dsh compaction seam.
 * It selects the oldest balanced span and condenses it into a structured
 * checkpoint using a deterministic extractor (semantic priority) rather than
 * a full LLM summarization call, which keeps the harness loop cheap while
 * preserving the durable surface contract.
 */
export declare class AgentFrameCompactionEngine extends CompactionEngine {
    static inject: string[];
    static Config: z<AgentFrameCompactionConfig>;
    readonly config: AgentFrameCompactionConfig;
    constructor(ctx: Context, config?: AgentFrameCompactionConfig);
    private _registerAutomaticCompaction;
    compactIfNeeded(agent: any, trigger: CompactionTrigger, signal: AbortSignal): Promise<CompactionResult | null>;
    compactNow(agent: any, signal: AbortSignal, sourceCommandId?: any): Promise<CompactionResult | null>;
    compactRegion(start: number, end: number, agent: any, signal?: AbortSignal): Promise<CompactionResult>;
    /**
     * Deterministic semantic condense: keep high-information lines, drop chatter.
     * This mirrors MemoryDirector's remember/forget decision without an extra
     * LLM round-trip in the hot path.
     */
    private _condense;
    private _surfaceEvents;
    private _eventText;
    /** Pick the oldest balanced span covering ~(1-retainRatio) of history. */
    private _selectSpan;
}
export default AgentFrameCompactionEngine;
//# sourceMappingURL=index.d.ts.map