dsh-deepseek-webchat 0.0.0-stage → 0.4.8
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/LICENSE +21 -0
- package/README.md +461 -2
- package/cordis.patch.yml +20 -0
- package/lib/client.js +2335 -0
- package/lib/index.js +908 -0
- package/package.json +71 -4
- package/scripts/build.mjs +71 -0
- package/scripts/check-client-bundle.mjs +123 -0
- package/scripts/check-profile-patch.mjs +124 -0
- package/src/client/index.js +2335 -0
- package/src/index.js +908 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ckarefulon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,462 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-deepseek-webchat
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A [DSH](https://github.com/deepseek-ai) sidebar plugin that shows the **real
|
|
4
|
+
[chat.deepseek.com](https://chat.deepseek.com/) web app** next to your session,
|
|
5
|
+
binds one DeepSeek conversation to each DSH Session, and lets you push selected
|
|
6
|
+
messages into the DeepSeek composer as a blockquote — which you then send
|
|
7
|
+
yourself.
|
|
8
|
+
|
|
9
|
+
No API key, no proxy, no scraping. It embeds the actual website through the
|
|
10
|
+
desktop shell's native browser guest, the same channel DSH's built-in side-card
|
|
11
|
+
browser uses.
|
|
12
|
+
|
|
13
|
+
- [What it does](#what-it-does)
|
|
14
|
+
- [Install](#install)
|
|
15
|
+
- [Using it](#using-it)
|
|
16
|
+
- [Privacy](#privacy)
|
|
17
|
+
- [Known limitations](#known-limitations)
|
|
18
|
+
- [How it works](#how-it-works)
|
|
19
|
+
- [Development](#development)
|
|
20
|
+
- [Publishing](#publishing)
|
|
21
|
+
|
|
22
|
+
## What it does
|
|
23
|
+
|
|
24
|
+
| | |
|
|
25
|
+
|---|---|
|
|
26
|
+
| **Real web app** | `chat.deepseek.com` itself, in a sidebar tab. Not an iframe, not the API. |
|
|
27
|
+
| **Login persists** | Sign in once; the plugin restores your session on later launches. |
|
|
28
|
+
| **One conversation per DSH Session** | Each DSH Session gets its own DeepSeek conversation, remembered by id. |
|
|
29
|
+
| **Follows the session you switch to** | Switch DSH Sessions and the sidebar follows to that Session's conversation. |
|
|
30
|
+
| **Manual context push** | Tick rows, add a question, preview it, then fill and send. |
|
|
31
|
+
| **Questions included** | The agent's questions to you, their options, and your answers are quotable too. |
|
|
32
|
+
| **Todo list included** | The agent's todo list is quotable without turning anything on. |
|
|
33
|
+
| **One click to send** | 「填入并发送」 fills the composer and submits it; 「仅填入」 stops there. |
|
|
34
|
+
| **Bulk selection** | Select all, clear, or take the last 5/10/20/50 rows in one click. |
|
|
35
|
+
| **Advanced opt-in** | A switch reveals thinking, tool calls and results — off by default. |
|
|
36
|
+
| **Explained context** | An optional note tells DeepSeek what the quotes are and where they came from. |
|
|
37
|
+
| **No back-flow** | DeepSeek's answers are never written back into your DSH conversation. |
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
Requires DSH Desktop **0.2.0-rc.1 or newer**, and a profile that is already
|
|
42
|
+
initialised (the `desktop` profile is created by the app on first run).
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
dsh plugin --profile desktop add dsh-deepseek-webchat
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then restart DSH Desktop. The tab appears in the sidebar column's guide, and a
|
|
49
|
+
chat icon in the conversation header opens it directly.
|
|
50
|
+
|
|
51
|
+
`lib/` is committed to this repository on purpose, and there is no `prepare`
|
|
52
|
+
script, so the install needs **no build step and no pnpm `allowBuilds`
|
|
53
|
+
approval**.
|
|
54
|
+
|
|
55
|
+
<details>
|
|
56
|
+
<summary>Installing from a local clone instead</summary>
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git clone https://github.com/Ckarefulon/dsh-deepseek-webchat
|
|
60
|
+
dsh plugin --profile desktop add /absolute/path/to/dsh-deepseek-webchat
|
|
61
|
+
```
|
|
62
|
+
</details>
|
|
63
|
+
|
|
64
|
+
<details>
|
|
65
|
+
<summary>Uninstalling</summary>
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
dsh plugin --profile desktop remove dsh-deepseek-webchat
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Your bindings and saved login live in `~/.dsh/dsh-deepseek-webchat/` and are
|
|
72
|
+
left in place; delete that directory to remove them too.
|
|
73
|
+
</details>
|
|
74
|
+
|
|
75
|
+
<details>
|
|
76
|
+
<summary>Troubleshooting: DSH will not start after installing</summary>
|
|
77
|
+
|
|
78
|
+
DSH shows **"The application could not start or stopped unexpectedly"** and
|
|
79
|
+
refuses to open. The crash log (the path is shown in the dialog, under
|
|
80
|
+
`%APPDATA%\@deepseek-ai\dsh-desktop\logs\`) contains
|
|
81
|
+
`client-modules: client bundle not found`.
|
|
82
|
+
|
|
83
|
+
That means the installed copy's `exports["./client"]` does not point at a real
|
|
84
|
+
file. Fix it by reinstalling the plugin from a commit that has the flat layout:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
dsh plugin --profile desktop remove dsh-deepseek-webchat
|
|
88
|
+
dsh plugin --profile desktop add dsh-deepseek-webchat
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
To confirm the layout before restarting, from the installed package directory:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
node -e "const p=require('./package.json');const r=p.exports['./client'].default;console.log(r, require('fs').existsSync(r))"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
It must print `./lib/client.js true`. If it prints `false`, do not restart DSH —
|
|
98
|
+
the boot will abort again.
|
|
99
|
+
|
|
100
|
+
The dialog's *"Disable third-party plugins, back up profile patch, and
|
|
101
|
+
restart"* button also works: it starts DSH with third-party plugins unmounted
|
|
102
|
+
and saves your profile patch alongside as `cordis.patch.yml.bak-<timestamp>`.
|
|
103
|
+
That backup is your configuration, not the plugin, so keep it.
|
|
104
|
+
</details>
|
|
105
|
+
|
|
106
|
+
## Using it
|
|
107
|
+
|
|
108
|
+
1. **Open the tab.** Click the chat icon in the conversation header, or pick
|
|
109
|
+
「DeepSeek 网页版」 from the sidebar column's guide.
|
|
110
|
+
2. **Sign in** to DeepSeek the first time. It is a normal browser login, inside
|
|
111
|
+
the panel.
|
|
112
|
+
3. **Send one message** in the DeepSeek page. DeepSeek creates a conversation
|
|
113
|
+
lazily, so this is the moment its id exists — the plugin notices and binds it
|
|
114
|
+
to the current DSH Session. The toolbar dot turns green.
|
|
115
|
+
4. **Quote context.** Press 「引用上下文」. The list opens scrolled to the newest
|
|
116
|
+
rows. Tick what you want — or use 「全选」, 「清除」, or the number box plus
|
|
117
|
+
「选末尾」 to take the last few in one go — optionally type a question or
|
|
118
|
+
instruction, and check the preview. The list holds your turns, the assistant's
|
|
119
|
+
replies, **the agent's todo list**, **the questions it asked you** (with the
|
|
120
|
+
options it offered), and **your answers** to them.
|
|
121
|
+
5. **Press 「填入并发送」.** The text goes into DeepSeek's composer and is
|
|
122
|
+
submitted for you; the panel returns to the page and the selection clears, so
|
|
123
|
+
the next push starts from a clean slate. Use 「仅填入」 instead if you would
|
|
124
|
+
rather read it over in the composer first.
|
|
125
|
+
6. **That is the send.** The plugin watches the composer to confirm it went out,
|
|
126
|
+
and says so — or tells you plainly that it did not, so you can press Enter
|
|
127
|
+
there yourself.
|
|
128
|
+
|
|
129
|
+
The toolbar also has 「刷新」 (reload the page) and 「解除绑定」 (forget this
|
|
130
|
+
Session's conversation, so the next visit starts a new one).
|
|
131
|
+
|
|
132
|
+
Switching to a different DSH Session moves the panel to *that* Session's
|
|
133
|
+
conversation automatically.
|
|
134
|
+
|
|
135
|
+
### What gets sent, and how
|
|
136
|
+
|
|
137
|
+
Every push is still something you asked for: the plugin fills the composer and
|
|
138
|
+
submits it **only** when you click 「填入并发送」. There is no timer, no
|
|
139
|
+
background upload, and nothing is sent merely because the panel is open.
|
|
140
|
+
|
|
141
|
+
Sending goes through DeepSeek's own composer handler rather than a synthetic
|
|
142
|
+
shortcut invented here. Its composer runs an `onKeyDown` that, for a plain
|
|
143
|
+
Enter, calls the same function its send button calls — so the plugin dispatches
|
|
144
|
+
a bubbling Enter at the textarea and lets DeepSeek do the rest. (Its button's
|
|
145
|
+
class name is a build-time hash, so guessing at it would break on any rebuild.)
|
|
146
|
+
|
|
147
|
+
Because a synthetic key press could in principle be ignored, the plugin does not
|
|
148
|
+
assume it worked. DeepSeek clears its textarea once a send is accepted, so the
|
|
149
|
+
plugin reads the composer back: cleared means sent. If it still holds text, the
|
|
150
|
+
plugin falls back to clicking DeepSeek's own send button, and if that fails too
|
|
151
|
+
it says so instead of pretending — leaving the text sitting in the composer for
|
|
152
|
+
you to send by hand.
|
|
153
|
+
|
|
154
|
+
**「附上说明」** (on by default) puts a short note in front of the quoted rows:
|
|
155
|
+
|
|
156
|
+
> 以下是我在另一个 AI 助手(DSH)里的对话片段,引用给你作为背景参考。以「> 」
|
|
157
|
+
> 开头的行是原文,【】里标出的是这段内容属于谁…
|
|
158
|
+
|
|
159
|
+
Without it, DeepSeek receives a wall of quotes and 【】 labels with no
|
|
160
|
+
explanation of what they are. Turn it off if you would rather send the raw
|
|
161
|
+
quotes.
|
|
162
|
+
|
|
163
|
+
### The advanced switch
|
|
164
|
+
|
|
165
|
+
By default the picker lists the conversation as a person reads it, plus the
|
|
166
|
+
agent's todo list. Tick **「高级:包含思考过程与工具调用」** to also list the
|
|
167
|
+
machinery behind it: the model's reasoning blocks, its tool calls, the tool
|
|
168
|
+
results, slash commands, and compaction summaries — including tool output that
|
|
169
|
+
may contain file contents. It is off on every open, and the host does the
|
|
170
|
+
filtering, so an advanced row is never even sent to the browser unless you asked
|
|
171
|
+
for it.
|
|
172
|
+
|
|
173
|
+
Each row is marked with an icon from the shell's own icon set plus a short
|
|
174
|
+
label, so a quoted answer and a quoted tool result stay distinguishable in the
|
|
175
|
+
blockquote:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
> 【提问】Confirm:Which layout?
|
|
179
|
+
> · Sidebar — right column
|
|
180
|
+
> · Center
|
|
181
|
+
> 【回答】Sidebar, please
|
|
182
|
+
> 【待办】[x] write the picker
|
|
183
|
+
> [~] test it
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Privacy
|
|
187
|
+
|
|
188
|
+
This plugin is built so that **nothing leaves your machine unless you press a
|
|
189
|
+
button**, and so that the things you would least want to leak are never even
|
|
190
|
+
offered.
|
|
191
|
+
|
|
192
|
+
**What is sent, and when.** Only the rows you tick, and only when you click
|
|
193
|
+
「填入并发送」 (or 「仅填入」, which stops at the composer). Both are explicit
|
|
194
|
+
actions; the plugin has no timer and no background upload.
|
|
195
|
+
|
|
196
|
+
**What is never offered.** The host half filters the session log before it
|
|
197
|
+
reaches the picker, dropping in **both** modes:
|
|
198
|
+
|
|
199
|
+
- `system/message` and `developer/message` events,
|
|
200
|
+
- **injected `user/message` events** — agent instructions, skill catalogs, goal
|
|
201
|
+
rounds, time context, compaction checkpoints, team and webhook deliveries,
|
|
202
|
+
which DSH records as user messages but which you never typed. Only events whose
|
|
203
|
+
`source.kind` is `user` (your turns) or `user-question-reply` (your answers to
|
|
204
|
+
the agent) are treated as yours,
|
|
205
|
+
- approval records, request headers, model and sandbox selections.
|
|
206
|
+
|
|
207
|
+
**What is off by default.** The model's private reasoning blocks, tool calls and
|
|
208
|
+
tool results are **not** offered until you turn on the advanced switch. When you
|
|
209
|
+
do, remember that a tool result can contain file contents the agent read — that
|
|
210
|
+
is exactly the kind of thing the default set keeps out, and the switch is your
|
|
211
|
+
explicit say-so. A todo list is the exception: it is the agent's own plan, which
|
|
212
|
+
you are already reading on screen, so it is offered by default.
|
|
213
|
+
|
|
214
|
+
So a system prompt, an API key in your environment, or a file the agent read
|
|
215
|
+
cannot be quoted by accident.
|
|
216
|
+
|
|
217
|
+
**What is stored locally.** Two JSON files in `~/.dsh/dsh-deepseek-webchat/`:
|
|
218
|
+
|
|
219
|
+
- `bindings.json` — the DSH Session id → DeepSeek conversation id map. No message
|
|
220
|
+
content, ever.
|
|
221
|
+
- `session.json` — the guest's DeepSeek login state (its site storage and
|
|
222
|
+
non-HttpOnly cookie string), so you stay signed in. This is a **credential**;
|
|
223
|
+
treat the file as you would a browser profile. It is written with the same
|
|
224
|
+
permissions as any other file your user creates.
|
|
225
|
+
|
|
226
|
+
**No telemetry.** The plugin makes no network request of its own. The only
|
|
227
|
+
traffic is the DeepSeek web app talking to DeepSeek, inside its own guest.
|
|
228
|
+
|
|
229
|
+
**The page runs sandboxed.** The desktop shell approves the guest with
|
|
230
|
+
`nodeIntegration: false`, `contextIsolation: true`, `sandbox: true` and
|
|
231
|
+
`webSecurity: true`, and refuses every permission request. The page cannot reach
|
|
232
|
+
your files or your DSH process.
|
|
233
|
+
|
|
234
|
+
## Known limitations
|
|
235
|
+
|
|
236
|
+
These are real, and worth knowing before you rely on the plugin.
|
|
237
|
+
|
|
238
|
+
**HttpOnly cookies cannot be restored.** The DSH Host runs as a separate Node
|
|
239
|
+
child process, not inside Electron, so the plugin cannot reach Electron's cookie
|
|
240
|
+
store. It can only read `document.cookie` from inside the guest, and HttpOnly
|
|
241
|
+
cookies are invisible there by design. In practice DeepSeek keeps its credential
|
|
242
|
+
in `localStorage.userToken` and sends it as a bearer token, so replaying site
|
|
243
|
+
storage is what restores your login — but if DeepSeek ever moves its credential
|
|
244
|
+
to an HttpOnly cookie, this plugin will start asking you to sign in again after
|
|
245
|
+
each restart.
|
|
246
|
+
|
|
247
|
+
**The guest partition is per-run.** The shell hands out a process-lifetime
|
|
248
|
+
session partition and the plugin cannot ask for a different one. Login survival
|
|
249
|
+
is therefore the snapshot-and-replay above, not a persistent browser profile.
|
|
250
|
+
|
|
251
|
+
**One DeepSeek login, shared.** Every DSH Session shares a single DeepSeek
|
|
252
|
+
account and browser session; the per-Session split is the conversation, not the
|
|
253
|
+
login. Separate DSH Sessions do **not** get separate DeepSeek accounts.
|
|
254
|
+
|
|
255
|
+
**Binding happens on the first message.** DeepSeek creates a conversation only
|
|
256
|
+
when you send something, so a DSH Session stays unbound until you send at least
|
|
257
|
+
one message in the page. Until then the toolbar dot is hollow.
|
|
258
|
+
|
|
259
|
+
**DeepSeek can change its page.** The composer fill targets
|
|
260
|
+
`textarea.ds-textarea__textarea`, and the conversation id is read from DeepSeek's
|
|
261
|
+
`/a/<agent>/s/<id>` route. If DeepSeek redesigns either, the fill or the binding
|
|
262
|
+
stops working until this plugin is updated. The rest of the plugin — embedding,
|
|
263
|
+
login, per-Session tabs — is unaffected.
|
|
264
|
+
|
|
265
|
+
**Desktop only.** The embedded page needs the desktop browser guest channel. In
|
|
266
|
+
a plain `dsh web` profile the panel says so instead of falling back to an iframe
|
|
267
|
+
(which DeepSeek would refuse anyway, via `frame-ancestors 'none'`).
|
|
268
|
+
|
|
269
|
+
**One DeepSeek tab per DSH Session.** The tab kind is single-instance, so you
|
|
270
|
+
cannot open two DeepSeek panels side by side for the same Session.
|
|
271
|
+
|
|
272
|
+
## How it works
|
|
273
|
+
|
|
274
|
+
<details>
|
|
275
|
+
<summary>Architecture</summary>
|
|
276
|
+
|
|
277
|
+
Two halves, as DSH plugins are:
|
|
278
|
+
|
|
279
|
+
**Host half** (`lib/index.js`, exports `.`) runs in the DSH Host process and
|
|
280
|
+
serves five routes under `/api/dsh-deepseek-webchat/`:
|
|
281
|
+
|
|
282
|
+
| Route | Purpose |
|
|
283
|
+
|---|---|
|
|
284
|
+
| `state` | What the panel needs to describe itself. |
|
|
285
|
+
| `messages?sessionId=[&advanced=1]` | The Session's quotable rows, filtered. |
|
|
286
|
+
| `binding` | Read/write/forget the DSH→DeepSeek conversation map. |
|
|
287
|
+
| `session/restore` | Hand back the saved login state. |
|
|
288
|
+
| `session/save` | Store the guest's login state. |
|
|
289
|
+
|
|
290
|
+
It reads messages through `ctx.sessionQuery.readSession()`, which is
|
|
291
|
+
live-preferred, and reduces the raw event log with the same text-extraction
|
|
292
|
+
rules the harness itself uses.
|
|
293
|
+
|
|
294
|
+
The `advanced` flag is honoured **host-side**, so the default response never
|
|
295
|
+
contains a reasoning or tool row at all — the browser half cannot accidentally
|
|
296
|
+
reveal one it was never given. The picker re-requests the list when the switch
|
|
297
|
+
flips rather than filtering locally.
|
|
298
|
+
|
|
299
|
+
Rows carry a `kind` alongside `role`: `user` and `assistant` for dialogue,
|
|
300
|
+
`question` and `answer` for the agent's questions and your replies (default),
|
|
301
|
+
then `reasoning`, `tool-call`, `tool-result`, `todo`, `command` and `summary`
|
|
302
|
+
(advanced). A `question` row is read from the `tool/call` event whose
|
|
303
|
+
`name === 'ask_user_question'`, parsed with the same `questionsOf` shape the
|
|
304
|
+
harness's own user-questions service uses; the answer arrives as an ordinary
|
|
305
|
+
`user/message` tagged `source.kind === 'user-question-reply'`, which the plain
|
|
306
|
+
human filter would otherwise drop.
|
|
307
|
+
|
|
308
|
+
**Browser half** (`lib/client.js`, exports `./client`) registers the sidebar tab
|
|
309
|
+
type, its body, and a header door.
|
|
310
|
+
|
|
311
|
+
**The guest, and why it is not an iframe.** `chat.deepseek.com` sends
|
|
312
|
+
`Content-Security-Policy: frame-ancestors 'none'`, so an `<iframe>` is refused by
|
|
313
|
+
the page. Instead the bundle asks `globalThis.dshDesktop.browser.acquire(...)`
|
|
314
|
+
for a reservation and attaches a `<webview>` whose `src` is `about:blank#<lease>`
|
|
315
|
+
and whose `partition` is the issued one. The shell's `will-attach-webview`
|
|
316
|
+
matches the lease, applies hardened preferences, and lets the navigation
|
|
317
|
+
through.
|
|
318
|
+
|
|
319
|
+
**Why the guest lives outside React.** A `<webview>` is destroyed when it leaves
|
|
320
|
+
the document, so a slot-owned guest would reload on every tab switch — losing a
|
|
321
|
+
half-typed question. The element instead lives in a container the plugin owns at
|
|
322
|
+
the document root, and the panel body only measures its area; the guest is
|
|
323
|
+
positioned onto that rectangle while the tab shows and hidden when it does not.
|
|
324
|
+
The tab type declares `keepMounted: true` so the body survives switches.
|
|
325
|
+
|
|
326
|
+
**Why the conversation URL works.** DeepSeek's own routes are
|
|
327
|
+
`/a/:agentId/s/:sessionId`, and the default agent is `chat`, so a conversation is
|
|
328
|
+
addressable as `https://chat.deepseek.com/a/chat/s/<id>` — no in-page JavaScript
|
|
329
|
+
is needed to reopen one.
|
|
330
|
+
</details>
|
|
331
|
+
|
|
332
|
+
## Development
|
|
333
|
+
|
|
334
|
+
Plain JavaScript ESM. No TypeScript, no bundler, no dependencies.
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
npm run build # copy src/ -> lib/
|
|
338
|
+
npm test # node --test
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
`lib/` is a byte-for-byte copy of `src/` and **is committed**, because a
|
|
342
|
+
git-hosted plugin must not need a build step on install. `npm test` asserts the
|
|
343
|
+
two still match, so they cannot drift.
|
|
344
|
+
|
|
345
|
+
After editing `src/`, run `npm run build` and commit both trees.
|
|
346
|
+
|
|
347
|
+
```
|
|
348
|
+
src/index.js host half -> lib/index.js
|
|
349
|
+
src/client/index.js browser half -> lib/client.js (note: flat, not lib/client/index.js)
|
|
350
|
+
scripts/build.mjs the copy
|
|
351
|
+
test/index.test.js host: urls, message filtering, bindings, snapshot, mirror
|
|
352
|
+
test/routes.test.js host: every HTTP route, driven through apply()
|
|
353
|
+
test/client.test.js browser: bundle load, registrations, fill + send, row icons
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Two checks worth running before a restart
|
|
357
|
+
|
|
358
|
+
A broken manifest does not fail loudly at build time — it aborts the Host boot,
|
|
359
|
+
so DSH simply never opens. Both checks are standalone: no dependencies, no
|
|
360
|
+
`node_modules`, nothing to install.
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
npm run check:bundle # this repo
|
|
364
|
+
node scripts/check-client-bundle.mjs <packageRoot> # any DSH plugin
|
|
365
|
+
node scripts/check-profile-patch.mjs <patch.yml>
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
**`check-client-bundle.mjs`** replicates `resolveMeta()` from
|
|
369
|
+
`@deepseek-ai/dsh-client-modules` verbatim: it joins `exports["./client"]` onto
|
|
370
|
+
the package root and calls `statSync` on the result, with no extension
|
|
371
|
+
completion and no directory-index fallback. A missing file throws
|
|
372
|
+
`MissingClientBundleError`, and because `modules` is a required plugin the whole
|
|
373
|
+
Host boot aborts. It also checks the neighbouring invariants — that the bundle
|
|
374
|
+
declares its own `module`/`exports` (the loader passes `require` only), returns
|
|
375
|
+
`module.exports`, and registers its own id. This is the check that reproduces
|
|
376
|
+
the startup abort on the old `lib/client/index.js` layout.
|
|
377
|
+
|
|
378
|
+
**`check-profile-patch.mjs`** parses a profile `cordis.patch.yml` the way the
|
|
379
|
+
loader must: YAML with the `!!js` custom tag treated as an opaque scalar. It
|
|
380
|
+
prints every entry id, so a patch can be reviewed before it is trusted — which
|
|
381
|
+
is what you need after DSH's crash dialog has replaced a full patch with a
|
|
382
|
+
minimal one. js-yaml is not a dependency of this repo; it is resolved from an
|
|
383
|
+
installed DSH profile, or point `DSH_JS_YAML` at one.
|
|
384
|
+
|
|
385
|
+
### Why the browser half is `lib/client.js` and not `lib/client/index.js`
|
|
386
|
+
|
|
387
|
+
This is load-bearing, and getting it wrong makes DSH fail to start at all.
|
|
388
|
+
|
|
389
|
+
DSH resolves a package's browser half by joining `exports["./client"]` onto the
|
|
390
|
+
package root and reading the result as an **exact file path** — there is no
|
|
391
|
+
extension and no directory-index fallback. If the manifest says
|
|
392
|
+
`./lib/client.js` while the build writes `./lib/client/index.js`, the client
|
|
393
|
+
module registry throws `MissingClientBundleError` while the Host is starting,
|
|
394
|
+
and because that registry is a *required* plugin the whole boot aborts. The
|
|
395
|
+
window shows "The application could not start or stopped unexpectedly" and
|
|
396
|
+
names `client-hmr` as waiting on `clientModules`; the crash log reports:
|
|
397
|
+
|
|
398
|
+
```
|
|
399
|
+
client-modules: client bundle not found; run `pnpm run build` before launch:
|
|
400
|
+
package: <name>
|
|
401
|
+
path: .../lib/client.js
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Every package DSH ships uses the flat `./lib/client.js` form. `npm test` asserts
|
|
405
|
+
that every path in `exports` exists and is a regular file, so this cannot
|
|
406
|
+
regress.
|
|
407
|
+
|
|
408
|
+
If you hit that dialog, your installed copy is stale. Reinstall (see
|
|
409
|
+
[Install](#install)) after pulling the fixed commit.
|
|
410
|
+
|
|
411
|
+
## Publishing
|
|
412
|
+
|
|
413
|
+
This package is published to npm as `dsh-deepseek-webchat`. `package.json`
|
|
414
|
+
carries `publishConfig` (`access: public`, `registry: https://registry.npmjs.org/`),
|
|
415
|
+
so a plain `npm publish` targets the right registry with no extra flags — even
|
|
416
|
+
though a local `~/.npmrc` may point at a mirror.
|
|
417
|
+
|
|
418
|
+
Releases are **automatic**. Push to `main` and `.github/workflows/publish.yml`
|
|
419
|
+
runs the suite, then publishes — but only if `package.json`'s `version` is one
|
|
420
|
+
the registry does not already have. So the whole release procedure is:
|
|
421
|
+
|
|
422
|
+
1. Bump `version` in `package.json`.
|
|
423
|
+
2. Run `npm run build`, commit `src/` and `lib/` together (`npm test` fails if
|
|
424
|
+
they differ), and push to `main`.
|
|
425
|
+
|
|
426
|
+
The run either publishes that version or reports that it is already live and
|
|
427
|
+
exits successfully. **A push without a version bump is a no-op, not a
|
|
428
|
+
failure** — which is why every change that should ship needs its own bump.
|
|
429
|
+
Docs-only commits still trigger the workflow and still no-op.
|
|
430
|
+
|
|
431
|
+
Authentication is npm **Trusted Publishing** (OIDC): GitHub mints a short-lived
|
|
432
|
+
token for the job and npm exchanges it for a publish token scoped to this one
|
|
433
|
+
package. There is **no `NPM_TOKEN` secret anywhere**. The workflow deliberately
|
|
434
|
+
does not use `actions/setup-node`'s `registry-url` input — that writes
|
|
435
|
+
`//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}` into `~/.npmrc`, and with
|
|
436
|
+
no such variable defined the placeholder survives as a literal string that npm
|
|
437
|
+
would send as the token. `publishConfig.registry` already names the registry.
|
|
438
|
+
|
|
439
|
+
<details>
|
|
440
|
+
<summary>One-time setup: attaching the trusted publisher</summary>
|
|
441
|
+
|
|
442
|
+
A trusted publisher can only be attached to a package that **already exists on
|
|
443
|
+
the registry**, so the very first release was published by hand (`npm publish`
|
|
444
|
+
from a checkout); the workflow takes over from the second one. On npmjs.com:
|
|
445
|
+
package → Settings → Trusted Publisher → GitHub Actions, then
|
|
446
|
+
|
|
447
|
+
| Field | Value |
|
|
448
|
+
|---|---|
|
|
449
|
+
| Repository | `Ckarefulon/dsh-deepseek-webchat` |
|
|
450
|
+
| Workflow filename | `publish.yml` |
|
|
451
|
+
| Environment | *(leave blank)* |
|
|
452
|
+
|
|
453
|
+
The filename must match exactly — npm ties the grant to it, and a mismatch
|
|
454
|
+
shows up as the publish failing with `ENEEDAUTH`.
|
|
455
|
+
|
|
456
|
+
</details>
|
|
457
|
+
|
|
458
|
+
## License
|
|
459
|
+
|
|
460
|
+
MIT. See [LICENSE](LICENSE).
|
|
461
|
+
|
|
462
|
+
Not affiliated with DeepSeek. "DeepSeek" is a trademark of its owner.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# dsh-deepseek-webchat bundle patch: inserts the dual-face plugin row into a
|
|
2
|
+
# profile roster. Applied as a profile bundle layer (the `dsh.bundle.patch`
|
|
3
|
+
# manifest field) over dsh-base; activate by adding this package to the
|
|
4
|
+
# profile's `dsh.profile.bundles`, or with
|
|
5
|
+
# dsh plugin --profile desktop add dsh-deepseek-webchat
|
|
6
|
+
#
|
|
7
|
+
# The row is a bare plugin by package name: the node half (exports ".") runs in
|
|
8
|
+
# the Host process and serves this plugin's /api/dsh-deepseek-webchat routes,
|
|
9
|
+
# and the `dsh.client` declaration in package.json makes the browser half
|
|
10
|
+
# (exports "./client", served at /plugins/<id>/client.js) load in the Web GUI as
|
|
11
|
+
# the sidebar tab type and its panel. `name` must be this package's manifest
|
|
12
|
+
# name verbatim (scoped names included) — dsh-client-modules keys every browser
|
|
13
|
+
# row by it, and lib/client.js registers its factory under the same id.
|
|
14
|
+
# `id` is the profile entry id; keep it stable because DSH also uses it as the
|
|
15
|
+
# settings-form namespace. It must be unique per profile: a second package
|
|
16
|
+
# inserting the same `deepseek-webchat` id cannot be installed alongside this
|
|
17
|
+
# one — the duplicate is rejected at boot.
|
|
18
|
+
- insert:
|
|
19
|
+
- id: deepseek-webchat
|
|
20
|
+
name: 'dsh-deepseek-webchat'
|