dsh-context-compression-improved 0.10.1 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## 0.10.2 (2026-10-28)
5
+
6
+ - fab: monitor floating ball position persistence switched to viewport-fraction ({fx,fy}, 4-dec) — corner-follow promise on restart/maximize/resolution change, replacing the absolute-pixel model that only *looked* fine because resize-clamp kept it on-screen. Legacy {x,y} archives normalize on load (zero migration). Pure layout module `src/client/fab-pos.ts` is byte-identical with dsh-browser-cdp's (dual-side sync discipline); pinned by fab-pos.client.spec.ts (6) + rewritten monitor-fab position specs (fraction persist / legacy normalize / resize re-derive).
7
+
8
+
4
9
  ## 0.10.0 (2026-10-24)
5
10
 
6
11
  - hosts: 0.2.1-rc.3 declaration-level enum addendum (18 rc; contract plane zero diff per host source-analysis) — shipped together with the stats feature below.
package/README.de.md CHANGED
@@ -15,7 +15,7 @@
15
15
  > Dieses Projekt unterstützt **ausschließlich DeepSeek-Modelle**. Verlustfreie Messung und verlustbehaftete Kompression hängen von den mitgelieferten offiziellen DeepSeek-Tokenizern ab (`deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-v4-flash-vision-exp`). Alles andere fällt offen aus (fail-open) und behält die ursprünglichen Tool-Ergebnisse bei. Das vollständige Sicherheitsmodell finden Sie im [Upstream-README](https://github.com/WilliamShi666/dsh-context-compression-selector#model-support-and-safety).
16
16
 
17
17
  <!-- host-compat:begin — generated by scripts/sync-hosts.mjs from scripts/hosts.mjs; DO NOT EDIT -->
18
- - **Unterstützte DSH-Hosts:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` (19 RC über die Linien 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
18
+ - **Unterstützte DSH-Hosts:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` `0.2.1-rc.5` (20 RC über die Linien 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
19
19
  <!-- host-compat:end -->
20
20
 
21
21
  ## Was es ist
package/README.es.md CHANGED
@@ -15,7 +15,7 @@
15
15
  > Este proyecto admite **únicamente modelos DeepSeek**. La medición sin pérdida y la compresión con pérdida dependen de los tokenizers oficiales de DeepSeek incluidos (`deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-v4-flash-vision-exp`). Todo lo demás falla de forma abierta (fail-open) y conserva los resultados de herramientas originales. Consulte el [README ascendente](https://github.com/WilliamShi666/dsh-context-compression-selector#model-support-and-safety) para conocer el modelo de seguridad completo.
16
16
 
17
17
  <!-- host-compat:begin — generated by scripts/sync-hosts.mjs from scripts/hosts.mjs; DO NOT EDIT -->
18
- - **Hosts DSH compatibles:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` (19 rc en las líneas 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
18
+ - **Hosts DSH compatibles:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` `0.2.1-rc.5` (20 rc en las líneas 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
19
19
  <!-- host-compat:end -->
20
20
 
21
21
  ## Qué es
package/README.fr.md CHANGED
@@ -15,7 +15,7 @@
15
15
  > Ce projet prend en charge **uniquement les modèles DeepSeek**. La mesure sans perte et la compression avec perte dépendent des tokenizers DeepSeek officiels fournis (`deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-v4-flash-vision-exp`). Tout le reste échoue en mode ouvert (fail-open) et conserve les résultats d'outils originaux. Consultez le [README amont](https://github.com/WilliamShi666/dsh-context-compression-selector#model-support-and-safety) pour le modèle de sécurité complet.
16
16
 
17
17
  <!-- host-compat:begin — generated by scripts/sync-hosts.mjs from scripts/hosts.mjs; DO NOT EDIT -->
18
- - **Hôtes DSH pris en charge :** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` (19 rc sur les lignes 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
18
+ - **Hôtes DSH pris en charge :** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` `0.2.1-rc.5` (20 rc sur les lignes 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
19
19
  <!-- host-compat:end -->
20
20
 
21
21
  ## Qu'est-ce que c'est
package/README.it.md CHANGED
@@ -15,7 +15,7 @@
15
15
  > Questo progetto supporta **solo modelli DeepSeek**. La misura senza perdita e la compressione con perdita dipendono dai tokenizer DeepSeek ufficiali inclusi (`deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-v4-flash-vision-exp`). Tutto il resto fallisce in modo aperto (fail-open) e conserva i risultati degli strumenti originali. Vedere il [README upstream](https://github.com/WilliamShi666/dsh-context-compression-selector#model-support-and-safety) per il modello di sicurezza completo.
16
16
 
17
17
  <!-- host-compat:begin — generated by scripts/sync-hosts.mjs from scripts/hosts.mjs; DO NOT EDIT -->
18
- - **Host DSH supportati:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` (19 rc attraverso le linee 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
18
+ - **Host DSH supportati:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` `0.2.1-rc.5` (20 rc attraverso le linee 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
19
19
  <!-- host-compat:end -->
20
20
 
21
21
  ## Che cos'è
package/README.ja.md CHANGED
@@ -18,7 +18,7 @@
18
18
  > **推奨の接続方法:API-key で DeepSeek をカスタム Responses API 経由に接続する。** 公式アカウントの Messages API ルートではなく、カスタムの OpenAI 互換エンドポイント(`/v1/responses`)の利用を推奨します。Anthropic 形式のメッセージ・シリアライズを経由しないためメッセージ形式に起因する問題が発生せず、`tool_use`/`tool_result` のペアリング検証(公式ルートの resume-replay 400 はプラグイン側では修復不可)を回避できます。また、時間に応じてエンドポイントノードを切り替えてもセッションを継続できます。
19
19
 
20
20
  <!-- host-compat:begin — generated by scripts/sync-hosts.mjs from scripts/hosts.mjs; DO NOT EDIT -->
21
- - **対応する DSH ホスト:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4`(0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1 の 19 rc)
21
+ - **対応する DSH ホスト:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` `0.2.1-rc.5`(0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1 の 20 rc)
22
22
  <!-- host-compat:end -->
23
23
 
24
24
  ## これは何か
package/README.ko.md CHANGED
@@ -18,7 +18,7 @@
18
18
  > **추천 연결 방식: API-key로 DeepSeek을 사용자 정의 Responses API에 연결하세요.** 공식 계정 Messages API 라우트 대신 사용자 정의 OpenAI 호환 엔드포인트(`/v1/responses`)를 사용하세요. Anthropic 스타일 메시지 직렬화를 거치지 않으므로 메시지 형식으로 인한 문제가 발생하지 않고, `tool_use`/`tool_result` 짝 검증 제한(공식 라우트의 resume-replay 400은 플러그인 쪽에서 수리 불가)을 회피할 수 있습니다. 또한 시간에 따라 엔드포인트 노드를 전환해도 세션을 이어서 사용할 수 있습니다.
19
19
 
20
20
  <!-- host-compat:begin — generated by scripts/sync-hosts.mjs from scripts/hosts.mjs; DO NOT EDIT -->
21
- - **지원하는 DSH 호스트:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` (0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1 라인의 19개 rc)
21
+ - **지원하는 DSH 호스트:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` `0.2.1-rc.5` (0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1 라인의 20개 rc)
22
22
  <!-- host-compat:end -->
23
23
 
24
24
  ## 이것은 무엇인가
package/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  > **Recommended: connect DeepSeek with your own API key via a custom Responses API endpoint.** Prefer a custom OpenAI-compatible endpoint (`/v1/responses`) over the official-account Messages API route: it does not go through the Anthropic-style message serialization, so requests never trip message-format issues or `tool_use`/`tool_result` pairing validation (the official route's resume-replay 400s cannot be repaired from the plugin side), and you can switch endpoint nodes over time and keep existing sessions running.
19
19
 
20
20
  <!-- host-compat:begin — generated by scripts/sync-hosts.mjs from scripts/hosts.mjs; DO NOT EDIT -->
21
- - **Supported DSH hosts:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` (19 rc releases across lines 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
21
+ - **Supported DSH hosts:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` `0.2.1-rc.5` (20 rc releases across lines 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
22
22
  <!-- host-compat:end -->
23
23
 
24
24
  ## What it is
package/README.ru.md CHANGED
@@ -15,7 +15,7 @@
15
15
  > Этот проект поддерживает **только модели DeepSeek**. Измерение без потерь и сжатие с потерями опираются на входящие в поставку официальные токенизаторы DeepSeek (`deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-v4-flash-vision-exp`). Во всех остальных случаях плагин работает по принципу fail-open и сохраняет исходные результаты инструментов. Полную модель безопасности см. в [апстрим-README](https://github.com/WilliamShi666/dsh-context-compression-selector#model-support-and-safety).
16
16
 
17
17
  <!-- host-compat:begin — generated by scripts/sync-hosts.mjs from scripts/hosts.mjs; DO NOT EDIT -->
18
- - **Поддерживаемые хосты DSH:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` (19 rc по линиям 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
18
+ - **Поддерживаемые хосты DSH:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` `0.2.1-rc.5` (20 rc по линиям 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
19
19
  <!-- host-compat:end -->
20
20
 
21
21
  ## Что это такое
package/README.zh.md CHANGED
@@ -18,7 +18,7 @@
18
18
  > **推荐接入方式:用 API key 以自定义 Responses API 连接 DeepSeek。** 建议走自定义 OpenAI 兼容端点(`/v1/responses`)而不是官方账号的 Messages API 路由:前者不经过 Anthropic 风格的消息序列化,不会因为 message 格式而出现问题,可避开 `tool_use`/`tool_result` 配对校验限制(官方路由 resume-replay 时的 400 插件侧无法修复);也便于按时间切换节点后接续会话。
19
19
 
20
20
  <!-- host-compat:begin — generated by scripts/sync-hosts.mjs from scripts/hosts.mjs; DO NOT EDIT -->
21
- - **支持的 DSH 宿主:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4`(覆盖 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1 七条线共 19 个 rc)
21
+ - **支持的 DSH 宿主:** `0.1.0-rc.2` `0.1.0-rc.3` `0.1.0-rc.6` `0.1.0-rc.7` `0.1.0-rc.8` `0.1.1-rc.1` `0.1.1-rc.2` `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-rc.1` `0.2.1-rc.2` `0.2.1-rc.3` `0.2.1-rc.4` `0.2.1-rc.5`(覆盖 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1 七条线共 20 个 rc)
22
22
  <!-- host-compat:end -->
23
23
 
24
24
  ## 它是什么
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-context-compression-improved",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "tag": "latest"
@@ -54,7 +54,7 @@
54
54
  "packageManager": "pnpm@11.7.0",
55
55
  "engines": {
56
56
  "node": "^22.19.0 || >=24.0.0",
57
- "dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4"
57
+ "dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "pnpm -r --if-present run bundle",
@@ -72,10 +72,10 @@
72
72
  "pack:dry-run": "pnpm -r --if-present run pack:dry-run"
73
73
  },
74
74
  "peerDependencies": {
75
- "@deepseek-ai/dsh-client-locale": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
76
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
77
- "@deepseek-ai/dsh-client-ui-settings": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
78
- "@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4"
75
+ "@deepseek-ai/dsh-client-locale": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
76
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
77
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
78
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5"
79
79
  },
80
80
  "peerDependenciesMeta": {
81
81
  "@deepseek-ai/dsh-client-locale": {
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-context-compression-improved",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Auditable tool-result context-compression selector with code-skeleton gate for DeepSeek Harness",
6
6
  "engines": {
7
- "dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4"
7
+ "dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5"
8
8
  },
9
9
  "contributes": {
10
10
  "tools": [],
@@ -1587,6 +1587,56 @@ window.__ModuleLoader__.load({
1587
1587
  } : void 0;
1588
1588
  }
1589
1589
  //#endregion
1590
+ //#region src/client/fab-pos.ts
1591
+ const clamp01 = (v) => Math.max(0, Math.min(1, v));
1592
+ const isFin = (v) => typeof v === "number" && Number.isFinite(v);
1593
+ /** 除法结果的归一化兜底:±Infinity 夹到 1/0,NaN 视为无效。 */
1594
+ const divClamp = (px, vpSize) => {
1595
+ const q = px / vpSize;
1596
+ if (q === Infinity) return 1;
1597
+ if (q === -Infinity) return 0;
1598
+ if (!Number.isFinite(q)) return null;
1599
+ return clamp01(q);
1600
+ };
1601
+ /**
1602
+ * 读入 localStorage 存量形状并归一为比例态:
1603
+ * - {fx,fy} 均有限 → 夹回 [0,1] 直用;
1604
+ * - 否则 {x,y} 均有限(旧像素格式)→ 按当前视口除法换算(±Infinity 夹 1/0,NaN 拒);
1605
+ * - 其余(非对象/数组/字段缺失/脏值)→ null,由调用方走默认位。
1606
+ */
1607
+ function normalizeStored(raw, vp) {
1608
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return null;
1609
+ const r = raw;
1610
+ if (isFin(r.fx) && isFin(r.fy)) return {
1611
+ fx: clamp01(r.fx),
1612
+ fy: clamp01(r.fy)
1613
+ };
1614
+ if (!isFin(r.x) || !isFin(r.y)) return null;
1615
+ const fx = divClamp(r.x, vp.vw);
1616
+ const fy = divClamp(r.y, vp.vh);
1617
+ if (fx === null || fy === null) return null;
1618
+ return {
1619
+ fx,
1620
+ fy
1621
+ };
1622
+ }
1623
+ /** 像素 → 比例,4 位小数舍入;像素本身可为 clamp 后越内值(先夹再存)。 */
1624
+ function toRatio(pos, vp) {
1625
+ const fx = divClamp(pos.x, vp.vw);
1626
+ const fy = divClamp(pos.y, vp.vh);
1627
+ return {
1628
+ fx: fx === null ? 0 : fx,
1629
+ fy: fy === null ? 0 : fy
1630
+ };
1631
+ }
1632
+ /** 比例 → 像素(不做 clamp——落位后由接线层既有 clamp 收边)。 */
1633
+ function fromRatio(r, vp) {
1634
+ return {
1635
+ x: Math.round(clamp01(r.fx) * vp.vw),
1636
+ y: Math.round(clamp01(r.fy) * vp.vh)
1637
+ };
1638
+ }
1639
+ //#endregion
1590
1640
  //#region src/client/monitor-fab.ts
1591
1641
  /**
1592
1642
  * 压缩监控浮动球 + 面板(task: cci-monitor-fab;骨架整编自 pm 撤下的
@@ -1685,27 +1735,38 @@ window.__ModuleLoader__.load({
1685
1735
  <div class="recent" data-recent></div>
1686
1736
  `;
1687
1737
  document.body.append(fab, panel);
1688
- let pos;
1738
+ const vpFab = () => ({
1739
+ vw: window.innerWidth,
1740
+ vh: window.innerHeight,
1741
+ w: 42,
1742
+ h: 42
1743
+ });
1744
+ let ratio;
1689
1745
  try {
1690
- pos = JSON.parse(localStorage.getItem(POS_KEY) ?? "null") ?? {
1691
- x: Math.max(8, window.innerWidth - 66),
1692
- y: Math.max(8, Math.round(window.innerHeight * .6))
1693
- };
1746
+ ratio = normalizeStored(JSON.parse(localStorage.getItem(POS_KEY) ?? "null"), vpFab());
1694
1747
  } catch {
1695
- pos = {
1696
- x: Math.max(8, window.innerWidth - 66),
1697
- y: Math.max(8, Math.round(window.innerHeight * .6))
1698
- };
1748
+ ratio = null;
1699
1749
  }
1750
+ let pos = ratio !== null ? fromRatio(ratio, vpFab()) : {
1751
+ x: Math.max(8, window.innerWidth - 66),
1752
+ y: Math.max(8, Math.round(window.innerHeight * .6))
1753
+ };
1700
1754
  const clamp = (p) => ({
1701
1755
  x: Math.max(8, Math.min(window.innerWidth - 50, p.x)),
1702
1756
  y: Math.max(8, Math.min(window.innerHeight - 50, p.y))
1703
1757
  });
1704
- const place = () => {
1758
+ /** 像素态直接落位: clamp → 镜像回 ratio → 写 style(拖拽帧专用,不回推 ratio)。 */
1759
+ const paint = () => {
1705
1760
  pos = clamp(pos);
1761
+ ratio = toRatio(pos, vpFab());
1706
1762
  fab.style.left = `${pos.x}px`;
1707
1763
  fab.style.top = `${pos.y}px`;
1708
1764
  };
1765
+ /** 从存储比例全量重推导(init + resize): 角落随视口缩放跟随,再夹回屏内。 */
1766
+ const place = () => {
1767
+ if (ratio !== null) pos = fromRatio(ratio, vpFab());
1768
+ paint();
1769
+ };
1709
1770
  place();
1710
1771
  window.addEventListener("resize", place);
1711
1772
  const makeDrag = (el, key) => {
@@ -1740,12 +1801,12 @@ window.__ModuleLoader__.load({
1740
1801
  });
1741
1802
  if (Math.abs(next.x - pos.x) > 2 || Math.abs(next.y - pos.y) > 2) moved = true;
1742
1803
  pos = key === "fab" ? next : pos;
1743
- if (key === "fab") place();
1804
+ if (key === "fab") paint();
1744
1805
  });
1745
1806
  el.addEventListener("pointerup", () => {
1746
1807
  active = false;
1747
1808
  if (moved && key === "fab") try {
1748
- localStorage.setItem(POS_KEY, JSON.stringify(pos));
1809
+ localStorage.setItem(POS_KEY, JSON.stringify(ratio ?? toRatio(pos, vpFab())));
1749
1810
  } catch {}
1750
1811
  });
1751
1812
  el.addEventListener("pointercancel", () => {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-context-compression-improved",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "description": "One-install context-compression selector bundle for DeepSeek Harness",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -70,7 +70,7 @@
70
70
  "author": "WilliamShi666",
71
71
  "engines": {
72
72
  "node": "^22.19.0 || >=24.0.0",
73
- "dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4"
73
+ "dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5"
74
74
  },
75
75
  "keywords": [
76
76
  "deepseek",
@@ -95,25 +95,25 @@
95
95
  "@deepseek-ai/cordis": ">=4.0.1 <5",
96
96
  "@deepseek-ai/cordis-plugin-include": ">=1.0.6 <2",
97
97
  "@deepseek-ai/cordis-plugin-loader": ">=1.0.2 <2",
98
- "@deepseek-ai/dsh-agent": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
99
- "@deepseek-ai/dsh-agent-presets": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
100
- "@deepseek-ai/dsh-client-locale": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
101
- "@deepseek-ai/dsh-client-store": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
102
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
103
- "@deepseek-ai/dsh-client-ui-session": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
104
- "@deepseek-ai/dsh-client-ui-settings": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
105
- "@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
106
- "@deepseek-ai/dsh-client-ui-workspace": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
107
- "@deepseek-ai/dsh-command-compact": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
108
- "@deepseek-ai/dsh-compaction": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
109
- "@deepseek-ai/dsh-compaction-basic": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
110
- "@deepseek-ai/dsh-invariants": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
111
- "@deepseek-ai/dsh-llm": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
112
- "@deepseek-ai/dsh-session": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
113
- "@deepseek-ai/dsh-settings": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
114
- "@deepseek-ai/dsh-system-prompt": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
115
- "@deepseek-ai/dsh-token-meter": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
116
- "@deepseek-ai/dsh-tools": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
98
+ "@deepseek-ai/dsh-agent": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
99
+ "@deepseek-ai/dsh-agent-presets": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
100
+ "@deepseek-ai/dsh-client-locale": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
101
+ "@deepseek-ai/dsh-client-store": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
102
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
103
+ "@deepseek-ai/dsh-client-ui-session": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
104
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
105
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
106
+ "@deepseek-ai/dsh-client-ui-workspace": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
107
+ "@deepseek-ai/dsh-command-compact": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
108
+ "@deepseek-ai/dsh-compaction": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
109
+ "@deepseek-ai/dsh-compaction-basic": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
110
+ "@deepseek-ai/dsh-invariants": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
111
+ "@deepseek-ai/dsh-llm": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
112
+ "@deepseek-ai/dsh-session": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
113
+ "@deepseek-ai/dsh-settings": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
114
+ "@deepseek-ai/dsh-system-prompt": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
115
+ "@deepseek-ai/dsh-token-meter": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
116
+ "@deepseek-ai/dsh-tools": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
117
117
  "react": ">=18 <19"
118
118
  },
119
119
  "peerDependenciesMeta": {
@@ -0,0 +1,71 @@
1
+ /**
2
+ * 视口比例位置持久化布局模块(百分位制,纯函数、node 环境可测、无 DOM 依赖)。
3
+ *
4
+ * 与 dsh-context-compression-improved monitor-fab 布局模型同构,改动须双侧同步
5
+ * (同串纪律:本文件与其 packages/selector/src/client/fab-pos.ts 逐字节一致,
6
+ * 测试用例同集对齐)。
7
+ *
8
+ * 存储模型:RatioPos { fx, fy } —— 悬浮物左上角相对视口的归一化位置(∈[0,1],
9
+ * 4 位小数)。兼容读入旧像素存档 { x, y }(按当前视口换算,形状判别即免迁移)。
10
+ * 换算后越界由接线层既有 clamp 兜底;本模块只做比例语义,不做落位。
11
+ */
12
+
13
+ export interface RatioPos {
14
+ fx: number;
15
+ fy: number;
16
+ }
17
+
18
+ export interface PixelPos {
19
+ x: number;
20
+ y: number;
21
+ }
22
+
23
+ /** vw/vh = 当前视口 CSS 像素;w/h = 悬浮物占位尺寸(本模块不参与运算,供接线层复用形状)。 */
24
+ export interface Viewport {
25
+ vw: number;
26
+ vh: number;
27
+ w: number;
28
+ h: number;
29
+ }
30
+
31
+ const clamp01 = (v: number): number => Math.max(0, Math.min(1, v));
32
+
33
+ const isFin = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v);
34
+
35
+ /** 除法结果的归一化兜底:±Infinity 夹到 1/0,NaN 视为无效。 */
36
+ const divClamp = (px: number, vpSize: number): number | null => {
37
+ const q = px / vpSize;
38
+ if (q === Infinity) return 1;
39
+ if (q === -Infinity) return 0;
40
+ if (!Number.isFinite(q)) return null;
41
+ return clamp01(q);
42
+ };
43
+
44
+ /**
45
+ * 读入 localStorage 存量形状并归一为比例态:
46
+ * - {fx,fy} 均有限 → 夹回 [0,1] 直用;
47
+ * - 否则 {x,y} 均有限(旧像素格式)→ 按当前视口除法换算(±Infinity 夹 1/0,NaN 拒);
48
+ * - 其余(非对象/数组/字段缺失/脏值)→ null,由调用方走默认位。
49
+ */
50
+ export function normalizeStored(raw: unknown, vp: Viewport): RatioPos | null {
51
+ if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) return null;
52
+ const r = raw as Record<string, unknown>;
53
+ if (isFin(r.fx) && isFin(r.fy)) return { fx: clamp01(r.fx), fy: clamp01(r.fy) };
54
+ if (!isFin(r.x) || !isFin(r.y)) return null;
55
+ const fx = divClamp(r.x, vp.vw);
56
+ const fy = divClamp(r.y, vp.vh);
57
+ if (fx === null || fy === null) return null;
58
+ return { fx, fy };
59
+ }
60
+
61
+ /** 像素 → 比例,4 位小数舍入;像素本身可为 clamp 后越内值(先夹再存)。 */
62
+ export function toRatio(pos: PixelPos, vp: Viewport): RatioPos {
63
+ const fx = divClamp(pos.x, vp.vw);
64
+ const fy = divClamp(pos.y, vp.vh);
65
+ return { fx: fx === null ? 0 : fx, fy: fy === null ? 0 : fy };
66
+ }
67
+
68
+ /** 比例 → 像素(不做 clamp——落位后由接线层既有 clamp 收边)。 */
69
+ export function fromRatio(r: RatioPos, vp: Viewport): PixelPos {
70
+ return { x: Math.round(clamp01(r.fx) * vp.vw), y: Math.round(clamp01(r.fy) * vp.vh) };
71
+ }
@@ -16,6 +16,9 @@
16
16
  * 口径),覆盖作用于默认会话;会话级绑定待 cci 有输入栏座位后另行接线。
17
17
  */
18
18
 
19
+ import { fromRatio, normalizeStored, toRatio } from './fab-pos';
20
+ import type { RatioPos, Viewport } from './fab-pos';
21
+
19
22
  const FAB_ID = 'dsh-cci-monitor-fab';
20
23
  const PANEL_ID = 'dsh-cci-monitor-panel';
21
24
  const STYLE_ID = 'dsh-cci-monitor-style';
@@ -151,25 +154,34 @@ export function initMonitorFab(deps: MonitorFabDeps): void {
151
154
  `;
152
155
  document.body.append(fab, panel);
153
156
 
154
- // 位置:localStorage 恢复 + 视口夹紧(pm 骨架原样)
155
- let pos: { x: number; y: number };
157
+ // 位置:视口比例(百分位)持久化 —— ratio 是存储真源, pos 是像素缓存;
158
+ // 读/写边界换算, 既有像素 clamp 继续兑底(与 browser-cdp 球区同构, issue #4 根治)
159
+ const vpFab = (): Viewport => ({ vw: window.innerWidth, vh: window.innerHeight, w: 42, h: 42 });
160
+ let ratio: RatioPos | null;
156
161
  try {
157
- pos = JSON.parse(localStorage.getItem(POS_KEY) ?? 'null') ?? {
158
- x: Math.max(8, window.innerWidth - 66),
159
- y: Math.max(8, Math.round(window.innerHeight * 0.6)),
160
- };
162
+ ratio = normalizeStored(JSON.parse(localStorage.getItem(POS_KEY) ?? 'null'), vpFab());
161
163
  } catch {
162
- pos = { x: Math.max(8, window.innerWidth - 66), y: Math.max(8, Math.round(window.innerHeight * 0.6)) };
164
+ ratio = null;
163
165
  }
166
+ let pos: { x: number; y: number } = ratio !== null
167
+ ? fromRatio(ratio, vpFab())
168
+ : { x: Math.max(8, window.innerWidth - 66), y: Math.max(8, Math.round(window.innerHeight * 0.6)) };
164
169
  const clamp = (p: { x: number; y: number }): { x: number; y: number } => ({
165
170
  x: Math.max(8, Math.min(window.innerWidth - 50, p.x)),
166
171
  y: Math.max(8, Math.min(window.innerHeight - 50, p.y)),
167
172
  });
168
- const place = (): void => {
173
+ /** 像素态直接落位: clamp → 镜像回 ratio → 写 style(拖拽帧专用,不回推 ratio)。 */
174
+ const paint = (): void => {
169
175
  pos = clamp(pos);
176
+ ratio = toRatio(pos, vpFab());
170
177
  fab.style.left = `${pos.x}px`;
171
178
  fab.style.top = `${pos.y}px`;
172
179
  };
180
+ /** 从存储比例全量重推导(init + resize): 角落随视口缩放跟随,再夹回屏内。 */
181
+ const place = (): void => {
182
+ if (ratio !== null) pos = fromRatio(ratio, vpFab());
183
+ paint();
184
+ };
173
185
  place();
174
186
  window.addEventListener('resize', place);
175
187
 
@@ -192,12 +204,12 @@ export function initMonitorFab(deps: MonitorFabDeps): void {
192
204
  const next = clamp({ x: startPos.x + (e.clientX - origin.x), y: startPos.y + (e.clientY - origin.y) });
193
205
  if (Math.abs(next.x - pos.x) > 2 || Math.abs(next.y - pos.y) > 2) moved = true;
194
206
  pos = key === 'fab' ? next : pos;
195
- if (key === 'fab') place();
207
+ if (key === 'fab') paint();
196
208
  });
197
209
  el.addEventListener('pointerup', () => {
198
210
  active = false;
199
211
  if (moved && key === 'fab') {
200
- try { localStorage.setItem(POS_KEY, JSON.stringify(pos)); } catch { /* 隐私模式:位置不持久化 */ }
212
+ try { localStorage.setItem(POS_KEY, JSON.stringify(ratio ?? toRatio(pos, vpFab()))); } catch { /* 隐私模式:位置不持久化 */ }
201
213
  }
202
214
  });
203
215
  el.addEventListener('pointercancel', () => {
@@ -0,0 +1,47 @@
1
+ /**
2
+ * fab-pos 纯函数钉桩(node 环境,无 DOM)——契约冻结点。
3
+ * 与 dsh-context-compression-improved packages/selector/tests/fab-pos.spec.ts 同集对齐。
4
+ */
5
+ import { describe, expect, it } from 'vitest';
6
+
7
+ import { fromRatio, normalizeStored, toRatio, type Viewport } from '../src/client/fab-pos';
8
+
9
+ const VP: Viewport = { vw: 1920, vh: 1080, w: 48, h: 48 };
10
+
11
+ describe('fab-pos viewport-fraction layout', () => {
12
+ it('新格式 {fx,fy} 透传原样', () => {
13
+ expect(normalizeStored({ fx: 0.5, fy: 0.5 }, VP)).toEqual({ fx: 0.5, fy: 0.5 });
14
+ });
15
+
16
+ it('旧格式 {x,y} 按当前视口换算', () => {
17
+ expect(normalizeStored({ x: 960, y: 540 }, VP)).toEqual({ fx: 0.5, fy: 0.5 });
18
+ });
19
+
20
+ it('脏输入(非对象/数组/字段缺失/非有限数)返 null', () => {
21
+ expect(normalizeStored(null, VP)).toBeNull();
22
+ expect(normalizeStored('{"x":1}', VP)).toBeNull();
23
+ expect(normalizeStored([1, 2], VP)).toBeNull();
24
+ expect(normalizeStored({ x: 10 }, VP)).toBeNull();
25
+ expect(normalizeStored({ x: NaN, y: 5 }, VP)).toBeNull();
26
+ expect(normalizeStored({ fx: 0.1, fy: Infinity }, VP)).toBeNull();
27
+ });
28
+
29
+ it('fx/fy 越界夹回 [0,1]', () => {
30
+ expect(normalizeStored({ fx: 1.5, fy: -0.2 }, VP)).toEqual({ fx: 1, fy: 0 });
31
+ });
32
+
33
+ it('toRatio→fromRatio 往返误差 ≤1px', () => {
34
+ for (const [x, y] of [[1752, 902], [0, 0], [1919, 1079], [640, 360], [48, 96]] as const) {
35
+ const back = fromRatio(toRatio({ x, y }, VP), VP);
36
+ expect(Math.abs(back.x - x)).toBeLessThanOrEqual(1);
37
+ expect(Math.abs(back.y - y)).toBeLessThanOrEqual(1);
38
+ }
39
+ });
40
+
41
+ it('vw=0 防御:旧格式除法产 Infinity 夹成 1,不抛错', () => {
42
+ const degenerate: Viewport = { vw: 0, vh: 0, w: 48, h: 48 };
43
+ expect(normalizeStored({ x: 960, y: 540 }, degenerate)).toEqual({ fx: 1, fy: 1 });
44
+ expect(() => toRatio({ x: 960, y: 540 }, degenerate)).not.toThrow();
45
+ expect(fromRatio({ fx: 1, fy: 1 }, degenerate)).toEqual({ x: 0, y: 0 });
46
+ });
47
+ });
@@ -210,11 +210,31 @@ describe('monitor fab (body-level overlay)', () => {
210
210
  expect((document.querySelector('[data-offsets]') as HTMLElement).textContent).toBe('-1,200')
211
211
  })
212
212
 
213
- it('position persists across drag-free re-init via localStorage', () => {
214
- localStorage.setItem('dsh.cci.monitor.pos', JSON.stringify({ x: 40, y: 60 }))
213
+ it('position persists across drag-free re-init via localStorage (fraction format)', () => {
214
+ localStorage.setItem('dsh.cci.monitor.pos', JSON.stringify({ fx: 0.5, fy: 0.5 }))
215
215
  initMonitorFab(makeDeps())
216
216
  const fab = document.getElementById(FAB_ID) as HTMLElement
217
- expect(fab.style.left).toBe('40px')
218
- expect(fab.style.top).toBe('60px')
217
+ // jsdom 视口 1024x768 → 512/384(均在既有 clamp [8, vw-50]/[8, vh-50] 内)
218
+ expect(fab.style.left).toBe('512px')
219
+ expect(fab.style.top).toBe('384px')
220
+ })
221
+
222
+ it('legacy pixel {x,y} archive normalizes against current viewport without throwing', () => {
223
+ localStorage.setItem('dsh.cci.monitor.pos', JSON.stringify({ x: 512, y: 384 }))
224
+ initMonitorFab(makeDeps())
225
+ const fab = document.getElementById(FAB_ID) as HTMLElement
226
+ expect(fab.style.left).toBe('512px')
227
+ expect(fab.style.top).toBe('384px')
228
+ })
229
+
230
+ it('ball re-derives from its fraction on resize (corner follows viewport)', () => {
231
+ localStorage.setItem('dsh.cci.monitor.pos', JSON.stringify({ fx: 0.5, fy: 0.5 }))
232
+ initMonitorFab(makeDeps())
233
+ const fab = document.getElementById(FAB_ID) as HTMLElement
234
+ expect(fab.style.left).toBe('512px')
235
+ Object.defineProperty(window, 'innerWidth', { value: 2048, writable: true, configurable: true })
236
+ window.dispatchEvent(new Event('resize'))
237
+ // 比例不变→横坐标随视口翻倍(旧像素模型会停在 512px 不跟角)
238
+ expect(fab.style.left).toBe('1024px')
219
239
  })
220
240
  })
@@ -23,8 +23,8 @@ describe('standalone package contract', () => {
23
23
  .toBe(selector.engines?.dsh)
24
24
  expect(selector.peerDependencies?.['@deepseek-ai/dsh-command-compact'])
25
25
  .toBe(selector.engines?.dsh)
26
- // compat-legacy 七线:dsh-* peer 与 engines.dsh 同为 19rc 枚举(hosts.mjs 口径,rc.4 已补票)。
27
- expect(selector.engines?.dsh?.split(' || ')).toHaveLength(19)
26
+ // compat-legacy 七线:dsh-* peer 与 engines.dsh 同为 20rc 枚举(hosts.mjs 口径,rc.5 已补票)。
27
+ expect(selector.engines?.dsh?.split(' || ')).toHaveLength(20)
28
28
  expect(selector.publishConfig?.tag).toBe('latest')
29
29
  expect(existsSync(resolve(root, '../runtime/package.json'))).toBe(false)
30
30
  })
@@ -51,8 +51,8 @@ describe('standalone package contract', () => {
51
51
  '@deepseek-ai/dsh-client-ui-slots',
52
52
  '@deepseek-ai/dsh-client-ui-settings',
53
53
  ])
54
- // compat-legacy 七线:root=安装面,engines 与全部 peer 同为 19rc 枚举(闸门口径)。
55
- expect(rootManifest.engines?.dsh?.split(' || ')).toHaveLength(19)
54
+ // compat-legacy 七线:root=安装面,engines 与全部 peer 同为 20rc 枚举(闸门口径)。
55
+ expect(rootManifest.engines?.dsh?.split(' || ')).toHaveLength(20)
56
56
  for (const range of Object.values(rootManifest.peerDependencies ?? {})) {
57
57
  expect(range).toBe(rootManifest.engines?.dsh)
58
58
  }
package/scripts/hosts.mjs CHANGED
@@ -30,7 +30,7 @@ export const supportedHosts = Object.freeze([
30
30
  '0.2.0-rc.1',
31
31
  '0.2.0-rc.2',
32
32
  '0.2.1-rc.1',
33
- '0.2.1-rc.2', '0.2.1-rc.3', '0.2.1-rc.4',
33
+ '0.2.1-rc.2', '0.2.1-rc.3', '0.2.1-rc.4', '0.2.1-rc.5',
34
34
  ])
35
35
  export const peerRange = supportedHosts.join(' || ')
36
36
  /** 显式偏离:devDeps 钉 rc.1(见文件头)。 */