dsh-thinking-levels 4.4.2 → 4.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -102,7 +102,10 @@ window.__ModuleLoader__.load({
102
102
  "panel.search.placeholder": "搜索模型…",
103
103
  "card.takeoverUi": "模型界面接管",
104
104
  "card.takeoverUiHint": "开启后由本插件重绘输入框的模型选择面板(含每行上下文/档位编辑与搜索);关闭(默认)保留官方模型弹窗——auto 档位照常出现,搜索与加载由官方界面负责。切换即时生效,无需重载。",
105
- "card.capabilities.apiUnsupported": "该提供方使用非 openai-completions 协议:思考兼容字段由宿主 pi-ai 原生处理,此处不可配置。",
105
+ "card.capabilities.apiUnsupported": "该提供方使用非 openai-completions 协议:thinkingFormat / supportsReasoningEffort 是 openai-completions 专属字段,在这里不提供(写入会被宿主整体拒绝)。思考开关照常可用——它写入 protocol 中立的 reasoningEfforts,由宿主 pi-ai 按协议原生映射。",
106
+ "card.capabilities.thinkingNative": "思考开关在所有协议下都可勾选:写入 protocol 中立的 reasoningEfforts,由宿主 pi-ai 按各协议原生映射(Anthropic 思考预算 / Responses reasoning effort);仅 thinkingFormat / supportsReasoningEffort 为 openai-completions 专属,指明是思考模型且协议为 openai-completions 后才出现。",
107
+ "card.capabilities.staleCompat": "旧版本曾强塞进该模型行的 openai-completions 专属字段",
108
+ "card.capabilities.stripStaleCompat": "清除这些残留字段",
106
109
  "card.dsContextTitle": "官方 DeepSeek 模型上下文上限",
107
110
  "input.effort.default": "提供方默认",
108
111
  "input.effort.reset": "恢复提供方默认",
@@ -200,7 +203,10 @@ window.__ModuleLoader__.load({
200
203
  "panel.search.placeholder": "Search models…",
201
204
  "card.takeoverUi": "Model UI takeover",
202
205
  "card.takeoverUiHint": "On: this plugin replaces the composer model picker with its own panel (per-line context/effort editors + search). Off (default): the official popup stays — the auto level still appears, and search and loading remain the shipped selector’s. Changes apply immediately — no reload needed.",
203
- "card.capabilities.apiUnsupported": "This provider uses a non-openai-completions protocol: the thinking-compat fields are handled natively by pi-ai and are not configurable here.",
206
+ "card.capabilities.apiUnsupported": "This provider uses a non-openai-completions protocol: thinkingFormat / supportsReasoningEffort are openai-completions-only fields and are not offered here (a write carrying them is rejected wholesale by the host). The thinking switch is unaffected: it writes the protocol-neutral reasoningEfforts, which pi-ai maps natively per protocol.",
207
+ "card.capabilities.thinkingNative": "The thinking switch is available on every protocol: it writes the protocol-neutral reasoningEfforts, which pi-ai maps natively (Anthropic thinking budget / Responses reasoning effort). thinkingFormat / supportsReasoningEffort are openai-completions-only and appear only once the model is declared a thinking model on that protocol.",
208
+ "card.capabilities.staleCompat": "openai-completions-only fields an older version forced onto this model row",
209
+ "card.capabilities.stripStaleCompat": "Remove these leftovers",
204
210
  "card.dsContextTitle": "Official DeepSeek context windows",
205
211
  "input.effort.default": "Provider default",
206
212
  "input.effort.reset": "Restore provider default",
@@ -298,7 +304,10 @@ window.__ModuleLoader__.load({
298
304
  "panel.search.placeholder": "モデルを検索…",
299
305
  "card.takeoverUi": "モデルUI引き継ぎ",
300
306
  "card.takeoverUiHint": "ON にするとこのプラグインが入力欄のモデル選択を独自パネル(行別のコンテキスト/レベル編集+検索)に置き換えます。OFF(既定)では公式ポップアップが維持され、auto レベルは引き続き表示され、検索と読み込みは標準セレクタの役割です。変更は即時反映されます(再読み込み不要)。",
301
- "card.capabilities.apiUnsupported": "このプロバイダーは openai-completions 以外のプロトコルを使用しています:思考互換フィールドは pi-ai がネイティブに処理するため、ここで設定できません。",
307
+ "card.capabilities.apiUnsupported": "このプロバイダーは openai-completions 以外のプロトコルを使用しています:thinkingFormat / supportsReasoningEffort は openai-completions 専用フィールドのためここでは提供しません(書き込むとホストが providers 全体を拒否します)。思考スイッチは影響を受けません — protocol 非依存の reasoningEfforts を書き込み、pi-ai がプロトコルごとにネイティブ変換します。",
308
+ "card.capabilities.thinkingNative": "思考スイッチはすべてのプロトコルでチェックできます:protocol 非依存の reasoningEfforts を書き込み、pi-ai が各プロトコルでネイティブ変換します(Anthropic の思考予算 / Responses の reasoning effort)。thinkingFormat / supportsReasoningEffort は openai-completions 専用で、そのプロトコルで思考モデルと宣言した場合のみ表示されます。",
309
+ "card.capabilities.staleCompat": "旧バージョンがこのモデル行に強制挿入した openai-completions 専用フィールド",
310
+ "card.capabilities.stripStaleCompat": "この残留フィールドを削除",
302
311
  "card.dsContextTitle": "公式 DeepSeek モデルのコンテキスト上限",
303
312
  "input.effort.default": "プロバイダーの既定",
304
313
  "input.effort.reset": "プロバイダーの既定に戻す",
@@ -396,7 +405,10 @@ window.__ModuleLoader__.load({
396
405
  "panel.search.placeholder": "모델 검색…",
397
406
  "card.takeoverUi": "모델 UI 인수",
398
407
  "card.takeoverUiHint": "켜면 이 플러그인이 입력창의 모델 선택을 자체 패널(행별 컨텍스트/레벨 편집 + 검색)로 대체합니다. 끄면(기본) 공식 팝업이 유지되며 auto 레벨은 계속 표시되고 검색과 로딩은 표준 셀렉터가 담당합니다. 변경이 즉시 반영됩니다(새로고침 불필요).",
399
- "card.capabilities.apiUnsupported": "이 제공자는 openai-completions 이외 프로토콜을 사용합니다: 사고 호환 필드는 pi-ai가 네이티브로 처리하므로 여기서 설정할 수 없습니다.",
408
+ "card.capabilities.apiUnsupported": "이 제공자는 openai-completions 이외 프로토콜을 사용합니다: thinkingFormat / supportsReasoningEffort 는 openai-completions 전용 필드이므로 여기서 제공하지 않습니다(기록하면 호스트가 providers 전체를 거부합니다). 사고 스위치는 영향받지 않습니다 — protocol 중립적인 reasoningEfforts 를 기록하면 pi-ai 가 프로토콜별로 네이티브 변환합니다.",
409
+ "card.capabilities.thinkingNative": "사고 스위치는 모든 프로토콜에서 체크할 수 있습니다: protocol 중립적인 reasoningEfforts 를 기록하고 pi-ai 가 각 프로토콜에서 네이티브 변환합니다(Anthropic 사고 예산 / Responses reasoning effort). thinkingFormat / supportsReasoningEffort 는 openai-completions 전용이며, 해당 프로토콜에서 사고 모델로 선언한 경우에만 표시됩니다.",
410
+ "card.capabilities.staleCompat": "구버전이 이 모델 행에 강제로 주입한 openai-completions 전용 필드",
411
+ "card.capabilities.stripStaleCompat": "이 잔여 필드 제거",
400
412
  "card.dsContextTitle": "공식 DeepSeek 모델 컨텍스트 상한",
401
413
  "input.effort.default": "공급자 기본값",
402
414
  "input.effort.reset": "공급자 기본값으로 복원",
@@ -494,7 +506,10 @@ window.__ModuleLoader__.load({
494
506
  "panel.search.placeholder": "Rechercher des modèles…",
495
507
  "card.takeoverUi": "Reprise de l'UI modèle",
496
508
  "card.takeoverUiHint": "Activé, ce plugin remplace le sélecteur de modèle du composeur par son propre panneau (éditeurs contexte/niveau par ligne + recherche). Désactivé (défaut), la popup officielle reste en place — le niveau auto apparaît toujours, recherche et chargement appartiennent au sélecteur d'origine. Le changement s’applique immédiatement, sans rechargement.",
497
- "card.capabilities.apiUnsupported": "Ce fournisseur utilise un protocole autre qu'openai-completions : les champs de compat de réflexion sont gérés nativement par pi-ai et ne sont pas configurables ici.",
509
+ "card.capabilities.apiUnsupported": "Ce fournisseur utilise un protocole autre qu'openai-completions : thinkingFormat / supportsReasoningEffort sont des champs propres à openai-completions et ne sont pas proposés ici (une écriture qui les porte est rejetée en bloc par l'hôte). L'interrupteur de réflexion n'est pas affecté : il écrit reasoningEfforts, neutre au protocole, que pi-ai traduit nativement.",
510
+ "card.capabilities.thinkingNative": "L'interrupteur de réflexion est disponible sur tous les protocoles : il écrit reasoningEfforts, neutre au protocole, que pi-ai traduit nativement (budget de réflexion Anthropic / reasoning effort Responses). thinkingFormat / supportsReasoningEffort sont propres à openai-completions et n'apparaissent qu'une fois le modèle déclaré réflexif sur ce protocole.",
511
+ "card.capabilities.staleCompat": "champs propres à openai-completions qu une version antérieure a forcés sur cette ligne de modèle",
512
+ "card.capabilities.stripStaleCompat": "Supprimer ces résidus",
498
513
  "card.dsContextTitle": "Fenêtres de contexte DeepSeek officielles",
499
514
  "input.effort.default": "Valeur par défaut du fournisseur",
500
515
  "input.effort.reset": "Restaurer la valeur par défaut du fournisseur",
@@ -592,7 +607,10 @@ window.__ModuleLoader__.load({
592
607
  "panel.search.placeholder": "Modelle suchen…",
593
608
  "card.takeoverUi": "Modell-UI-Übernahme",
594
609
  "card.takeoverUiHint": "Ein: dieses Plugin ersetzt die Modellauswahl des Composers durch ein eigenes Panel (Kontext-/Stufen-Editoren je Zeile + Suche). Aus (Standard): die offizielle Popup bleibt — die auto-Stufe erscheint weiterhin; Suche und Laden übernimmt der mitgelieferte Wähler. Änderungen wirken sofort — neu laden ist nicht nötig.",
595
- "card.capabilities.apiUnsupported": "Dieser Provider nutzt ein anderes Protokoll als openai-completions: die Thinking-Kompatibilitätsfelder werden von pi-ai nativ behandelt und sind hier nicht konfigurierbar.",
610
+ "card.capabilities.apiUnsupported": "Dieser Provider nutzt ein anderes Protokoll als openai-completions: thinkingFormat / supportsReasoningEffort sind openai-completions-exklusive Felder und werden hier nicht angeboten (eine Schreiboperation damit wird vom Host als Ganzes abgelehnt). Der Thinking-Schalter ist nicht betroffen: er schreibt protokollneutral reasoningEfforts, die pi-ai protokollweit nativ übersetzt.",
611
+ "card.capabilities.thinkingNative": "Der Thinking-Schalter ist auf jedem Protokoll verfügbar: er schreibt protokollneutral reasoningEfforts, die pi-ai nativ übersetzt (Anthropic-Thinking-Budget / Responses reasoning effort). thinkingFormat / supportsReasoningEffort sind openai-completions-exklusiv und erscheinen erst, wenn das Modell auf diesem Protokoll als Thinking-Modell deklariert ist.",
612
+ "card.capabilities.staleCompat": "openai-completions-exklusive Felder, die eine ältere Version in diese Modellzeile gezwungen hat",
613
+ "card.capabilities.stripStaleCompat": "Diese Reste entfernen",
596
614
  "card.dsContextTitle": "Kontextfenster der offiziellen DeepSeek-Modelle",
597
615
  "input.effort.default": "Anbieterstandard",
598
616
  "input.effort.reset": "Auf Anbieterstandard zurücksetzen",
@@ -690,7 +708,10 @@ window.__ModuleLoader__.load({
690
708
  "panel.search.placeholder": "Cerca modelli…",
691
709
  "card.takeoverUi": "Sostituzione UI modello",
692
710
  "card.takeoverUiHint": "Se attivo, questo plugin sostituisce il selettore modelli del compositore con un pannello proprio (editor contesto/livello per riga + ricerca). Se spento (predefinito) resta il popup ufficiale: il livello auto è comunque visibile, ricerca e caricamento sono a carico del selettore originale. La modifica ha effetto immediato, senza ricaricare.",
693
- "card.capabilities.apiUnsupported": "Questo provider usa un protocollo diverso da openai-completions: i campi di compatibilità thinking sono gestiti nativamente da pi-ai e non sono configurabili qui.",
711
+ "card.capabilities.apiUnsupported": "Questo provider usa un protocollo diverso da openai-completions: thinkingFormat / supportsReasoningEffort sono campi esclusivi di openai-completions e qui non vengono offerti (una scrittura che li contiene viene rifiutata in blocco dall host). L interruttore thinking non è interessato: scrive reasoningEfforts, neutro rispetto al protocollo, che pi-ai traduce nativamente.",
712
+ "card.capabilities.thinkingNative": "L interruttore thinking è disponibile su ogni protocollo: scrive reasoningEfforts, neutro rispetto al protocollo, che pi-ai traduce nativamente (budget thinking Anthropic / reasoning effort Responses). thinkingFormat / supportsReasoningEffort sono esclusivi di openai-completions e compaiono solo dopo che il modello è dichiarato thinking su quel protocollo.",
713
+ "card.capabilities.staleCompat": "campi esclusivi di openai-completions che una versione precedente ha forzato su questa riga di modello",
714
+ "card.capabilities.stripStaleCompat": "Rimuovi questi residui",
694
715
  "card.dsContextTitle": "Finestra di contesto dei modelli DeepSeek ufficiali",
695
716
  "input.effort.default": "Predefinito del provider",
696
717
  "input.effort.reset": "Ripristina il predefinito del provider",
@@ -788,7 +809,10 @@ window.__ModuleLoader__.load({
788
809
  "panel.search.placeholder": "Поиск моделей…",
789
810
  "card.takeoverUi": "Перехват UI модели",
790
811
  "card.takeoverUiHint": "Включено: этот плагин заменяет выбор модели в композиторе собственной панелью (редакторы контекста/уровня в строках + поиск). Выключено (по умолчанию) остаётся официальное popup-окно — уровень auto по-прежнему виден, поиск и загрузка обеспечиваются штатным селектором. Изменения применяются сразу, без перезагрузки.",
791
- "card.capabilities.apiUnsupported": "Этот провайдер использует протокол, отличный от openai-completions: поля совместимости thinking обрабатываются pi-ai нативно и здесь не настраиваются.",
812
+ "card.capabilities.apiUnsupported": "Этот провайдер использует протокол, отличный от openai-completions: thinkingFormat / supportsReasoningEffort доступны только на openai-completions и здесь не предлагаются (запись с ними отклоняется хостом целиком). Переключатель thinking не затронут: он пишет протоколонезависимый reasoningEfforts, который pi-ai транслирует нативно.",
813
+ "card.capabilities.thinkingNative": "Переключатель thinking доступен на всех протоколах: он пишет протоколонезависимый reasoningEfforts, который pi-ai транслирует нативно (бюджет thinking Anthropic / reasoning effort Responses). thinkingFormat / supportsReasoningEffort доступны только на openai-completions и появляются лишь после того, как модель объявлена thinking на этом протоколе.",
814
+ "card.capabilities.staleCompat": "поля, доступные только на openai-completions, которые старая версия принудительно записала в эту строку модели",
815
+ "card.capabilities.stripStaleCompat": "Удалить эти остатки",
792
816
  "card.dsContextTitle": "Лимиты контекста официальных моделей DeepSeek",
793
817
  "input.effort.default": "Значение провайдера по умолчанию",
794
818
  "input.effort.reset": "Вернуть значение провайдера по умолчанию",
@@ -886,7 +910,10 @@ window.__ModuleLoader__.load({
886
910
  "panel.search.placeholder": "Buscar modelos…",
887
911
  "card.takeoverUi": "Relevo de la UI de modelo",
888
912
  "card.takeoverUiHint": "Si está activo, este plugin sustituye el selector de modelos del compositor por un panel propio (editores de contexto/nivel por línea + búsqueda). Si está desactivado (predeterminado) se mantiene el popup oficial: el nivel auto sigue apareciendo y la búsqueda y la carga corresponden al selector nativo. El cambio se aplica de inmediato, sin recargar.",
889
- "card.capabilities.apiUnsupported": "Este proveedor usa un protocolo distinto de openai-completions: los campos de compatibilidad de thinking los gestiona pi-ai de forma nativa y no son configurables aquí.",
913
+ "card.capabilities.apiUnsupported": "Este proveedor usa un protocolo distinto de openai-completions: thinkingFormat / supportsReasoningEffort son campos exclusivos de openai-completions y aquí no se ofrecen (una escritura que los lleve es rechazada en bloque por el host). El interruptor de thinking no se ve afectado: escribe reasoningEfforts, neutral respecto al protocolo, que pi-ai traduce de forma nativa.",
914
+ "card.capabilities.thinkingNative": "El interruptor de thinking está disponible en todos los protocolos: escribe reasoningEfforts, neutral respecto al protocolo, que pi-ai traduce de forma nativa (presupuesto de thinking de Anthropic / reasoning effort de Responses). thinkingFormat / supportsReasoningEffort son exclusivos de openai-completions y solo aparecen cuando el modelo se declara de thinking en ese protocolo.",
915
+ "card.capabilities.staleCompat": "campos exclusivos de openai-completions que una versión anterior forzó en esta fila de modelo",
916
+ "card.capabilities.stripStaleCompat": "Eliminar estos restos",
890
917
  "card.dsContextTitle": "Ventana de contexto de los modelos DeepSeek oficiales",
891
918
  "input.effort.default": "Predeterminado del proveedor",
892
919
  "input.effort.reset": "Restaurar el valor predeterminado del proveedor",
@@ -3478,17 +3505,116 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3478
3505
  } : base;
3479
3506
  }
3480
3507
  /**
3481
- * Whether the model-level thinking-compat fields (`compat.thinkingFormat`,
3482
- * `compat.supportsReasoningEffort`) may be written for this entry's provider
3483
- * (issue #2): the host llm-pi-ai gate offers them ONLY on the
3484
- * openai-completions protocol — a Responses route carrying them fails the
3485
- * WHOLE providers write (`not configurable here`). An absent `api` keeps
3486
- * pi-ai's openai-completions default, so the row stays editable.
3487
- * (exported for the gate's unit regression, issue #2)
3508
+ * Whether this entry's wire protocol takes the model-level
3509
+ * openai-completions compat fields (`compat.thinkingFormat`,
3510
+ * `compat.supportsReasoningEffort`). The host llm-pi-ai gate (`COMPAT_GATES`)
3511
+ * offers them ONLY on openai-completions, and a MODEL-level write carrying one
3512
+ * on a Responses/Anthropic route fails the WHOLE providers payload
3513
+ * (`not configurable here`). An absent `api` keeps pi-ai's
3514
+ * openai-completions default, so the row stays editable.
3515
+ *
3516
+ * Scoped to the FIELD, never to thinking: the thinking DECLARATION
3517
+ * (`reasoningEfforts`) is protocol-neutral and stays editable everywhere — a
3518
+ * non-completions route merely must not carry the completions-only compat
3519
+ * fields alongside it (issue #6).
3520
+ * (exported for the gate's unit regression, issues #2/#6)
3488
3521
  */
3489
- function effortCompatConfigurable(entry) {
3522
+ function completionsCompatConfigurable(entry) {
3490
3523
  return typeof entry.providerApi !== "string" || entry.providerApi === "openai-completions";
3491
3524
  }
3525
+ /**
3526
+ * Write the Thinking checkbox's declaration onto ONE model row (the caller
3527
+ * hands the row inside its cloned providers payload). Protocol-aware on
3528
+ * purpose (issue #6):
3529
+ *
3530
+ * - `reasoningEfforts` is protocol-NEUTRAL: the host llm-pi-ai resolves it to
3531
+ * `reasoning: true` + `thinkingLevelMap` for every wire protocol, and pi-ai
3532
+ * then maps the levels natively (Anthropic thinking budget, Responses
3533
+ * reasoning effort). Thinking is therefore declarable on all three protocol
3534
+ * families — it is the prerequisite of the effort selector.
3535
+ * - the `off` wire value is where the protocols DIVERGE. `off: null` marks the
3536
+ * level unsupported to pi-ai (`getSupportedThinkingLevels` drops it), which
3537
+ * is the completions transport's "send nothing" toggle — fine there, but on
3538
+ * a pi-ai-served route it would leave thinking un-turn-off-able. A
3539
+ * non-completions route therefore keeps `off` SELECTABLE with the
3540
+ * providers' own "no reasoning" token: Anthropic only needs it non-null
3541
+ * (`thinking: {type:'disabled'}`), Responses sends `effort: 'none'`.
3542
+ * - the qwen `thinkingFormat` autofill is an openai-completions-ONLY compat
3543
+ * field: writing it on a Responses/Anthropic route makes the host reject the
3544
+ * whole providers payload, so it is skipped there and the format simply
3545
+ * stays inherited.
3546
+ * @param entry - the capability entry whose provider protocol decides the gate.
3547
+ * @param row - the model row to mutate.
3548
+ * @param next - the new Thinking state.
3549
+ */
3550
+ function writeThinkingRow(entry, row, next) {
3551
+ if (!next) {
3552
+ row["reasoningEfforts"] = false;
3553
+ return;
3554
+ }
3555
+ const effortCapable = supportsEffortOf(row);
3556
+ const completions = completionsCompatConfigurable(entry);
3557
+ if (effortCapable) row["reasoningEfforts"] = effortTableOf({ high: "high" });
3558
+ else if (completions) row["reasoningEfforts"] = {
3559
+ off: null,
3560
+ high: "high"
3561
+ };
3562
+ else row["reasoningEfforts"] = {
3563
+ off: "none",
3564
+ high: "high"
3565
+ };
3566
+ if (!effortCapable && completions) patchCompat(row, (compat) => {
3567
+ if (compat["thinkingFormat"] === void 0) compat["thinkingFormat"] = "qwen-chat-template";
3568
+ });
3569
+ }
3570
+ /**
3571
+ * The two compat switches that exist ONLY on the openai-completions protocol.
3572
+ * Both are model-level writes; on any other protocol the host's
3573
+ * `resolveModelCompat` refuses the entry and fails the WHOLE providers payload
3574
+ * (`model "x" sets compat "…", but its api is "…", which does not take it`).
3575
+ */
3576
+ const THINKING_COMPAT_FIELDS = ["thinkingFormat", "supportsReasoningEffort"];
3577
+ /**
3578
+ * The openai-completions-only compat fields an entry's OWN model row still
3579
+ * carries while its route speaks another protocol — i.e. leftovers from a
3580
+ * version that offered those switches on every route (4.4.0–4.4.2), or a
3581
+ * hand-edited `cordis.yml`. They are a hard write blocker: the next save of
3582
+ * ANY model switch on this route fails wholesale until they are removed.
3583
+ *
3584
+ * This is the "split the force-written format out and check it" half of issue
3585
+ * #7: the fields are no longer offered on such routes, so what remains is
3586
+ * exactly this audit + one-click cleanup.
3587
+ * @param entry - the capability entry (model row + its route's protocol).
3588
+ * @returns the offending field names, in {@link THINKING_COMPAT_FIELDS} order.
3589
+ */
3590
+ function staleThinkingCompatFields(entry) {
3591
+ if (completionsCompatConfigurable(entry)) return [];
3592
+ const own = entry.model["compat"];
3593
+ if (typeof own !== "object" || own === null || Array.isArray(own)) return [];
3594
+ const compat = own;
3595
+ return THINKING_COMPAT_FIELDS.filter((field) => compat[field] !== void 0);
3596
+ }
3597
+ /**
3598
+ * Remove those leftovers from ONE model row, returning what was removed (empty
3599
+ * when the row was already clean, so the caller can skip the write). Sibling
3600
+ * compat fields survive; an emptied compat object is deleted rather than left
3601
+ * as `{}`.
3602
+ * @param entry - the capability entry whose protocol decides what is stale.
3603
+ * @param row - the model row to mutate.
3604
+ * @returns the removed field names.
3605
+ */
3606
+ function stripThinkingCompat(entry, row) {
3607
+ const removed = staleThinkingCompatFields({
3608
+ ...entry,
3609
+ model: row
3610
+ });
3611
+ if (removed.length === 0) return [];
3612
+ const compat = { ...row["compat"] };
3613
+ for (const field of removed) delete compat[field];
3614
+ if (Object.keys(compat).length === 0) delete row["compat"];
3615
+ else row["compat"] = compat;
3616
+ return removed;
3617
+ }
3492
3618
  /** Flatten the user-layer providers into capability entries (models arrays only). */
3493
3619
  function entriesOf(providers) {
3494
3620
  return Object.entries(providers).flatMap(([providerId, profile]) => {
@@ -3761,23 +3887,24 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3761
3887
  return current;
3762
3888
  });
3763
3889
  };
3764
- /** Toggle whether a model is a thinking model (reasoningEfforts table vs false). */
3890
+ /**
3891
+ * Toggle whether a model is a thinking model (`reasoningEfforts` table vs
3892
+ * false). Delegates the row patch to {@link writeThinkingRow}: thinking is
3893
+ * declared on every protocol, only the completions-only format autofill is
3894
+ * protocol-gated.
3895
+ */
3765
3896
  const toggleThinking = (entry, next) => {
3766
- patchModel(entry.providerId, entry.index, (row) => {
3767
- if (next) {
3768
- const effortCapable = supportsEffortOf(row);
3769
- row["reasoningEfforts"] = effortCapable ? effortTableOf({ high: "high" }) : {
3770
- off: null,
3771
- high: "high"
3772
- };
3773
- if (!effortCapable) patchCompat(row, (compat) => {
3774
- if (compat["thinkingFormat"] === void 0) compat["thinkingFormat"] = "qwen-chat-template";
3775
- });
3776
- } else row["reasoningEfforts"] = false;
3777
- });
3897
+ patchModel(entry.providerId, entry.index, (row) => writeThinkingRow(entry, row, next));
3778
3898
  };
3779
- /** Toggle whether a model accepts reasoning_effort levels. */
3899
+ /**
3900
+ * Toggle whether a model accepts reasoning_effort levels.
3901
+ *
3902
+ * openai-completions only, by construction: the checkbox is no longer
3903
+ * rendered anywhere else (issue #7), so this writer can never be reached with
3904
+ * a route whose protocol would refuse the field.
3905
+ */
3780
3906
  const toggleEffortCapable = (entry, next) => {
3907
+ if (!completionsCompatConfigurable(entry)) return;
3781
3908
  patchModel(entry.providerId, entry.index, (row) => {
3782
3909
  patchCompat(row, (compat) => {
3783
3910
  compat["supportsReasoningEffort"] = next;
@@ -3785,6 +3912,33 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3785
3912
  });
3786
3913
  });
3787
3914
  };
3915
+ /** Remove the completions-only compat leftovers from one model row (issue
3916
+ * #7's cleanup half). The audit lives in {@link staleThinkingCompatFields};
3917
+ * this is the one-click repair, and it is a no-op when the row is already
3918
+ * clean. */
3919
+ const stripStaleCompat = (entry) => {
3920
+ patchModel(entry.providerId, entry.index, (row) => {
3921
+ stripThinkingCompat(entry, row);
3922
+ });
3923
+ };
3924
+ /**
3925
+ * Sweep every stale row in one providers write (card-level audit button).
3926
+ * One write instead of N: the host validates the whole payload, so a
3927
+ * half-cleaned section could still be refused by a row the sweep had not
3928
+ * reached yet.
3929
+ */
3930
+ const stripAllStaleCompat = () => {
3931
+ commitProviders((current) => {
3932
+ for (const entry of entriesOf(current)) {
3933
+ const profile = current[entry.providerId];
3934
+ if (profile === void 0 || !Array.isArray(profile.models)) continue;
3935
+ const row = profile.models[entry.index];
3936
+ if (typeof row !== "object" || row === null) continue;
3937
+ stripThinkingCompat(entry, row);
3938
+ }
3939
+ return current;
3940
+ });
3941
+ };
3788
3942
  /** Apply one model's wire draft as its `reasoningEfforts` table. */
3789
3943
  const applyDraft = (entry) => {
3790
3944
  const key = entryKey(entry);
@@ -3793,6 +3947,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3793
3947
  const table = effortTableOf(draft);
3794
3948
  patchModel(entry.providerId, entry.index, (row) => {
3795
3949
  row["reasoningEfforts"] = table;
3950
+ if (!completionsCompatConfigurable(entry)) return;
3796
3951
  const extended = Object.keys(table).some((level) => level !== "off" && level !== "on" && level !== "high");
3797
3952
  if (supportsEffortOf(row) || extended) patchCompat(row, (compat) => {
3798
3953
  compat["supportsReasoningEffort"] = true;
@@ -3924,6 +4079,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3924
4079
  const needle = query.trim().toLowerCase();
3925
4080
  const visible = needle === "" ? allEntries : allEntries.filter((entry) => entry.modelId.toLowerCase().includes(needle) || entry.providerId.toLowerCase().includes(needle));
3926
4081
  const providerIds = [...new Set(visible.map((entry) => entry.providerId))];
4082
+ const staleEntries = allEntries.filter((entry) => staleThinkingCompatFields(entry).length > 0);
3927
4083
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3928
4084
  style: sectionStyle,
3929
4085
  children: [
@@ -3945,6 +4101,31 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3945
4101
  role: "status",
3946
4102
  children: ["⚠ ", writeError]
3947
4103
  }),
4104
+ staleEntries.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4105
+ style: { margin: "4px 0 6px" },
4106
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
4107
+ style: {
4108
+ ...hintStyle,
4109
+ color: "var(--dsw-alias-warning, #b7791f)"
4110
+ },
4111
+ children: [
4112
+ t("card.capabilities.staleCompat"),
4113
+ ": ",
4114
+ staleEntries.length,
4115
+ " / ",
4116
+ allEntries.length
4117
+ ]
4118
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4119
+ type: "button",
4120
+ disabled: readonly || busy,
4121
+ onClick: stripAllStaleCompat,
4122
+ style: {
4123
+ ...controlStyle,
4124
+ cursor: readonly || busy ? "default" : "pointer"
4125
+ },
4126
+ children: t("card.capabilities.stripStaleCompat")
4127
+ })]
4128
+ }),
3948
4129
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3949
4130
  style: {
3950
4131
  display: "flex",
@@ -4051,7 +4232,9 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4051
4232
  const thinking = typeof effortsOf(entry.model) === "object";
4052
4233
  const compat = compatOf(entry);
4053
4234
  const supportsEffort = compat["supportsReasoningEffort"] === true;
4054
- const apiGated = !effortCompatConfigurable(entry);
4235
+ const compatGated = !completionsCompatConfigurable(entry);
4236
+ const compatOffered = thinking && !compatGated;
4237
+ const stale = staleThinkingCompatFields(entry);
4055
4238
  const meta = summaryOf(entry);
4056
4239
  const format = typeof compat["thinkingFormat"] === "string" ? compat["thinkingFormat"] : void 0;
4057
4240
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -4118,10 +4301,33 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4118
4301
  borderTop: "1px solid var(--dsw-alias-border-l2)"
4119
4302
  },
4120
4303
  children: [
4121
- apiGated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4304
+ compatGated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4122
4305
  style: hintStyle,
4123
4306
  children: t("card.capabilities.apiUnsupported")
4124
4307
  }),
4308
+ stale.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4309
+ style: { margin: "0 0 8px" },
4310
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
4311
+ style: {
4312
+ ...hintStyle,
4313
+ color: "var(--dsw-alias-warning, #b7791f)"
4314
+ },
4315
+ children: [
4316
+ t("card.capabilities.staleCompat"),
4317
+ ": ",
4318
+ stale.join(", ")
4319
+ ]
4320
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4321
+ type: "button",
4322
+ disabled: readonly || busy,
4323
+ onClick: () => stripStaleCompat(entry),
4324
+ style: {
4325
+ ...controlStyle,
4326
+ cursor: readonly || busy ? "default" : "pointer"
4327
+ },
4328
+ children: t("card.capabilities.stripStaleCompat")
4329
+ })]
4330
+ }),
4125
4331
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4126
4332
  style: {
4127
4333
  display: "flex",
@@ -4137,11 +4343,11 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4137
4343
  gap: "6px",
4138
4344
  fontSize: "12px"
4139
4345
  },
4140
- title: apiGated ? t("card.capabilities.apiUnsupported") : void 0,
4346
+ title: compatGated ? t("card.capabilities.thinkingNative") : void 0,
4141
4347
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4142
4348
  type: "checkbox",
4143
4349
  checked: thinking,
4144
- disabled: readonly || busy || apiGated,
4350
+ disabled: readonly || busy,
4145
4351
  onChange: (event) => toggleThinking(entry, event.currentTarget.checked)
4146
4352
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.thinking") })]
4147
4353
  }),
@@ -4181,7 +4387,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4181
4387
  }, modality))
4182
4388
  ]
4183
4389
  }),
4184
- thinking ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4390
+ compatOffered ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4185
4391
  style: {
4186
4392
  display: "inline-flex",
4187
4393
  alignItems: "center",
@@ -4189,15 +4395,14 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4189
4395
  fontSize: "12px",
4190
4396
  margin: "0 0 8px"
4191
4397
  },
4192
- title: apiGated ? t("card.capabilities.apiUnsupported") : void 0,
4193
4398
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4194
4399
  type: "checkbox",
4195
4400
  checked: supportsEffort,
4196
- disabled: readonly || busy || apiGated,
4401
+ disabled: readonly || busy,
4197
4402
  onChange: (event) => toggleEffortCapable(entry, event.currentTarget.checked)
4198
4403
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.supportsEffort") })]
4199
4404
  }) : null,
4200
- thinking && supportsEffort ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4405
+ thinking && (!compatOffered || supportsEffort) ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4201
4406
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4202
4407
  style: fieldLabelStyle,
4203
4408
  children: t("card.capabilities.efforts")
@@ -4288,7 +4493,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4288
4493
  })]
4289
4494
  })
4290
4495
  ] }) : null,
4291
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4496
+ compatOffered && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4292
4497
  style: {
4293
4498
  display: "flex",
4294
4499
  gap: "16px",
@@ -4303,8 +4508,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4303
4508
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
4304
4509
  style: controlStyle,
4305
4510
  value: format ?? "inherit",
4306
- disabled: readonly || busy || apiGated,
4307
- title: apiGated ? t("card.capabilities.apiUnsupported") : void 0,
4511
+ disabled: readonly || busy,
4308
4512
  onChange: (event) => {
4309
4513
  const next = event.currentTarget.value;
4310
4514
  patchModel(entry.providerId, entry.index, (row) => {