dsh-mobile 0.1.0-alpha.32 → 0.1.0-alpha.33
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.en.md +26 -74
- package/README.md +27 -78
- package/lib/index.d.mts +1 -1
- package/lib/index.mjs +67 -3
- package/package.json +11 -1
package/README.en.md
CHANGED
|
@@ -19,15 +19,19 @@
|
|
|
19
19
|
|
|
20
20
|
<p align="center"><a href="https://github.com/saya-ch/dsh-mobile/releases"><strong>Download the Android app</strong></a></p>
|
|
21
21
|
|
|
22
|
-
DSH Mobile is a DeepSeek Harness plugin that lets a mobile browser or the Android app connect over a protected LAN and keep using the same sessions, Workspaces, messages, and tools. It is a mobile entry point only; the DeepSeek Harness source is not modified.
|
|
22
|
+
DSH Mobile is a DeepSeek Harness plugin that lets a mobile browser or the Android app connect over a protected LAN and keep using the same sessions, Workspaces, messages, and tools. It is a mobile entry point only; the DeepSeek Harness source is not modified and no public-Internet tunneling is needed.
|
|
23
|
+
|
|
24
|
+
It also lets you customize the phone from a DSH conversation: `/mobile <what you want>`.
|
|
23
25
|
|
|
24
26
|
## What it does
|
|
25
27
|
|
|
26
|
-
- Continue DSH work from a phone
|
|
27
|
-
-
|
|
28
|
-
- A dedicated touch layout
|
|
29
|
-
- Auto-discovery
|
|
30
|
-
-
|
|
28
|
+
- **Continue DSH work from a phone**: the same sessions, Workspaces, messages, and tools, in real time.
|
|
29
|
+
- **Customize the phone UI by talking to DSH**: change the mobile layout, interactions, and features from a conversation; open pages refresh within seconds.
|
|
30
|
+
- **A dedicated touch layout**: session drawer, tool details, settings, and composer reorganized for phones.
|
|
31
|
+
- **Auto-discovery, no re-pairing**: Wi-Fi, hotspot, or IP changes normally recover automatically.
|
|
32
|
+
- **Three pairing options**: scan a QR code, paste a pairing link, or enter a key.
|
|
33
|
+
|
|
34
|
+
A paired device is fully trusted and can operate the DSH on the computer. Use this only on a trusted home or office LAN, or a trusted VPN.
|
|
31
35
|
|
|
32
36
|
## Quick start
|
|
33
37
|
|
|
@@ -48,86 +52,34 @@ pnpm dsh plugin --profile web exec dsh-mobile setup
|
|
|
48
52
|
pnpm dsh --profile web
|
|
49
53
|
```
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
After starting DSH, open **Mobile Access** in the lower-left sidebar, enable it, then:
|
|
55
|
+
After starting DSH, open **Mobile Access** in the lower-left sidebar, then:
|
|
54
56
|
|
|
55
57
|
1. Select **Create and copy key** or **Copy pairing link**; the panel shows a pairing QR code.
|
|
56
58
|
2. In the Android app, tap **Scan QR code** and point the camera at the screen — or tap **Scan**, select the computer, and paste the key or pairing link.
|
|
57
59
|
3. Pairing establishes persistent device trust; later launches do not ask again.
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
The plugin does not modify the DeepSeek Harness source. Settings, certificates, devices, and customization files live under `$DSH_HOME/mobile-access/`.
|
|
62
|
-
|
|
63
|
-
## App or mobile browser
|
|
64
|
-
|
|
65
|
-
| Client | Best for | Notes |
|
|
66
|
-
| --- | --- | --- |
|
|
67
|
-
| Android app | Everyday use | Auto-discovery; private certificate pinning inside the app, no manual browser trust step |
|
|
68
|
-
| Mobile browser | Temporary or cross-platform | Open the HTTPS origin shown by Mobile Access; trust the certificate manually on first visit |
|
|
69
|
-
|
|
70
|
-
Discovery uses mDNS/NSD, UDP announcements and queries, plus HTTPS probing. It publishes only the device name, address, port, protocol version, and stable `instanceId` — never keys or device tokens. IP changes do not require another pairing.
|
|
71
|
-
|
|
72
|
-
For a browser's first connection, open pairing on the computer, then select **Copy pairing link** and open that link on the phone — the pairing code is prefilled. Alternatively, visit `/mobile-access/pair` on the shown HTTPS origin and enter the 43-character pairing code after the key's final dot. The browser stores a revocable device credential after pairing.
|
|
73
|
-
|
|
74
|
-
## Mobile UI
|
|
75
|
-
|
|
76
|
-
Phones use a dedicated layout shell that no longer depends on the desktop three-column DOM, while native components keep a small touch-adaptation layer:
|
|
77
|
-
|
|
78
|
-
- A workspace-and-session drawer opens from the top-left.
|
|
79
|
-
- Conversations, traces, tool details, and Session logs keep their full capabilities.
|
|
80
|
-
- Settings use top-level tabs and a single column.
|
|
81
|
-
- The composer keeps command, permission, model, context, image, and send controls.
|
|
82
|
-
- **Add Workspace** browses computer folders inside the phone page instead of opening a system picker on the computer.
|
|
83
|
-
|
|
84
|
-
The Android app is a thin Kotlin WebView shell and contains no frontend copy; mobile browsers load the same page. For compatibility diagnosis, append `?frontend=stock` to the browser URL to temporarily use the previous desktop-page adaptation.
|
|
61
|
+
`setup` automatically selects and remembers the current LAN; Wi-Fi, hotspot, and IP changes normally recover without re-pairing. Use `--address 192.168.x.x` only when automatic selection fails. Settings, certificates, devices, and customization files live under `$DSH_HOME/mobile-access/`.
|
|
85
62
|
|
|
86
|
-
##
|
|
63
|
+
## Extend and customize
|
|
87
64
|
|
|
88
|
-
|
|
65
|
+
Type `/mobile <what you want>` in a DSH conversation, and DSH edits the phone client's files for you; changes apply within a few seconds. For example:
|
|
89
66
|
|
|
90
67
|
```text
|
|
91
|
-
|
|
92
|
-
$DSH_HOME/mobile-access/mobile.js
|
|
68
|
+
/mobile turn the phone UI into an old CRT terminal, with messages scrolling like terminal output
|
|
93
69
|
```
|
|
94
70
|
|
|
95
|
-
|
|
71
|
+
Two kinds of changes are supported: the phone UI itself (theme, layout, buttons), and computer capabilities the phone can use (browsing computer files, running programs on the computer). `/mobile` hands the request to the DSH agent, which edits files under the local DSH configuration directory (`$DSH_HOME/mobile-access/`); the phone client applies them automatically. UI changes live in `mobile.css`/`mobile.js`. Computer capabilities come from extensions under `extensions/`, whose `host.mjs` runs with the local user's privileges on the computer. DeepSeek Harness source is not modified.
|
|
96
72
|
|
|
97
|
-
|
|
98
|
-
Edit $DSH_HOME/mobile-access/mobile.css and mobile.js to turn the mobile
|
|
99
|
-
client into a one-handed development console: add a bottom shortcut bar,
|
|
100
|
-
a session status panel, and a press-and-hold voice entry. Narrow screens only;
|
|
101
|
-
do not modify the DSH source.
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Changes are applied to open Android and browser pages within a few seconds. `mobile.css` and `mobile.js` own the phone UI, interactions, and orchestration of existing APIs; they cannot create computer files, run commands, or access computer hardware by themselves. Browsers fall back to available Web APIs, while the Android app exposes a narrow native bridge for file picking, camera capture, sharing, clipboard, notifications, and speech.
|
|
105
|
-
|
|
106
|
-
### Add computer-side capabilities
|
|
107
|
-
|
|
108
|
-
For a new capability on the computer, create an extension under `$DSH_HOME/mobile-access/extensions/<id>/`:
|
|
73
|
+
> When using computer-side capabilities, use only content you trust.
|
|
109
74
|
|
|
110
|
-
|
|
111
|
-
extension.json # metadata
|
|
112
|
-
host.mjs # trusted local Node.js code
|
|
113
|
-
mobile.js # optional phone-side script
|
|
114
|
-
mobile.css # optional phone-side styles
|
|
115
|
-
assets/ # optional static files
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Generate a complete starter extension with:
|
|
119
|
-
|
|
120
|
-
```powershell
|
|
121
|
-
dsh plugin --profile web exec dsh-mobile extension create media-tools --name "Media tools"
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
`host.mjs` can register schema-validated actions, ordinary HTTP/streaming/SSE routes, and teardown effects; `mobile.js` calls them through `api.host.invoke()` or `api.host.fetch()`. Extension source files can be changed only on the computer by the user or DSH; the phone has no endpoint that writes them. Closing Mobile Access, revoking a device, refreshing an extension, or stopping the gateway aborts its active requests.
|
|
125
|
-
|
|
126
|
-
A published DSH plugin can also call `ctx.mobileAccess.registerExtension(definition)` from a Cordis effect. It shares the same authentication, routes, and client SDK as local directory extensions without modifying DSH core.
|
|
75
|
+
## App or mobile browser
|
|
127
76
|
|
|
128
|
-
|
|
77
|
+
| Client | Best for | Notes |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| Android app | Everyday use | Auto-discovery; private certificate pinning inside the app, no manual browser trust step |
|
|
80
|
+
| Mobile browser | Temporary or cross-platform | Open the HTTPS origin shown by Mobile Access; trust the certificate manually on first visit |
|
|
129
81
|
|
|
130
|
-
|
|
82
|
+
The Android app is a thin Kotlin WebView shell and contains no frontend copy; mobile browsers load the same page. For compatibility diagnosis, append `?frontend=stock` to the browser URL to temporarily use the previous desktop-page adaptation.
|
|
131
83
|
|
|
132
84
|
## How it works
|
|
133
85
|
|
|
@@ -137,7 +89,7 @@ flowchart LR
|
|
|
137
89
|
Gateway -->|"loopback proxy"| DSH["Stock DSH Web and Host"]
|
|
138
90
|
```
|
|
139
91
|
|
|
140
|
-
|
|
92
|
+
Three layers: the Host face for discovery, pairing, HTTPS, loopback proxying, and extension registration; the Client face for the dedicated mobile layout and extension SDK; and the Android app for a narrow native bridge. Neither the DeepSeek Harness source nor its desktop page on port 3080 is modified.
|
|
141
93
|
|
|
142
94
|
## Security
|
|
143
95
|
|
|
@@ -151,9 +103,9 @@ See [SECURITY.md](SECURITY.md).
|
|
|
151
103
|
|
|
152
104
|
| DSH Mobile | Verified DeepSeek Harness releases |
|
|
153
105
|
| --- | --- |
|
|
154
|
-
| `0.1.0-alpha.
|
|
106
|
+
| `0.1.0-alpha.33` | `0.1.0-rc.5`, `0.1.0-rc.6`, `0.1.0-rc.7` |
|
|
155
107
|
|
|
156
|
-
At startup, the plugin verifies the DSH Host version and the frontend dependencies required by the mobile layout
|
|
108
|
+
At startup, the plugin verifies the DSH Host version and the frontend dependencies required by the mobile layout; an unverified release fails with a clear error instead of serving a broken page. CI also tracks the DSH main branch layout contract. If a DSH upgrade reports an incompatibility, update DSH Mobile first.
|
|
157
109
|
|
|
158
110
|
## Uninstall
|
|
159
111
|
|
package/README.md
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
16
|
<p align="center">
|
|
17
|
+
<a href="#能做什么">能做什么</a> ·
|
|
17
18
|
<a href="#快速开始">快速开始</a> ·
|
|
18
|
-
<a href="
|
|
19
|
-
<a href="#在-dsh-对话中自定义">自定义</a> ·
|
|
19
|
+
<a href="#扩展与自定义">扩展与自定义</a> ·
|
|
20
20
|
<a href="README.en.md">English</a>
|
|
21
21
|
</p>
|
|
22
22
|
|
|
@@ -26,13 +26,17 @@
|
|
|
26
26
|
|
|
27
27
|
DSH Mobile 是一个 DeepSeek Harness 插件,让手机浏览器或 Android App 在受保护的局域网内连接电脑,继续使用同一份会话、工作区、消息和工具。它只作为移动入口接入,不修改 DeepSeek Harness 源码。
|
|
28
28
|
|
|
29
|
+
它还能在 DSH 对话里用 `/mobile <需求>` 定制手机端。
|
|
30
|
+
|
|
29
31
|
## 能做什么
|
|
30
32
|
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
33
|
+
- **在手机上继续电脑端的工作**:同一份会话、工作区、消息和工具,实时同步。
|
|
34
|
+
- **用对话定制手机端**:直接在 DSH 对话里改手机页面的布局、交互和功能,几秒内刷新。
|
|
35
|
+
- **专属触屏布局**:会话抽屉、工具详情、设置和输入栏都按手机重新组织。
|
|
36
|
+
- **自动发现、无需重新配对**:切换 Wi-Fi、热点或 IP 后通常自动恢复。
|
|
37
|
+
- **三种配对方式**:扫码、配对链接、密钥。
|
|
38
|
+
|
|
39
|
+
配对设备被视为完全信任,可以操作电脑上的 DSH;建议只在可信的家庭、办公局域网或可信 VPN 中使用。
|
|
36
40
|
|
|
37
41
|
## 快速开始
|
|
38
42
|
|
|
@@ -53,86 +57,33 @@ pnpm dsh plugin --profile web exec dsh-mobile setup
|
|
|
53
57
|
pnpm dsh --profile web
|
|
54
58
|
```
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
启动后,在 DeepSeek Harness 左下角打开“移动访问”并确认已开启,然后:
|
|
60
|
+
启动后,在 DeepSeek Harness 左下角打开“移动访问”,然后:
|
|
59
61
|
|
|
60
62
|
1. 点击“生成并复制密钥”或“复制配对链接”,面板会显示配对二维码。
|
|
61
|
-
2. Android App
|
|
63
|
+
2. Android App 点击“扫码配对”,把手机对准电脑屏幕上的二维码即可;也可以点击“扫描”选择电脑后粘贴密钥或配对链接。
|
|
62
64
|
3. 配对完成后会建立持久设备信任,以后打开 App 无需重复输入。
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
插件不会修改 DeepSeek Harness 源码。设置、证书、设备和自定义文件保存在 `$DSH_HOME/mobile-access/`。
|
|
67
|
-
|
|
68
|
-
## App 与手机浏览器
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
| 方式 | 适合场景 | 说明 |
|
|
72
|
-
| ------------- | ------------------ | ------------------------------------------------------------------------- |
|
|
73
|
-
| Android App | 日常使用 | 自动发现;App 内保存私有证书信任,无需在浏览器手动信任证书 |
|
|
74
|
-
| 手机浏览器 | 临时或跨平台访问 | 打开“移动访问”卡片显示的 HTTPS 地址;首次连接需在浏览器手动信任该证书 |
|
|
75
|
-
|
|
76
|
-
Android 使用 mDNS/NSD、UDP 公告与主动查询、HTTPS 探测等方式发现 DeepSeek Harness。发现广播设备名、地址、端口、协议版本和稳定 `instanceId`,不会广播密钥或令牌。IP 变化后不需要重新配对。
|
|
77
|
-
|
|
78
|
-
手机浏览器首次连接:在电脑端开启配对后,点击“复制配对链接”并把链接发到手机浏览器打开,配对码会自动填入;也可以打开 HTTPS 地址中的 `/mobile-access/pair`,手动输入密钥最后一段的 43 位配对码。配对完成后,浏览器会保存可撤销的设备凭据。
|
|
79
|
-
|
|
80
|
-
## 移动端界面
|
|
81
|
-
|
|
82
|
-
手机端使用独立的移动布局外壳,不再依赖桌面三栏 DOM;原生的对话、工具、设置等组件保留触屏适配:
|
|
83
|
-
|
|
84
|
-
- 左上角打开工作区与会话抽屉。
|
|
85
|
-
- 对话、轨迹、工具详情和 Session log 保持原有能力。
|
|
86
|
-
- 设置页使用顶部分类和单列内容。
|
|
87
|
-
- 输入栏保留命令、权限、模型、上下文、图片和发送控件。
|
|
88
|
-
- “添加工作区”在手机上展示电脑目录,不会在电脑上弹系统选择器。
|
|
89
|
-
|
|
90
|
-
Android App 只是 Kotlin WebView 薄壳,不内置另一份网页;手机浏览器访问的也是同一页面。需要排查兼容性时,可在浏览器地址后追加 `?frontend=stock`,临时回到旧的桌面页面适配模式。
|
|
66
|
+
`setup` 会自动选择并记住当前局域网,切换 Wi-Fi、热点或 IP 后通常自动恢复;仅在自动选择失败时使用 `--address 192.168.x.x`。设置、证书、设备和自定义文件保存在 `$DSH_HOME/mobile-access/`。
|
|
91
67
|
|
|
92
|
-
##
|
|
68
|
+
## 扩展与自定义
|
|
93
69
|
|
|
94
|
-
|
|
70
|
+
在 DSH 对话里输入 `/mobile <需求>`,DSH 会直接修改手机端的文件,几秒内生效。例如:
|
|
95
71
|
|
|
96
72
|
```text
|
|
97
|
-
|
|
98
|
-
$DSH_HOME/mobile-access/mobile.js
|
|
73
|
+
/mobile 把手机端做成老式终端的样子,让消息像终端输出一样逐行滚动
|
|
99
74
|
```
|
|
100
75
|
|
|
101
|
-
|
|
76
|
+
`/mobile` 把需求交给 DSH 对话中的 agent,由它直接修改本机 `$DSH_HOME/mobile-access/` 下的文件,保存后手机端自动生效。改动分两类:界面和交互在 `mobile.css`/`mobile.js`;需要电脑能力时用 `extensions/` 下的扩展,其 `host.mjs` 以本机用户权限在电脑上运行。不修改 DeepSeek Harness 源码。
|
|
102
77
|
|
|
103
|
-
|
|
104
|
-
请编辑 $DSH_HOME/mobile-access/mobile.css 和 mobile.js,
|
|
105
|
-
把移动端改成适合单手操作的开发控制台:增加底部快捷指令、
|
|
106
|
-
会话状态面板和长按语音入口。只影响窄屏,不修改 DSH 源码。
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
保存后,已打开的 App 和浏览器通常会在几秒内应用变化。`mobile.css` 和 `mobile.js` 负责手机页面的样式、交互和已有 API 编排;它们不能单独创建电脑文件、运行命令或访问电脑硬件。浏览器按 Web API 能力降级,Android App 通过受限的原生 Bridge 提供文件选择、拍照、分享、剪贴板、通知和语音等能力。
|
|
110
|
-
|
|
111
|
-
### 扩展电脑端能力
|
|
112
|
-
|
|
113
|
-
需要手机调用新的电脑能力时,在 `$DSH_HOME/mobile-access/extensions/<id>/` 创建扩展:
|
|
114
|
-
|
|
115
|
-
```text
|
|
116
|
-
extension.json # 元数据
|
|
117
|
-
host.mjs # 电脑端 Node.js 代码(可信本地代码)
|
|
118
|
-
mobile.js # 手机端脚本,可选
|
|
119
|
-
mobile.css # 手机端样式,可选
|
|
120
|
-
assets/ # 静态资源,可选
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
可用命令生成模板:
|
|
124
|
-
|
|
125
|
-
```powershell
|
|
126
|
-
dsh plugin --profile web exec dsh-mobile extension create media-tools --name "媒体工具"
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
`host.mjs` 可以注册经过 Schema 校验的 Action、普通 HTTP/流式/SSE Route 和清理 Effect;`mobile.js` 通过 `api.host.invoke()` 或 `api.host.fetch()` 调用它们。扩展文件只能在电脑端由用户或 DSH 修改,手机没有写入这些文件的接口。Mobile Access 关闭、设备撤销、扩展刷新或网关关闭时,扩展请求会被中止。
|
|
78
|
+
## App 与手机浏览器
|
|
130
79
|
|
|
131
|
-
发布型 DSH 插件也可以在 Cordis effect 中调用 `ctx.mobileAccess.registerExtension(definition)`,与本地目录扩展共用认证、路由和客户端 SDK,不需要修改 DSH 核心。
|
|
132
80
|
|
|
133
|
-
|
|
81
|
+
| 方式 | 适合场景 | 说明 |
|
|
82
|
+
| ------------- | ------------------ | ------------------------------------------------------------------------- |
|
|
83
|
+
| Android App | 日常使用 | 自动发现;App 内保存私有证书信任,无需在浏览器手动信任证书 |
|
|
84
|
+
| 手机浏览器 | 临时或跨平台访问 | 打开“移动访问”卡片显示的 HTTPS 地址;首次连接需在浏览器手动信任该证书 |
|
|
134
85
|
|
|
135
|
-
|
|
86
|
+
Android App 只是 Kotlin WebView 薄壳,不内置另一份网页;手机浏览器访问的是同一页面。需要排查兼容性时,可在浏览器地址后追加 `?frontend=stock`,临时回到旧的桌面页面适配模式。
|
|
136
87
|
|
|
137
88
|
## 工作原理
|
|
138
89
|
|
|
@@ -143,7 +94,7 @@ flowchart LR
|
|
|
143
94
|
DSH -->|"同一工作区、会话和事件流"| Phone
|
|
144
95
|
```
|
|
145
96
|
|
|
146
|
-
插件包含三层:Host face
|
|
97
|
+
插件包含三层:Host face 负责发现、配对、HTTPS、回环代理和扩展注册表;Client face 提供独立的移动布局与扩展 SDK;Android App 提供受限的原生 Bridge。DeepSeek Harness 的源码和 3080 桌面页面都不会被修改,安装和卸载完全通过插件机制完成。
|
|
147
98
|
|
|
148
99
|
## 安全
|
|
149
100
|
|
|
@@ -158,14 +109,12 @@ flowchart LR
|
|
|
158
109
|
|
|
159
110
|
| DSH Mobile | 已验证的 DeepSeek Harness |
|
|
160
111
|
| ------------------ | ------------------------------------------ |
|
|
161
|
-
| `0.1.0-alpha.
|
|
112
|
+
| `0.1.0-alpha.33` | `0.1.0-rc.5`、`0.1.0-rc.6`、`0.1.0-rc.7` |
|
|
162
113
|
|
|
163
|
-
|
|
114
|
+
插件启动时会检查 DSH Host 版本和移动布局所需的前端依赖,遇到未经验证的版本会直接报错而不是带病启动;CI 也会持续跟踪 DSH 主分支的布局契约。升级 DSH 后如遇兼容提示,请先升级 DSH Mobile。
|
|
164
115
|
|
|
165
116
|
## 卸载
|
|
166
117
|
|
|
167
|
-
保留设备和自定义数据:
|
|
168
|
-
|
|
169
118
|
```powershell
|
|
170
119
|
dsh plugin --profile web remove dsh-mobile
|
|
171
120
|
```
|
package/lib/index.d.mts
CHANGED
|
@@ -590,7 +590,7 @@ declare const WS_PATHS: Set<string>;
|
|
|
590
590
|
//#region src/plugin.d.ts
|
|
591
591
|
/** Stable Cordis plugin name. */
|
|
592
592
|
declare const name = "dsh-mobile";
|
|
593
|
-
/** The stock WebServer
|
|
593
|
+
/** The stock WebServer serves the control card; commands exposes /mobile to the DSH agent. */
|
|
594
594
|
declare const inject: string[];
|
|
595
595
|
/** Mount the resident control route and its optional authenticated LAN gateway. */
|
|
596
596
|
declare function apply(ctx: Context, config: PluginConfig): Promise<void>;
|
package/lib/index.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import { pipeline } from "node:stream/promises";
|
|
|
14
14
|
import Bonjour from "bonjour-service";
|
|
15
15
|
import * as QRCode from "qrcode";
|
|
16
16
|
import { Service } from "@deepseek-ai/cordis";
|
|
17
|
+
import { boundContextSummary, createUserMessage } from "@deepseek-ai/dsh-llm/message";
|
|
17
18
|
import { execFile } from "node:child_process";
|
|
18
19
|
import { promisify } from "node:util";
|
|
19
20
|
import { generate } from "selfsigned";
|
|
@@ -3248,6 +3249,39 @@ var MemoryDeviceStore = class {
|
|
|
3248
3249
|
return structuredClone(this.snapshot);
|
|
3249
3250
|
}
|
|
3250
3251
|
};
|
|
3252
|
+
//#endregion
|
|
3253
|
+
//#region src/mobile-guide.ts
|
|
3254
|
+
/**
|
|
3255
|
+
* Instructions handed to the DSH agent when the user runs `/mobile <task>`.
|
|
3256
|
+
* The agent edits files under the DSH home; this text is what tells it the
|
|
3257
|
+
* layout of the mobile-access customization surface so it does not guess.
|
|
3258
|
+
*/
|
|
3259
|
+
const MOBILE_CUSTOMIZATION_GUIDE = `你在为用户定制 DSH Mobile 的手机端。DSH Mobile 是一个把电脑上的 DeepSeek Harness 带到手机浏览器的插件,手机端界面和能力都来自本机文件。
|
|
3260
|
+
|
|
3261
|
+
所有改动只允许在 $DSH_HOME/mobile-access/ 目录内进行,绝不修改 DeepSeek Harness 的源码或其他目录。$DSH_HOME 是 DeepSeek Harness 的配置目录(通常为 ~/.dsh),先确认它的实际路径再操作。
|
|
3262
|
+
|
|
3263
|
+
手机端的能力分两层,按用户需求选择改动目标:
|
|
3264
|
+
|
|
3265
|
+
1. 界面与交互 —— 只改外观和交互,不需要碰电脑的文件或程序:
|
|
3266
|
+
- $DSH_HOME/mobile-access/mobile.css:手机端样式
|
|
3267
|
+
- $DSH_HOME/mobile-access/mobile.js:手机端脚本,用 window.dshMobile.register(({ root }) => { ... }) 把内容挂载到 root,返回清理函数
|
|
3268
|
+
- 保存后手机端几秒内自动应用,无需重启
|
|
3269
|
+
|
|
3270
|
+
2. 电脑端能力 —— 手机需要读电脑文件、执行命令或访问硬件时,创建扩展:
|
|
3271
|
+
- 目录:$DSH_HOME/mobile-access/extensions/<id>/,id 用小写字母数字和连字符(如 media-remote)
|
|
3272
|
+
- extension.json:{"schemaVersion":1,"id":"<id>","name":"显示名","version":"0.1.0","description":"说明"}
|
|
3273
|
+
- host.mjs:电脑端 Node.js 代码(可信本地代码,可读写文件、执行命令)。导出默认函数 (api) => { ... },用 api.action('名称', { input, run }) 注册动作、api.route({ method, path, handle }) 注册路由、api.effect(fn) 注册清理
|
|
3274
|
+
- mobile.js:手机端脚本,用 window.dshMobile.define({ apiVersion:1, id:'<id>', activate(api) { ... } }),activate 返回清理函数
|
|
3275
|
+
- mobile.css:手机端样式(可选)
|
|
3276
|
+
- assets/:手机端静态资源(可选)
|
|
3277
|
+
- mobile.js 里用 api.host.invoke('动作名', 输入) 调 host.mjs 的 action,api.host.fetch('/路由路径') 调 route
|
|
3278
|
+
- 也可以先用命令生成模板:dsh plugin --profile web exec dsh-mobile extension create <id> --name "<名称>",再在模板上改
|
|
3279
|
+
|
|
3280
|
+
安全约束:
|
|
3281
|
+
- host.mjs 拥有电脑用户的完整权限,绝不能放入不可信代码,也不要让手机端无条件执行任意命令
|
|
3282
|
+
- 所有改动只限 $DSH_HOME/mobile-access/,不要动 DeepSeek Harness 源码
|
|
3283
|
+
|
|
3284
|
+
请执行用户需求:外观或交互类改 mobile.css / mobile.js;需要电脑能力的创建或修改扩展。完成后简要说明改了什么、手机端会有什么变化。`;
|
|
3251
3285
|
promisify(execFile);
|
|
3252
3286
|
const VIRTUAL_INTERFACE_MARKERS = [
|
|
3253
3287
|
"bridge",
|
|
@@ -3453,8 +3487,8 @@ async function materializeManagedSetup(setup, table) {
|
|
|
3453
3487
|
//#region src/plugin.ts
|
|
3454
3488
|
/** Stable Cordis plugin name. */
|
|
3455
3489
|
const name = "dsh-mobile";
|
|
3456
|
-
/** The stock WebServer
|
|
3457
|
-
const inject = ["webServer"];
|
|
3490
|
+
/** The stock WebServer serves the control card; commands exposes /mobile to the DSH agent. */
|
|
3491
|
+
const inject = ["webServer", "commands"];
|
|
3458
3492
|
function installedDshVersion() {
|
|
3459
3493
|
const manifest = createRequire(import.meta.url)("@deepseek-ai/dsh-host-webserver/package.json");
|
|
3460
3494
|
if (manifest === null || typeof manifest !== "object") return void 0;
|
|
@@ -3634,19 +3668,49 @@ async function apply(ctx, config) {
|
|
|
3634
3668
|
};
|
|
3635
3669
|
await ctx.effect(async () => {
|
|
3636
3670
|
const unregister = ctx.webServer.register(adminRoute);
|
|
3671
|
+
const disposeMobileCommand = ctx.commands.register({
|
|
3672
|
+
name: "mobile",
|
|
3673
|
+
description: "按需求修改 DSH Mobile 的手机端界面或添加电脑端能力",
|
|
3674
|
+
input: { hint: "<要做什么>" },
|
|
3675
|
+
handler: ({ agent, rawInput }) => {
|
|
3676
|
+
const task = rawInput.trim();
|
|
3677
|
+
if (task === "") return {
|
|
3678
|
+
kind: "error",
|
|
3679
|
+
text: "请带上需求,例如:/mobile 把手机端改成深色主题"
|
|
3680
|
+
};
|
|
3681
|
+
agent.steer(createUserMessage({
|
|
3682
|
+
content: [{
|
|
3683
|
+
type: "text",
|
|
3684
|
+
text: `${MOBILE_CUSTOMIZATION_GUIDE}\n\n用户需求:${task}`
|
|
3685
|
+
}],
|
|
3686
|
+
source: {
|
|
3687
|
+
kind: "plugin",
|
|
3688
|
+
plugin: "dsh-mobile",
|
|
3689
|
+
form: "notice",
|
|
3690
|
+
summary: boundContextSummary(`/mobile ${task}`)
|
|
3691
|
+
}
|
|
3692
|
+
}));
|
|
3693
|
+
return {
|
|
3694
|
+
kind: "success",
|
|
3695
|
+
text: "已把需求交给 DSH 处理,改动会在手机端几秒内生效。"
|
|
3696
|
+
};
|
|
3697
|
+
}
|
|
3698
|
+
});
|
|
3637
3699
|
try {
|
|
3638
3700
|
await controller.initialize();
|
|
3639
3701
|
} catch (error) {
|
|
3640
3702
|
unregister();
|
|
3703
|
+
disposeMobileCommand();
|
|
3641
3704
|
unregisterBuiltin();
|
|
3642
3705
|
throw error;
|
|
3643
3706
|
}
|
|
3644
3707
|
return async () => {
|
|
3645
3708
|
unregister();
|
|
3709
|
+
disposeMobileCommand();
|
|
3646
3710
|
await controller.close();
|
|
3647
3711
|
unregisterBuiltin();
|
|
3648
3712
|
};
|
|
3649
|
-
}, "dsh-mobile: local control
|
|
3713
|
+
}, "dsh-mobile: local control, authenticated LAN gateway, and /mobile command");
|
|
3650
3714
|
}
|
|
3651
3715
|
//#endregion
|
|
3652
3716
|
export { AUTH_PREFIX, AccessController, AccessError, BoundedRateLimiter, CSRF_COOKIE, CSRF_HEADER, Config, DEVICE_COOKIE, EXTENSION_LIMITS, JsonDeviceStore, JsonMobileAccessControlStore, LOCAL_ADMIN_PREFIX, MemoryDeviceStore, MobileAccessGateway, MobileAccessGatewayController, MobileAccessService, MobileExtensionError, RequestTrustPolicy, SESSION_COOKIE, SUPPORTED_DSH_VERSIONS, WS_PATHS, addressAllowed, apply, assertExtensionId, assertSupportedDshVersion, createMobileAccessService, inject, isLoopbackAddress, name, parseAuthority, parseCidr, parseControlFile, parseDeviceSnapshot, parseExtensionManifest, parseGatewayConfig, parseMobileAccessControlState, resolveAuthority, rewriteMobileIndex };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mobile",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.33",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "DeepSeek Harness 移动端适配与安全局域网访问插件,支持 Android App 和手机浏览器。",
|
|
6
6
|
"type": "module",
|
|
@@ -89,16 +89,24 @@
|
|
|
89
89
|
"license": "Apache-2.0",
|
|
90
90
|
"peerDependencies": {
|
|
91
91
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
92
|
+
"@deepseek-ai/dsh-commands": "0.1.0-rc.6 || 0.1.0-rc.7",
|
|
92
93
|
"@deepseek-ai/dsh-host-webserver": "0.1.0-rc.5 || 0.1.0-rc.6 || 0.1.0-rc.7",
|
|
94
|
+
"@deepseek-ai/dsh-llm": "0.1.0-rc.6 || 0.1.0-rc.7",
|
|
93
95
|
"react": "^18.2.0"
|
|
94
96
|
},
|
|
95
97
|
"peerDependenciesMeta": {
|
|
96
98
|
"@deepseek-ai/cordis": {
|
|
97
99
|
"optional": true
|
|
98
100
|
},
|
|
101
|
+
"@deepseek-ai/dsh-commands": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
99
104
|
"@deepseek-ai/dsh-host-webserver": {
|
|
100
105
|
"optional": true
|
|
101
106
|
},
|
|
107
|
+
"@deepseek-ai/dsh-llm": {
|
|
108
|
+
"optional": true
|
|
109
|
+
},
|
|
102
110
|
"react": {
|
|
103
111
|
"optional": true
|
|
104
112
|
}
|
|
@@ -111,7 +119,9 @@
|
|
|
111
119
|
},
|
|
112
120
|
"devDependencies": {
|
|
113
121
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
122
|
+
"@deepseek-ai/dsh-commands": "^0.1.0-rc.7",
|
|
114
123
|
"@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.7",
|
|
124
|
+
"@deepseek-ai/dsh-llm": "^0.1.0-rc.7",
|
|
115
125
|
"@types/js-yaml": "^4.0.9",
|
|
116
126
|
"@types/node": "^24.3.0",
|
|
117
127
|
"@types/qrcode": "^1.5.5",
|