dsh-thinking-levels 4.1.0 → 4.2.0-beta.29

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
@@ -43,11 +43,19 @@ window.__ModuleLoader__.load({
43
43
  "card.capabilities.vendor": "提供方",
44
44
  "card.capabilities.developerRole": "网关不支持 developer 角色",
45
45
  "card.capabilities.developerRoleHint": "官方兼容开关(dsh ≥ v0.1.0-rc.8):写入路由级 compat.supportsDeveloperRole: false,系统提示词按 system 角色发送,修复 vLLM / SGLang 等网关的 Unexpected message role 400。取消勾选 = 删除该字段、恢复继承。",
46
+ "card.capabilities.takeover": "第三方接管",
47
+ "card.capabilities.takeoverHint": "勾选后该路由的模型请求改由 dsh-llm-openai-completions 传输层短路发送(多模态真发 + 模态门禁 + 提示词注入),pi-ai 不再参与。写入传输层自身的 providers 名单;取消勾选 = 从名单移除。需已安装该传输层。",
48
+ "card.capabilities.takeoverHintAbsent": "传输层 dsh-llm-openai-completions 未安装——先安装并启用后才能按路由接管。",
46
49
  "card.capabilities.expandProvider": "展开提供方",
47
50
  "card.capabilities.collapseProvider": "收起提供方",
48
51
  "card.capabilities.openModelSettings": "打开模型设置",
49
52
  "card.capabilities.closeModelSettings": "收起模型设置",
50
53
  "card.capabilities.vision": "视觉模型",
54
+ "card.capabilities.video": "视频输入",
55
+ "card.capabilities.audio": "音频输入",
56
+ "card.capabilities.mediaHint": "视频/音频声明写入接管传输层的 extraInputs(宿主模型行 input 枚举仅支持 text|image);仅该路由被接管时生效,勾选后此模型可接收对应内容块,未勾选时遇到即拒绝或按 modalFallback 遮蔽。",
57
+ "card.masterTakeover": "接管主控",
58
+ "card.masterTakeoverHint": "总闸:开启后本开关状态在每次启动时镜像为传输层的 enabled(唯一写入者)。“第三方接管”路由勾只管名单成员、不直接写总闸;主控关闭时勾选路由会自动点亮本开关。",
51
59
  "card.capabilities.thinking": "思考模型",
52
60
  "card.capabilities.supportsEffort": "支持 think effort",
53
61
  "card.capabilities.efforts": "思考档位(勾选后填写线上值)",
@@ -121,11 +129,19 @@ window.__ModuleLoader__.load({
121
129
  "card.capabilities.vendor": "Provider",
122
130
  "card.capabilities.developerRole": "Gateway rejects the developer role",
123
131
  "card.capabilities.developerRoleHint": "Official compat switch (dsh ≥ v0.1.0-rc.8): writes route-level compat.supportsDeveloperRole: false so the system prompt is sent as role system — fixes the Unexpected message role 400 on vLLM / SGLang gateways. Unchecking deletes the field and restores inheritance.",
132
+ "card.capabilities.takeover": "Third-party takeover",
133
+ "card.capabilities.takeoverHint": "When checked, the model requests of this route are short-circuited through the dsh-llm-openai-completions transport (multimodal true-send, modality gate, prompt injection) and pi-ai steps out. Writes the providers list of the transport itself; unchecking removes the route. Requires the transport to be installed.",
134
+ "card.capabilities.takeoverHintAbsent": "The dsh-llm-openai-completions transport is not installed — install and enable it to take routes over per route.",
124
135
  "card.capabilities.expandProvider": "Expand provider",
125
136
  "card.capabilities.collapseProvider": "Collapse provider",
126
137
  "card.capabilities.openModelSettings": "Open model settings",
127
138
  "card.capabilities.closeModelSettings": "Collapse model settings",
128
139
  "card.capabilities.vision": "Vision model",
140
+ "card.capabilities.video": "Video input",
141
+ "card.capabilities.audio": "Audio input",
142
+ "card.capabilities.mediaHint": "Video/audio declarations are written to the taken-over transport’s extraInputs (the host model-row input enum only accepts text|image). Effective only while the route is taken over; when off, matching content blocks are refused or masked per modalFallback.",
143
+ "card.masterTakeover": "Takeover master",
144
+ "card.masterTakeoverHint": "Master switch: its state mirrors into the transport’s enabled on every start (the sole writer). The per-route “Third-party takeover” checkboxes own membership only; with the master off, checking a route lights this switch automatically.",
129
145
  "card.capabilities.thinking": "Thinking model",
130
146
  "card.capabilities.supportsEffort": "Supports think effort",
131
147
  "card.capabilities.efforts": "Thinking effort levels (tick, then enter the wire value)",
@@ -199,11 +215,19 @@ window.__ModuleLoader__.load({
199
215
  "card.capabilities.vendor": "プロバイダー",
200
216
  "card.capabilities.developerRole": "ゲートウェイは developer ロール非対応",
201
217
  "card.capabilities.developerRoleHint": "公式互換スイッチ(dsh ≥ v0.1.0-rc.8):ルートレベルの compat.supportsDeveloperRole: false を書き込み、システムプロンプトを system ロールで送信します。vLLM / SGLang などの Unexpected message role 400 を修正。チェックを外すとフィールドを削除し継承に戻します。",
218
+ "card.capabilities.takeover": "サードパーティテイクオーバー",
219
+ "card.capabilities.takeoverHint": "チェックすると、このルートのモデルリクエストは dsh-llm-openai-completions トランスポート経由で短路送信され(マルチモーダル真送信・モーダルゲート・プロンプト注入)、pi-ai は関与しません。トランスポート自身の providers リストに書き込みます。チェック解除でルートを削除。トランスポートのインストールが必要です。",
220
+ "card.capabilities.takeoverHintAbsent": "トランスポート dsh-llm-openai-completions が未インストールです — ルート単位のテイクオーバーには先にインストールして有効化してください。",
202
221
  "card.capabilities.expandProvider": "プロバイダーを展開",
203
222
  "card.capabilities.collapseProvider": "プロバイダーを折りたたむ",
204
223
  "card.capabilities.openModelSettings": "モデル設定を開く",
205
224
  "card.capabilities.closeModelSettings": "モデル設定を折りたたむ",
206
225
  "card.capabilities.vision": "視覚モデル",
226
+ "card.capabilities.video": "動画入力",
227
+ "card.capabilities.audio": "音声入力",
228
+ "card.capabilities.mediaHint": "動画/音声の宣言は引継ぎトランスポートの extraInputs に書き込まれます(ホストのモデル行 input 列挙は text|image のみ)。ルートが引継ぎ中のときのみ有効で、オフの場合は該当ブロックが拒否されるか modalFallback でマスクされます。",
229
+ "card.masterTakeover": "引継ぎマスター",
230
+ "card.masterTakeoverHint": "マスタースイッチ:起動ごとにトランスポートの enabled へミラーされます(唯一の書き手)。ルート毎の「サードパーティ引継ぎ」チェックはメンバーのみを担い、マスター OFF でチェックすると自動的に点灯します。",
207
231
  "card.capabilities.thinking": "思考モデル",
208
232
  "card.capabilities.supportsEffort": "think effort をサポート",
209
233
  "card.capabilities.efforts": "思考レベル(チェック後、送信値を入力)",
@@ -277,11 +301,19 @@ window.__ModuleLoader__.load({
277
301
  "card.capabilities.vendor": "제공자",
278
302
  "card.capabilities.developerRole": "게이트웨이가 developer 역할 미지원",
279
303
  "card.capabilities.developerRoleHint": "공식 호환 스위치(dsh ≥ v0.1.0-rc.8): 라우트 수준 compat.supportsDeveloperRole: false 를 기록하여 시스템 프롬프트를 system 역할로 전송합니다. vLLM / SGLang 등의 Unexpected message role 400 을 수정. 체크 해제 시 필드를 삭제하고 상속을 복원합니다.",
304
+ "card.capabilities.takeover": "서드파티 인수",
305
+ "card.capabilities.takeoverHint": "체크하면 이 루트의 모델 요청이 dsh-llm-openai-completions 전송 계층을 통해 단락 전송되고(멀티모달 실전송·모달리티 게이트·프롬프트 주입) pi-ai 는 개입하지 않습니다. 전송 계층 자체의 providers 목록에 기록합니다. 체크 해제 시 루트를 제거합니다. 전송 계층 설치가 필요합니다.",
306
+ "card.capabilities.takeoverHintAbsent": "dsh-llm-openai-completions 전송 계층이 설치되어 있지 않습니다 — 루트별 인수를 위해 먼저 설치하고 활성화하세요.",
280
307
  "card.capabilities.expandProvider": "제공자 펼치기",
281
308
  "card.capabilities.collapseProvider": "제공자 접기",
282
309
  "card.capabilities.openModelSettings": "모델 설정 열기",
283
310
  "card.capabilities.closeModelSettings": "모델 설정 접기",
284
311
  "card.capabilities.vision": "시각 모델",
312
+ "card.capabilities.video": "비디오 입력",
313
+ "card.capabilities.audio": "오디오 입력",
314
+ "card.capabilities.mediaHint": "비디오/오디오 선언은 인수 transport의 extraInputs에 기록됩니다(호스트 모델 행 input 열거는 text|image만 허용). 해당 라우트가 인수 중일 때만 유효하며, 꺼져 있으면 해당 블록이 거부되거나 modalFallback로 가려집니다.",
315
+ "card.masterTakeover": "인수 마스터",
316
+ "card.masterTakeoverHint": "마스터 스위치: 시작 시마다 transport의 enabled로 미러링됩니다(유일한 기록자). 라우트별 서드파티 인수 체크는 멤버십만 담당하며, 마스터가 꺼진 상태에서 체크하면 자동으로 켜집니다.",
285
317
  "card.capabilities.thinking": "사고 모델",
286
318
  "card.capabilities.supportsEffort": "think effort 지원",
287
319
  "card.capabilities.efforts": "사고 수준(체크 후 전송 값 입력)",
@@ -355,11 +387,19 @@ window.__ModuleLoader__.load({
355
387
  "card.capabilities.vendor": "Fournisseur",
356
388
  "card.capabilities.developerRole": "La passerelle rejette le rôle developer",
357
389
  "card.capabilities.developerRoleHint": "Commutateur de compatibilité officiel (dsh ≥ v0.1.0-rc.8) : écrit compat.supportsDeveloperRole: false au niveau de la route pour que le prompt système soit envoyé avec le rôle system — corrige l'erreur Unexpected message role 400 sur les passerelles vLLM / SGLang. Décocher supprime le champ et restaure l'héritage.",
390
+ "card.capabilities.takeover": "Prise en charge tierce",
391
+ "card.capabilities.takeoverHint": "Une fois coché, les requêtes de modèle de cette route passent par le transport dsh-llm-openai-completions (envoi multimodal réel, garde de modalité, injection de prompt) et pi-ai sort. Écrit la liste providers du transport lui-même ; décocher retire la route. Le transport doit être installé.",
392
+ "card.capabilities.takeoverHintAbsent": "Le transport dsh-llm-openai-completions n est pas installé — installez-le et activez-le pour la prise en charge par route.",
358
393
  "card.capabilities.expandProvider": "Déplier le fournisseur",
359
394
  "card.capabilities.collapseProvider": "Replier le fournisseur",
360
395
  "card.capabilities.openModelSettings": "Ouvrir les paramètres du modèle",
361
396
  "card.capabilities.closeModelSettings": "Replier les paramètres du modèle",
362
397
  "card.capabilities.vision": "Modèle vision",
398
+ "card.capabilities.video": "Entrée vidéo",
399
+ "card.capabilities.audio": "Entrée audio",
400
+ "card.capabilities.mediaHint": "Les déclarations vidéo/audio sont écrites dans les extraInputs du transport repris (l’énumération input du modèle hôte n’accepte que text|image). Effectif uniquement lorsque la route est reprise ; sinon les blocs concernés sont refusés ou masqués selon modalFallback.",
401
+ "card.masterTakeover": "Prise de contrôle maître",
402
+ "card.masterTakeoverHint": "Interrupteur maître : son état est reflété dans le enabled du transport à chaque démarrage (seul rédacteur). Les cases de prise de contrôle tierce par route ne gèrent que l’appartenance ; master off, cocher une route allume cet interrupteur.",
363
403
  "card.capabilities.thinking": "Modèle de réflexion",
364
404
  "card.capabilities.supportsEffort": "Prend en charge think effort",
365
405
  "card.capabilities.efforts": "Niveaux de réflexion (cochez, puis saisissez la valeur wire)",
@@ -433,11 +473,19 @@ window.__ModuleLoader__.load({
433
473
  "card.capabilities.vendor": "Anbieter",
434
474
  "card.capabilities.developerRole": "Gateway lehnt die Entwickler-Rolle ab",
435
475
  "card.capabilities.developerRoleHint": "Offizieller Kompatibilitätsschalter (dsh ≥ v0.1.0-rc.8): Schreibt compat.supportsDeveloperRole: false auf Routenebene, damit der System-Prompt als Rolle system gesendet wird — behebt den Unexpected message role 400 auf vLLM / SGLang Gateways. Deaktivieren löscht das Feld und stellt die Vererbung wieder her.",
476
+ "card.capabilities.takeover": "Third-Party-Übernahme",
477
+ "card.capabilities.takeoverHint": "Ist dies aktiviert, werden die Modellanfragen dieser Route durch die dsh-llm-openai-completions-Transportschicht geleitet (echtes Multimodal-Senden, Modalitäts-Gate, Prompt-Injection) und pi-ai tritt zurück. Schreibt die providers-Liste der Transportschicht selbst; Deaktivieren entfernt die Route. Die Transportschicht muss installiert sein.",
478
+ "card.capabilities.takeoverHintAbsent": "Die Transportschicht dsh-llm-openai-completions ist nicht installiert — bitte zuerst installieren und aktivieren, um Routen gezielt zu übernehmen.",
436
479
  "card.capabilities.expandProvider": "Anbieter aufklappen",
437
480
  "card.capabilities.collapseProvider": "Anbieter einklappen",
438
481
  "card.capabilities.openModelSettings": "Modelleinstellungen öffnen",
439
482
  "card.capabilities.closeModelSettings": "Modelleinstellungen einklappen",
440
483
  "card.capabilities.vision": "Vision-Modell",
484
+ "card.capabilities.video": "Videoeingabe",
485
+ "card.capabilities.audio": "Audioeingabe",
486
+ "card.capabilities.mediaHint": "Video/Audio-Deklarationen werden in die extraInputs des übernommenen Transports geschrieben (die Input-Enumeration der Host-Modellzeile akzeptiert nur text|image). Nur wirksam, während die Route übernommen ist; andernfalls werden passende Blöcke abgelehnt oder per modalFallback maskiert.",
487
+ "card.masterTakeover": "Übernahme-Master",
488
+ "card.masterTakeoverHint": "Hauptschalter: Der Zustand wird bei jedem Start in das enabled des Transports gespiegelt (einziger Schreiber). Die Routen-Häkchen der Übernahme durch Drittanbieter steuern nur die Mitgliedschaft; bei ausgeschaltetem Master leuchtet er beim Häkchen automatisch auf.",
441
489
  "card.capabilities.thinking": "Denkmodell",
442
490
  "card.capabilities.supportsEffort": "Unterstützt think effort",
443
491
  "card.capabilities.efforts": "Denkstufen (aktivieren, dann Drahtwert eingeben)",
@@ -511,11 +559,19 @@ window.__ModuleLoader__.load({
511
559
  "card.capabilities.vendor": "Provider",
512
560
  "card.capabilities.developerRole": "Il gateway rifiuta il ruolo developer",
513
561
  "card.capabilities.developerRoleHint": "Interruttore di compatibilità ufficiale (dsh ≥ v0.1.0-rc.8): scrive compat.supportsDeveloperRole: false a livello di rotta così il prompt di sistema viene inviato come ruolo system — corregge l'errore Unexpected message role 400 su gateway vLLM / SGLang. Deselezionare elimina il campo e ripristina l'ereditarietà.",
562
+ "card.capabilities.takeover": "Takeover di terze parti",
563
+ "card.capabilities.takeoverHint": "Se selezionato, le richieste di modello di questa rotta passano per il trasporto dsh-llm-openai-completions (invio multimodale reale, gate di modalita, iniezione del prompt) e pi-ai esce. Scrive la lista providers del trasporto stesso; deselezionare rimuove la rotta. Richiede il trasporto installato.",
564
+ "card.capabilities.takeoverHintAbsent": "Il trasporto dsh-llm-openai-completions non è installato — installarlo e attivarlo per il takeover per rotta.",
514
565
  "card.capabilities.expandProvider": "Espandi provider",
515
566
  "card.capabilities.collapseProvider": "Comprimi provider",
516
567
  "card.capabilities.openModelSettings": "Apri impostazioni modello",
517
568
  "card.capabilities.closeModelSettings": "Comprimi impostazioni modello",
518
569
  "card.capabilities.vision": "Modello vision",
570
+ "card.capabilities.video": "Input video",
571
+ "card.capabilities.audio": "Input audio",
572
+ "card.capabilities.mediaHint": "Le dichiarazioni video/audio vengono scritte negli extraInputs del transport preso in carico (l’enumerazione input della riga modello dell’host accetta solo text|image). Effettivo solo mentre la route è presa in carico; altrimenti i blocchi corrispondenti vengono rifiutati o mascherati secondo modalFallback.",
573
+ "card.masterTakeover": "Takeover principale",
574
+ "card.masterTakeoverHint": "Interruttore principale: lo stato viene specchiato nel enabled del transport a ogni avvio (unico scrittore). I check di takeover di terze parti per route gestiscono solo l’appartenenza; con il master spento, spuntando una route si accende automaticamente.",
519
575
  "card.capabilities.thinking": "Modello di ragionamento",
520
576
  "card.capabilities.supportsEffort": "Supporta think effort",
521
577
  "card.capabilities.efforts": "Livelli di ragionamento (spunta, poi inserisci il valore wire)",
@@ -589,11 +645,19 @@ window.__ModuleLoader__.load({
589
645
  "card.capabilities.vendor": "Провайдер",
590
646
  "card.capabilities.developerRole": "Шлюз отклоняет роль developer",
591
647
  "card.capabilities.developerRoleHint": "Официальный переключатель совместимости (dsh ≥ v0.1.0-rc.8): записывает compat.supportsDeveloperRole: false на уровне маршрута, чтобы системный промпт отправлялся с ролью system — исправляет Unexpected message role 400 на шлюзах vLLM / SGLang. Снятие флажка удаляет поле и восстанавливает наследование.",
648
+ "card.capabilities.takeover": "Сторонний перехват",
649
+ "card.capabilities.takeoverHint": "Если включено, запросы модели этого маршрута направляются через транспорт dsh-llm-openai-completions (истинная мультимодальная отправка, шлюз модальностей, инъекция промпта), а pi-ai устраняется. Записывает список providers самого транспорта; снятие флажка убирает маршрут. Требуется установленный транспорт.",
650
+ "card.capabilities.takeoverHintAbsent": "Транспорт dsh-llm-openai-completions не установлен — установите и включите его для перехвата по маршрутам.",
592
651
  "card.capabilities.expandProvider": "Развернуть провайдер",
593
652
  "card.capabilities.collapseProvider": "Свернуть провайдер",
594
653
  "card.capabilities.openModelSettings": "Открыть настройки модели",
595
654
  "card.capabilities.closeModelSettings": "Свернуть настройки модели",
596
655
  "card.capabilities.vision": "Модель с vision",
656
+ "card.capabilities.video": "Видеовход",
657
+ "card.capabilities.audio": "Аудиовход",
658
+ "card.capabilities.mediaHint": "Объявления видео/аудио записываются в extraInputs перехваченного транспорта (перечисление input строки модели хоста допускает только text|image). Действует, только пока маршрут перехвачен; иначе соответствующие блоки отклоняются или маскируются согласно modalFallback.",
659
+ "card.masterTakeover": "Мастер перехвата",
660
+ "card.masterTakeoverHint": "Главный выключатель: состояние зеркалится в enabled транспорта при каждом запуске (единственный писатель). Галочки стороннего перехвата у маршрутов управляют только членством; при выключенном мастере отметка маршрута автоматически включает его.",
597
661
  "card.capabilities.thinking": "Модель с мышлением",
598
662
  "card.capabilities.supportsEffort": "Поддерживает think effort",
599
663
  "card.capabilities.efforts": "Уровни мышления (отметьте, затем введите значение wire)",
@@ -667,11 +731,19 @@ window.__ModuleLoader__.load({
667
731
  "card.capabilities.vendor": "Proveedor",
668
732
  "card.capabilities.developerRole": "El gateway rechaza el rol developer",
669
733
  "card.capabilities.developerRoleHint": "Interruptor de compatibilidad oficial (dsh ≥ v0.1.0-rc.8): escribe compat.supportsDeveloperRole: false a nivel de ruta para que el prompt del sistema se envíe con rol system — corrige el error Unexpected message role 400 en gateways vLLM / SGLang. Desmarcar elimina el campo y restaura la herencia.",
734
+ "card.capabilities.takeover": "Toma de control de terceros",
735
+ "card.capabilities.takeoverHint": "Al marcarlo, las peticiones de modelo de esta ruta se envian a traves del transporte dsh-llm-openai-completions (envio multimodal real, puerta de modalidad, inyeccion de prompt) y pi-ai sale. Escribe la lista providers del propio transporte; desmarcar elimina la ruta. Requiere el transporte instalado.",
736
+ "card.capabilities.takeoverHintAbsent": "El transporte dsh-llm-openai-completions no esta instalado — instalalo y activalo para la toma de control por ruta.",
670
737
  "card.capabilities.expandProvider": "Expandir proveedor",
671
738
  "card.capabilities.collapseProvider": "Contraer proveedor",
672
739
  "card.capabilities.openModelSettings": "Abrir configuración del modelo",
673
740
  "card.capabilities.closeModelSettings": "Contraer configuración del modelo",
674
741
  "card.capabilities.vision": "Modelo de visión",
742
+ "card.capabilities.video": "Entrada de video",
743
+ "card.capabilities.audio": "Entrada de audio",
744
+ "card.capabilities.mediaHint": "Las declaraciones de vídeo/audio se escriben en los extraInputs del transport tomado (la enumeración input de la fila de modelo del host solo acepta text|image). Efectivo solo mientras la ruta esté tomada; si no, los bloques correspondientes se rechazan o se enmascaran según modalFallback.",
745
+ "card.masterTakeover": "Maestro de toma de control",
746
+ "card.masterTakeoverHint": "Interruptor maestro: su estado se refleja en el enabled del transport en cada arranque (único escritor). Las casillas de toma de control de terceros por ruta solo gestionan pertenencia; con el maestro apagado, marcar una ruta lo enciende automáticamente.",
675
747
  "card.capabilities.thinking": "Modelo de razonamiento",
676
748
  "card.capabilities.supportsEffort": "Soporta think effort",
677
749
  "card.capabilities.efforts": "Niveles de razonamiento (marca, luego introduce el valor wire)",
@@ -713,6 +785,591 @@ window.__ModuleLoader__.load({
713
785
  "card.capabilities.failed": "Error al guardar: el valor fue rechazado o está en conflicto. Verifícalo."
714
786
  };
715
787
  //#endregion
788
+ //#region src/client/context-ring.tsx
789
+ /**
790
+ * Context-capacity check ring for the composer tool row
791
+ * (`conversation.input.right`, the seat just left of the send button —
792
+ * the same seat the retired context-window pill used, and the same side of
793
+ * the composer where the shipped ContextMeter lived).
794
+ *
795
+ * Why this exists: the model-seat panel replaced the shipped `ModelSelect`
796
+ * trigger and popup, and with them went the shipped context meter — the
797
+ * "how full is this window" read. The editor part moved into the model
798
+ * panel's per-model lines; the CHECK part (used vs. window, pressure, a
799
+ * breakdown, a warning before you run out) is what this ring restores.
800
+ * Layout language follows better-er/dsh-cache-billing (rows with a color
801
+ * swatch, token counts right-aligned, a muted footer note), which itself
802
+ * pins into the shipped meter's popup.
803
+ *
804
+ * Data: the session projection seats. `useProjection('contextPressure')`
805
+ * is the same feed the shipped meter consumes (`{ usedTokens, contextWindow,
806
+ * percent }`), `useProjection('contextBreakdown')` the three-way split
807
+ * (`{ systemTokens, toolsTokens, messageTokens }`). Both are optional on the
808
+ * props and defensively read: a harness without the projection seat, or a
809
+ * session before its first request, renders nothing here instead of a dead
810
+ * control (the retired pill's discipline). Values refresh live while the
811
+ * projection pushes — no polling.
812
+ *
813
+ * Zero host coupling beyond react + the injected seats: plain SVG + HTML
814
+ * with token-based inline styling; copy is inline zh/en by document language
815
+ * (the plugin's locale dictionaries stay untouched).
816
+ */
817
+ const COPY = {
818
+ zh: {
819
+ title: "上下文检查",
820
+ used: "已用",
821
+ remaining: "剩余",
822
+ window: "窗口容量",
823
+ percent: "占用",
824
+ system: "系统提示词",
825
+ tools: "工具定义",
826
+ messages: "对话消息",
827
+ warning: "上下文即将用尽——建议压缩上下文或开启新会话。",
828
+ aria: (percent) => `上下文已用 ${percent}`,
829
+ unset: "本轮尚未产生用量",
830
+ billing: "缓存账单",
831
+ billStep: "当前步",
832
+ billTurn: "当前轮",
833
+ billSession: "会话累计",
834
+ billCacheRead: "缓存命中",
835
+ billCacheMiss: "缓存未命中",
836
+ billOutput: "输出",
837
+ billFullMiss: "完全失效",
838
+ billRoundsWord: "步",
839
+ billPeak: "峰价",
840
+ billOffPeak: "谷价",
841
+ billPriced: "按 DeepSeek-V4.1-Flash 计价",
842
+ billEstimate: "按 Flash 价估算"
843
+ },
844
+ en: {
845
+ title: "Context check",
846
+ used: "Used",
847
+ remaining: "Remaining",
848
+ window: "Context window",
849
+ percent: "Pressure",
850
+ system: "System prompt",
851
+ tools: "Tool definitions",
852
+ messages: "Messages",
853
+ warning: "Context is nearly full — compact the context or start a new session.",
854
+ aria: (percent) => `${percent} of context used`,
855
+ unset: "No usage yet in this turn",
856
+ billing: "Cache billing",
857
+ billStep: "This step",
858
+ billTurn: "This turn",
859
+ billSession: "Session total",
860
+ billCacheRead: "Cache read",
861
+ billCacheMiss: "Cache miss",
862
+ billOutput: "Output",
863
+ billFullMiss: "Full misses",
864
+ billRoundsWord: "steps",
865
+ billPeak: "Peak rates",
866
+ billOffPeak: "Off-peak rates",
867
+ billPriced: "priced as DeepSeek-V4.1-Flash",
868
+ billEstimate: "estimated at Flash prices"
869
+ }
870
+ };
871
+ const copy = () => typeof document !== "undefined" && document.documentElement.lang?.toLowerCase().startsWith("zh") ? COPY.zh : COPY.en;
872
+ const RING_SIZE = 18;
873
+ const RING_STROKE = 2.5;
874
+ const triggerStyle$1 = {
875
+ display: "inline-flex",
876
+ alignItems: "center",
877
+ gap: "5px",
878
+ height: "24px",
879
+ padding: "0 6px",
880
+ background: "transparent",
881
+ border: "none",
882
+ borderRadius: "6px",
883
+ cursor: "pointer",
884
+ color: "var(--dsw-alias-label-secondary, inherit)",
885
+ fontFamily: "var(--ds-font-family-code, monospace)",
886
+ fontSize: "11px",
887
+ lineHeight: "16px",
888
+ whiteSpace: "nowrap"
889
+ };
890
+ const popStyle$1 = {
891
+ position: "absolute",
892
+ bottom: "calc(100% + 8px)",
893
+ right: 0,
894
+ zIndex: 1200,
895
+ minWidth: "264px",
896
+ padding: "10px 12px",
897
+ background: "var(--dsw-alias-bg-layer-3, rgba(127,127,127,0.05))",
898
+ color: "var(--dsw-alias-label-primary, inherit)",
899
+ border: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,0.25))",
900
+ borderRadius: "10px",
901
+ boxShadow: "0 8px 24px rgba(0,0,0,0.14)",
902
+ fontSize: "12px",
903
+ lineHeight: "18px"
904
+ };
905
+ const headStyle = {
906
+ display: "flex",
907
+ alignItems: "baseline",
908
+ gap: "8px",
909
+ fontWeight: 600,
910
+ marginBottom: "4px"
911
+ };
912
+ const figureStyle = {
913
+ fontVariantNumeric: "tabular-nums",
914
+ fontFamily: "var(--ds-font-family-code, monospace)"
915
+ };
916
+ const rowStyle$1 = {
917
+ display: "flex",
918
+ alignItems: "center",
919
+ gap: "12px",
920
+ padding: "2px 0"
921
+ };
922
+ const rowLabelStyle = {
923
+ display: "flex",
924
+ alignItems: "center",
925
+ color: "var(--dsw-alias-label-secondary, inherit)"
926
+ };
927
+ const rowValueStyle = {
928
+ marginLeft: "auto",
929
+ fontVariantNumeric: "tabular-nums",
930
+ fontWeight: 500,
931
+ textAlign: "right"
932
+ };
933
+ const swatchStyle = (color) => ({
934
+ display: "inline-block",
935
+ width: "8px",
936
+ height: "8px",
937
+ borderRadius: "2px",
938
+ marginRight: "6px",
939
+ flex: "none",
940
+ background: color
941
+ });
942
+ const warnStyle = {
943
+ marginTop: "6px",
944
+ color: "#f43f5e",
945
+ fontSize: "11px",
946
+ lineHeight: "16px"
947
+ };
948
+ const footStyle = {
949
+ marginTop: "6px",
950
+ color: "var(--dsw-alias-label-caption, inherit)",
951
+ fontSize: "11px",
952
+ lineHeight: "16px"
953
+ };
954
+ const BREAKDOWN_COLORS = {
955
+ system: "#8b5cf6",
956
+ tools: "#0ea5e9",
957
+ messages: "#10b981"
958
+ };
959
+ /** Pressure color: calm → amber → red (cache-billing's foot/warn palette). */
960
+ function pressureColor(percent) {
961
+ if (percent >= 85) return "#f43f5e";
962
+ if (percent >= 70) return "#f59e0b";
963
+ return "var(--dsw-alias-label-secondary, currentColor)";
964
+ }
965
+ /** Format a token count compactly (12.3k / 1.24M). */
966
+ function formatTokens(n) {
967
+ if (n >= 1e6) return `${Math.round(n / 1e6 * 100) / 100}M`;
968
+ if (n >= 1e3) return `${Math.round(n / 1e3 * 10) / 10}k`;
969
+ return String(Math.round(n));
970
+ }
971
+ const BILL_COLORS = {
972
+ hit: "#10b981",
973
+ miss: "#f59e0b",
974
+ output: "#3b82f6"
975
+ };
976
+ /** One nested billing sub-row (cache-billing's indented swatch row). */
977
+ function BillSubRow({ label, tokens, amount, color }) {
978
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
979
+ style: {
980
+ ...rowStyle$1,
981
+ paddingLeft: "16px"
982
+ },
983
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dt", {
984
+ style: rowLabelStyle,
985
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: swatchStyle(color) }), label]
986
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", {
987
+ style: {
988
+ ...rowValueStyle,
989
+ margin: 0
990
+ },
991
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
992
+ style: {
993
+ color: "var(--dsw-alias-label-caption, inherit)",
994
+ fontWeight: 400,
995
+ marginRight: "6px"
996
+ },
997
+ children: [formatTokens(tokens), " tok"]
998
+ }), amount]
999
+ })]
1000
+ });
1001
+ }
1002
+ /** Format an amount: four decimals for a step, fewer for the totals. */
1003
+ function formatMoney(amount, digits) {
1004
+ return `¥${amount.toFixed(digits)}`;
1005
+ }
1006
+ let store = {};
1007
+ const listeners = /* @__PURE__ */ new Set();
1008
+ /** Immutable replacement — useSyncExternalStore compares snapshots by
1009
+ * reference, so in-place mutation would never re-render subscribers. */
1010
+ function publish(patch) {
1011
+ store = {
1012
+ ...store,
1013
+ ...patch
1014
+ };
1015
+ for (const listener of listeners) listener();
1016
+ }
1017
+ function subscribeStore(listener) {
1018
+ listeners.add(listener);
1019
+ return () => {
1020
+ listeners.delete(listener);
1021
+ };
1022
+ }
1023
+ function getStore() {
1024
+ return store;
1025
+ }
1026
+ /**
1027
+ * The zero-size data hook: props delivered by the slot renderer carry the
1028
+ * session projection hook; every push lands in the module store.
1029
+ */
1030
+ function ProjectionDataHook(props) {
1031
+ const pressure = props.useProjection?.("contextPressure");
1032
+ const breakdown = props.useProjection?.("contextBreakdown");
1033
+ const billing = props.useProjection?.("tlCacheBilling");
1034
+ (0, react.useEffect)(() => {
1035
+ publish({
1036
+ seatMounted: true,
1037
+ pressure,
1038
+ breakdown,
1039
+ billing
1040
+ });
1041
+ });
1042
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1043
+ "data-dsh-thinking-levels": "projection-hook",
1044
+ style: { display: "none" }
1045
+ });
1046
+ }
1047
+ /** The SVG ring: one background track + one pressure arc. */
1048
+ function Ring({ percent, color }) {
1049
+ const r = 15.5 / 2;
1050
+ const c = 2 * Math.PI * r;
1051
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1052
+ width: RING_SIZE,
1053
+ height: RING_SIZE,
1054
+ viewBox: `0 0 ${RING_SIZE} ${RING_SIZE}`,
1055
+ "aria-hidden": "true",
1056
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
1057
+ cx: RING_SIZE / 2,
1058
+ cy: RING_SIZE / 2,
1059
+ r,
1060
+ fill: "none",
1061
+ stroke: "var(--dsw-alias-border-l2, rgba(127,127,127,0.3))",
1062
+ strokeWidth: RING_STROKE
1063
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
1064
+ cx: RING_SIZE / 2,
1065
+ cy: RING_SIZE / 2,
1066
+ r,
1067
+ fill: "none",
1068
+ stroke: color,
1069
+ strokeWidth: RING_STROKE,
1070
+ strokeLinecap: "round",
1071
+ strokeDasharray: `${c * Math.max(0, Math.min(100, percent)) / 100} ${c}`,
1072
+ transform: `rotate(-90 ${RING_SIZE / 2} ${RING_SIZE / 2})`
1073
+ })]
1074
+ });
1075
+ }
1076
+ /** One breakdown row (cache-billing's swatch-row layout). */
1077
+ function BreakdownRow({ label, value, color }) {
1078
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1079
+ style: rowStyle$1,
1080
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dt", {
1081
+ style: rowLabelStyle,
1082
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: swatchStyle(color) }), label]
1083
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", {
1084
+ style: {
1085
+ ...rowValueStyle,
1086
+ margin: 0
1087
+ },
1088
+ children: formatTokens(value)
1089
+ })]
1090
+ });
1091
+ }
1092
+ /**
1093
+ * The ring entry: pressure arc trigger + the check popover. Renders nothing
1094
+ * without a projection seat or before the session has any reading.
1095
+ */
1096
+ function ContextRing(props) {
1097
+ const live = (0, react.useSyncExternalStore)(subscribeStore, getStore);
1098
+ const hasSeat = live.seatMounted === true;
1099
+ const [open, setOpen] = (0, react.useState)(false);
1100
+ const rootRef = (0, react.useRef)(null);
1101
+ const pressure = live.pressure;
1102
+ const breakdown = live.breakdown;
1103
+ const billing = live.billing;
1104
+ const used = typeof pressure?.projectedTokens === "number" ? pressure.projectedTokens : typeof pressure?.pressureTokens === "number" ? pressure.pressureTokens : void 0;
1105
+ const window_ = typeof pressure?.contextWindow === "number" && pressure.contextWindow > 0 ? pressure.contextWindow : typeof props.contextWindowFallback === "number" && props.contextWindowFallback > 0 ? props.contextWindowFallback : void 0;
1106
+ const hasReading = used !== void 0 && window_ !== void 0 && window_ > 0;
1107
+ const c = copy();
1108
+ const percent = hasReading ? Math.min(100, Math.round(used / window_ * 100)) : 0;
1109
+ const color = pressureColor(percent);
1110
+ const remaining = hasReading ? Math.max(0, window_ - used) : 0;
1111
+ const rows = !hasReading || breakdown === void 0 ? [] : [
1112
+ {
1113
+ label: c.system,
1114
+ value: breakdown.systemTokens,
1115
+ color: BREAKDOWN_COLORS.system
1116
+ },
1117
+ {
1118
+ label: c.tools,
1119
+ value: breakdown.toolsTokens,
1120
+ color: BREAKDOWN_COLORS.tools
1121
+ },
1122
+ {
1123
+ label: c.messages,
1124
+ value: breakdown.messageTokens,
1125
+ color: BREAKDOWN_COLORS.messages
1126
+ }
1127
+ ];
1128
+ if (!hasSeat) return null;
1129
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1130
+ ref: rootRef,
1131
+ style: {
1132
+ position: "relative",
1133
+ display: "inline-flex"
1134
+ },
1135
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1136
+ type: "button",
1137
+ style: hasReading ? triggerStyle$1 : {
1138
+ ...triggerStyle$1,
1139
+ opacity: .55
1140
+ },
1141
+ "aria-label": hasReading ? c.aria(`${percent}%`) : c.unset,
1142
+ "aria-haspopup": hasReading ? "dialog" : void 0,
1143
+ "aria-expanded": open,
1144
+ onClick: () => {
1145
+ if (hasReading) setOpen((state) => !state);
1146
+ },
1147
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Ring, {
1148
+ percent,
1149
+ color
1150
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1151
+ style: {
1152
+ ...figureStyle,
1153
+ color: hasReading ? color : "var(--dsw-alias-label-caption, inherit)"
1154
+ },
1155
+ children: hasReading ? `${percent}%` : "–"
1156
+ })]
1157
+ }), open && hasReading && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1158
+ style: popStyle$1,
1159
+ role: "dialog",
1160
+ "aria-label": c.title,
1161
+ children: [
1162
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1163
+ style: headStyle,
1164
+ children: [c.title, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1165
+ style: {
1166
+ ...rowValueStyle,
1167
+ ...figureStyle
1168
+ },
1169
+ children: [
1170
+ "~",
1171
+ formatTokens(used),
1172
+ " / ",
1173
+ formatTokens(window_)
1174
+ ]
1175
+ })]
1176
+ }),
1177
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1178
+ style: rowStyle$1,
1179
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
1180
+ style: rowLabelStyle,
1181
+ children: c.percent
1182
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", {
1183
+ style: {
1184
+ ...rowValueStyle,
1185
+ margin: 0,
1186
+ color
1187
+ },
1188
+ children: [percent, "%"]
1189
+ })]
1190
+ }),
1191
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1192
+ style: rowStyle$1,
1193
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
1194
+ style: rowLabelStyle,
1195
+ children: c.remaining
1196
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", {
1197
+ style: {
1198
+ ...rowValueStyle,
1199
+ margin: 0
1200
+ },
1201
+ children: formatTokens(remaining)
1202
+ })]
1203
+ }),
1204
+ rows.every((row) => typeof row.value === "number") && rows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dl", {
1205
+ style: {
1206
+ margin: "4px 0 0",
1207
+ padding: "6px 0 0",
1208
+ borderTop: "1px solid var(--dsw-alias-border-l3, rgba(127,127,127,0.18))"
1209
+ },
1210
+ children: rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BreakdownRow, {
1211
+ label: row.label,
1212
+ value: row.value,
1213
+ color: row.color
1214
+ }, row.label))
1215
+ }),
1216
+ billing?.available === true && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dl", {
1217
+ style: {
1218
+ margin: "4px 0 0",
1219
+ padding: "6px 0 0",
1220
+ borderTop: "1px solid var(--dsw-alias-border-l3, rgba(127,127,127,0.18))"
1221
+ },
1222
+ children: [
1223
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1224
+ style: rowStyle$1,
1225
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
1226
+ style: {
1227
+ ...rowLabelStyle,
1228
+ color: "#a78bfa"
1229
+ },
1230
+ children: c.billStep
1231
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", {
1232
+ style: {
1233
+ ...rowValueStyle,
1234
+ margin: 0
1235
+ },
1236
+ children: [
1237
+ formatTokens((billing.totalInputTokens ?? 0) + (billing.outputTokens ?? 0)),
1238
+ " tok ",
1239
+ formatMoney(billing.cost ?? 0, 4)
1240
+ ]
1241
+ })]
1242
+ }),
1243
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BillSubRow, {
1244
+ label: c.billCacheRead,
1245
+ tokens: billing.cacheReadTokens ?? 0,
1246
+ amount: formatMoney(billing.cost ?? 0, 4),
1247
+ color: BILL_COLORS.hit
1248
+ }),
1249
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BillSubRow, {
1250
+ label: c.billCacheMiss,
1251
+ tokens: (billing.totalInputTokens ?? 0) - (billing.cacheReadTokens ?? 0),
1252
+ amount: formatMoney(billing.missCost ?? 0, 4),
1253
+ color: BILL_COLORS.miss
1254
+ }),
1255
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BillSubRow, {
1256
+ label: c.billOutput,
1257
+ tokens: billing.outputTokens ?? 0,
1258
+ amount: formatMoney(billing.outputCost ?? 0, 4),
1259
+ color: BILL_COLORS.output
1260
+ }),
1261
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1262
+ style: rowStyle$1,
1263
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
1264
+ style: {
1265
+ ...rowLabelStyle,
1266
+ color: "#22d3ee"
1267
+ },
1268
+ children: c.billTurn
1269
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", {
1270
+ style: {
1271
+ ...rowValueStyle,
1272
+ margin: 0
1273
+ },
1274
+ children: [
1275
+ formatTokens(billing.turnTokens ?? 0),
1276
+ " tok ",
1277
+ formatMoney(billing.turnCost ?? 0, 3)
1278
+ ]
1279
+ })]
1280
+ }),
1281
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BillSubRow, {
1282
+ label: c.billCacheRead,
1283
+ tokens: billing.turnCacheReadTokens ?? 0,
1284
+ amount: formatMoney(billing.turnHitCost ?? 0, 3),
1285
+ color: BILL_COLORS.hit
1286
+ }),
1287
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BillSubRow, {
1288
+ label: c.billCacheMiss,
1289
+ tokens: (billing.turnInputTokens ?? 0) - (billing.turnCacheReadTokens ?? 0),
1290
+ amount: formatMoney(billing.turnMissCost ?? 0, 3),
1291
+ color: BILL_COLORS.miss
1292
+ }),
1293
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BillSubRow, {
1294
+ label: c.billOutput,
1295
+ tokens: billing.turnOutputTokens ?? 0,
1296
+ amount: formatMoney(billing.turnOutputCost ?? 0, 3),
1297
+ color: BILL_COLORS.output
1298
+ }),
1299
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1300
+ style: rowStyle$1,
1301
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dt", {
1302
+ style: {
1303
+ ...rowLabelStyle,
1304
+ color: "#f472b6"
1305
+ },
1306
+ children: [c.billSession, billing.sessionRounds ? ` · ${billing.sessionRounds} ${c.billRoundsWord}` : ""]
1307
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", {
1308
+ style: {
1309
+ ...rowValueStyle,
1310
+ margin: 0
1311
+ },
1312
+ children: [
1313
+ formatTokens((billing.sessionInputTokens ?? 0) + (billing.sessionOutputTokens ?? 0)),
1314
+ " tok ",
1315
+ formatMoney((billing.sessionCacheHitCost ?? 0) + (billing.sessionMissCost ?? 0) + (billing.sessionOutputCost ?? 0), 2)
1316
+ ]
1317
+ })]
1318
+ }),
1319
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BillSubRow, {
1320
+ label: c.billCacheRead,
1321
+ tokens: billing.sessionCacheReadTokens ?? 0,
1322
+ amount: formatMoney(billing.sessionCacheHitCost ?? 0, 2),
1323
+ color: BILL_COLORS.hit
1324
+ }),
1325
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BillSubRow, {
1326
+ label: c.billCacheMiss,
1327
+ tokens: (billing.sessionInputTokens ?? 0) - (billing.sessionCacheReadTokens ?? 0),
1328
+ amount: formatMoney(billing.sessionMissCost ?? 0, 2),
1329
+ color: BILL_COLORS.miss
1330
+ }),
1331
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BillSubRow, {
1332
+ label: c.billOutput,
1333
+ tokens: billing.sessionOutputTokens ?? 0,
1334
+ amount: formatMoney(billing.sessionOutputCost ?? 0, 2),
1335
+ color: BILL_COLORS.output
1336
+ }),
1337
+ (billing.sessionFullMissSteps ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1338
+ style: rowStyle$1,
1339
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
1340
+ style: {
1341
+ ...rowLabelStyle,
1342
+ color: "#f43f5e"
1343
+ },
1344
+ children: c.billFullMiss
1345
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", {
1346
+ style: {
1347
+ ...rowValueStyle,
1348
+ margin: 0
1349
+ },
1350
+ children: billing.sessionFullMissSteps
1351
+ })]
1352
+ })
1353
+ ]
1354
+ }),
1355
+ percent >= 85 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1356
+ style: warnStyle,
1357
+ children: c.warning
1358
+ }),
1359
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1360
+ style: footStyle,
1361
+ children: [
1362
+ c.window,
1363
+ ": ",
1364
+ hasReading ? window_.toLocaleString() : c.unset,
1365
+ billing?.available === true ? ` · ${billing.tier === "peak" ? c.billPeak : c.billOffPeak} · ${billing.modelMatched === false ? c.billEstimate : c.billPriced}` : ""
1366
+ ]
1367
+ })
1368
+ ]
1369
+ })]
1370
+ });
1371
+ }
1372
+ //#endregion
716
1373
  //#region src/thinking-level.ts
717
1374
  /**
718
1375
  * Display rank of the effort slider stops: `auto` is the scheduler sentinel and
@@ -1746,7 +2403,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
1746
2403
  /** The user-layer `providers` value of the llm-pi-ai namespace, when present. */
1747
2404
  function providersOf$1(snapshot) {
1748
2405
  if (typeof snapshot !== "object" || snapshot === null) return {};
1749
- const user = snapshot.user;
2406
+ const user = snapshot.user ?? snapshot.value;
1750
2407
  if (typeof user !== "object" || user === null || Array.isArray(user)) return {};
1751
2408
  const providers = user["providers"];
1752
2409
  return typeof providers === "object" && providers !== null && !Array.isArray(providers) ? providers : {};
@@ -1834,13 +2491,18 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
1834
2491
  const model = group.models.find((candidate) => candidate.id === state.current?.model);
1835
2492
  if (model !== void 0) return {
1836
2493
  model,
1837
- name: model.name
2494
+ name: model.name,
2495
+ provider: group.id
1838
2496
  };
1839
2497
  }
1840
2498
  }, [state]);
1841
2499
  const providers = (0, react.useMemo)(() => providersOf$1(piSnapshot), [piSnapshot]);
1842
2500
  const dsSection = (0, react.useMemo)(() => deepseekSectionOf(dsSnapshot), [dsSnapshot]);
1843
- /** The effective window of one model line, resolved against its family. */
2501
+ /** The effective window of one model line, resolved against its family.
2502
+ * Declared BEFORE activeWindow: the ring's window-fallback memo calls this
2503
+ * in its factory, and a const arrow below the first caller would be a
2504
+ * temporal-dead-zone ReferenceError on every mount with a selected model
2505
+ * (the seat then abdicates and the shipped selector takes over). */
1844
2506
  const windowOf = (provider, model) => {
1845
2507
  if (provider === DEEPSEEK_PROVIDER) {
1846
2508
  const models = dsSection.models ?? [];
@@ -1850,6 +2512,15 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
1850
2512
  const entry = piModelEntry(providers, provider, model);
1851
2513
  return entry === void 0 ? void 0 : contextWindowOf(entry);
1852
2514
  };
2515
+ /** The active model's declared capacity — the ring's window fallback. */
2516
+ const activeWindow = (0, react.useMemo)(() => {
2517
+ if (current === void 0) return void 0;
2518
+ return windowOf(current.provider, current.model.id ?? current.model.name ?? "");
2519
+ }, [
2520
+ current,
2521
+ providers,
2522
+ dsSection
2523
+ ]);
1853
2524
  /** Whether one model line has a config write target. */
1854
2525
  const writableLine = (provider, model) => {
1855
2526
  if (!writable) return false;
@@ -1969,279 +2640,283 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
1969
2640
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1970
2641
  ref: rootRef,
1971
2642
  style: rootStyle,
1972
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1973
- type: "button",
1974
- style: triggerStyle,
1975
- "aria-expanded": open,
1976
- "aria-haspopup": "dialog",
1977
- "aria-label": t("model.panel.choose"),
1978
- title: state.current === null ? triggerLabel : `${state.current.provider}/${triggerLabel}`,
1979
- onClick: () => {
1980
- if (open) close();
1981
- else {
1982
- setOpen(true);
1983
- setError(null);
1984
- }
1985
- },
1986
- children: [
1987
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1988
- style: triggerNameStyle,
1989
- children: triggerLabel
1990
- }),
1991
- effortLabel !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1992
- style: triggerEffortStyle,
1993
- children: effortLabel
1994
- }),
1995
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1996
- style: chevronStyle,
1997
- children: open ? "▲" : "▼"
1998
- })
1999
- ]
2000
- }), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2001
- style: backdropStyle,
2002
- onClick: close
2003
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2004
- style: popStyle,
2005
- role: "dialog",
2006
- "aria-label": t("model.panel.choose"),
2007
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2008
- style: modelsStyle,
2643
+ children: [
2644
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2645
+ type: "button",
2646
+ style: triggerStyle,
2647
+ "aria-expanded": open,
2648
+ "aria-haspopup": "dialog",
2649
+ "aria-label": t("model.panel.choose"),
2650
+ title: state.current === null ? triggerLabel : `${state.current.provider}/${triggerLabel}`,
2651
+ onClick: () => {
2652
+ if (open) close();
2653
+ else {
2654
+ setOpen(true);
2655
+ setError(null);
2656
+ }
2657
+ },
2009
2658
  children: [
2010
- directory === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2011
- style: statusStyle,
2012
- children: t("model.panel.unavailable")
2659
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2660
+ style: triggerNameStyle,
2661
+ children: triggerLabel
2013
2662
  }),
2014
- directory !== void 0 && state.status === "loading" && state.groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2015
- style: statusStyle,
2016
- children: t("model.panel.loading")
2663
+ effortLabel !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2664
+ style: triggerEffortStyle,
2665
+ children: effortLabel
2017
2666
  }),
2018
- directory !== void 0 && state.groups.map((group) => {
2019
- const isExpanded = expanded.has(group.id);
2020
- const name = group.name ?? group.label ?? group.id;
2021
- const activeModel = state.current?.provider === group.id ? state.current.model : void 0;
2022
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2023
- type: "button",
2024
- style: providerToggleStyle,
2025
- "aria-expanded": isExpanded,
2026
- onClick: () => toggleProvider(group.id),
2027
- children: [
2028
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2029
- style: providerNameStyle$1,
2030
- children: name
2031
- }),
2032
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2033
- style: providerMetaStyle,
2034
- children: group.models.length
2035
- }),
2036
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2037
- style: chevronStyle,
2038
- children: isExpanded ? "▼" : "▶"
2039
- })
2040
- ]
2041
- }), isExpanded && group.models.map((model) => {
2042
- const active = activeModel === model.id;
2043
- const lineWritable = writableLine(group.id, model.id);
2044
- const lineWindow = windowOf(group.id, model.id);
2045
- const isContextEditing = editing !== null && editing.provider === group.id && editing.model === model.id && editing.kind === "context";
2046
- const isEffortEditing = editing !== null && editing.provider === group.id && editing.model === model.id && editing.kind === "effort";
2047
- const lineEffort = active ? state.current?.reasoningEffort ?? model.reasoning?.defaultEffort : model.reasoning?.defaultEffort;
2048
- const lineStops = model.reasoning === void 0 ? [] : orderEffortsForSlider(model.reasoning.efforts);
2049
- const lineEffortName = lineEffort === void 0 ? t("input.effort.default") : lineStops.find((stop) => stop.id === lineEffort)?.name ?? lineEffort;
2050
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2051
- style: active ? modelRowActiveStyle : modelRowStyle$1,
2667
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2668
+ style: chevronStyle,
2669
+ children: open ? "▲" : "▼"
2670
+ })
2671
+ ]
2672
+ }),
2673
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextRing, { contextWindowFallback: activeWindow }),
2674
+ open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2675
+ style: backdropStyle,
2676
+ onClick: close
2677
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2678
+ style: popStyle,
2679
+ role: "dialog",
2680
+ "aria-label": t("model.panel.choose"),
2681
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2682
+ style: modelsStyle,
2683
+ children: [
2684
+ directory === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2685
+ style: statusStyle,
2686
+ children: t("model.panel.unavailable")
2687
+ }),
2688
+ directory !== void 0 && state.status === "loading" && state.groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2689
+ style: statusStyle,
2690
+ children: t("model.panel.loading")
2691
+ }),
2692
+ directory !== void 0 && state.groups.map((group) => {
2693
+ const isExpanded = expanded.has(group.id);
2694
+ const name = group.name ?? group.label ?? group.id;
2695
+ const activeModel = state.current?.provider === group.id ? state.current.model : void 0;
2696
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2697
+ type: "button",
2698
+ style: providerToggleStyle,
2699
+ "aria-expanded": isExpanded,
2700
+ onClick: () => toggleProvider(group.id),
2052
2701
  children: [
2053
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2054
- type: "button",
2055
- role: "option",
2056
- "aria-selected": active,
2057
- style: modelPickStyle,
2058
- disabled: busy,
2059
- onClick: () => chooseModel(group.id, model.id),
2060
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2061
- style: modelCopyStyle,
2062
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2063
- style: modelNameStyle,
2064
- children: model.name
2065
- })
2066
- }), active && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2067
- style: checkStyle,
2068
- "aria-hidden": "true",
2069
- children: "✓"
2070
- })]
2071
- }),
2072
- (model.reasoning?.efforts.length ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2073
- role: "button",
2074
- tabIndex: 0,
2075
- "aria-label": t("input.effort.title"),
2076
- title: t("input.effort.title"),
2077
- "aria-expanded": isEffortEditing,
2078
- style: effortChipStyle,
2079
- onClick: (event) => {
2080
- event.stopPropagation();
2081
- if (!busy) toggleEffortEditor(group.id, model.id);
2082
- },
2083
- onKeyDown: (event) => {
2084
- if (event.key !== "Enter" && event.key !== " ") return;
2085
- event.preventDefault();
2086
- event.stopPropagation();
2087
- if (!busy) toggleEffortEditor(group.id, model.id);
2088
- },
2089
- children: lineEffortName
2090
- }),
2091
- isEffortEditing && model.reasoning !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2092
- style: editorRowStyle,
2093
- onClick: (event) => event.stopPropagation(),
2094
- children: [
2095
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2096
- style: labelStyle$1,
2097
- children: t("input.effort.title")
2098
- }),
2099
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EffortSlider, {
2100
- stops: lineStops,
2101
- value: lineEffort,
2102
- mascot: isDeepSeekLine(group.id, model.id, model.name),
2103
- disabled: busy,
2104
- onCommit: (id) => chooseEffort(group.id, model.id, id),
2105
- t
2106
- }),
2107
- model.reasoning.defaultEffort !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2108
- type: "button",
2109
- disabled: busy,
2110
- "aria-label": t("input.effort.reset"),
2111
- title: t("input.effort.reset"),
2112
- style: actionButtonStyle,
2113
- onClick: (event) => {
2114
- event.stopPropagation();
2115
- const target = model.reasoning?.defaultEffort;
2116
- if (target !== void 0) chooseEffort(group.id, model.id, target);
2117
- },
2118
- children: "↺"
2119
- })
2120
- ]
2702
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2703
+ style: providerNameStyle$1,
2704
+ children: name
2121
2705
  }),
2122
2706
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2123
- role: "button",
2124
- tabIndex: 0,
2125
- "aria-label": t("input.context.title"),
2126
- title: lineWritable ? t("input.context.globalHint") : t("model.panel.noTarget"),
2127
- style: lineWritable && !busy ? chipStyle : chipDisabledStyle,
2128
- onClick: (event) => {
2129
- event.stopPropagation();
2130
- if (!lineWritable || busy) return;
2131
- if (isContextEditing) {
2132
- setEditing(null);
2133
- return;
2134
- }
2135
- openEditor(group.id, model.id);
2136
- },
2137
- onKeyDown: (event) => {
2138
- if (event.key !== "Enter" && event.key !== " ") return;
2139
- event.preventDefault();
2140
- event.stopPropagation();
2141
- if (!lineWritable || busy) return;
2142
- openEditor(group.id, model.id);
2143
- },
2144
- children: lineWindow === void 0 ? t("input.context.unset") : formatContextWindow(lineWindow)
2707
+ style: providerMetaStyle,
2708
+ children: group.models.length
2145
2709
  }),
2146
- isContextEditing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2147
- style: editorRowStyle,
2148
- children: [
2149
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2150
- style: labelStyle$1,
2151
- title: t("input.context.globalHint"),
2152
- children: t("model.panel.window")
2153
- }),
2154
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2155
- type: "range",
2156
- min: 0,
2157
- max: CONTEXT_WINDOW_PRESETS.length - 1,
2158
- step: 1,
2159
- value: draft ?? stopIndexOf(lineWindow),
2160
- disabled: busy,
2161
- "aria-label": t("input.context.title"),
2162
- style: sliderStyle,
2163
- onChange: (event) => {
2164
- setDraft(Number(event.currentTarget.value));
2165
- },
2166
- onPointerUp: () => {
2167
- if (draft === null) return;
2168
- commitWindow(group.id, model.id, CONTEXT_WINDOW_PRESETS[draft]?.value);
2169
- },
2170
- onKeyUp: () => {
2171
- if (draft === null) return;
2172
- commitWindow(group.id, model.id, CONTEXT_WINDOW_PRESETS[draft]?.value);
2173
- }
2174
- }),
2175
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2176
- style: valueStyle,
2177
- children: draft === null ? lineWindow === void 0 ? t("input.context.unset") : formatContextWindow(lineWindow) : formatContextWindow(CONTEXT_WINDOW_PRESETS[draft]?.value ?? 0)
2178
- }),
2179
- custom ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2180
- type: "text",
2181
- inputMode: "numeric",
2182
- value: raw,
2183
- disabled: busy,
2184
- placeholder: t("input.context.customPlaceholder"),
2185
- "aria-label": t("input.context.customPlaceholder"),
2186
- style: inputStyle,
2187
- onChange: (event) => {
2188
- setRaw(event.currentTarget.value);
2189
- },
2190
- onKeyDown: (event) => {
2191
- if (event.key === "Enter") applyCustom();
2192
- }
2193
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2194
- type: "button",
2195
- disabled: busy,
2196
- style: actionButtonStyle,
2197
- onClick: applyCustom,
2198
- children: t("input.context.apply")
2199
- })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2200
- type: "button",
2201
- disabled: busy,
2202
- "aria-label": t("input.context.custom"),
2203
- title: t("input.context.custom"),
2204
- style: actionButtonStyle,
2205
- onClick: () => {
2206
- setCustom(true);
2207
- setError(null);
2208
- },
2209
- children: "⋯"
2210
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2211
- type: "button",
2212
- disabled: busy || lineWindow === void 0,
2213
- style: {
2214
- ...actionButtonStyle,
2215
- opacity: lineWindow === void 0 ? .55 : 1
2216
- },
2217
- onClick: () => {
2218
- setDraft(null);
2219
- setError(null);
2220
- commitWindow(group.id, model.id, void 0);
2221
- },
2222
- children: t("input.context.clear")
2223
- })] }),
2224
- error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2225
- style: errorStyle,
2226
- children: error
2227
- })
2228
- ]
2710
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2711
+ style: chevronStyle,
2712
+ children: isExpanded ? "▼" : "▶"
2229
2713
  })
2230
2714
  ]
2231
- }, group.id + ":" + model.id);
2232
- })] }, group.id);
2233
- }),
2234
- directory !== void 0 && state.status !== "loading" && state.groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2235
- style: statusStyle,
2236
- children: t("model.panel.empty")
2237
- })
2238
- ]
2239
- }), directory !== void 0 && state.error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2240
- style: errorBannerStyle,
2241
- role: "status",
2242
- children: state.error
2243
- })]
2244
- })] }) : null]
2715
+ }), isExpanded && group.models.map((model) => {
2716
+ const active = activeModel === model.id;
2717
+ const lineWritable = writableLine(group.id, model.id);
2718
+ const lineWindow = windowOf(group.id, model.id);
2719
+ const isContextEditing = editing !== null && editing.provider === group.id && editing.model === model.id && editing.kind === "context";
2720
+ const isEffortEditing = editing !== null && editing.provider === group.id && editing.model === model.id && editing.kind === "effort";
2721
+ const lineEffort = active ? state.current?.reasoningEffort ?? model.reasoning?.defaultEffort : model.reasoning?.defaultEffort;
2722
+ const lineStops = model.reasoning === void 0 ? [] : orderEffortsForSlider(model.reasoning.efforts);
2723
+ const lineEffortName = lineEffort === void 0 ? t("input.effort.default") : lineStops.find((stop) => stop.id === lineEffort)?.name ?? lineEffort;
2724
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2725
+ style: active ? modelRowActiveStyle : modelRowStyle$1,
2726
+ children: [
2727
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2728
+ type: "button",
2729
+ role: "option",
2730
+ "aria-selected": active,
2731
+ style: modelPickStyle,
2732
+ disabled: busy,
2733
+ onClick: () => chooseModel(group.id, model.id),
2734
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2735
+ style: modelCopyStyle,
2736
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2737
+ style: modelNameStyle,
2738
+ children: model.name
2739
+ })
2740
+ }), active && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2741
+ style: checkStyle,
2742
+ "aria-hidden": "true",
2743
+ children: "✓"
2744
+ })]
2745
+ }),
2746
+ (model.reasoning?.efforts.length ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2747
+ role: "button",
2748
+ tabIndex: 0,
2749
+ "aria-label": t("input.effort.title"),
2750
+ title: t("input.effort.title"),
2751
+ "aria-expanded": isEffortEditing,
2752
+ style: effortChipStyle,
2753
+ onClick: (event) => {
2754
+ event.stopPropagation();
2755
+ if (!busy) toggleEffortEditor(group.id, model.id);
2756
+ },
2757
+ onKeyDown: (event) => {
2758
+ if (event.key !== "Enter" && event.key !== " ") return;
2759
+ event.preventDefault();
2760
+ event.stopPropagation();
2761
+ if (!busy) toggleEffortEditor(group.id, model.id);
2762
+ },
2763
+ children: lineEffortName
2764
+ }),
2765
+ isEffortEditing && model.reasoning !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2766
+ style: editorRowStyle,
2767
+ onClick: (event) => event.stopPropagation(),
2768
+ children: [
2769
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2770
+ style: labelStyle$1,
2771
+ children: t("input.effort.title")
2772
+ }),
2773
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EffortSlider, {
2774
+ stops: lineStops,
2775
+ value: lineEffort,
2776
+ mascot: isDeepSeekLine(group.id, model.id, model.name),
2777
+ disabled: busy,
2778
+ onCommit: (id) => chooseEffort(group.id, model.id, id),
2779
+ t
2780
+ }),
2781
+ model.reasoning.defaultEffort !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2782
+ type: "button",
2783
+ disabled: busy,
2784
+ "aria-label": t("input.effort.reset"),
2785
+ title: t("input.effort.reset"),
2786
+ style: actionButtonStyle,
2787
+ onClick: (event) => {
2788
+ event.stopPropagation();
2789
+ const target = model.reasoning?.defaultEffort;
2790
+ if (target !== void 0) chooseEffort(group.id, model.id, target);
2791
+ },
2792
+ children: "↺"
2793
+ })
2794
+ ]
2795
+ }),
2796
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2797
+ role: "button",
2798
+ tabIndex: 0,
2799
+ "aria-label": t("input.context.title"),
2800
+ title: lineWritable ? t("input.context.globalHint") : t("model.panel.noTarget"),
2801
+ style: lineWritable && !busy ? chipStyle : chipDisabledStyle,
2802
+ onClick: (event) => {
2803
+ event.stopPropagation();
2804
+ if (!lineWritable || busy) return;
2805
+ if (isContextEditing) {
2806
+ setEditing(null);
2807
+ return;
2808
+ }
2809
+ openEditor(group.id, model.id);
2810
+ },
2811
+ onKeyDown: (event) => {
2812
+ if (event.key !== "Enter" && event.key !== " ") return;
2813
+ event.preventDefault();
2814
+ event.stopPropagation();
2815
+ if (!lineWritable || busy) return;
2816
+ openEditor(group.id, model.id);
2817
+ },
2818
+ children: lineWindow === void 0 ? t("input.context.unset") : formatContextWindow(lineWindow)
2819
+ }),
2820
+ isContextEditing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2821
+ style: editorRowStyle,
2822
+ children: [
2823
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2824
+ style: labelStyle$1,
2825
+ title: t("input.context.globalHint"),
2826
+ children: t("model.panel.window")
2827
+ }),
2828
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2829
+ type: "range",
2830
+ min: 0,
2831
+ max: CONTEXT_WINDOW_PRESETS.length - 1,
2832
+ step: 1,
2833
+ value: draft ?? stopIndexOf(lineWindow),
2834
+ disabled: busy,
2835
+ "aria-label": t("input.context.title"),
2836
+ style: sliderStyle,
2837
+ onChange: (event) => {
2838
+ setDraft(Number(event.currentTarget.value));
2839
+ },
2840
+ onPointerUp: () => {
2841
+ if (draft === null) return;
2842
+ commitWindow(group.id, model.id, CONTEXT_WINDOW_PRESETS[draft]?.value);
2843
+ },
2844
+ onKeyUp: () => {
2845
+ if (draft === null) return;
2846
+ commitWindow(group.id, model.id, CONTEXT_WINDOW_PRESETS[draft]?.value);
2847
+ }
2848
+ }),
2849
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2850
+ style: valueStyle,
2851
+ children: draft === null ? lineWindow === void 0 ? t("input.context.unset") : formatContextWindow(lineWindow) : formatContextWindow(CONTEXT_WINDOW_PRESETS[draft]?.value ?? 0)
2852
+ }),
2853
+ custom ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2854
+ type: "text",
2855
+ inputMode: "numeric",
2856
+ value: raw,
2857
+ disabled: busy,
2858
+ placeholder: t("input.context.customPlaceholder"),
2859
+ "aria-label": t("input.context.customPlaceholder"),
2860
+ style: inputStyle,
2861
+ onChange: (event) => {
2862
+ setRaw(event.currentTarget.value);
2863
+ },
2864
+ onKeyDown: (event) => {
2865
+ if (event.key === "Enter") applyCustom();
2866
+ }
2867
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2868
+ type: "button",
2869
+ disabled: busy,
2870
+ style: actionButtonStyle,
2871
+ onClick: applyCustom,
2872
+ children: t("input.context.apply")
2873
+ })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2874
+ type: "button",
2875
+ disabled: busy,
2876
+ "aria-label": t("input.context.custom"),
2877
+ title: t("input.context.custom"),
2878
+ style: actionButtonStyle,
2879
+ onClick: () => {
2880
+ setCustom(true);
2881
+ setError(null);
2882
+ },
2883
+ children: "⋯"
2884
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2885
+ type: "button",
2886
+ disabled: busy || lineWindow === void 0,
2887
+ style: {
2888
+ ...actionButtonStyle,
2889
+ opacity: lineWindow === void 0 ? .55 : 1
2890
+ },
2891
+ onClick: () => {
2892
+ setDraft(null);
2893
+ setError(null);
2894
+ commitWindow(group.id, model.id, void 0);
2895
+ },
2896
+ children: t("input.context.clear")
2897
+ })] }),
2898
+ error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2899
+ style: errorStyle,
2900
+ children: error
2901
+ })
2902
+ ]
2903
+ })
2904
+ ]
2905
+ }, group.id + ":" + model.id);
2906
+ })] }, group.id);
2907
+ }),
2908
+ directory !== void 0 && state.status !== "loading" && state.groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2909
+ style: statusStyle,
2910
+ children: t("model.panel.empty")
2911
+ })
2912
+ ]
2913
+ }), directory !== void 0 && state.error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2914
+ style: errorBannerStyle,
2915
+ role: "status",
2916
+ children: state.error
2917
+ })]
2918
+ })] }) : null
2919
+ ]
2245
2920
  });
2246
2921
  }
2247
2922
  //#endregion
@@ -2341,8 +3016,20 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2341
3016
  color: "var(--dsw-alias-label-primary)"
2342
3017
  };
2343
3018
  const controlStyle = {
2344
- background: "var(--dsw-alias-bg-surface, #fff)",
2345
- color: "var(--dsw-alias-label-primary)",
3019
+ background: "var(--dsw-alias-bg-surface, rgba(127,127,127,0.12))",
3020
+ color: "var(--dsw-alias-label-primary, inherit)",
3021
+ colorScheme: (() => {
3022
+ try {
3023
+ const [r, g, b] = (getComputedStyle(document.body).backgroundColor.match(/\d+/g) ?? [
3024
+ "255",
3025
+ "255",
3026
+ "255"
3027
+ ]).map(Number);
3028
+ return (r * 299 + g * 587 + b * 114) / 1e3 < 128 ? "dark" : "light";
3029
+ } catch {
3030
+ return "light";
3031
+ }
3032
+ })(),
2346
3033
  border: "1px solid var(--dsw-alias-border-l2)",
2347
3034
  borderRadius: "4px",
2348
3035
  padding: "3px 8px",
@@ -2511,7 +3198,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2511
3198
  /** The user-layer `providers` value of the llm-pi-ai namespace, when present. */
2512
3199
  function providersOf(snapshot) {
2513
3200
  if (typeof snapshot !== "object" || snapshot === null) return {};
2514
- const user = snapshot.user;
3201
+ const user = snapshot.user ?? snapshot.value;
2515
3202
  if (typeof user !== "object" || user === null || Array.isArray(user)) return {};
2516
3203
  const providers = user["providers"];
2517
3204
  return typeof providers === "object" && providers !== null && !Array.isArray(providers) ? providers : {};
@@ -2523,6 +3210,45 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2523
3210
  if (typeof compat !== "object" || compat === null || Array.isArray(compat)) return false;
2524
3211
  return compat["supportsDeveloperRole"] === false;
2525
3212
  }
3213
+ /**
3214
+ * Whether the transport currently takes this route over: its master switch on
3215
+ * AND the route in its manual providers list. Pure membership — the checkbox
3216
+ * is the single per-route truth, so dispatch uses the same set.
3217
+ */
3218
+ function takeoverActiveOf(section, providerId) {
3219
+ if (section.enabled !== true) return false;
3220
+ return Array.isArray(section.providers) && section.providers.includes(providerId);
3221
+ }
3222
+ /**
3223
+ * The transport's `extraInputs` dict ('provider/model' → modality list), from
3224
+ * its own section. The host llm-pi-ai schema caps a model row's `input` enum
3225
+ * at text|image, so video/audio declarations for omni models live here —
3226
+ * the taken-over transport unions them into the model's effective input.
3227
+ */
3228
+ function extraInputsOf(section) {
3229
+ if (typeof section.extraInputs !== "object" || section.extraInputs === null || Array.isArray(section.extraInputs)) return {};
3230
+ const out = {};
3231
+ for (const [key, value] of Object.entries(section.extraInputs)) if (Array.isArray(value)) out[key] = value.filter((m) => typeof m === "string");
3232
+ return out;
3233
+ }
3234
+ /**
3235
+ * One settings write with a single self-heal retry. A false return means the
3236
+ * host refused the optimistic lock — and the client has ALREADY completed its
3237
+ * recover() (a fresh describe folded into the mirror) by the time resolve
3238
+ * lands, so an immediate second attempt carries a fresh revision: the machine
3239
+ * equivalent of the user's proven "click it twice" workaround.
3240
+ */
3241
+ async function setWithRetry(scope, field, value) {
3242
+ if (await scope.set(field, value).catch(() => false)) return {
3243
+ ok: true,
3244
+ retried: false
3245
+ };
3246
+ await new Promise((resolve) => setTimeout(resolve, 350));
3247
+ return {
3248
+ ok: await scope.set(field, value).catch(() => false),
3249
+ retried: true
3250
+ };
3251
+ }
2526
3252
  /** The effective `compat` of an entry: its own `compat` merged over the provider-level `compat`. */
2527
3253
  function compatOf(entry) {
2528
3254
  const base = typeof entry.providerCompat === "object" && entry.providerCompat !== null ? entry.providerCompat : {};
@@ -2592,28 +3318,62 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2592
3318
  * @param readonly - whether writes are forbidden.
2593
3319
  * @returns the capabilities block, or a placeholder when nothing is configured.
2594
3320
  */
3321
+ /**
3322
+ * The absent-transport snapshot: a module-level CONSTANT. `useSyncExternalStore`
3323
+ * requires getSnapshot to return a STABLE value — an inline fallback literal is
3324
+ * a new object on every call, and React spins an infinite update loop (#185)
3325
+ * the moment this block renders with no transport handle (the ready branch's
3326
+ * first-ever mount crash).
3327
+ */
3328
+ const OC_ABSENT_SNAPSHOT = Object.freeze({
3329
+ status: "unavailable",
3330
+ value: void 0,
3331
+ revision: void 0,
3332
+ writable: false,
3333
+ base: void 0,
3334
+ user: void 0,
3335
+ mode: "memory"
3336
+ });
2595
3337
  function ModelCapabilities(props) {
2596
- const { scope, t, readonly } = props;
2597
- const snapshot = (0, react.useSyncExternalStore)((listener) => scope.subscribe(listener), () => scope.getSnapshot());
3338
+ const { scope, ocScope, tlScope, t, readonly } = props;
3339
+ const subscribe = (0, react.useCallback)((listener) => scope.subscribe(listener), [scope]);
3340
+ const getSnapshot = (0, react.useCallback)(() => scope.getSnapshot(), [scope]);
3341
+ const snapshot = (0, react.useSyncExternalStore)(subscribe, getSnapshot);
3342
+ const ocSubscribe = (0, react.useCallback)((listener) => ocScope?.subscribe(listener) ?? (() => {}), [ocScope]);
3343
+ const ocGetSnapshot = (0, react.useCallback)(() => ocScope !== void 0 ? ocScope.getSnapshot() : OC_ABSENT_SNAPSHOT, [ocScope]);
3344
+ const ocSnapshot = (0, react.useSyncExternalStore)(ocSubscribe, ocGetSnapshot);
3345
+ const ocSection = ocSnapshot.status === "ready" && typeof ocSnapshot.value === "object" && ocSnapshot.value !== null ? ocSnapshot.value : {};
3346
+ const ocWritable = ocSnapshot.status === "ready" && ocSnapshot.writable && !readonly;
3347
+ const [pendingOc, setPendingOc] = (0, react.useState)({});
3348
+ const [pendingPi, setPendingPi] = (0, react.useState)(void 0);
3349
+ const [writeError, setWriteError] = (0, react.useState)(null);
3350
+ const viewOc = {
3351
+ ...ocSection,
3352
+ ...pendingOc
3353
+ };
2598
3354
  const unavailable = snapshot.status === "unavailable";
2599
3355
  const providers = snapshot.status === "ready" ? providersOf(snapshot) : {};
2600
- const allEntries = entriesOf(providers);
3356
+ const viewProviders = {
3357
+ ...providers,
3358
+ ...pendingPi
3359
+ };
3360
+ const allEntries = entriesOf(viewProviders);
2601
3361
  const [query, setQuery] = (0, react.useState)("");
2602
3362
  const [expandedProviders, setExpandedProviders] = (0, react.useState)({});
2603
3363
  const [expandedModels, setExpandedModels] = (0, react.useState)({});
2604
3364
  const [drafts, setDrafts] = (0, react.useState)({});
2605
- const [busy, setBusy] = (0, react.useState)(false);
3365
+ const [busy] = (0, react.useState)(false);
2606
3366
  const [contextRaw, setContextRaw] = (0, react.useState)({});
2607
3367
  const [contextError, setContextError] = (0, react.useState)({});
2608
3368
  const entryKey = (entry) => `${entry.providerId}\u0000${entry.index}`;
2609
- /** Commit one patch over the user-layer providers. */
3369
+ /** Commit one patch over the user-layer providers (optimistic + self-heal retry). */
2610
3370
  const commitProviders = (mutate) => {
2611
3371
  if (snapshot.status !== "ready" || readonly) return;
2612
- setBusy(true);
2613
- scope.set("providers", mutate(structuredClone(providers))).then(() => {
2614
- setBusy(false);
2615
- }).catch(() => {
2616
- setBusy(false);
3372
+ const next = mutate(structuredClone(viewProviders));
3373
+ setPendingPi(next);
3374
+ setWithRetry(scope, "providers", next).then(({ ok }) => {
3375
+ setPendingPi(void 0);
3376
+ if (!ok) setWriteError(t("card.writeError"));
2617
3377
  });
2618
3378
  };
2619
3379
  /** Toggle the route-level official compat flag: unchecked = inherit (unset). */
@@ -2629,6 +3389,78 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2629
3389
  return current;
2630
3390
  });
2631
3391
  };
3392
+ /**
3393
+ * Toggle the per-route third-party takeover. Ownership split (plan §D): this
3394
+ * checkbox writes MEMBERSHIP only — `OC.enabled`'s sole writer is the host
3395
+ * mirror of TL's `takeover` master. Checking a route while the master is off
3396
+ * lights the master through ONE TL-namespace write instead of the old direct
3397
+ * OC.enabled write that used to fight the mirror and bounce the checkbox.
3398
+ */
3399
+ const toggleTakeover = (providerId, next) => {
3400
+ if (ocScope === void 0 || !ocWritable) return;
3401
+ const currentProviders = Array.isArray(viewOc.providers) ? viewOc.providers.filter((id) => typeof id === "string") : [];
3402
+ const providers = next ? [.../* @__PURE__ */ new Set([...currentProviders, providerId])] : currentProviders.filter((id) => id !== providerId);
3403
+ setPendingOc((cur) => ({
3404
+ ...cur,
3405
+ providers
3406
+ }));
3407
+ const tlTakeoverNow = (tlScope?.getSnapshot().value)?.takeover === true;
3408
+ if (next && !tlTakeoverNow && tlScope !== void 0) {
3409
+ setWithRetry(tlScope, "takeover", true).then(({ ok }) => {
3410
+ if (!ok) setWriteError(t("card.writeError"));
3411
+ });
3412
+ setWithRetry(ocScope, "enabled", true).then(({ ok }) => {
3413
+ if (!ok) setWriteError(t("card.writeError"));
3414
+ });
3415
+ }
3416
+ setWithRetry(ocScope, "providers", providers).then(({ ok }) => {
3417
+ setPendingOc((cur) => {
3418
+ const rest = { ...cur };
3419
+ delete rest["providers"];
3420
+ return rest;
3421
+ });
3422
+ if (!ok) {
3423
+ setPendingOc((cur) => ({
3424
+ ...cur,
3425
+ providers: currentProviders
3426
+ }));
3427
+ setWriteError(t("card.writeError"));
3428
+ }
3429
+ });
3430
+ };
3431
+ /** The model's extra input modalities declared on the transport ('provider/model' key). */
3432
+ const modelExtrasOf = (providerId, modelId) => extraInputsOf(viewOc)[`${providerId}/${modelId}`] ?? [];
3433
+ /** Toggle one model's video/audio declaration on the transport's extraInputs.
3434
+ * The host pi-ai schema caps model-row `input` at text|image, so omni
3435
+ * modalities live here — effective only while the route is taken over. */
3436
+ const toggleModelModality = (providerId, modelId, modality, next) => {
3437
+ if (ocScope === void 0 || !ocWritable) return;
3438
+ const current = extraInputsOf(viewOc);
3439
+ const modelKey = `${providerId}/${modelId}`;
3440
+ const entry = Array.isArray(current[modelKey]) ? [...current[modelKey]] : [];
3441
+ const nextEntry = next ? [.../* @__PURE__ */ new Set([...entry, modality])] : entry.filter((m) => m !== modality);
3442
+ const nextDict = { ...current };
3443
+ if (nextEntry.length > 0) nextDict[modelKey] = nextEntry;
3444
+ else delete nextDict[modelKey];
3445
+ setPendingOc((cur) => ({
3446
+ ...cur,
3447
+ extraInputs: nextDict
3448
+ }));
3449
+ setWithRetry(ocScope, "extraInputs", nextDict).then(({ ok }) => {
3450
+ setPendingOc((cur) => {
3451
+ const rest = { ...cur };
3452
+ delete rest["extraInputs"];
3453
+ return rest;
3454
+ });
3455
+ if (!ok) {
3456
+ setPendingOc((cur) => ({
3457
+ ...cur,
3458
+ extraInputs: current
3459
+ }));
3460
+ setWriteError(t("card.writeError"));
3461
+ }
3462
+ });
3463
+ };
2632
3464
  /** Patch one model row of one provider. */
2633
3465
  const patchModel = (providerId, index, patch) => {
2634
3466
  commitProviders((current) => {
@@ -2814,6 +3646,16 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2814
3646
  style: hintStyle,
2815
3647
  children: t("card.capabilities.hint")
2816
3648
  }),
3649
+ writeError !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
3650
+ style: {
3651
+ margin: "0 0 4px",
3652
+ fontSize: "12px",
3653
+ lineHeight: "18px",
3654
+ color: "var(--dsw-alias-danger, #e5484d)"
3655
+ },
3656
+ role: "status",
3657
+ children: ["⚠ ", writeError]
3658
+ }),
2817
3659
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2818
3660
  style: {
2819
3661
  display: "flex",
@@ -2892,6 +3734,23 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2892
3734
  onChange: (event) => toggleDeveloperRole(providerId, event.currentTarget.checked)
2893
3735
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.developerRole") })]
2894
3736
  }),
3737
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
3738
+ style: {
3739
+ display: "inline-flex",
3740
+ alignItems: "center",
3741
+ gap: "5px",
3742
+ fontSize: "11px",
3743
+ whiteSpace: "nowrap",
3744
+ color: ocWritable ? "var(--dsw-alias-label-secondary)" : "var(--dsw-alias-label-disabled, var(--dsw-alias-label-caption))"
3745
+ },
3746
+ title: ocScope === void 0 ? t("card.capabilities.takeoverHintAbsent") : t("card.capabilities.takeoverHint"),
3747
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3748
+ type: "checkbox",
3749
+ checked: takeoverActiveOf(viewOc, providerId),
3750
+ disabled: readonly || busy || !ocWritable,
3751
+ onChange: (event) => toggleTakeover(providerId, event.currentTarget.checked)
3752
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.takeover") })]
3753
+ }),
2895
3754
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2896
3755
  style: providerBadgeStyle,
2897
3756
  children: providerEntries.length
@@ -2944,6 +3803,16 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2944
3803
  title: "image",
2945
3804
  children: meta.image ? "IMG" : "–"
2946
3805
  }),
3806
+ modelExtrasOf(entry.providerId, entry.modelId).includes("video") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3807
+ style: badgeStyle,
3808
+ title: "video (extraInputs)",
3809
+ children: "VID"
3810
+ }),
3811
+ modelExtrasOf(entry.providerId, entry.modelId).includes("audio") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3812
+ style: badgeStyle,
3813
+ title: "audio (extraInputs)",
3814
+ children: "AUD"
3815
+ }),
2947
3816
  meta.context !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2948
3817
  style: badgeStyle,
2949
3818
  children: meta.context
@@ -2966,37 +3835,56 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2966
3835
  flexWrap: "wrap",
2967
3836
  margin: "2px 0 8px"
2968
3837
  },
2969
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2970
- style: {
2971
- display: "inline-flex",
2972
- alignItems: "center",
2973
- gap: "6px",
2974
- fontSize: "12px"
2975
- },
2976
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2977
- type: "checkbox",
2978
- checked: thinking,
2979
- disabled: readonly || busy,
2980
- onChange: (event) => toggleThinking(entry, event.currentTarget.checked)
2981
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.thinking") })]
2982
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2983
- style: {
2984
- display: "inline-flex",
2985
- alignItems: "center",
2986
- gap: "6px",
2987
- fontSize: "12px"
2988
- },
2989
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2990
- type: "checkbox",
2991
- checked: meta.image,
2992
- disabled: readonly || busy,
2993
- onChange: (event) => {
2994
- patchModel(entry.providerId, entry.index, (row) => {
2995
- row["input"] = event.currentTarget.checked ? ["text", "image"] : ["text"];
2996
- });
2997
- }
2998
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.vision") })]
2999
- })]
3838
+ children: [
3839
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
3840
+ style: {
3841
+ display: "inline-flex",
3842
+ alignItems: "center",
3843
+ gap: "6px",
3844
+ fontSize: "12px"
3845
+ },
3846
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3847
+ type: "checkbox",
3848
+ checked: thinking,
3849
+ disabled: readonly || busy,
3850
+ onChange: (event) => toggleThinking(entry, event.currentTarget.checked)
3851
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.thinking") })]
3852
+ }),
3853
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
3854
+ style: {
3855
+ display: "inline-flex",
3856
+ alignItems: "center",
3857
+ gap: "6px",
3858
+ fontSize: "12px"
3859
+ },
3860
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3861
+ type: "checkbox",
3862
+ checked: meta.image,
3863
+ disabled: readonly || busy,
3864
+ onChange: (event) => {
3865
+ patchModel(entry.providerId, entry.index, (row) => {
3866
+ row["input"] = event.currentTarget.checked ? ["text", "image"] : ["text"];
3867
+ });
3868
+ }
3869
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.vision") })]
3870
+ }),
3871
+ ["video", "audio"].map((modality) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
3872
+ style: {
3873
+ display: "inline-flex",
3874
+ alignItems: "center",
3875
+ gap: "6px",
3876
+ fontSize: "12px",
3877
+ color: takeoverActiveOf(viewOc, entry.providerId) ? void 0 : "var(--dsw-alias-label-disabled, var(--dsw-alias-label-caption))"
3878
+ },
3879
+ title: t("card.capabilities.mediaHint"),
3880
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3881
+ type: "checkbox",
3882
+ checked: modelExtrasOf(entry.providerId, entry.modelId).includes(modality),
3883
+ disabled: readonly || busy || !ocWritable || !takeoverActiveOf(viewOc, entry.providerId),
3884
+ onChange: (event) => toggleModelModality(entry.providerId, entry.modelId, modality, event.currentTarget.checked)
3885
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t(`card.capabilities.${modality}`) })]
3886
+ }, modality))
3887
+ ]
3000
3888
  }),
3001
3889
  thinking ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
3002
3890
  style: {
@@ -3237,13 +4125,38 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3237
4125
  * default so the family section reads as an open page of drawers.
3238
4126
  * @param props - locale copy and the injected scopes.
3239
4127
  */
3240
- function ThinkingLevelsCard({ t, scope, piAiScope }) {
4128
+ function ThinkingLevelsCard({ t, scope, piAiScope, ocScope }) {
3241
4129
  const [open, setOpen] = (0, react.useState)(true);
3242
- const snapshot = (0, react.useSyncExternalStore)((listener) => scope.subscribe(listener), () => scope.getSnapshot());
4130
+ const subscribe = (0, react.useCallback)((listener) => scope.subscribe(listener), [scope]);
4131
+ const getSnapshot = (0, react.useCallback)(() => scope.getSnapshot(), [scope]);
4132
+ const snapshot = (0, react.useSyncExternalStore)(subscribe, getSnapshot);
3243
4133
  const unavailable = snapshot.status === "unavailable";
3244
4134
  const readonly = unavailable || !snapshot.writable;
3245
4135
  const value = snapshot.value ?? {};
3246
- const level = EFFORT_OPTIONS.includes(value.level) ? value.level : "auto";
4136
+ const [pendingTl, setPendingTl] = (0, react.useState)({});
4137
+ const [writeErrorTl, setWriteErrorTl] = (0, react.useState)(null);
4138
+ const viewValue = {
4139
+ ...value,
4140
+ ...pendingTl
4141
+ };
4142
+ const level = EFFORT_OPTIONS.includes(viewValue.level) ? viewValue.level : "auto";
4143
+ const writeTl = (field, v) => {
4144
+ setPendingTl((cur) => ({
4145
+ ...cur,
4146
+ [field]: v
4147
+ }));
4148
+ setWithRetry(scope, field, v).then(({ ok }) => {
4149
+ setPendingTl((cur) => {
4150
+ const rest = { ...cur };
4151
+ delete rest[field];
4152
+ return rest;
4153
+ });
4154
+ if (!ok) setWriteErrorTl(t("card.writeError"));
4155
+ });
4156
+ if (field === "takeover" && typeof v === "boolean" && ocScope !== void 0) setWithRetry(ocScope, "enabled", v).then(({ ok }) => {
4157
+ if (!ok) setWriteErrorTl(t("card.writeError"));
4158
+ });
4159
+ };
3247
4160
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3248
4161
  style: {
3249
4162
  border: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,0.35))",
@@ -3333,7 +4246,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3333
4246
  disabled: readonly,
3334
4247
  style: controlStyle,
3335
4248
  onChange: (event) => {
3336
- scope.set("level", event.currentTarget.value);
4249
+ writeTl("level", event.currentTarget.value);
3337
4250
  },
3338
4251
  children: EFFORT_OPTIONS.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
3339
4252
  value: option,
@@ -3350,10 +4263,28 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3350
4263
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3351
4264
  id: "plugin-config-thinking-levels-enabled",
3352
4265
  type: "checkbox",
3353
- checked: value.enabled ?? true,
4266
+ checked: viewValue.enabled ?? true,
3354
4267
  disabled: readonly,
3355
4268
  onChange: (event) => {
3356
- scope.set("enabled", event.currentTarget.checked);
4269
+ writeTl("enabled", event.currentTarget.checked);
4270
+ }
4271
+ })]
4272
+ }),
4273
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4274
+ style: rowStyle,
4275
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4276
+ htmlFor: "plugin-config-thinking-levels-takeover",
4277
+ style: labelStyle,
4278
+ title: t("card.masterTakeoverHint"),
4279
+ children: t("card.masterTakeover")
4280
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4281
+ id: "plugin-config-thinking-levels-takeover",
4282
+ type: "checkbox",
4283
+ checked: viewValue.takeover ?? false,
4284
+ disabled: readonly,
4285
+ title: t("card.masterTakeoverHint"),
4286
+ onChange: (event) => {
4287
+ writeTl("takeover", event.currentTarget.checked);
3357
4288
  }
3358
4289
  })]
3359
4290
  }),
@@ -3366,10 +4297,10 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3366
4297
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3367
4298
  id: "plugin-config-thinking-levels-downgrade",
3368
4299
  type: "checkbox",
3369
- checked: value.allowDowngrade ?? true,
3370
- disabled: readonly || value.level !== "auto",
4300
+ checked: viewValue.allowDowngrade ?? true,
4301
+ disabled: readonly || viewValue.level !== "auto",
3371
4302
  onChange: (event) => {
3372
- scope.set("allowDowngrade", event.currentTarget.checked);
4303
+ writeTl("allowDowngrade", event.currentTarget.checked);
3373
4304
  }
3374
4305
  })]
3375
4306
  }),
@@ -3382,13 +4313,22 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3382
4313
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3383
4314
  id: "plugin-config-thinking-levels-upgrade",
3384
4315
  type: "checkbox",
3385
- checked: value.allowUpgrade ?? false,
3386
- disabled: readonly || value.level !== "auto",
4316
+ checked: viewValue.allowUpgrade ?? false,
4317
+ disabled: readonly || viewValue.level !== "auto",
3387
4318
  onChange: (event) => {
3388
- scope.set("allowUpgrade", event.currentTarget.checked);
4319
+ writeTl("allowUpgrade", event.currentTarget.checked);
3389
4320
  }
3390
4321
  })]
3391
4322
  }),
4323
+ writeErrorTl !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
4324
+ style: {
4325
+ margin: "8px 0 0",
4326
+ fontSize: "12px",
4327
+ color: "var(--dsw-alias-danger, #e5484d)"
4328
+ },
4329
+ role: "status",
4330
+ children: ["⚠ ", writeErrorTl]
4331
+ }),
3392
4332
  !snapshot.writable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3393
4333
  style: {
3394
4334
  margin: "8px 0 0",
@@ -3399,6 +4339,8 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3399
4339
  }),
3400
4340
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelCapabilities, {
3401
4341
  scope: piAiScope,
4342
+ ocScope,
4343
+ tlScope: scope,
3402
4344
  t,
3403
4345
  readonly
3404
4346
  })
@@ -3428,10 +4370,28 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3428
4370
  */
3429
4371
  /** This plugin's own tab, always first: the thinking-levels card itself. */
3430
4372
  const OWN_TAB_ID = "thinking-levels";
4373
+ const NO_TABS = [];
4374
+ /**
4375
+ * Contributor ledger reader across shell generations. 0.1.7+ shells deliver
4376
+ * the hooks compartment (`useTabs`); ≤0.1.6 shells deliver none, so the same
4377
+ * projected observable (`hooks.tabs`, injected by the section factory) is read
4378
+ * through React's own subscription instead. The face choice is fixed per host
4379
+ * (a shell never grows hooks mid-session), so the hook order stays stable per
4380
+ * component instance even though the two paths differ.
4381
+ */
4382
+ function useContributorTabs(hooksFace, hooksTabs) {
4383
+ const [polled, setPolled] = (0, react.useState)(() => hooksTabs?.getSnapshot() ?? NO_TABS);
4384
+ (0, react.useEffect)(() => {
4385
+ if (hooksFace.useTabs !== void 0 || hooksTabs === void 0) return;
4386
+ return hooksTabs.subscribe(() => setPolled(hooksTabs.getSnapshot()));
4387
+ }, [hooksFace, hooksTabs]);
4388
+ if (hooksFace.useTabs !== void 0) return hooksFace.useTabs((value) => value);
4389
+ return polled;
4390
+ }
3431
4391
  function FamilySettingsSection(props) {
3432
- const { t, renderSlot, scope, piAiScope } = props;
3433
- const { useTabs } = props;
3434
- const contributors = useTabs((value) => value);
4392
+ const { t: tHost, renderSlot, scope, piAiScope, ocScope } = props;
4393
+ const t = tHost ?? props.tFallback ?? ((key) => key);
4394
+ const contributors = useContributorTabs(props, props.hooks?.tabs);
3435
4395
  const [activeId, setActiveId] = (0, react.useState)(OWN_TAB_ID);
3436
4396
  const rows = [{
3437
4397
  id: OWN_TAB_ID,
@@ -3463,6 +4423,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3463
4423
  appearance: "none",
3464
4424
  font: "inherit",
3465
4425
  cursor: "pointer",
4426
+ whiteSpace: "nowrap",
3466
4427
  border: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,0.35))",
3467
4428
  background: row.id === active ? "var(--dsw-alias-bg-layer-3, rgba(127,127,127,0.08))" : "none",
3468
4429
  color: "var(--dsw-alias-label-primary, inherit)",
@@ -3477,29 +4438,100 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3477
4438
  children: active === OWN_TAB_ID ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThinkingLevelsCard, {
3478
4439
  t,
3479
4440
  scope,
3480
- piAiScope
3481
- }) : renderSlot?.("dsh-family.tab", {}, {
4441
+ piAiScope,
4442
+ ocScope
4443
+ }) : renderSlot ? renderSlot("dsh-family.tab", {}, {
3482
4444
  only: active,
3483
4445
  fallback: null
3484
- })
4446
+ }) : props.renderContributor?.(active) ?? null
3485
4447
  })]
3486
4448
  });
3487
4449
  }
3488
4450
  //#endregion
3489
4451
  //#region src/client/index.ts
3490
- /** Services required by the browser half. */
3491
- const inject = [
3492
- "slots",
3493
- "locale",
3494
- "configForms",
3495
- "modelDirectories"
3496
- ];
4452
+ /**
4453
+ * dsh-thinking-levels — browser half.
4454
+ *
4455
+ * Registers the `thinking-levels` dictionaries and one composer model-seat
4456
+ * panel (`conversation.input.model`) carrying the per-line context-window
4457
+ * editor.
4458
+ *
4459
+ * The plugin's own settings (default level, enable toggle, scheduler bounds)
4460
+ * have NO standalone settings card since the DSH 0.1.7 line: the host renders
4461
+ * the Plugins settings form declaratively from the `.volatile()` fields of the
4462
+ * schema in src/index.ts, and the runtime values flow through the
4463
+ * `configForms` service keyed by the composition entry id. The former
4464
+ * per-plugin settings card was dropped with that migration (its seat no
4465
+ * longer exists in 0.1.7), including its llm-pi-ai model-capability editor.
4466
+ * DSH 0.2.0 restores a client face for them: the family settings section
4467
+ * below and the Plugins-page `plugins.bundle.config` card (same component,
4468
+ * same inject factory).
4469
+ *
4470
+ * All @deepseek-ai/* imports are type-only: collaboration happens through
4471
+ * cordis services (`configForms`) and slot registration only (client bundle
4472
+ * purity).
4473
+ */
4474
+ /** Services required by the browser half (the common floor across all host
4475
+ * generations). Generation-specific services resolve through separate deferred
4476
+ * injects below: a cordis inject naming an absent service would pend forever,
4477
+ * so `configForms` (0.1.7+), `settingsScope` (≤0.1.6) and `modelDirectories`
4478
+ * each get their own inject that simply never fires where the service is
4479
+ * missing — shape-detected availability, never version-guessed.
4480
+ */
4481
+ const inject = ["slots", "locale"];
4482
+ /**
4483
+ * The openai-completions transport's settings namespace, resolved per render:
4484
+ * its composition entry id changed shape across packaging history
4485
+ * (`dsh-llm-openai-completions` in the 0.4.0 fragment; earlier manual installs
4486
+ * used the short form), so both candidates are probed and the one the host's
4487
+ * describe document actually carries wins. A handle for an absent namespace
4488
+ * reports `unavailable` forever, which the capability card treats as "transport
4489
+ * absent" — that degradation is only honest when BOTH candidates are absent.
4490
+ */
4491
+ const OC_NAMESPACE_PREFERRED = "dsh-llm-openai-completions";
4492
+ const OC_NAMESPACE_LEGACY = "llm-openai-completions";
4493
+ function ocTransportScopeOf(scopeOf) {
4494
+ const preferredScope = scopeOf(OC_NAMESPACE_PREFERRED);
4495
+ if ((typeof preferredScope?.getSnapshot === "function" ? preferredScope.getSnapshot().status : void 0) === "unavailable") return scopeOf(OC_NAMESPACE_LEGACY);
4496
+ return preferredScope;
4497
+ }
4498
+ const TL_NAMESPACE_MODERN = "dsh-thinking-levels";
4499
+ const TL_NAMESPACE_LEGACY = "thinking-levels";
4500
+ /**
4501
+ * The plugin's own settings scope, generation-probed like the transport above:
4502
+ * 0.1.7+ keys configForms by the composition entry id (`dsh-thinking-levels`),
4503
+ * while ≤0.1.6 hosts register the settings section under `thinking-levels` —
4504
+ * the same namespace the legacy card reads. A handle for an absent namespace
4505
+ * reports `unavailable` forever, which is the probe signal.
4506
+ */
4507
+ function tlSettingsScopeOf(scopeOf) {
4508
+ const modern = scopeOf(TL_NAMESPACE_MODERN);
4509
+ const status = typeof modern?.getSnapshot === "function" ? modern.getSnapshot().status : void 0;
4510
+ if (status === "unavailable") {
4511
+ logOwnScopeOnce(false, status);
4512
+ return scopeOf(TL_NAMESPACE_LEGACY);
4513
+ }
4514
+ logOwnScopeOnce(true, status);
4515
+ return modern;
4516
+ }
4517
+ /** One-shot generation probe line (client mirror of the server's
4518
+ * installSection-style log): which own-settings namespace the family section
4519
+ * settled on, and why. Never repeats — render-time callers hit this often. */
4520
+ let ownScopeLogged = false;
4521
+ function logOwnScopeOnce(modern, status) {
4522
+ if (ownScopeLogged) return;
4523
+ ownScopeLogged = true;
4524
+ console.info(`[dsh-thinking-levels] own-scope ns = ${modern ? TL_NAMESPACE_MODERN : TL_NAMESPACE_LEGACY} (modern status=${String(status)})`);
4525
+ }
3497
4526
  /**
3498
4527
  * Client plugin body: dictionaries plus the composer quick-control slot.
3499
4528
  * @param ctx - client root context.
3500
4529
  */
3501
4530
  function apply(ctx) {
3502
- const t = ctx.locale.bind(NS);
4531
+ const locale = ctx.locale;
4532
+ const t = typeof locale.bind === "function" ? locale.bind(NS) : (key) => key;
4533
+ let scopeOf;
4534
+ const scopeInject = ctx.inject;
3503
4535
  ctx.effect(() => {
3504
4536
  const disposers = [
3505
4537
  ctx.locale.register(NS, {
@@ -3541,8 +4573,8 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3541
4573
  }
3542
4574
  return {
3543
4575
  directory,
3544
- piAiScope: ctx.configForms.get("llm-pi-ai"),
3545
- deepseekScope: ctx.configForms.get("llm-deepseek")
4576
+ piAiScope: scopeOf?.("llm-pi-ai"),
4577
+ deepseekScope: scopeOf?.("llm-deepseek")
3546
4578
  };
3547
4579
  }
3548
4580
  }, ModelPanel);
@@ -3562,9 +4594,22 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3562
4594
  let tabsVersion = -1;
3563
4595
  let tabsRevision = -1;
3564
4596
  let tabs = [];
4597
+ const renderContributor = (id) => {
4598
+ try {
4599
+ const entry = ctx.slots.entries("dsh-family.tab").find((candidate) => candidate.options.id === id);
4600
+ if (entry === void 0 || entry.component === void 0) return null;
4601
+ const injected = typeof entry.inject === "function" ? entry.inject() : void 0;
4602
+ return (0, react.createElement)(entry.component, injected ?? {});
4603
+ } catch {
4604
+ return null;
4605
+ }
4606
+ };
3565
4607
  const sectionInjected = () => ({
3566
- scope: ctx.configForms.get("dsh-thinking-levels"),
3567
- piAiScope: ctx.configForms.get("llm-pi-ai"),
4608
+ scope: tlSettingsScopeOf(scopeOf),
4609
+ piAiScope: scopeOf("llm-pi-ai"),
4610
+ ocScope: ocTransportScopeOf(scopeOf),
4611
+ tFallback: t,
4612
+ renderContributor,
3568
4613
  hooks: { tabs: {
3569
4614
  getSnapshot: () => {
3570
4615
  const version = ctx.slots.getVersion("dsh-family.tab");
@@ -3590,26 +4635,79 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3590
4635
  }
3591
4636
  } }
3592
4637
  });
3593
- ctx.slots.inject("settings.section", function* () {
3594
- yield ctx.slots.register({
3595
- name: "settings.section",
3596
- id: "dsh-family",
3597
- order: 40,
3598
- label: () => t("family.title"),
4638
+ /** ≤0.1.6 legacy card seat (settings.plugin.item) RETIRED (2026-10-08 family
4639
+ * insection round 2): the 思考档位 card duplicated the family-tab card on the
4640
+ * ≤0.1.5 plugins page — all plugin settings now live only in the 起子插件设置
4641
+ * family tab. The legacy scope namespace (`thinking-levels`) remains what the
4642
+ * family-tab card reads via `scopeOf` below. */
4643
+ /** 0.1.7+/0.2.0 surfaces: family section, plugins-page card, context ring.
4644
+ * Generation-neutral in practice (route A, 2026-10): the `settings.section`
4645
+ * entry and its children declaration exist on every host line (the perm-gate
4646
+ * placeholder render proved the 0.1.5 shell consumes client-contributed
4647
+ * section bodies), so the settingsScope waist below calls this too — its
4648
+ * `plugins.bundle.config` inject idles harmlessly where the slot is never
4649
+ * declared (0.1.7 and older).
4650
+ *
4651
+ * Election note (2026-10-08 T20-a revision): the old "priority-0 head +
4652
+ * priority-10 shadow" assumption is dead — ≤0.1.7 shells list EVERY same-id
4653
+ * entry as its own nav row, so TL + guard double registration showed TWO
4654
+ * 起子插件设置 rows on all five farm cells. Guard now defers FAMILY_YIELD_MS
4655
+ * after the declaration and stands down when this entry is already seated;
4656
+ * symmetric guard here: if a dsh-family entry is somehow already in the
4657
+ * ledger when our factory fires (host-native surface, future rival), we
4658
+ * stand down too — exactly one owner, whichever path seated first. */
4659
+ function registerModernSurface() {
4660
+ if (scopeOf === void 0) return;
4661
+ ctx.slots.inject("settings.section", function* () {
4662
+ console.log("[dsh-thinking-levels] settings.section factory fired (declared)");
4663
+ if (ctx.slots.entries("settings.section").some((e) => e.options.id === "dsh-family")) {
4664
+ console.log("[dsh-thinking-levels] settings.section: dsh-family already seated — stand down");
4665
+ return;
4666
+ }
4667
+ const base = {
4668
+ name: "settings.section",
4669
+ id: "dsh-family",
4670
+ order: 40,
4671
+ label: () => t("family.title"),
4672
+ locale: NS,
4673
+ inject: sectionInjected
4674
+ };
4675
+ try {
4676
+ yield ctx.slots.register({
4677
+ ...base,
4678
+ children: { "dsh-family.tab": {
4679
+ kind: "list",
4680
+ scope: "root"
4681
+ } }
4682
+ }, FamilySettingsSection);
4683
+ } catch {
4684
+ yield ctx.slots.register(base, FamilySettingsSection);
4685
+ }
4686
+ });
4687
+ ctx.slots.inject("plugins.bundle.config", () => ctx.slots.register({
4688
+ name: "plugins.bundle.config",
4689
+ key: "dsh-thinking-levels",
3599
4690
  locale: NS,
3600
- inject: sectionInjected,
3601
- children: { "dsh-family.tab": {
3602
- kind: "list",
3603
- scope: "root"
3604
- } }
3605
- }, FamilySettingsSection);
4691
+ inject: sectionInjected
4692
+ }, FamilySettingsSection));
4693
+ }
4694
+ ctx.slots.inject("conversation.input.right", () => ctx.slots.register({
4695
+ name: "conversation.input.right",
4696
+ id: "projection-data-hook",
4697
+ order: 9
4698
+ }, ProjectionDataHook));
4699
+ scopeInject.call(ctx, ["configForms"], (scope) => {
4700
+ const forms = scope.configForms;
4701
+ if (forms === void 0) return;
4702
+ scopeOf = ((ns) => forms.get(ns));
4703
+ registerModernSurface();
4704
+ });
4705
+ scopeInject.call(ctx, ["settingsScope"], (scope) => {
4706
+ const settingsScope = scope.settingsScope;
4707
+ if (settingsScope === void 0) return;
4708
+ scopeOf = ((ns) => settingsScope.bind({ namespace: ns }));
4709
+ registerModernSurface();
3606
4710
  });
3607
- ctx.slots.inject("plugins.bundle.config", () => ctx.slots.register({
3608
- name: "plugins.bundle.config",
3609
- key: "dsh-thinking-levels",
3610
- locale: NS,
3611
- inject: sectionInjected
3612
- }, FamilySettingsSection));
3613
4711
  }
3614
4712
  //#endregion
3615
4713
  exports.apply = apply;