dsh-deepseek-chat 0.1.15 → 0.1.17

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.15**(本地修复版,尚未发布 npm) · 适配 **DSH 0.2.0-rc.2 桌面版** · 默认语言为简体中文。
7
+ 当前本地候选版本 **0.1.17**(npm 公开版本仍为 0.1.16) · 适配 **DSH 0.2.0-rc.2 桌面版** · 默认语言为简体中文。
8
8
 
9
9
  ## 功能预览
10
10
 
@@ -60,16 +60,16 @@ dsh plugin --profile desktop add dsh-deepseek-chat
60
60
  已有安装可能继续使用之前锁定的版本。升级到当前版本时,在 DSH 的插件安装输入框中明确输入:
61
61
 
62
62
  ```text
63
- dsh-deepseek-chat@0.1.12
63
+ dsh-deepseek-chat@0.1.16
64
64
  ```
65
65
 
66
66
  使用命令行指定要升级的版本:
67
67
 
68
68
  ```bash
69
- dsh plugin --profile desktop add dsh-deepseek-chat@0.1.12
69
+ dsh plugin --profile desktop add dsh-deepseek-chat@0.1.16
70
70
  ```
71
71
 
72
- **完整退出并重新打开 DSH**,在插件管理页检查已安装版本为 **0.1.12**。进入 CHAT 后,“对话”标题右侧应显示刷新图标,未登录时登录按钮应有蓝色背景。
72
+ **完整退出并重新打开 DSH**,在插件管理页检查已安装版本为 **0.1.16**。进入 CHAT 后,“对话”标题右侧应显示刷新图标,未登录时登录按钮应有蓝色背景。
73
73
 
74
74
  使用其他 profile 时替换 `desktop`。通过 DSH 官方插件管理器或 CLI 更新,让依赖记录和锁文件一起更新;直接覆盖安装目录中的文件不能保证下次启动仍使用新版。
75
75
 
@@ -96,7 +96,7 @@ dsh plugin --profile desktop add https://github.com/xingxingbk-git/dsh-deepseek-
96
96
  将构建生成的 `.tgz` 文件交给 DSH 官方插件管理器安装,或使用 CLI:
97
97
 
98
98
  ```bash
99
- dsh plugin --profile desktop add /absolute/path/dsh-deepseek-chat-0.1.15.tgz
99
+ dsh plugin --profile desktop add /absolute/path/dsh-deepseek-chat-0.1.17.tgz
100
100
  ```
101
101
 
102
102
  将路径替换成你的实际安装包;使用其他 profile 时替换 `desktop`。**安装或更新后,完整退出并重新打开 DSH**,让新插件生效。
@@ -145,7 +145,7 @@ pnpm install --frozen-lockfile
145
145
  pnpm package:plugin
146
146
  ```
147
147
 
148
- 生成 `artifacts/dsh-deepseek-chat-0.1.15.tgz`,包含 Host、Client、类型声明、图标和 bundle patch。插件管理列表的图标位于 `assets/icon.svg`,替换后重新打包安装即可;SVG 须自包含且不超过 256 KiB。
148
+ 生成 `artifacts/dsh-deepseek-chat-0.1.17.tgz`,包含 Host、Client、类型声明、图标和 bundle patch。插件管理列表的图标位于 `assets/icon.svg`,替换后重新打包安装即可;SVG 须自包含且不超过 256 KiB。
149
149
 
150
150
  修改源码后执行 `pnpm release:prepare`,并将源码与整个 `lib/` 一起提交。`pnpm check:distribution` 会检查编译产物与源码、版本及安装入口是否一致;旧产物或缺失文件会使检查失败。安装用户不需要执行这些开发命令。
151
151
 
package/assets/icon.svg CHANGED
@@ -1,8 +1,8 @@
1
1
  <svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M196 112.949C204.346 112.909 211.523 115.412 217.72 121.131C224.025 127.008 227.708 135.172 227.934 143.789C228.062 148.136 227.922 152.698 227.954 157.112C228.033 168.358 228.612 176.813 221.923 186.555C219.563 189.995 214.666 194.105 213.325 196.364C212.086 198.446 214.628 212.401 211.632 214.797C210.195 215.946 208.882 215.876 207.358 215.231C205.167 214.305 201.312 211.577 199.45 210.261C184.872 199.957 187.562 201.557 170.79 201.704C150.891 201.771 133.595 203.783 124.865 181.54C130.579 181.364 136.623 181.639 142.302 181.214C154.909 180.269 168.02 173.839 177.111 165.113C187.514 155.246 194.081 142.01 195.646 127.762C196.083 123.491 195.901 117.449 196 112.949Z" fill="#5C89FE"/>
3
- <path d="M119.624 42.1215C139.443 42.1285 156.161 39.8326 171.777 54.8926C180.94 63.7299 186.207 75.8529 186.412 88.5821C186.421 89.8159 186.415 91.0498 186.396 92.2835L186.412 112.744C186.412 117.807 186.572 123.037 185.946 128.065C183.199 150.097 164.558 168.773 142.49 171.44C137.328 172.063 131.768 171.891 126.574 171.897L104.296 171.862C100.057 171.852 93.9562 171.664 89.9286 172.146C86.3675 172.571 78.5088 179.767 75.6108 180.78C70.19 185.204 62.9939 189.308 57.1403 193.211C54.8102 194.766 50.1211 194.45 49.5138 191.288C47.8324 182.533 50.2091 172.632 48.6233 163.854C48.309 162.114 43.3992 158.741 42.1939 157.268C27.0551 141.228 27.631 124.986 28.2328 104.644C28.1682 101.869 28.0824 98.9897 28.1431 96.2208C28.3572 81.3928 34.5244 67.2732 45.2571 57.0398C57.1849 45.6739 71.0588 41.8091 87.1696 42.2096C97.9871 42.1026 108.805 42.0729 119.624 42.1215ZM70.5569 116.331C65.3711 116.331 61.1673 120.535 61.1673 125.721C61.1674 130.906 65.3712 135.11 70.5569 135.11H115.418C120.604 135.11 124.808 130.906 124.808 125.721C124.808 120.535 120.604 116.331 115.418 116.331H70.5569ZM70.5569 81.9026C65.3711 81.9026 61.1673 86.1065 61.1673 91.2922C61.1674 96.4778 65.3712 100.682 70.5569 100.682H145.674C150.859 100.682 155.063 96.4778 155.063 91.2922C155.063 86.1065 150.86 81.9026 145.674 81.9026H70.5569Z" fill-rule="evenodd" clip-rule="evenodd" fill="url(#paint0_linear_29_365)"/>
2
+ <path d="M189.2 114.539C196.712 114.503 203.171 116.756 208.748 121.902C214.422 127.192 217.737 134.539 217.941 142.295C218.056 146.208 217.929 150.313 217.958 154.285C218.03 164.407 218.55 172.016 212.531 180.784C210.406 183.88 206 187.58 204.792 189.612C203.677 191.486 205.965 204.046 203.269 206.202C201.975 207.236 200.794 207.173 199.422 206.593C197.45 205.759 193.981 203.304 192.305 202.12C179.185 192.846 181.605 194.286 166.511 194.418C148.601 194.479 133.035 196.29 125.179 176.271C130.321 176.113 135.76 176.36 140.871 175.977C152.218 175.127 164.018 169.34 172.199 161.486C181.562 152.607 187.472 140.694 188.881 127.87C189.275 124.027 189.111 118.589 189.2 114.539Z" fill="#5C89FE"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M120.461 50.794C138.299 50.8004 153.345 48.7341 167.399 62.2881C175.646 70.2416 180.387 81.1523 180.57 92.6086C180.579 93.719 180.574 94.8295 180.556 95.9399L180.57 114.354C180.57 118.911 180.714 123.618 180.151 128.143C177.679 147.972 160.902 164.781 141.041 167.181C136.396 167.741 131.391 167.586 126.717 167.592L106.666 167.561C102.851 167.552 97.3606 167.382 93.7357 167.816C90.5308 168.199 83.4579 174.675 80.8497 175.587C75.971 179.568 69.4945 183.262 64.2263 186.774C62.1292 188.174 57.9089 187.89 57.3624 185.044C55.8492 177.165 57.9882 168.253 56.561 160.354C56.2781 158.787 51.8593 155.751 50.7745 154.426C37.1496 139.99 37.6679 125.372 38.2095 107.064C38.1514 104.566 38.0742 101.975 38.1288 99.4834C38.3214 86.1382 43.872 73.4306 53.5313 64.2205C64.2664 53.9912 76.7529 50.5129 91.2526 50.8733C100.988 50.777 110.725 50.7503 120.461 50.794ZM76.3012 117.583C71.634 117.583 67.8505 121.366 67.8505 126.033C67.8507 130.701 71.6341 134.484 76.3012 134.484H116.677C121.344 134.484 125.127 130.7 125.127 126.033C125.127 121.366 121.344 117.583 116.677 117.583H76.3012ZM76.3012 86.597C71.634 86.597 67.8505 90.3805 67.8505 95.0477C67.8507 99.7147 71.6341 103.498 76.3012 103.498H143.906C148.574 103.498 152.357 99.7147 152.357 95.0477C152.357 90.3805 148.574 86.597 143.906 86.597H76.3012Z" fill="url(#paint0_linear_377_2)"/>
4
4
  <defs>
5
- <linearGradient id="paint0_linear_29_365" x1="37.1997" y1="42.4018" x2="163.778" y2="194.469" gradientUnits="userSpaceOnUse">
5
+ <linearGradient id="paint0_linear_377_2" x1="46.2797" y1="51.0463" x2="160.201" y2="187.907" gradientUnits="userSpaceOnUse">
6
6
  <stop stop-color="#28E9EA"/>
7
7
  <stop offset="0.5" stop-color="#329FF6"/>
8
8
  <stop offset="0.8" stop-color="#4D7AF7"/>
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "format": 1,
3
3
  "name": "dsh-deepseek-chat",
4
- "version": "0.1.15",
4
+ "version": "0.1.17",
5
5
  "inputs": {
6
- "assets/icon.svg": "ad1b0fda90c1c1f2a0b9208bc86f5fe8c21d505a1208576be4e3110b26b4f79c",
6
+ "assets/icon.svg": "8ea4f1d75f655c24e7f42fd5ed76763872d2c2c9d0661e14d64bcbc4dc5f84c8",
7
7
  "cordis.patch.yml": "05edb71cd276de1251ae67644ec68b54efc26258814956fa0e932d36da741bdc",
8
- "package.json": "acd432f5f0b5f8ab4651681fd7de7dfd4d55169994b8a95bd18fb477f7d59313",
8
+ "package.json": "e2b34523efa241f10feb9287abffc2c91ad8365072c3932b4faffebac111d6b7",
9
9
  "pnpm-lock.yaml": "c4f600b0d599b85f6181d295cd5f9f06f1eb0435eeeb2e7cf1a376b3c6a4ca15",
10
10
  "scripts/build.mjs": "715879e3c25382c35b06db2065b3b13815d1185aa4b9267b68a6257cacee30ec",
11
11
  "scripts/check-artifact.mjs": "6fec38fb74e41dfeacef7147280c69854087d0665747d7d65137cc98f9dc673b",
@@ -13,18 +13,18 @@
13
13
  "scripts/client-contract.mjs": "1e212575218fc985f4405e2eac98b33a969494ff6b2144b1204a6d66963ba894",
14
14
  "scripts/distribution-manifest.mjs": "e746c447b03b0e9a86efce7827bbd5d9184c6ccd1f1f0f1c9eb12abfe1b2f3b7",
15
15
  "src/authorization.ts": "5f0c1b69e43541ce606349047788df72e442e9cbb3267c8c0caf2c0f556a5589",
16
- "src/client.ts": "89daf45dd171db396208102d76d080e581ca9ef5c6bc9a893e55b139a990cdc8",
16
+ "src/client.ts": "4c4ce2b680d295a36d103c6f2aeb23d5347e9c30f5e5b45a53ff48dee3a88f67",
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
- "src/sidebar-adapter.ts": "edcc051bbcaabb2d09055b231f57253a50a6d9e75acf18adafbf262001b18a48",
22
- "src/styles.ts": "e14e7c882d6d3476da96d45dc837ac653247b17e35ae5042dea83eda4531723c",
23
- "src/ui.tsx": "f98ced07985556ae4d054fa13120ed329d06a8d4d4506f708fe7abca8e7a590c",
21
+ "src/sidebar-adapter.ts": "83c2ce69a160cfeb8e4af6498d2233c150e8c1decdf4805288d56a9829835ad4",
22
+ "src/styles.ts": "51a2e65e7244a47b540d25e0d8dbbc2fccdc51b4caf980419b054e7c60060889",
23
+ "src/ui.tsx": "5666fea9b9e75c110f7398b99d2ce9a9f75a72b0b9a228cc1efe02b8e52c5c21",
24
24
  "src/web-surface.tsx": "a13ec7ad7d151877d27e7cb79c80e6bf549cbd08f84a53eeadd56d4667419918",
25
- "src/website-conversation-actions.ts": "3aee35c114567514f71cca7495dad7ec251cc79ed866571e417323c564e3f59e",
25
+ "src/website-conversation-actions.ts": "558196cb6ad5c34b8cbffe1ebef4a77a8a0312cfc4bf275fa13c4d9aeaf02f0e",
26
26
  "src/website-header.ts": "ac4972a28a5f0968de4d5f98d54fbac853f901c7eda00c0849984a2e66f291f3",
27
- "src/website-navigation.ts": "80810fac9e0c13bf18b4cb4d0832001d6dfb83b3dc0b9eb136baefbf9f38877c",
27
+ "src/website-navigation.ts": "bc7bb07e8283a2bf3331d6f31496136dda5b072f8f05b695f438a8299bc26b94",
28
28
  "src/website-notice.ts": "65c781bec41e6c2e541d9512cc0051864d64fc3204b3ba5f2e005bdc955f39c9",
29
29
  "src/website-session-store.ts": "8ef6d49465e0034f12b763a666b4a90c8c9819fb8baea06dcaba340fd97d72f1",
30
30
  "src/website-session.ts": "f2434fafc40adb15b5f16fc8b6152bd8df7e85f5210330a1337502c9a08136d8",
@@ -32,7 +32,7 @@
32
32
  "tsconfig.json": "1ad0b3b39537564a180dc7f4084ceb3098b567f509320c77d71bc37aaf4f1879"
33
33
  },
34
34
  "artifacts": {
35
- "lib/client.js": "48d18e6367f314ae29dce2f93796d8ea4b02499be2d3856318bad8ab6d615618",
35
+ "lib/client.js": "33a434e4e6f8ac8639ce8d90679257b80d1e13c0ebd5f7befcbfaee6c9891d57",
36
36
  "lib/index.js": "e9c50cc544f24c60d086538ab1283ae0ed2811f23c9bb469916a2e89c3ffb38d",
37
37
  "lib/types/authorization.d.ts": "130649eed3635e75c3f50c13de93c52440a27f1b88136ab2297552570c013d49",
38
38
  "lib/types/client.d.ts": "a79702d5d86c75e81f1e954b3e9f4a562a6b3082d68d798d6a1b37bd41b908a7",
@@ -40,9 +40,9 @@
40
40
  "lib/types/index.d.ts": "8257403b97e892a879328654761e3ff8008bbcae0bfacce6e190ef9b5d94750e",
41
41
  "lib/types/protocol.d.ts": "11e77f35382fdc32f9fb0bec48641c43fc2f74064741bf89145fd931a3918a95",
42
42
  "lib/types/server.d.ts": "62b23f8f9fe9bb16a20274929876c1a34b3ab1e94179567e2e3a56cd67638288",
43
- "lib/types/sidebar-adapter.d.ts": "9296987e7ecbd76e42d75bbf65d06f3e368dc036501baf931d7eaa9fb923252d",
44
- "lib/types/styles.d.ts": "305836b3ce5cb256ffb033038b7df2919759976f3ca29395a7cd41bbd5811536",
45
- "lib/types/ui.d.ts": "dcccb0fe08c0b482abd305db39a4d90f66295bb44f9c37931240194f6a28eb10",
43
+ "lib/types/sidebar-adapter.d.ts": "5730bbeb661d8731620dc22397c8a8928209124b8d92d8b8549b6a84824e0518",
44
+ "lib/types/styles.d.ts": "c7434168512577eb1255158835dd6ea044413edd586844b21daf711ea2eeffec",
45
+ "lib/types/ui.d.ts": "26ed9db1073e303ff8d7e8bdf548a90181267ca38d26cce6e2e6a95823d1d972",
46
46
  "lib/types/web-surface.d.ts": "71686d72b4a5d6c619ee4ec916bbf7b853a87a7cc4d506fbfd0359191434984f",
47
47
  "lib/types/website-conversation-actions.d.ts": "3bfea5b960e2e78ba6a03c060ff606a3b07293028843c481f8d8f3a41d733c19",
48
48
  "lib/types/website-header.d.ts": "6379a35e7d35af3fb969802ee2cae969a104dbad937f7b9e371463a0bd7dea9d",
package/lib/client.js CHANGED
@@ -14739,10 +14739,6 @@ window.__ModuleLoader__.load({
14739
14739
  descriptors: DSH_CHAT_DESCRIPTORS
14740
14740
  };
14741
14741
 
14742
- // src/ui.tsx
14743
- var import_react = require("react");
14744
- var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
14745
-
14746
14742
  // src/styles.ts
14747
14743
  var chatStyles = String.raw`
14748
14744
  .dsh-chat-rename-input{box-sizing:border-box;width:100%;height:44px;padding:7px 14px;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);outline:none;background:transparent;font-size:14px;font-weight:400;line-height:22px;color:var(--dsw-alias-label-primary)}
@@ -14760,8 +14756,7 @@ window.__ModuleLoader__.load({
14760
14756
  .dsh-chat-mode-compact .dsh-chat-modes{flex-direction:column;width:30px;gap:3px}.dsh-chat-mode-compact .dsh-chat-modes button{width:24px;padding:4px 2px}
14761
14757
  [data-dsh-chat-brand-fill="identity"]{flex:1;width:100%}
14762
14758
  [data-dsh-chat-brand-fill="name"]{flex:1}
14763
- [data-dsh-chat-sidebar-mode="chat"] [data-dsh-chat-plugin-row="true"],
14764
- [data-dsh-chat-sidebar-mode="chat"] [data-dsh-chat-only-plugins="true"]{display:none}
14759
+ [data-dsh-chat-sidebar-mode="chat"] > [data-dsh-chat-panel-region="true"]{display:none}
14765
14760
  [data-dsh-chat-sidebar-mode="chat"] [data-dsh-chat-new-session="true"]:disabled{opacity:.45;cursor:default}
14766
14761
  .dsh-chat-brand-name{display:inline-flex;align-items:center;gap:6px;min-width:0;max-width:100%;flex:1;width:100%}
14767
14762
  .dsh-chat-brand-wordmark{display:block;flex:0 1 102px;min-width:0;width:102px;height:24px;overflow:hidden}
@@ -14809,14 +14804,69 @@ window.__ModuleLoader__.load({
14809
14804
  .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}
14810
14805
  .dsh-chat-settings-error{color:#ff8585;line-height:1.5;font-size:12px}
14811
14806
  `;
14807
+ var styleLeases = /* @__PURE__ */ new WeakMap();
14808
+ function acquireChatStyles(doc) {
14809
+ let lease = styleLeases.get(doc);
14810
+ if (!lease) {
14811
+ const style = doc.createElement("style");
14812
+ style.setAttribute("data-dsh-deepseek-chat-styles", "true");
14813
+ let users = 0;
14814
+ const ensure = () => {
14815
+ if (style.textContent !== chatStyles) style.textContent = chatStyles;
14816
+ if (style.media) style.media = "";
14817
+ if (style.hasAttribute("disabled")) style.removeAttribute("disabled");
14818
+ if (!style.isConnected) doc.head.appendChild(style);
14819
+ if (style.sheet?.disabled) style.sheet.disabled = false;
14820
+ };
14821
+ const observer = new MutationObserver(ensure);
14822
+ ensure();
14823
+ observer.observe(doc.head, {
14824
+ childList: true,
14825
+ subtree: true,
14826
+ characterData: true,
14827
+ attributes: true,
14828
+ attributeFilter: ["disabled", "media"]
14829
+ });
14830
+ const current = {
14831
+ ensure,
14832
+ retain() {
14833
+ users++;
14834
+ ensure();
14835
+ },
14836
+ release() {
14837
+ if (--users > 0) return;
14838
+ observer.disconnect();
14839
+ style.remove();
14840
+ if (styleLeases.get(doc) === current) styleLeases.delete(doc);
14841
+ }
14842
+ };
14843
+ lease = current;
14844
+ styleLeases.set(doc, current);
14845
+ }
14846
+ lease.retain();
14847
+ let released = false;
14848
+ return () => {
14849
+ if (!released) {
14850
+ released = true;
14851
+ lease.release();
14852
+ }
14853
+ };
14854
+ }
14855
+ function ensureChatStyles(doc) {
14856
+ styleLeases.get(doc)?.ensure();
14857
+ }
14812
14858
 
14813
14859
  // src/ui.tsx
14860
+ var import_react_dom = require("react-dom");
14861
+ var import_react = require("react");
14862
+ var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
14814
14863
  var import_jsx_runtime = require("react/jsx-runtime");
14815
14864
  function useDshChat(bridge) {
14816
14865
  return (0, import_react.useSyncExternalStore)(bridge.subscribe, bridge.getSnapshot, bridge.getSnapshot);
14817
14866
  }
14818
14867
  function DshChatStyles() {
14819
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: chatStyles });
14868
+ (0, import_react.useLayoutEffect)(() => acquireChatStyles(document), []);
14869
+ return null;
14820
14870
  }
14821
14871
  function PanelIcon() {
14822
14872
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
@@ -14841,38 +14891,47 @@ window.__ModuleLoader__.load({
14841
14891
  function DshChatBrandName({ bridge }) {
14842
14892
  const name2 = (0, import_react.useRef)(null);
14843
14893
  const anchor = (0, import_react.useRef)(null);
14894
+ const [localAnchor, setLocalAnchor] = (0, import_react.useState)(null);
14844
14895
  (0, import_react.useLayoutEffect)(() => {
14845
14896
  const element = anchor.current;
14846
14897
  const group = name2.current;
14847
14898
  if (!element || !group) return;
14848
- bridge.attachSidebar(group);
14849
- let visible = false;
14850
14899
  const measure = () => {
14900
+ if (!group.isConnected || !element.isConnected) return;
14901
+ ensureChatStyles(document);
14902
+ bridge.attachSidebar(group);
14851
14903
  const rect = element.getBoundingClientRect();
14852
- bridge.updateBrandAnchor(visible && rect.width > 0 && rect.height > 0 ? { left: rect.left, top: rect.top, width: rect.width, height: rect.height } : null);
14904
+ const visible = rect.width > 0 && rect.height > 0 && rect.right > 0 && rect.left < window.innerWidth && rect.bottom > 0 && rect.top < window.innerHeight && getComputedStyle(group).visibility !== "hidden";
14905
+ const next = visible ? { left: rect.left, top: rect.top, width: rect.width, height: rect.height } : null;
14906
+ setLocalAnchor((previous) => previous?.left === next?.left && previous?.top === next?.top && previous?.width === next?.width && previous?.height === next?.height ? previous : next);
14907
+ bridge.updateBrandAnchor(next, group);
14853
14908
  };
14854
14909
  const resize = new ResizeObserver(measure);
14855
14910
  resize.observe(group);
14856
14911
  resize.observe(element);
14857
- const intersection2 = new IntersectionObserver((entries) => {
14858
- visible = entries.some((entry) => entry.target === element && entry.isIntersecting && entry.intersectionRatio >= 0.99);
14859
- measure();
14860
- }, { threshold: [0, 0.99, 1] });
14861
- intersection2.observe(element);
14912
+ const reconcile = window.setInterval(measure, 250);
14913
+ measure();
14914
+ window.addEventListener("focus", measure);
14915
+ document.addEventListener("visibilitychange", measure);
14862
14916
  window.addEventListener("resize", measure);
14863
14917
  window.addEventListener("scroll", measure, true);
14864
14918
  return () => {
14865
14919
  resize.disconnect();
14866
- intersection2.disconnect();
14920
+ window.clearInterval(reconcile);
14921
+ window.removeEventListener("focus", measure);
14922
+ document.removeEventListener("visibilitychange", measure);
14867
14923
  window.removeEventListener("resize", measure);
14868
14924
  window.removeEventListener("scroll", measure, true);
14869
- bridge.updateBrandAnchor(null);
14925
+ bridge.updateBrandAnchor(null, group);
14870
14926
  };
14871
14927
  }, [bridge]);
14872
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { ref: name2, className: "dsh-chat-brand-name", children: [
14873
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatStyles, {}),
14874
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatWordmark, {}),
14875
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ref: anchor, className: "dsh-chat-brand-anchor" })
14928
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
14929
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { ref: name2, className: "dsh-chat-brand-name", children: [
14930
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatStyles, {}),
14931
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatWordmark, {}),
14932
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ref: anchor, className: "dsh-chat-brand-anchor" })
14933
+ ] }),
14934
+ (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatBrandControl, { bridge, rect: localAnchor }), document.body)
14876
14935
  ] });
14877
14936
  }
14878
14937
  function DshChatAuthorizationNotice({ bridge, state }) {
@@ -14882,9 +14941,9 @@ window.__ModuleLoader__.load({
14882
14941
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-chat-text-button", onClick: () => bridge.refreshAuthorization(), children: "\u91CD\u8BD5\u8FDE\u63A5" })
14883
14942
  ] });
14884
14943
  }
14885
- function DshChatBrandControl({ bridge }) {
14944
+ function DshChatBrandControl({ bridge, rect: ownedRect }) {
14886
14945
  const state = useDshChat(bridge);
14887
- const rect = state.brandAnchor;
14946
+ const rect = ownedRect === void 0 ? state.brandAnchor : ownedRect;
14888
14947
  if (rect === null) return null;
14889
14948
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-brand-control", "aria-label": "dsh-deepseek-chat \u6A21\u5F0F\u9009\u62E9", style: {
14890
14949
  left: rect.left,
@@ -15155,7 +15214,7 @@ window.__ModuleLoader__.load({
15155
15214
  }
15156
15215
 
15157
15216
  // src/web-surface.tsx
15158
- var import_react_dom = require("react-dom");
15217
+ var import_react_dom2 = require("react-dom");
15159
15218
  var import_react2 = require("react");
15160
15219
 
15161
15220
  // src/website-conversation-actions.ts
@@ -15184,49 +15243,81 @@ window.__ModuleLoader__.load({
15184
15243
  const menuSelector = '[role="menu"],.ds-dropdown-menu';
15185
15244
  const existing = new Set(doc.querySelectorAll(menuSelector));
15186
15245
  if ([...existing].some((el) => el.getBoundingClientRect().height > 0)) return "\u8BF7\u5148\u5173\u95ED\u5B98\u7F51\u5F53\u524D\u83DC\u5355\uFF0C\u518D\u64CD\u4F5C\u5BF9\u8BDD\u3002";
15246
+ const originalTitle = (link.getAttribute("title") || link.textContent || "").trim();
15247
+ const editorHost = row.parentElement && row.parentElement !== sidebar && sidebar.contains(row.parentElement) && row.parentElement.querySelectorAll("a[href]").length === 1 ? row.parentElement : row;
15187
15248
  const originalPath = doc.defaultView.location.pathname;
15188
- triggers[0].click();
15189
- const deadline = Date.now() + 3e3;
15190
- while (Date.now() < deadline) {
15191
- await new Promise((resolve) => setTimeout(resolve, 50));
15192
- if (!link.isConnected || !profile.isConnected || !profile.hasAttribute("data-dsh-chat-profile-confirmed") || doc.defaultView?.location.origin !== "https://chat.deepseek.com" || doc.defaultView.location.pathname !== originalPath) return error51;
15193
- const menus = [...doc.querySelectorAll(menuSelector)].filter((el) => !existing.has(el) && el.getBoundingClientRect().height > 0);
15194
- const matches = menus.flatMap((menu) => [...menu.querySelectorAll('[role="menuitem"],.ds-dropdown-menu-option,button,[role="button"]')]).filter((el) => labels[command.action].test(el.textContent?.trim() || "") && !el.matches(':disabled,[aria-disabled="true"]'));
15195
- const unique = [...new Set(matches)].filter((el) => !matches.some((other) => other !== el && el.contains(other)));
15196
- if (unique.length === 1) {
15197
- unique[0].click();
15198
- if (command.action !== "rename") return null;
15199
- const renameDeadline = Date.now() + 3e3;
15200
- let submitted = false;
15201
- while (Date.now() < renameDeadline) {
15202
- await new Promise((resolve) => setTimeout(resolve, 50));
15203
- if (!profile.isConnected || doc.defaultView?.location.pathname !== originalPath) return error51;
15204
- if (submitted) {
15205
- const current = [...sidebar.querySelectorAll("a[href]")].find((el) => el.href === command.href);
15206
- if ((current?.getAttribute("title") || current?.textContent || "").trim() === command.title.trim()) return null;
15207
- continue;
15249
+ const hideActionMenu = () => {
15250
+ for (const menu of doc.querySelectorAll(menuSelector)) {
15251
+ if (existing.has(menu) || ![...menu.querySelectorAll('[role="menuitem"],.ds-dropdown-menu-option,button,[role="button"]')].some((el) => labels[command.action].test(el.textContent?.trim() || ""))) continue;
15252
+ menu.setAttribute("data-dsh-chat-action-menu", "");
15253
+ }
15254
+ };
15255
+ const observer = new MutationObserver(hideActionMenu);
15256
+ observer.observe(doc.body, { childList: true, subtree: true, characterData: true });
15257
+ try {
15258
+ triggers[0].click();
15259
+ hideActionMenu();
15260
+ const deadline = Date.now() + 3e3;
15261
+ while (Date.now() < deadline) {
15262
+ await new Promise((resolve) => setTimeout(resolve, 50));
15263
+ if (!link.isConnected || !profile.isConnected || !profile.hasAttribute("data-dsh-chat-profile-confirmed") || doc.defaultView?.location.origin !== "https://chat.deepseek.com" || doc.defaultView.location.pathname !== originalPath) return error51;
15264
+ const menus = [...doc.querySelectorAll(menuSelector)].filter((el) => !existing.has(el) && el.getBoundingClientRect().height > 0);
15265
+ const matches = menus.flatMap((menu) => [...menu.querySelectorAll('[role="menuitem"],.ds-dropdown-menu-option,button,[role="button"]')]).filter((el) => labels[command.action].test(el.textContent?.trim() || "") && !el.matches(':disabled,[aria-disabled="true"]'));
15266
+ const unique = [...new Set(matches)].filter((el) => !matches.some((other) => other !== el && el.contains(other)));
15267
+ if (unique.length === 1) {
15268
+ unique[0].click();
15269
+ if (command.action !== "rename") return null;
15270
+ const renameDeadline = Date.now() + 3e3;
15271
+ let submitted = false;
15272
+ while (Date.now() < renameDeadline) {
15273
+ await new Promise((resolve) => setTimeout(resolve, 50));
15274
+ if (!profile.isConnected || doc.defaultView?.location.pathname !== originalPath) return error51;
15275
+ if (submitted) {
15276
+ const current = [...sidebar.querySelectorAll("a[href]")].find((el) => el.href === command.href);
15277
+ if ((current?.getAttribute("title") || current?.textContent || "").trim() === command.title.trim()) return null;
15278
+ continue;
15279
+ }
15280
+ const inputs = [...sidebar.querySelectorAll('input:not([type="hidden"])')].filter((input2) => !input2.disabled && input2.type === "text" && !/搜索|search/i.test([input2.getAttribute("aria-label"), input2.getAttribute("placeholder"), input2.getAttribute("title")].join(" ")) && !input2.closest('[role="dialog"],.ds-modal-content'));
15281
+ const rowInputs = inputs.filter((input2) => editorHost.contains(input2));
15282
+ const inline = rowInputs.length ? rowInputs : inputs.filter((input2) => input2.value.trim() === originalTitle);
15283
+ if (inline.length === 1) {
15284
+ const input2 = inline[0];
15285
+ const setter2 = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
15286
+ if (!setter2) return error51;
15287
+ input2.focus();
15288
+ setter2.call(input2, command.title.trim());
15289
+ input2.dispatchEvent(new Event("input", { bubbles: true }));
15290
+ input2.dispatchEvent(new Event("change", { bubbles: true }));
15291
+ await new Promise((resolve) => setTimeout(resolve, 50));
15292
+ input2.dispatchEvent(new KeyboardEvent("keydown", { key: "Enter", code: "Enter", bubbles: true, cancelable: true }));
15293
+ input2.dispatchEvent(new KeyboardEvent("keyup", { key: "Enter", code: "Enter", bubbles: true }));
15294
+ submitted = true;
15295
+ continue;
15296
+ }
15297
+ const dialogs = [...doc.querySelectorAll('[role="dialog"],.ds-modal-content')].filter((el) => /重命名|Rename/i.test(el.textContent || "") && el.querySelectorAll('input:not([type="hidden"])').length === 1).filter((el) => !el.querySelector('[role="dialog"],.ds-modal-content'));
15298
+ if (dialogs.length !== 1) continue;
15299
+ const dialog = dialogs[0];
15300
+ const input = dialog.querySelector('input:not([type="hidden"])');
15301
+ if (!["text", ""].includes(input.type) || input.disabled) return error51;
15302
+ const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
15303
+ if (!setter) return error51;
15304
+ setter.call(input, command.title.trim());
15305
+ input.dispatchEvent(new Event("input", { bubbles: true }));
15306
+ input.dispatchEvent(new Event("change", { bubbles: true }));
15307
+ await new Promise((resolve) => setTimeout(resolve, 50));
15308
+ const confirms = [...dialog.querySelectorAll('button,[role="button"],.ds-button')].filter((el) => /^(确定|确认|保存|重命名|Confirm|Save|Rename)$/i.test(el.textContent?.trim() || "") && !el.matches(':disabled,[aria-disabled="true"]'));
15309
+ if (confirms.length !== 1) return error51;
15310
+ confirms[0].click();
15311
+ submitted = true;
15208
15312
  }
15209
- const dialogs = [...doc.querySelectorAll('[role="dialog"],.ds-modal-content')].filter((el) => /重命名|Rename/i.test(el.textContent || "") && el.querySelectorAll('input:not([type="hidden"])').length === 1).filter((el) => !el.querySelector('[role="dialog"],.ds-modal-content'));
15210
- if (dialogs.length !== 1) continue;
15211
- const dialog = dialogs[0];
15212
- const input = dialog.querySelector('input:not([type="hidden"])');
15213
- if (!["text", ""].includes(input.type) || input.disabled) return error51;
15214
- const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
15215
- if (!setter) return error51;
15216
- setter.call(input, command.title.trim());
15217
- input.dispatchEvent(new Event("input", { bubbles: true }));
15218
- input.dispatchEvent(new Event("change", { bubbles: true }));
15219
- await new Promise((resolve) => setTimeout(resolve, 50));
15220
- const confirms = [...dialog.querySelectorAll('button,[role="button"],.ds-button')].filter((el) => /^(确定|确认|保存|重命名|Confirm|Save|Rename)$/i.test(el.textContent?.trim() || "") && !el.matches(':disabled,[aria-disabled="true"]'));
15221
- if (confirms.length !== 1) return error51;
15222
- confirms[0].click();
15223
- submitted = true;
15224
- }
15225
- return "\u5B98\u7F51\u672A\u786E\u8BA4\u91CD\u547D\u540D\u7ED3\u679C\uFF0C\u8BF7\u5237\u65B0\u5217\u8868\u540E\u91CD\u8BD5\u3002";
15226
- }
15227
- }
15228
- if (!doc.querySelector('[role="dialog"],.ds-modal-content')) triggers[0].dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
15229
- return error51;
15313
+ return "\u5B98\u7F51\u672A\u786E\u8BA4\u91CD\u547D\u540D\u7ED3\u679C\uFF0C\u8BF7\u5237\u65B0\u5217\u8868\u540E\u91CD\u8BD5\u3002";
15314
+ }
15315
+ }
15316
+ if (!doc.querySelector('[role="dialog"],.ds-modal-content')) triggers[0].dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
15317
+ return error51;
15318
+ } finally {
15319
+ observer.disconnect();
15320
+ }
15230
15321
  }
15231
15322
 
15232
15323
  // src/website-header.ts
@@ -15580,7 +15671,7 @@ window.__ModuleLoader__.load({
15580
15671
  const conversationError = "\u8BE5\u5BF9\u8BDD\u4E0D\u5728\u5F53\u524D\u5B98\u7F51\u5217\u8868\uFF0C\u8BF7\u5237\u65B0\u5217\u8868\u3002";
15581
15672
  const styleId = "dsh-chat-website-navigation-style";
15582
15673
  const preparingStyleId = "dsh-chat-website-preparing-style";
15583
- const owned = [marker, presentedMarker, missingSidebarMarker, fallbackMarker, fallbackErrorMarker, profileMarker, profileProofMarker, profileAvatarMarker, navigationWidthMarker, expandingMarker, compactToggleMarker, "data-dsh-chat-conversation-error", "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"];
15674
+ const owned = [marker, presentedMarker, missingSidebarMarker, fallbackMarker, fallbackErrorMarker, profileMarker, profileProofMarker, profileAvatarMarker, navigationWidthMarker, expandingMarker, compactToggleMarker, "data-dsh-chat-action-menu", "data-dsh-chat-conversation-error", "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"];
15584
15675
  const empty = (status) => ({ status, ...status === "sign-in" ? { authenticated: false } : {}, conversations: [], selectedHref: null, canCreate: false, error: null });
15585
15676
  const clearSettings = (preserveConfirmedPreferences = false) => {
15586
15677
  const confirmed = ["data-dsh-chat-language", "data-dsh-chat-theme", "data-dsh-chat-dark-complete", "data-dsh-chat-settings-restored"];
@@ -15901,7 +15992,8 @@ window.__ModuleLoader__.load({
15901
15992
  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", "");
15902
15993
  }
15903
15994
  }
15904
- const styleText = `[${marker}],[data-dsh-chat-web-chrome]{display:none!important}
15995
+ const styleText = `[data-dsh-chat-action-menu]{visibility:hidden!important;pointer-events:none!important}
15996
+ [${marker}],[data-dsh-chat-web-chrome]{display:none!important}
15905
15997
  [data-dsh-chat-layout]{grid-template-columns:minmax(0,1fr)!important}
15906
15998
  [data-dsh-chat-content]{margin-left:0!important;min-width:0!important;width:100%!important;max-width:none!important;flex:1 1 0%!important}`;
15907
15999
  let style = doc.getElementById(styleId);
@@ -15923,7 +16015,7 @@ window.__ModuleLoader__.load({
15923
16015
  }
15924
16016
  function websiteCommandScript(command) {
15925
16017
  if (command.type === "refresh") throw new Error("Website refresh must be handled by the guest owner");
15926
- if (command.type === "conversation-action") return `(async () => { const adaptWebsiteSettings = ${adaptWebsiteSettings.toString()}; const adaptWebsiteHeader = ${adaptWebsiteHeader.toString()}; const dismissWebsiteEnvironmentNotice = ${dismissWebsiteEnvironmentNotice.toString()}; const adapt = ${adaptWebsiteNavigation.toString()}; const command = ${JSON.stringify(command)}; const before = adapt(document,location,{type:'snapshot',showOriginal:false}); if (before.authenticated !== true || !before.conversations.some(item=>item.href===command.href)) return before; const error = await (${performWebsiteConversationAction.toString()})(document,command); if(error) document.documentElement.setAttribute('data-dsh-chat-conversation-error',error); else document.documentElement.removeAttribute('data-dsh-chat-conversation-error'); return adapt(document,location,{type:'snapshot',showOriginal:false}); })()`;
16018
+ if (command.type === "conversation-action") return `(async () => { const adaptWebsiteSettings = ${adaptWebsiteSettings.toString()}; const adaptWebsiteHeader = ${adaptWebsiteHeader.toString()}; const dismissWebsiteEnvironmentNotice = ${dismissWebsiteEnvironmentNotice.toString()}; const adapt = ${adaptWebsiteNavigation.toString()}; const command = ${JSON.stringify(command)}; const before = adapt(document,location,{type:'snapshot',showOriginal:false}); if (before.authenticated !== true || !before.conversations.some(item=>item.href===command.href)) return before; const error = await (${performWebsiteConversationAction.toString()})(document,command); if(error) document.documentElement.setAttribute('data-dsh-chat-action-menu', 'data-dsh-chat-conversation-error',error); else document.documentElement.removeAttribute('data-dsh-chat-conversation-error'); return adapt(document,location,{type:'snapshot',showOriginal:false}); })()`;
15927
16019
  return `(() => { const adaptWebsiteSettings = ${adaptWebsiteSettings.toString()}; const adaptWebsiteHeader = ${adaptWebsiteHeader.toString()}; const dismissWebsiteEnvironmentNotice = ${dismissWebsiteEnvironmentNotice.toString()}; return (${adaptWebsiteNavigation.toString()})(document,location,${JSON.stringify(command)}); })()`;
15928
16020
  }
15929
16021
  function parseWebsiteNavigation(value) {
@@ -16468,7 +16560,7 @@ window.__ModuleLoader__.load({
16468
16560
  const activeReservation = reservation !== null && reservation.generation === state.authorizationGeneration && reservation.storageKey === state.accountStorageKey ? reservation : null;
16469
16561
  const clearance = 0;
16470
16562
  const logoutError = state.websiteAuthenticationStatus === "error" && /退出/.test(state.websiteSessionError ?? "");
16471
- 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: {
16563
+ return (0, import_react_dom2.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: {
16472
16564
  zIndex: inSettings ? 0 : 14,
16473
16565
  visibility: visible ? "visible" : "hidden",
16474
16566
  display: (inSettings || state.mode === "chat") && rect ? "flex" : "none",
@@ -16510,13 +16602,17 @@ window.__ModuleLoader__.load({
16510
16602
  }
16511
16603
 
16512
16604
  // src/sidebar-adapter.ts
16513
- var newSessionLabels = /* @__PURE__ */ new Set(["\u65B0\u5EFA\u4F1A\u8BDD", "\u65B0\u4F1A\u8BDD", "New Session"]);
16514
- var pluginLabels = /* @__PURE__ */ new Set(["\u63D2\u4EF6", "Plugins"]);
16515
16605
  function createSidebarBinding(read, create, report) {
16516
16606
  let adapter = null;
16607
+ let owner = null;
16517
16608
  return {
16518
16609
  attach(name2) {
16610
+ if (owner === name2 && adapter?.valid()) {
16611
+ adapter.sync();
16612
+ return;
16613
+ }
16519
16614
  adapter?.dispose();
16615
+ owner = name2;
16520
16616
  adapter = attachSidebarAdapter(name2, read, create);
16521
16617
  report(adapter !== null);
16522
16618
  },
@@ -16526,6 +16622,7 @@ window.__ModuleLoader__.load({
16526
16622
  dispose() {
16527
16623
  adapter?.dispose();
16528
16624
  adapter = null;
16625
+ owner = null;
16529
16626
  }
16530
16627
  };
16531
16628
  }
@@ -16537,8 +16634,10 @@ window.__ModuleLoader__.load({
16537
16634
  const row = brand?.parentElement;
16538
16635
  const root = row?.parentElement;
16539
16636
  if (!nameSeat || !identity || !brand || !row || !root || identity.getAttribute("aria-hidden") !== "true" || !row.hasAttribute("data-window-drag") || identity.children.length !== 2) return null;
16540
- const newButton = Array.from(root.children).find((element) => element.tagName === "BUTTON" && newSessionLabels.has(element.getAttribute("aria-label") ?? ""));
16541
- if (!newButton) return null;
16637
+ const next = row.nextElementSibling;
16638
+ const buttons = Array.from(root.children).filter((element) => element.tagName === "BUTTON");
16639
+ if (!next || next.tagName !== "BUTTON" || buttons.length !== 1 || buttons[0] !== next) return null;
16640
+ const newButton = next;
16542
16641
  const originalAttributes = /* @__PURE__ */ new Map();
16543
16642
  const mark = (element, key, value) => {
16544
16643
  let originals = originalAttributes.get(element);
@@ -16565,14 +16664,12 @@ window.__ModuleLoader__.load({
16565
16664
  const sync = () => {
16566
16665
  if (disposed) return;
16567
16666
  const state = read();
16667
+ mark(identity, "data-dsh-chat-brand-fill", "identity");
16668
+ mark(nameSeat, "data-dsh-chat-brand-fill", "name");
16568
16669
  mark(root, "data-dsh-chat-sidebar-mode", state.chat ? "chat" : "harness");
16569
16670
  newButton.disabled = state.chat ? !state.canCreate : originallyDisabled;
16570
16671
  for (const nav of Array.from(root.children).filter((element) => element.tagName === "NAV")) {
16571
- const buttons = Array.from(nav.children).filter((element) => element.tagName === "BUTTON");
16572
- for (const button of buttons) {
16573
- if (pluginLabels.has(button.getAttribute("aria-label") ?? "")) mark(button, "data-dsh-chat-plugin-row", "true");
16574
- }
16575
- mark(nav, "data-dsh-chat-only-plugins", buttons.length > 0 && buttons.every((button) => pluginLabels.has(button.getAttribute("aria-label") ?? "")) ? "true" : "false");
16672
+ mark(nav, "data-dsh-chat-panel-region", "true");
16576
16673
  }
16577
16674
  };
16578
16675
  const observer = new MutationObserver(sync);
@@ -16580,6 +16677,7 @@ window.__ModuleLoader__.load({
16580
16677
  sync();
16581
16678
  return {
16582
16679
  sync,
16680
+ valid: () => !disposed && name2.isConnected && nameSeat.parentElement === identity && identity.parentElement === brand && brand.parentElement === row && row.parentElement === root && newButton.parentElement === root,
16583
16681
  dispose() {
16584
16682
  if (disposed) return;
16585
16683
  disposed = true;
@@ -16649,6 +16747,7 @@ window.__ModuleLoader__.load({
16649
16747
  const pendingPreferences = /* @__PURE__ */ new Map();
16650
16748
  let viewport = null;
16651
16749
  let brandAnchor = null;
16750
+ let brandAnchorOwner = null;
16652
16751
  let sidebarAdapted = null;
16653
16752
  let websiteNavigation = emptyNavigation();
16654
16753
  let showWebsiteNavigation = false;
@@ -16990,7 +17089,9 @@ window.__ModuleLoader__.load({
16990
17089
  viewport = next;
16991
17090
  publish();
16992
17091
  },
16993
- updateBrandAnchor: (next) => {
17092
+ updateBrandAnchor: (next, owner) => {
17093
+ if (owner && next === null && brandAnchorOwner !== owner) return;
17094
+ if (owner) brandAnchorOwner = next === null ? null : owner;
16994
17095
  if (brandAnchor?.left === next?.left && brandAnchor?.top === next?.top && brandAnchor?.width === next?.width && brandAnchor?.height === next?.height) return;
16995
17096
  brandAnchor = next;
16996
17097
  publish();
@@ -17361,11 +17462,12 @@ window.__ModuleLoader__.load({
17361
17462
  });
17362
17463
  publish();
17363
17464
  ctx.effect(() => {
17465
+ const releaseStyles = typeof document === "undefined" ? () => {
17466
+ } : acquireChatStyles(document);
17364
17467
  ctx.slots.inject("settings.section", () => ctx.slots.register({ name: "settings.section", id: "dsh-deepseek-chat.chat-settings", order: 80, label: "CHAT\u8BBE\u7F6E", inject: () => ({ bridge }) }, DshChatChatSettings));
17365
17468
  ctx.slots.inject("main", () => ctx.slots.register({ name: "main", key: CHAT_PANEL, inject: () => ({ bridge }) }, DshChatChatPanel));
17366
17469
  ctx.slots.inject("sidebar.brand.name", () => ctx.slots.register({ name: "sidebar.brand.name", priority: -100, inject: () => ({ bridge }) }, DshChatBrandName));
17367
17470
  ctx.slots.inject("shell.overlay", () => [
17368
- ctx.slots.register({ name: "shell.overlay", id: "dsh-deepseek-chat.brand-control", order: 100, inject: () => ({ bridge }) }, DshChatBrandControl),
17369
17471
  ctx.slots.register({ name: "shell.overlay", id: "dsh-deepseek-chat.website", order: 90, inject: () => ({ bridge, nativeBrowser }) }, DshChatWebSurface)
17370
17472
  ]);
17371
17473
  const stopMode = mode.subscribe(publish);
@@ -17381,6 +17483,7 @@ window.__ModuleLoader__.load({
17381
17483
  clearTimeout(logoutTimer);
17382
17484
  mode.dispose();
17383
17485
  sidebar?.dispose();
17486
+ releaseStyles();
17384
17487
  stopPanel();
17385
17488
  stopMode();
17386
17489
  disposed = true;
@@ -13,5 +13,6 @@ export declare function createSidebarBinding(read: () => SidebarAdapterState, cr
13
13
  * Unknown layouts are left alone; no global search or hashed CSS selectors. */
14
14
  export declare function attachSidebarAdapter(name: HTMLElement, read: () => SidebarAdapterState, create: () => void): {
15
15
  sync(): void;
16
+ valid(): boolean;
16
17
  dispose(): void;
17
18
  } | null;
@@ -1,2 +1,5 @@
1
1
  /** Own UI plus the user's narrowly approved, reversible rc.2 sidebar markers. */
2
2
  export declare const chatStyles: string;
3
+ export declare function acquireChatStyles(doc: Document): () => void;
4
+ /** CSSOM disabling does not emit a DOM mutation; the brand measurement also checks it. */
5
+ export declare function ensureChatStyles(doc: Document): void;
package/lib/types/ui.d.ts CHANGED
@@ -46,7 +46,7 @@ export interface DshChatUIBridge {
46
46
  toggleSidebar(): void;
47
47
  attachViewport(element: HTMLElement | null): void;
48
48
  updateViewport(rect: DshChatViewportRect | null): void;
49
- updateBrandAnchor(rect: DshChatViewportRect | null): void;
49
+ updateBrandAnchor(rect: DshChatViewportRect | null, owner?: HTMLElement): void;
50
50
  attachSidebar(element: HTMLElement): void;
51
51
  reloadWebsite(): void;
52
52
  refreshWebsiteNavigation(): void;
@@ -75,15 +75,17 @@ export interface DshChatBridgeProps {
75
75
  readonly bridge: DshChatUIBridge;
76
76
  }
77
77
  export declare function useDshChat(bridge: DshChatUIBridge): DshChatViewState;
78
- export declare function DshChatStyles(): import("react/jsx-runtime").JSX.Element;
78
+ export declare function DshChatStyles(): null;
79
79
  export declare function DshChatModeSelector({ bridge, state, compact }: DshChatBridgeProps & {
80
80
  readonly state: DshChatViewState;
81
81
  readonly compact?: boolean;
82
82
  }): import("react/jsx-runtime").JSX.Element;
83
- /** Decorative brand content only: this slot has an aria-hidden/New Session owner. */
83
+ /** The brand seat owns identity and its portalled controls as one lifetime. */
84
84
  export declare function DshChatBrandName({ bridge }: PropsRuntime<'sidebar.brand.name'> & DshChatBridgeProps): import("react/jsx-runtime").JSX.Element;
85
85
  /** The interactive surface is outside the brand slot's hidden/button ancestry. */
86
- export declare function DshChatBrandControl({ bridge }: PropsRuntime<'shell.overlay'> & DshChatBridgeProps): import("react/jsx-runtime").JSX.Element | null;
86
+ export declare function DshChatBrandControl({ bridge, rect: ownedRect }: DshChatBridgeProps & {
87
+ readonly rect?: DshChatViewportRect | null;
88
+ }): import("react/jsx-runtime").JSX.Element | null;
87
89
  /** Only the middle browsing region changes; the shipped shell and Settings stay mounted. */
88
90
  export declare function DshChatChatNavigation({ bridge, wide, expandSidebar }: PropsRuntime<'sidebar.workspaces'> & DshChatBridgeProps): import("react/jsx-runtime").JSX.Element;
89
91
  /** Measures only this plugin's own element; website content lives in the retained overlay. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-deepseek-chat",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "CHAT / HARNESS mode switcher for DeepSeek Harness",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,17 +10,13 @@
10
10
  "bugs": {
11
11
  "url": "https://github.com/xingxingbk-git/dsh-deepseek-chat/issues"
12
12
  },
13
- "keywords": [
14
- "dsh",
15
- "deepseek",
16
- "chat",
17
- "dsh-plugin"
18
- ],
13
+ "keywords": ["dsh", "deepseek", "chat", "dsh-plugin"],
19
14
  "publishConfig": {
20
15
  "access": "public",
21
16
  "registry": "https://registry.npmjs.org/"
22
17
  },
23
18
  "type": "module",
19
+ "packageManager": "pnpm@10.33.2",
24
20
  "engines": {
25
21
  "node": "^22.19.0 || >=24.0.0"
26
22
  },
@@ -43,6 +39,17 @@
43
39
  "README.md",
44
40
  "assets/icon.svg"
45
41
  ],
42
+ "scripts": {
43
+ "build:plugin": "node ./scripts/build.mjs",
44
+ "release:prepare": "node ./scripts/build.mjs && node ./scripts/check-distribution.mjs",
45
+ "check:distribution": "node ./scripts/check-distribution.mjs",
46
+ "typecheck": "tsc -p tsconfig.json --noEmit",
47
+ "test": "node ./scripts/test.mjs",
48
+ "preview": "node ./scripts/preview.mjs",
49
+ "check:artifact": "node ./scripts/check-artifact.mjs",
50
+ "check:git-install": "node ./scripts/check-git-install.mjs",
51
+ "package:plugin": "pnpm release:prepare && pnpm pack --pack-destination ./artifacts"
52
+ },
46
53
  "dsh": {
47
54
  "bundle": {
48
55
  "patch": "./cordis.patch.yml"
@@ -93,16 +100,5 @@
93
100
  "react-dom": "18.3.1",
94
101
  "typescript": "5.8.3"
95
102
  },
96
- "icon": "./assets/icon.svg",
97
- "scripts": {
98
- "build:plugin": "node ./scripts/build.mjs",
99
- "release:prepare": "node ./scripts/build.mjs && node ./scripts/check-distribution.mjs",
100
- "check:distribution": "node ./scripts/check-distribution.mjs",
101
- "typecheck": "tsc -p tsconfig.json --noEmit",
102
- "test": "node ./scripts/test.mjs",
103
- "preview": "node ./scripts/preview.mjs",
104
- "check:artifact": "node ./scripts/check-artifact.mjs",
105
- "check:git-install": "node ./scripts/check-git-install.mjs",
106
- "package:plugin": "pnpm release:prepare && pnpm pack --pack-destination ./artifacts"
107
- }
108
- }
103
+ "icon": "./assets/icon.svg"
104
+ }