@dsh-mobile/mobile-remote 3.4.1-beta.2 → 3.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/PRIVACY-POLICY.en.md +7 -2
- package/docs/PRIVACY-POLICY.md +7 -2
- package/docs/TERMS-OF-SERVICE.en.md +3 -2
- package/docs/TERMS-OF-SERVICE.md +3 -2
- package/lib/backup.js +30 -0
- package/lib/config.js +10 -0
- package/lib/host-plugins.js +290 -0
- package/lib/host-schedule.js +206 -0
- package/lib/host-team.js +89 -0
- package/lib/index.js +196 -3281
- package/lib/live-activity.js +351 -0
- package/lib/memory/context.js +17 -3
- package/lib/memory/decay.js +68 -4
- package/lib/memory/promises.js +116 -0
- package/lib/memory/routes.js +113 -1
- package/lib/memory/store.js +212 -13
- package/lib/memory/turn-hook.js +109 -0
- package/lib/phone-announce.js +6 -5
- package/lib/protocol.js +13 -0
- package/lib/routes/agents.js +405 -0
- package/lib/routes/app-state.js +178 -0
- package/lib/routes/backup.js +144 -0
- package/lib/routes/diagnostics.js +227 -0
- package/lib/routes/files.js +326 -0
- package/lib/routes/git.js +53 -0
- package/lib/routes/history.js +313 -0
- package/lib/routes/host-services.js +51 -0
- package/lib/routes/models.js +462 -0
- package/lib/routes/notifications.js +183 -0
- package/lib/routes/pairing.js +170 -0
- package/lib/routes/route-groups.js +20 -0
- package/lib/routes/send.js +341 -0
- package/lib/routes/sessions.js +462 -0
- package/lib/routes/toolbox.js +14 -0
- package/lib/routes/usage.js +211 -0
- package/lib/timeline.js +5 -1
- package/lib/toolbox.js +355 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -253,7 +253,7 @@ pushUrls:
|
|
|
253
253
|
|
|
254
254
|
## 版本与兼容
|
|
255
255
|
|
|
256
|
-
- **版本号统一**:App 版本和插件版本用同一条版本线(插件 3.4.
|
|
256
|
+
- **版本号统一**:App 版本和插件版本用同一条版本线(插件 3.4.1,App 3.4.1+43;测试版插件 3.5.0-beta.1 配 App 3.5.0+44)。插件发布在 npm(`@dsh-mobile/mobile-remote`),手机 App 在 App Store 和官网 https://dsh.claud.ing/。
|
|
257
257
|
- **版本差矩阵**(一句话:谁旧谁吃亏,但都不崩):
|
|
258
258
|
|
|
259
259
|
| 组合 | 结果 |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DSH Mobile - DeepSeek Harness Privacy Policy
|
|
2
2
|
|
|
3
|
-
> Effective date: 2026-11-02 · Last updated: 2026-11-
|
|
3
|
+
> Effective date: 2026-11-02 · Last updated: 2026-11-25
|
|
4
4
|
> Publisher: Digital Bang Intelligence LLC., 30 N Gould St Ste R, Sheridan, WY 82801, USA · support@claud.ing
|
|
5
5
|
|
|
6
6
|
## 1. Overview
|
|
@@ -42,6 +42,8 @@ You can scan a QR code or type the address and access token of the service on yo
|
|
|
42
42
|
|
|
43
43
|
When you use sessions, messages, streamed replies, task status, answers to questions, approval results, file requests and images travel between your device and the DeepSeek Harness service on your computer. They are stored and processed by that service according to its own configuration. DSH Mobile does not upload this content to any server operated by us.
|
|
44
44
|
|
|
45
|
+
**Copies of conversations on the phone.** So that a conversation opens quickly and can still be read and searched when your computer is unreachable, the app keeps a copy of the conversation history it has fetched (the messages and activity summaries it shows; not attachments or images) in its own app folder on the phone, separately for each computer. The copy is encrypted with ChaCha20-Poly1305 under a random key, one per computer, kept in system secure storage (iOS Keychain / Android Keystore); it is never uploaded. It is deleted when you remove that computer from the app, when you clear it or turn it off under "Settings → Storage", when it passes the size limit you set there (the conversations opened longest ago go first), or when you uninstall the app. Settings → Storage also shows and clears the other files the app keeps on the phone: temporary download copies, images you saved from conversations, temporary files and the app log.
|
|
46
|
+
|
|
45
47
|
**This connection is not encrypted by DSH Mobile.** It uses plain HTTP inside your network: the access token keeps other devices from using the service, but anyone who can watch your network traffic could read it. Use it only on networks you trust, or add your own VPN or TLS. Only the Public network relay (Section 6) is end-to-end encrypted.
|
|
46
48
|
|
|
47
49
|
## 5. Cloud account (optional)
|
|
@@ -81,11 +83,12 @@ The desktop plugin runs inside DeepSeek Harness on your computer. We publish it,
|
|
|
81
83
|
|
|
82
84
|
- **Relay connection.** Unless you set `relay.enabled: false` in its configuration, the plugin connects outbound to the relay addresses in its configuration, by default our relay at `wss://dsh.claud.ing`, so that a phone can pair with your computer and reach it from another network. Depending on the plugin version and its settings, it opens this connection when it starts or only after a phone has been paired over the relay. It proves it owns its room with a private key that never leaves your computer. Our relay sees your computer's IP address, the room identifier, timing and data volume, and counts the connection as described in Section 6.
|
|
83
85
|
- **Local service.** The plugin serves the app over plain HTTP on your local network, protected by an access token (Section 4). It keeps the token, the list of paired phones and its relay private key in its state folder.
|
|
84
|
-
- **Memory (off by default).** If you turn memory on, the plugin saves statements you make about yourself in conversations, and memories you add by hand, in `memory.db` and `memory-archive.jsonl` in its state folder. Before saving, it masks phone numbers, ID numbers, keys and long digit strings. It adds relevant memories to the context that DeepSeek Harness sends to your model provider. Since plugin 3.3.0, deleting a memory (one, or all of them) removes its text from those files and from the context of new conversations. A conversation that already used a memory keeps it: DeepSeek Harness keeps the earlier context in that conversation's history, sends it with the conversation's later turns and may keep it in its own session files, so start a new conversation, or delete that one in DeepSeek Harness, if that matters to you. Plugin versions before 3.3.0 only hid a deleted memory and kept its text; update the plugin if you use one.
|
|
86
|
+
- **Memory (off by default).** If you turn memory on, the plugin saves statements you make about yourself in conversations, and memories you add by hand, in `memory.db` and `memory-archive.jsonl` in its state folder. The same files also hold follow-ups the agent said in a reply it would do later (with the time it named; you mark them done on the phone) and the words on your "Don't mention" list, which keep matching memories out of the context and tell the agent not to bring those words up. Before saving, it masks phone numbers, ID numbers, keys and long digit strings. It adds relevant memories to the context that DeepSeek Harness sends to your model provider. Since plugin 3.3.0, deleting a memory (one, or all of them) removes its text from those files and from the context of new conversations. A conversation that already used a memory keeps it: DeepSeek Harness keeps the earlier context in that conversation's history, sends it with the conversation's later turns and may keep it in its own session files, so start a new conversation, or delete that one in DeepSeek Harness, if that matters to you. Plugin versions before 3.3.0 only hid a deleted memory and kept its text; update the plugin if you use one.
|
|
85
87
|
- **Backups.** When you request a backup, the plugin produces a file with your current memories (deleted ones are not in it) and your assistant settings (mode, persona and quiet hours). It contains no access token or keys. Without a passphrase it is a plain JSON file. With a passphrase (at least 15 characters) the whole file is encrypted with AES-256-GCM under a key derived from the passphrase with scrypt; the plugin does not keep the passphrase, and without it the file cannot be read or restored. A backup made earlier still holds the memories that existed when it was made. If you fetch a backup to your phone, it travels over your connection (plain HTTP on a local network, encrypted through the relay); where you keep it is up to you. Restoring a backup only adds entries, so restoring an older backup brings back memories you deleted after making it.
|
|
86
88
|
- **Balance and usage queries.** The plugin answers two kinds of request from your phone, using your own credentials. A usage request asks DeepSeek (through the DeepSeek account you signed in to in DeepSeek Harness, or `api.deepseek.com` with your API key), OpenAI (Codex usage, through DeepSeek Harness's Codex settings) and OpenCode (`opencode.ai`). The app sends one each time it starts with a computer set up (or first connects to one) and when you open or refresh the usage page; the Android desktop pet sends one when you open its panel, at most every 2 minutes. A balance request asks DeepSeek only. While the Android desktop pet is on, it sends one every 30 minutes, and every 5 seconds while its panel is open; because the plugin caches the answer for 60 seconds, DeepSeek is then asked about once a minute. Those credentials never go to the phone or to us. When the app's usage request goes through your DeepSeek account, the plugin passes the app's interface language (English or Chinese) and your phone's time-zone offset to DeepSeek Harness's DeepSeek account service, which sends them to DeepSeek with the request. Results are cached on your computer for up to 60 seconds.
|
|
87
89
|
- **Push channels.** If you add push channels (ServerChan, ntfy, Bark, a WeCom group robot or any webhook), the plugin sends alerts to them directly. By default (`pushContent: minimal`) an alert contains the event type and a short session code, and a generic webhook also receives the full session ID and the time; with `standard` alerts also contain the session title and event details. Those services handle alerts under their own policies.
|
|
88
90
|
- **Phone actions.** If you use the app, the AI agent running on your computer can ask your phone to set a timer or an alarm, add a calendar event or open a link. The plugin offers the agent these tools only while a phone whose app supports them is connected to your computer. A request travels from your computer to your phone over the connection you already use (your local network, or the Public network relay, where it is end-to-end encrypted like every other message, Section 6). **Nothing happens until you confirm it on the phone**, on a screen that names your computer (or after you chose "Allow this turn" for the same kind of action within the same agent turn). The request holds what the agent wrote, such as an event title, a time, notes or a link. **We do not store, log or receive these details: they go to no server of ours, and they are not part of any telemetry or relay counter.** The plugin's own logs keep at most the kind of action, a request ID and the outcome, never the details. Like any other tool call, though, the agent's request and its result are part of the conversation, which DeepSeek Harness keeps and sends to your model provider (Section 9). Nothing is sent to us for this beyond the encrypted relay traffic described in Section 6, which exists with or without phone actions.
|
|
91
|
+
- **Toolbox.** You can make small tools for the app's Toolbox tab on your computer, by hand in the plugin's `toolbox` folder (in its state folder) or by asking the agent, which can package a folder and offer it to your phone. The plugin reads such a folder only when you or the agent ask for it, and never one inside the DeepSeek Harness home other than the `toolbox` folder. It sends the tool's files to your phone over the connection you already use, only after you confirm the install on the phone, on a screen that names your computer. The tool's files go to no server of ours; the plugin's logs keep at most the tool's ID, a request ID and the outcome.
|
|
89
92
|
- **Direct (peer-to-peer) connection (experimental, off by default).** Only if you turn it on, the phone and your computer can try to connect directly instead of through the relay. To set it up they trade connection set-up messages (session descriptions and network candidates, which contain IP addresses) through your computer's room on our relay. **These messages are end-to-end encrypted with the keys from your pairing, so our servers cannot read them.** Our relay sees only that a set-up connection happened, and its size and timing, and counts it without content and without IP addresses, like the other relay counters (Section 6). The data itself then goes directly between your two devices and is encrypted again; it does not pass through our servers. To find its public address, each side asks a STUN server, by default `stun:stun.cloudflare.com:3478`, which is run by Cloudflare and sees the IP address of the device that asks; you can change that server in the plugin's configuration (`p2p.stun`).
|
|
90
93
|
- **Proactive messages and quiet hours.** Both are decided on your computer. Proactive messages are off by default; their schedule is kept in `proactive.json` in the state folder, and the messages reach you the same way as alerts.
|
|
91
94
|
|
|
@@ -136,6 +139,8 @@ What each permission is for:
|
|
|
136
139
|
|
|
137
140
|
**Phone actions.** When the agent on your computer asks your phone to set a timer or an alarm, add a calendar event or open a link, the app first shows a confirmation that names the computer, with "Allow once", "Allow this turn" (the same kind of action from that computer for the rest of that agent turn) and "Cancel"; with no answer in 30 seconds it cancels. Only after you allow it does the app pass the request to your phone's Clock, Calendar or browser app, which then handle it under their own policies (a calendar event may, for example, be synced by the calendar account you use). The app does not read your calendar or alarms, does not put the title, time, notes or link in its diagnostic log, and tells your computer only whether the action was done, cancelled or failed. Phone actions currently work on Android only; on iOS the app answers that they are not available.
|
|
138
141
|
|
|
142
|
+
**Toolbox.** The Toolbox tab has a calculator, an expense tracker and a calendar built in, and the tools you install from your own computer (Section 7). The calculator and expense tracker run inside the app; the calendar's notes and the expenses you log stay on your phone. Every tool runs in its own sandbox: it cannot use the network (requests to any address are blocked), cannot use phone features such as the camera, location, contacts or files, and cannot see your sessions, files, access tokens, account or the data of other tools. It keeps its data on your phone in storage of its own, which the app deletes when you uninstall the tool. The app shares no data from the app or your phone with a tool; if a later version lets you share something with a tool, it will ask you each time. Tools are not shared between users, and nothing about the tools you install or use is sent to us.
|
|
143
|
+
|
|
139
144
|
**Direct connection (experimental, off by default).** If it is turned on, the app and your computer trade connection set-up messages through our relay, end-to-end encrypted, and then connect directly, as described in Section 7. The app asks a STUN server (by default Cloudflare's `stun.cloudflare.com`) for its public IP address for that.
|
|
140
145
|
|
|
141
146
|
**On Android, the built-in QR scanner library sends data to Google.** The Android app scans QR codes with Google's ML Kit barcode-scanning library, which is built into the app. It can send data while the app runs, not only when you scan a code. According to Google, it collects and sends to Google, over HTTPS and for diagnostics and usage analytics: device information (manufacturer, model, OS version and build, available machine-learning accelerators), app information (package name and app version), a per-installation identifier that is not meant to identify you or your device, and scanner events, settings, performance and error codes. Google's list does not include the camera images or the contents of the codes you scan, and Google says it does not transfer this data to third parties. The data goes to Google's Firebase logging service (firebaselogging.googleapis.com), not to us. The iOS app scans with Apple's built-in Vision framework and sends no such data.
|
package/docs/PRIVACY-POLICY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DSH Mobile - DeepSeek Harness 隐私政策
|
|
2
2
|
|
|
3
|
-
> 生效日期:2026-11-02 · 最近更新:2026-11-
|
|
3
|
+
> 生效日期:2026-11-02 · 最近更新:2026-11-25
|
|
4
4
|
> 发布者:Digital Bang Intelligence LLC.,30 N Gould St Ste R, Sheridan, WY 82801, USA · support@claud.ing
|
|
5
5
|
|
|
6
6
|
## 1. 概述
|
|
@@ -42,6 +42,8 @@ DSH Mobile 让你连接到自己在电脑上运行的 DeepSeek Harness 服务,
|
|
|
42
42
|
|
|
43
43
|
当你使用会话功能时,消息、流式回复、任务状态、问询回答、审批结果、文件请求和图片会在你的设备与电脑端 DeepSeek Harness 服务之间传输。它们由该服务按其自身配置保存和处理。DSH Mobile 不会把这些内容上传到我们运营的任何服务器。
|
|
44
44
|
|
|
45
|
+
**手机上的对话副本。** 为了让对话打开得更快、在连不上电脑时也能查看和搜索,应用会把已经拉取过的对话历史(它显示的消息与活动摘要,不含附件和图片)保存在手机上应用自己的目录里,每台电脑分开保存。副本用随机密钥以 ChaCha20-Poly1305 加密,每台电脑一把密钥,保存在系统安全存储(iOS Keychain / Android Keystore)中;副本不会上传。在应用里删除这台电脑、在“设置 → 存储”里清除或关闭它、超过你在那里设定的容量上限(最久没打开的对话先删)、或卸载应用时,副本都会被删除。“设置 → 存储”还会显示并可清除应用在手机上保存的其他文件:下载时的临时副本、你从对话里保存的图片、临时文件和应用日志。
|
|
46
|
+
|
|
45
47
|
**这条连接不由 DSH Mobile 加密。** 它在你的网络内使用明文 HTTP:访问口令能防止其他设备使用这项服务,但能监听你网络流量的人可以读到内容。请只在可信网络中使用,或自行加上 VPN 或 TLS。只有公开网络中继(第 6 节)是端到端加密的。
|
|
46
48
|
|
|
47
49
|
## 5. 云端账号(可选)
|
|
@@ -81,11 +83,12 @@ DSH Mobile 让你连接到自己在电脑上运行的 DeepSeek Harness 服务,
|
|
|
81
83
|
|
|
82
84
|
- **中继连接。** 除非你在配置里设 `relay.enabled: false`,插件会主动向外连接配置里的中继地址(默认是我们的中继 `wss://dsh.claud.ing`),让手机能和你的电脑配对,并在其他网络下连到它。根据插件版本和设置,它会在启动时、或在有手机通过中继配对之后才建立这条连接。它用一把从不离开你电脑的私钥证明自己拥有这个房间。我们的中继能看到你电脑的 IP 地址、房间标识、时间和数据量,并按第 6 节记入计数。
|
|
83
85
|
- **本地服务。** 插件在你的局域网内用明文 HTTP 为应用提供服务,并用访问口令保护(第 4 节)。口令、已配对手机列表和它的中继私钥都保存在状态目录里。
|
|
84
|
-
- **记忆(默认关闭)。** 如果你打开记忆,插件会把你在对话中关于自己的陈述,以及你手动添加的记忆,保存到状态目录下的 `memory.db` 和 `memory-archive.jsonl
|
|
86
|
+
- **记忆(默认关闭)。** 如果你打开记忆,插件会把你在对话中关于自己的陈述,以及你手动添加的记忆,保存到状态目录下的 `memory.db` 和 `memory-archive.jsonl`。这两个文件还会保存智能体在回复里说过稍后要做的跟进事项(连同它说的时间;你在手机上标记完成),以及你的“别再提”名单:名单里的词会让相关记忆不再进入上下文,并告诉智能体不要主动提起它们。保存前会遮蔽手机号、证件号、密钥和长数字串。它会把相关记忆加入 DeepSeek Harness 发给你的模型提供商的上下文。自插件 3.3.0 起,删除记忆(单条或全部)会把其原文从这两个文件中清除,新的对话也不会再拿到它。已经用过这条记忆的对话仍保留它:DeepSeek Harness 会把之前的上下文留在该对话的历史里、随后续轮次一起发送,也可能保存在它自己的会话文件中;如果这对你重要,请开一个新对话,或在 DeepSeek Harness 里删除那个对话。3.3.0 之前的插件版本删除时只是隐藏、原文仍保留;如果你还在用,请更新插件。
|
|
85
87
|
- **备份。** 当你请求备份时,插件会生成一个文件,内含你现有的记忆(已删除的不在其中)和助手设置(模式、人格和安静时段)。它不含访问口令或密钥。不设口令时它是明文 JSON 文件;设了口令(至少 15 个字符)时,整个文件用 AES-256-GCM 加密,密钥由口令经 scrypt 派生;插件不保存口令,没有口令就无法读取或恢复该文件。之前做的备份仍包含做备份时存在的记忆。如果你把备份取到手机上,它会经由你的连接传输(局域网下是明文 HTTP,经中继时加密);保存在哪里由你决定。恢复备份只会新增条目,所以恢复一份较早的备份,会把你在那之后删除的记忆加回来。
|
|
86
88
|
- **余额与用量查询。** 插件会用你自己的凭据,回应手机发来的两类请求。用量请求会向 DeepSeek(通过你在 DeepSeek Harness 里登录的 DeepSeek 账号,或用你的 API Key 访问 `api.deepseek.com`)、OpenAI(Codex 用量,通过 DeepSeek Harness 的 Codex 设置)和 OpenCode(`opencode.ai`)查询。每次在已配置电脑的情况下启动应用(或第一次连上电脑)时、以及你打开或刷新用量页时,应用会发一次;你打开 Android 桌面宠物的面板时,宠物也会发一次,最多每 2 分钟一次。余额请求只查询 DeepSeek。开启 Android 桌面宠物后,它每 30 分钟发一次,面板打开期间每 5 秒发一次;由于插件会把结果缓存 60 秒,这时 DeepSeek 约每分钟被查询一次。这些凭据永远不会发到手机或我们这里。应用的用量请求通过你的 DeepSeek 账号查询时,插件会把应用的界面语言(中文或英文)和手机的时区偏移交给 DeepSeek Harness 的 DeepSeek 账号服务,由它随请求一起发给 DeepSeek。查询结果在你的电脑上最多缓存 60 秒。
|
|
87
89
|
- **推送通道。** 如果你添加了推送通道(Server酱、ntfy、Bark、企业微信群机器人或任意 Webhook),插件会把提醒直接发给它们。默认(`pushContent: minimal`)提醒包含事件类型和会话短码,通用 Webhook 还会收到完整的会话 ID 和时间;设为 `standard` 时提醒还会包含会话标题和事件详情。这些服务按其各自政策处理提醒。
|
|
88
90
|
- **手机动作。** 如果你使用本应用,运行在你电脑上的 AI 智能体可以请求你的手机设置计时器或闹钟、添加日历事件或打开链接。只有在支持这些动作的应用版本连接到你的电脑时,插件才会把这些工具提供给智能体。请求从你的电脑经你已经在用的连接送到手机(局域网,或公开网络中继;经中继时与其他所有消息一样端到端加密,见第 6 节)。**你在手机上确认之前,什么都不会发生**:确认界面会写明是哪台电脑(或者你在同一次智能体轮次内,已对同一类动作选择了“本轮允许”)。请求里包含智能体写下的内容,例如事件标题、时间、备注或链接。**我们不会存储、记录或接收这些内容:它们不会发往我们的任何服务器,也不属于任何遥测或中继计数。** 插件自己的日志最多只记录动作的种类、请求 ID 和结果,不记录这些内容。不过,与任何其他工具调用一样,智能体的请求及其结果属于对话的一部分,而对话由 DeepSeek Harness 保存并发送给你的模型提供方(第 9 节)。除第 6 节所述、无论是否使用手机动作都已存在的加密中继流量外,这项功能不会向我们发送任何数据。
|
|
91
|
+
- **工具箱。** 你可以在电脑上为应用的“工具箱”页制作小工具:手动放进插件状态目录下的 `toolbox` 文件夹,或者让智能体把一个文件夹打包并发给你的手机。插件只在你或智能体要求时读取这样的文件夹,并且不会读取 DeepSeek Harness 主目录里除 `toolbox` 文件夹以外的任何文件夹。只有在你在手机上确认安装之后(确认界面会写明是哪台电脑),插件才会经你已经在用的连接把工具文件发给手机。工具文件不会发往我们的任何服务器;插件日志最多只记录工具 ID、请求 ID 和结果。
|
|
89
92
|
- **直连(点对点)连接(实验性,默认关闭)。** 只有在你主动开启后,手机和你的电脑才会尝试直接连接,而不经过中继。为了建立连接,它们会通过我们中继上你电脑的房间交换连接建立消息(会话描述和网络候选地址,其中包含 IP 地址)。**这些消息用你们配对时的密钥端到端加密,我们的服务器无法读取。** 我们的中继只能看到发生过一次建立连接、它的大小和时间,并像其他中继计数一样记录,不含内容,也不含 IP 地址(第 6 节)。随后数据直接在你的两台设备之间传输并再次加密,不经过我们的服务器。为了得知自己的公网地址,双方会向 STUN 服务器发起查询,默认是 `stun:stun.cloudflare.com:3478`,由 Cloudflare 运营,它会看到发起查询的设备的 IP 地址;你可以在插件配置里更换这个服务器(`p2p.stun`)。
|
|
90
93
|
- **主动消息与安静时段。** 两者都在你的电脑上决定。主动消息默认关闭;其排程保存在状态目录的 `proactive.json` 中,消息和提醒走同样的通道到达你。
|
|
91
94
|
|
|
@@ -136,6 +139,8 @@ DeepSeek Harness、模型提供商、推送通道和文件服务由你选择并
|
|
|
136
139
|
|
|
137
140
|
**手机动作。** 当你电脑上的智能体请求手机设置计时器或闹钟、添加日历事件或打开链接时,应用会先弹出一个写明电脑名称的确认界面,选项为“允许一次”“本轮允许”(在该智能体的本轮余下时间里,允许这台电脑的同一类动作)和“取消”;30 秒内没有回答则自动取消。只有在你允许之后,应用才会把请求交给手机上的时钟、日历或浏览器应用,由它们按各自的政策处理(例如日历事件可能会被你所用的日历账号同步)。应用不会读取你的日历或闹钟,不会把标题、时间、备注或链接写进它的诊断日志,只会告诉你的电脑这个动作已完成、已取消还是失败。目前手机动作只在 Android 上可用;在 iOS 上应用会回答不支持。
|
|
138
141
|
|
|
142
|
+
**工具箱。** “工具箱”页内置计算器、记账和日历,另外还有你从自己电脑上安装的工具(第 7 节)。计算器和记账在应用内运行;日历备注和你记下的花费都只保存在手机上。每个工具都运行在独立的沙盒里:不能使用网络(发往任何地址的请求都会被拦截),不能使用相机、位置、通讯录、文件等手机功能,也看不到你的会话、文件、访问口令、账号或其他工具的数据。工具把数据保存在手机上专属于它的存储里,卸载工具时应用会把这些数据删除。应用不会把应用内或手机上的任何数据交给工具;如果以后的版本允许你把某些内容交给工具,每次都会先征得你的同意。工具不会在用户之间共享,你安装或使用了哪些工具也不会发给我们。
|
|
143
|
+
|
|
139
144
|
**直连(实验性,默认关闭)。** 如果开启,应用和你的电脑会通过我们的中继交换端到端加密的连接建立消息,然后直接连接,详见第 7 节。为此,应用会向 STUN 服务器(默认是 Cloudflare 的 `stun.cloudflare.com`)查询自己的公网 IP 地址。
|
|
140
145
|
|
|
141
146
|
**Android 版内置的扫码库会向 Google 发送数据。** Android 版使用内置在应用里的 Google ML Kit 条码扫描库扫码。它在应用运行时就可能发送数据,不限于扫码的时候。据 Google 说明,它会通过 HTTPS 收集并发给 Google 以下数据,用于诊断和使用分析:设备信息(制造商、型号、系统版本和构建号、可用的机器学习加速硬件)、应用信息(包名和应用版本)、一个不用于识别你或你设备的按安装生成的标识符,以及扫码功能的事件、设置、性能和错误码。Google 列出的数据不包括相机画面或你扫描的二维码内容,Google 也说明不会把这些数据转给第三方。这些数据发往 Google 的 Firebase 日志服务(firebaselogging.googleapis.com),不是发给我们。iOS 版使用 Apple 系统自带的 Vision 框架扫码,不发送此类数据。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DSH Mobile - DeepSeek Harness Terms of Service
|
|
2
2
|
|
|
3
|
-
> Effective date: 2026-11-02 · Last updated: 2026-11-
|
|
3
|
+
> Effective date: 2026-11-02 · Last updated: 2026-11-25
|
|
4
4
|
> Publisher: Digital Bang Intelligence LLC., 30 N Gould St Ste R, Sheridan, WY 82801, USA · support@claud.ing
|
|
5
5
|
|
|
6
6
|
## 1. Agreement
|
|
@@ -9,7 +9,7 @@ These terms are an agreement between you and Digital Bang Intelligence LLC. ("we
|
|
|
9
9
|
|
|
10
10
|
## 2. What the app and cloud services are
|
|
11
11
|
|
|
12
|
-
DSH Mobile is an independent mobile companion for DeepSeek Harness. It is not affiliated with or endorsed by DeepSeek. It connects to a DeepSeek Harness service that you install and run on your own computer, and lets you view and continue sessions, follow tasks, answer questions, approve tool actions, browse workspace files and receive alerts. You need DeepSeek Harness on your computer and the DSH Mobile plugin.
|
|
12
|
+
DSH Mobile is an independent mobile companion for DeepSeek Harness. It is not affiliated with or endorsed by DeepSeek. It connects to a DeepSeek Harness service that you install and run on your own computer, and lets you view and continue sessions, follow tasks, answer questions, approve tool actions, browse workspace files and receive alerts. Its free Toolbox tab holds a few built-in tools and small offline tools that you install from your own computer. You need DeepSeek Harness on your computer and the DSH Mobile plugin.
|
|
13
13
|
|
|
14
14
|
We offer two ways to connect:
|
|
15
15
|
|
|
@@ -60,6 +60,7 @@ We may rate-limit, suspend or terminate relay access to protect the service, com
|
|
|
60
60
|
- **Approving tool actions.** When an AI agent asks to run a command or change files and you approve it in the app, the action runs on your computer with your permissions. Read what you approve. We are not responsible for actions you approve.
|
|
61
61
|
- **AI output.** Responses generated through DeepSeek Harness and its model providers can be wrong, incomplete or unsafe. Review them before relying on them or running anything they suggest.
|
|
62
62
|
- **Persona cards you import.** A persona card is a JSON file you choose to import. You are responsible for its content and for having the right to use it; we do not review imported cards. The DSH Mobile plugin stores them on your computer, and their text is sent to the AI model as the assistant's persona in your sessions. It goes to whichever model provider your DeepSeek Harness uses, not to us.
|
|
63
|
+
- **Tools you make or install.** A tool in the Toolbox tab that you install from your computer is made by you, or by an AI agent at your request, not by us. You are responsible for its content and for having the right to use it; we do not review, host or distribute such tools, and they are not shared with other users. Tools run in a sandbox without network access or access to your other data (see the Privacy Policy), but you should install only tools you trust, and we are not responsible for what a tool you install shows or calculates.
|
|
63
64
|
- **Other services.** DeepSeek Harness, model providers, push channels and any private network you run are provided by others or by you under their own terms and fees; those terms apply to your use of them.
|
|
64
65
|
|
|
65
66
|
## 8. Privacy
|
package/docs/TERMS-OF-SERVICE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DSH Mobile - DeepSeek Harness 服务条款
|
|
2
2
|
|
|
3
|
-
> 生效日期:2026-11-02 · 最近更新:2026-11-
|
|
3
|
+
> 生效日期:2026-11-02 · 最近更新:2026-11-25
|
|
4
4
|
> 发布者:Digital Bang Intelligence LLC.,30 N Gould St Ste R, Sheridan, WY 82801, USA · support@claud.ing
|
|
5
5
|
|
|
6
6
|
## 1. 协议
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## 2. 本应用与云端服务
|
|
11
11
|
|
|
12
|
-
DSH Mobile 是 DeepSeek Harness 的独立移动伴侣,与 DeepSeek 没有隶属或背书关系。它连接到你在自己电脑上安装并运行的 DeepSeek Harness
|
|
12
|
+
DSH Mobile 是 DeepSeek Harness 的独立移动伴侣,与 DeepSeek 没有隶属或背书关系。它连接到你在自己电脑上安装并运行的 DeepSeek Harness 服务,让你查看和继续会话、查看任务、回答问询、审批工具动作、浏览工作区文件和接收提醒。其中免费的“工具箱”页提供几个内置工具,以及你从自己电脑上安装的离线小工具。使用前,你的电脑上需要有 DeepSeek Harness 和 DSH Mobile 插件。
|
|
13
13
|
|
|
14
14
|
我们提供两种连接方式:
|
|
15
15
|
|
|
@@ -60,6 +60,7 @@ DSH Mobile 是 DeepSeek Harness 的独立移动伴侣,与 DeepSeek 没有隶
|
|
|
60
60
|
- **审批工具动作。** 当 AI 智能体请求运行命令或修改文件,而你在应用里批准后,这个动作会以你的权限在你的电脑上执行。请看清楚再批准。你批准的动作,我们不承担责任。
|
|
61
61
|
- **AI 输出。** 通过 DeepSeek Harness 及其模型提供商生成的回复可能有错、不完整或不安全。在依赖它们或运行它们建议的内容之前,请先自己核对。
|
|
62
62
|
- **你导入的人设卡。** 人设卡是你自己选择导入的 JSON 文件。你要对其内容负责,并对自己有权使用它负责;我们不审核你导入的人设卡。DSH Mobile 插件把它们保存在你的电脑上,其文字会在你的会话中作为助手的人设发送给 AI 模型,发往你的 DeepSeek Harness 所使用的模型提供商,而不是发给我们。
|
|
63
|
+
- **你制作或安装的工具。** 你从电脑安装到“工具箱”页的工具由你本人,或由 AI 智能体按你的要求制作,而不是由我们制作。你要对其内容负责,并对自己有权使用它负责;我们不审核、不托管也不分发这类工具,它们也不会与其他用户共享。工具在没有网络、也无法访问你其他数据的沙盒中运行(见隐私政策),但请只安装你信任的工具;对你安装的工具所显示或计算的内容,我们不承担责任。
|
|
63
64
|
- **其他服务。** DeepSeek Harness、模型提供商、推送通道和你自己搭建的虚拟组网由他人或你按各自的条款和费用提供,你使用它们时适用这些条款。
|
|
64
65
|
|
|
65
66
|
## 8. 隐私
|
package/lib/backup.js
CHANGED
|
@@ -86,8 +86,15 @@ export function buildBackup({ store, prefs, now = () => Date.now() }) {
|
|
|
86
86
|
lastRecalledAt:
|
|
87
87
|
typeof m.lastRecalledAt === "number" ? m.lastRecalledAt : undefined,
|
|
88
88
|
|
|
89
|
+
...(m.kind === "promise" ? { kind: "promise" } : {}),
|
|
90
|
+
...(typeof m.expiresAt === "number" ? { expiresAt: m.expiresAt } : {}),
|
|
91
|
+
...(typeof m.dueAt === "number" ? { dueAt: m.dueAt } : {}),
|
|
92
|
+
...(typeof m.doneAt === "number" ? { doneAt: m.doneAt } : {}),
|
|
93
|
+
|
|
89
94
|
|
|
90
95
|
})),
|
|
96
|
+
|
|
97
|
+
mutes: store?.listMutes ? store.listMutes().map((m) => m.term) : [],
|
|
91
98
|
};
|
|
92
99
|
}
|
|
93
100
|
|
|
@@ -221,6 +228,10 @@ export async function decryptBackup(envelope, passphrase) {
|
|
|
221
228
|
|
|
222
229
|
|
|
223
230
|
|
|
231
|
+
function timeOrNull(v) {
|
|
232
|
+
return typeof v === "number" && Number.isFinite(v) && v > 0 ? v : null;
|
|
233
|
+
}
|
|
234
|
+
|
|
224
235
|
function validateMemory(raw, index) {
|
|
225
236
|
if (!raw || typeof raw !== "object") {
|
|
226
237
|
return { ok: false, reason: "不是对象", index };
|
|
@@ -250,6 +261,10 @@ function validateMemory(raw, index) {
|
|
|
250
261
|
source: raw.source === "manual" ? "manual" : "conversation",
|
|
251
262
|
origin: typeof raw.origin === "string" ? raw.origin : null,
|
|
252
263
|
pinned: raw.pinned === true,
|
|
264
|
+
kind: raw.kind === "promise" ? "promise" : "fact",
|
|
265
|
+
expiresAt: timeOrNull(raw.expiresAt),
|
|
266
|
+
dueAt: timeOrNull(raw.dueAt),
|
|
267
|
+
doneAt: timeOrNull(raw.doneAt),
|
|
253
268
|
},
|
|
254
269
|
};
|
|
255
270
|
}
|
|
@@ -413,6 +428,10 @@ export function applyRestore(payload, { store, prefs }) {
|
|
|
413
428
|
source: item.source,
|
|
414
429
|
origin: item.origin,
|
|
415
430
|
pinned: item.pinned,
|
|
431
|
+
kind: item.kind,
|
|
432
|
+
expiresAt: item.expiresAt,
|
|
433
|
+
dueAt: item.dueAt,
|
|
434
|
+
doneAt: item.doneAt,
|
|
416
435
|
});
|
|
417
436
|
added += 1;
|
|
418
437
|
} catch (err) {
|
|
@@ -421,6 +440,17 @@ export function applyRestore(payload, { store, prefs }) {
|
|
|
421
440
|
}
|
|
422
441
|
}
|
|
423
442
|
}
|
|
443
|
+
|
|
444
|
+
if (store?.addMute && Array.isArray(payload?.mutes)) {
|
|
445
|
+
for (const term of payload.mutes.slice(0, 200)) {
|
|
446
|
+
if (typeof term !== "string") continue;
|
|
447
|
+
try {
|
|
448
|
+
store.addMute(term);
|
|
449
|
+
} catch {
|
|
450
|
+
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
424
454
|
let assistant = false;
|
|
425
455
|
if (plan.assistant && prefs?.set) {
|
|
426
456
|
try {
|
package/lib/config.js
CHANGED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
import { readBody, sendError, sendJson } from "./http-util.js";
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
export const HOST_PLUGINS_FEATURE = "host-plugins";
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export const SELF_NAMES = Object.freeze(["@dsh-mobile/mobile-remote", "mobile-remote"]);
|
|
46
|
+
|
|
47
|
+
const SECRET_KEY_RE = /(token|secret|passw|pwd|api[-_]?key|apikey|private|credential|cookie|auth|signature|session[-_]?key|^key$|[-_]key$|Key$)/i;
|
|
48
|
+
const MASK = "••••••";
|
|
49
|
+
const ENTRY_ID_RE = /^[A-Za-z0-9._:@/-]{1,200}$/;
|
|
50
|
+
const MAX_FIELDS = 200;
|
|
51
|
+
const VALUE_MAX = 2000;
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export function looksSecret(value) {
|
|
55
|
+
if (typeof value !== "string") return false;
|
|
56
|
+
const v = value.trim();
|
|
57
|
+
if (/^(sk|pk|rk|ghp|gho|ghs|xox[abpr]|glpat|AKIA)[-_]?[A-Za-z0-9]/.test(v) && v.length >= 16) return true;
|
|
58
|
+
if (/^eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/.test(v)) return true;
|
|
59
|
+
if (/^-----BEGIN [A-Z ]*PRIVATE KEY-----/.test(v)) return true;
|
|
60
|
+
|
|
61
|
+
if (v.length >= 32 && /^[A-Za-z0-9+/=_-]+$/.test(v) && /[0-9]/.test(v) && /[A-Za-z]/.test(v)) return true;
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
export const isSecretKey = (key) => SECRET_KEY_RE.test(String(key));
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
export function maskConfig(value, key = "", depth = 0) {
|
|
68
|
+
if (depth > 6) return MASK;
|
|
69
|
+
if (value === null || value === undefined) return value ?? null;
|
|
70
|
+
if (Array.isArray(value)) return value.slice(0, 100).map((v) => maskConfig(v, key, depth + 1));
|
|
71
|
+
if (typeof value === "object") {
|
|
72
|
+
const out = {};
|
|
73
|
+
for (const [k, v] of Object.entries(value).slice(0, MAX_FIELDS)) out[k] = maskConfig(v, k, depth + 1);
|
|
74
|
+
return out;
|
|
75
|
+
}
|
|
76
|
+
if (key && isSecretKey(key) && value !== "" && typeof value !== "boolean") return MASK;
|
|
77
|
+
if (looksSecret(value)) return MASK;
|
|
78
|
+
if (typeof value === "string" && value.length > VALUE_MAX) return `${value.slice(0, VALUE_MAX)}…`;
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
export function configFields(config) {
|
|
84
|
+
const fields = [];
|
|
85
|
+
const obj = config && typeof config === "object" && !Array.isArray(config) ? config : {};
|
|
86
|
+
for (const [key, raw] of Object.entries(obj).slice(0, MAX_FIELDS)) {
|
|
87
|
+
const type = raw === null ? "null" : Array.isArray(raw) ? "array" : typeof raw;
|
|
88
|
+
const masked = (isSecretKey(key) && raw !== "" && typeof raw !== "boolean" && raw !== null) || looksSecret(raw);
|
|
89
|
+
const scalar = type === "string" || type === "number" || type === "boolean";
|
|
90
|
+
const field = { key, type, masked, editable: scalar && !masked };
|
|
91
|
+
if (masked) field.value = MASK;
|
|
92
|
+
else if (scalar) field.value = typeof raw === "string" && raw.length > VALUE_MAX ? `${raw.slice(0, VALUE_MAX)}…` : raw;
|
|
93
|
+
else field.value = maskConfig(raw, key, 1);
|
|
94
|
+
|
|
95
|
+
if (typeof raw === "string" && raw.length > VALUE_MAX) field.editable = false;
|
|
96
|
+
fields.push(field);
|
|
97
|
+
}
|
|
98
|
+
return fields;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const text = (t) => {
|
|
102
|
+
if (typeof t === "string") return t;
|
|
103
|
+
if (t && typeof t === "object") {
|
|
104
|
+
const out = {};
|
|
105
|
+
for (const [k, v] of Object.entries(t).slice(0, 20)) if (typeof v === "string") out[k] = v.slice(0, 500);
|
|
106
|
+
return Object.keys(out).length ? out : null;
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
export function createHostPluginRoutes({ manager, configEditor, selfEntryId, writeAllowed, logger }) {
|
|
118
|
+
const get = (fn) => {
|
|
119
|
+
try { return fn?.(); } catch { return undefined; }
|
|
120
|
+
};
|
|
121
|
+
const mgr = () => {
|
|
122
|
+
const m = get(manager);
|
|
123
|
+
return m && typeof m.listPlugins === "function" ? m : undefined;
|
|
124
|
+
};
|
|
125
|
+
const editor = () => {
|
|
126
|
+
const e = get(configEditor);
|
|
127
|
+
return e && typeof e.configuration === "function" && typeof e.edit === "function" ? e : undefined;
|
|
128
|
+
};
|
|
129
|
+
const isSelf = (row) => {
|
|
130
|
+
const own = get(selfEntryId);
|
|
131
|
+
return (own && row?.entryId === own) || SELF_NAMES.includes(row?.moduleName) || SELF_NAMES.includes(row?.name);
|
|
132
|
+
};
|
|
133
|
+
const readJsonBody = async (req, res) => {
|
|
134
|
+
try {
|
|
135
|
+
return JSON.parse(await readBody(req)) ?? {};
|
|
136
|
+
} catch (err) {
|
|
137
|
+
sendError(res, err?.status === 413 ? 413 : 400, err?.status === 413 ? "payload-too-large" : "bad-request");
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const refuseWrite = (req, res, body) => {
|
|
143
|
+
if (!writeAllowed(req)) {
|
|
144
|
+
sendError(res, 403, "pairing-required", "changing plugins needs a paired, authenticated phone");
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
if (body?.confirm !== true) {
|
|
148
|
+
sendError(res, 400, "confirmation-required", "confirm the change on the phone first");
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
return false;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const pluginView = (row) => ({
|
|
155
|
+
entryId: String(row.entryId),
|
|
156
|
+
moduleName: String(row.moduleName ?? ""),
|
|
157
|
+
title: text(row.meta?.title),
|
|
158
|
+
description: text(row.meta?.description),
|
|
159
|
+
enabled: row.enabled === true,
|
|
160
|
+
phase: typeof row.fiberPhase === "string" ? row.fiberPhase : null,
|
|
161
|
+
diagnostic: typeof row.diagnostic === "string" ? row.diagnostic.slice(0, 500) : null,
|
|
162
|
+
readOnly: isSelf(row) ? "this-plugin" : row.readOnlyReason ?? null,
|
|
163
|
+
self: isSelf(row) === true,
|
|
164
|
+
});
|
|
165
|
+
const bundleView = (b) => ({
|
|
166
|
+
name: String(b.name),
|
|
167
|
+
version: typeof b.version === "string" ? b.version : null,
|
|
168
|
+
title: text(b.meta?.title),
|
|
169
|
+
description: text(b.meta?.description) ?? (typeof b.description === "string" ? b.description.slice(0, 500) : null),
|
|
170
|
+
enabled: b.enabled === true,
|
|
171
|
+
official: b.official === true,
|
|
172
|
+
optional: b.optional === true,
|
|
173
|
+
available: b.availability !== "missing",
|
|
174
|
+
readOnly: isSelf(b) ? "this-plugin" : b.readOnlyReason ?? (b.availability === "missing" ? "not-installed" : null),
|
|
175
|
+
error: b.error?.code ?? null,
|
|
176
|
+
self: isSelf(b) === true,
|
|
177
|
+
});
|
|
178
|
+
const resultView = (r) => ({
|
|
179
|
+
changed: r?.changed === true,
|
|
180
|
+
application: typeof r?.application === "string" ? r.application : "failed",
|
|
181
|
+
restartReason: r?.restartReason ?? null,
|
|
182
|
+
error: r?.error ? { code: String(r.error.code ?? "operation-error"), diagnostic: typeof r.error.diagnostic === "string" ? r.error.diagnostic.slice(0, 500) : null } : null,
|
|
183
|
+
warnings: Array.isArray(r?.warnings) ? r.warnings.filter((w) => typeof w === "string").slice(0, 10) : [],
|
|
184
|
+
});
|
|
185
|
+
const findConfigRow = (ed, entryId) => {
|
|
186
|
+
const rows = ed.configuration();
|
|
187
|
+
return (Array.isArray(rows) ? rows : []).find((r) => r?.entry?.id === entryId);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
return async function handleHostPlugins(req, res, rest, method, url) {
|
|
191
|
+
if (rest !== "/host-plugins" && !rest.startsWith("/host-plugins/")) return false;
|
|
192
|
+
try {
|
|
193
|
+
if (rest === "/host-plugins") {
|
|
194
|
+
if (method !== "GET" && method !== "HEAD") { sendError(res, 405, "method-not-allowed"); return true; }
|
|
195
|
+
const m = mgr();
|
|
196
|
+
if (!m) { sendError(res, 503, "plugin-manager-unavailable", "this computer's DSH does not offer plugin management"); return true; }
|
|
197
|
+
const plugins = (await m.listPlugins()).filter((r) => r && r.entryId).map(pluginView);
|
|
198
|
+
let bundles = [];
|
|
199
|
+
if (typeof m.listBundles === "function") {
|
|
200
|
+
try {
|
|
201
|
+
bundles = (await m.listBundles()).filter((b) => b && typeof b.name === "string").map(bundleView);
|
|
202
|
+
} catch (err) {
|
|
203
|
+
logger?.debug?.(`mobile-remote: listBundles: ${err?.message ?? err}`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
sendJson(res, 200, { ok: true, plugins, bundles, configurable: editor() !== undefined });
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
if (rest === "/host-plugins/toggle") {
|
|
210
|
+
if (method !== "POST") { sendError(res, 405, "method-not-allowed"); return true; }
|
|
211
|
+
const body = await readJsonBody(req, res);
|
|
212
|
+
if (body === undefined) return true;
|
|
213
|
+
if (refuseWrite(req, res, body)) return true;
|
|
214
|
+
const m = mgr();
|
|
215
|
+
if (!m) { sendError(res, 503, "plugin-manager-unavailable"); return true; }
|
|
216
|
+
const { kind, id, enabled } = body;
|
|
217
|
+
if ((kind !== "plugin" && kind !== "bundle") || typeof id !== "string" || !ENTRY_ID_RE.test(id) || typeof enabled !== "boolean") {
|
|
218
|
+
sendError(res, 400, "bad-request", "kind (plugin|bundle), id and enabled are required");
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
if (kind === "plugin") {
|
|
222
|
+
const row = (await m.listPlugins()).find((r) => r?.entryId === id);
|
|
223
|
+
if (!row) { sendError(res, 404, "unknown-plugin"); return true; }
|
|
224
|
+
if (isSelf(row)) { sendError(res, 403, "this-plugin", "the phone cannot switch off the plugin it talks through"); return true; }
|
|
225
|
+
if (row.readOnlyReason) { sendError(res, 403, row.readOnlyReason); return true; }
|
|
226
|
+
sendJson(res, 200, { ok: true, result: resultView(await m.setPluginEnabled(id, enabled)) });
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
if (typeof m.listBundles !== "function" || typeof m.setBundleEnabled !== "function") { sendError(res, 503, "plugin-manager-unavailable"); return true; }
|
|
230
|
+
const bundle = (await m.listBundles()).find((b) => b?.name === id);
|
|
231
|
+
if (!bundle) { sendError(res, 404, "unknown-bundle"); return true; }
|
|
232
|
+
if (isSelf(bundle)) { sendError(res, 403, "this-plugin", "the phone cannot switch off the plugin it talks through"); return true; }
|
|
233
|
+
if (bundle.readOnlyReason) { sendError(res, 403, bundle.readOnlyReason); return true; }
|
|
234
|
+
if (enabled && bundle.availability === "missing") { sendError(res, 403, "not-installed", "installing is done on the computer"); return true; }
|
|
235
|
+
sendJson(res, 200, { ok: true, result: resultView(await m.setBundleEnabled(id, enabled)) });
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
if (rest === "/host-plugins/config") {
|
|
239
|
+
const ed = editor();
|
|
240
|
+
if (!ed) { sendError(res, 503, "config-editor-unavailable", "this computer's DSH does not offer plugin settings"); return true; }
|
|
241
|
+
if (method === "GET" || method === "HEAD") {
|
|
242
|
+
const entryId = url?.searchParams?.get("entryId") ?? "";
|
|
243
|
+
if (!ENTRY_ID_RE.test(entryId)) { sendError(res, 400, "bad-request", "entryId"); return true; }
|
|
244
|
+
const row = findConfigRow(ed, entryId);
|
|
245
|
+
if (!row) { sendError(res, 404, "not-configurable", "this plugin has no settings the profile can change"); return true; }
|
|
246
|
+
const self = isSelf({ entryId, moduleName: row.entry?.options?.name });
|
|
247
|
+
const fields = configFields(row.entry?.options?.config ?? {});
|
|
248
|
+
if (self) for (const f of fields) f.editable = false;
|
|
249
|
+
sendJson(res, 200, { ok: true, entryId, readOnly: self ? "this-plugin" : null, fields });
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
if (method === "PATCH") {
|
|
253
|
+
const body = await readJsonBody(req, res);
|
|
254
|
+
if (body === undefined) return true;
|
|
255
|
+
if (refuseWrite(req, res, body)) return true;
|
|
256
|
+
const { entryId, set } = body;
|
|
257
|
+
if (typeof entryId !== "string" || !ENTRY_ID_RE.test(entryId) || !set || typeof set !== "object" || Array.isArray(set) || !Object.keys(set).length) {
|
|
258
|
+
sendError(res, 400, "bad-request", "entryId and a non-empty set are required");
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
const row = findConfigRow(ed, entryId);
|
|
262
|
+
if (!row) { sendError(res, 404, "not-configurable"); return true; }
|
|
263
|
+
if (isSelf({ entryId, moduleName: row.entry?.options?.name })) { sendError(res, 403, "this-plugin", "change this plugin's settings on the computer"); return true; }
|
|
264
|
+
const current = row.entry?.options?.config ?? {};
|
|
265
|
+
const editable = new Map(configFields(current).map((f) => [f.key, f]));
|
|
266
|
+
for (const [k, v] of Object.entries(set)) {
|
|
267
|
+
const f = editable.get(k);
|
|
268
|
+
if (!f || !f.editable) { sendError(res, 403, "field-not-editable", k); return true; }
|
|
269
|
+
if (typeof v !== f.type) { sendError(res, 400, "bad-request", `${k} must be a ${f.type}`); return true; }
|
|
270
|
+
if (typeof v === "number" && !Number.isFinite(v)) { sendError(res, 400, "bad-request", `${k} must be finite`); return true; }
|
|
271
|
+
if (typeof v === "string" && v.length > VALUE_MAX) { sendError(res, 400, "bad-request", `${k} is too long`); return true; }
|
|
272
|
+
if (typeof v === "string" && looksSecret(v)) { sendError(res, 403, "field-not-editable", "secrets are set on the computer"); return true; }
|
|
273
|
+
}
|
|
274
|
+
await ed.edit(row.entry, (cur) => ({ ...cur, ...set }));
|
|
275
|
+
const after = findConfigRow(ed, entryId);
|
|
276
|
+
sendJson(res, 200, { ok: true, entryId, fields: configFields(after?.entry?.options?.config ?? { ...current, ...set }) });
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
sendError(res, 405, "method-not-allowed");
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
sendError(res, 404, "not-found");
|
|
283
|
+
return true;
|
|
284
|
+
} catch (err) {
|
|
285
|
+
|
|
286
|
+
sendError(res, 400, "plugin-change-failed", String(err?.message ?? err).slice(0, 300));
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
}
|