refactor(llm): classify auxiliary request purpose

This commit is contained in:
Yichen Jiang
2026-07-22 18:59:49 +08:00
parent f432f25203
commit 5234a40f9c
10 changed files with 17 additions and 19 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ The plugin registers the single provider route `deepseek`. A request selects it
## App attribution
Every request carries the shared attribution header from dsh-llm's `attributionHeaders()` - the mandatory `User-Agent` baseline identifying the harness (see [dsh-llm § App attribution](../llm/README.md#app-attribution-attributionts)). Direct DeepSeek requests and OpenAI-compatible gateway requests get no provider-specific app-attribution headers under this adapter contract; OpenRouter app attribution is deferred to a future explicit OpenRouter adapter or mode. A request with `GenerateOptions.compact` set (dsh-compact-basic's auxiliary summarization call) additionally carries `x-deepseek-harness-compact: 1`, so the host can separate compaction traffic from conversation requests.
Every request carries the shared attribution header from dsh-llm's `attributionHeaders()` - the mandatory `User-Agent` baseline identifying the harness (see [dsh-llm § App attribution](../llm/README.md#app-attribution-attributionts)). Direct DeepSeek requests and OpenAI-compatible gateway requests get no provider-specific app-attribution headers under this adapter contract; OpenRouter app attribution is deferred to a future explicit OpenRouter adapter or mode. A request whose `GenerateOptions.purpose` is `compaction` (dsh-compact-basic's auxiliary summarization call) additionally carries `x-deepseek-harness-compact: 1`, so the host can separate compaction traffic from conversation requests.
## Wire-format notes (verified live + against the official docs)
+1 -1
View File
@@ -182,7 +182,7 @@ export class DeepSeekAdapter extends LlmAdapter {
...options.sessionId !== undefined
? { 'x-deepseek-harness-session-id': String(options.sessionId) }
: {},
...options.compact === true
...options.purpose === 'compaction'
? { 'x-deepseek-harness-compact': '1' }
: {},
}
@@ -129,7 +129,6 @@ 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')
})
@@ -168,7 +167,7 @@ describe('DeepSeekAdapter against a mock server', () => {
await assemble(ctx, {
model: 'deepseek-v4-flash',
messages: [{ role: 'user', content: [{ type: 'text', text: 'hi' }] }],
compact: true,
purpose: 'compaction',
})
expect(server.headers[0]?.['x-deepseek-harness-compact']).toBe('1')