@anionex/dsh-eye-care 0.1.0

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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +86 -0
  4. package/README.zh.md +86 -0
  5. package/assets/eye-care-dark.png +0 -0
  6. package/assets/eye-care-light.png +0 -0
  7. package/cordis.patch.yml +3 -0
  8. package/lib/client.js +1106 -0
  9. package/lib/client.js.map +1 -0
  10. package/lib/index.js +14 -0
  11. package/lib/index.js.map +1 -0
  12. package/lib/rpc.js +123 -0
  13. package/lib/rpc.js.map +1 -0
  14. package/lib/settings.js +12 -0
  15. package/lib/settings.js.map +1 -0
  16. package/lib/shared.js +70 -0
  17. package/lib/shared.js.map +1 -0
  18. package/lib/types/client/EyeCareRow.d.ts +20 -0
  19. package/lib/types/client/EyeCareRow.d.ts.map +1 -0
  20. package/lib/types/client/controller.d.ts +96 -0
  21. package/lib/types/client/controller.d.ts.map +1 -0
  22. package/lib/types/client/index.d.ts +23 -0
  23. package/lib/types/client/index.d.ts.map +1 -0
  24. package/lib/types/client/locales.d.ts +54 -0
  25. package/lib/types/client/locales.d.ts.map +1 -0
  26. package/lib/types/client/themes.d.ts +14 -0
  27. package/lib/types/client/themes.d.ts.map +1 -0
  28. package/lib/types/index.d.ts +10 -0
  29. package/lib/types/index.d.ts.map +1 -0
  30. package/lib/types/rpc.d.ts +17 -0
  31. package/lib/types/rpc.d.ts.map +1 -0
  32. package/lib/types/settings.d.ts +8 -0
  33. package/lib/types/settings.d.ts.map +1 -0
  34. package/lib/types/shared.d.ts +59 -0
  35. package/lib/types/shared.d.ts.map +1 -0
  36. package/package.json +99 -0
  37. package/src/client/EyeCareRow.module.css +137 -0
  38. package/src/client/EyeCareRow.tsx +122 -0
  39. package/src/client/controller.ts +435 -0
  40. package/src/client/css-modules.d.ts +5 -0
  41. package/src/client/index.tsx +72 -0
  42. package/src/client/locales.ts +56 -0
  43. package/src/client/themes.ts +254 -0
  44. package/src/index.ts +30 -0
  45. package/src/rpc.ts +138 -0
  46. package/src/settings.ts +22 -0
  47. package/src/shared.ts +112 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anionex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
+ # after editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write dsh-eye-care/README.md
5
+ README.md: a1992d36826adbbf5be6abd43bcad4b5366b643c
6
+ README.zh.md: 19f5bcd0d176715622aaaf6598606a3dc4bab44e
package/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # DSH Eye Care
2
+
3
+ English | [中文](README.zh.md)
4
+
5
+ Warm Light, Warm Dark, System-Aware.
6
+
7
+ A DeepSeek Harness Web profile bundle that replaces cool white interface colors with six warm semantic themes while leaving the native Appearance preference intact.
8
+
9
+ <p align="center">
10
+ <img src="assets/eye-care-light.png" alt="DSH Eye Care settings row in warm light mode with Day and Warm selected" width="49%">
11
+ <img src="assets/eye-care-dark.png" alt="DSH Eye Care settings row in warm dark mode with Auto and Warm selected" width="49%">
12
+ </p>
13
+
14
+ ## What it does
15
+
16
+ DSH Web's built-in Light and Dark themes are cool-toned. Eye care adds a warm light palette, a warm dark palette, and an automatic scheme without a global sepia filter or image transform.
17
+
18
+ - **Four operating modes:** `off`, `auto`, `light`, and `dark`.
19
+ - **Three warmth levels:** `soft`, `balanced`, and `warm`.
20
+ - **Six concrete themes** registered through the official ThemeService.
21
+ - **Real semantic tokens** for backgrounds, text, borders, buttons, sidebar, bubbles, inputs, code blocks, scrollbars, and Shiki colors.
22
+ - **Native Appearance stays authoritative:** choosing Light, Dark, or System turns eye care off and keeps that newly selected theme.
23
+ - **Loopback persistence** stores the selection in Host settings; remote browsers keep the selection in the current process.
24
+
25
+ ## Preview
26
+
27
+ The screenshots above show the General settings row in warm day mode and warm night mode. Day and Night are explicit; Auto follows `prefers-color-scheme` at the selected warmth. The row also renders an `aria-live` status and keyboard-visible focus states.
28
+
29
+ ## Install
30
+
31
+ Install the public npm package into the Web profile:
32
+
33
+ ```sh
34
+ dsh plugin --profile web add @anionex/dsh-eye-care
35
+ ```
36
+
37
+ For local development, replace the package name with the checkout's absolute path or a locally packed tarball. `DSH_HOME` defaults to `~/.dsh`; point it at a temporary directory to try the bundle without changing your main profiles.
38
+
39
+ Restart or start the Web UI:
40
+
41
+ ```sh
42
+ dsh web
43
+ ```
44
+
45
+ Open **Settings → General → Eye care** and choose a mode and warmth.
46
+
47
+ ## Theme matrix
48
+
49
+ | Scheme | Soft | Balanced | Warm |
50
+ |---|---|---|---|
51
+ | Light | `eye-care-light-soft` | `eye-care-light-balanced` | `eye-care-light-warm` |
52
+ | Dark | `eye-care-dark-soft` | `eye-care-dark-balanced` | `eye-care-dark-warm` |
53
+
54
+ ## How it works
55
+
56
+ The Host half registers the `eye-care` Settings namespace and exposes a loopback-only Connection RPC channel `/eye-care`. Writes are serialized and fenced by `expectedRevision`; a conflict re-reads the Host snapshot and retries the latest intent.
57
+
58
+ The browser half registers the six themes, injects the General-settings row, and owns the controller lifecycle. The controller subscribes to `theme/change` and `prefers-color-scheme`, restores the pre-eye-care theme on disable or unload, and unregisters every theme on dispose. Remote browsers do not inject the Host RPC and therefore stay process-local.
59
+
60
+ ## Compatibility and limitations
61
+
62
+ - Requires a DeepSeek Harness Web profile with the standard `settings`, `connection`, `locale`, `slots`, and `theme` services.
63
+ - A native Appearance change is treated as an explicit opt-out by design.
64
+ - Remote browser sessions do not persist eye care back to the Host.
65
+ - There is no global color filter; all colors come from named semantic tokens.
66
+ - The package is pre-release and follows the profile bundle format; its generated theme ids are stable while the bundle is installed.
67
+
68
+ ## Development
69
+
70
+ ```sh
71
+ cd dsh-eye-care
72
+ pnpm install --frozen-lockfile
73
+ pnpm run check
74
+ pnpm run test
75
+ pnpm run build
76
+ ```
77
+
78
+ Run the optional clean-profile installation test:
79
+
80
+ ```sh
81
+ DSH_EYE_CARE_PROFILE_E2E=1 pnpm exec vitest run tests/profile-install.e2e.spec.ts
82
+ ```
83
+
84
+ ## License
85
+
86
+ [MIT](LICENSE)
package/README.zh.md ADDED
@@ -0,0 +1,86 @@
1
+ # DSH Eye Care
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 暖色浅色、暖色暗色,自动跟随系统。
6
+
7
+ 这是一个 DeepSeek Harness Web Profile Bundle:用六套暖色语义主题替换冷白界面配色,同时保持原生外观偏好不被破坏。
8
+
9
+ <p align="center">
10
+ <img src="assets/eye-care-light.png" alt="DSH Eye Care 设置行:暖色日间主题,已选择日间和温暖" width="49%">
11
+ <img src="assets/eye-care-dark.png" alt="DSH Eye Care 设置行:暖色夜间主题,已选择自动和温暖" width="49%">
12
+ </p>
13
+
14
+ ## 功能
15
+
16
+ DSH Web 内置的 Light 与 Dark 主题偏冷。护眼模式在不使用全局 sepia 滤镜或图片变换的前提下,提供暖色浅色、暖色暗色和自动明暗切换。
17
+
18
+ - **四种模式:** `off`、`auto`、`light`、`dark`。
19
+ - **三档暖色强度:** `soft`、`balanced`、`warm`。
20
+ - **六套具体主题**通过官方 ThemeService 注册。
21
+ - **真正的语义 token**覆盖背景、文字、边框、按钮、sidebar、bubble、输入框、代码块、滚动条与 Shiki 配色。
22
+ - **原生外观仍然权威:** 选择浅色、深色或跟随系统会关闭护眼模式,并保留新选择的主题。
23
+ - **Loopback 持久化**把选择保存到 Host settings;远程浏览器则把选择保留在当前进程。
24
+
25
+ ## 预览
26
+
27
+ 上方截图分别展示暖色日间与暖色夜间状态下的 General 设置行。日间与夜间是显式模式;自动模式会按所选暖色强度跟随 `prefers-color-scheme`。设置行还提供 `aria-live` 状态提示和键盘可见的焦点状态。
28
+
29
+ ## 安装
30
+
31
+ 把公共 npm 包一键安装到 Web Profile:
32
+
33
+ ```sh
34
+ dsh plugin --profile web add @anionex/dsh-eye-care
35
+ ```
36
+
37
+ 本地开发时,把包名替换为 checkout 的绝对路径或本地打包的 tarball。`DSH_HOME` 默认指向 `~/.dsh`;只想试用而不改动主 Profile 时,可把它指向一个临时目录。
38
+
39
+ 重启或启动 Web UI:
40
+
41
+ ```sh
42
+ dsh web
43
+ ```
44
+
45
+ 打开 **设置 → 通用设置 → 护眼模式**,选择模式与暖色强度。
46
+
47
+ ## 主题矩阵
48
+
49
+ | 明暗 | 柔和 | 均衡 | 温暖 |
50
+ |---|---|---|---|
51
+ | 浅色 | `eye-care-light-soft` | `eye-care-light-balanced` | `eye-care-light-warm` |
52
+ | 暗色 | `eye-care-dark-soft` | `eye-care-dark-balanced` | `eye-care-dark-warm` |
53
+
54
+ ## 工作原理
55
+
56
+ Host 半区注册 `eye-care` Settings 命名空间,并暴露仅限 loopback 的 Connection RPC 通道 `/eye-care`。写入串行执行,并以 `expectedRevision` 做版本栅栏;发生冲突时重新读取 Host 快照,再重试最新意图。
57
+
58
+ Browser 半区注册六套主题,注入 General 设置行,并管理控制器生命周期。控制器订阅 `theme/change` 与 `prefers-color-scheme`,在关闭或卸载时恢复启用护眼前的主题,并在 dispose 时注销全部主题。远程浏览器不注入 Host RPC,因此选择保持进程本地。
59
+
60
+ ## 兼容性与限制
61
+
62
+ - 需要包含标准 `settings`、`connection`、`locale`、`slots` 和 `theme` 服务的 DeepSeek Harness Web Profile。
63
+ - 原生外观切换按设计视为明确退出护眼模式。
64
+ - 远程浏览器会话不会把护眼选择回写到 Host。
65
+ - 不使用全局颜色滤镜;所有颜色都来自命名的语义 token。
66
+ - 该包处于预发布阶段,遵循 Profile Bundle 格式;只要 bundle 已安装,其生成的主题 id 就保持稳定。
67
+
68
+ ## 开发
69
+
70
+ ```sh
71
+ cd dsh-eye-care
72
+ pnpm install --frozen-lockfile
73
+ pnpm run check
74
+ pnpm run test
75
+ pnpm run build
76
+ ```
77
+
78
+ 运行可选的干净 Profile 安装测试:
79
+
80
+ ```sh
81
+ DSH_EYE_CARE_PROFILE_E2E=1 pnpm exec vitest run tests/profile-install.e2e.spec.ts
82
+ ```
83
+
84
+ ## 许可证
85
+
86
+ [MIT](LICENSE)
Binary file
Binary file
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: dsh-eye-care
3
+ name: '@anionex/dsh-eye-care'