@jaychang1989/dsh-webchat 0.4.1 → 0.4.2
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/NOTICE +18 -17
- package/README.en.md +88 -0
- package/README.md +50 -45
- package/cordis.patch.yml +3 -5
- package/lib/index.js +50 -10
- package/package.json +3 -3
- package/README.zh.md +0 -83
package/NOTICE
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
dsh-webchat
|
|
2
2
|
Copyright 2026 jaychang1989
|
|
3
3
|
|
|
4
|
-
This
|
|
4
|
+
This package is a fork of dsh-web-chat
|
|
5
5
|
(https://github.com/xmuwenxiang/dsh-web-chat), Copyright the dsh-web-chat
|
|
6
|
-
authors, licensed under the Apache License, Version 2.0.
|
|
6
|
+
authors, licensed under the Apache License, Version 2.0. A copy of that license
|
|
7
|
+
is in LICENSE.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
Reused from that project, and the reason this notice exists:
|
|
9
10
|
|
|
10
|
-
* the
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(`sessionPersistence.open` / `create` + handle `read` / `append` / `flush`)
|
|
16
|
-
instead of the retired service-level `load` / `append` pair.
|
|
11
|
+
* the plugin scaffolding — the dual-half packaging (a host half plus a
|
|
12
|
+
`dsh.client` browser half), the `cordis.patch.yml` bundle row, and the
|
|
13
|
+
`window.__ModuleLoader__.load` form of the emitted client bundle;
|
|
14
|
+
* the approach to injecting a sidebar entry row at the DOM level, with its
|
|
15
|
+
self-healing MutationObservers, and the base styling that came with it.
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
chat.deepseek.com web app in a window instead of driving the page and
|
|
20
|
-
re-rendering the conversation. The custom chat panel, the local transcript
|
|
21
|
-
store, the five `webchat_*` agent tools, the transfer/distillation code and
|
|
22
|
-
thirteen of the fifteen HTTP routes were removed, along with the
|
|
23
|
-
`playwright-core` runtime dependency and the React-based client build.
|
|
17
|
+
Written here:
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
* the launcher behaviour — opening the official chat.deepseek.com page in a
|
|
20
|
+
window, the three window strategies and their ordering;
|
|
21
|
+
* the entry-as-action interaction (the entry itself opens the page, with the
|
|
22
|
+
busy state and the result toast);
|
|
23
|
+
* the host routes, the tests and this documentation.
|
|
24
|
+
|
|
25
|
+
The package no longer drives the page, stores transcripts, exposes agent tools
|
|
26
|
+
or reimplements a chat interface.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# dsh-webchat
|
|
2
|
+
|
|
3
|
+
[简体中文](./README.md) | **English**
|
|
4
|
+
|
|
5
|
+
Opens the official [chat.deepseek.com](https://chat.deepseek.com) web app from [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) in one click.
|
|
6
|
+
|
|
7
|
+
**One sidebar entry. Click it, and the official page opens in a window.**
|
|
8
|
+
|
|
9
|
+
That is the whole plugin. No chat UI, no transcript store, no agent tools — the official web app already is the client: model picker, deep think, smart search, history and attachments all live there.
|
|
10
|
+
|
|
11
|
+
## Why it opens a window instead of a pane
|
|
12
|
+
|
|
13
|
+
Three routes are closed, and these are measurements rather than preferences:
|
|
14
|
+
|
|
15
|
+
| Route | Measured result |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| `<iframe>` | `chat.deepseek.com` answers with `Content-Security-Policy: frame-ancestors 'none'`, so the browser refuses to render it in a frame |
|
|
18
|
+
| Electron `<webview>` | both desktop windows run with `webviewTag: false`, and `will-attach-webview` is explicitly blocked |
|
|
19
|
+
| The desktop app's own `WebContentsView` | reserved for platform pages (account/top-up) with navigation pinned to that origin; not reachable from a plugin |
|
|
20
|
+
|
|
21
|
+
A real window is therefore the only faithful way to show the official page.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
dsh plugin --profile desktop add @jaychang1989/dsh-webchat
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or straight from this repository:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
dsh plugin --profile desktop add github:jaychang1989/dsh-webchat
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
> The npm package is scoped because the unscoped `dsh-webchat` name is taken. The scope does not change the plugin's identity: the entry id stays `webchat`.
|
|
36
|
+
|
|
37
|
+
**Restart the desktop app after installing.**
|
|
38
|
+
|
|
39
|
+
## Use
|
|
40
|
+
|
|
41
|
+
1. Click the "DeepSeek 网页 / DeepSeek Web" entry in the sidebar.
|
|
42
|
+
2. Sign in to DeepSeek once in the window it opens; the session is kept afterwards.
|
|
43
|
+
|
|
44
|
+
A short toast in the corner reports the outcome.
|
|
45
|
+
|
|
46
|
+
## How it opens the page
|
|
47
|
+
|
|
48
|
+
Tried in order; the first that works wins, and the toast tells you which one it was:
|
|
49
|
+
|
|
50
|
+
1. **App window** — a window created by the DSH desktop process itself (the desktop app is Electron). An already-open one is focused instead of duplicated.
|
|
51
|
+
2. **Chromeless window** — Edge/Chrome in `--app=` mode with its own `--user-data-dir` (`~/.dsh/dsh-webchat/app-window`), so its login stays separate from your everyday browser. Used when (1) cannot reach Electron.
|
|
52
|
+
3. **System browser** — the fallback, so a click always does something.
|
|
53
|
+
|
|
54
|
+
None of the three needs configuration.
|
|
55
|
+
|
|
56
|
+
## Requirements
|
|
57
|
+
|
|
58
|
+
- DeepSeek Harness **0.2.0-rc.1 or a newer 0.2.x**
|
|
59
|
+
- Node.js >= 22
|
|
60
|
+
- Strategy 2 needs Edge or Chrome installed; strategy 1 does not
|
|
61
|
+
|
|
62
|
+
## Known limitations
|
|
63
|
+
|
|
64
|
+
- The DeepSeek web front end has its own rate limiting and sign-in flow; the plugin only hands the page over and does not mediate its requests.
|
|
65
|
+
- A strategy-1 window is owned by the DSH process: if you close the DSH main window while it is still open, DSH will not quit (Electron's `window-all-closed`). Close that window too.
|
|
66
|
+
- Reloading the plugin does not close a window that is already open — otherwise a settings change would close the conversation you are reading.
|
|
67
|
+
|
|
68
|
+
## Troubleshooting
|
|
69
|
+
|
|
70
|
+
| Symptom | Cause / fix |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| The toast says `HTTP 404` | The host half in memory is an older version (the host half loads once per process; the client half is re-fetched on every page load). **Restart the desktop app** |
|
|
73
|
+
| The toast says it handed the page to the system browser | Strategies 1 and 2 were both unavailable — check whether the host refused a window, or whether Edge/Chrome is installed |
|
|
74
|
+
| The entry is missing from the sidebar | Check that `@jaychang1989/dsh-webchat` is in the profile's `dsh.profile.bundles`, then restart the desktop app |
|
|
75
|
+
|
|
76
|
+
## Development and tests
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
node --test
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Thirteen cases: the host's two routes and its window-strategy selection, plus the browser half executed against a DOM stand-in (it mounts the entry, posts to the right route on click, and reports success, handoff and failure honestly).
|
|
83
|
+
|
|
84
|
+
There is no build step — `lib/index.js` and `lib/client.js` are the hand-written runtime, and the package has **zero runtime dependencies**. See [MAINTAINING.md](./MAINTAINING.md) (Chinese).
|
|
85
|
+
|
|
86
|
+
## Origin and license
|
|
87
|
+
|
|
88
|
+
[Apache-2.0](./LICENSE). This package started as a fork of [xmuwenxiang/dsh-web-chat](https://github.com/xmuwenxiang/dsh-web-chat): it reuses that project's plugin scaffolding (the dual-half packaging, the `cordis.patch.yml` row, the `window.__ModuleLoader__.load` bundle form) and its approach to injecting a sidebar entry, while the current behaviour — the window strategies, the entry-as-action, the toast — is new. See [NOTICE](./NOTICE) for the copyright and license statements.
|
package/README.md
CHANGED
|
@@ -1,83 +1,88 @@
|
|
|
1
1
|
# dsh-webchat
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**简体中文** | [English](./README.en.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 里一键打开 [chat.deepseek.com](https://chat.deepseek.com) 官方网页版。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**侧边栏一个入口,点一下,官方页面就开在一个窗口里。**
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
仅此而已。不做聊天界面,不做会话存储,不做 agent 工具——官方网页版本身就是完整的客户端,模型选择、深度思考、智能搜索、历史记录、附件上传都在里面。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
- the desktop build runs both windows with **`webviewTag: false`** and blocks `will-attach-webview`, so `<webview>` is unavailable too.
|
|
11
|
+
## 为什么不嵌在面板里
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
三条路都被封死,这是实测结果而不是取舍:
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
2. **`app-window-shell`** — a chromeless Edge/Chrome window (`--app=`) with its own `--user-data-dir` (`~/.dsh/dsh-webchat/app-window`), so its login stays separate from your everyday browser. Used when the host refuses (1).
|
|
22
|
-
3. **`system-browser`** — handed to the OS default browser, so the button always does something.
|
|
15
|
+
| 方式 | 实测结果 |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| `<iframe>` | `chat.deepseek.com` 返回 `Content-Security-Policy: frame-ancestors 'none'`,浏览器直接拒绝渲染 |
|
|
18
|
+
| Electron `<webview>` | 桌面端两个窗口都是 `webviewTag: false`,且 `will-attach-webview` 被显式拦截 |
|
|
19
|
+
| 桌面端内置的 `WebContentsView` | 只服务平台页面(账号/充值),导航被限制在该 origin,第三方插件拿不到 |
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
所以忠实呈现官方页面的唯一方式,就是开一个真实窗口。
|
|
25
22
|
|
|
26
|
-
##
|
|
23
|
+
## 安装
|
|
27
24
|
|
|
28
25
|
```bash
|
|
29
26
|
dsh plugin --profile desktop add @jaychang1989/dsh-webchat
|
|
30
27
|
```
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
或直接从仓库安装:
|
|
33
30
|
|
|
34
31
|
```bash
|
|
35
32
|
dsh plugin --profile desktop add github:jaychang1989/dsh-webchat
|
|
36
33
|
```
|
|
37
34
|
|
|
38
|
-
>
|
|
35
|
+
> npm 包名带 scope,因为不带 scope 的 `dsh-webchat` 已被占用。scope 不影响插件身份:entry id 仍是 `webchat`。
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
安装后**重启桌面端**。
|
|
41
38
|
|
|
42
|
-
##
|
|
39
|
+
## 使用
|
|
43
40
|
|
|
44
|
-
1.
|
|
45
|
-
2.
|
|
41
|
+
1. 点侧边栏的「DeepSeek 网页」入口;
|
|
42
|
+
2. 在弹出的窗口里登录一次 DeepSeek,之后登录态会保留。
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
点击后右下角会有一条短提示说明结果。
|
|
48
45
|
|
|
49
|
-
##
|
|
46
|
+
## 它怎么打开页面
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
| Local transcript store at `~/.dsh/dsh-webchat/transcripts.json` | Removed (only the window profile directory remains) |
|
|
57
|
-
| Fifteen `/api/dsh-webchat/*` routes | Two: `state` and `open` |
|
|
58
|
-
| Depended on `playwright-core`; the client half needed React and a bundler | **No runtime dependencies**; plain-DOM client, no build step |
|
|
59
|
-
| ~3800 lines of build output | ~700 lines of hand-written JS |
|
|
48
|
+
按顺序尝试,第一个成功的生效,提示条会告诉你实际用了哪一种:
|
|
49
|
+
|
|
50
|
+
1. **应用窗口** —— 由 DSH 桌面端进程自己创建的窗口(桌面端就是 Electron)。已经开着就聚焦,不会重复开。
|
|
51
|
+
2. **无边框窗口** —— Edge/Chrome 的 `--app=` 模式,使用独立 `--user-data-dir`(`~/.dsh/dsh-webchat/app-window`),因此登录态与你日常浏览器互不干扰。用于第 1 种拿不到 Electron 的场景。
|
|
52
|
+
3. **系统默认浏览器** —— 兜底,保证点击一定有反应。
|
|
60
53
|
|
|
61
|
-
|
|
54
|
+
三种都不需要额外配置。
|
|
62
55
|
|
|
63
|
-
|
|
56
|
+
## 环境要求
|
|
57
|
+
|
|
58
|
+
- DeepSeek Harness **0.2.0-rc.1 或更新的 0.2.x**
|
|
64
59
|
- Node.js >= 22
|
|
65
|
-
-
|
|
60
|
+
- 第 2 种方式需要本机装有 Edge 或 Chrome;第 1 种不需要
|
|
61
|
+
|
|
62
|
+
## 已知限制
|
|
66
63
|
|
|
67
|
-
|
|
64
|
+
- 官方网页端有它自己的风控和登录流程,插件只负责把页面交出去,不介入其请求。
|
|
65
|
+
- 第 1 种方式创建的窗口由 DSH 进程拥有:如果你先关掉 DSH 主窗口、而它仍开着,DSH 不会退出(Electron 的 `window-all-closed` 语义)。把它一起关掉即可。
|
|
66
|
+
- 插件被重载时不会主动关闭已经打开的窗口——否则一次设置变更就会把你正在看的会话关掉。
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
- A strategy-1 window is owned by the DSH process: if you close the DSH main window while it is still open, DSH will not quit (Electron's `window-all-closed`). Close that window too.
|
|
71
|
-
- Reloading the plugin does not close a window that is already open, so a settings change cannot close the conversation you are reading.
|
|
68
|
+
## 排查
|
|
72
69
|
|
|
73
|
-
|
|
70
|
+
| 现象 | 原因 / 处理 |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| 提示条显示 `HTTP 404` | 宿主的旧版本还在内存里(宿主半区只在进程启动时加载,客户端半区每次刷新页面重新取)。**重启桌面端**即可 |
|
|
73
|
+
| 提示条显示「已交给系统默认浏览器打开」 | 前两种方式都不可用;看窗口是否被宿主拒绝,或本机没装 Edge/Chrome |
|
|
74
|
+
| 入口没出现在侧边栏 | 确认 profile 的 `dsh.profile.bundles` 里有 `@jaychang1989/dsh-webchat`,并重启桌面端 |
|
|
75
|
+
|
|
76
|
+
## 开发与测试
|
|
74
77
|
|
|
75
78
|
```bash
|
|
76
|
-
node --test
|
|
79
|
+
node --test
|
|
77
80
|
```
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
13 个用例:宿主两条路由与窗口策略选择,以及浏览器半区在 DOM 桩里真实执行(挂载入口、点击后请求正确路由、成功/兜底/失败是否都如实提示)。
|
|
83
|
+
|
|
84
|
+
没有构建步骤——`lib/index.js` 与 `lib/client.js` 就是手写的运行时代码,包内**零运行时依赖**。细节见 [MAINTAINING.md](./MAINTAINING.md)。
|
|
80
85
|
|
|
81
|
-
##
|
|
86
|
+
## 来源与许可
|
|
82
87
|
|
|
83
|
-
[Apache-2.0](./LICENSE)
|
|
88
|
+
[Apache-2.0](./LICENSE)。本包最初由 [xmuwenxiang/dsh-web-chat](https://github.com/xmuwenxiang/dsh-web-chat) 分叉而来:沿用了它的插件骨架(双半区打包、`cordis.patch.yml` 行、浏览器 bundle 的 `window.__ModuleLoader__.load` 形式)与侧边栏入口的 DOM 注入思路,当前功能(打开官方页面的窗口策略、入口即动作、提示条)是新写的。版权与许可声明见 [NOTICE](./NOTICE)。
|
package/cordis.patch.yml
CHANGED
|
@@ -13,11 +13,9 @@
|
|
|
13
13
|
# manifest name verbatim (scoped names included) — dsh-client-modules keys every
|
|
14
14
|
# browser row by it, and lib/client.js registers its factory under the same id.
|
|
15
15
|
# `id` is the profile entry id; dsh >= 0.1.7 also uses it as the settings form
|
|
16
|
-
# namespace, so keep it stable.
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
# `id: webchat`. Do not keep both installed in one profile — a duplicate entry
|
|
20
|
-
# id is rejected at boot.
|
|
16
|
+
# namespace, so keep it stable. It must be unique per profile: a second package
|
|
17
|
+
# inserting the same `webchat` id cannot be installed alongside this one — the
|
|
18
|
+
# duplicate is rejected at boot.
|
|
21
19
|
- insert:
|
|
22
20
|
- id: webchat
|
|
23
21
|
name: '@jaychang1989/dsh-webchat'
|
package/lib/index.js
CHANGED
|
@@ -28,8 +28,16 @@
|
|
|
28
28
|
|
|
29
29
|
import { spawn } from 'node:child_process'
|
|
30
30
|
import { existsSync } from 'node:fs'
|
|
31
|
+
import { createRequire } from 'node:module'
|
|
31
32
|
import { join } from 'node:path'
|
|
32
33
|
|
|
34
|
+
/**
|
|
35
|
+
* A CommonJS `require` anchored at this module. Electron hands `electron` to
|
|
36
|
+
* CJS natively, while the harness's ESM loader resolves bare specifiers itself
|
|
37
|
+
* — which is why the ESM import below is tried first and this is the fallback.
|
|
38
|
+
*/
|
|
39
|
+
const requireHere = createRequire(import.meta.url)
|
|
40
|
+
|
|
33
41
|
/** Stable cordis plugin name. */
|
|
34
42
|
export const name = 'webchat'
|
|
35
43
|
|
|
@@ -65,6 +73,9 @@ function windowSlot() {
|
|
|
65
73
|
/** Last open attempt, reported to the panel. */
|
|
66
74
|
let lastAttempt = { ok: false, via: 'none', error: '', at: 0 }
|
|
67
75
|
|
|
76
|
+
/** Every strategy's outcome from the most recent open, oldest first. */
|
|
77
|
+
let lastAttempts = []
|
|
78
|
+
|
|
68
79
|
/**
|
|
69
80
|
* Remember one attempt.
|
|
70
81
|
* @param ok - whether the page was opened.
|
|
@@ -77,19 +88,41 @@ function record(ok, via, error = '') {
|
|
|
77
88
|
return lastAttempt
|
|
78
89
|
}
|
|
79
90
|
|
|
91
|
+
/** Render any thrown value as a message. */
|
|
92
|
+
function messageOf(error) {
|
|
93
|
+
return error instanceof Error ? error.message : String(error)
|
|
94
|
+
}
|
|
95
|
+
|
|
80
96
|
/**
|
|
81
|
-
* Load Electron lazily. A plugin that cannot reach it must still
|
|
82
|
-
*
|
|
83
|
-
* strategy instead of killing the entry at import time.
|
|
97
|
+
* Load Electron lazily, two ways. A plugin that cannot reach it must still
|
|
98
|
+
* load, and the probe stays inside the call so a failure falls through to the
|
|
99
|
+
* next strategy instead of killing the entry at import time.
|
|
100
|
+
*
|
|
101
|
+
* The ESM import is tried first because it is the honest form; the harness's
|
|
102
|
+
* loader resolves bare specifiers itself and does not always hand `electron`
|
|
103
|
+
* to Electron's own resolver, so a CommonJS require — which Electron serves
|
|
104
|
+
* natively — is the fallback.
|
|
84
105
|
* @returns the Electron module.
|
|
85
|
-
* @throws when
|
|
106
|
+
* @throws with every probe failure joined, when neither path yields a window API.
|
|
86
107
|
*/
|
|
87
108
|
async function electronApi() {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
109
|
+
const usable = (mod) => (mod !== null && typeof mod === 'object' && mod.BrowserWindow !== undefined ? mod : undefined)
|
|
110
|
+
const failures = []
|
|
111
|
+
try {
|
|
112
|
+
const fromImport = usable(await import('electron'))
|
|
113
|
+
if (fromImport !== undefined) return fromImport
|
|
114
|
+
failures.push('esm import resolved but exposed no BrowserWindow')
|
|
115
|
+
} catch (error) {
|
|
116
|
+
failures.push(`esm import failed: ${messageOf(error)}`)
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
const fromRequire = usable(requireHere('electron'))
|
|
120
|
+
if (fromRequire !== undefined) return fromRequire
|
|
121
|
+
failures.push('cjs require resolved but exposed no BrowserWindow')
|
|
122
|
+
} catch (error) {
|
|
123
|
+
failures.push(`cjs require failed: ${messageOf(error)}`)
|
|
91
124
|
}
|
|
92
|
-
|
|
125
|
+
throw new Error(failures.join(' | '))
|
|
93
126
|
}
|
|
94
127
|
|
|
95
128
|
/** Windows chromeless-window executables, in preference order. */
|
|
@@ -192,15 +225,21 @@ export const OPEN_STRATEGIES = [
|
|
|
192
225
|
* @returns the recorded attempt: ok, the winning `via`, or the last error.
|
|
193
226
|
*/
|
|
194
227
|
export async function openPage(strategies = OPEN_STRATEGIES) {
|
|
228
|
+
const attempts = []
|
|
195
229
|
let failure = { via: 'none', error: 'no strategy was tried' }
|
|
196
230
|
for (const strategy of strategies) {
|
|
197
231
|
try {
|
|
198
232
|
const detail = await strategy.run()
|
|
199
|
-
|
|
233
|
+
const via = typeof detail === 'string' && detail !== '' ? detail : strategy.via
|
|
234
|
+
attempts.push({ via: strategy.via, ok: true, error: '' })
|
|
235
|
+
lastAttempts = attempts
|
|
236
|
+
return record(true, via)
|
|
200
237
|
} catch (error) {
|
|
201
|
-
failure = { via: strategy.via, error:
|
|
238
|
+
failure = { via: strategy.via, error: messageOf(error) }
|
|
239
|
+
attempts.push({ via: strategy.via, ok: false, error: failure.error })
|
|
202
240
|
}
|
|
203
241
|
}
|
|
242
|
+
lastAttempts = attempts
|
|
204
243
|
return record(false, failure.via, failure.error)
|
|
205
244
|
}
|
|
206
245
|
|
|
@@ -229,6 +268,7 @@ export function apply(ctx) {
|
|
|
229
268
|
url: PAGE_URL,
|
|
230
269
|
appWindowOpen: slot.current !== null && slot.current.isDestroyed() === false,
|
|
231
270
|
last: lastAttempt,
|
|
271
|
+
attempts: lastAttempts,
|
|
232
272
|
})
|
|
233
273
|
},
|
|
234
274
|
}), 'dsh-webchat: state route')
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaychang1989/dsh-webchat",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Opens the official DeepSeek web app (chat.deepseek.com) in a window from
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"description": "Opens the official DeepSeek web app (chat.deepseek.com) in a window from DeepSeek Harness: one sidebar entry that opens the page directly, so the official client keeps its model picker, deep think, smart search, history and attachments. No chat UI, no agent tools, no runtime dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
7
7
|
"deepseek-harness",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"cordis.patch.yml",
|
|
57
57
|
"NOTICE",
|
|
58
58
|
"README.md",
|
|
59
|
-
"README.
|
|
59
|
+
"README.en.md"
|
|
60
60
|
],
|
|
61
61
|
"scripts": {
|
|
62
62
|
"test": "node --test"
|
package/README.zh.md
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# dsh-webchat
|
|
2
|
-
|
|
3
|
-
在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 里打开 [chat.deepseek.com](https://chat.deepseek.com) 官方网页版:侧边栏一个入口,**点一下就直接打开官方页面**。
|
|
4
|
-
|
|
5
|
-
**不再重新实现聊天界面。** 官方网页版本身就是完整的客户端——模型选择、深度思考、智能搜索、历史记录、附件上传都在里面。本插件只负责把它打开,别的一概不管。
|
|
6
|
-
|
|
7
|
-
## 为什么是「开一个窗口」,而不是「嵌在面板里」
|
|
8
|
-
|
|
9
|
-
两条路都被封死了,这是实测结论而非选择:
|
|
10
|
-
|
|
11
|
-
- `chat.deepseek.com` 返回 **`Content-Security-Policy: frame-ancestors 'none'`** —— 任何 iframe 嵌入都会被浏览器拒绝;
|
|
12
|
-
- DSH 桌面端两个窗口都是 **`webviewTag: false`**,且 `will-attach-webview` 被显式拦截 —— `<webview>` 也不可用。
|
|
13
|
-
|
|
14
|
-
所以忠实呈现官方页面的唯一方式就是开一个真实窗口。
|
|
15
|
-
|
|
16
|
-
## 打开顺序
|
|
17
|
-
|
|
18
|
-
点击入口后会按顺序尝试,第一个成功的生效,结果用一条短提示告诉你实际用了哪种:
|
|
19
|
-
|
|
20
|
-
1. **`app-window`** —— 由 DSH 桌面端进程直接创建的窗口(桌面端就是 Electron)。已经开着就聚焦,不会重复开第二个。
|
|
21
|
-
2. **`app-window-shell`** —— 无边框的 Edge/Chrome 窗口(`--app=`),使用独立 `--user-data-dir`(`~/.dsh/dsh-webchat/app-window`),因此登录态与你的日常浏览器互不干扰。用于第 1 种被宿主拒绝的场景。
|
|
22
|
-
3. **`system-browser`** —— 交给操作系统默认浏览器,保证按钮任何时候都有反应。
|
|
23
|
-
|
|
24
|
-
登录一次即可:窗口自己的 profile 会保留登录态。
|
|
25
|
-
|
|
26
|
-
## 安装
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
dsh plugin --profile desktop add @jaychang1989/dsh-webchat
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
或直接从仓库安装:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
dsh plugin --profile desktop add github:jaychang1989/dsh-webchat
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
> npm 包名带 scope,因为不带 scope 的 `dsh-webchat` 属于已停止维护的上游项目。scope 不影响插件身份:entry id 仍是 `webchat`。
|
|
39
|
-
|
|
40
|
-
**从上游或本插件 0.3.x 切换过来时**:它们都插入 `id: webchat` 这一行,同一个 profile 里不能并存(entry id 重复会在启动时报错)。先移除旧的再加新的,然后重启桌面端。
|
|
41
|
-
|
|
42
|
-
## 使用
|
|
43
|
-
|
|
44
|
-
1. 点侧边栏的「DeepSeek 网页」入口 —— 页面直接打开,不需要再点第二次;
|
|
45
|
-
2. 在弹出的窗口里登录一次,之后正常使用官方网页版。
|
|
46
|
-
|
|
47
|
-
点击后右下角会有一条短提示说明结果:`已打开 DeepSeek 网页` / `已交给系统默认浏览器打开` / 失败原因(例如 `HTTP 404`,通常意味着宿主半区还是旧版本,重启桌面端即可)。
|
|
48
|
-
|
|
49
|
-
## 与 0.3.x 的差异(这是一次大幅删减)
|
|
50
|
-
|
|
51
|
-
| 0.3.x | 0.4.0 |
|
|
52
|
-
| --- | --- |
|
|
53
|
-
| 用 Playwright 驱动网页,自研聊天面板重新渲染消息 | 不再驱动网页,直接开官方页面;自研面板删除 |
|
|
54
|
-
| 5 个 agent 工具(`webchat_status/send/recover/import/transfer`) | 全部删除 |
|
|
55
|
-
| 「转移到 harness」「从网页恢复」「导入」「导出」 | 全部删除 |
|
|
56
|
-
| 本地会话存储 `~/.dsh/dsh-webchat/transcripts.json` | 删除(只留窗口 profile 目录) |
|
|
57
|
-
| 15 条 `/api/dsh-webchat/*` 路由 | 只剩 2 条:`state` / `open` |
|
|
58
|
-
| 依赖 `playwright-core`,客户端产物需 React + 构建器 | **零运行时依赖**,客户端为纯 DOM,无构建步骤 |
|
|
59
|
-
| 约 3800 行(构建产物) | 约 700 行(手写 JS) |
|
|
60
|
-
|
|
61
|
-
## 环境要求
|
|
62
|
-
|
|
63
|
-
- DeepSeek Harness **0.2.0-rc.1 或更新的 0.2.x**
|
|
64
|
-
- Node.js >= 22
|
|
65
|
-
- 第 2 种策略(无边框窗口)需要本机装有 Edge 或 Chrome;第 1 种策略不需要
|
|
66
|
-
|
|
67
|
-
## 限制
|
|
68
|
-
|
|
69
|
-
- 官方网页端受 DeepSeek 官方风控;页面打不开时插件只负责把页面交出去,不介入其登录或请求。
|
|
70
|
-
- 第 1 种策略创建的窗口由 DSH 进程拥有:若你先关掉 DSH 主窗口、而它仍开着,DSH 不会退出(Electron 的 `window-all-closed` 语义)。关掉该窗口即可。
|
|
71
|
-
- 插件被重载时不会主动关闭已经打开的窗口(避免一次设置变更就关掉你正在看的会话)。
|
|
72
|
-
|
|
73
|
-
## 开发与测试
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
node --test # 11 个用例:宿主路由、窗口策略选择、浏览器半区在 DOM 桩里的挂载与按钮行为
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
没有构建步骤:`lib/index.js` 与 `lib/client.js` 就是手写的运行时代码。详见 [MAINTAINING.md](./MAINTAINING.md)。
|
|
80
|
-
|
|
81
|
-
## License
|
|
82
|
-
|
|
83
|
-
[Apache-2.0](./LICENSE) — 原始版权归 [xmuwenxiang/dsh-web-chat](https://github.com/xmuwenxiang/dsh-web-chat) 作者所有,详见 [NOTICE](./NOTICE)。
|