dsh-deepseek-chat 0.1.10 → 0.1.12

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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  CHAT模式 加载真实的 [DeepSeek Chat 官网](https://chat.deepseek.com/),使用官网的聊天功能和账号历史;HARNESS模式 为原 DSH 工作区。
6
6
 
7
- 当前版本 **0.1.10** · 适配 **DSH 0.2.0-rc.2 桌面版** · 默认语言为简体中文。
7
+ 当前版本 **0.1.12** · 适配 **DSH 0.2.0-rc.2 桌面版** · 默认语言为简体中文。
8
8
 
9
9
  ## 功能预览
10
10
 
@@ -13,7 +13,8 @@ CHAT模式 加载真实的 [DeepSeek Chat 官网](https://chat.deepseek.com/),
13
13
  ![CHAT 模式:DSH 原侧栏与 DeepSeek 官网聊天页面](docs/images/chat-overview.png)
14
14
 
15
15
  - 共用 DSH 原侧栏,显示官网对话标题、置顶和日期分组。
16
- - 点击历史对话继续聊天;顶部“新会话”和列表旁的+用于新建官网对话。
16
+ - 点击历史对话继续聊天;顶部“新会话”用于新建官网对话。
17
+ - 点击“对话”右侧的刷新图标,重新加载官网当前页面并更新列表。在其他网页端新建对话后,可用它同步,无需退出 DSH。
17
18
  - 搜索筛选已加载的对话标题,聊天正文和输入框由官网提供。
18
19
  - 对话标题位于左上角,点击标题使用官网原有的名称编辑功能。
19
20
 
@@ -76,7 +77,7 @@ dsh plugin --profile desktop add https://github.com/xingxingbk-git/dsh-deepseek-
76
77
  将构建生成的 `.tgz` 文件交给 DSH 官方插件管理器安装,或使用 CLI:
77
78
 
78
79
  ```bash
79
- dsh plugin --profile desktop add /absolute/path/dsh-deepseek-chat-0.1.10.tgz
80
+ dsh plugin --profile desktop add /absolute/path/dsh-deepseek-chat-0.1.12.tgz
80
81
  ```
81
82
 
82
83
  将路径替换成你的实际安装包;使用其他 profile 时替换 `desktop`。**安装或更新后,完整退出并重新打开 DSH**,让新插件生效。
@@ -88,13 +89,15 @@ dsh plugin --profile desktop add /absolute/path/dsh-deepseek-chat-0.1.10.tgz
88
89
  ## 开始使用
89
90
 
90
91
  1. 选择 **CHAT**。未登录时点击 **登录 DeepSeek**;也可在 **设置 → CHAT设置** 点击同一个登录入口。
91
- 2. 在插件内的真实官网页面正常登录。两个入口使用同一网页,登录后自动同步账号和对话,不需要重新打开设置刷新。
92
+ 2. 登录统一在 CHAT 主页面的真实官网中完成。CHAT 设置只显示账号、登录状态和语言;点击其中的登录按钮会关闭设置并进入 CHAT,登录后自动同步,无需刷新。
92
93
  3. 打开 **设置 → CHAT设置**,确认出现“已记住网页登录”,按需选择语言。退出登录会清除本插件的登录记忆并正常退出官网;模式切换器继续可用。
93
94
 
94
95
  当前登录在插件网页中完成。外部浏览器登录后自动授权回跳需要官网提供面向 Chat 的授权交换接口,目前未确认可用;直接在其他浏览器登录不会自动登录本插件。
95
96
 
96
97
  页面加载失败时,可在故障提示中重试;登录保存服务连接失败时,会显示原因和重试入口。插件会自动收起官网固定的“使用环境异常”说明,其他提示、验证码和认证错误仍由官网处理。
97
98
 
99
+ 刷新列表会重新加载当前官网页面,并保留当前对话地址。检测到未发送的输入或正在生成等状态时,会提示先完成当前操作;插件不会保存草稿。刷新中请稍候;官网加载失败或超时后,可点击右侧提示中的“重试网页”。
100
+
98
101
  ## 使用限制
99
102
 
100
103
  - **兼容范围:**目前针对 DSH 0.2.0-rc.2 桌面版适配,其他版本和平台待验证;DSH Web版暂不支持本插件的 CHAT 模式。
@@ -123,7 +126,7 @@ pnpm install --frozen-lockfile
123
126
  pnpm package:plugin
124
127
  ```
125
128
 
126
- 生成 `artifacts/dsh-deepseek-chat-0.1.10.tgz`,包含 Host、Client、类型声明、图标和 bundle patch。插件管理列表的图标位于 `assets/icon.svg`,替换后重新打包安装即可;SVG 须自包含且不超过 256 KiB。
129
+ 生成 `artifacts/dsh-deepseek-chat-0.1.11.tgz`,包含 Host、Client、类型声明、图标和 bundle patch。插件管理列表的图标位于 `assets/icon.svg`,替换后重新打包安装即可;SVG 须自包含且不超过 256 KiB。
127
130
 
128
131
  修改源码后执行 `pnpm release:prepare`,并将源码与整个 `lib/` 一起提交。`pnpm check:distribution` 会检查编译产物与源码、版本及安装入口是否一致;旧产物或缺失文件会使检查失败。安装用户不需要执行这些开发命令。
129
132
 
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "format": 1,
3
3
  "name": "dsh-deepseek-chat",
4
- "version": "0.1.10",
4
+ "version": "0.1.12",
5
5
  "inputs": {
6
6
  "assets/icon.svg": "ad1b0fda90c1c1f2a0b9208bc86f5fe8c21d505a1208576be4e3110b26b4f79c",
7
7
  "cordis.patch.yml": "05edb71cd276de1251ae67644ec68b54efc26258814956fa0e932d36da741bdc",
8
- "package.json": "d3604956f5a0cedab38287d3d665bab0653af9940d9adfb2301ffd1c13715a38",
8
+ "package.json": "c71ffe743031d1d35b55ea474eb4bec84394b89ba1b0edbc94be90ed095f63d9",
9
9
  "pnpm-lock.yaml": "c4f600b0d599b85f6181d295cd5f9f06f1eb0435eeeb2e7cf1a376b3c6a4ca15",
10
10
  "scripts/build.mjs": "a9a2961e09fb16b99e206c4d191c9e970a4a3999979df9a626fa310c0fdee5b1",
11
11
  "scripts/check-artifact.mjs": "6fec38fb74e41dfeacef7147280c69854087d0665747d7d65137cc98f9dc673b",
@@ -13,17 +13,17 @@
13
13
  "scripts/client-contract.mjs": "1e212575218fc985f4405e2eac98b33a969494ff6b2144b1204a6d66963ba894",
14
14
  "scripts/distribution-manifest.mjs": "e746c447b03b0e9a86efce7827bbd5d9184c6ccd1f1f0f1c9eb12abfe1b2f3b7",
15
15
  "src/authorization.ts": "5f0c1b69e43541ce606349047788df72e442e9cbb3267c8c0caf2c0f556a5589",
16
- "src/client.ts": "3b60eb6a9f3625c9b1c344713907631f9213ba54f797a2d4c67e4ffe7d4e6da6",
16
+ "src/client.ts": "a8e4a06fc487e98f61285bcd6e9a8dcb8bad00a6f1a74806a176a839c5f0dec1",
17
17
  "src/core/mode.ts": "2fe56c319706d86746010bd5551f4ee47e31e12a0ee28effffb719b0696ad70c",
18
18
  "src/index.ts": "59edf0d6af2feec3e08da322cabc07a2dc83868312c4daa1074b2a5b12892f57",
19
19
  "src/protocol.ts": "5194007a0c06f7b293cc34579ccdc150c23c35b825091667f37a7293594bd29f",
20
20
  "src/server.ts": "295c52235fa399967a594b76b1f4c869adccc978ee3c0f3f8f3a12894b81ef9b",
21
21
  "src/sidebar-adapter.ts": "edcc051bbcaabb2d09055b231f57253a50a6d9e75acf18adafbf262001b18a48",
22
- "src/styles.ts": "24a03f8c96b8966aae0a1b7df2a6bbb13390ee22ec17a7ff9126f7da2259c8cf",
23
- "src/ui.tsx": "fd08c974ea997794d06a2270f4d0da789ce879327dc7149fcd4f63d3ffca35e3",
24
- "src/web-surface.tsx": "ad423c66b639ea853a59e7ef1b656226e3b0e8df5d21aefb95df967022e6fef3",
22
+ "src/styles.ts": "289b012ece94ac6eabad905606cfda06a8bd79073f5cc24938ae6e5bd973aa6d",
23
+ "src/ui.tsx": "abe6d31dcac461c42aee7b5632e2354977ae497a932b63451fd66f370d0dd975",
24
+ "src/web-surface.tsx": "51862e3c0cff10a9ae44f757a9e879af9d9a31d2aca1d8715d6f848700637551",
25
25
  "src/website-header.ts": "ac4972a28a5f0968de4d5f98d54fbac853f901c7eda00c0849984a2e66f291f3",
26
- "src/website-navigation.ts": "0c70ef6a518d2ba051be0f9094d92cad33ead42815c52742a93835247331dd1c",
26
+ "src/website-navigation.ts": "fbbefeb0cd95665021a525c7b067d55b547fc24eeb6c03e84e42cf345a1da6d0",
27
27
  "src/website-notice.ts": "65c781bec41e6c2e541d9512cc0051864d64fc3204b3ba5f2e005bdc955f39c9",
28
28
  "src/website-session-store.ts": "8ef6d49465e0034f12b763a666b4a90c8c9819fb8baea06dcaba340fd97d72f1",
29
29
  "src/website-session.ts": "f2434fafc40adb15b5f16fc8b6152bd8df7e85f5210330a1337502c9a08136d8",
@@ -31,7 +31,7 @@
31
31
  "tsconfig.json": "1ad0b3b39537564a180dc7f4084ceb3098b567f509320c77d71bc37aaf4f1879"
32
32
  },
33
33
  "artifacts": {
34
- "lib/client.js": "c380faa909eb794101949a7621dab657508cd393e67b246f33912fc50bf08a96",
34
+ "lib/client.js": "46a6041d6c144746b485d03809ea1aff6f6a6c5591b314f76309b500df4d3e72",
35
35
  "lib/index.js": "e9c50cc544f24c60d086538ab1283ae0ed2811f23c9bb469916a2e89c3ffb38d",
36
36
  "lib/types/authorization.d.ts": "130649eed3635e75c3f50c13de93c52440a27f1b88136ab2297552570c013d49",
37
37
  "lib/types/client.d.ts": "a79702d5d86c75e81f1e954b3e9f4a562a6b3082d68d798d6a1b37bd41b908a7",
@@ -41,10 +41,10 @@
41
41
  "lib/types/server.d.ts": "62b23f8f9fe9bb16a20274929876c1a34b3ab1e94179567e2e3a56cd67638288",
42
42
  "lib/types/sidebar-adapter.d.ts": "9296987e7ecbd76e42d75bbf65d06f3e368dc036501baf931d7eaa9fb923252d",
43
43
  "lib/types/styles.d.ts": "305836b3ce5cb256ffb033038b7df2919759976f3ca29395a7cd41bbd5811536",
44
- "lib/types/ui.d.ts": "ecd307b91dec65724fe331081c00c6aea5e286051a9f79cda0f9ab476398d8f4",
44
+ "lib/types/ui.d.ts": "c1239e1382356c169ef34074240a19109a2839a2608e018ec436d1d716fe494b",
45
45
  "lib/types/web-surface.d.ts": "71686d72b4a5d6c619ee4ec916bbf7b853a87a7cc4d506fbfd0359191434984f",
46
46
  "lib/types/website-header.d.ts": "6379a35e7d35af3fb969802ee2cae969a104dbad937f7b9e371463a0bd7dea9d",
47
- "lib/types/website-navigation.d.ts": "6ffd226ded2fc9971bf982e41ee8d8b15d89d113943bbd7cea18f9d4c1ccc973",
47
+ "lib/types/website-navigation.d.ts": "822e80968c1a704cd2a341d53ee38a483f0a407a0e23d2dd883fd25d0925186d",
48
48
  "lib/types/website-notice.d.ts": "2912746645e3e9facfe167c7b2b2eff584e3b812cab5e106afc7cb2b0259fc15",
49
49
  "lib/types/website-session-store.d.ts": "bd641ab5e62ea4dd5f5cbfa823548a5c266c9701bca986fb348482ee69b2e0c0",
50
50
  "lib/types/website-session.d.ts": "5ded232b24dd72e7b3c5f0ff505ba0aa818cbde14be7e2099bbbf262ec395a2b",
package/lib/client.js CHANGED
@@ -14747,9 +14747,9 @@ window.__ModuleLoader__.load({
14747
14747
  var chatStyles = String.raw`
14748
14748
  .dsh-chat-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
14749
14749
  .dsh-chat-navigation,.dsh-chat-brand-control,.dsh-chat-brand-name,.dsh-chat-main-anchor,.dsh-chat-web-surface{font-family:var(--dsw-font-family,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif);color:var(--dsw-alias-label-primary,#22242a);box-sizing:border-box;font-size:14px}
14750
- .dsh-chat-navigation *,.dsh-chat-brand-control *,.dsh-chat-brand-name *,.dsh-chat-main-anchor *,.dsh-chat-web-surface *{box-sizing:border-box}
14751
- .dsh-chat-navigation button,.dsh-chat-brand-control button,.dsh-chat-main-anchor button,.dsh-chat-web-surface button{font:inherit;-webkit-app-region:no-drag}
14752
- .dsh-chat-navigation button:focus-visible,.dsh-chat-brand-control button:focus-visible,.dsh-chat-main-anchor button:focus-visible,.dsh-chat-web-surface button:focus-visible{outline:2px solid #4d6bfe;outline-offset:3px}
14750
+ .dsh-chat-navigation *,.dsh-chat-brand-control *,.dsh-chat-brand-name *,.dsh-chat-main-anchor *,.dsh-chat-web-surface *,.dsh-chat-settings *{box-sizing:border-box}
14751
+ .dsh-chat-navigation button,.dsh-chat-brand-control button,.dsh-chat-main-anchor button,.dsh-chat-web-surface button,.dsh-chat-settings button{font:inherit;-webkit-app-region:no-drag}
14752
+ .dsh-chat-navigation button:focus-visible,.dsh-chat-brand-control button:focus-visible,.dsh-chat-main-anchor button:focus-visible,.dsh-chat-web-surface button:focus-visible,.dsh-chat-settings button:focus-visible{outline:2px solid #4d6bfe;outline-offset:3px}
14753
14753
  .dsh-chat-modes{display:flex;align-items:center;gap:2px;border:0;padding:3px;margin:0;border-radius:9px;background:var(--dsw-alias-interactive-bg-hover,#e7e9ed);min-width:0;width:max-content}
14754
14754
  .dsh-chat-modes button{padding:6px 9px;border:0;background:transparent;border-radius:6px;color:inherit;font-size:10px;font-weight:650;letter-spacing:.35px;white-space:nowrap;cursor:pointer;min-height:27px}
14755
14755
  .dsh-chat-modes button[aria-pressed="true"]{background:#fff;color:#242832;box-shadow:0 1px 3px #151e2f15}
@@ -14777,6 +14777,7 @@ window.__ModuleLoader__.load({
14777
14777
  .dsh-chat-navigation-header{display:flex;align-items:center;justify-content:space-between;padding:0 14px 8px 16px;min-height:36px;color:var(--dsw-alias-label-secondary,#8b8d91);font-size:14px}
14778
14778
  .dsh-chat-navigation-header>div{display:flex;gap:2px}
14779
14779
  .dsh-chat-icon-button{display:inline-flex;align-items:center;justify-content:center;flex:none;width:28px;height:28px;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary,#8b8d91);cursor:pointer;font-size:21px!important}.dsh-chat-icon-button:hover{background:var(--dsw-alias-interactive-bg-hover,#ffffff0d)}.dsh-chat-icon-button:disabled{opacity:.4;cursor:default}
14780
+ .dsh-chat-refreshing{animation:dsh-chat-refresh-spin .8s linear infinite}@keyframes dsh-chat-refresh-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.dsh-chat-refreshing{animation:none}}
14780
14781
  .dsh-chat-navigation-search{margin:0 14px 8px;padding:7px 9px;min-width:0;border:1px solid var(--dsw-alias-border-l2,#85858b40);border-radius:6px;background:transparent;color:inherit;font:inherit;font-size:12px}
14781
14782
  .dsh-chat-navigation-list{flex:1;min-height:0;overflow:auto;padding:0 12px 12px;scrollbar-width:thin}
14782
14783
  .dsh-chat-conversation-group h3{font-size:12px;font-weight:400;color:var(--dsw-alias-label-secondary,#8b8d91);margin:15px 4px 6px}
@@ -14784,6 +14785,7 @@ window.__ModuleLoader__.load({
14784
14785
  .dsh-chat-navigation-status{font-size:12px;line-height:1.7;color:var(--dsw-alias-label-secondary,#8b8d91);padding:6px 4px}
14785
14786
  .dsh-chat-navigation-rail{align-items:center;padding-top:6px}
14786
14787
  .dsh-chat-text-button{padding:7px 4px;border:0;background:transparent;color:var(--dsw-alias-label-secondary,#8b8d91);font-size:11px!important;cursor:pointer}
14788
+ .dsh-chat-primary-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:144px;min-height:40px;padding:10px 20px;border:1px solid #4d6bfe;border-radius:8px;background:#4d6bfe;color:#fff;font-size:14px!important;font-weight:600!important;line-height:20px;white-space:nowrap;cursor:pointer;pointer-events:auto;-webkit-app-region:no-drag}.dsh-chat-primary-button:hover{background:#617dff;border-color:#617dff}.dsh-chat-primary-button:active{background:#3b58e8;border-color:#3b58e8}.dsh-chat-primary-button:disabled{opacity:.5;cursor:default}
14787
14789
  .dsh-chat-main-anchor{height:100%;min-width:0;width:100%;position:relative;background:var(--dsw-alias-bg-base,#fff)}
14788
14790
  .dsh-chat-web-surface{position:fixed;z-index:20;pointer-events:auto;display:flex;flex-direction:column;background:var(--dsw-alias-bg-base,#fff);overflow:hidden}
14789
14791
  .dsh-chat-web-content{position:relative;flex:1;min-height:0;display:flex}.dsh-chat-webview{display:flex;width:100%;height:100%;flex:1;border:0}
@@ -14795,8 +14797,7 @@ window.__ModuleLoader__.load({
14795
14797
  .dsh-chat-leading button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:0;border-radius:var(--dsw-radius-sm,6px);background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;-webkit-app-region:no-drag}
14796
14798
  .dsh-chat-leading button:hover{background:var(--dsw-alias-interactive-bg-hover)}.dsh-chat-leading button:disabled{opacity:.4;cursor:default}
14797
14799
  .dsh-chat-settings{font-family:var(--dsw-font-family,system-ui);color:var(--dsw-alias-label-primary);font-size:14px;min-width:0}.dsh-chat-settings h2{margin:0 0 20px;font-size:20px}
14798
- .dsh-chat-settings-pane-hidden{height:1px!important;min-height:1px!important;background:transparent!important;overflow:hidden!important}.dsh-chat-settings-card{border:1px solid var(--dsw-alias-border-primary,#ffffff15);border-radius:12px;padding:24px;background:var(--dsw-alias-bg-base,#202124)}.dsh-chat-settings-language{display:flex;align-items:center;justify-content:space-between;gap:24px;border-top:1px solid #ffffff15;padding-top:20px}.dsh-chat-settings-select{position:relative;display:inline-flex;flex:none;min-width:140px}.dsh-chat-settings-language select{box-sizing:border-box;width:100%;appearance:none;-webkit-appearance:none;font:inherit;color:inherit;background:var(--dsw-alias-bg-base,#202124);border:1px solid #ffffff25;border-radius:8px;padding:8px 38px 8px 12px;min-width:140px}.dsh-chat-settings-select-arrow{position:absolute;right:12px;top:50%;transform:translateY(-50%);width:12px;height:12px;pointer-events:none}.dsh-chat-settings-language select:disabled+.dsh-chat-settings-select-arrow{opacity:.4}.dsh-chat-settings-account p,.dsh-chat-settings-progress{font-size:12px;color:var(--dsw-alias-label-secondary,#aaa)}
14799
- .dsh-chat-settings-pane{position:relative;height:min(500px,calc(100vh - 340px));min-height:220px;border-radius:12px;overflow:hidden;background:#292a2d}
14800
+ .dsh-chat-settings-card{border:1px solid var(--dsw-alias-border-primary,#ffffff15);border-radius:12px;padding:24px;background:var(--dsw-alias-bg-base,#202124)}.dsh-chat-settings-status strong{display:block;font-size:16px;font-weight:600}.dsh-chat-settings-status p{margin:10px 0 20px;color:var(--dsw-alias-label-secondary,#aaa);line-height:1.7}.dsh-chat-settings-status .dsh-chat-settings-error{color:#ff8585}.dsh-chat-settings-language{display:flex;align-items:center;justify-content:space-between;gap:24px;border-top:1px solid #ffffff15;padding-top:20px}.dsh-chat-settings-select{position:relative;display:inline-flex;flex:none;min-width:140px}.dsh-chat-settings-language select{box-sizing:border-box;width:100%;appearance:none;-webkit-appearance:none;font:inherit;color:inherit;background:var(--dsw-alias-bg-base,#202124);border:1px solid #ffffff25;border-radius:8px;padding:8px 38px 8px 12px;min-width:140px}.dsh-chat-settings-select-arrow{position:absolute;right:12px;top:50%;transform:translateY(-50%);width:12px;height:12px;pointer-events:none}.dsh-chat-settings-language select:disabled+.dsh-chat-settings-select-arrow{opacity:.4}.dsh-chat-settings-account p,.dsh-chat-settings-progress{font-size:12px;color:var(--dsw-alias-label-secondary,#aaa)}
14800
14801
  .dsh-chat-settings-account{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:12px;min-width:0}.dsh-chat-settings-account>div{flex:1 1 0%;min-width:0;max-width:100%}.dsh-chat-settings-account strong{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsh-chat-settings-account button{flex-shrink:0;white-space:nowrap;padding:8px 14px;border:1px solid #ff5f64;border-radius:8px;background:transparent;color:#ff5f64;cursor:pointer;font:inherit}.dsh-chat-settings-account button:disabled{opacity:.4;cursor:default}
14801
14802
  .dsh-chat-settings-error{color:#ff8585;line-height:1.5;font-size:12px}
14802
14803
  `;
@@ -14886,7 +14887,7 @@ window.__ModuleLoader__.load({
14886
14887
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatStyles, {}),
14887
14888
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatModeSelector, { bridge, state }),
14888
14889
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatAuthorizationNotice, { bridge, state }),
14889
- state.sidebarAdapted === false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-chat-authorization-notice", role: "alert", children: "\u5F53\u524D\u4FA7\u680F\u4E0D\u517C\u5BB9\uFF1A\u9876\u90E8\u65B0\u4F1A\u8BDD\u4ECD\u4F7F\u7528 HARNESS\u3002CHAT \u8BF7\u4F7F\u7528\u5BF9\u8BDD\u5217\u8868\u65C1\u7684\uFF0B\u3002" })
14890
+ state.sidebarAdapted === false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-chat-authorization-notice", role: "alert", children: "\u5F53\u524D\u4FA7\u680F\u4E0D\u517C\u5BB9\uFF1A\u9876\u90E8\u65B0\u4F1A\u8BDD\u4ECD\u4F7F\u7528 HARNESS\u3002CHAT \u8BF7\u5C55\u5F00\u5B98\u7F51\u5BFC\u822A\u540E\u65B0\u5EFA\u5BF9\u8BDD\u3002" })
14890
14891
  ] });
14891
14892
  }
14892
14893
  function DshChatChatNavigation({ bridge, wide, expandSidebar }) {
@@ -14894,6 +14895,8 @@ window.__ModuleLoader__.load({
14894
14895
  const [query, setQuery] = (0, import_react.useState)("");
14895
14896
  const [searching, setSearching] = (0, import_react.useState)(false);
14896
14897
  const navigation = state.websiteNavigation;
14898
+ const refreshing = state.websiteNavigationRefreshing;
14899
+ const refreshDisabled = !state.modeEnabled || !state.desktopAvailable || refreshing || state.webLoading || navigation.authenticated !== true || ["signing-in", "signing-out"].includes(state.websiteAuthenticationStatus) || navigation.settings?.pending;
14897
14900
  const groups = /* @__PURE__ */ new Map();
14898
14901
  for (const item of navigation.conversations) {
14899
14902
  if (!item.title.toLocaleLowerCase().includes(query.toLocaleLowerCase())) continue;
@@ -14911,11 +14914,12 @@ window.__ModuleLoader__.load({
14911
14914
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8.5", cy: "8.5", r: "6", stroke: "currentColor", strokeWidth: "1.4" }),
14912
14915
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m13 13 4 4", stroke: "currentColor", strokeWidth: "1.4" })
14913
14916
  ] }) }),
14914
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-chat-icon-button", "aria-label": "\u65B0\u5EFA\u5B98\u7F51\u5BF9\u8BDD", disabled: !navigation.canCreate, onClick: () => bridge.commandWebsite({ type: "new" }), children: "\uFF0B" })
14917
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tooltip, { label: refreshing ? "\u6B63\u5728\u5237\u65B0\u5B98\u7F51\u5BF9\u8BDD\u5217\u8868\u2026" : "\u5237\u65B0\u5B98\u7F51\u5BF9\u8BDD\u5217\u8868", delayMs: 500, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-chat-icon-button", "aria-label": "\u5237\u65B0\u5B98\u7F51\u5BF9\u8BDD\u5217\u8868", "aria-busy": refreshing, disabled: refreshDisabled, onClick: () => bridge.refreshWebsiteNavigation(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconRefreshOutlineRegular, { size: 14, className: refreshing ? "dsh-chat-refreshing" : void 0 }) }) })
14915
14918
  ] })
14916
14919
  ] }),
14917
14920
  searching && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { className: "dsh-chat-navigation-search", "aria-label": "\u641C\u7D22\u5DF2\u52A0\u8F7D\u7684\u5B98\u7F51\u5BF9\u8BDD\u6807\u9898", placeholder: "\u641C\u7D22\u5BF9\u8BDD", value: query, onChange: (event) => setQuery(event.target.value), autoFocus: true }),
14918
14921
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-navigation-list", children: [
14922
+ refreshing && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-chat-navigation-status", role: "status", children: "\u6B63\u5728\u5237\u65B0\u5B98\u7F51\u5BF9\u8BDD\u5217\u8868\u2026" }),
14919
14923
  navigation.authenticated === true && navigation.status === "ready" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
14920
14924
  [...groups].map(([label, rows]) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-chat-conversation-group", "aria-label": label, children: [
14921
14925
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: label }),
@@ -14924,7 +14928,8 @@ window.__ModuleLoader__.load({
14924
14928
  groups.size === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-chat-navigation-status", children: query ? "\u6CA1\u6709\u5339\u914D\u7684\u5BF9\u8BDD" : "\u6682\u65E0\u5BF9\u8BDD" }),
14925
14929
  !query && navigation.conversations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-chat-text-button", onClick: () => bridge.commandWebsite({ type: "more" }), children: "\u52A0\u8F7D\u66F4\u65E9\u7684\u5BF9\u8BDD" })
14926
14930
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-chat-navigation-status", role: "status", children: navigation.status === "sign-in" ? "CHAT \u5C1A\u672A\u767B\u5F55\u3002\u8BF7\u5728\u53F3\u4FA7\u70B9\u51FB\u767B\u5F55 DeepSeek\uFF0C\u5B8C\u6210\u540E\u81EA\u52A8\u663E\u793A\u5B98\u7F51\u5BF9\u8BDD\u3002" : navigation.status === "unsupported" ? "\u6682\u672A\u8BC6\u522B\u5B98\u7F51\u5217\u8868\uFF0C\u8BF7\u4F7F\u7528\u53F3\u4FA7\u5B98\u7F51\u5BFC\u822A\u3002" : "\u6B63\u5728\u52A0\u8F7D\u5B98\u7F51\u5BF9\u8BDD\u2026" }),
14927
- navigation.error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-chat-navigation-status", role: "alert", children: navigation.error })
14931
+ navigation.error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-chat-navigation-status", role: "alert", children: navigation.error }),
14932
+ state.websiteNavigationRefreshError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-chat-navigation-status", role: "alert", children: state.websiteNavigationRefreshError })
14928
14933
  ] })
14929
14934
  ] })
14930
14935
  ] });
@@ -14968,44 +14973,32 @@ window.__ModuleLoader__.load({
14968
14973
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tooltip, { label: "\u65B0\u5EFA\u5BF9\u8BDD", delayMs: 500, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", "aria-label": "\u65B0\u5EFA\u5B98\u7F51\u5BF9\u8BDD", disabled: !state.modeEnabled || !state.websiteNavigation.canCreate, onClick: () => bridge.commandWebsite({ type: "new" }), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconNewChatOutlineRegular, { size: 16 }) }) })
14969
14974
  ] });
14970
14975
  }
14971
- function DshChatChatSettings({ bridge }) {
14976
+ function DshChatChatSettings({ bridge, close }) {
14972
14977
  const state = useDshChat(bridge);
14973
- const pane = (0, import_react.useRef)(null);
14974
14978
  const enabled = state.desktopAvailable;
14975
14979
  (0, import_react.useLayoutEffect)(() => {
14976
- const element = pane.current;
14977
- if (!element || !enabled) {
14978
- bridge.updateSettingsViewport(null);
14980
+ if (!enabled) {
14981
+ bridge.setSettingsOpen(false);
14979
14982
  return;
14980
14983
  }
14981
- const measure = () => {
14982
- const rect = element.getBoundingClientRect();
14983
- bridge.updateSettingsViewport({ left: rect.left, top: rect.top, width: rect.width, height: rect.height });
14984
- };
14985
- const resize = new ResizeObserver(measure);
14986
- resize.observe(element);
14987
- globalThis.addEventListener("resize", measure);
14988
- globalThis.addEventListener("scroll", measure, true);
14989
- measure();
14984
+ bridge.setSettingsOpen(true);
14990
14985
  return () => {
14991
- resize.disconnect();
14992
- globalThis.removeEventListener("resize", measure);
14993
- globalThis.removeEventListener("scroll", measure, true);
14994
- bridge.updateSettingsViewport(null);
14986
+ bridge.setSettingsOpen(false);
14995
14987
  };
14996
14988
  }, [bridge, enabled]);
14997
- (0, import_react.useLayoutEffect)(() => {
14998
- if (!enabled || !pane.current) return;
14999
- const rect = pane.current.getBoundingClientRect();
15000
- bridge.updateSettingsViewport({ left: rect.left, top: rect.top, width: rect.width, height: rect.height });
15001
- }, [bridge, enabled, state.preferenceError, state.websiteNavigation.accountName, state.websiteNavigation.settings?.error, state.websiteAuthenticationStatus]);
14989
+ const signIn = () => {
14990
+ bridge.setSettingsOpen(false);
14991
+ close();
14992
+ bridge.beginWebsiteSignIn();
14993
+ };
15002
14994
  const navigation = state.websiteNavigation;
15003
14995
  const settings = navigation.settings;
14996
+ const showAccount = enabled && navigation.authenticated === true && !["signed-out", "signing-in", "signing-out"].includes(state.websiteAuthenticationStatus);
15004
14997
  const language = /中文|Chinese/i.test(settings?.language ?? "") ? "zh-CN" : /English|英语/i.test(settings?.language ?? "") ? "en" : /^(System|跟随系统|系统|Follow system)$/i.test(settings?.language ?? "") ? "system" : "";
15005
14998
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-chat-settings", children: [
15006
14999
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatStyles, {}),
15007
15000
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "CHAT\u8BBE\u7F6E" }),
15008
- enabled && navigation.authenticated === true && state.websiteAuthenticationStatus !== "signing-out" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-settings-card", children: [
15001
+ showAccount && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-settings-card", children: [
15009
15002
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-settings-account", role: "group", "aria-label": "DeepSeek \u5B98\u7F51\u8D26\u53F7", children: [
15010
15003
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
15011
15004
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { title: navigation.accountName || "DeepSeek Chat", children: navigation.accountName || "DeepSeek Chat" }),
@@ -15045,23 +15038,30 @@ window.__ModuleLoader__.load({
15045
15038
  ] })
15046
15039
  ] }),
15047
15040
  !enabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "status", children: "\u9700\u8981 DSH \u684C\u9762\u7248\u7684\u5B98\u65B9\u7F51\u9875\u5BB9\u5668\u3002" }),
15048
- enabled && state.websiteAuthenticationStatus === "signed-out" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-settings-card", children: [
15049
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "CHAT \u5C1A\u672A\u767B\u5F55\u3002\u8FD9\u91CC\u4E0E\u5BF9\u8BDD\u9875\u9762\u4F7F\u7528\u540C\u4E00\u4E2A\u5B98\u7F51\u8D26\u53F7\uFF0C\u767B\u5F55\u540E\u81EA\u52A8\u540C\u6B65\u3002" }),
15050
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => bridge.beginWebsiteSignIn(), children: "\u767B\u5F55 DeepSeek" })
15041
+ enabled && state.websiteAuthenticationStatus === "signed-out" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-settings-card dsh-chat-settings-status", children: [
15042
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "CHAT \u5C1A\u672A\u767B\u5F55" }),
15043
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "\u767B\u5F55\u4F1A\u6253\u5F00 CHAT \u5BF9\u8BDD\u9875\u9762\u3002\u5B8C\u6210\u5B98\u7F51\u767B\u5F55\u540E\uFF0C\u8FD9\u91CC\u7684\u8D26\u53F7\u4E0E\u5B98\u7F51\u5BF9\u8BDD\u4F1A\u81EA\u52A8\u540C\u6B65\u3002" }),
15044
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-chat-primary-button", onClick: signIn, children: "\u767B\u5F55 DeepSeek" })
15051
15045
  ] }),
15052
- enabled && state.websiteAuthenticationStatus === "signing-in" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "status", children: "\u8BF7\u5728\u4E0B\u65B9\u5B98\u7F51\u5B8C\u6210\u767B\u5F55\u3002\u767B\u5F55\u6210\u529F\u540E\u8D26\u53F7\u3001\u5BF9\u8BDD\u5217\u8868\u548C\u767B\u5F55\u8BB0\u5FC6\u4F1A\u81EA\u52A8\u540C\u6B65\u3002" }),
15053
- enabled && state.websiteAuthenticationStatus === "signing-out" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "status", children: "\u6B63\u5728\u6E05\u9664\u767B\u5F55\u8BB0\u5FC6\u5E76\u9000\u51FA\u5B98\u7F51\u2026" }),
15054
- enabled && state.websiteAuthenticationStatus === "error" && state.websiteSessionError && navigation.authenticated !== true && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "dsh-chat-settings-error", role: "alert", children: [
15055
- state.websiteSessionError,
15056
- " ",
15057
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => bridge.logoutWebsite(), children: "\u91CD\u8BD5\u9000\u51FA\u767B\u5F55" })
15046
+ enabled && state.websiteAuthenticationStatus === "signing-in" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-settings-card dsh-chat-settings-status", children: [
15047
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { role: "status", children: "\u6B63\u5728\u767B\u5F55 DeepSeek" }),
15048
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "\u8BF7\u5728 CHAT \u5BF9\u8BDD\u9875\u9762\u5B8C\u6210\u5B98\u7F51\u767B\u5F55\u3002\u767B\u5F55\u6210\u529F\u540E\uFF0C\u8D26\u53F7\u548C\u767B\u5F55\u8BB0\u5FC6\u4F1A\u81EA\u52A8\u540C\u6B65\u3002" }),
15049
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-chat-primary-button", onClick: signIn, children: "\u7EE7\u7EED\u767B\u5F55" })
15058
15050
  ] }),
15059
- enabled && state.websiteAuthenticationStatus !== "signing-out" && navigation.authenticated !== true && navigation.status !== "sign-in" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { role: "status", children: [
15060
- state.webError || (navigation.status === "unsupported" ? "\u5B98\u7F51\u9875\u9762\u5DF2\u6253\u5F00\uFF0C\u6682\u672A\u8BC6\u522B\u5230\u8D26\u53F7\u548C\u5BF9\u8BDD\u533A\u57DF\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8BD5\u3002" : "\u6B63\u5728\u8BC6\u522B DeepSeek \u5B98\u7F51\u767B\u5F55\u72B6\u6001\u2026"),
15061
- " ",
15062
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => bridge.reloadWebsite(), children: "\u91CD\u65B0\u52A0\u8F7D" })
15051
+ enabled && state.websiteAuthenticationStatus === "signing-out" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-settings-card dsh-chat-settings-status", children: [
15052
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { role: "status", children: "\u6B63\u5728\u9000\u51FA\u767B\u5F55" }),
15053
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "\u6B63\u5728\u6E05\u9664\u767B\u5F55\u8BB0\u5FC6\u5E76\u9000\u51FA\u5B98\u7F51\u2026" })
15063
15054
  ] }),
15064
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: pane, className: `dsh-chat-settings-pane${enabled && state.websiteAuthenticationStatus === "signing-in" ? "" : " dsh-chat-settings-pane-hidden"}`, "aria-label": "CHAT\u5B98\u7F51\u767B\u5F55\u533A\u57DF" })
15055
+ enabled && state.websiteAuthenticationStatus === "error" && !showAccount && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-settings-card dsh-chat-settings-status", children: [
15056
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u767B\u5F55\u72B6\u6001\u6682\u65F6\u65E0\u6CD5\u540C\u6B65" }),
15057
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-chat-settings-error", role: "alert", children: state.websiteSessionError || state.webError || "\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u5B98\u7F51\u767B\u5F55\u72B6\u6001\uFF0C\u8BF7\u91CD\u8BD5\u3002" }),
15058
+ /退出/.test(state.websiteSessionError ?? "") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-chat-text-button", onClick: () => bridge.logoutWebsite(), children: "\u91CD\u8BD5\u9000\u51FA\u767B\u5F55" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-chat-text-button", onClick: () => bridge.reloadWebsite(), children: "\u91CD\u65B0\u52A0\u8F7D" })
15059
+ ] }),
15060
+ enabled && !showAccount && state.websiteAuthenticationStatus === "loading" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-settings-card dsh-chat-settings-status", children: [
15061
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { role: "status", children: "\u6B63\u5728\u540C\u6B65\u5B98\u7F51\u8D26\u53F7" }),
15062
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: state.webError || (navigation.status === "unsupported" ? "\u5B98\u7F51\u9875\u9762\u5DF2\u6253\u5F00\uFF0C\u6B63\u5728\u540C\u6B65\u8D26\u53F7\u548C\u5BF9\u8BDD\u5217\u8868\u2026" : "\u6B63\u5728\u8BC6\u522B DeepSeek \u5B98\u7F51\u767B\u5F55\u72B6\u6001\u2026") }),
15063
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-chat-text-button", onClick: () => bridge.reloadWebsite(), children: "\u91CD\u65B0\u52A0\u8F7D" })
15064
+ ] })
15065
15065
  ] });
15066
15066
  }
15067
15067
 
@@ -15415,16 +15415,18 @@ window.__ModuleLoader__.load({
15415
15415
  const profileProofMarker = "data-dsh-chat-profile-confirmed";
15416
15416
  const profileAvatarMarker = "data-dsh-chat-profile-avatar";
15417
15417
  const navigationWidthMarker = "data-dsh-chat-navigation-width";
15418
+ const expandingMarker = "data-dsh-chat-expanding";
15419
+ const compactToggleMarker = "data-dsh-chat-compact-toggle";
15418
15420
  const conversationError = "\u8BE5\u5BF9\u8BDD\u4E0D\u5728\u5F53\u524D\u5B98\u7F51\u5217\u8868\uFF0C\u8BF7\u5237\u65B0\u5217\u8868\u3002";
15419
15421
  const styleId = "dsh-chat-website-navigation-style";
15420
15422
  const preparingStyleId = "dsh-chat-website-preparing-style";
15421
- const owned = [marker, presentedMarker, missingSidebarMarker, fallbackMarker, fallbackErrorMarker, profileMarker, profileProofMarker, profileAvatarMarker, navigationWidthMarker, "data-dsh-chat-layout", "data-dsh-chat-content", "data-dsh-chat-web-chrome", "data-dsh-chat-settings-dialog", "data-dsh-chat-settings-host", "data-dsh-chat-settings-tabs", "data-dsh-chat-settings-pane", "data-dsh-chat-settings-layout", "data-dsh-chat-settings-chrome", "data-dsh-chat-settings-appearance", "data-dsh-chat-expanding", "data-dsh-chat-header-row", "data-dsh-chat-header-title", "data-dsh-chat-header-share", "data-dsh-chat-header-title-host", "data-dsh-chat-header-editor", "data-dsh-chat-header-native-depth"];
15423
+ const owned = [marker, presentedMarker, missingSidebarMarker, fallbackMarker, fallbackErrorMarker, profileMarker, profileProofMarker, profileAvatarMarker, navigationWidthMarker, expandingMarker, compactToggleMarker, "data-dsh-chat-layout", "data-dsh-chat-content", "data-dsh-chat-web-chrome", "data-dsh-chat-settings-dialog", "data-dsh-chat-settings-host", "data-dsh-chat-settings-tabs", "data-dsh-chat-settings-pane", "data-dsh-chat-settings-layout", "data-dsh-chat-settings-chrome", "data-dsh-chat-settings-appearance", "data-dsh-chat-header-row", "data-dsh-chat-header-title", "data-dsh-chat-header-share", "data-dsh-chat-header-title-host", "data-dsh-chat-header-editor", "data-dsh-chat-header-native-depth"];
15422
15424
  const empty = (status) => ({ status, ...status === "sign-in" ? { authenticated: false } : {}, conversations: [], selectedHref: null, canCreate: false, error: null });
15423
15425
  const clearSettings = (preserveConfirmedPreferences = false) => {
15424
15426
  const confirmed = ["data-dsh-chat-language", "data-dsh-chat-theme", "data-dsh-chat-dark-complete", "data-dsh-chat-settings-restored"];
15425
15427
  for (const attr of [...doc.documentElement.attributes]) if (/^data-dsh-chat-(settings-|language$|theme$|dark-complete$)/.test(attr.name) && !(preserveConfirmedPreferences && confirmed.includes(attr.name))) doc.documentElement.removeAttribute(attr.name);
15426
15428
  };
15427
- const restore = (preserveConfirmedPreferences = false) => {
15429
+ const restore = (preserveConfirmedPreferences = false, preserveCompactAttempt = false) => {
15428
15430
  clearSettings(preserveConfirmedPreferences);
15429
15431
  doc.getElementById(styleId)?.remove();
15430
15432
  doc.getElementById("dsh-chat-header-style")?.remove();
@@ -15433,10 +15435,14 @@ window.__ModuleLoader__.load({
15433
15435
  doc.getElementById("dsh-chat-settings-view-style")?.remove();
15434
15436
  doc.documentElement.removeAttribute("data-dsh-chat-voice");
15435
15437
  doc.documentElement.removeAttribute("data-dsh-chat-preparing");
15436
- owned.forEach((attr) => doc.querySelectorAll(`[${attr}]`).forEach((node2) => node2.removeAttribute(attr)));
15438
+ owned.forEach((attr) => {
15439
+ if (preserveCompactAttempt && (attr === expandingMarker || attr === compactToggleMarker)) return;
15440
+ doc.querySelectorAll(`[${attr}]`).forEach((node2) => node2.removeAttribute(attr));
15441
+ });
15437
15442
  };
15438
15443
  const fallback = (error51 = null) => {
15439
- restore(page.origin === origin && !/^\/sign_in\/?$/.test(page.pathname) && command.type !== "restore");
15444
+ const preserveRecovery = page.origin === origin && !/^\/sign_in\/?$/.test(page.pathname) && command.type !== "restore";
15445
+ restore(preserveRecovery, preserveRecovery);
15440
15446
  if (page.origin === origin && /^\/sign_in\/?$/.test(page.pathname)) return empty("sign-in");
15441
15447
  if (!(command.type === "snapshot" && command.showOriginal)) {
15442
15448
  doc.documentElement.setAttribute(fallbackMarker, "");
@@ -15539,25 +15545,56 @@ window.__ModuleLoader__.load({
15539
15545
  if (started !== previous) doc.documentElement.setAttribute(missingSidebarMarker, String(started));
15540
15546
  return now - started >= 5e3;
15541
15547
  };
15548
+ const iconButtonSelector = 'button,[role="button"],.ds-icon-button';
15549
+ const compactNavigation = () => {
15550
+ const toggleLabels = /^(展开侧边栏|打开侧边栏|侧边栏|切换侧边栏|Open sidebar|Expand sidebar|Toggle sidebar|Sidebar)$/i;
15551
+ const openingLabels = /^(展开侧边栏|打开侧边栏|Open sidebar|Expand sidebar)$/i;
15552
+ const searchLabels = /^(搜索|搜索对话|Search|Search chats|Search conversations)$/i;
15553
+ const newLabels = /^(开启新对话|新对话|新建对话|New chat|New Chat)$/i;
15554
+ const namedAs = (button, expected) => {
15555
+ const names = ["aria-label", "title"].map((attr) => (button.getAttribute(attr) ?? "").trim()).filter(Boolean);
15556
+ return names.length === 0 || names.every((name2) => expected.test(name2));
15557
+ };
15558
+ for (const row of doc.querySelectorAll("div,header,nav")) {
15559
+ const bounds = row.getBoundingClientRect();
15560
+ if (bounds.top < -1 || bounds.top > 72 || bounds.left < -1 || bounds.left > 160 || bounds.width < 72 || bounds.width > 360 || bounds.height < 24 || bounds.height > 80 || row.textContent?.trim() || row.closest('[role="dialog"],[role="menu"],[data-dsh-chat-settings-dialog],.ds-modal-content,.ds-dropdown-menu') || row.querySelector('a[href],input,textarea,[contenteditable="true"]')) continue;
15561
+ const rowButtons = [...row.querySelectorAll(iconButtonSelector)].filter((button) => {
15562
+ const parentButton = button.parentElement?.closest(iconButtonSelector);
15563
+ return !parentButton || !row.contains(parentButton);
15564
+ });
15565
+ if (rowButtons.length !== 3) continue;
15566
+ const buttons = rowButtons.filter((button) => {
15567
+ const rect = button.getBoundingClientRect();
15568
+ return rect.width >= 20 && rect.width <= 64 && rect.height >= 20 && rect.height <= 64 && rect.left >= bounds.left - 1 && rect.right <= bounds.right + 1 && rect.top >= bounds.top - 1 && rect.bottom <= bounds.bottom + 1 && !button.textContent?.trim() && !!button.querySelector("svg") && !button.closest('[hidden],[aria-hidden="true"]') && getComputedStyle(button).visibility !== "hidden" && button.getAttribute("aria-disabled") !== "true" && !button.matches(":disabled");
15569
+ }).sort((left, right) => left.getBoundingClientRect().left - right.getBoundingClientRect().left);
15570
+ if (buttons.length !== 3 || buttons[0].getAttribute("aria-expanded") === "true" || !namedAs(buttons[0], toggleLabels) || !namedAs(buttons[1], searchLabels) || !namedAs(buttons[2], newLabels)) continue;
15571
+ const rects = buttons.map((button) => button.getBoundingClientRect());
15572
+ if (rects.some((rect) => Math.abs(rect.top - rects[0].top) > 8) || rects[1].left < rects[0].right - 1 || rects[2].left < rects[1].right - 1) continue;
15573
+ return { row, toggle: buttons[0] };
15574
+ }
15575
+ for (const toggle of doc.querySelectorAll(iconButtonSelector)) {
15576
+ const bounds = toggle.getBoundingClientRect();
15577
+ const name2 = (toggle.getAttribute("aria-label") || toggle.getAttribute("title") || "").trim();
15578
+ const expanded = toggle.getAttribute("aria-expanded");
15579
+ if (!toggleLabels.test(name2) || expanded === "true" || !openingLabels.test(name2) && expanded !== "false" || bounds.left < 0 || bounds.left > 160 || bounds.top < 0 || bounds.top > 72 || bounds.width < 20 || bounds.width > 64 || bounds.height < 20 || bounds.height > 64 || toggle.textContent?.trim() || !toggle.querySelector("svg") || toggle.getAttribute("aria-disabled") === "true" || toggle.matches(":disabled") || getComputedStyle(toggle).visibility === "hidden" || toggle.closest('[hidden],[aria-hidden="true"],a[href],[role="dialog"],[role="menu"],[data-dsh-chat-settings-dialog],.ds-modal-content,.ds-dropdown-menu')) continue;
15580
+ return { row: toggle.parentElement, toggle };
15581
+ }
15582
+ return null;
15583
+ };
15542
15584
  if (!sidebar || !newChat) {
15585
+ const compact = !isOriginalSnapshot && command.type === "snapshot" ? compactNavigation() : null;
15586
+ if (compact && !doc.documentElement.hasAttribute(expandingMarker)) {
15587
+ const started = String(Date.now());
15588
+ compact.toggle.setAttribute(compactToggleMarker, started);
15589
+ doc.documentElement.setAttribute(expandingMarker, started);
15590
+ doc.documentElement.setAttribute(missingSidebarMarker, started);
15591
+ compact.toggle.click();
15592
+ return empty("loading");
15593
+ }
15594
+ const expandedAt = Number(doc.documentElement.getAttribute(expandingMarker));
15595
+ if (!isOriginalSnapshot && Number.isFinite(expandedAt) && expandedAt > 0 && Date.now() - expandedAt < 5e3) return empty("loading");
15543
15596
  if (recovering) return fallbackNavigation();
15544
15597
  if (isOriginalSnapshot || structureExpired()) return fallback();
15545
- if (!doc.documentElement.hasAttribute(presentedMarker) && !doc.documentElement.hasAttribute("data-dsh-chat-expanding")) {
15546
- const compact = [...doc.querySelectorAll("div,header")].find((el) => {
15547
- const r = el.getBoundingClientRect();
15548
- const buttons = el.querySelectorAll('button,[role="button"]');
15549
- return r.top >= -1 && r.top < 80 && r.left >= -1 && r.left < 180 && r.width > 30 && r.width < 400 && r.height > 16 && r.height < 80 && buttons.length >= 2 && buttons.length <= 3 && el.querySelector("svg,img") && !el.textContent?.trim();
15550
- });
15551
- const mobileToggle = [...doc.querySelectorAll('button,[role="button"]')].find((el) => {
15552
- const r = el.getBoundingClientRect();
15553
- return r.left >= 0 && r.left < 80 && r.top >= 0 && r.top < 80 && r.width >= 20 && r.width <= 72 && r.height >= 20 && r.height <= 72 && !el.textContent?.trim() && !!el.querySelector("svg") && !el.closest("[data-dsh-chat-settings-dialog]");
15554
- });
15555
- const expandable = compact ?? mobileToggle;
15556
- if (expandable) {
15557
- doc.documentElement.setAttribute("data-dsh-chat-expanding", String(Date.now()));
15558
- (compact?.querySelector('button,[role="button"]') ?? mobileToggle)?.click();
15559
- }
15560
- }
15561
15598
  return empty("loading");
15562
15599
  }
15563
15600
  let track = sidebar;
@@ -15581,6 +15618,8 @@ window.__ModuleLoader__.load({
15581
15618
  return empty("loading");
15582
15619
  }
15583
15620
  doc.documentElement.removeAttribute(missingSidebarMarker);
15621
+ doc.documentElement.removeAttribute(expandingMarker);
15622
+ doc.querySelectorAll(`[${compactToggleMarker}]`).forEach((button) => button.removeAttribute(compactToggleMarker));
15584
15623
  if (recovering) {
15585
15624
  doc.documentElement.removeAttribute(fallbackMarker);
15586
15625
  doc.documentElement.removeAttribute(fallbackErrorMarker);
@@ -15705,7 +15744,7 @@ window.__ModuleLoader__.load({
15705
15744
  content.setAttribute("data-dsh-chat-content", "");
15706
15745
  for (const candidate of content.querySelectorAll("div,header")) {
15707
15746
  const r = candidate.getBoundingClientRect();
15708
- if (r.top >= -1 && r.top <= 72 && r.height > 0 && r.height <= 80 && r.width <= 400 && candidate.querySelectorAll('button,[role="button"]').length >= 2 && candidate.querySelectorAll('button,[role="button"]').length <= 3 && candidate.querySelector("svg,img") && !candidate.querySelector('textarea,[contenteditable="true"]') && !candidate.textContent?.trim()) candidate.setAttribute("data-dsh-chat-web-chrome", "");
15747
+ if (r.top >= -1 && r.top <= 72 && r.height > 0 && r.height <= 80 && r.width <= 400 && candidate.querySelectorAll(iconButtonSelector).length >= 2 && candidate.querySelectorAll(iconButtonSelector).length <= 3 && candidate.querySelector("svg,img") && !candidate.querySelector('textarea,[contenteditable="true"]') && !candidate.textContent?.trim()) candidate.setAttribute("data-dsh-chat-web-chrome", "");
15709
15748
  }
15710
15749
  }
15711
15750
  const styleText = `html:not([data-dsh-chat-settings-request]) [${marker}],[data-dsh-chat-web-chrome]{display:none!important}
@@ -15729,6 +15768,7 @@ window.__ModuleLoader__.load({
15729
15768
  return { status: ready ? "ready" : "loading", ...authenticated === void 0 ? {} : { authenticated }, conversations, selectedHref: safeHref(page.pathname), canCreate: newChat !== null, error: null, accountName, settings };
15730
15769
  }
15731
15770
  function websiteCommandScript(command) {
15771
+ if (command.type === "refresh") throw new Error("Website refresh must be handled by the guest owner");
15732
15772
  return `(() => { const adaptWebsiteSettings = ${adaptWebsiteSettings.toString()}; const adaptWebsiteHeader = ${adaptWebsiteHeader.toString()}; const dismissWebsiteEnvironmentNotice = ${dismissWebsiteEnvironmentNotice.toString()}; return (${adaptWebsiteNavigation.toString()})(document,location,${JSON.stringify(command)}); })()`;
15733
15773
  }
15734
15774
  function parseWebsiteNavigation(value) {
@@ -15854,6 +15894,30 @@ window.__ModuleLoader__.load({
15854
15894
  // src/web-surface.tsx
15855
15895
  var import_jsx_runtime2 = require("react/jsx-runtime");
15856
15896
  var WEBSITE_URL = "https://chat.deepseek.com/";
15897
+ function websiteRefreshReadiness(doc, origin) {
15898
+ if (origin !== "https://chat.deepseek.com") return "unavailable";
15899
+ const visible = (node) => {
15900
+ const rect = node.getBoundingClientRect();
15901
+ const style = doc.defaultView?.getComputedStyle(node);
15902
+ return rect.width > 0 && rect.height > 0 && style?.display !== "none" && style?.visibility !== "hidden";
15903
+ };
15904
+ for (const field of doc.querySelectorAll('textarea,input[type="text"],input:not([type]),[contenteditable="true"]')) {
15905
+ if (!visible(field)) continue;
15906
+ if (field instanceof HTMLTextAreaElement || field instanceof HTMLInputElement) {
15907
+ if (field.value.trim().length > 0) return "draft";
15908
+ if (field.disabled || field.readOnly) return "busy";
15909
+ } else if ((field.textContent ?? "").trim().length > 0) return "draft";
15910
+ }
15911
+ for (const field of doc.querySelectorAll('input[type="file"]')) {
15912
+ if (field.files?.length) return "draft";
15913
+ }
15914
+ const stopping = /^(停止|停止生成|停止回答|停止响应|取消生成|Stop|Stop generating|Stop generation|Stop response|Cancel generation)$/i;
15915
+ for (const button of doc.querySelectorAll('button,[role="button"]')) {
15916
+ if (visible(button) && [button.getAttribute("aria-label"), button.getAttribute("title"), button.textContent?.trim()].some((label) => label && stopping.test(label))) return "busy";
15917
+ }
15918
+ if ([...doc.querySelectorAll('[aria-busy="true"]')].some(visible)) return "busy";
15919
+ return "ready";
15920
+ }
15857
15921
  function headerInset(viewport) {
15858
15922
  return viewport?.left === 0 ? Math.max(24, Math.ceil(document.querySelector(".dsh-chat-leading")?.getBoundingClientRect().right ?? 144) + 16) : 24;
15859
15923
  }
@@ -15870,12 +15934,12 @@ window.__ModuleLoader__.load({
15870
15934
  const retryGuestSession = (0, import_react2.useRef)(null);
15871
15935
  const lastReload = (0, import_react2.useRef)(state.websiteReloadRevision);
15872
15936
  (0, import_react2.useEffect)(() => {
15873
- if ((state.mode === "chat" && state.modeEnabled || state.settingsViewport) && state.authorizationStatus === "authorized") {
15937
+ if ((state.mode === "chat" && state.modeEnabled || state.settingsOpen) && state.authorizationStatus === "authorized") {
15874
15938
  setRequestedGeneration(state.authorizationGeneration);
15875
15939
  if (previousMode.current === "harness" && needsRecovery.current) setRecoveryRevision((value) => value + 1);
15876
15940
  }
15877
15941
  previousMode.current = state.mode;
15878
- }, [state.mode, state.modeEnabled, state.authorizationStatus, state.authorizationGeneration, state.settingsViewport]);
15942
+ }, [state.mode, state.modeEnabled, state.authorizationStatus, state.authorizationGeneration, state.settingsOpen]);
15879
15943
  (0, import_react2.useEffect)(() => {
15880
15944
  let stopped = false;
15881
15945
  let held;
@@ -15935,10 +15999,21 @@ window.__ModuleLoader__.load({
15935
15999
  let websiteHadSession = false;
15936
16000
  let savedSessionFingerprint = null;
15937
16001
  let pendingSessionCapture = null;
16002
+ let navigationRefresh = null;
16003
+ let navigationRefreshTimer;
16004
+ const refreshTimeoutMessage = "\u5B98\u7F51\u52A0\u8F7D\u8D85\u65F6\uFF0C\u8BF7\u70B9\u51FB\u300C\u91CD\u8BD5\u7F51\u9875\u300D\u3002";
15938
16005
  let fastPollingUntil = Date.now() + 8e3;
15939
16006
  let lastPolled = 0;
15940
16007
  let lastNavigationStatus = null;
16008
+ const finishNavigationRefresh = (error51, request = navigationRefresh) => {
16009
+ if (!request || navigationRefresh !== request) return;
16010
+ navigationRefresh = null;
16011
+ clearTimeout(navigationRefreshTimer);
16012
+ navigationRefreshTimer = void 0;
16013
+ bridge.reportWebsiteNavigationRefresh(generation, { requestId: request.requestId, refreshing: false, error: error51 });
16014
+ };
15941
16015
  retryGuestSession.current = () => {
16016
+ finishNavigationRefresh(null);
15942
16017
  restorationAttempted = false;
15943
16018
  restoredFromVault = false;
15944
16019
  restoreDeadline = 0;
@@ -15947,6 +16022,7 @@ window.__ModuleLoader__.load({
15947
16022
  if (loading) lastError = null;
15948
16023
  else if (error51 !== null) lastError = error51;
15949
16024
  if (!events.signal.aborted) bridge.reportWebsiteState(generation, { loading, error: lastError });
16025
+ if (error51) finishNavigationRefresh("\u5B98\u7F51\u5BF9\u8BDD\u5217\u8868\u5237\u65B0\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002");
15950
16026
  };
15951
16027
  const resetDocumentPresentation = () => {
15952
16028
  documentRevision++;
@@ -16052,6 +16128,14 @@ window.__ModuleLoader__.load({
16052
16128
  if (result.status !== "loading") documentPresented = true;
16053
16129
  bridge.reportWebsiteNavigation(generation, result);
16054
16130
  if (result.status !== "loading" || !documentPresented) setPresentationReady(result.status !== "loading");
16131
+ if (result.status === "ready" && result.authenticated === true && lastError === refreshTimeoutMessage) {
16132
+ lastError = null;
16133
+ report(false);
16134
+ }
16135
+ if (navigationRefresh && requestDocumentRevision > navigationRefresh.documentRevision) {
16136
+ if (result.status === "ready" && result.authenticated === true) finishNavigationRefresh(null);
16137
+ else if (result.status === "sign-in") finishNavigationRefresh("\u5B98\u7F51\u767B\u5F55\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u540E\u5237\u65B0\u5217\u8868\u3002");
16138
+ }
16055
16139
  }
16056
16140
  if (result.authenticated === true) {
16057
16141
  websiteHadSession = true;
@@ -16067,7 +16151,7 @@ window.__ModuleLoader__.load({
16067
16151
  if (currentProjection()) {
16068
16152
  documentPresented = true;
16069
16153
  bridge.reportWebsiteNavigation(generation, { status: "unsupported", conversations: [], selectedHref: null, canCreate: false, error: null });
16070
- setPresentationReady(!snapshot.settingsViewport);
16154
+ setPresentationReady(!snapshot.settingsOpen);
16071
16155
  if (currentProjection()) {
16072
16156
  try {
16073
16157
  await execute({ type: "restore" });
@@ -16091,7 +16175,45 @@ window.__ModuleLoader__.load({
16091
16175
  };
16092
16176
  const stopCommands = bridge.bindWebsiteNavigation(generation, (command) => {
16093
16177
  if (command.type !== "snapshot") fastPollingUntil = Date.now() + 8e3;
16094
- queued = queued.then(() => adapt(command)).then(() => adapt(snapshotCommand()));
16178
+ if (command.type === "refresh") {
16179
+ queued = queued.then(async () => {
16180
+ clearTimeout(navigationRefreshTimer);
16181
+ navigationRefreshTimer = void 0;
16182
+ const refreshRequest = { requestId: command.requestId, authenticationRevision: command.authenticationRevision, documentRevision };
16183
+ navigationRefresh = refreshRequest;
16184
+ const sameRequest = () => navigationRefresh === refreshRequest && active() && bridge.getSnapshot().websiteAuthenticationRevision === command.authenticationRevision;
16185
+ if (!sameRequest() || !approvedOrigin()) {
16186
+ finishNavigationRefresh("\u5B98\u7F51\u9875\u9762\u72B6\u6001\u5DF2\u53D8\u5316\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u5237\u65B0\u3002", refreshRequest);
16187
+ return;
16188
+ }
16189
+ try {
16190
+ const readiness = await executeScript(`(${websiteRefreshReadiness.toString()})(document,location.origin)`);
16191
+ if (!sameRequest() || documentRevision !== refreshRequest.documentRevision) {
16192
+ finishNavigationRefresh("\u5B98\u7F51\u9875\u9762\u72B6\u6001\u5DF2\u53D8\u5316\uFF0C\u8BF7\u7A0D\u540E\u5237\u65B0\u3002", refreshRequest);
16193
+ return;
16194
+ }
16195
+ if (readiness !== "ready") {
16196
+ finishNavigationRefresh(readiness === "draft" ? "\u8BF7\u5148\u53D1\u9001\u6216\u6E05\u7A7A\u672A\u53D1\u9001\u5185\u5BB9\uFF0C\u518D\u5237\u65B0\u5BF9\u8BDD\u5217\u8868\u3002" : readiness === "busy" ? "\u8BF7\u7B49\u5F53\u524D\u56DE\u590D\u6216\u7F51\u9875\u64CD\u4F5C\u5B8C\u6210\uFF0C\u518D\u5237\u65B0\u5BF9\u8BDD\u5217\u8868\u3002" : "\u5F53\u524D\u5B98\u7F51\u9875\u9762\u6682\u65F6\u65E0\u6CD5\u5237\u65B0\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002", refreshRequest);
16197
+ return;
16198
+ }
16199
+ navigationRefreshTimer = setTimeout(() => {
16200
+ if (navigationRefresh !== refreshRequest) return;
16201
+ if (!sameRequest()) {
16202
+ finishNavigationRefresh("\u5B98\u7F51\u767B\u5F55\u72B6\u6001\u5DF2\u53D8\u5316\uFF0C\u8BF7\u7A0D\u540E\u5237\u65B0\u3002", refreshRequest);
16203
+ return;
16204
+ }
16205
+ finishNavigationRefresh("\u5B98\u7F51\u5BF9\u8BDD\u5217\u8868\u5237\u65B0\u8D85\u65F6\uFF0C\u8BF7\u70B9\u51FB\u53F3\u4FA7\u300C\u91CD\u8BD5\u7F51\u9875\u300D\u3002", refreshRequest);
16206
+ report(false, refreshTimeoutMessage);
16207
+ }, 3e4);
16208
+ report(true);
16209
+ current.reload();
16210
+ } catch {
16211
+ if (!sameRequest()) return;
16212
+ report(false);
16213
+ finishNavigationRefresh("\u65E0\u6CD5\u5237\u65B0\u5B98\u7F51\u5BF9\u8BDD\u5217\u8868\uFF0C\u8BF7\u91CD\u8BD5\u3002", refreshRequest);
16214
+ }
16215
+ });
16216
+ } else queued = queued.then(() => adapt(command)).then(() => adapt(snapshotCommand()));
16095
16217
  return queued;
16096
16218
  });
16097
16219
  const timer = setInterval(() => {
@@ -16099,6 +16221,7 @@ window.__ModuleLoader__.load({
16099
16221
  }, 200);
16100
16222
  events.signal.addEventListener("abort", () => {
16101
16223
  clearInterval(timer);
16224
+ finishNavigationRefresh("\u7F51\u9875\u5DF2\u5173\u95ED\uFF0C\u5237\u65B0\u672A\u5B8C\u6210\u3002");
16102
16225
  stopCommands();
16103
16226
  }, { once: true });
16104
16227
  const navigate = (url2) => {
@@ -16189,14 +16312,14 @@ window.__ModuleLoader__.load({
16189
16312
  (0, import_react2.useEffect)(() => () => {
16190
16313
  guestEvents.current?.abort();
16191
16314
  }, []);
16192
- const inSettings = state.settingsViewport !== null;
16193
- const rect = inSettings && state.websiteNavigation.status !== "sign-in" ? { left: 0, top: 0, width: globalThis.innerWidth, height: globalThis.innerHeight } : state.settingsViewport ?? state.viewport;
16194
- const visible = (inSettings && state.websiteNavigation.status === "sign-in" && presentationReady || !inSettings && state.mode === "chat" && state.modeEnabled) && rect !== null;
16315
+ const inSettings = state.settingsOpen;
16316
+ const rect = inSettings ? state.viewport ?? { left: 0, top: 0, width: globalThis.innerWidth, height: globalThis.innerHeight } : state.viewport;
16317
+ const visible = !inSettings && state.mode === "chat" && state.modeEnabled && rect !== null && rect.width > 0 && rect.height > 0;
16195
16318
  const activeReservation = reservation !== null && reservation.generation === state.authorizationGeneration && reservation.storageKey === state.accountStorageKey ? reservation : null;
16196
16319
  const clearance = 0;
16197
16320
  const logoutError = state.websiteAuthenticationStatus === "error" && /退出/.test(state.websiteSessionError ?? "");
16198
16321
  return (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { id: "dsh-chat-website-surface", className: "dsh-chat-web-surface", "aria-label": "DeepSeek \u5B98\u7F51\u7F51\u9875", "aria-hidden": !visible, style: {
16199
- zIndex: inSettings ? visible ? 1001 : 0 : 14,
16322
+ zIndex: inSettings ? 0 : 14,
16200
16323
  visibility: visible ? "visible" : "hidden",
16201
16324
  display: (inSettings || state.mode === "chat") && rect ? "flex" : "none",
16202
16325
  opacity: visible ? 1 : 0,
@@ -16205,7 +16328,7 @@ window.__ModuleLoader__.load({
16205
16328
  top: (rect?.top ?? 0) + clearance,
16206
16329
  width: rect?.width ?? 0,
16207
16330
  height: Math.max(0, (rect?.height ?? 0) - clearance),
16208
- borderRadius: inSettings ? 12 : 0,
16331
+ borderRadius: 0,
16209
16332
  overflow: "hidden"
16210
16333
  }, children: [
16211
16334
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DshChatStyles, {}),
@@ -16228,7 +16351,7 @@ window.__ModuleLoader__.load({
16228
16351
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: nativeBrowser === void 0 ? "\u5F53\u524D\u73AF\u5883\u65E0\u6CD5\u5185\u5D4C\u7F51\u9875" : state.webError !== null ? "\u7F51\u9875\u6682\u65F6\u65E0\u6CD5\u4F7F\u7528" : logoutError ? "\u9000\u51FA\u767B\u5F55\u672A\u5B8C\u6210" : state.websiteAuthenticationStatus === "signed-out" ? "\u767B\u5F55 DeepSeek Chat" : state.websiteAuthenticationStatus === "signing-out" ? "\u6B63\u5728\u9000\u51FA\u767B\u5F55" : "\u6B63\u5728\u6253\u5F00 DeepSeek \u5B98\u7F51" }),
16229
16352
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: state.webError || (logoutError ? state.websiteSessionError : nativeBrowser === void 0 ? "\u9700\u8981\u63D0\u4F9B\u5B98\u65B9\u6D4F\u89C8\u5668\u80FD\u529B\u7684 DSH \u684C\u9762\u7248\u3002" : state.websiteAuthenticationStatus === "signing-out" ? "\u6B63\u5728\u6E05\u9664\u767B\u5F55\u8BB0\u5FC6\u5E76\u9000\u51FA\u5B98\u7F51\u3002" : "CHAT \u4F7F\u7528\u72EC\u7ACB\u7684\u5B98\u7F51\u767B\u5F55\uFF0C\u767B\u5F55\u540E\u81EA\u52A8\u540C\u6B65\u8D26\u53F7\u548C\u5B98\u7F51\u5BF9\u8BDD\u3002") }),
16230
16353
  logoutError && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "dsh-chat-text-button", onClick: () => bridge.logoutWebsite(), children: "\u91CD\u8BD5\u9000\u51FA\u767B\u5F55" }),
16231
- state.websiteAuthenticationStatus === "signed-out" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "dsh-chat-text-button", onClick: () => bridge.beginWebsiteSignIn(), children: "\u767B\u5F55 DeepSeek" }),
16354
+ state.websiteAuthenticationStatus === "signed-out" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "dsh-chat-primary-button", onClick: () => bridge.beginWebsiteSignIn(), children: "\u767B\u5F55 DeepSeek" }),
16232
16355
  state.authorizationStatus !== "authorized" && nativeBrowser !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "dsh-chat-text-button", onClick: () => bridge.refreshAuthorization(), children: "\u91CD\u8BD5\u8FDE\u63A5" }),
16233
16356
  state.webError !== null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "dsh-chat-text-button", onClick: () => bridge.reloadWebsite(), disabled: nativeBrowser === void 0 || !state.modeEnabled, children: "\u91CD\u8BD5\u7F51\u9875" })
16234
16357
  ] })
@@ -16343,10 +16466,13 @@ window.__ModuleLoader__.load({
16343
16466
  let refreshing = null;
16344
16467
  let authorizationGeneration = 0;
16345
16468
  let websiteReloadRevision = 0;
16469
+ let websiteNavigationRefreshing = false;
16470
+ let websiteNavigationRefreshError = null;
16471
+ let websiteNavigationRefreshRequest = 0;
16346
16472
  let webLoading = false;
16347
16473
  let webError = null;
16348
16474
  let connectionError = null;
16349
- let settingsViewport = null;
16475
+ let settingsOpen = false;
16350
16476
  let settingsReadRequested = false;
16351
16477
  let preferenceError = null;
16352
16478
  let preferences = null;
@@ -16395,6 +16521,7 @@ window.__ModuleLoader__.load({
16395
16521
  },
16396
16522
  cancelAccount: () => {
16397
16523
  authorizationGeneration++;
16524
+ resetNavigationRefresh();
16398
16525
  webLoading = false;
16399
16526
  webError = null;
16400
16527
  websiteNavigation = emptyNavigation();
@@ -16421,7 +16548,7 @@ window.__ModuleLoader__.load({
16421
16548
  desktopAvailable: Boolean(nativeBrowser),
16422
16549
  webLoading,
16423
16550
  webError,
16424
- settingsViewport,
16551
+ settingsOpen,
16425
16552
  preferenceError,
16426
16553
  viewport,
16427
16554
  brandAnchor,
@@ -16433,16 +16560,24 @@ window.__ModuleLoader__.load({
16433
16560
  accountStorageKey: state.authorization.status === "authorized" && state.authorization.accountId ? `dsh-deepseek-chat:website:${state.authorization.accountId}` : null,
16434
16561
  authorizationGeneration,
16435
16562
  websiteReloadRevision,
16563
+ websiteNavigationRefreshing,
16564
+ websiteNavigationRefreshError,
16436
16565
  websiteNavigation,
16437
16566
  showWebsiteNavigation
16438
16567
  };
16439
16568
  sidebar?.sync();
16440
16569
  for (const listener of listeners) listener();
16441
16570
  }
16571
+ function resetNavigationRefresh() {
16572
+ websiteNavigationRefreshRequest++;
16573
+ websiteNavigationRefreshing = false;
16574
+ websiteNavigationRefreshError = null;
16575
+ }
16442
16576
  function acceptAuthorization(value) {
16443
16577
  const next = authorizationSchema.parse(value);
16444
16578
  const previous = mode.getSnapshot().authorization;
16445
16579
  if (next.accountId !== previous.accountId || next.epoch !== previous.epoch) {
16580
+ resetNavigationRefresh();
16446
16581
  authorizationGeneration++;
16447
16582
  websiteNavigation = emptyNavigation();
16448
16583
  navigationHandler = null;
@@ -16675,7 +16810,8 @@ window.__ModuleLoader__.load({
16675
16810
  },
16676
16811
  beginWebsiteSignIn: () => {
16677
16812
  if (disposed || !nativeBrowser || logoutRequested) return;
16678
- if (mode.getSnapshot().mode !== "chat" && !settingsViewport) mode.select("chat");
16813
+ resetNavigationRefresh();
16814
+ if (mode.getSnapshot().mode !== "chat") mode.select("chat");
16679
16815
  restorationBlocked = true;
16680
16816
  if (!websiteSignInRequested) websiteAuthenticationRevision++;
16681
16817
  websiteSignInRequested = true;
@@ -16713,14 +16849,42 @@ window.__ModuleLoader__.load({
16713
16849
  },
16714
16850
  reportWebsiteState: (generation, state) => {
16715
16851
  if (disposed || generation !== authorizationGeneration) return;
16852
+ const recovered = webError !== null && !state.loading && state.error === null;
16716
16853
  webLoading = state.loading;
16717
16854
  webError = state.error;
16718
16855
  publish();
16856
+ if (recovered && !websiteNavigationRefreshing) {
16857
+ websiteNavigationRefreshError = null;
16858
+ publish();
16859
+ }
16719
16860
  },
16720
16861
  reloadWebsite: () => {
16862
+ resetNavigationRefresh();
16721
16863
  websiteReloadRevision++;
16722
16864
  publish();
16723
16865
  },
16866
+ refreshWebsiteNavigation: () => {
16867
+ if (disposed || !mode.canEnter() || !nativeBrowser || websiteNavigationRefreshing || webLoading || websiteNavigation.authenticated !== true || logoutRequested || logoutFailed || ["signing-in", "signing-out"].includes(websiteAuthenticationStatus) || restoringPreferences || websiteNavigation.settings?.pending) return;
16868
+ if (!navigationHandler) {
16869
+ websiteNavigationRefreshError = "\u5B98\u7F51\u9875\u9762\u5C1A\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u5237\u65B0\u3002";
16870
+ publish();
16871
+ return;
16872
+ }
16873
+ const requestId = ++websiteNavigationRefreshRequest;
16874
+ const generation = authorizationGeneration;
16875
+ websiteNavigationRefreshing = true;
16876
+ websiteNavigationRefreshError = null;
16877
+ publish();
16878
+ void navigationHandler({ type: "refresh", requestId, authenticationRevision: websiteAuthenticationRevision }).catch(() => {
16879
+ bridge.reportWebsiteNavigationRefresh(generation, { requestId, refreshing: false, error: "\u65E0\u6CD5\u5237\u65B0\u5B98\u7F51\u5BF9\u8BDD\u5217\u8868\uFF0C\u8BF7\u91CD\u8BD5\u3002" });
16880
+ });
16881
+ },
16882
+ reportWebsiteNavigationRefresh: (generation, state) => {
16883
+ if (disposed || generation !== authorizationGeneration || state.requestId !== websiteNavigationRefreshRequest || !websiteNavigationRefreshing) return;
16884
+ websiteNavigationRefreshing = state.refreshing;
16885
+ websiteNavigationRefreshError = state.error;
16886
+ publish();
16887
+ },
16724
16888
  reportWebsiteNavigation: (generation, value, newDocument = false) => {
16725
16889
  if (disposed || generation !== authorizationGeneration) return;
16726
16890
  let next;
@@ -16805,6 +16969,7 @@ window.__ModuleLoader__.load({
16805
16969
  commandWebsite: (command) => {
16806
16970
  if (disposed || !mode.canEnter() || !navigationHandler) return;
16807
16971
  if ((logoutRequested || logoutFailed) && command.type !== "logout" && command.type !== "snapshot") return;
16972
+ if (websiteNavigationRefreshing && !["logout", "snapshot", "restore", "settings-close"].includes(command.type)) return;
16808
16973
  if (websiteNavigation.status !== "ready" && command.type !== "logout" && command.type !== "snapshot" && command.type !== "restore") return;
16809
16974
  if (command.type === "settings-read" && (restoringPreferences || websiteNavigation.settings?.pending)) return;
16810
16975
  if (command.type === "open" && !websiteNavigation.conversations.some((item) => item.href === command.href)) return;
@@ -16818,11 +16983,11 @@ window.__ModuleLoader__.load({
16818
16983
  showWebsiteNavigation = !showWebsiteNavigation;
16819
16984
  publish();
16820
16985
  },
16821
- updateSettingsViewport: (next) => {
16822
- if (settingsViewport?.left === next?.left && settingsViewport?.top === next?.top && settingsViewport?.width === next?.width && settingsViewport?.height === next?.height) return;
16823
- const opening = !settingsViewport && !!next;
16986
+ setSettingsOpen: (next) => {
16987
+ if (settingsOpen === next) return;
16988
+ const opening = !settingsOpen && next;
16824
16989
  if (opening) settingsReadRequested = false;
16825
- settingsViewport = next;
16990
+ settingsOpen = next;
16826
16991
  publish();
16827
16992
  if (!next && navigationHandler) void navigationHandler({ type: "settings-close" });
16828
16993
  else readSettingsWhenReady();
@@ -16830,6 +16995,7 @@ window.__ModuleLoader__.load({
16830
16995
  logoutWebsite: () => {
16831
16996
  if (logoutRequested || !navigationHandler || !websiteHadSession && !logoutFailed) return;
16832
16997
  if (!logoutFailed && websiteNavigation.status !== "ready") return;
16998
+ resetNavigationRefresh();
16833
16999
  const generation = authorizationGeneration;
16834
17000
  const handler = navigationHandler;
16835
17001
  clearTimeout(logoutTimer);
@@ -16959,7 +17125,7 @@ window.__ModuleLoader__.load({
16959
17125
  publish();
16960
17126
  }
16961
17127
  function readSettingsWhenReady() {
16962
- if (!settingsViewport || !navigationHandler || websiteNavigation.status !== "ready" || websiteNavigation.authenticated !== true || settingsReadRequested || restoringPreferences || logoutRequested || logoutFailed || websiteNavigation.settings?.pending) return;
17128
+ if (!settingsOpen || !navigationHandler || websiteNavigation.status !== "ready" || websiteNavigation.authenticated !== true || settingsReadRequested || restoringPreferences || logoutRequested || logoutFailed || websiteNavigation.settings?.pending) return;
16963
17129
  settingsReadRequested = true;
16964
17130
  if (websiteNavigation.settings?.language && !websiteNavigation.settings.error) return;
16965
17131
  void navigationHandler({ type: "settings-read" });
package/lib/types/ui.d.ts CHANGED
@@ -22,7 +22,7 @@ export interface DshChatViewState {
22
22
  readonly accountStorageKey: string | null;
23
23
  readonly authorizationGeneration: number;
24
24
  readonly websiteReloadRevision: number;
25
- readonly settingsViewport: DshChatViewportRect | null;
25
+ readonly settingsOpen: boolean;
26
26
  readonly preferenceError: string | null;
27
27
  readonly websiteAuthenticationStatus: 'loading' | 'signed-out' | 'signing-in' | 'signed-in' | 'signing-out' | 'error';
28
28
  readonly websiteAuthenticationRevision: number;
@@ -32,6 +32,8 @@ export interface DshChatViewState {
32
32
  readonly brandAnchor: DshChatViewportRect | null;
33
33
  readonly sidebarAdapted: boolean | null;
34
34
  readonly websiteNavigation: WebsiteNavigation;
35
+ readonly websiteNavigationRefreshing: boolean;
36
+ readonly websiteNavigationRefreshError: string | null;
35
37
  readonly showWebsiteNavigation: boolean;
36
38
  }
37
39
  export interface DshChatUIBridge {
@@ -47,6 +49,12 @@ export interface DshChatUIBridge {
47
49
  updateBrandAnchor(rect: DshChatViewportRect | null): void;
48
50
  attachSidebar(element: HTMLElement): void;
49
51
  reloadWebsite(): void;
52
+ refreshWebsiteNavigation(): void;
53
+ reportWebsiteNavigationRefresh(generation: number, state: {
54
+ readonly requestId: number;
55
+ readonly refreshing: boolean;
56
+ readonly error: string | null;
57
+ }): void;
50
58
  reportWebsiteState(generation: number, state: {
51
59
  readonly loading: boolean;
52
60
  readonly error: string | null;
@@ -55,7 +63,7 @@ export interface DshChatUIBridge {
55
63
  bindWebsiteNavigation(generation: number, handler: (command: WebsiteCommand) => Promise<void>): () => void;
56
64
  commandWebsite(command: WebsiteCommand): void;
57
65
  toggleWebsiteNavigation(): void;
58
- updateSettingsViewport(rect: DshChatViewportRect | null): void;
66
+ setSettingsOpen(open: boolean): void;
59
67
  logoutWebsite(): void;
60
68
  loadWebsiteSession(generation: number): Promise<WebsiteSession | null>;
61
69
  saveWebsiteSession(generation: number, session: WebsiteSession): Promise<boolean>;
@@ -81,4 +89,4 @@ export declare function DshChatChatNavigation({ bridge, wide, expandSidebar }: P
81
89
  export declare function DshChatChatPanel({ bridge }: PropsRuntime<'main'> & DshChatBridgeProps): import("react/jsx-runtime").JSX.Element;
82
90
  /** Same public primitive icons, geometry and tooltip behavior as native rc.2 chrome. */
83
91
  export declare function DshChatLeadingControls({ bridge }: PropsRuntime<'shell.leading'> & DshChatBridgeProps): import("react/jsx-runtime").JSX.Element;
84
- export declare function DshChatChatSettings({ bridge }: PropsRuntime<'settings.section'> & DshChatBridgeProps): import("react/jsx-runtime").JSX.Element;
92
+ export declare function DshChatChatSettings({ bridge, close }: PropsRuntime<'settings.section'> & DshChatBridgeProps): import("react/jsx-runtime").JSX.Element;
@@ -41,6 +41,12 @@ export type WebsiteCommand = {
41
41
  readonly language: string;
42
42
  } | {
43
43
  readonly type: 'logout';
44
+ }
45
+ /** Handled by the guest owner; never a DOM-only snapshot. */
46
+ | {
47
+ readonly type: 'refresh';
48
+ readonly requestId: number;
49
+ readonly authenticationRevision: number;
44
50
  } | {
45
51
  readonly type: 'new';
46
52
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-deepseek-chat",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "CHAT / HARNESS mode switcher for DeepSeek Harness",
5
5
  "repository": {
6
6
  "type": "git",