dsh-web-mobile-pmsfh 0.0.0-stage → 3.2.6

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 renlang119
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.en.md ADDED
@@ -0,0 +1,294 @@
1
+ # dsh-web-mobile-pmsfh
2
+
3
+ [简体中文](README.md) | **English**
4
+
5
+ A dedicated mobile page for DeepSeek Harness: open the main site on a mobile
6
+ device and you land in a separate interface built for narrow screens, with
7
+ sessions, conversations, attachments, and approvals in one place. The desktop
8
+ interface and the upstream repository stay untouched.
9
+
10
+ It serves a standalone mobile page at `/dsh-web-mobile-pmsfh/`, calls DSH's own
11
+ APIs directly, does not load the official frontend, and does not modify
12
+ official code.
13
+
14
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
15
+ [![topic](https://img.shields.io/badge/topic-dsh--plugin-amber)](https://github.com/topics/dsh-plugin)
16
+ [![npm](https://img.shields.io/npm/v/dsh-web-mobile-pmsfh.svg)](https://www.npmjs.com/package/dsh-web-mobile-pmsfh)
17
+ [![dsh](https://img.shields.io/badge/dsh-0.2.2--rc.1-5B6EF5)](https://github.com/deepseek-ai/deepseek-harness)
18
+
19
+ ## Features
20
+
21
+ - **Sessions**: grouped by workspace and collapsible, plus "Ungrouped"; create,
22
+ rename, and delete workspaces — deleting only removes a workspace from the
23
+ list, keeping the directory and session records, and its sessions move to
24
+ "Ungrouped"; long-press a session to archive it; creating a session picks the
25
+ workspace through an inline directory browser and a permission level (Read
26
+ Only / Workspace Write / Full access; only Full access requires a risk
27
+ confirmation)
28
+ - **Conversations**: streaming output, collapsible reasoning, a notice when
29
+ context is compacted; markdown and code block rendering, stop while
30
+ generating, queued messages stay visible, paginated history as you scroll up,
31
+ stick to the bottom with a one-tap return
32
+ - **Attachments**: pick files on the device, upload for a receipt, and send them
33
+ with the next message through the official conversation attachment channel;
34
+ 8 MB per file, removable before sending, not written to the workspace
35
+ - **Approvals**: out-of-scope operations raise an approval card with allow
36
+ once, deny, later, or a custom command of your own
37
+ - **Models**: switch model and reasoning level within a session
38
+ - **Files**: list and download workspace files, read-only
39
+ - **Interface**: Chinese and English follow the browser, light and dark follow
40
+ the system; the composer rides above the soft keyboard; "Open desktop
41
+ version" at the bottom of the list applies to this browsing session only,
42
+ and a floating "📱" button appears in the corner after switching to return to
43
+ the mobile page; uses the existing DSH login state with guidance when it
44
+ expires and a sign-out action
45
+
46
+ ## Quick Start
47
+
48
+ Requirements: DSH `0.2.2-rc.1` (see Compatibility), Node.js 24 or later, and
49
+ pnpm for the `dsh plugin` command — enable it through corepack or install it
50
+ globally:
51
+
52
+ ```bash
53
+ corepack enable
54
+ ```
55
+
56
+ or
57
+
58
+ ```bash
59
+ npm i -g pnpm
60
+ ```
61
+
62
+ Once pnpm is available, install the plugin one of two ways; after installing,
63
+ restart DSH, adjusting the restart command to how your deployment runs it.
64
+
65
+ ### Option 1: Install from npm
66
+
67
+ Ready to use, with update prompts when new versions are released:
68
+
69
+ ```bash
70
+ dsh plugin --profile web add dsh-web-mobile-pmsfh
71
+ ```
72
+
73
+ ### Option 2: Install from source
74
+
75
+ For your own modifications; keep the cloned directory, since updates are pulled
76
+ inside it:
77
+
78
+ ```bash
79
+ git clone https://github.com/renlang119/dsh-web-mobile-pmsfh.git
80
+ dsh plugin --profile web add ./dsh-web-mobile-pmsfh
81
+ ```
82
+
83
+ The `dsh plugin` command above installs the plugin for the server started by
84
+ `dsh web`. The DSH desktop client manages its own plugins; to use it there too,
85
+ open Settings → Plugins in the client.
86
+
87
+ If your npm points at a regional mirror and cannot find the package, append
88
+ `--registry=https://registry.npmjs.org`.
89
+
90
+ Restart command example:
91
+
92
+ ```bash
93
+ sudo systemctl restart dsh-web
94
+ ```
95
+
96
+ First visit: opening the main site on a mobile device redirects automatically,
97
+ or you can open `https://<domain>/dsh-web-mobile-pmsfh/` directly; if it does
98
+ not redirect, check whether "Open desktop version" was chosen in this browsing
99
+ session — that preference is session-scoped (sessionStorage) and resets when
100
+ the page is closed and reopened.
101
+
102
+ ## Compatibility
103
+
104
+ | DSH | Status |
105
+ | --- | --- |
106
+ | `0.2.2-rc.1` | Supported |
107
+ | other `0.2.x` | Untested; endpoint signatures may differ |
108
+
109
+ ## Tech Stack
110
+
111
+ Node.js 24 · DeepSeek Harness `0.2.2-rc.1` · Cordis plugin · vanilla
112
+ JavaScript (no build) · markdown-it
113
+
114
+ The mobile page is a single-page vanilla JS app; it does not load the official
115
+ frontend or go through a bundler, and it has no extra runtime dependencies —
116
+ clone and run.
117
+
118
+ ## Project Structure
119
+
120
+ ```text
121
+ dsh-web-mobile-pmsfh/
122
+ ├─ lib/index.js host half: static routes and connection.admit checks
123
+ ├─ client/client.js desktop client: redirect narrow screens to the mobile page
124
+ ├─ mobile/ mobile page
125
+ │ ├─ index.html
126
+ │ ├─ app.js / app.css
127
+ │ └─ vendor/ markdown-it and CJK punctuation patch
128
+ ├─ cordis.patch.yml plugin mount configuration
129
+ ├─ types.d.ts protocol and data shapes
130
+ └─ tsconfig.json type-check only, no emit
131
+ ```
132
+
133
+ ## Architecture
134
+
135
+ The plugin has three parts, all inside the plugin directory, with zero changes
136
+ to the main repository; `cordis.patch.yml` inserts the plugin into the
137
+ profile's layer stack:
138
+
139
+ | Part | Role |
140
+ | --- | --- |
141
+ | `lib/index.js` | Host half: static routes behind the DSH login gate |
142
+ | `client/client.js` | Client half: bounces phones (coarse pointer, ≤ 768px) to the mobile page |
143
+ | `mobile/` | The mobile page: a vanilla JS single-page app, no official frontend, no bundler |
144
+
145
+ The mobile page talks to DSH exclusively through DSH's own wire protocol
146
+ (Typert Gateway) — there are no plugin-private endpoints:
147
+
148
+ - `POST /api/<method>`: unary RPC (sessions, workspaces, models, files, …)
149
+ - `WS /api/remote.mux`: frame-multiplexed long connection (session journal
150
+ streams, workspace baselines, the event bus)
151
+ - `POST /api/$events/result`: approval and question answers
152
+
153
+ Five resource routes, plus a bare-path 302 redirect:
154
+
155
+ | Path | Content |
156
+ | --- | --- |
157
+ | `/dsh-web-mobile-pmsfh/` | Mobile page |
158
+ | `/dsh-web-mobile-pmsfh/app.js` | Page script |
159
+ | `/dsh-web-mobile-pmsfh/app.css` | Page styles |
160
+ | `/dsh-web-mobile-pmsfh/vendor/markdown-it.min.js` | Markdown rendering |
161
+ | `/dsh-web-mobile-pmsfh/vendor/markdown-it-cjk-friendly.min.js` | `**` handling for CJK |
162
+
163
+ Page files are read from disk per request (`no-cache`, 304 when unchanged), so
164
+ a plugin update plus a dsh-web restart takes effect immediately; vendor files
165
+ are content-hash cached for 30 days (`immutable`).
166
+
167
+ ## DSH API Dependencies
168
+
169
+ The mobile page calls these internal DSH endpoints directly
170
+ (`session/follow`, `workspace/follow`, and `$events` ride the mux connection;
171
+ the rest are unary RPC):
172
+
173
+ | Endpoint | Purpose |
174
+ | --- | --- |
175
+ | `session/list`/`session/create`/`session/prompt`/`session/cancel` | List/create/prompt/stop |
176
+ | `session/selectModel` / `session/modelCatalog` | Model and reasoning level |
177
+ | `session/page` / `session/follow` | Paginated history and the live journal stream |
178
+ | `workspace/create` / `workspace/rename` / `workspace/delete` | Workspace management |
179
+ | `workspace/archiveSession` / `workspace/follow` | Archive sessions; workspace baseline stream |
180
+ | `directoryPicker/list` / `directoryPicker/createDirectory` | New-workspace directory browser |
181
+ | `commands/execute` | Permission preset setup (the `/permission` command) |
182
+ | `fileUploads/upload` | Attachment upload; the receipt is sent with the next message |
183
+ | `workspaceFiles/list` / `workspaceFiles/readBytes` | Workspace file list and download |
184
+ | `$events/result` | Approval and question answers |
185
+
186
+ These are DSH-internal endpoints with no stability promise: when the check
187
+ service is unavailable, the plugin returns 503 and does not let the request
188
+ through; an endpoint signature change breaks the affected features until the
189
+ plugin adapts (see Compatibility).
190
+
191
+ ## Quality
192
+
193
+ - **Types**: `types.d.ts` defines the protocol and data shapes; sources use
194
+ `@ts-check`; `tsc --noEmit` is clean
195
+ - **Syntax**: `node --check` covers the host and the mobile page
196
+ - **Assets**: content-hash ETags return 304 on repeat visits and take effect
197
+ right after an upgrade
198
+ - **No build chain**: the repository is the runtime artifact; no install or
199
+ build step
200
+
201
+ ## Security
202
+
203
+ - No account system of its own: unauthenticated access to the plugin page is
204
+ rejected by DSH's login check (401); if that check service is unavailable,
205
+ the plugin returns 503 and does not let the request through
206
+ - When exposing the service through a reverse proxy, add authentication at the
207
+ proxy layer (Basic Auth / OIDC / mTLS) and do not expose the DSH port
208
+ directly to the internet
209
+ - Model output is rendered by markdown-it (`html: false`), and links are
210
+ limited to `http/https/mailto`; HTML responses carry CSP, nosniff,
211
+ no-referrer, and `X-Frame-Options: DENY`
212
+
213
+ ## Self-check & Troubleshooting
214
+
215
+ - The plugin page bounces back to the DSH login page: not signed in or the
216
+ session expired — sign in on the main site first
217
+ - The plugin page returns 503: DSH's login-check service is unavailable, the
218
+ plugin refuses to let the request through — restore DSH itself first
219
+ - A phone opening the main site does not land on the mobile page: "Open desktop
220
+ version" was chosen in this browsing session (session-scoped, sessionStorage);
221
+ closing and reopening the page restores the default, and a phone switched to
222
+ the desktop page shows a floating "📱" button to return
223
+ - The session list loads but the model list is unavailable: the DSH backend
224
+ model service is failing — check DSH's own logs
225
+ - After a DSH upgrade the plugin page fails or misbehaves: an internal endpoint
226
+ signature may have changed; check Compatibility for the adapted version and
227
+ wait for the plugin to catch up
228
+
229
+ ## Known limitations
230
+
231
+ - Subagent sessions are not listed (matching the desktop client: subagents do
232
+ not take top-level rows)
233
+ - Attachments use the official conversation attachment channel and are not
234
+ written to the workspace; workspace files are read-only
235
+ - The plugin consumes DSH-internal endpoints with no stability promise: an
236
+ endpoint signature change breaks the affected features until the plugin
237
+ adapts
238
+ - Single-user use is recommended: DSH itself does not separate accounts, so a
239
+ shared deployment needs isolation in front
240
+
241
+ ## Update
242
+
243
+ Installed from npm: update to the new version and restart.
244
+
245
+ ```bash
246
+ dsh plugin --profile web add dsh-web-mobile-pmsfh@latest
247
+ sudo systemctl restart dsh-web
248
+ ```
249
+
250
+ Installed from source: pull the latest code in the cloned directory and
251
+ restart.
252
+
253
+ ```bash
254
+ git pull
255
+ sudo systemctl restart dsh-web
256
+ ```
257
+
258
+ ## Uninstall
259
+
260
+ Remove the plugin from the `web` profile and restart:
261
+
262
+ ```bash
263
+ dsh plugin --profile web remove dsh-web-mobile-pmsfh
264
+ sudo systemctl restart dsh-web
265
+ ```
266
+
267
+ ## Development
268
+
269
+ For local debugging, use a separate `DSH_HOME` and port so production data is
270
+ unaffected:
271
+
272
+ ```bash
273
+ DSH_HOME=~/.dsh-test dsh --profile web --no-open --port 3080
274
+ ```
275
+
276
+ - No build chain: the repository is the runtime artifact; changes land after a
277
+ dsh-web restart (page files are read from disk per request)
278
+ - Syntax check with `node --check`, type check with `tsc --noEmit`
279
+ (`@ts-check` applies per file)
280
+ - Debug hooks: the page exposes `__dshwm.dispatch()`, which injects synthetic
281
+ mux frames to rehearse approval and question cards; `__frames` records the
282
+ sequence of received frame types
283
+ - Soft-keyboard fit: `#app` is pinned to the visualViewport height, with the
284
+ `interactive-widget=resizes-content` meta alongside, so the composer rides
285
+ above the keyboard
286
+ - The dictionaries live in the `T` object at the top of `mobile/app.js` —
287
+ Chinese and English key sets side by side; update both when changing UI copy
288
+
289
+ Implementation notes: static assets get content-hash ETags and return 304 on
290
+ repeat visits; bundled dependencies are cached for 30 days.
291
+
292
+ ## License
293
+
294
+ [MIT](LICENSE) © 2026 renlang119
package/README.md CHANGED
@@ -1,3 +1,233 @@
1
- # Temporary Holding Version
1
+ # dsh-web-mobile-pmsfh
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **简体中文** | [English](README.en.md)
4
+
5
+ DeepSeek Harness 的移动端页面插件:移动设备打开主站自动进入,会话、对话、
6
+ 附件、审批都在这个为窄屏设计的独立界面里完成;不动桌面端界面,也不改主仓库代码。
7
+
8
+ 它在 `/dsh-web-mobile-pmsfh/` 路径下挂一套独立的移动页,直接调 DSH 自己的接口,不加载官方前端,也不改官方代码。
9
+
10
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
11
+ [![topic](https://img.shields.io/badge/topic-dsh--plugin-amber)](https://github.com/topics/dsh-plugin)
12
+ [![npm](https://img.shields.io/npm/v/dsh-web-mobile-pmsfh.svg)](https://www.npmjs.com/package/dsh-web-mobile-pmsfh)
13
+ [![dsh](https://img.shields.io/badge/dsh-0.2.2--rc.1-5B6EF5)](https://github.com/deepseek-ai/deepseek-harness)
14
+
15
+ ## 功能概览
16
+
17
+ - **会话**:按工作区分组折叠,另有「未分组」;新建、重命名、删除工作区(删除只从列表移除,目录与会话记录保留,会话转入「未分组」);长按归档会话;新建会话时经内联目录浏览器选工作区,并选权限档位(仅可查看 /
18
+ 工作区内修改 / 完全权限,完全权限启用前需确认风险)
19
+ - **对话**:流式输出、思考过程折叠、上下文压缩提示;markdown 与代码块渲染,生成中可停止,后续消息排队可见,上翻按页加载更早消息,贴底跟随与一键回到底部
20
+ - **附件**:移动设备上选文件,先上传拿到凭证再随下一条消息发送,走官方对话附件通道;单文件上限 8 MB,发送前可移除,不落工作区
21
+ - **审批**:越界操作弹出审批卡,可选允许一次、拒绝、稍后,也可自行输入后提交
22
+ - **模型**:会话内切换模型与推理等级
23
+ - **文件**:工作区文件列表与下载,只读
24
+ - **界面**:中英双语跟随浏览器,深浅色跟随系统;软键盘弹出时输入框骑在键盘上方;列表底部「进入桌面版」只对本次浏览生效,切换后右下角出现「📱」浮标可返回移动版;沿用 DSH 登录状态,过期有引导,可退出登录
25
+
26
+ ## 快速开始
27
+
28
+ 环境要求:DSH `0.2.2-rc.1`(见「兼容性」)、Node.js ≥ 24;`dsh plugin`
29
+ 需要 pnpm,经 corepack 启用或全局安装:
30
+
31
+ ```bash
32
+ corepack enable
33
+ ```
34
+
35
+ 或
36
+
37
+ ```bash
38
+ npm i -g pnpm
39
+ ```
40
+
41
+ 装好后,两种方式选一种安装;安装完成后重启 DSH 服务,重启命令按实际部署方式调整。
42
+
43
+ ### 方式一:从 npm 安装
44
+
45
+ 适合直接使用,能收到新版本的更新提示:
46
+
47
+ ```bash
48
+ dsh plugin --profile web add dsh-web-mobile-pmsfh
49
+ ```
50
+
51
+ ### 方式二:从源码安装
52
+
53
+ 适合自行修改;克隆目录需保留,更新时在目录内拉取:
54
+
55
+ ```bash
56
+ git clone https://github.com/renlang119/dsh-web-mobile-pmsfh.git
57
+ dsh plugin --profile web add ./dsh-web-mobile-pmsfh
58
+ ```
59
+
60
+ `dsh plugin` 命令安装到 `dsh web` 启动的服务端;DSH 桌面客户端自行管理插件,要在桌面端使用,在客户端的设置 → 插件页里安装。
61
+
62
+ 如果本机 npm 指向国内镜像,无法安装这个包,在命令后面加
63
+ `--registry=https://registry.npmjs.org`。
64
+
65
+ 重启命令示例:
66
+
67
+ ```bash
68
+ sudo systemctl restart dsh-web
69
+ ```
70
+
71
+ 首次访问:用移动设备打开主站会自动跳转,也可以直接开
72
+ `https://<域名>/dsh-web-mobile-pmsfh/`;如果没跳转,检查这次浏览是否点过「进入桌面版」——那是会话级偏好(sessionStorage),关闭页面重新打开即恢复默认。
73
+
74
+ ## 兼容性
75
+
76
+ | DSH | 状态 |
77
+ | --- | --- |
78
+ | `0.2.2-rc.1` | 已适配 |
79
+ | 其他 `0.2.x` | 未验证,端点签名可能不同 |
80
+
81
+ ## 技术栈
82
+
83
+ Node.js 24 · DeepSeek Harness `0.2.2-rc.1` · Cordis 插件 · 原生 JavaScript
84
+ (无构建)· markdown-it
85
+
86
+ 移动页是单页原生 JS 应用,不加载官方前端、不走打包器;运行时没有额外依赖,
87
+ 克隆后即可运行。
88
+
89
+ ## 项目结构
90
+
91
+ ```text
92
+ dsh-web-mobile-pmsfh/
93
+ ├─ lib/index.js host 侧:静态路由与 connection.admit 校验
94
+ ├─ client/client.js 桌面端:窄屏设备跳转到移动页
95
+ ├─ mobile/ 移动页
96
+ │ ├─ index.html
97
+ │ ├─ app.js / app.css
98
+ │ └─ vendor/ markdown-it 与 CJK 标点兼容补丁
99
+ ├─ cordis.patch.yml 插件挂载配置
100
+ ├─ types.d.ts 协议与数据形状定义
101
+ └─ tsconfig.json 仅类型检查,不产出构建物
102
+ ```
103
+
104
+ ## 架构
105
+
106
+ 插件分三个部分,全部落在插件目录内,主仓库零改动;`cordis.patch.yml`
107
+ 把插件插入 profile 层栈完成挂载:
108
+
109
+ | 组件 | 职责 |
110
+ | --- | --- |
111
+ | `lib/index.js` | host 侧:注册 `/dsh-web-mobile-pmsfh/` 下的静态路由,全部置于 DSH 登录门之后 |
112
+ | `client/client.js` | 桌面端注入:把触屏窄屏(coarse pointer 且视口 ≤ 768px)从官方界面跳转过来 |
113
+ | `mobile/` | 独立移动页:原生 JS 单页应用,不加载官方前端、不走打包器 |
114
+
115
+ 移动页与 DSH 的通信全部走 DSH 自身的 wire 协议(Typert Gateway),没有插件私有端点:
116
+
117
+ - `POST /api/<method>`:一元 RPC(会话、工作区、模型、文件等操作)
118
+ - `WS /api/remote.mux`:帧复用长连接(会话日志流、工作区基线、事件总线)
119
+ - `POST /api/$events/result`:审批与问答应答
120
+
121
+ 5 条资源路由,另加 1 条裸路径 302 跳转:
122
+
123
+ | 路径 | 内容 |
124
+ | --- | --- |
125
+ | `/dsh-web-mobile-pmsfh/` | 移动页 |
126
+ | `/dsh-web-mobile-pmsfh/app.js` | 页面脚本 |
127
+ | `/dsh-web-mobile-pmsfh/app.css` | 页面样式 |
128
+ | `/dsh-web-mobile-pmsfh/vendor/markdown-it.min.js` | markdown 渲染 |
129
+ | `/dsh-web-mobile-pmsfh/vendor/markdown-it-cjk-friendly.min.js` | CJK 标点下的 `**` 处理 |
130
+
131
+ 页面文件每次请求从磁盘读取(`no-cache`,内容不变时 304),插件更新并重启 dsh-web 后立即生效;vendor 文件按内容哈希缓存 30 天(`immutable`)。
132
+
133
+ ## DSH 接口依赖
134
+
135
+ 移动页直接调用下列 DSH 内部接口(`session/follow`、`workspace/follow`
136
+ 与 `$events` 走 mux 长连接,其余走一元 RPC):
137
+
138
+ | 接口 | 用途 |
139
+ | --- | --- |
140
+ | `session/list`/`session/create`/`session/prompt`/`session/cancel` | 列表、创建、发消息、停止 |
141
+ | `session/selectModel` / `session/modelCatalog` | 模型与推理等级选择 |
142
+ | `session/page` / `session/follow` | 历史分页与实时日志流 |
143
+ | `workspace/create` / `workspace/rename` / `workspace/delete` | 工作区管理 |
144
+ | `workspace/archiveSession` / `workspace/follow` | 会话归档与工作区基线流 |
145
+ | `directoryPicker/list` / `directoryPicker/createDirectory` | 新建工作区的内联目录浏览器 |
146
+ | `commands/execute` | 权限档位设置(`/permission` 命令) |
147
+ | `fileUploads/upload` | 附件上传,返回凭证随下一条消息发送 |
148
+ | `workspaceFiles/list` / `workspaceFiles/readBytes` | 工作区文件列表与下载 |
149
+ | `$events/result` | 审批与问答应答 |
150
+
151
+ 这些是 DSH 内部接口,没有稳定承诺:校验服务不可用时返回 503,不放行;
152
+ 端点签名变动会导致相应功能不可用,需要等插件适配(见「兼容性」)。
153
+
154
+ ## 质量
155
+
156
+ - **类型**:`types.d.ts` 定义协议与数据形状,源码带 `@ts-check`,
157
+ `tsc --noEmit` 全绿
158
+ - **语法**:`node --check` 覆盖 host 侧与移动页
159
+ - **静态资源**:按内容哈希发 ETag,重复访问返回 304,升级后立即生效
160
+ - **无构建链**:仓库即运行物,没有安装与构建步骤
161
+
162
+ ## 安全
163
+
164
+ - 不自带账号体系:未登录访问插件页被 DSH 登录校验拦下(401);校验服务不可用时返回 503,不放行
165
+ - 经反向代理对外暴露时,在代理层加认证(Basic Auth / OIDC / mTLS),不要把 DSH 端口直接暴露公网
166
+ - 模型输出经 markdown-it 渲染(`html: false`),链接限定
167
+ `http/https/mailto`;HTML 响应带 CSP、nosniff、no-referrer 与
168
+ `X-Frame-Options: DENY`
169
+
170
+ ## 自检与排查
171
+
172
+ - 打不开插件页、被带回 DSH 登录页:未登录或会话过期,先在主站登录
173
+ - 插件页返回 503:DSH 登录校验服务不可用,插件拒绝放行,先恢复 DSH
174
+ 本体
175
+ - 手机打开主站没有进移动页:本次浏览点过「进入桌面版」(会话级偏好,
176
+ sessionStorage),关闭页面重新打开即恢复默认;切到桌面版的手机右下角有「📱」浮标,点它回移动版
177
+ - 会话列表能开但模型列表不可用:DSH 后端模型服务异常,看 DSH 自身日志
178
+ - 升级 DSH 后插件页打不开或行为异常:内部接口签名可能变动,对照「兼容性」确认适配版本,等插件适配新版
179
+
180
+ ## 已知限制
181
+
182
+ - 不列子代理会话(与桌面端一致:子代理不占顶层行)
183
+ - 附件走官方对话附件通道,不写入工作区;工作区文件只读
184
+ - 依赖 DSH 内部接口,没有稳定承诺:端点签名变动会使相应功能不可用,
185
+ 需等插件适配
186
+ - 建议只单人使用:DSH 本身没有多账号区分,多人共用要自己在外面做隔离
187
+
188
+ ## 更新
189
+
190
+ 从 npm 安装的,更新到新版本后重启:
191
+
192
+ ```bash
193
+ dsh plugin --profile web add dsh-web-mobile-pmsfh@latest
194
+ sudo systemctl restart dsh-web
195
+ ```
196
+
197
+ 从源码安装的,在克隆目录拉取最新代码后重启:
198
+
199
+ ```bash
200
+ git pull
201
+ sudo systemctl restart dsh-web
202
+ ```
203
+
204
+ ## 卸载
205
+
206
+ 从 `web` profile 移除插件后重启:
207
+
208
+ ```bash
209
+ dsh plugin --profile web remove dsh-web-mobile-pmsfh
210
+ sudo systemctl restart dsh-web
211
+ ```
212
+
213
+ ## 开发
214
+
215
+ 本地调试建议使用独立的 `DSH_HOME` 与端口,避免影响生产数据:
216
+
217
+ ```bash
218
+ DSH_HOME=~/.dsh-test dsh --profile web --no-open --port 3080
219
+ ```
220
+
221
+ - 无构建链:仓库即运行产物,改动落盘后重启 dsh-web 即生效(页面文件每次请求都从磁盘读)
222
+ - 语法检查 `node --check`,类型检查 `tsc --noEmit`(`@ts-check` 逐文件生效)
223
+ - 调试钩子:页面暴露 `__dshwm.dispatch()`,可向 mux 注入合成帧,用于演练审批与问答弹窗;`__frames` 记录收到的帧类型序列
224
+ - 软键盘适配:`#app` 以 visualViewport 高度为准钉高,配合
225
+ `interactive-widget=resizes-content` meta,保证输入框骑在键盘上方
226
+ - 词典集中在 `mobile/app.js` 顶部的 `T` 对象,中英两套键值对照,改界面文案时两套都要动
227
+
228
+ 实现要点:静态资源按内容哈希发 ETag,重复访问返回 304;内置依赖缓存
229
+ 30 天。
230
+
231
+ ## 许可证
232
+
233
+ [MIT](LICENSE) © 2026 renlang119
@@ -0,0 +1,68 @@
1
+ /**
2
+ * dsh-web-mobile-pmsfh client bundle (v2.2, hand-written lazy-CJS factory).
3
+ *
4
+ * Role: bounce coarse-pointer narrow-viewport browsers (phones) from the
5
+ * official SPA to the standalone mobile page served by the plugin's host half
6
+ * at /dsh-web-mobile-pmsfh/. The old CSS-overlay drawer/touch-target code is retired.
7
+ *
8
+ * Escape hatch (session-scoped): the mobile page's "desktop version" link sets
9
+ * sessionStorage['dsh-web-mobile-pmsfh:desktop'] = '1' before navigating to '/',
10
+ * and this bundle then stays out of the way for that browsing session only —
11
+ * the next fresh visit defaults back to the mobile page.
12
+ *
13
+ * Legacy note: v2.0/v2.1 used a PERMANENT localStorage flag that stranded
14
+ * users on the desktop UI with no way back. This bundle clears that legacy
15
+ * flag on every load so previously-locked browsers recover mobile default.
16
+ */
17
+ window.__ModuleLoader__.load({
18
+ id: 'dsh-web-mobile-pmsfh',
19
+ factory: function (require) {
20
+ var module = { exports: {} }
21
+ var exports = module.exports
22
+
23
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' })
24
+ exports.name = 'dsh-web-mobile-pmsfh'
25
+ exports.inject = []
26
+ exports.apply = function () {
27
+ try {
28
+ if (location.pathname.indexOf('/dsh-web-mobile-pmsfh') === 0) return
29
+ // Remove the legacy permanent escape flag (one-way lock from v2.0/v2.1)
30
+ try { localStorage.removeItem('dsh-web-mobile-pmsfh:desktop') } catch (e) {}
31
+ var escaped = false
32
+ try { escaped = sessionStorage.getItem('dsh-web-mobile-pmsfh:desktop') === '1' } catch (e) {}
33
+ var coarse = window.matchMedia('(pointer: coarse)').matches
34
+ var narrow = window.matchMedia('(max-width: 768px)').matches
35
+ if (!escaped && coarse && narrow) {
36
+ location.replace('/dsh-web-mobile-pmsfh/')
37
+ return
38
+ }
39
+ // Phone chose desktop for this session: give it a way back.
40
+ if (escaped && coarse && narrow) addMobileFab()
41
+ } catch (e) {
42
+ // Redirect is best-effort; never block the official UI on a failure.
43
+ console.warn('[dsh-web-mobile-pmsfh] redirect check failed', e)
44
+ }
45
+ }
46
+
47
+ function addMobileFab() {
48
+ if (document.getElementById('dsh-web-mobile-pmsfh-fab')) return
49
+ var fab = document.createElement('a')
50
+ fab.id = 'dsh-web-mobile-pmsfh-fab'
51
+ fab.href = '/dsh-web-mobile-pmsfh/'
52
+ fab.textContent = '📱'
53
+ fab.title = '移动版'
54
+ fab.setAttribute('aria-label', '移动版')
55
+ fab.style.cssText = 'position:fixed;right:12px;bottom:calc(12px + env(safe-area-inset-bottom,0px));' +
56
+ 'z-index:2200;width:44px;height:44px;border-radius:22px;display:flex;align-items:center;' +
57
+ 'justify-content:center;background:#1a1a1a;color:#fff;font-size:20px;text-decoration:none;' +
58
+ 'box-shadow:0 2px 10px rgba(0,0,0,.35);opacity:.85;'
59
+ var append = function () {
60
+ if (document.body && !document.getElementById('dsh-web-mobile-pmsfh-fab')) document.body.appendChild(fab)
61
+ }
62
+ if (document.body) append()
63
+ else document.addEventListener('DOMContentLoaded', append)
64
+ }
65
+
66
+ return module.exports
67
+ },
68
+ })
@@ -0,0 +1,4 @@
1
+ # dsh bundle patch: inserts this plugin into a profile's layer stack.
2
+ - insert:
3
+ - id: dsh-web-mobile-pmsfh
4
+ name: 'dsh-web-mobile-pmsfh'