@@ -2,15 +2,15 @@ import type { ReasoningEffort } from "../agent/profile-types.js";
22import type { DirectorId } from "../agent/directors/types.js" ;
33
44/**
5- * Per-role V4 effort defaults. coder is the cheapest spawn: 'low' clamps to
6- * the V4 'none' wire rung (thinking off), per the operator's "simplest
7- * implementer = none" intent. Every other role takes its rung from the map .
5+ * Per-role V4 effort defaults. dispatch/planner/reviewer dispatch and judge —
6+ * max. coder defaults to max (operator-confirmed). Every other leaf reasons at
7+ * xhigh .
88 */
99export const DEEPSEEK_V4_ROLE_EFFORT : Record < DirectorId , ReasoningEffort > = {
1010 dispatch : "max" ,
1111 planner : "max" ,
1212 reviewer : "max" ,
13- coder : "low " ,
13+ coder : "max " ,
1414 explorer : "xhigh" ,
1515 artist : "xhigh" ,
1616 "qa-lead" : "xhigh" ,
@@ -20,13 +20,23 @@ export const DEEPSEEK_V4_ROLE_EFFORT: Record<DirectorId, ReasoningEffort> = {
2020 warden : "xhigh" ,
2121} ;
2222
23- // DeepSeek V4 effort translator shared by the adapter and the effort picker.
24- // V4 ships under several ids across two catalogs — deepseek-v4-pro/-flash/
25- // -flash-vision-exp — and under a vendor-qualified host id like
26- // deepseek-ai/DeepSeek-V4-Flash-0731. Match the `deepseek-v4` segment at the
27- // start or after a `/`, so both bare and qualified ids resolve while pre-V4
28- // ids (deepseek-coder, deepseek-chat) do not. This mirrors the grok/kimi/astra
29- // leaf predicates, which also accept an org-qualified segment.
23+ // DeepSeek family predicate shared by the adapter router and the family policy.
24+ // The family ships under several ids across two catalogs — deepseek-v4-pro/
25+ // -flash/-flash-vision-exp and deepseek-chat/deepseek-coder/deepseek-v3 — and
26+ // under a vendor-qualified host id like deepseek-ai/DeepSeek-V4-Flash-0731.
27+ // Match the `deepseek` segment at the start or after a `/`, so both bare and
28+ // qualified ids resolve across the whole family (including future versions).
29+ // This mirrors the grok/kimi/astra leaf predicates, which also accept an
30+ // org-qualified segment.
31+ export function isDeepSeekModel ( model : string ) : boolean {
32+ return / ( ^ | \/ ) d e e p s e e k / i. test ( model . trim ( ) ) ;
33+ }
34+
35+ // V4-variant detection: distinguishes the V4 model line from pre-V4 DeepSeek
36+ // (deepseek-chat, deepseek-coder, deepseek-v3). Only where the wire semantics
37+ // genuinely differ between V4 and pre-V4 deepseek — the V4 adapter's model-card
38+ // and effort quirks, the reasoning_content keep-vs-strip behavior, and the
39+ // none/xhigh/max effort ladder — do callers gate on this variant predicate.
3040export function isDeepSeekV4Model ( model : string ) : boolean {
3141 return / ( ^ | \/ ) d e e p s e e k - v 4 / i. test ( model . trim ( ) ) ;
3242}
@@ -43,15 +53,17 @@ export const DEEPSEEK_V4_EFFORTS: readonly ReasoningEffort[] = [
4353/**
4454 * Translate a V4 effort to its raw wire value: `xhigh`/`max` pass through
4555 * verbatim, `none` maps to null (the caller drops `reasoning_effort`, since
46- * `reasoning_effort:"none"` is illegal on the wire). Off-ladder values return
47- * undefined — the caller leaves `reasoning_effort` untouched rather than
48- * coercing it onto a V4 rung.
56+ * `reasoning_effort:"none"` is illegal on the wire). The V4 ladder is strictly
57+ * none/xhigh/max: any off-ladder effort arriving on a manual/exec/config path
58+ * is rejected with a clear error rather than coerced or passed through, so no
59+ * off-ladder value can reach the wire for a V4 model.
4960 */
50- export function mapV4Effort (
51- effort : ReasoningEffort ,
52- ) : "xhigh" | "max" | null | undefined {
61+ export function mapV4Effort ( effort : ReasoningEffort ) : "xhigh" | "max" | null {
5362 if ( effort === "none" ) return null ;
54- return effort === "xhigh" || effort === "max" ? effort : undefined ;
63+ if ( effort === "xhigh" || effort === "max" ) return effort ;
64+ throw new Error (
65+ `DeepSeek V4 does not support reasoning effort "${ effort } " (supported: none, xhigh, max).` ,
66+ ) ;
5567}
5668
5769/**
0 commit comments