dsh-deepseek-chat 0.1.18 → 0.1.19
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 +37 -25
- package/lib/build-manifest.json +10 -8
- package/lib/client.js +89 -45
- package/lib/types/ui.d.ts +2 -4
- package/lib/types/website-sidebar-collapse.d.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
CHAT模式 加载真实的 [DeepSeek Chat 官网](https://chat.deepseek.com/),使用官网的聊天功能和账号历史;HARNESS模式 为原 DSH 工作区。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
当前版本 **0.1.19** · 适配 **DSH 0.2.0-rc.2 桌面版** · 默认语言为简体中文。
|
|
8
8
|
|
|
9
9
|
## 功能预览
|
|
10
10
|
|
|
@@ -39,64 +39,72 @@ CHAT模式 加载真实的 [DeepSeek Chat 官网](https://chat.deepseek.com/),
|
|
|
39
39
|
|
|
40
40
|
## 安装
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
**希望尽快获取仓库中最新版本时,建议复制下方仓库地址,在 DSH 插件安装输入框中安装。**
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
按 npm 名称 `dsh-deepseek-chat` 安装,可能受到已锁定版本、包元数据缓存或 pnpm 的最低发布时间策略影响,刚发布的新版本不一定立即被选中。例如,`minimumReleaseAge: 1440` 表示版本发布满 **24 小时**后才符合该策略;这不是固定的“24 小时缓存”,具体取决于 DSH 使用的 pnpm 版本和配置。参见 [pnpm 官方说明](https://github.com/pnpm/pnpm.io/blob/main/versioned_docs/version-10.x/settings.md#minimumreleaseage)。
|
|
45
|
+
|
|
46
|
+
仓库地址安装获取的是**已推送到 GitHub 的源码及编译产物**;作者尚未推送的本地修改不会包含在内。已有安装也需要手动更新,并完整退出后重新打开 DSH。
|
|
47
|
+
|
|
48
|
+
### 使用仓库地址安装(希望尽快获取更新时推荐)
|
|
49
|
+
|
|
50
|
+
在 DSH 的插件安装输入框中粘贴:
|
|
45
51
|
|
|
46
52
|
```text
|
|
47
|
-
dsh-deepseek-chat
|
|
53
|
+
https://github.com/xingxingbk-git/dsh-deepseek-chat
|
|
48
54
|
```
|
|
49
55
|
|
|
50
|
-
|
|
56
|
+
仓库同时提供源码和编译好的 `lib`,安装直接加载编译产物,无需运行构建脚本或修改 `allowBuilds`。
|
|
57
|
+
|
|
58
|
+
使用命令行也可以安装:
|
|
51
59
|
|
|
52
60
|
```bash
|
|
53
|
-
dsh plugin --profile desktop add dsh-deepseek-chat
|
|
61
|
+
dsh plugin --profile desktop add https://github.com/xingxingbk-git/dsh-deepseek-chat
|
|
54
62
|
```
|
|
55
63
|
|
|
56
|
-
|
|
64
|
+
旧名称 `dsh-chat` 在 npm 上属于其他项目,请使用新的插件名称或完整仓库地址。
|
|
57
65
|
|
|
58
|
-
### 升级已有安装
|
|
59
66
|
|
|
60
|
-
|
|
67
|
+
### 按名称安装
|
|
68
|
+
|
|
69
|
+
在 DSH 的插件安装输入框中输入:
|
|
61
70
|
|
|
62
71
|
```text
|
|
63
|
-
dsh-deepseek-chat
|
|
72
|
+
dsh-deepseek-chat
|
|
64
73
|
```
|
|
65
74
|
|
|
66
|
-
|
|
75
|
+
也可以使用命令行:
|
|
67
76
|
|
|
68
77
|
```bash
|
|
69
|
-
dsh plugin --profile desktop add dsh-deepseek-chat
|
|
78
|
+
dsh plugin --profile desktop add dsh-deepseek-chat
|
|
70
79
|
```
|
|
71
80
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
使用其他 profile 时替换 `desktop`。通过 DSH 官方插件管理器或 CLI 更新,让依赖记录和锁文件一起更新;直接覆盖安装目录中的文件不能保证下次启动仍使用新版。
|
|
81
|
+
这是 npm 上的插件包,由 DSH 安装;无需运行独立的 npx 命令。
|
|
75
82
|
|
|
76
|
-
###
|
|
83
|
+
### 升级已有安装
|
|
77
84
|
|
|
78
|
-
|
|
85
|
+
已有安装可能继续使用之前锁定的版本。升级到当前版本时,在 DSH 的插件安装输入框中明确输入:
|
|
79
86
|
|
|
80
87
|
```text
|
|
81
|
-
|
|
88
|
+
dsh-deepseek-chat@0.1.19
|
|
82
89
|
```
|
|
83
90
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
使用命令行也可以安装:
|
|
91
|
+
指定版本可以明确安装目标,但仍可能受到发布时间策略限制。使用命令行指定要升级的版本:
|
|
87
92
|
|
|
88
93
|
```bash
|
|
89
|
-
dsh plugin --profile desktop add
|
|
94
|
+
dsh plugin --profile desktop add dsh-deepseek-chat@0.1.19
|
|
90
95
|
```
|
|
91
96
|
|
|
92
|
-
|
|
97
|
+
**完整退出并重新打开 DSH**,在插件管理页检查已安装版本为 **0.1.19**。进入 CHAT 后,“对话”标题右侧应显示刷新图标,未登录时登录按钮应有蓝色背景。
|
|
98
|
+
|
|
99
|
+
使用其他 profile 时替换 `desktop`。通过 DSH 官方插件管理器或 CLI 更新,让依赖记录和锁文件一起更新;直接覆盖安装目录中的文件不能保证下次启动仍使用新版。
|
|
100
|
+
|
|
93
101
|
|
|
94
102
|
### 本地安装包
|
|
95
103
|
|
|
96
104
|
将构建生成的 `.tgz` 文件交给 DSH 官方插件管理器安装,或使用 CLI:
|
|
97
105
|
|
|
98
106
|
```bash
|
|
99
|
-
dsh plugin --profile desktop add /absolute/path/dsh-deepseek-chat-0.1.
|
|
107
|
+
dsh plugin --profile desktop add /absolute/path/dsh-deepseek-chat-0.1.19.tgz
|
|
100
108
|
```
|
|
101
109
|
|
|
102
110
|
将路径替换成你的实际安装包;使用其他 profile 时替换 `desktop`。**安装或更新后,完整退出并重新打开 DSH**,让新插件生效。
|
|
@@ -145,7 +153,7 @@ pnpm install --frozen-lockfile
|
|
|
145
153
|
pnpm package:plugin
|
|
146
154
|
```
|
|
147
155
|
|
|
148
|
-
生成 `artifacts/dsh-deepseek-chat-0.1.
|
|
156
|
+
生成 `artifacts/dsh-deepseek-chat-0.1.19.tgz`,包含 Host、Client、类型声明、图标和 bundle patch。插件管理列表的图标位于 `assets/icon.svg`,替换后重新打包安装即可;SVG 须自包含且不超过 256 KiB。
|
|
149
157
|
|
|
150
158
|
修改源码后执行 `pnpm release:prepare`,并将源码与整个 `lib/` 一起提交。`pnpm check:distribution` 会检查编译产物与源码、版本及安装入口是否一致;旧产物或缺失文件会使检查失败。安装用户不需要执行这些开发命令。
|
|
151
159
|
|
|
@@ -154,3 +162,7 @@ pnpm package:plugin
|
|
|
154
162
|
```bash
|
|
155
163
|
dsh plugin --profile desktop remove dsh-deepseek-chat
|
|
156
164
|
```
|
|
165
|
+
|
|
166
|
+
## 已知问题:分享链接复制
|
|
167
|
+
|
|
168
|
+
CHAT 模式可以正常创建分享链接,但点击“创建并复制”或“复制”可能提示复制失败。DSH 桌面版内嵌浏览器会拒绝网页的剪贴板权限请求,目前没有提供开启此权限的配置项。遇到此问题,请选中完整链接,在 macOS 按 `⌘C`、Windows 按 `Ctrl+C` 手动复制。
|
package/lib/build-manifest.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"format": 1,
|
|
3
3
|
"name": "dsh-deepseek-chat",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.19",
|
|
5
5
|
"inputs": {
|
|
6
6
|
"assets/icon.svg": "8ea4f1d75f655c24e7f42fd5ed76763872d2c2c9d0661e14d64bcbc4dc5f84c8",
|
|
7
7
|
"cordis.patch.yml": "05edb71cd276de1251ae67644ec68b54efc26258814956fa0e932d36da741bdc",
|
|
8
|
-
"package.json": "
|
|
8
|
+
"package.json": "9a523a699158a0bd3144857b94dec8f68b2a358293484b9ee84c44dbdf1e66e3",
|
|
9
9
|
"pnpm-lock.yaml": "c4f600b0d599b85f6181d295cd5f9f06f1eb0435eeeb2e7cf1a376b3c6a4ca15",
|
|
10
10
|
"scripts/build.mjs": "715879e3c25382c35b06db2065b3b13815d1185aa4b9267b68a6257cacee30ec",
|
|
11
11
|
"scripts/check-artifact.mjs": "6fec38fb74e41dfeacef7147280c69854087d0665747d7d65137cc98f9dc673b",
|
|
@@ -19,20 +19,21 @@
|
|
|
19
19
|
"src/protocol.ts": "5194007a0c06f7b293cc34579ccdc150c23c35b825091667f37a7293594bd29f",
|
|
20
20
|
"src/server.ts": "295c52235fa399967a594b76b1f4c869adccc978ee3c0f3f8f3a12894b81ef9b",
|
|
21
21
|
"src/sidebar-adapter.ts": "83c2ce69a160cfeb8e4af6498d2233c150e8c1decdf4805288d56a9829835ad4",
|
|
22
|
-
"src/styles.ts": "
|
|
23
|
-
"src/ui.tsx": "
|
|
22
|
+
"src/styles.ts": "2ce32a9f1e9e263210875ee38c13f65ff3318a425c6ef6787d163b50d8670cbf",
|
|
23
|
+
"src/ui.tsx": "d4e9271b018ee68bd184237b9fc1c3ce10726cbc2afb15188fe8d52fec418d84",
|
|
24
24
|
"src/web-surface.tsx": "a13ec7ad7d151877d27e7cb79c80e6bf549cbd08f84a53eeadd56d4667419918",
|
|
25
25
|
"src/website-conversation-actions.ts": "558196cb6ad5c34b8cbffe1ebef4a77a8a0312cfc4bf275fa13c4d9aeaf02f0e",
|
|
26
26
|
"src/website-header.ts": "ac4972a28a5f0968de4d5f98d54fbac853f901c7eda00c0849984a2e66f291f3",
|
|
27
|
-
"src/website-navigation.ts": "
|
|
27
|
+
"src/website-navigation.ts": "7766736f8f9313b635ce06796509ad5ac7b96a312d43f36ad56c549032e17cb7",
|
|
28
28
|
"src/website-notice.ts": "65c781bec41e6c2e541d9512cc0051864d64fc3204b3ba5f2e005bdc955f39c9",
|
|
29
29
|
"src/website-session-store.ts": "8ef6d49465e0034f12b763a666b4a90c8c9819fb8baea06dcaba340fd97d72f1",
|
|
30
30
|
"src/website-session.ts": "f2434fafc40adb15b5f16fc8b6152bd8df7e85f5210330a1337502c9a08136d8",
|
|
31
31
|
"src/website-settings.ts": "adc9511be1d76e62d59a5e834dc561b8a2b8fdf6a877ecc865f5f0e840600fb2",
|
|
32
|
+
"src/website-sidebar-collapse.ts": "55483a2c5eb7ca46030147d968f83411c7936c537e46b75057ced223fe763c0b",
|
|
32
33
|
"tsconfig.json": "1ad0b3b39537564a180dc7f4084ceb3098b567f509320c77d71bc37aaf4f1879"
|
|
33
34
|
},
|
|
34
35
|
"artifacts": {
|
|
35
|
-
"lib/client.js": "
|
|
36
|
+
"lib/client.js": "678cc96e0ef7baffff0297fc06cc1a5679c5bfd741e02a89d456bcee201522bb",
|
|
36
37
|
"lib/index.js": "e9c50cc544f24c60d086538ab1283ae0ed2811f23c9bb469916a2e89c3ffb38d",
|
|
37
38
|
"lib/types/authorization.d.ts": "130649eed3635e75c3f50c13de93c52440a27f1b88136ab2297552570c013d49",
|
|
38
39
|
"lib/types/client.d.ts": "a79702d5d86c75e81f1e954b3e9f4a562a6b3082d68d798d6a1b37bd41b908a7",
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"lib/types/server.d.ts": "62b23f8f9fe9bb16a20274929876c1a34b3ab1e94179567e2e3a56cd67638288",
|
|
43
44
|
"lib/types/sidebar-adapter.d.ts": "5730bbeb661d8731620dc22397c8a8928209124b8d92d8b8549b6a84824e0518",
|
|
44
45
|
"lib/types/styles.d.ts": "c7434168512577eb1255158835dd6ea044413edd586844b21daf711ea2eeffec",
|
|
45
|
-
"lib/types/ui.d.ts": "
|
|
46
|
+
"lib/types/ui.d.ts": "79be011d99dc65f60118b0a026271a7a0f1087aad80ddcd40b4fe48d86cae30c",
|
|
46
47
|
"lib/types/web-surface.d.ts": "71686d72b4a5d6c619ee4ec916bbf7b853a87a7cc4d506fbfd0359191434984f",
|
|
47
48
|
"lib/types/website-conversation-actions.d.ts": "3bfea5b960e2e78ba6a03c060ff606a3b07293028843c481f8d8f3a41d733c19",
|
|
48
49
|
"lib/types/website-header.d.ts": "6379a35e7d35af3fb969802ee2cae969a104dbad937f7b9e371463a0bd7dea9d",
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
"lib/types/website-notice.d.ts": "2912746645e3e9facfe167c7b2b2eff584e3b812cab5e106afc7cb2b0259fc15",
|
|
51
52
|
"lib/types/website-session-store.d.ts": "bd641ab5e62ea4dd5f5cbfa823548a5c266c9701bca986fb348482ee69b2e0c0",
|
|
52
53
|
"lib/types/website-session.d.ts": "5ded232b24dd72e7b3c5f0ff505ba0aa818cbde14be7e2099bbbf262ec395a2b",
|
|
53
|
-
"lib/types/website-settings.d.ts": "d6d3dbf3e3bfce364a7778c2104224b0f8fbc64e9661d33ddc074bbafe77c733"
|
|
54
|
+
"lib/types/website-settings.d.ts": "d6d3dbf3e3bfce364a7778c2104224b0f8fbc64e9661d33ddc074bbafe77c733",
|
|
55
|
+
"lib/types/website-sidebar-collapse.d.ts": "3ec7a64053cc040050bdd606b390c4597266ce7e25652933c9756c9fb985f0d3"
|
|
54
56
|
}
|
|
55
57
|
}
|
package/lib/client.js
CHANGED
|
@@ -14761,8 +14761,8 @@ window.__ModuleLoader__.load({
|
|
|
14761
14761
|
.dsh-chat-brand-name{display:inline-flex;align-items:center;gap:6px;min-width:0;max-width:100%;flex:1;width:100%}
|
|
14762
14762
|
.dsh-chat-brand-wordmark{display:block;flex:0 1 102px;min-width:0;width:102px;height:24px;overflow:hidden}
|
|
14763
14763
|
.dsh-chat-brand-wordmark svg{display:block;width:156px;max-width:none;height:24px}
|
|
14764
|
-
.dsh-chat-brand-
|
|
14765
|
-
.dsh-chat-brand-control{position:
|
|
14764
|
+
.dsh-chat-brand-control-host{display:flex;align-items:center;width:112px;height:24px;flex:none;margin-left:auto;-webkit-app-region:no-drag}
|
|
14765
|
+
.dsh-chat-brand-control{position:relative;width:100%;height:24px;pointer-events:auto;display:flex;align-items:center;-webkit-app-region:no-drag}
|
|
14766
14766
|
.dsh-chat-brand-control .dsh-chat-modes{height:23px;min-height:23px;max-height:23px;padding:1px;border-radius:5px;gap:0;overflow:hidden}
|
|
14767
14767
|
.dsh-chat-brand-control .dsh-chat-mode-wrap,.dsh-chat-brand-control .dsh-chat-modes{width:100%}
|
|
14768
14768
|
.dsh-chat-brand-control .dsh-chat-modes button{flex:1}
|
|
@@ -14907,48 +14907,46 @@ window.__ModuleLoader__.load({
|
|
|
14907
14907
|
}
|
|
14908
14908
|
function DshChatBrandName({ bridge }) {
|
|
14909
14909
|
const name2 = (0, import_react.useRef)(null);
|
|
14910
|
-
const
|
|
14911
|
-
const [localAnchor, setLocalAnchor] = (0, import_react.useState)(null);
|
|
14910
|
+
const [controlHost, setControlHost] = (0, import_react.useState)(null);
|
|
14912
14911
|
(0, import_react.useLayoutEffect)(() => {
|
|
14913
|
-
const element = anchor.current;
|
|
14914
14912
|
const group = name2.current;
|
|
14915
|
-
if (!
|
|
14916
|
-
const
|
|
14917
|
-
|
|
14918
|
-
|
|
14913
|
+
if (!group) return;
|
|
14914
|
+
const host = document.createElement("span");
|
|
14915
|
+
host.className = "dsh-chat-brand-control-host";
|
|
14916
|
+
const reconcile = () => {
|
|
14917
|
+
if (!group.isConnected) {
|
|
14918
|
+
host.remove();
|
|
14919
|
+
return;
|
|
14920
|
+
}
|
|
14919
14921
|
bridge.attachSidebar(group);
|
|
14920
|
-
const
|
|
14921
|
-
const
|
|
14922
|
-
const
|
|
14923
|
-
|
|
14924
|
-
|
|
14922
|
+
const outlet = group.parentElement;
|
|
14923
|
+
const seat = outlet?.getAttribute("data-slot") === "sidebar.brand.name" ? outlet.parentElement : outlet;
|
|
14924
|
+
const identity = seat?.parentElement;
|
|
14925
|
+
const brand = identity?.parentElement;
|
|
14926
|
+
const row = brand?.parentElement;
|
|
14927
|
+
if (!identity || identity.getAttribute("aria-hidden") !== "true" || !brand || !row?.hasAttribute("data-window-drag")) {
|
|
14928
|
+
host.remove();
|
|
14929
|
+
return;
|
|
14930
|
+
}
|
|
14931
|
+
if (host.parentElement !== row || brand.nextElementSibling !== host) brand.after(host);
|
|
14925
14932
|
};
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
14930
|
-
|
|
14931
|
-
window.addEventListener("focus", measure);
|
|
14932
|
-
document.addEventListener("visibilitychange", measure);
|
|
14933
|
-
window.addEventListener("resize", measure);
|
|
14934
|
-
window.addEventListener("scroll", measure, true);
|
|
14933
|
+
reconcile();
|
|
14934
|
+
setControlHost(host);
|
|
14935
|
+
const observer = new MutationObserver(reconcile);
|
|
14936
|
+
observer.observe(host.parentElement?.parentElement ?? group, { childList: true, subtree: true });
|
|
14937
|
+
const styleRecovery = window.setInterval(() => ensureChatStyles(document), 250);
|
|
14935
14938
|
return () => {
|
|
14936
|
-
|
|
14937
|
-
window.clearInterval(
|
|
14938
|
-
|
|
14939
|
-
document.removeEventListener("visibilitychange", measure);
|
|
14940
|
-
window.removeEventListener("resize", measure);
|
|
14941
|
-
window.removeEventListener("scroll", measure, true);
|
|
14942
|
-
bridge.updateBrandAnchor(null, group);
|
|
14939
|
+
observer.disconnect();
|
|
14940
|
+
window.clearInterval(styleRecovery);
|
|
14941
|
+
host.remove();
|
|
14943
14942
|
};
|
|
14944
14943
|
}, [bridge]);
|
|
14945
14944
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
14946
14945
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { ref: name2, className: "dsh-chat-brand-name", children: [
|
|
14947
14946
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatStyles, {}),
|
|
14948
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatWordmark, {})
|
|
14949
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ref: anchor, className: "dsh-chat-brand-anchor" })
|
|
14947
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatWordmark, {})
|
|
14950
14948
|
] }),
|
|
14951
|
-
(0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatBrandControl, { bridge
|
|
14949
|
+
controlHost && (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatBrandControl, { bridge }), controlHost)
|
|
14952
14950
|
] });
|
|
14953
14951
|
}
|
|
14954
14952
|
function DshChatAuthorizationNotice({ bridge, state }) {
|
|
@@ -14958,16 +14956,9 @@ window.__ModuleLoader__.load({
|
|
|
14958
14956
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-chat-text-button", onClick: () => bridge.refreshAuthorization(), children: "\u91CD\u8BD5\u8FDE\u63A5" })
|
|
14959
14957
|
] });
|
|
14960
14958
|
}
|
|
14961
|
-
function DshChatBrandControl({ bridge
|
|
14959
|
+
function DshChatBrandControl({ bridge }) {
|
|
14962
14960
|
const state = useDshChat(bridge);
|
|
14963
|
-
|
|
14964
|
-
if (rect === null) return null;
|
|
14965
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-brand-control", "aria-label": "dsh-deepseek-chat \u6A21\u5F0F\u9009\u62E9", style: {
|
|
14966
|
-
left: rect.left,
|
|
14967
|
-
top: rect.top,
|
|
14968
|
-
width: rect.width,
|
|
14969
|
-
height: rect.height
|
|
14970
|
-
}, children: [
|
|
14961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-chat-brand-control", "aria-label": "dsh-deepseek-chat \u6A21\u5F0F\u9009\u62E9", children: [
|
|
14971
14962
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatStyles, {}),
|
|
14972
14963
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatModeSelector, { bridge, state }),
|
|
14973
14964
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DshChatAuthorizationNotice, { bridge, state }),
|
|
@@ -15280,6 +15271,58 @@ window.__ModuleLoader__.load({
|
|
|
15280
15271
|
var import_react_dom2 = require("react-dom");
|
|
15281
15272
|
var import_react2 = require("react");
|
|
15282
15273
|
|
|
15274
|
+
// src/website-sidebar-collapse.ts
|
|
15275
|
+
function collapseWebsiteSidebar(doc, track) {
|
|
15276
|
+
const attempt = "data-dsh-chat-native-collapse-attempt";
|
|
15277
|
+
if (doc.defaultView?.location.origin !== "https://chat.deepseek.com" || doc.documentElement.hasAttribute(attempt) || !track.hasAttribute("data-dsh-chat-navigation") || !track.querySelector('[data-dsh-chat-profile-confirmed="footer-v1"]')) return false;
|
|
15278
|
+
const sheet = doc.getElementById("dsh-chat-website-navigation-style")?.sheet;
|
|
15279
|
+
const originalStyle = track.getAttribute("style");
|
|
15280
|
+
const disabled = sheet?.disabled;
|
|
15281
|
+
try {
|
|
15282
|
+
track.style.setProperty("visibility", "hidden", "important");
|
|
15283
|
+
track.style.setProperty("pointer-events", "none", "important");
|
|
15284
|
+
if (sheet) sheet.disabled = true;
|
|
15285
|
+
const bounds = track.getBoundingClientRect();
|
|
15286
|
+
if (bounds.width < 160 || bounds.width > 480 || bounds.left < -1 || bounds.left > 16) return false;
|
|
15287
|
+
let controls = [...track.querySelectorAll('button,[role="button"],.ds-icon-button,.ds-button')].filter((el) => {
|
|
15288
|
+
const r = el.getBoundingClientRect();
|
|
15289
|
+
return r.top >= 0 && r.top <= 72 && r.width >= 12 && r.width <= 56 && r.height >= 12 && r.height <= 56 && (!el.textContent?.trim() || /^(收起侧边栏|关闭侧边栏|搜索|搜索对话|Collapse sidebar|Close sidebar|Hide sidebar|Search)$/i.test(el.textContent.trim())) && !!el.querySelector("svg") && !el.matches(':disabled,[aria-disabled="true"]');
|
|
15290
|
+
}).filter((el) => ![...track.querySelectorAll('button,[role="button"],.ds-icon-button,.ds-button')].some((other) => other !== el && el.contains(other)));
|
|
15291
|
+
if (controls.length === 0) {
|
|
15292
|
+
const candidates = [];
|
|
15293
|
+
for (const svg of track.querySelectorAll("svg")) {
|
|
15294
|
+
let el = svg.parentElement;
|
|
15295
|
+
for (let depth = 0; el && el !== track && depth < 4; depth++, el = el.parentElement) {
|
|
15296
|
+
const r = el.getBoundingClientRect();
|
|
15297
|
+
if (r.top >= 0 && r.top <= 72 && r.left >= bounds.right - 100 && r.right <= bounds.right + 1 && r.width >= 12 && r.width <= 56 && r.height >= 12 && r.height <= 56 && !el.textContent?.trim() && !el.querySelector("input,a[href]")) candidates.push(el);
|
|
15298
|
+
}
|
|
15299
|
+
}
|
|
15300
|
+
controls = [...new Set(candidates)].filter((el) => !candidates.some((other) => other !== el && other.contains(el)));
|
|
15301
|
+
}
|
|
15302
|
+
const named = controls.filter((el) => /^(收起侧边栏|关闭侧边栏|Collapse sidebar|Close sidebar|Hide sidebar)$/i.test(el.getAttribute("aria-label") || el.getAttribute("title") || el.textContent?.trim() || ""));
|
|
15303
|
+
let button = named.length === 1 ? named[0] : void 0;
|
|
15304
|
+
if (!button && controls.length === 2) {
|
|
15305
|
+
const ordered = controls.sort((a, b) => a.getBoundingClientRect().left - b.getBoundingClientRect().left);
|
|
15306
|
+
let header = ordered[1].parentElement;
|
|
15307
|
+
for (let depth = 0; header && header !== track && depth < 4; depth++, header = header.parentElement) {
|
|
15308
|
+
const r = header.getBoundingClientRect();
|
|
15309
|
+
if (header.contains(ordered[0]) && r.top >= 0 && r.top <= 32 && r.height <= 80 && header.querySelector("svg,img")) {
|
|
15310
|
+
button = ordered[1];
|
|
15311
|
+
break;
|
|
15312
|
+
}
|
|
15313
|
+
}
|
|
15314
|
+
}
|
|
15315
|
+
if (!button) return false;
|
|
15316
|
+
doc.documentElement.setAttribute(attempt, "true");
|
|
15317
|
+
button.click();
|
|
15318
|
+
return true;
|
|
15319
|
+
} finally {
|
|
15320
|
+
if (sheet && disabled !== void 0) sheet.disabled = disabled;
|
|
15321
|
+
if (originalStyle === null) track.removeAttribute("style");
|
|
15322
|
+
else track.setAttribute("style", originalStyle);
|
|
15323
|
+
}
|
|
15324
|
+
}
|
|
15325
|
+
|
|
15283
15326
|
// src/website-conversation-actions.ts
|
|
15284
15327
|
async function performWebsiteConversationAction(doc, command) {
|
|
15285
15328
|
const error51 = "\u6682\u65F6\u65E0\u6CD5\u6267\u884C\u8BE5\u5BF9\u8BDD\u64CD\u4F5C\uFF0C\u8BF7\u5237\u65B0\u5217\u8868\u540E\u91CD\u8BD5\u3002";
|
|
@@ -15734,7 +15777,7 @@ window.__ModuleLoader__.load({
|
|
|
15734
15777
|
const conversationError = "\u8BE5\u5BF9\u8BDD\u4E0D\u5728\u5F53\u524D\u5B98\u7F51\u5217\u8868\uFF0C\u8BF7\u5237\u65B0\u5217\u8868\u3002";
|
|
15735
15778
|
const styleId = "dsh-chat-website-navigation-style";
|
|
15736
15779
|
const preparingStyleId = "dsh-chat-website-preparing-style";
|
|
15737
|
-
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"];
|
|
15780
|
+
const owned = [marker, presentedMarker, missingSidebarMarker, fallbackMarker, fallbackErrorMarker, profileMarker, profileProofMarker, profileAvatarMarker, navigationWidthMarker, expandingMarker, compactToggleMarker, "data-dsh-chat-native-collapse-attempt", "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"];
|
|
15738
15781
|
const empty = (status) => ({ status, ...status === "sign-in" ? { authenticated: false } : {}, conversations: [], selectedHref: null, canCreate: false, error: null });
|
|
15739
15782
|
const clearSettings = (preserveConfirmedPreferences = false) => {
|
|
15740
15783
|
const confirmed = ["data-dsh-chat-language", "data-dsh-chat-theme", "data-dsh-chat-dark-complete", "data-dsh-chat-settings-restored"];
|
|
@@ -16066,6 +16109,7 @@ window.__ModuleLoader__.load({
|
|
|
16066
16109
|
doc.head.append(style);
|
|
16067
16110
|
}
|
|
16068
16111
|
if (style.textContent !== styleText) style.textContent = styleText;
|
|
16112
|
+
if (authenticated === true && command.type === "snapshot" && !command.showOriginal) collapseWebsiteSidebar(doc, track);
|
|
16069
16113
|
}
|
|
16070
16114
|
const selected = conversations.find((item) => item.href === safeHref(page.pathname));
|
|
16071
16115
|
if (!(command.type === "snapshot" && command.showOriginal)) adaptWebsiteHeader(doc, content, selected?.title ?? null, command.type === "snapshot" ? command.headerInset ?? (Number.parseInt(settingsRoot.style.getPropertyValue("--dsh-chat-title-inset")) || 24) : Number.parseInt(settingsRoot.style.getPropertyValue("--dsh-chat-title-inset")) || 24);
|
|
@@ -16078,8 +16122,8 @@ window.__ModuleLoader__.load({
|
|
|
16078
16122
|
}
|
|
16079
16123
|
function websiteCommandScript(command) {
|
|
16080
16124
|
if (command.type === "refresh") throw new Error("Website refresh must be handled by the guest owner");
|
|
16081
|
-
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-
|
|
16082
|
-
return `(() => { const adaptWebsiteSettings = ${adaptWebsiteSettings.toString()}; const adaptWebsiteHeader = ${adaptWebsiteHeader.toString()}; const dismissWebsiteEnvironmentNotice = ${dismissWebsiteEnvironmentNotice.toString()}; return (${adaptWebsiteNavigation.toString()})(document,location,${JSON.stringify(command)}); })()`;
|
|
16125
|
+
if (command.type === "conversation-action") return `(async () => { const collapseWebsiteSidebar = ${collapseWebsiteSidebar.toString()}; 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}); })()`;
|
|
16126
|
+
return `(() => { const collapseWebsiteSidebar = ${collapseWebsiteSidebar.toString()}; const adaptWebsiteSettings = ${adaptWebsiteSettings.toString()}; const adaptWebsiteHeader = ${adaptWebsiteHeader.toString()}; const dismissWebsiteEnvironmentNotice = ${dismissWebsiteEnvironmentNotice.toString()}; return (${adaptWebsiteNavigation.toString()})(document,location,${JSON.stringify(command)}); })()`;
|
|
16083
16127
|
}
|
|
16084
16128
|
function parseWebsiteNavigation(value) {
|
|
16085
16129
|
if (!value || typeof value !== "object") throw new Error("Invalid navigation response");
|
package/lib/types/ui.d.ts
CHANGED
|
@@ -81,12 +81,10 @@ export declare function DshChatModeSelector({ bridge, state, compact }: DshChatB
|
|
|
81
81
|
readonly state: DshChatViewState;
|
|
82
82
|
readonly compact?: boolean;
|
|
83
83
|
}): import("react/jsx-runtime").JSX.Element;
|
|
84
|
-
/**
|
|
84
|
+
/** Keep interactive controls in the sidebar row, outside its decorative/new-chat brand. */
|
|
85
85
|
export declare function DshChatBrandName({ bridge }: PropsRuntime<'sidebar.brand.name'> & DshChatBridgeProps): import("react/jsx-runtime").JSX.Element;
|
|
86
86
|
/** The interactive surface is outside the brand slot's hidden/button ancestry. */
|
|
87
|
-
export declare function DshChatBrandControl({ bridge
|
|
88
|
-
readonly rect?: DshChatViewportRect | null;
|
|
89
|
-
}): import("react/jsx-runtime").JSX.Element | null;
|
|
87
|
+
export declare function DshChatBrandControl({ bridge }: DshChatBridgeProps): import("react/jsx-runtime").JSX.Element;
|
|
90
88
|
/** rc.2 replays its retained request counter on WorkspaceBrowser remount.
|
|
91
89
|
* Adapt only the view hook; never mutate the host request store or actions. */
|
|
92
90
|
export declare function guardHarnessSearchReplay(entry: StoredEntry): (() => void) | null;
|