dsh-thinking-levels 4.3.3 → 4.4.1

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
@@ -99,6 +99,11 @@ window.__ModuleLoader__.load({
99
99
  "model.panel.noTarget": "该模型没有可写的配置项",
100
100
  "model.panel.unavailable": "当前会话的模型目录不可用",
101
101
  "input.effort.title": "思考强度",
102
+ "panel.search.placeholder": "搜索模型…",
103
+ "card.takeoverUi": "模型界面接管",
104
+ "card.takeoverUiHint": "开启后由本插件重绘输入框的模型选择面板(含每行上下文/档位编辑与搜索);关闭(默认)保留官方模型弹窗——auto 档位照常出现,搜索与加载由官方界面负责。切换即时生效,无需重载。",
105
+ "card.capabilities.apiUnsupported": "该提供方使用非 openai-completions 协议:思考兼容字段由宿主 pi-ai 原生处理,此处不可配置。",
106
+ "card.dsContextTitle": "官方 DeepSeek 模型上下文上限",
102
107
  "input.effort.default": "提供方默认",
103
108
  "input.effort.reset": "恢复提供方默认",
104
109
  "card.capabilities.failed": "保存失败:配置被拒绝或冲突,请检查值。"
@@ -192,6 +197,11 @@ window.__ModuleLoader__.load({
192
197
  "model.panel.noTarget": "No writable config entry for this model",
193
198
  "model.panel.unavailable": "The model directory is unavailable for this session",
194
199
  "input.effort.title": "Reasoning effort",
200
+ "panel.search.placeholder": "Search models…",
201
+ "card.takeoverUi": "Model UI takeover",
202
+ "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.",
204
+ "card.dsContextTitle": "Official DeepSeek context windows",
195
205
  "input.effort.default": "Provider default",
196
206
  "input.effort.reset": "Restore provider default",
197
207
  "card.capabilities.failed": "Save failed: the value was rejected or conflicted. Check it."
@@ -285,6 +295,11 @@ window.__ModuleLoader__.load({
285
295
  "model.panel.noTarget": "このモデルには書き込み可能な設定項目がありません",
286
296
  "model.panel.unavailable": "このセッションのモデルディレクトリは利用できません",
287
297
  "input.effort.title": "思考レベル",
298
+ "panel.search.placeholder": "モデルを検索…",
299
+ "card.takeoverUi": "モデルUI引き継ぎ",
300
+ "card.takeoverUiHint": "ON にするとこのプラグインが入力欄のモデル選択を独自パネル(行別のコンテキスト/レベル編集+検索)に置き換えます。OFF(既定)では公式ポップアップが維持され、auto レベルは引き続き表示され、検索と読み込みは標準セレクタの役割です。変更は即時反映されます(再読み込み不要)。",
301
+ "card.capabilities.apiUnsupported": "このプロバイダーは openai-completions 以外のプロトコルを使用しています:思考互換フィールドは pi-ai がネイティブに処理するため、ここで設定できません。",
302
+ "card.dsContextTitle": "公式 DeepSeek モデルのコンテキスト上限",
288
303
  "input.effort.default": "プロバイダーの既定",
289
304
  "input.effort.reset": "プロバイダーの既定に戻す",
290
305
  "card.capabilities.failed": "保存に失敗しました:値が拒否されたか競合しています。確認してください。"
@@ -378,6 +393,11 @@ window.__ModuleLoader__.load({
378
393
  "model.panel.noTarget": "이 모델에는 쓰기 가능한 설정 항목이 없습니다",
379
394
  "model.panel.unavailable": "이 세션의 모델 디렉터리를 사용할 수 없습니다",
380
395
  "input.effort.title": "추론 강도",
396
+ "panel.search.placeholder": "모델 검색…",
397
+ "card.takeoverUi": "모델 UI 인수",
398
+ "card.takeoverUiHint": "켜면 이 플러그인이 입력창의 모델 선택을 자체 패널(행별 컨텍스트/레벨 편집 + 검색)로 대체합니다. 끄면(기본) 공식 팝업이 유지되며 auto 레벨은 계속 표시되고 검색과 로딩은 표준 셀렉터가 담당합니다. 변경이 즉시 반영됩니다(새로고침 불필요).",
399
+ "card.capabilities.apiUnsupported": "이 제공자는 openai-completions 이외 프로토콜을 사용합니다: 사고 호환 필드는 pi-ai가 네이티브로 처리하므로 여기서 설정할 수 없습니다.",
400
+ "card.dsContextTitle": "공식 DeepSeek 모델 컨텍스트 상한",
381
401
  "input.effort.default": "공급자 기본값",
382
402
  "input.effort.reset": "공급자 기본값으로 복원",
383
403
  "card.capabilities.failed": "저장 실패: 값이 거부되었거나 충돌합니다. 확인하세요."
@@ -471,6 +491,11 @@ window.__ModuleLoader__.load({
471
491
  "model.panel.noTarget": "Aucune entrée de configuration inscriptible pour ce modèle",
472
492
  "model.panel.unavailable": "Le répertoire de modèles est indisponible pour cette session",
473
493
  "input.effort.title": "Effort de raisonnement",
494
+ "panel.search.placeholder": "Rechercher des modèles…",
495
+ "card.takeoverUi": "Reprise de l'UI modèle",
496
+ "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.",
498
+ "card.dsContextTitle": "Fenêtres de contexte DeepSeek officielles",
474
499
  "input.effort.default": "Valeur par défaut du fournisseur",
475
500
  "input.effort.reset": "Restaurer la valeur par défaut du fournisseur",
476
501
  "card.capabilities.failed": "Échec de l'enregistrement : la valeur a été rejetée ou est en conflit. Vérifiez-la."
@@ -564,6 +589,11 @@ window.__ModuleLoader__.load({
564
589
  "model.panel.noTarget": "Kein beschreibbarer Konfigurationseintrag für dieses Modell",
565
590
  "model.panel.unavailable": "Das Modellverzeichnis ist für diese Sitzung nicht verfügbar",
566
591
  "input.effort.title": "Schlussfolgerungsaufwand",
592
+ "panel.search.placeholder": "Modelle suchen…",
593
+ "card.takeoverUi": "Modell-UI-Übernahme",
594
+ "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.",
596
+ "card.dsContextTitle": "Kontextfenster der offiziellen DeepSeek-Modelle",
567
597
  "input.effort.default": "Anbieterstandard",
568
598
  "input.effort.reset": "Auf Anbieterstandard zurücksetzen",
569
599
  "card.capabilities.failed": "Speichern fehlgeschlagen: Der Wert wurde abgelehnt oder steht in Konflikt. Bitte überprüfen."
@@ -657,6 +687,11 @@ window.__ModuleLoader__.load({
657
687
  "model.panel.noTarget": "Nessuna voce di configurazione scrivibile per questo modello",
658
688
  "model.panel.unavailable": "La directory dei modelli non è disponibile per questa sessione",
659
689
  "input.effort.title": "Sforzo di ragionamento",
690
+ "panel.search.placeholder": "Cerca modelli…",
691
+ "card.takeoverUi": "Sostituzione UI modello",
692
+ "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.",
694
+ "card.dsContextTitle": "Finestra di contesto dei modelli DeepSeek ufficiali",
660
695
  "input.effort.default": "Predefinito del provider",
661
696
  "input.effort.reset": "Ripristina il predefinito del provider",
662
697
  "card.capabilities.failed": "Salvataggio non riuscito: il valore è stato rifiutato o è in conflitto. Verifica."
@@ -750,6 +785,11 @@ window.__ModuleLoader__.load({
750
785
  "model.panel.noTarget": "Нет записываемой записи конфигурации для этой модели",
751
786
  "model.panel.unavailable": "Каталог моделей недоступен для этой сессии",
752
787
  "input.effort.title": "Усилие рассуждения",
788
+ "panel.search.placeholder": "Поиск моделей…",
789
+ "card.takeoverUi": "Перехват UI модели",
790
+ "card.takeoverUiHint": "Включено: этот плагин заменяет выбор модели в композиторе собственной панелью (редакторы контекста/уровня в строках + поиск). Выключено (по умолчанию) остаётся официальное popup-окно — уровень auto по-прежнему виден, поиск и загрузка обеспечиваются штатным селектором. Изменения применяются сразу, без перезагрузки.",
791
+ "card.capabilities.apiUnsupported": "Этот провайдер использует протокол, отличный от openai-completions: поля совместимости thinking обрабатываются pi-ai нативно и здесь не настраиваются.",
792
+ "card.dsContextTitle": "Лимиты контекста официальных моделей DeepSeek",
753
793
  "input.effort.default": "Значение провайдера по умолчанию",
754
794
  "input.effort.reset": "Вернуть значение провайдера по умолчанию",
755
795
  "card.capabilities.failed": "Ошибка сохранения: значение отклонено или конфликтует. Проверьте его."
@@ -843,6 +883,11 @@ window.__ModuleLoader__.load({
843
883
  "model.panel.noTarget": "No hay entrada de configuración escribible para este modelo",
844
884
  "model.panel.unavailable": "El directorio de modelos no está disponible para esta sesión",
845
885
  "input.effort.title": "Esfuerzo de razonamiento",
886
+ "panel.search.placeholder": "Buscar modelos…",
887
+ "card.takeoverUi": "Relevo de la UI de modelo",
888
+ "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í.",
890
+ "card.dsContextTitle": "Ventana de contexto de los modelos DeepSeek oficiales",
846
891
  "input.effort.default": "Predeterminado del proveedor",
847
892
  "input.effort.reset": "Restaurar el valor predeterminado del proveedor",
848
893
  "card.capabilities.failed": "Error al guardar: el valor fue rechazado o está en conflicto. Verifícalo."
@@ -2232,7 +2277,8 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2232
2277
  */
2233
2278
  /** The official DeepSeek provider route owned by the llm-deepseek adapter. */
2234
2279
  const DEEPSEEK_PROVIDER = "deepseek-official";
2235
- /** llm-deepseek's native default context capacity (DEFAULT_CONTEXT_WINDOW). */
2280
+ /** llm-deepseek's native default context capacity (DEFAULT_CONTEXT_WINDOW).
2281
+ * exported for the settings-card editor (4.4.0, takeoverUi off). */
2236
2282
  const DEEPSEEK_DEFAULT_WINDOW = 1e6;
2237
2283
  /** Slider stop an unset window parks on: the thumb needs a position, the readout stays "unset". */
2238
2284
  const UNSET_STOP_INDEX = CONTEXT_WINDOW_PRESETS.findIndex((preset) => preset.value === 256e3);
@@ -2250,6 +2296,21 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2250
2296
  current: null,
2251
2297
  error: null
2252
2298
  };
2299
+ /**
2300
+ * The absent-own-settings-scope snapshot: a module-level CONSTANT —
2301
+ * `useSyncExternalStore` demands a stable getSnapshot value, an inline
2302
+ * literal re-renders forever (the #185 pattern proven on the capability
2303
+ * card's transport face).
2304
+ */
2305
+ const TL_ABSENT_SNAPSHOT = Object.freeze({
2306
+ status: "unavailable",
2307
+ value: void 0,
2308
+ revision: void 0,
2309
+ writable: false,
2310
+ base: void 0,
2311
+ user: void 0,
2312
+ mode: "memory"
2313
+ });
2253
2314
  const rootStyle = {
2254
2315
  position: "relative",
2255
2316
  display: "inline-flex"
@@ -2551,10 +2612,20 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2551
2612
  * (the "max context window" editor moved into each line).
2552
2613
  * @param props - injected directory + config forms, session seat, copy.
2553
2614
  */
2554
- function ModelPanel({ directory, piAiScope, deepseekScope, t }) {
2615
+ function ModelPanel({ directory, piAiScope, deepseekScope, tlScope, sessionId, t }) {
2555
2616
  const state = (0, react.useSyncExternalStore)((listener) => directory?.store.subscribe(listener) ?? (() => {}), () => directory?.store.getSnapshot() ?? UNAVAILABLE_STATE);
2556
2617
  const piSnapshot = (0, react.useSyncExternalStore)((listener) => piAiScope.subscribe(listener), () => piAiScope.getSnapshot());
2557
2618
  const dsSnapshot = (0, react.useSyncExternalStore)((listener) => deepseekScope.subscribe(listener), () => deepseekScope.getSnapshot());
2619
+ const tlSnapshot = (0, react.useSyncExternalStore)((listener) => tlScope?.subscribe(listener) ?? (() => {}), () => tlScope === void 0 ? TL_ABSENT_SNAPSHOT : tlScope.getSnapshot());
2620
+ /** The configured default level: the chip's user-intent fallback (issue #5). */
2621
+ const configLevel = (tlSnapshot.status === "ready" ? tlSnapshot.value?.level : void 0) ?? "auto";
2622
+ /**
2623
+ * The effort explicitly picked in THIS mount — the authoritative intent
2624
+ * until the session changes (issue #5). The directory's merged `current`
2625
+ * cannot tell a persisted `auto` pending from a scheduler-resolved wire
2626
+ * level apart; a local pick can, so it wins whenever it exists.
2627
+ */
2628
+ const selectedEffortRef = (0, react.useRef)(void 0);
2558
2629
  const [open, setOpen] = (0, react.useState)(false);
2559
2630
  const [expanded, setExpanded] = (0, react.useState)(() => /* @__PURE__ */ new Set());
2560
2631
  const [editing, setEditing] = (0, react.useState)(null);
@@ -2563,15 +2634,20 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2563
2634
  const [raw, setRaw] = (0, react.useState)("");
2564
2635
  const [error, setError] = (0, react.useState)(null);
2565
2636
  const [busy, setBusy] = (0, react.useState)(false);
2637
+ const [query, setQuery] = (0, react.useState)("");
2566
2638
  const rootRef = (0, react.useRef)(null);
2567
2639
  (0, react.useEffect)(() => {
2568
2640
  if (!open) return;
2569
2641
  directory?.load().catch(() => {});
2570
2642
  }, [directory, open]);
2643
+ (0, react.useEffect)(() => {
2644
+ selectedEffortRef.current = void 0;
2645
+ }, [sessionId]);
2571
2646
  const close = (0, react.useCallback)(() => {
2572
2647
  setOpen(false);
2573
2648
  setEditing(null);
2574
2649
  setError(null);
2650
+ setQuery("");
2575
2651
  }, []);
2576
2652
  (0, react.useEffect)(() => {
2577
2653
  if (!open) return;
@@ -2598,6 +2674,12 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2598
2674
  }, [state]);
2599
2675
  const providers = (0, react.useMemo)(() => providersOf$1(piSnapshot), [piSnapshot]);
2600
2676
  const dsSection = (0, react.useMemo)(() => deepseekSectionOf(dsSnapshot), [dsSnapshot]);
2677
+ const needle = query.trim().toLowerCase();
2678
+ const showSearch = (0, react.useMemo)(() => state.groups.reduce((count, group) => count + group.models.length, 0), [state.groups]) > 4;
2679
+ const visibleGroups = (0, react.useMemo)(() => needle === "" ? state.groups : state.groups.map((group) => ({
2680
+ ...group,
2681
+ models: group.models.filter((model) => model.name.toLowerCase().includes(needle) || model.id.toLowerCase().includes(needle))
2682
+ })).filter((group) => group.models.length > 0), [state.groups, needle]);
2601
2683
  /** The effective window of one model line, resolved against its family.
2602
2684
  * Declared BEFORE activeWindow: the ring's window-fallback memo calls this
2603
2685
  * in its factory, and a const arrow below the first caller would be a
@@ -2723,6 +2805,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2723
2805
  const chooseEffort = (provider, model, effort) => {
2724
2806
  if (busy || directory === void 0) return;
2725
2807
  setBusy(true);
2808
+ selectedEffortRef.current = effort === "" ? void 0 : effort;
2726
2809
  directory.select({
2727
2810
  provider,
2728
2811
  model,
@@ -2735,8 +2818,12 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2735
2818
  };
2736
2819
  const triggerLabel = current?.name ?? state.current?.model ?? t("model.panel.choose");
2737
2820
  const currentReasoning = current?.model.reasoning;
2738
- const effectiveEffort = state.current?.reasoningEffort ?? currentReasoning?.defaultEffort;
2739
- const effortLabel = currentReasoning === void 0 ? void 0 : effectiveEffort === void 0 ? t("input.effort.default") : currentReasoning.efforts.find((level) => level.id === effectiveEffort)?.name ?? effectiveEffort;
2821
+ const resolvedEffort = state.current?.reasoningEffort;
2822
+ const autoAdvertised = currentReasoning?.efforts.some((effort) => effort.id === "auto") === true;
2823
+ const intentEffort = selectedEffortRef.current ?? (resolvedEffort === "auto" || autoAdvertised && configLevel === "auto" ? "auto" : resolvedEffort ?? currentReasoning?.defaultEffort);
2824
+ const effortName = (id) => currentReasoning?.efforts.find((level) => level.id === id)?.name ?? id;
2825
+ const effortLabel = currentReasoning === void 0 ? void 0 : intentEffort === void 0 ? t("input.effort.default") : effortName(intentEffort);
2826
+ const resolvedHint = currentReasoning !== void 0 && intentEffort === "auto" && resolvedEffort !== void 0 && resolvedEffort !== "auto" ? `→ ${effortName(resolvedEffort)}` : void 0;
2740
2827
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2741
2828
  ref: rootRef,
2742
2829
  style: rootStyle,
@@ -2764,6 +2851,10 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2764
2851
  style: triggerEffortStyle,
2765
2852
  children: effortLabel
2766
2853
  }),
2854
+ resolvedHint !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2855
+ style: triggerEffortStyle,
2856
+ children: resolvedHint
2857
+ }),
2767
2858
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2768
2859
  style: chevronStyle,
2769
2860
  children: open ? "▲" : "▼"
@@ -2778,243 +2869,263 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2778
2869
  style: popStyle,
2779
2870
  role: "dialog",
2780
2871
  "aria-label": t("model.panel.choose"),
2781
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2782
- style: modelsStyle,
2783
- children: [
2784
- directory === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2785
- style: statusStyle,
2786
- children: t("model.panel.unavailable")
2787
- }),
2788
- directory !== void 0 && state.status === "loading" && state.groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2789
- style: statusStyle,
2790
- children: t("model.panel.loading")
2791
- }),
2792
- directory !== void 0 && state.groups.map((group) => {
2793
- const isExpanded = expanded.has(group.id);
2794
- const name = group.name ?? group.label ?? group.id;
2795
- const activeModel = state.current?.provider === group.id ? state.current.model : void 0;
2796
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2797
- type: "button",
2798
- style: providerToggleStyle,
2799
- "aria-expanded": isExpanded,
2800
- onClick: () => toggleProvider(group.id),
2801
- children: [
2802
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2803
- style: providerNameStyle$1,
2804
- children: name
2805
- }),
2806
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2807
- style: providerMetaStyle,
2808
- children: group.models.length
2809
- }),
2810
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2811
- style: chevronStyle,
2812
- children: isExpanded ? "▼" : "▶"
2813
- })
2814
- ]
2815
- }), isExpanded && group.models.map((model) => {
2816
- const active = activeModel === model.id;
2817
- const lineWritable = writableLine(group.id, model.id);
2818
- const lineWindow = windowOf(group.id, model.id);
2819
- const isContextEditing = editing !== null && editing.provider === group.id && editing.model === model.id && editing.kind === "context";
2820
- const isEffortEditing = editing !== null && editing.provider === group.id && editing.model === model.id && editing.kind === "effort";
2821
- const lineEffort = active ? state.current?.reasoningEffort ?? model.reasoning?.defaultEffort : model.reasoning?.defaultEffort;
2822
- const lineStops = model.reasoning === void 0 ? [] : orderEffortsForSlider(model.reasoning.efforts);
2823
- const lineEffortName = lineEffort === void 0 ? t("input.effort.default") : lineStops.find((stop) => stop.id === lineEffort)?.name ?? lineEffort;
2824
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2825
- style: active ? modelRowActiveStyle : modelRowStyle$1,
2872
+ children: [
2873
+ showSearch && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2874
+ type: "text",
2875
+ value: query,
2876
+ placeholder: t("panel.search.placeholder"),
2877
+ "aria-label": t("panel.search.placeholder"),
2878
+ style: {
2879
+ ...inputStyle,
2880
+ width: "100%",
2881
+ boxSizing: "border-box",
2882
+ margin: "2px 0 6px"
2883
+ },
2884
+ onChange: (event) => setQuery(event.currentTarget.value)
2885
+ }),
2886
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2887
+ style: modelsStyle,
2888
+ children: [
2889
+ directory === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2890
+ style: statusStyle,
2891
+ children: t("model.panel.unavailable")
2892
+ }),
2893
+ directory !== void 0 && state.status === "loading" && state.groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2894
+ style: statusStyle,
2895
+ children: t("model.panel.loading")
2896
+ }),
2897
+ directory !== void 0 && visibleGroups.map((group) => {
2898
+ const isExpanded = needle !== "" || expanded.has(group.id);
2899
+ const name = group.name ?? group.label ?? group.id;
2900
+ const activeModel = state.current?.provider === group.id ? state.current.model : void 0;
2901
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2902
+ type: "button",
2903
+ style: providerToggleStyle,
2904
+ "aria-expanded": isExpanded,
2905
+ onClick: () => toggleProvider(group.id),
2826
2906
  children: [
2827
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2828
- type: "button",
2829
- role: "option",
2830
- "aria-selected": active,
2831
- style: modelPickStyle,
2832
- disabled: busy,
2833
- onClick: () => chooseModel(group.id, model.id),
2834
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2835
- style: modelCopyStyle,
2836
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2837
- style: modelNameStyle,
2838
- children: model.name
2839
- })
2840
- }), active && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2841
- style: checkStyle,
2842
- "aria-hidden": "true",
2843
- children: "✓"
2844
- })]
2845
- }),
2846
- (model.reasoning?.efforts.length ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2847
- role: "button",
2848
- tabIndex: 0,
2849
- "aria-label": t("input.effort.title"),
2850
- title: t("input.effort.title"),
2851
- "aria-expanded": isEffortEditing,
2852
- style: effortChipStyle,
2853
- onClick: (event) => {
2854
- event.stopPropagation();
2855
- if (!busy) toggleEffortEditor(group.id, model.id);
2856
- },
2857
- onKeyDown: (event) => {
2858
- if (event.key !== "Enter" && event.key !== " ") return;
2859
- event.preventDefault();
2860
- event.stopPropagation();
2861
- if (!busy) toggleEffortEditor(group.id, model.id);
2862
- },
2863
- children: lineEffortName
2864
- }),
2865
- isEffortEditing && model.reasoning !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2866
- style: editorRowStyle,
2867
- onClick: (event) => event.stopPropagation(),
2868
- children: [
2869
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2870
- style: labelStyle$1,
2871
- children: t("input.effort.title")
2872
- }),
2873
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EffortSlider, {
2874
- stops: lineStops,
2875
- value: lineEffort,
2876
- mascot: isDeepSeekLine(group.id, model.id, model.name),
2877
- disabled: busy,
2878
- onCommit: (id) => chooseEffort(group.id, model.id, id),
2879
- t
2880
- }),
2881
- model.reasoning.defaultEffort !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2882
- type: "button",
2883
- disabled: busy,
2884
- "aria-label": t("input.effort.reset"),
2885
- title: t("input.effort.reset"),
2886
- style: actionButtonStyle,
2887
- onClick: (event) => {
2888
- event.stopPropagation();
2889
- const target = model.reasoning?.defaultEffort;
2890
- if (target !== void 0) chooseEffort(group.id, model.id, target);
2891
- },
2892
- children: "↺"
2893
- })
2894
- ]
2907
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2908
+ style: providerNameStyle$1,
2909
+ children: name
2895
2910
  }),
2896
2911
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2897
- role: "button",
2898
- tabIndex: 0,
2899
- "aria-label": t("input.context.title"),
2900
- title: lineWritable ? t("input.context.globalHint") : t("model.panel.noTarget"),
2901
- style: lineWritable && !busy ? chipStyle : chipDisabledStyle,
2902
- onClick: (event) => {
2903
- event.stopPropagation();
2904
- if (!lineWritable || busy) return;
2905
- if (isContextEditing) {
2906
- setEditing(null);
2907
- return;
2908
- }
2909
- openEditor(group.id, model.id);
2910
- },
2911
- onKeyDown: (event) => {
2912
- if (event.key !== "Enter" && event.key !== " ") return;
2913
- event.preventDefault();
2914
- event.stopPropagation();
2915
- if (!lineWritable || busy) return;
2916
- openEditor(group.id, model.id);
2917
- },
2918
- children: lineWindow === void 0 ? t("input.context.unset") : formatContextWindow(lineWindow)
2912
+ style: providerMetaStyle,
2913
+ children: group.models.length
2919
2914
  }),
2920
- isContextEditing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2921
- style: editorRowStyle,
2922
- children: [
2923
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2924
- style: labelStyle$1,
2925
- title: t("input.context.globalHint"),
2926
- children: t("model.panel.window")
2927
- }),
2928
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2929
- type: "range",
2930
- min: 0,
2931
- max: CONTEXT_WINDOW_PRESETS.length - 1,
2932
- step: 1,
2933
- value: draft ?? stopIndexOf(lineWindow),
2934
- disabled: busy,
2935
- "aria-label": t("input.context.title"),
2936
- style: sliderStyle,
2937
- onChange: (event) => {
2938
- setDraft(Number(event.currentTarget.value));
2939
- },
2940
- onPointerUp: () => {
2941
- if (draft === null) return;
2942
- commitWindow(group.id, model.id, CONTEXT_WINDOW_PRESETS[draft]?.value);
2943
- },
2944
- onKeyUp: () => {
2945
- if (draft === null) return;
2946
- commitWindow(group.id, model.id, CONTEXT_WINDOW_PRESETS[draft]?.value);
2947
- }
2948
- }),
2949
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2950
- style: valueStyle,
2951
- children: draft === null ? lineWindow === void 0 ? t("input.context.unset") : formatContextWindow(lineWindow) : formatContextWindow(CONTEXT_WINDOW_PRESETS[draft]?.value ?? 0)
2952
- }),
2953
- custom ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2954
- type: "text",
2955
- inputMode: "numeric",
2956
- value: raw,
2957
- disabled: busy,
2958
- placeholder: t("input.context.customPlaceholder"),
2959
- "aria-label": t("input.context.customPlaceholder"),
2960
- style: inputStyle,
2961
- onChange: (event) => {
2962
- setRaw(event.currentTarget.value);
2963
- },
2964
- onKeyDown: (event) => {
2965
- if (event.key === "Enter") applyCustom();
2966
- }
2967
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2968
- type: "button",
2969
- disabled: busy,
2970
- style: actionButtonStyle,
2971
- onClick: applyCustom,
2972
- children: t("input.context.apply")
2973
- })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2974
- type: "button",
2975
- disabled: busy,
2976
- "aria-label": t("input.context.custom"),
2977
- title: t("input.context.custom"),
2978
- style: actionButtonStyle,
2979
- onClick: () => {
2980
- setCustom(true);
2981
- setError(null);
2982
- },
2983
- children: "⋯"
2984
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2985
- type: "button",
2986
- disabled: busy || lineWindow === void 0,
2987
- style: {
2988
- ...actionButtonStyle,
2989
- opacity: lineWindow === void 0 ? .55 : 1
2990
- },
2991
- onClick: () => {
2992
- setDraft(null);
2993
- setError(null);
2994
- commitWindow(group.id, model.id, void 0);
2995
- },
2996
- children: t("input.context.clear")
2997
- })] }),
2998
- error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2999
- style: errorStyle,
3000
- children: error
3001
- })
3002
- ]
2915
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2916
+ style: chevronStyle,
2917
+ children: isExpanded ? "▼" : "▶"
3003
2918
  })
3004
2919
  ]
3005
- }, group.id + ":" + model.id);
3006
- })] }, group.id);
3007
- }),
3008
- directory !== void 0 && state.status !== "loading" && state.groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3009
- style: statusStyle,
3010
- children: t("model.panel.empty")
3011
- })
3012
- ]
3013
- }), directory !== void 0 && state.error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3014
- style: errorBannerStyle,
3015
- role: "status",
3016
- children: state.error
3017
- })]
2920
+ }), isExpanded && group.models.map((model) => {
2921
+ const active = activeModel === model.id;
2922
+ const lineWritable = writableLine(group.id, model.id);
2923
+ const lineWindow = windowOf(group.id, model.id);
2924
+ const isContextEditing = editing !== null && editing.provider === group.id && editing.model === model.id && editing.kind === "context";
2925
+ const isEffortEditing = editing !== null && editing.provider === group.id && editing.model === model.id && editing.kind === "effort";
2926
+ const lineEffort = active ? state.current?.reasoningEffort ?? model.reasoning?.defaultEffort : model.reasoning?.defaultEffort;
2927
+ const lineStops = model.reasoning === void 0 ? [] : orderEffortsForSlider(model.reasoning.efforts);
2928
+ const lineEffortName = lineEffort === void 0 ? t("input.effort.default") : lineStops.find((stop) => stop.id === lineEffort)?.name ?? lineEffort;
2929
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2930
+ style: active ? modelRowActiveStyle : modelRowStyle$1,
2931
+ children: [
2932
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2933
+ type: "button",
2934
+ role: "option",
2935
+ "aria-selected": active,
2936
+ style: modelPickStyle,
2937
+ disabled: busy,
2938
+ onClick: () => chooseModel(group.id, model.id),
2939
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2940
+ style: modelCopyStyle,
2941
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2942
+ style: modelNameStyle,
2943
+ children: model.name
2944
+ })
2945
+ }), active && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2946
+ style: checkStyle,
2947
+ "aria-hidden": "true",
2948
+ children: "✓"
2949
+ })]
2950
+ }),
2951
+ (model.reasoning?.efforts.length ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2952
+ role: "button",
2953
+ tabIndex: 0,
2954
+ "aria-label": t("input.effort.title"),
2955
+ title: t("input.effort.title"),
2956
+ "aria-expanded": isEffortEditing,
2957
+ style: effortChipStyle,
2958
+ onClick: (event) => {
2959
+ event.stopPropagation();
2960
+ if (!busy) toggleEffortEditor(group.id, model.id);
2961
+ },
2962
+ onKeyDown: (event) => {
2963
+ if (event.key !== "Enter" && event.key !== " ") return;
2964
+ event.preventDefault();
2965
+ event.stopPropagation();
2966
+ if (!busy) toggleEffortEditor(group.id, model.id);
2967
+ },
2968
+ children: lineEffortName
2969
+ }),
2970
+ isEffortEditing && model.reasoning !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2971
+ style: editorRowStyle,
2972
+ onClick: (event) => event.stopPropagation(),
2973
+ children: [
2974
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2975
+ style: labelStyle$1,
2976
+ children: t("input.effort.title")
2977
+ }),
2978
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EffortSlider, {
2979
+ stops: lineStops,
2980
+ value: lineEffort,
2981
+ mascot: isDeepSeekLine(group.id, model.id, model.name),
2982
+ disabled: busy,
2983
+ onCommit: (id) => chooseEffort(group.id, model.id, id),
2984
+ t
2985
+ }),
2986
+ model.reasoning.defaultEffort !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2987
+ type: "button",
2988
+ disabled: busy,
2989
+ "aria-label": t("input.effort.reset"),
2990
+ title: t("input.effort.reset"),
2991
+ style: actionButtonStyle,
2992
+ onClick: (event) => {
2993
+ event.stopPropagation();
2994
+ const target = model.reasoning?.defaultEffort;
2995
+ if (target !== void 0) chooseEffort(group.id, model.id, target);
2996
+ },
2997
+ children: "↺"
2998
+ })
2999
+ ]
3000
+ }),
3001
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3002
+ role: "button",
3003
+ tabIndex: 0,
3004
+ "aria-label": t("input.context.title"),
3005
+ title: lineWritable ? t("input.context.globalHint") : t("model.panel.noTarget"),
3006
+ style: lineWritable && !busy ? chipStyle : chipDisabledStyle,
3007
+ onClick: (event) => {
3008
+ event.stopPropagation();
3009
+ if (!lineWritable || busy) return;
3010
+ if (isContextEditing) {
3011
+ setEditing(null);
3012
+ return;
3013
+ }
3014
+ openEditor(group.id, model.id);
3015
+ },
3016
+ onKeyDown: (event) => {
3017
+ if (event.key !== "Enter" && event.key !== " ") return;
3018
+ event.preventDefault();
3019
+ event.stopPropagation();
3020
+ if (!lineWritable || busy) return;
3021
+ openEditor(group.id, model.id);
3022
+ },
3023
+ children: lineWindow === void 0 ? t("input.context.unset") : formatContextWindow(lineWindow)
3024
+ }),
3025
+ isContextEditing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3026
+ style: editorRowStyle,
3027
+ children: [
3028
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3029
+ style: labelStyle$1,
3030
+ title: t("input.context.globalHint"),
3031
+ children: t("model.panel.window")
3032
+ }),
3033
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3034
+ type: "range",
3035
+ min: 0,
3036
+ max: CONTEXT_WINDOW_PRESETS.length - 1,
3037
+ step: 1,
3038
+ value: draft ?? stopIndexOf(lineWindow),
3039
+ disabled: busy,
3040
+ "aria-label": t("input.context.title"),
3041
+ style: sliderStyle,
3042
+ onChange: (event) => {
3043
+ setDraft(Number(event.currentTarget.value));
3044
+ },
3045
+ onPointerUp: () => {
3046
+ if (draft === null) return;
3047
+ commitWindow(group.id, model.id, CONTEXT_WINDOW_PRESETS[draft]?.value);
3048
+ },
3049
+ onKeyUp: () => {
3050
+ if (draft === null) return;
3051
+ commitWindow(group.id, model.id, CONTEXT_WINDOW_PRESETS[draft]?.value);
3052
+ }
3053
+ }),
3054
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3055
+ style: valueStyle,
3056
+ children: draft === null ? lineWindow === void 0 ? t("input.context.unset") : formatContextWindow(lineWindow) : formatContextWindow(CONTEXT_WINDOW_PRESETS[draft]?.value ?? 0)
3057
+ }),
3058
+ custom ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3059
+ type: "text",
3060
+ inputMode: "numeric",
3061
+ value: raw,
3062
+ disabled: busy,
3063
+ placeholder: t("input.context.customPlaceholder"),
3064
+ "aria-label": t("input.context.customPlaceholder"),
3065
+ style: inputStyle,
3066
+ onChange: (event) => {
3067
+ setRaw(event.currentTarget.value);
3068
+ },
3069
+ onKeyDown: (event) => {
3070
+ if (event.key === "Enter") applyCustom();
3071
+ }
3072
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3073
+ type: "button",
3074
+ disabled: busy,
3075
+ style: actionButtonStyle,
3076
+ onClick: applyCustom,
3077
+ children: t("input.context.apply")
3078
+ })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3079
+ type: "button",
3080
+ disabled: busy,
3081
+ "aria-label": t("input.context.custom"),
3082
+ title: t("input.context.custom"),
3083
+ style: actionButtonStyle,
3084
+ onClick: () => {
3085
+ setCustom(true);
3086
+ setError(null);
3087
+ },
3088
+ children: "⋯"
3089
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3090
+ type: "button",
3091
+ disabled: busy || lineWindow === void 0,
3092
+ style: {
3093
+ ...actionButtonStyle,
3094
+ opacity: lineWindow === void 0 ? .55 : 1
3095
+ },
3096
+ onClick: () => {
3097
+ setDraft(null);
3098
+ setError(null);
3099
+ commitWindow(group.id, model.id, void 0);
3100
+ },
3101
+ children: t("input.context.clear")
3102
+ })] }),
3103
+ error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3104
+ style: errorStyle,
3105
+ children: error
3106
+ })
3107
+ ]
3108
+ })
3109
+ ]
3110
+ }, group.id + ":" + model.id);
3111
+ })] }, group.id);
3112
+ }),
3113
+ directory !== void 0 && state.status !== "loading" && state.groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3114
+ style: statusStyle,
3115
+ children: t("model.panel.empty")
3116
+ }),
3117
+ directory !== void 0 && needle !== "" && visibleGroups.length === 0 && state.groups.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3118
+ style: statusStyle,
3119
+ children: t("model.panel.empty")
3120
+ })
3121
+ ]
3122
+ }),
3123
+ directory !== void 0 && state.error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3124
+ style: errorBannerStyle,
3125
+ role: "status",
3126
+ children: state.error
3127
+ })
3128
+ ]
3018
3129
  })] }) : null
3019
3130
  ]
3020
3131
  });
@@ -3366,6 +3477,18 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3366
3477
  ...own
3367
3478
  } : base;
3368
3479
  }
3480
+ /**
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)
3488
+ */
3489
+ function effortCompatConfigurable(entry) {
3490
+ return typeof entry.providerApi !== "string" || entry.providerApi === "openai-completions";
3491
+ }
3369
3492
  /** Flatten the user-layer providers into capability entries (models arrays only). */
3370
3493
  function entriesOf(providers) {
3371
3494
  return Object.entries(providers).flatMap(([providerId, profile]) => {
@@ -3380,7 +3503,8 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3380
3503
  model: typeof model === "object" && model !== null && !Array.isArray(model) ? model : {},
3381
3504
  modelId: typeof model === "object" && model !== null && typeof model["id"] === "string" ? model["id"] : `#${index + 1}`,
3382
3505
  providerCompat,
3383
- providerInput
3506
+ providerInput,
3507
+ providerApi: raw["api"]
3384
3508
  }));
3385
3509
  });
3386
3510
  }
@@ -3418,6 +3542,63 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3418
3542
  });
3419
3543
  }
3420
3544
  /**
3545
+ * Horizontal pill toggle: the real checkbox stays the a11y control (sr-only),
3546
+ * the drawn track/knob reflects `checked` — which the card feeds from its
3547
+ * optimistic overlay, so the pill flips the instant the user clicks and rolls
3548
+ * back on a refused write (same pendingTl contract as every other field).
3549
+ */
3550
+ function PillToggle(props) {
3551
+ const { id, checked, disabled, title, onChange } = props;
3552
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
3553
+ htmlFor: id,
3554
+ title,
3555
+ style: {
3556
+ display: "inline-flex",
3557
+ alignItems: "center",
3558
+ cursor: disabled ? "default" : "pointer"
3559
+ },
3560
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3561
+ id,
3562
+ type: "checkbox",
3563
+ checked,
3564
+ disabled,
3565
+ onChange: (event) => onChange(event.currentTarget.checked),
3566
+ style: {
3567
+ position: "absolute",
3568
+ width: 1,
3569
+ height: 1,
3570
+ margin: 0,
3571
+ opacity: 0,
3572
+ pointerEvents: "none"
3573
+ }
3574
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3575
+ "aria-hidden": true,
3576
+ style: {
3577
+ display: "inline-block",
3578
+ width: "36px",
3579
+ height: "20px",
3580
+ borderRadius: "999px",
3581
+ flex: "0 0 auto",
3582
+ position: "relative",
3583
+ background: checked ? "var(--dsw-alias-bg-control-primary, #4d6bfe)" : "var(--dsw-alias-fill-input-primary, rgba(127,127,127,0.25))",
3584
+ border: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,0.35))",
3585
+ transition: "background 0.16s"
3586
+ },
3587
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: {
3588
+ position: "absolute",
3589
+ top: "1px",
3590
+ left: checked ? "17px" : "1px",
3591
+ width: "16px",
3592
+ height: "16px",
3593
+ borderRadius: "50%",
3594
+ background: "#fff",
3595
+ boxShadow: "0 1px 2px rgba(0,0,0,0.25)",
3596
+ transition: "left 0.16s"
3597
+ } })
3598
+ })]
3599
+ });
3600
+ }
3601
+ /**
3421
3602
  * The llm-pi-ai model-capability editor block (dsh-thinking-effort style:
3422
3603
  * provider groups, model rows with badges, per-level wire editors, search and
3423
3604
  * one-click presets).
@@ -3870,6 +4051,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3870
4051
  const thinking = typeof effortsOf(entry.model) === "object";
3871
4052
  const compat = compatOf(entry);
3872
4053
  const supportsEffort = compat["supportsReasoningEffort"] === true;
4054
+ const apiGated = !effortCompatConfigurable(entry);
3873
4055
  const meta = summaryOf(entry);
3874
4056
  const format = typeof compat["thinkingFormat"] === "string" ? compat["thinkingFormat"] : void 0;
3875
4057
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -3936,6 +4118,10 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3936
4118
  borderTop: "1px solid var(--dsw-alias-border-l2)"
3937
4119
  },
3938
4120
  children: [
4121
+ apiGated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4122
+ style: hintStyle,
4123
+ children: t("card.capabilities.apiUnsupported")
4124
+ }),
3939
4125
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3940
4126
  style: {
3941
4127
  display: "flex",
@@ -3951,10 +4137,11 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3951
4137
  gap: "6px",
3952
4138
  fontSize: "12px"
3953
4139
  },
4140
+ title: apiGated ? t("card.capabilities.apiUnsupported") : void 0,
3954
4141
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3955
4142
  type: "checkbox",
3956
4143
  checked: thinking,
3957
- disabled: readonly || busy,
4144
+ disabled: readonly || busy || apiGated,
3958
4145
  onChange: (event) => toggleThinking(entry, event.currentTarget.checked)
3959
4146
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.thinking") })]
3960
4147
  }),
@@ -4002,10 +4189,11 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4002
4189
  fontSize: "12px",
4003
4190
  margin: "0 0 8px"
4004
4191
  },
4192
+ title: apiGated ? t("card.capabilities.apiUnsupported") : void 0,
4005
4193
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4006
4194
  type: "checkbox",
4007
4195
  checked: supportsEffort,
4008
- disabled: readonly || busy,
4196
+ disabled: readonly || busy || apiGated,
4009
4197
  onChange: (event) => toggleEffortCapable(entry, event.currentTarget.checked)
4010
4198
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.supportsEffort") })]
4011
4199
  }) : null,
@@ -4115,7 +4303,8 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4115
4303
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
4116
4304
  style: controlStyle,
4117
4305
  value: format ?? "inherit",
4118
- disabled: readonly || busy,
4306
+ disabled: readonly || busy || apiGated,
4307
+ title: apiGated ? t("card.capabilities.apiUnsupported") : void 0,
4119
4308
  onChange: (event) => {
4120
4309
  const next = event.currentTarget.value;
4121
4310
  patchModel(entry.providerId, entry.index, (row) => {
@@ -4228,12 +4417,184 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4228
4417
  });
4229
4418
  }
4230
4419
  /**
4420
+ * The absent-llm-deepseek snapshot: module-level CONSTANT (the stable-snapshot
4421
+ * rule that killed the first-ever panel mount, #185).
4422
+ */
4423
+ const DS_ABSENT_SNAPSHOT = Object.freeze({
4424
+ status: "unavailable",
4425
+ value: void 0,
4426
+ revision: void 0,
4427
+ writable: false,
4428
+ base: void 0,
4429
+ user: void 0,
4430
+ mode: "memory"
4431
+ });
4432
+ /**
4433
+ * Official DeepSeek model context-window editor (4.4.0): the per-line editor
4434
+ * lived only in the ModelPanel; with the seat takeover off by default the
4435
+ * card owns it. Writes mirror the panel's DEEPSEEK branch exactly: the model
4436
+ * entry's `contextWindow` when listed, the route `defaultContextWindow`
4437
+ * otherwise (clear = back to the native 1M).
4438
+ * @param props - the llm-deepseek scope (absent = section hidden), copy, fence.
4439
+ * @returns the editor block, or null when the namespace/scope is unavailable.
4440
+ */
4441
+ function DeepSeekContextSection(props) {
4442
+ const { scope, t, readonly } = props;
4443
+ const subscribe = (0, react.useCallback)((listener) => scope !== void 0 ? scope.subscribe(listener) : () => {}, [scope]);
4444
+ const getSnapshot = (0, react.useCallback)(() => scope === void 0 ? DS_ABSENT_SNAPSHOT : scope.getSnapshot(), [scope]);
4445
+ const snapshot = (0, react.useSyncExternalStore)(subscribe, getSnapshot);
4446
+ const [raw, setRaw] = (0, react.useState)({});
4447
+ const [errors, setErrors] = (0, react.useState)({});
4448
+ const [busy, setBusy] = (0, react.useState)(false);
4449
+ if (snapshot.status !== "ready") return null;
4450
+ const section = deepseekSectionOf(snapshot);
4451
+ const models = section.models ?? [];
4452
+ if (models.length === 0 && section.defaultContextWindow === void 0) return null;
4453
+ const writable = snapshot.writable && !readonly && !busy;
4454
+ /** Commit one row's window (index -1 = the route default layer). */
4455
+ const commit = (index, value) => {
4456
+ if (scope === void 0 || !writable) return;
4457
+ setBusy(true);
4458
+ const rows = (deepseekSectionOf(scope.getSnapshot()).models ?? []).map((entry) => ({ ...entry }));
4459
+ (index >= 0 ? scope.set("models", rows.map((entry, at) => {
4460
+ if (at !== index) return entry;
4461
+ if (value === void 0) {
4462
+ const rest = { ...entry };
4463
+ delete rest["contextWindow"];
4464
+ return rest;
4465
+ }
4466
+ return {
4467
+ ...entry,
4468
+ contextWindow: value
4469
+ };
4470
+ })) : scope.set("defaultContextWindow", value ?? 1e6)).then(() => {
4471
+ setBusy(false);
4472
+ setErrors((cur) => {
4473
+ const next = { ...cur };
4474
+ delete next[String(index)];
4475
+ return next;
4476
+ });
4477
+ }, () => {
4478
+ setBusy(false);
4479
+ setErrors((cur) => ({
4480
+ ...cur,
4481
+ [String(index)]: t("card.capabilities.failed")
4482
+ }));
4483
+ });
4484
+ };
4485
+ /** Validate and commit the custom input; empty clears. */
4486
+ const applyCustom = (index) => {
4487
+ const key = String(index);
4488
+ const trimmed = (raw[key] ?? "").trim();
4489
+ if (trimmed === "") {
4490
+ commit(index, void 0);
4491
+ return;
4492
+ }
4493
+ const validation = validateContextWindow(trimmed);
4494
+ if (!validation.ok) {
4495
+ setErrors((cur) => ({
4496
+ ...cur,
4497
+ [key]: t(validation.reason === "integer" ? "input.context.integer" : "input.context.range")
4498
+ }));
4499
+ return;
4500
+ }
4501
+ commit(index, validation.value);
4502
+ };
4503
+ const rows = [...models.map((entry, index) => ({
4504
+ label: String(entry["name"] ?? entry["id"] ?? index),
4505
+ index,
4506
+ value: contextWindowOf(entry)
4507
+ })), {
4508
+ label: t("model.panel.window"),
4509
+ index: -1,
4510
+ value: section.defaultContextWindow
4511
+ }];
4512
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4513
+ style: sectionStyle,
4514
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4515
+ style: fieldLabelStyle,
4516
+ children: t("card.dsContextTitle")
4517
+ }), rows.map((row) => {
4518
+ const key = String(row.index);
4519
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4520
+ style: {
4521
+ display: "flex",
4522
+ gap: "8px",
4523
+ flexWrap: "wrap",
4524
+ alignItems: "center",
4525
+ margin: "6px 0"
4526
+ },
4527
+ children: [
4528
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4529
+ style: {
4530
+ ...fieldLabelStyle,
4531
+ margin: 0
4532
+ },
4533
+ children: row.label
4534
+ }),
4535
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4536
+ style: badgeStyle,
4537
+ children: row.value === void 0 ? t("input.context.unset") : formatContextWindow(row.value)
4538
+ }),
4539
+ CONTEXT_WINDOW_PRESETS.map((preset) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4540
+ type: "button",
4541
+ disabled: !writable,
4542
+ onClick: () => commit(row.index, preset.value),
4543
+ style: {
4544
+ ...controlStyle,
4545
+ padding: "2px 8px",
4546
+ cursor: writable ? "pointer" : "default",
4547
+ opacity: writable ? 1 : .5
4548
+ },
4549
+ children: preset.label
4550
+ }, preset.value)),
4551
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4552
+ type: "text",
4553
+ inputMode: "numeric",
4554
+ value: raw[key] ?? "",
4555
+ disabled: !writable,
4556
+ placeholder: t("card.capabilities.contextCustomPlaceholder"),
4557
+ style: {
4558
+ ...controlStyle,
4559
+ width: "120px"
4560
+ },
4561
+ onChange: (event) => setRaw((cur) => ({
4562
+ ...cur,
4563
+ [key]: event.currentTarget.value
4564
+ })),
4565
+ onKeyDown: (event) => {
4566
+ if (event.key === "Enter") applyCustom(row.index);
4567
+ }
4568
+ }),
4569
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4570
+ type: "button",
4571
+ disabled: !writable || row.value === void 0,
4572
+ onClick: () => commit(row.index, void 0),
4573
+ style: {
4574
+ ...controlStyle,
4575
+ padding: "2px 8px"
4576
+ },
4577
+ children: t("input.context.clear")
4578
+ }),
4579
+ errors[key] !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4580
+ style: {
4581
+ fontSize: "12px",
4582
+ color: "var(--dsw-alias-danger, #e5484d)"
4583
+ },
4584
+ children: errors[key]
4585
+ })
4586
+ ]
4587
+ }, key);
4588
+ })]
4589
+ });
4590
+ }
4591
+ /**
4231
4592
  * The card body, wrapped in a disclosure shell like every peer settings card:
4232
4593
  * a header (name + description + chevron) that toggles the body, expanded by
4233
4594
  * default so the family section reads as an open page of drawers.
4234
4595
  * @param props - locale copy and the injected scopes.
4235
4596
  */
4236
- function ThinkingLevelsCard({ t, scope, piAiScope, ocScope }) {
4597
+ function ThinkingLevelsCard({ t, scope, piAiScope, ocScope, deepseekScope }) {
4237
4598
  const [open, setOpen] = (0, react.useState)(true);
4238
4599
  const subscribe = (0, react.useCallback)((listener) => scope.subscribe(listener), [scope]);
4239
4600
  const getSnapshot = (0, react.useCallback)(() => scope.getSnapshot(), [scope]);
@@ -4397,6 +4758,23 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4397
4758
  }
4398
4759
  })]
4399
4760
  }),
4761
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4762
+ style: rowStyle,
4763
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4764
+ htmlFor: "plugin-config-thinking-levels-takeover-ui",
4765
+ style: labelStyle,
4766
+ title: t("card.takeoverUiHint"),
4767
+ children: t("card.takeoverUi")
4768
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillToggle, {
4769
+ id: "plugin-config-thinking-levels-takeover-ui",
4770
+ checked: viewValue.takeoverUi ?? false,
4771
+ disabled: readonly,
4772
+ title: t("card.takeoverUiHint"),
4773
+ onChange: (next) => {
4774
+ writeTl("takeoverUi", next);
4775
+ }
4776
+ })]
4777
+ }),
4400
4778
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4401
4779
  style: rowStyle,
4402
4780
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
@@ -4473,6 +4851,11 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4473
4851
  tlScope: scope,
4474
4852
  t,
4475
4853
  readonly
4854
+ }),
4855
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeepSeekContextSection, {
4856
+ scope: deepseekScope,
4857
+ t,
4858
+ readonly
4476
4859
  })
4477
4860
  ] })
4478
4861
  }) : null]
@@ -4519,7 +4902,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4519
4902
  return polled;
4520
4903
  }
4521
4904
  function FamilySettingsSection(props) {
4522
- const { t: tHost, renderSlot, scope, piAiScope, ocScope } = props;
4905
+ const { t: tHost, renderSlot, scope, piAiScope, ocScope, deepseekScope } = props;
4523
4906
  const t = tHost ?? props.tFallback ?? ((key) => key);
4524
4907
  const contributors = useContributorTabs(props, props.hooks?.tabs);
4525
4908
  const [activeId, setActiveId] = (0, react.useState)(OWN_TAB_ID);
@@ -4569,7 +4952,8 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4569
4952
  t,
4570
4953
  scope,
4571
4954
  piAiScope,
4572
- ocScope
4955
+ ocScope,
4956
+ deepseekScope
4573
4957
  }) : renderSlot ? renderSlot("dsh-family.tab", {}, {
4574
4958
  only: active,
4575
4959
  fallback: null
@@ -4683,6 +5067,76 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4683
5067
  for (const dispose of disposers) dispose();
4684
5068
  };
4685
5069
  }, "dsh-thinking-levels: dictionaries");
5070
+ /**
5071
+ * takeoverUi seat watchdog (4.4.1, desktop field report): the one-shot
5072
+ * mirror read at inject time was not enough — on the real host the seat
5073
+ * callback fires when `modelDirectories` starts, which can precede BOTH the
5074
+ * settings waist binding (`scopeOf` still undefined) and the mirror fold
5075
+ * (status `loading`). A static decision then never seats even with the
5076
+ * switch on, and no reload changes it (the service order is the same every
5077
+ * boot). Seating becomes an evaluation driven by every input that can move
5078
+ * it: the declaration, the waist binding, and each settings change — flip
5079
+ * the switch and the panel seats (or abdicates) immediately, no reload.
5080
+ */
5081
+ let seatDirectories;
5082
+ let seatDeclared = false;
5083
+ let seatWatched = false;
5084
+ let seatClaimed;
5085
+ let seatWatchOff;
5086
+ let seatHandleMemo;
5087
+ const seatHandle = () => {
5088
+ if (seatHandleMemo === void 0 && scopeOf !== void 0) seatHandleMemo = tlSettingsScopeOf(scopeOf);
5089
+ return seatHandleMemo;
5090
+ };
5091
+ const takeoverUiOn = () => {
5092
+ const snap = typeof seatHandle()?.getSnapshot === "function" ? seatHandle().getSnapshot() : void 0;
5093
+ return snap?.status === "ready" && snap.value?.takeoverUi === true;
5094
+ };
5095
+ const seatOptions = (directories) => ({
5096
+ name: "conversation.input.model",
5097
+ id: "context-window-model-panel",
5098
+ priority: -1,
5099
+ locale: NS,
5100
+ inject: (sessionId) => {
5101
+ let directory;
5102
+ try {
5103
+ directory = directories.directoryFor(sessionId);
5104
+ } catch {
5105
+ directory = void 0;
5106
+ }
5107
+ return {
5108
+ directory,
5109
+ piAiScope: scopeOf?.("llm-pi-ai"),
5110
+ deepseekScope: scopeOf?.("llm-deepseek"),
5111
+ tlScope: scopeOf === void 0 ? void 0 : tlSettingsScopeOf(scopeOf)
5112
+ };
5113
+ }
5114
+ });
5115
+ /** Apply the current intent: seat while on, release the seat while off. */
5116
+ const evaluateSeat = () => {
5117
+ if (!seatDeclared || seatDirectories === void 0 || scopeOf === void 0) return;
5118
+ const on = takeoverUiOn();
5119
+ if (on && seatClaimed === void 0) try {
5120
+ seatClaimed = ctx.slots.register(seatOptions(seatDirectories), ModelPanel);
5121
+ } catch {
5122
+ seatClaimed = void 0;
5123
+ }
5124
+ else if (!on && seatClaimed !== void 0) {
5125
+ const claim = seatClaimed;
5126
+ seatClaimed = void 0;
5127
+ claim();
5128
+ }
5129
+ };
5130
+ const startSeatWatch = () => {
5131
+ if (seatWatched) return;
5132
+ if (scopeOf === void 0 || !seatDeclared || seatDirectories === void 0) return;
5133
+ seatWatched = true;
5134
+ const handle = seatHandle();
5135
+ if (typeof handle?.subscribe === "function") seatWatchOff = handle.subscribe(() => {
5136
+ evaluateSeat();
5137
+ });
5138
+ evaluateSeat();
5139
+ };
4686
5140
  ctx.inject([
4687
5141
  "modelDirectories",
4688
5142
  "sessions",
@@ -4691,26 +5145,20 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4691
5145
  ], (scope) => {
4692
5146
  const directories = scope.modelDirectories;
4693
5147
  if (directories === void 0) return;
5148
+ seatDirectories = directories;
4694
5149
  ctx.slots.inject("conversation.input.model", function* () {
4695
- yield ctx.slots.register({
4696
- name: "conversation.input.model",
4697
- id: "context-window-model-panel",
4698
- priority: -1,
4699
- locale: NS,
4700
- inject: (sessionId) => {
4701
- let directory;
4702
- try {
4703
- directory = directories.directoryFor(sessionId);
4704
- } catch {
4705
- directory = void 0;
4706
- }
4707
- return {
4708
- directory,
4709
- piAiScope: scopeOf?.("llm-pi-ai"),
4710
- deepseekScope: scopeOf?.("llm-deepseek")
4711
- };
5150
+ seatDeclared = true;
5151
+ startSeatWatch();
5152
+ yield () => {
5153
+ seatWatchOff?.();
5154
+ seatWatchOff = void 0;
5155
+ seatWatched = false;
5156
+ if (seatClaimed !== void 0) {
5157
+ const claim = seatClaimed;
5158
+ seatClaimed = void 0;
5159
+ claim();
4712
5160
  }
4713
- }, ModelPanel);
5161
+ };
4714
5162
  });
4715
5163
  });
4716
5164
  /** Registrant labels arrive as a string or a locale thunk; unwrap either.
@@ -4740,6 +5188,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4740
5188
  const sectionInjected = () => ({
4741
5189
  scope: tlSettingsScopeOf(scopeOf),
4742
5190
  piAiScope: scopeOf("llm-pi-ai"),
5191
+ deepseekScope: scopeOf("llm-deepseek"),
4743
5192
  ocScope: ocTransportScopeOf(scopeOf),
4744
5193
  tFallback: t,
4745
5194
  renderContributor,
@@ -4824,12 +5273,14 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4824
5273
  if (forms === void 0) return;
4825
5274
  scopeOf = ((ns) => forms.get(ns));
4826
5275
  registerModernSurface();
5276
+ startSeatWatch();
4827
5277
  });
4828
5278
  scopeInject.call(ctx, ["settingsScope"], (scope) => {
4829
5279
  const settingsScope = scope.settingsScope;
4830
5280
  if (settingsScope === void 0) return;
4831
5281
  scopeOf = ((ns) => settingsScope.bind({ namespace: ns }));
4832
5282
  registerModernSurface();
5283
+ startSeatWatch();
4833
5284
  });
4834
5285
  }
4835
5286
  //#endregion