dsh-thinking-levels 4.4.0 → 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/CHANGELOG.ja.md CHANGED
@@ -11,6 +11,11 @@
11
11
  - [Список изменений на русском](./CHANGELOG.ru.md)
12
12
  - [Changelog en español](./CHANGELOG.es.md)
13
13
 
14
+ ## [4.4.1] — 2026-10-19(takeoverUi 座席ウォッチドッグ — デスクトップ実測フィードバック)
15
+
16
+ - 修正:`takeoverUi` がリロード不要で即時反映。4.4.0 はシート inject 時に設定ミラーを一度だけ読んでいたため、実機では設定チャネルのバインド/ミラー折り込みよりモデルシート呼出が先に走り、スイッチ ON でもパネルが着席しなかった(公式ポップアップのまま、コンテキストチップも消失)。着席判定はウォッチドッグ化され、設定ウェイストのバインドと各設定変更のたびに再評価されます。
17
+ - カード:takeoverUi 行は楽観的な横置きピルトグルに(クリックで即反転、書込拒否時はロールバック)。
18
+
14
19
  ## [4.4.0] — 2026-10-19(issue まとめ対応:#2 #3 #4 #5)
15
20
 
16
21
  ### 修正
package/CHANGELOG.ko.md CHANGED
@@ -11,6 +11,11 @@
11
11
  - [Список изменений на русском](./CHANGELOG.ru.md)
12
12
  - [Changelog en español](./CHANGELOG.es.md)
13
13
 
14
+ ## [4.4.1] — 2026-10-19(takeoverUi 시트 감시 — 데스크톱 실측 피드백)
15
+
16
+ - 수정: `takeoverUi` 즉시 반영(새로고침 불필요). 4.4.0은 시트 inject 시 설정 미러를 1회만 읽어, 실제 호스트에서 설정 바인딩/미러 접힘보다 모델 시트 콜백이 먼저 실행되면 ON이어도 착석하지 않았다. 이제 웨이스트 바인딩과 모든 설정 변경 시 재평가하는 감시 방식으로 전환.
17
+ - 카드: takeoverUi 줄을 낙관적 횡형 알약 토글로 변경.
18
+
14
19
  ## [4.4.0] — 2026-10-19(issue 일괄 처리: #2 #3 #4 #5)
15
20
 
16
21
  ### 수정
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.4.1] — 2026-10-19 (takeoverUi seat watchdog — desktop field report)
4
+
5
+ - Fixed: `takeoverUi` now applies live, no reload. The 4.4.0 gate read the settings mirror once at seat-inject time; on the real desktop host the model-seat callback can fire BEFORE the settings channel binds or the mirror folds, so with the switch on the panel never seated (and the official popup stayed with no context chips). Seating is now a watchdog re-evaluated whenever the settings waist binds or any settings change lands: flipping the switch seats the ModelPanel — flipping back returns the shipped ModelSelect — immediately.
6
+ - Card: the takeoverUi row is an optimistic horizontal pill toggle (flips on click, rolls back on a refused write).
7
+
3
8
  ## [4.4.0] — 2026-10-19 (issue batch: #2 #3 #4 #5)
4
9
 
5
10
  ### Fixed
package/README.md CHANGED
@@ -105,7 +105,7 @@ DeepSeek lines (the official route, or any gateway model whose id/name says deep
105
105
 
106
106
  ## Model UI takeover (since 4.4.0)
107
107
 
108
- New setting `takeoverUi` (default **off**): the plugin no longer replaces the composer's model popup — search, grouping and loading stay with the shipped selector, and the `auto` mask still arrives through the server-side advertisement; official-model context editing lives on the settings card. Turning it on restores the ModelPanel takeover (per-line editors + popup search). Reload the page after changing.
108
+ New setting `takeoverUi` (default **off**): the plugin no longer replaces the composer's model popup — search, grouping and loading stay with the shipped selector, and the `auto` mask still arrives through the server-side advertisement; official-model context editing lives on the settings card. Turning it on restores the ModelPanel takeover (per-line editors + popup search). Changes apply immediately — no reload needed.
109
109
 
110
110
  The strip is community whale-girl artwork sourced from [HanaAyane/dsh-reasoning-effort](https://github.com/HanaAyane/dsh-reasoning-effort) (`assets/chibi-runner-strip.png`); regenerate the inlined asset with `python tools/whale-mascot.py`.
111
111
 
package/README.zh.md CHANGED
@@ -76,7 +76,7 @@ DeepSeek 行(官方路由,或 id/名称含 deepseek 的网关模型)滑钮
76
76
 
77
77
  ## 模型界面接管(4.4.0 起)
78
78
 
79
- 新增设置项「模型界面接管」(`takeoverUi`,缺省关闭):关闭时不替换官方模型弹窗——搜索、分组、加载都由宿主原生选择器负责,`auto` 档位照常经服务端广告出现;官方模型的上下文编辑在设置卡内完成。开启时恢复本插件的 ModelPanel 接管(逐行上下文/档位编辑 + 弹窗搜索)。更改后需重载页面生效。
79
+ 新增设置项「模型界面接管」(`takeoverUi`,缺省关闭):关闭时不替换官方模型弹窗——搜索、分组、加载都由宿主原生选择器负责,`auto` 档位照常经服务端广告出现;官方模型的上下文编辑在设置卡内完成。开启时恢复本插件的 ModelPanel 接管(逐行上下文/档位编辑 + 弹窗搜索)。切换即时生效,无需重载。
80
80
 
81
81
  立绘为社区鲸鱼娘二创,来源 [HanaAyane/dsh-reasoning-effort](https://github.com/HanaAyane/dsh-reasoning-effort)(`assets/chibi-runner-strip.png`);用 `python tools/whale-mascot.py` 可重新生成内联素材。
82
82
 
package/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-thinking-levels",
3
- "version": "4.4.0",
3
+ "version": "4.4.1",
4
4
  "main": "./lib/index.js",
5
5
  "description": "thinking-level (reasoning_effort) control — auto-adjust per tool round, with optional manual lock and per-tool timing telemetry.",
6
6
  "engines": {
package/lib/client.js CHANGED
@@ -101,7 +101,7 @@ window.__ModuleLoader__.load({
101
101
  "input.effort.title": "思考强度",
102
102
  "panel.search.placeholder": "搜索模型…",
103
103
  "card.takeoverUi": "模型界面接管",
104
- "card.takeoverUiHint": "开启后由本插件重绘输入框的模型选择面板(含每行上下文/档位编辑与搜索);关闭(默认)保留官方模型弹窗——auto 档位照常出现,搜索与加载由官方界面负责。更改后需重载页面生效。",
104
+ "card.takeoverUiHint": "开启后由本插件重绘输入框的模型选择面板(含每行上下文/档位编辑与搜索);关闭(默认)保留官方模型弹窗——auto 档位照常出现,搜索与加载由官方界面负责。切换即时生效,无需重载。",
105
105
  "card.capabilities.apiUnsupported": "该提供方使用非 openai-completions 协议:思考兼容字段由宿主 pi-ai 原生处理,此处不可配置。",
106
106
  "card.dsContextTitle": "官方 DeepSeek 模型上下文上限",
107
107
  "input.effort.default": "提供方默认",
@@ -199,7 +199,7 @@ window.__ModuleLoader__.load({
199
199
  "input.effort.title": "Reasoning effort",
200
200
  "panel.search.placeholder": "Search models…",
201
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. Reload the page after changing.",
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
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
204
  "card.dsContextTitle": "Official DeepSeek context windows",
205
205
  "input.effort.default": "Provider default",
@@ -297,7 +297,7 @@ window.__ModuleLoader__.load({
297
297
  "input.effort.title": "思考レベル",
298
298
  "panel.search.placeholder": "モデルを検索…",
299
299
  "card.takeoverUi": "モデルUI引き継ぎ",
300
- "card.takeoverUiHint": "ON にするとこのプラグインが入力欄のモデル選択を独自パネル(行別のコンテキスト/レベル編集+検索)に置き換えます。OFF(既定)では公式ポップアップが維持され、auto レベルは引き続き表示され、検索と読み込みは標準セレクタの役割です。変更後はページの再読み込みが必要です。",
300
+ "card.takeoverUiHint": "ON にするとこのプラグインが入力欄のモデル選択を独自パネル(行別のコンテキスト/レベル編集+検索)に置き換えます。OFF(既定)では公式ポップアップが維持され、auto レベルは引き続き表示され、検索と読み込みは標準セレクタの役割です。変更は即時反映されます(再読み込み不要)。",
301
301
  "card.capabilities.apiUnsupported": "このプロバイダーは openai-completions 以外のプロトコルを使用しています:思考互換フィールドは pi-ai がネイティブに処理するため、ここで設定できません。",
302
302
  "card.dsContextTitle": "公式 DeepSeek モデルのコンテキスト上限",
303
303
  "input.effort.default": "プロバイダーの既定",
@@ -395,7 +395,7 @@ window.__ModuleLoader__.load({
395
395
  "input.effort.title": "추론 강도",
396
396
  "panel.search.placeholder": "모델 검색…",
397
397
  "card.takeoverUi": "모델 UI 인수",
398
- "card.takeoverUiHint": "켜면 이 플러그인이 입력창의 모델 선택을 자체 패널(행별 컨텍스트/레벨 편집 + 검색)로 대체합니다. 끄면(기본) 공식 팝업이 유지되며 auto 레벨은 계속 표시되고 검색과 로딩은 표준 셀렉터가 담당합니다. 변경 후 페이지 새로고침이 필요합니다.",
398
+ "card.takeoverUiHint": "켜면 이 플러그인이 입력창의 모델 선택을 자체 패널(행별 컨텍스트/레벨 편집 + 검색)로 대체합니다. 끄면(기본) 공식 팝업이 유지되며 auto 레벨은 계속 표시되고 검색과 로딩은 표준 셀렉터가 담당합니다. 변경이 즉시 반영됩니다(새로고침 불필요).",
399
399
  "card.capabilities.apiUnsupported": "이 제공자는 openai-completions 이외 프로토콜을 사용합니다: 사고 호환 필드는 pi-ai가 네이티브로 처리하므로 여기서 설정할 수 없습니다.",
400
400
  "card.dsContextTitle": "공식 DeepSeek 모델 컨텍스트 상한",
401
401
  "input.effort.default": "공급자 기본값",
@@ -493,7 +493,7 @@ window.__ModuleLoader__.load({
493
493
  "input.effort.title": "Effort de raisonnement",
494
494
  "panel.search.placeholder": "Rechercher des modèles…",
495
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. Rechargez la page après modification.",
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
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
498
  "card.dsContextTitle": "Fenêtres de contexte DeepSeek officielles",
499
499
  "input.effort.default": "Valeur par défaut du fournisseur",
@@ -591,7 +591,7 @@ window.__ModuleLoader__.load({
591
591
  "input.effort.title": "Schlussfolgerungsaufwand",
592
592
  "panel.search.placeholder": "Modelle suchen…",
593
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. Nach der Änderung die Seite neu laden.",
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
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
596
  "card.dsContextTitle": "Kontextfenster der offiziellen DeepSeek-Modelle",
597
597
  "input.effort.default": "Anbieterstandard",
@@ -689,7 +689,7 @@ window.__ModuleLoader__.load({
689
689
  "input.effort.title": "Sforzo di ragionamento",
690
690
  "panel.search.placeholder": "Cerca modelli…",
691
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. Ricarica la pagina dopo la modifica.",
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
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
694
  "card.dsContextTitle": "Finestra di contesto dei modelli DeepSeek ufficiali",
695
695
  "input.effort.default": "Predefinito del provider",
@@ -787,7 +787,7 @@ window.__ModuleLoader__.load({
787
787
  "input.effort.title": "Усилие рассуждения",
788
788
  "panel.search.placeholder": "Поиск моделей…",
789
789
  "card.takeoverUi": "Перехват UI модели",
790
- "card.takeoverUiHint": "Включено: этот плагин заменяет выбор модели в композиторе собственной панелью (редакторы контекста/уровня в строках + поиск). Выключено (по умолчанию) остаётся официальное popup-окно — уровень auto по-прежнему виден, поиск и загрузка обеспечиваются штатным селектором. После изменения перезагрузите страницу.",
790
+ "card.takeoverUiHint": "Включено: этот плагин заменяет выбор модели в композиторе собственной панелью (редакторы контекста/уровня в строках + поиск). Выключено (по умолчанию) остаётся официальное popup-окно — уровень auto по-прежнему виден, поиск и загрузка обеспечиваются штатным селектором. Изменения применяются сразу, без перезагрузки.",
791
791
  "card.capabilities.apiUnsupported": "Этот провайдер использует протокол, отличный от openai-completions: поля совместимости thinking обрабатываются pi-ai нативно и здесь не настраиваются.",
792
792
  "card.dsContextTitle": "Лимиты контекста официальных моделей DeepSeek",
793
793
  "input.effort.default": "Значение провайдера по умолчанию",
@@ -885,7 +885,7 @@ window.__ModuleLoader__.load({
885
885
  "input.effort.title": "Esfuerzo de razonamiento",
886
886
  "panel.search.placeholder": "Buscar modelos…",
887
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. Recarga la página tras cambiarlo.",
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
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
890
  "card.dsContextTitle": "Ventana de contexto de los modelos DeepSeek oficiales",
891
891
  "input.effort.default": "Predeterminado del proveedor",
@@ -3542,6 +3542,63 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3542
3542
  });
3543
3543
  }
3544
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
+ /**
3545
3602
  * The llm-pi-ai model-capability editor block (dsh-thinking-effort style:
3546
3603
  * provider groups, model rows with badges, per-level wire editors, search and
3547
3604
  * one-click presets).
@@ -4708,14 +4765,13 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4708
4765
  style: labelStyle,
4709
4766
  title: t("card.takeoverUiHint"),
4710
4767
  children: t("card.takeoverUi")
4711
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4768
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillToggle, {
4712
4769
  id: "plugin-config-thinking-levels-takeover-ui",
4713
- type: "checkbox",
4714
4770
  checked: viewValue.takeoverUi ?? false,
4715
4771
  disabled: readonly,
4716
4772
  title: t("card.takeoverUiHint"),
4717
- onChange: (event) => {
4718
- writeTl("takeoverUi", event.currentTarget.checked);
4773
+ onChange: (next) => {
4774
+ writeTl("takeoverUi", next);
4719
4775
  }
4720
4776
  })]
4721
4777
  }),
@@ -5011,6 +5067,76 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
5011
5067
  for (const dispose of disposers) dispose();
5012
5068
  };
5013
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
+ };
5014
5140
  ctx.inject([
5015
5141
  "modelDirectories",
5016
5142
  "sessions",
@@ -5019,30 +5145,20 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
5019
5145
  ], (scope) => {
5020
5146
  const directories = scope.modelDirectories;
5021
5147
  if (directories === void 0) return;
5148
+ seatDirectories = directories;
5022
5149
  ctx.slots.inject("conversation.input.model", function* () {
5023
- const tlHandle = scopeOf === void 0 ? void 0 : tlSettingsScopeOf(scopeOf);
5024
- const tlSnap = typeof tlHandle?.getSnapshot === "function" ? tlHandle.getSnapshot() : void 0;
5025
- if (!(tlSnap?.status === "ready" && tlSnap.value?.takeoverUi === true)) return;
5026
- yield ctx.slots.register({
5027
- name: "conversation.input.model",
5028
- id: "context-window-model-panel",
5029
- priority: -1,
5030
- locale: NS,
5031
- inject: (sessionId) => {
5032
- let directory;
5033
- try {
5034
- directory = directories.directoryFor(sessionId);
5035
- } catch {
5036
- directory = void 0;
5037
- }
5038
- return {
5039
- directory,
5040
- piAiScope: scopeOf?.("llm-pi-ai"),
5041
- deepseekScope: scopeOf?.("llm-deepseek"),
5042
- tlScope: scopeOf === void 0 ? void 0 : tlSettingsScopeOf(scopeOf)
5043
- };
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();
5044
5160
  }
5045
- }, ModelPanel);
5161
+ };
5046
5162
  });
5047
5163
  });
5048
5164
  /** Registrant labels arrive as a string or a locale thunk; unwrap either.
@@ -5157,12 +5273,14 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
5157
5273
  if (forms === void 0) return;
5158
5274
  scopeOf = ((ns) => forms.get(ns));
5159
5275
  registerModernSurface();
5276
+ startSeatWatch();
5160
5277
  });
5161
5278
  scopeInject.call(ctx, ["settingsScope"], (scope) => {
5162
5279
  const settingsScope = scope.settingsScope;
5163
5280
  if (settingsScope === void 0) return;
5164
5281
  scopeOf = ((ns) => settingsScope.bind({ namespace: ns }));
5165
5282
  registerModernSurface();
5283
+ startSeatWatch();
5166
5284
  });
5167
5285
  }
5168
5286
  //#endregion