refactor(token-meter): simplify singleton service (round 1)
This commit is contained in:
@@ -46,12 +46,12 @@
|
||||
Verify your work by running the code or tests. Keep answers brief and
|
||||
factual.
|
||||
|
||||
# Replay-aware request pressure for the bundled DeepSeek model profiles.
|
||||
# Replay-aware request pressure with one service-wide context window.
|
||||
- id: token-meter
|
||||
name: '@deepseek-ai/dsh-token-meter'
|
||||
|
||||
# Summarize an older range when measured history approaches the context window.
|
||||
# Built-in model policies provide the ordinary threshold and retained-tail defaults.
|
||||
# Service-wide policy provides the ordinary threshold and retained-tail defaults.
|
||||
- id: compact-basic
|
||||
name: '@deepseek-ai/dsh-compact-basic'
|
||||
|
||||
|
||||
@@ -34,14 +34,11 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('compaction: a long session compa
|
||||
ctx = await codingHarness(workdir, {
|
||||
persona: SYSTEM_PROMPT,
|
||||
tokenMeter: {
|
||||
models: {
|
||||
'deepseek-v4-flash': { contextWindow: 2000 },
|
||||
},
|
||||
contextWindow: 2000,
|
||||
},
|
||||
compact: {
|
||||
models: {
|
||||
'deepseek-v4-flash': { thresholdRatio: 0.5, retainTokens: 400 },
|
||||
},
|
||||
thresholdRatio: 0.5,
|
||||
retainTokens: 400,
|
||||
summarizationModel: '',
|
||||
maxTokens: 1024,
|
||||
compactionRetries: 1,
|
||||
|
||||
@@ -48,7 +48,7 @@ export interface CodingHarnessOptions {
|
||||
* compaction plugin (the default suites run without it).
|
||||
*/
|
||||
compact?: BasicCompactConfig
|
||||
/** Optional meter profiles loaded before compact-basic. */
|
||||
/** Optional token-meter capacity loaded before compact-basic. */
|
||||
tokenMeter?: TokenMeterConfig
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ export async function codingHarness(workdir: string, options: CodingHarnessOptio
|
||||
await ctx.plugin(ToolBash)
|
||||
await ctx.plugin(ToolTodo)
|
||||
// Compaction is opt-in: only the compaction e2e loads the reusable meter and
|
||||
// backend, with a lowered profile window so a short real session crosses the threshold.
|
||||
// backend, with a lower context window so a short real session crosses the threshold.
|
||||
if (options.compact !== undefined) {
|
||||
await ctx.plugin(TokenMeterService, options.tokenMeter)
|
||||
await ctx.plugin(BasicCompactService, options.compact)
|
||||
|
||||
Reference in New Issue
Block a user