feat(llm): mark compaction requests with x-deepseek-harness-compact header

This commit is contained in:
Jinhua Zhu
2026-07-22 18:35:32 +08:00
parent 6646ef04ac
commit 66e5f8eecd
7 changed files with 29 additions and 2 deletions
@@ -129,6 +129,8 @@ describe('DeepSeekAdapter against a mock server', () => {
expect(server.headers[0]).not.toHaveProperty('http-referer')
expect(server.headers[0]).not.toHaveProperty('x-openrouter-title')
expect(server.headers[0]).not.toHaveProperty('x-openrouter-categories')
// A conversation request carries no compaction marker.
expect(server.headers[0]).not.toHaveProperty('x-deepseek-harness-compact')
})
it('streams raw chunks through ctx.llm.stream', async () => {
@@ -159,6 +161,19 @@ describe('DeepSeekAdapter against a mock server', () => {
expect(server.headers[0]?.['x-deepseek-harness-session-id']).toBe('child-session')
})
it('marks the auxiliary compaction call on the wire', async () => {
const server = await mockServer([{ kind: 'sse', events: textEvents }])
const ctx = await harness(server.url)
await assemble(ctx, {
model: 'deepseek-v4-flash',
messages: [{ role: 'user', content: [{ type: 'text', text: 'hi' }] }],
compact: true,
})
expect(server.headers[0]?.['x-deepseek-harness-compact']).toBe('1')
})
it('forwards thinking config onto the wire', async () => {
const server = await mockServer([{ kind: 'sse', events: textEvents }])
const ctx = await harness(server.url, { thinking: 'disabled', reasoningEffort: 'high' })