Merge remote-tracking branch 'origin/token-meter-service' into compact-post-step-overflow-recovery

# Conflicts:
#	docs/core-data-structures/compaction.md
#	docs/rfc/implemented/architecture/2026-07-15-replay-token-meter-service.i18n.yaml
#	docs/rfc/implemented/architecture/2026-07-15-replay-token-meter-service.md
#	docs/rfc/implemented/architecture/2026-07-15-replay-token-meter-service.zh.md
#	docs/rfc/implemented/feature/2026-06-18-compaction-capability-seam.md
#	examples/coding-agent/cordis.yml
#	packages/compact/compact-basic/README.md
#	packages/compact/compact-basic/src/automatic.ts
#	packages/compact/compact-basic/src/config.ts
#	packages/compact/compact-basic/src/index.ts
#	packages/compact/compact-basic/tests/compact-basic.spec.ts
This commit is contained in:
Hypatia May
2026-07-16 16:18:16 +08:00
36 changed files with 939 additions and 1292 deletions

View File

@@ -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 after measured pressure or a canonical provider overflow.
# Built-in policies provide pressure, retention, and one overflow-retry default.
# Service-wide policy provides pressure, retention, and one overflow-retry default.
- id: compact-basic
name: '@deepseek-ai/dsh-compact-basic'

View File

@@ -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,

View File

@@ -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)