fix: retain LLM HTTP status metadata

This commit is contained in:
Tianyi Cui
2026-07-14 23:43:53 +08:00
parent 0bc114c07d
commit d0df50aa8e
7 changed files with 21 additions and 15 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ import { LlmError, assertNever } from '@deepseek-ai/dsh-llm'
*/
export type ReplayEntry =
| { kind: 'chunks'; chunks: StreamChunk[] }
| { kind: 'throw'; chunks: StreamChunk[]; message: string; code: string }
| { kind: 'throw'; chunks: StreamChunk[]; message: string; code: string; status?: number }
| { kind: 'hang' }
/** Resolved plugin configuration. */
@@ -221,7 +221,7 @@ async function* replayEntry(entry: ReplayEntry, signal: AbortSignal | undefined)
if (signal?.aborted) throw new Error('aborted')
yield chunk
}
throw new LlmError(entry.message, entry.code)
throw new LlmError(entry.message, entry.code, entry.status)
case 'hang':
// Replay a stream that stalls until cancelled (mirrors MockAdapter): one
// chunk, then wait for abort and surface it as the consumer expects.