@dsh-mobile/mobile-remote 3.5.0-beta.1 → 3.5.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -87,6 +87,7 @@ The desktop plugin runs inside DeepSeek Harness on your computer. We publish it,
87
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.
88
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.
89
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.
90
+ - **Notifications while the app is closed (push).** Once our push service is switched on, the app gives each computer it is paired with a push token (from Apple on iPhone, or from Google's Firebase Cloud Messaging on Android phones with Google services) and an encryption key it creates for that computer. The key travels over your existing connection and stays on the phone and that computer. When something needs you, finishes or fails and the app is not open, the plugin encrypts the notification text (the session title, a short description and your computer's name) with that key and sends it through our cloud service (`dsh.claud.ing`) to Apple or Google, which deliver it to your phone; the phone decrypts it. **Our service and Apple or Google see the push token and encrypted data they cannot read; we do not store the token, the data or a log of them.** If the phone cannot decrypt in time, it shows a generic notification. Phones without Google services get no such push and keep the push channels above. Removing a computer from the app tells it to forget the token and deletes the key on the phone. Approve, Decline and Cancel buttons on such a notification send your answer, encrypted with the same key, through our relay to that computer (only computers set up for remote access); the relay cannot read it and keeps no copy.
90
91
  - **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
92
  - **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.
92
93
  - **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`).
@@ -117,6 +118,8 @@ DeepSeek Harness, model providers, push channels and file services are chosen an
117
118
  | Google ML Kit (Android only) | QR-code scanning in the app; sends Google diagnostic and usage data (Section 10) | [ML Kit data disclosure](https://developers.google.com/ml-kit/android-data-disclosure) |
118
119
  | Cloudflare | Website hosting, the cloud account service and its storage (D1, R2), the Public network relay and its counters (Workers Analytics Engine); the default STUN server for direct connections, only if you turn them on (Section 7) | [Cloudflare Privacy Policy](https://www.cloudflare.com/privacypolicy/) |
119
120
  | DeepSeek, OpenAI, OpenCode | Balance and usage queries from the desktop plugin, with your own credentials | Their own policies |
121
+ | Apple Push Notification service | Delivers the app's encrypted notifications to iPhones (Section 7) | [Apple Privacy Policy](https://www.apple.com/legal/privacy/) |
122
+ | Google Firebase Cloud Messaging (Android with Google services) | Delivers the app's encrypted notifications to Android phones (Section 7) | [Google Privacy Policy](https://policies.google.com/privacy) |
120
123
  | ServerChan, ntfy, Bark, WeCom, webhooks | Push alerts you set up in the desktop plugin | Their own policies |
121
124
  | WeChat, QQ, Discord | Support channels listed on our website | Their own policies |
122
125
 
@@ -87,6 +87,7 @@ DSH Mobile 让你连接到自己在电脑上运行的 DeepSeek Harness 服务,
87
87
  - **备份。** 当你请求备份时,插件会生成一个文件,内含你现有的记忆(已删除的不在其中)和助手设置(模式、人格和安静时段)。它不含访问口令或密钥。不设口令时它是明文 JSON 文件;设了口令(至少 15 个字符)时,整个文件用 AES-256-GCM 加密,密钥由口令经 scrypt 派生;插件不保存口令,没有口令就无法读取或恢复该文件。之前做的备份仍包含做备份时存在的记忆。如果你把备份取到手机上,它会经由你的连接传输(局域网下是明文 HTTP,经中继时加密);保存在哪里由你决定。恢复备份只会新增条目,所以恢复一份较早的备份,会把你在那之后删除的记忆加回来。
88
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 秒。
89
89
  - **推送通道。** 如果你添加了推送通道(Server酱、ntfy、Bark、企业微信群机器人或任意 Webhook),插件会把提醒直接发给它们。默认(`pushContent: minimal`)提醒包含事件类型和会话短码,通用 Webhook 还会收到完整的会话 ID 和时间;设为 `standard` 时提醒还会包含会话标题和事件详情。这些服务按其各自政策处理提醒。
90
+ - **应用关闭时的通知(推送)。** 我们的推送服务开启后,应用会给每台已配对的电脑一个推送令牌(iPhone 上来自 Apple;有 Google 服务的 Android 手机上来自 Google 的 Firebase Cloud Messaging),以及一把应用为这台电脑生成的加密密钥。密钥经你已有的连接传给电脑,只保存在手机和那台电脑上。当有事需要你处理、任务完成或失败而应用没有打开时,插件用这把密钥加密通知文字(会话标题、一句简短说明和你电脑的名字),经我们的云端服务(`dsh.claud.ing`)交给 Apple 或 Google 送达手机,由手机解密。**我们的服务和 Apple、Google 只能看到推送令牌和无法读取的密文;我们不保存令牌、密文,也不记录它们。** 手机来不及解密时会显示一条通用通知。没有 Google 服务的手机收不到这种推送,仍使用上面的推送通道。在应用里移除一台电脑时,应用会让它忘掉这个令牌,并删除手机上的密钥。通知上的“批准”“拒绝”“取消”按钮会把你的回答用同一把密钥加密,经我们的中继交给那台电脑(仅限开启了远程访问的电脑);中继无法读取,也不保留副本。
90
91
  - **手机动作。** 如果你使用本应用,运行在你电脑上的 AI 智能体可以请求你的手机设置计时器或闹钟、添加日历事件或打开链接。只有在支持这些动作的应用版本连接到你的电脑时,插件才会把这些工具提供给智能体。请求从你的电脑经你已经在用的连接送到手机(局域网,或公开网络中继;经中继时与其他所有消息一样端到端加密,见第 6 节)。**你在手机上确认之前,什么都不会发生**:确认界面会写明是哪台电脑(或者你在同一次智能体轮次内,已对同一类动作选择了“本轮允许”)。请求里包含智能体写下的内容,例如事件标题、时间、备注或链接。**我们不会存储、记录或接收这些内容:它们不会发往我们的任何服务器,也不属于任何遥测或中继计数。** 插件自己的日志最多只记录动作的种类、请求 ID 和结果,不记录这些内容。不过,与任何其他工具调用一样,智能体的请求及其结果属于对话的一部分,而对话由 DeepSeek Harness 保存并发送给你的模型提供方(第 9 节)。除第 6 节所述、无论是否使用手机动作都已存在的加密中继流量外,这项功能不会向我们发送任何数据。
91
92
  - **工具箱。** 你可以在电脑上为应用的“工具箱”页制作小工具:手动放进插件状态目录下的 `toolbox` 文件夹,或者让智能体把一个文件夹打包并发给你的手机。插件只在你或智能体要求时读取这样的文件夹,并且不会读取 DeepSeek Harness 主目录里除 `toolbox` 文件夹以外的任何文件夹。只有在你在手机上确认安装之后(确认界面会写明是哪台电脑),插件才会经你已经在用的连接把工具文件发给手机。工具文件不会发往我们的任何服务器;插件日志最多只记录工具 ID、请求 ID 和结果。
92
93
  - **直连(点对点)连接(实验性,默认关闭)。** 只有在你主动开启后,手机和你的电脑才会尝试直接连接,而不经过中继。为了建立连接,它们会通过我们中继上你电脑的房间交换连接建立消息(会话描述和网络候选地址,其中包含 IP 地址)。**这些消息用你们配对时的密钥端到端加密,我们的服务器无法读取。** 我们的中继只能看到发生过一次建立连接、它的大小和时间,并像其他中继计数一样记录,不含内容,也不含 IP 地址(第 6 节)。随后数据直接在你的两台设备之间传输并再次加密,不经过我们的服务器。为了得知自己的公网地址,双方会向 STUN 服务器发起查询,默认是 `stun:stun.cloudflare.com:3478`,由 Cloudflare 运营,它会看到发起查询的设备的 IP 地址;你可以在插件配置里更换这个服务器(`p2p.stun`)。
@@ -117,6 +118,8 @@ DeepSeek Harness、模型提供商、推送通道和文件服务由你选择并
117
118
  | Google ML Kit(仅 Android) | 应用内扫码;会把诊断和使用数据发给 Google(第 10 节) | [ML Kit 数据披露](https://developers.google.com/ml-kit/android-data-disclosure) |
118
119
  | Cloudflare | 托管网站、云端账号服务及其存储(D1、R2)、公开网络中继及其计数(Workers Analytics Engine);直连默认使用的 STUN 服务器(仅在你开启直连时,第 7 节) | [Cloudflare 隐私政策](https://www.cloudflare.com/privacypolicy/) |
119
120
  | DeepSeek、OpenAI、OpenCode | 电脑端插件用你自己的凭据查询余额和用量 | 其各自政策 |
121
+ | Apple 推送通知服务(APNs) | 把应用的加密通知送到 iPhone(第 7 节) | [Apple 隐私政策](https://www.apple.com/legal/privacy/) |
122
+ | Google Firebase Cloud Messaging(有 Google 服务的 Android) | 把应用的加密通知送到 Android 手机(第 7 节) | [Google 隐私权政策](https://policies.google.com/privacy) |
120
123
  | Server酱、ntfy、Bark、企业微信、Webhook | 你在电脑端插件里配置的推送提醒 | 其各自政策 |
121
124
  | 微信、QQ、Discord | 我们网站上列出的客服渠道 | 其各自政策 |
122
125
 
@@ -23,6 +23,8 @@
23
23
 
24
24
 
25
25
 
26
+
27
+
26
28
 
27
29
 
28
30
 
@@ -75,6 +77,61 @@ const receiptView = (r) => ({
75
77
  targetSessionId: str(r?.targetSessionId) ?? null,
76
78
  });
77
79
 
80
+ const hostZone = () => {
81
+ try { return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC"; } catch { return "UTC"; }
82
+ };
83
+ const TIME_RE = /^\d{2}:\d{2}(:\d{2}(\.\d{1,3})?)?$/;
84
+ const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
85
+ const zoneOf = (v) => (typeof v === "string" && v.length > 0 && v.length <= 64 ? v : hostZone());
86
+ const secondsOf = (v) => (Number.isInteger(v) && v >= 1 && v <= 366 * 86400 ? v : undefined);
87
+
88
+
89
+ export function scheduleTimingOf(t) {
90
+ if (!t || typeof t !== "object" || Array.isArray(t)) return { error: "timing must be an object" };
91
+ switch (t.kind) {
92
+ case "after": {
93
+ const n = secondsOf(t.afterSeconds);
94
+ return n ? { timing: { kind: "after", after_seconds: n } } : { error: "afterSeconds must be a whole number of seconds" };
95
+ }
96
+ case "every": {
97
+ const n = secondsOf(t.everySeconds);
98
+ return n ? { timing: { kind: "every", every_seconds: n } } : { error: "everySeconds must be a whole number of seconds" };
99
+ }
100
+ case "at":
101
+ if (!DATE_RE.test(t.date ?? "") || !TIME_RE.test(t.time ?? "")) return { error: "at needs date (YYYY-MM-DD) and time (HH:mm)" };
102
+ return { timing: { kind: "at", at: { date: t.date, time: t.time.length === 5 ? `${t.time}:00` : t.time, time_zone: zoneOf(t.timeZone) } } };
103
+ case "daily":
104
+ if (!TIME_RE.test(t.time ?? "")) return { error: "daily needs time (HH:mm)" };
105
+ return { timing: { kind: "daily", daily: { time: t.time.length === 5 ? `${t.time}:00` : t.time, time_zone: zoneOf(t.timeZone) } } };
106
+ case "weekly": {
107
+ const days = Array.isArray(t.weekdays) ? [...new Set(t.weekdays)] : [];
108
+ if (!TIME_RE.test(t.time ?? "")) return { error: "weekly needs time (HH:mm)" };
109
+ if (days.length === 0 || days.some((d) => !Number.isInteger(d) || d < 1 || d > 7)) return { error: "weekdays must be 1 (Mon) to 7 (Sun)" };
110
+ return { timing: { kind: "weekly", weekly: { time: t.time.length === 5 ? `${t.time}:00` : t.time, time_zone: zoneOf(t.timeZone), weekdays: days.sort((a, b) => a - b) } } };
111
+ }
112
+ case "cron":
113
+ if (typeof t.expression !== "string" || !t.expression.trim() || t.expression.length > 200) return { error: "cron needs an expression" };
114
+ return { timing: { kind: "cron", cron: { expression: t.expression.trim(), time_zone: zoneOf(t.timeZone) } } };
115
+ default:
116
+ return { error: "timing.kind is not one the phone can set" };
117
+ }
118
+ }
119
+
120
+
121
+ export function scheduleTargetOf(t) {
122
+ if (!t || typeof t !== "object" || Array.isArray(t)) return { error: "target must be an object" };
123
+ if (t.kind === "session") {
124
+ if (typeof t.sessionId !== "string" || !ID_RE.test(t.sessionId)) return { error: "target.sessionId is not valid" };
125
+ return { target: { kind: "session", sessionId: t.sessionId } };
126
+ }
127
+ if (t.kind === "new_once" || t.kind === "new") {
128
+ const create = {};
129
+ if (typeof t.cwd === "string" && t.cwd && t.cwd.length <= 1024) create.cwd = t.cwd;
130
+ return { target: { kind: t.kind, ...(Object.keys(create).length ? { create } : {}) } };
131
+ }
132
+ return { error: "target.kind is not one the phone can set" };
133
+ }
134
+
78
135
 
79
136
  export function schedulePatchOf(body) {
80
137
  if (!body || typeof body !== "object" || Array.isArray(body)) return { error: "body must be an object" };
@@ -93,6 +150,16 @@ export function schedulePatchOf(body) {
93
150
  if (typeof body.active !== "boolean") return { error: "active must be true or false" };
94
151
  patch.active = body.active;
95
152
  }
153
+ if (body.timing !== undefined) {
154
+ const r = scheduleTimingOf(body.timing);
155
+ if (r.error) return { error: r.error };
156
+ patch.timing = r.timing;
157
+ }
158
+ if (body.target !== undefined) {
159
+ const r = scheduleTargetOf(body.target);
160
+ if (r.error) return { error: r.error };
161
+ patch.target = r.target;
162
+ }
96
163
  if (Object.keys(patch).length === 0) return { error: "nothing to change" };
97
164
  const expected = body.expectedUpdatedAt;
98
165
  if (expected !== undefined && expected !== null && typeof expected !== "string") return { error: "expectedUpdatedAt must be a string or null" };
package/lib/index.js CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- import { protocolInfo } from "./protocol.js"; import { createPhoneActions } from "./phone-actions.js"; import { attachLiveActivity } from "./live-activity.js";
10
+ import { protocolInfo } from "./protocol.js"; import { createPhoneActions } from "./phone-actions.js"; import { attachLiveActivity } from "./live-activity.js"; import { PHONE_PUSH_KINDS, attachPushAnswers, createPhonePush, phoneActionText, replyTarget, workerEndpoint } from "./phone-push.js";
11
11
  import { networkInterfaces, hostname } from "node:os";
12
12
  import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
13
13
  import { ftruncateSync, mkdirSync, readFileSync, renameSync, writeFileSync, writeSync } from "node:fs";
@@ -1342,8 +1342,9 @@ export function apply(ctx, configInput) {
1342
1342
 
1343
1343
 
1344
1344
 
1345
- const pushSend = async (kind, sessionId, title, detail) => {
1346
- if (config.pushUrls.length === 0) return false;
1345
+ const pushSend = async (kind, sessionId, title, detail, ask) => {
1346
+ const toPhone = PHONE_PUSH_KINDS[kind] !== undefined && phonePush.active && !appInForeground();
1347
+ if (config.pushUrls.length === 0 && !toPhone) return false;
1347
1348
  const key = `${sessionId}:${kind}`;
1348
1349
  const now = Date.now();
1349
1350
  const last = pushCooldowns.get(key) ?? 0;
@@ -1388,7 +1389,7 @@ export function apply(ctx, configInput) {
1388
1389
  const safeHeadline = headline.trim() === "" ? kindLabel : headline;
1389
1390
  const redactedTitle = safeHeadline;
1390
1391
  const redactedDetail = body.trim() === "" ? redactPathText(detail) : body;
1391
- let delivered = 0;
1392
+ let delivered = toPhone ? await phonePush.notify({ kind: PHONE_PUSH_KINDS[kind], title: redactedTitle, body: redactedDetail, sid: sessionId, ask }).catch(() => 0) : 0;
1392
1393
  for (const target of config.pushUrls) {
1393
1394
 
1394
1395
  const outcome = await pushTracked(target, kind, kindLabel, redactedTitle, redactedDetail, sessionId);
@@ -1408,7 +1409,7 @@ export function apply(ctx, configInput) {
1408
1409
 
1409
1410
  const lastNeedsAnswerAt = new Map();
1410
1411
  const NEEDS_ANSWER_DEDUP_MS = 10_000;
1411
- const notifyNeedsAnswer = (sessionId, detail) => {
1412
+ const notifyNeedsAnswer = (sessionId, detail, ask) => {
1412
1413
  const now = Date.now();
1413
1414
  const last = lastNeedsAnswerAt.get(sessionId) ?? 0;
1414
1415
  if (now - last < NEEDS_ANSWER_DEDUP_MS) return false;
@@ -1420,7 +1421,7 @@ export function apply(ctx, configInput) {
1420
1421
  });
1421
1422
  const sessions = ctx.get("sessions");
1422
1423
  const sess = sessions?.get(sessionId);
1423
- void pushSend("needs-answer", sessionId, notifyTitle(sessionId, sess), detail).catch((err) => {
1424
+ void pushSend("needs-answer", sessionId, notifyTitle(sessionId, sess), detail, ask).catch((err) => {
1424
1425
 
1425
1426
  ctx.logger.warn(`mobile-remote: pushSend 失败(${sessionId}):${err?.message ?? err}`);
1426
1427
  });
@@ -1712,7 +1713,7 @@ export function apply(ctx, configInput) {
1712
1713
  }
1713
1714
  }
1714
1715
  };
1715
- const phoneActions = createPhoneActions({ ctx, broadcast, phoneConnected: () => connections.size > 0, pcName: config.relay?.name }); const liveActivity = attachLiveActivity({ ctx, config, agentSessionId: (a) => agentSessionId(a), sessionTitleOf: (s) => sessionTitleOf(s), pending: () => [...pendingApprovals.values(), ...pendingQuestions.values()] });
1716
+ const phonePush = createPhonePush({ dir: STATE_DIR, endpoint: workerEndpoint(config), pcName: () => config.relay?.name || hostname(), reply: () => { try { return replyTarget(relay); } catch { return null; } }, logger: ctx.logger }); const phoneActions = createPhoneActions({ ctx, broadcast, phoneConnected: () => connections.size > 0, pcName: config.relay?.name, canPush: () => phonePush.active && !appInForeground(), onRequest: (f) => void phonePush.notify({ kind: "phone-action", ...phoneActionText(f), sid: f.sessionId, ask: { type: "phone-action", id: f.id } }).catch(() => 0) }); const liveActivity = attachLiveActivity({ ctx, config, agentSessionId: (a) => agentSessionId(a), sessionTitleOf: (s) => sessionTitleOf(s), pending: () => [...pendingApprovals.values(), ...pendingQuestions.values()] });
1716
1717
  const toolbox = createToolbox({ ctx, broadcast, pcName: config.relay?.name });
1717
1718
 
1718
1719
 
@@ -1863,7 +1864,7 @@ export function apply(ctx, configInput) {
1863
1864
  res.write(`data: ${JSON.stringify({ type: "mobile/frame", frame: f })}\n\n`);
1864
1865
  }
1865
1866
 
1866
- for (const f of sessionJobsFrames()) {
1867
+ for (const f of [...sessionJobsFrames(), ...phoneActions.pendingFrames()]) {
1867
1868
  res.write(`data: ${JSON.stringify(f)}\n\n`);
1868
1869
  }
1869
1870
  };
@@ -2546,7 +2547,7 @@ export function apply(ctx, configInput) {
2546
2547
  get pendingQuestions() { return pendingQuestions; },
2547
2548
  get persistHeld() { return persistHeld; },
2548
2549
  get persistReceipts() { return persistReceipts; },
2549
- get phoneActions() { return phoneActions; }, get liveActivity() { return liveActivity; },
2550
+ get phoneActions() { return phoneActions; }, get liveActivity() { return liveActivity; }, get phonePush() { return phonePush; },
2550
2551
  get pluginVersion() { return pluginVersion; },
2551
2552
  get toolbox() { return toolbox; },
2552
2553
  get presenceState() { return presenceState; },
@@ -2828,8 +2829,8 @@ export function apply(ctx, configInput) {
2828
2829
  timer.unref?.();
2829
2830
  entry.timer = timer;
2830
2831
  };
2831
- const notifyAsk = (sessionId, req) =>
2832
- notifyNeedsAnswer(sessionId, `审批请求:${typeof req?.toolName === "string" && req.toolName ? req.toolName : "工具"} 需要授权`);
2832
+ const notifyAsk = (sessionId, req, id) =>
2833
+ notifyNeedsAnswer(sessionId, `审批请求:${typeof req?.toolName === "string" && req.toolName ? req.toolName : "工具"} 需要授权`, id ? { type: "approval", id } : undefined);
2833
2834
  const notifyQuestion = (sessionId) => notifyNeedsAnswer(sessionId, "agent 正在等待你的回答");
2834
2835
 
2835
2836
 
@@ -2862,7 +2863,7 @@ export function apply(ctx, configInput) {
2862
2863
 
2863
2864
  putAskReplay("a", entry, requested);
2864
2865
  broadcast({ type: "mobile/frame", frame: requested });
2865
- notifyAskDeferred(sessionId, () => pendingApprovals.has(phoneKey), () => notifyAsk(sessionId, req));
2866
+ notifyAskDeferred(sessionId, () => pendingApprovals.has(phoneKey), () => notifyAsk(sessionId, req, phoneKey));
2866
2867
  return { held, entry };
2867
2868
  };
2868
2869
  const holdQuestion = (req, sessionId) => {
@@ -2950,7 +2951,7 @@ export function apply(ctx, configInput) {
2950
2951
  broadcast({ type: "mobile/frame", frame: requested });
2951
2952
 
2952
2953
 
2953
- notifyAskDeferred(sessionId, () => pendingApprovals.has(phoneKey), () => notifyAsk(sessionId, request));
2954
+ notifyAskDeferred(sessionId, () => pendingApprovals.has(phoneKey), () => notifyAsk(sessionId, request, phoneKey));
2954
2955
  return;
2955
2956
  }
2956
2957
  if (frame.event === "user-questions/request") {
@@ -3247,7 +3248,7 @@ export function apply(ctx, configInput) {
3247
3248
  const demand = relayRemote
3248
3249
  ? createRelayDemand({ connector, devices, log: (m) => ctx.logger.warn?.(`mobile-remote: ${m}`) })
3249
3250
  : { active: false, start() { return false; }, stop() {}, sync() { return false; }, dispose() {} };
3250
- relay = { identity, devices, connector, demand, p2p, remote: relayRemote, urls: relayRemote ? relayUrls : [], name: config.relay?.name || hostname() };
3251
+ relay = { identity, devices, connector, demand, p2p, remote: relayRemote, urls: relayRemote ? relayUrls : [], name: config.relay?.name || hostname() }; attachPushAnswers({ connector, phonePush, room: () => identity.roomId, approve: (id, outcome) => { const e = pendingApprovals.get(id); if (e) finishApproval(e, outcome); return Boolean(e); }, cancelPhoneAction: (id) => phoneActions.cancelFromPush(id), logger: ctx.logger });
3251
3252
  } catch (err) {
3252
3253
  ctx.logger.warn?.(`mobile-remote: 中继初始化失败,已关闭:${err?.message ?? err}`);
3253
3254
  }
@@ -14,6 +14,8 @@
14
14
 
15
15
 
16
16
 
17
+
18
+
17
19
  import { randomUUID } from "node:crypto";
18
20
  import { hostname } from "node:os";
19
21
  import { ACTIONS, TOOL_NAMES, TOOL_SPECS, validatePhoneAction } from "./phone-action-args.js";
@@ -49,7 +51,7 @@ const sessionIdOf = (agent) => agent?.session?.id ?? String(agent?.id ?? "").rep
49
51
 
50
52
 
51
53
 
52
- export const createPhoneActions = ({ ctx, broadcast, phoneConnected, pcName, now = Date.now, setTimer = setTimeout, clearTimer = clearTimeout, graceMs = GRACE_MS }) => {
54
+ export const createPhoneActions = ({ ctx, broadcast, phoneConnected, pcName, canPush = () => false, onRequest = () => {}, now = Date.now, setTimer = setTimeout, clearTimer = clearTimeout, graceMs = GRACE_MS }) => {
53
55
  const pending = new Map();
54
56
  const settled = new Map();
55
57
  const turns = new Map();
@@ -77,7 +79,8 @@ export const createPhoneActions = ({ ctx, broadcast, phoneConnected, pcName, now
77
79
  };
78
80
 
79
81
  const request = (action, args, exec) => {
80
- if (!phoneConnected()) throw new Error("phone not connected: the DSH Mobile app is not connected to this computer right now, so this action cannot be done. Tell the user.");
82
+ const pushed = !phoneConnected() && canPush();
83
+ if (!phoneConnected() && !pushed) throw new Error("phone not connected: the DSH Mobile app is not connected to this computer right now, so this action cannot be done. Tell the user.");
81
84
  if (pending.size >= MAX_PENDING) throw new Error("too many phone actions are waiting for the user");
82
85
  const id = randomUUID();
83
86
  const sessionId = sessionIdOf(exec?.agent);
@@ -96,13 +99,18 @@ export const createPhoneActions = ({ ctx, broadcast, phoneConnected, pcName, now
96
99
  entry.offAbort = () => signal.removeEventListener("abort", onAbort);
97
100
  }
98
101
  }
99
- pending.set(id, entry);
100
- broadcast({
102
+ const frame = {
101
103
  type: "phone-action-request", id, pcName: name, action, args,
102
104
  expiresAt: at + ASK_MS,
103
105
  ...(sessionId ? { sessionId } : {}),
104
106
  ...(turnId ? { turnId } : {}),
105
- });
107
+ };
108
+ entry.frame = frame;
109
+ pending.set(id, entry);
110
+ broadcast(frame);
111
+ if (pushed) {
112
+ try { onRequest(frame); } catch { }
113
+ }
106
114
  });
107
115
  };
108
116
 
@@ -223,5 +231,9 @@ export const createPhoneActions = ({ ctx, broadcast, phoneConnected, pcName, now
223
231
 
224
232
  features: () => (supported ? [FEATURE] : []),
225
233
  pendingCount: () => pending.size,
234
+
235
+ pendingFrames: () => [...pending.values()].map((e) => e.frame).filter((f) => f && f.expiresAt > now()),
236
+
237
+ cancelFromPush: (id) => settle(id, { status: "cancelled", detail: "cancelled on the phone's lock screen" }, { byPhone: true }),
226
238
  };
227
239
  };
@@ -0,0 +1,310 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+ import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
23
+ import { chmodSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
24
+ import { join } from "node:path";
25
+ import { readBody, sendError, sendJson } from "./http-util.js";
26
+
27
+ export const PUSH_AAD = "dsh-push-v1";
28
+ export const ANSWER_AAD = "dsh-push-answer-v1|";
29
+ export const MAX_REGISTRATIONS = 8;
30
+
31
+ export const ANSWER_MAX_AGE_MS = 10 * 60_000;
32
+
33
+ export const MAX_PLAINTEXT_BYTES = 2048;
34
+ const FILE = "push-registrations.json";
35
+
36
+ const KEY_ID_RE = /^[0-9a-f]{16}$/;
37
+ const APNS_TOKEN_RE = /^[0-9a-f]{64,200}$/;
38
+ const FCM_TOKEN_RE = /^[A-Za-z0-9_:-]{20,400}$/;
39
+ const KINDS = new Set(["needs-you", "done", "failed", "phone-action", "reminder"]);
40
+
41
+ export const PHONE_PUSH_KINDS = Object.freeze({ "needs-answer": "needs-you", completed: "done", failed: "failed", reminder: "reminder" });
42
+
43
+
44
+ const clean = (v, max) => (typeof v === "string" ? v.replace(/[\u0000-\u0008\u000b-\u001f\u007f]/g, " ").trim().slice(0, max) : "");
45
+
46
+
47
+ const line = (v, max) => clean(typeof v === "string" ? v.replace(/[\u0000-\u001f\u007f]/g, " ") : v, max);
48
+ const b64u = {
49
+ enc: (buf) => Buffer.from(buf).toString("base64url"),
50
+ dec: (s) => Buffer.from(s, "base64url"),
51
+ };
52
+
53
+
54
+ export function seal(key, keyIdHex, plaintext, aad = PUSH_AAD, nonce = randomBytes(12)) {
55
+ const cipher = createCipheriv("aes-256-gcm", key, nonce);
56
+ cipher.setAAD(Buffer.from(aad, "utf8"));
57
+ const ct = Buffer.concat([cipher.update(typeof plaintext === "string" ? Buffer.from(plaintext, "utf8") : plaintext), cipher.final()]);
58
+ return b64u.enc(Buffer.concat([Buffer.from(keyIdHex, "hex"), nonce, ct, cipher.getAuthTag()]));
59
+ }
60
+
61
+
62
+ export function boxKeyId(box) {
63
+ if (typeof box !== "string" || !/^[A-Za-z0-9_-]{48,4000}$/.test(box)) return null;
64
+ const raw = b64u.dec(box);
65
+ return raw.length >= 36 ? raw.subarray(0, 8).toString("hex") : null;
66
+ }
67
+
68
+
69
+ export function open(key, box, aad = PUSH_AAD) {
70
+ try {
71
+ const raw = b64u.dec(box);
72
+ if (raw.length < 36) return null;
73
+ const decipher = createDecipheriv("aes-256-gcm", key, raw.subarray(8, 20));
74
+ decipher.setAAD(Buffer.from(aad, "utf8"));
75
+ decipher.setAuthTag(raw.subarray(raw.length - 16));
76
+ return Buffer.concat([decipher.update(raw.subarray(20, raw.length - 16)), decipher.final()]);
77
+ } catch {
78
+ return null;
79
+ }
80
+ }
81
+
82
+
83
+ export function checkRegistration(body) {
84
+ if (!body || typeof body !== "object" || Array.isArray(body)) return { ok: false, error: "bad-request" };
85
+ if (typeof body.keyId !== "string" || !KEY_ID_RE.test(body.keyId)) return { ok: false, error: "invalid-key-id" };
86
+ if (body.token === null) return { ok: true, forget: body.keyId };
87
+ const platform = body.platform;
88
+ if (platform !== "apns" && platform !== "fcm") return { ok: false, error: "invalid-platform" };
89
+ const re = platform === "apns" ? APNS_TOKEN_RE : FCM_TOKEN_RE;
90
+ if (typeof body.token !== "string" || !re.test(body.token)) return { ok: false, error: "invalid-token" };
91
+ let key;
92
+ try {
93
+ key = typeof body.key === "string" ? Buffer.from(body.key, "base64") : null;
94
+ } catch {
95
+ key = null;
96
+ }
97
+ if (!key || key.length !== 32) return { ok: false, error: "invalid-key" };
98
+ const environment = platform === "apns" ? (body.environment === "sandbox" ? "sandbox" : "production") : null;
99
+ return { ok: true, reg: { keyId: body.keyId, key: key.toString("base64"), platform, token: body.token, environment } };
100
+ }
101
+
102
+
103
+
104
+
105
+
106
+ export function buildPlaintext({ kind, title, body, pc, sid, ask, reply, at }) {
107
+ const msg = { v: 1, kind: KINDS.has(kind) ? kind : "needs-you", title: line(title, 120), body: clean(body, 600), pc: line(pc, 60), at };
108
+ const s = clean(sid, 120);
109
+ if (s) msg.sid = s;
110
+ if (ask && (ask.type === "approval" || ask.type === "phone-action") && typeof ask.id === "string" && ask.id.length <= 200) {
111
+ msg.ask = { type: ask.type, id: ask.id };
112
+ }
113
+ if (reply && /^https:\/\/[^/\s]+$/.test(reply.url ?? "") && /^[0-9a-f]{32}$/.test(reply.room ?? "")) msg.reply = { url: reply.url, room: reply.room };
114
+ let text = JSON.stringify(msg);
115
+ while (Buffer.byteLength(text) > MAX_PLAINTEXT_BYTES && (msg.body.length > 0 || msg.title.length > 0)) {
116
+ if (msg.body.length > 0) msg.body = msg.body.slice(0, Math.floor(msg.body.length / 2));
117
+ else msg.title = msg.title.slice(0, Math.floor(msg.title.length / 2));
118
+ text = JSON.stringify(msg);
119
+ }
120
+ return text;
121
+ }
122
+
123
+
124
+ export function workerEndpoint(config) {
125
+ const raw = config?.phonePush?.endpoint || config?.liveActivityPush?.endpoint || "";
126
+ return typeof raw === "string" && /^https:\/\/[^/\s]+/.test(raw) ? raw.replace(/\/+$/, "") : null;
127
+ }
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+ export function createPhonePush({ dir, endpoint, pcName = () => "", reply = () => null, fetchImpl = globalThis.fetch, now = Date.now, logger = {}, timeoutMs = 10_000 } = {}) {
137
+
138
+ const regs = new Map();
139
+ const seenAnswers = new Set();
140
+ const file = dir ? join(dir, FILE) : null;
141
+ const log = (m) => logger.info?.(`mobile-remote: [push] ${m}`);
142
+
143
+ const load = () => {
144
+ if (!file) return;
145
+ try {
146
+ const data = JSON.parse(readFileSync(file, "utf8"));
147
+ for (const r of Array.isArray(data?.regs) ? data.regs : []) {
148
+ const c = checkRegistration(r);
149
+ if (c.ok && c.reg) regs.set(c.reg.keyId, { ...c.reg, at: Number(r.at) || 0 });
150
+ }
151
+ } catch {
152
+
153
+ }
154
+ };
155
+ const save = () => {
156
+ if (!file) return;
157
+ try {
158
+ mkdirSync(dir, { recursive: true });
159
+ const tmp = `${file}.${process.pid}.tmp`;
160
+ writeFileSync(tmp, JSON.stringify({ v: 1, regs: [...regs.values()] }), { mode: 0o600 });
161
+ renameSync(tmp, file);
162
+ try { chmodSync(file, 0o600); } catch { }
163
+ } catch (err) {
164
+ log(`could not save registrations (${err?.code ?? "error"})`);
165
+ }
166
+ };
167
+ load();
168
+
169
+ const register = (reg) => {
170
+
171
+ for (const [id, r] of regs) if (r.token === reg.token && id !== reg.keyId) regs.delete(id);
172
+ regs.delete(reg.keyId);
173
+ if (regs.size >= MAX_REGISTRATIONS) regs.delete([...regs.values()].sort((a, b) => a.at - b.at)[0].keyId);
174
+ regs.set(reg.keyId, { ...reg, at: now() });
175
+ save();
176
+ };
177
+
178
+ const sendOne = async (reg, text) => {
179
+ const key = Buffer.from(reg.key, "base64");
180
+ const body = { platform: reg.platform, token: reg.token, e: seal(key, reg.keyId, text) };
181
+ if (reg.environment) body.environment = reg.environment;
182
+ const res = await fetchImpl(`${endpoint}/api/push/notify`, {
183
+ method: "POST",
184
+ headers: { "content-type": "application/json", "user-agent": "dsh-mobile-remote" },
185
+ body: JSON.stringify(body),
186
+ signal: AbortSignal.timeout(timeoutMs),
187
+ });
188
+ return res.status;
189
+ };
190
+
191
+ return {
192
+
193
+ get active() {
194
+ return endpoint !== null && regs.size > 0;
195
+ },
196
+ get size() {
197
+ return regs.size;
198
+ },
199
+
200
+ registration: (keyId) => regs.get(keyId),
201
+
202
+
203
+
204
+
205
+
206
+
207
+ openAnswer(box, room) {
208
+ const keyId = boxKeyId(box);
209
+ const reg = keyId ? regs.get(keyId) : undefined;
210
+ if (!reg || typeof room !== "string") return null;
211
+ const raw = open(Buffer.from(reg.key, "base64"), box, ANSWER_AAD + room);
212
+ if (!raw) return null;
213
+ let a;
214
+ try {
215
+ a = JSON.parse(raw.toString("utf8"));
216
+ } catch {
217
+ return null;
218
+ }
219
+ const ok = a?.v === 1 && typeof a.id === "string" && a.id.length <= 200 && Number.isFinite(a.at)
220
+ && ((a.type === "approval" && (a.decision === "approve" || a.decision === "decline")) || (a.type === "phone-action" && a.decision === "cancel"));
221
+ if (!ok || a.at < now() - ANSWER_MAX_AGE_MS || a.at > now() + 120_000) return null;
222
+ const seenKey = `${keyId}:${a.type}:${a.id}`;
223
+ if (seenAnswers.has(seenKey)) return null;
224
+ seenAnswers.add(seenKey);
225
+ if (seenAnswers.size > 256) seenAnswers.delete(seenAnswers.values().next().value);
226
+ return { type: a.type, id: a.id, decision: a.decision };
227
+ },
228
+
229
+
230
+
231
+
232
+
233
+ async notify(n) {
234
+ if (endpoint === null || regs.size === 0) return 0;
235
+ const text = buildPlaintext({ ...n, pc: pcName(), reply: n.ask ? reply() : null, at: now() });
236
+ let delivered = 0;
237
+ let dropped = false;
238
+ await Promise.all([...regs.values()].map(async (reg) => {
239
+ try {
240
+ const status = await sendOne(reg, text);
241
+ if (status === 200) delivered++;
242
+ else if (status === 410) {
243
+ regs.delete(reg.keyId);
244
+ dropped = true;
245
+ } else log(`${reg.platform} push refused (${status})`);
246
+ } catch (err) {
247
+ log(`${reg.platform} push failed (${err?.name ?? "error"})`);
248
+ }
249
+ }));
250
+ if (dropped) save();
251
+ return delivered;
252
+ },
253
+
254
+
255
+ async handle(req, res, method) {
256
+ if (method !== "POST") return sendError(res, 405, "method-not-allowed"), true;
257
+ let body;
258
+ try {
259
+ body = JSON.parse(await readBody(req, 8 * 1024));
260
+ } catch (err) {
261
+ return sendError(res, err?.status === 413 ? 413 : 400, err?.status === 413 ? "payload-too-large" : "invalid-json"), true;
262
+ }
263
+ const c = checkRegistration(body);
264
+ if (!c.ok) return sendError(res, 400, c.error), true;
265
+ if (c.forget) {
266
+ if (regs.delete(c.forget)) save();
267
+ } else register(c.reg);
268
+ return sendJson(res, 200, { ok: true, configured: endpoint !== null, actions: reply() !== null }), true;
269
+ },
270
+ };
271
+ }
272
+
273
+
274
+
275
+
276
+
277
+ export function replyTarget(relay) {
278
+ if (!relay?.remote || !/^[0-9a-f]{32}$/.test(relay.identity?.roomId ?? "")) return null;
279
+ const m = /^wss:\/\/([^/\s?#]+)/.exec(relay.urls?.[0] ?? "");
280
+ return m ? { url: `https://${m[1]}`, room: relay.identity.roomId } : null;
281
+ }
282
+
283
+
284
+ export function phoneActionText(frame) {
285
+ const a = frame?.args ?? {};
286
+ const icon = { add_reminder: "⏰", add_event: "📅", set_alarm: "⏰", set_timer: "⏱", open_link: "🔗" }[frame?.action] ?? "📱";
287
+ const what =
288
+ frame?.action === "add_reminder" ? `${a.title ?? ""} · ${a.at ?? ""}`
289
+ : frame?.action === "add_event" ? `${a.title ?? ""} · ${a.start ?? ""}`
290
+ : frame?.action === "set_alarm" ? `${a.time ?? ""}${a.label ? ` · ${a.label}` : ""}`
291
+ : frame?.action === "set_timer" ? `${Math.round((a.seconds ?? 0) / 60)} min${a.label ? ` · ${a.label}` : ""}`
292
+ : frame?.action === "open_link" ? String(a.url ?? "")
293
+ : "";
294
+ const label = { add_reminder: "Add reminder", add_event: "Add event", set_alarm: "Set alarm", set_timer: "Set timer", open_link: "Open link" }[frame?.action] ?? "Phone action";
295
+ return { title: `${icon} ${label}`, body: `${what}?` };
296
+ }
297
+
298
+
299
+
300
+
301
+
302
+ export function attachPushAnswers({ connector, phonePush, room, approve, cancelPhoneAction, logger = {} }) {
303
+ if (typeof connector?.onAnswer !== "function") return () => {};
304
+ return connector.onAnswer((box) => {
305
+ const a = phonePush.openAnswer(box, room());
306
+ if (!a) return void logger.info?.("mobile-remote: [push] lock-screen answer dropped (not ours, old or replayed)");
307
+ const done = a.type === "approval" ? approve(a.id, a.decision === "approve" ? "allowed-once" : "rejected") : cancelPhoneAction(a.id);
308
+ logger.info?.(`mobile-remote: [push] lock-screen ${a.type} ${a.decision} → ${done ? "applied" : "no longer pending"}`);
309
+ });
310
+ }
package/lib/protocol.js CHANGED
@@ -49,6 +49,9 @@ export const FEATURES = Object.freeze([
49
49
 
50
50
 
51
51
  "toolbox-install",
52
+
53
+
54
+ "push",
52
55
  ]);
53
56
 
54
57
 
@@ -47,7 +47,8 @@ const fromHex = (h) => Uint8Array.from(h.match(/../g) ?? [], (x) => parseInt(x,
47
47
 
48
48
  export const AUTH_CONTEXT = "dsh-relay-host-v1";
49
49
 
50
- export const HOST_CAPS = Object.freeze(["signal"]);
50
+
51
+ export const HOST_CAPS = Object.freeze(["signal", "push"]);
51
52
 
52
53
  export class RelayConnector {
53
54
 
@@ -71,6 +72,13 @@ export class RelayConnector {
71
72
  this.unsubscribe = devices.onRevoke((id) => this.dropDevice(id));
72
73
 
73
74
  this.signalHandlers = new Set();
75
+
76
+ this.answerHandlers = new Set();
77
+ }
78
+
79
+ onAnswer(handler) {
80
+ this.answerHandlers.add(handler);
81
+ return () => this.answerHandlers.delete(handler);
74
82
  }
75
83
  static TIMING = Object.freeze({ handshakeMs: 15_000, pingMs: 20_000, pongMs: 10_000, firstFrameMs: 15_000, backoffMinMs: 1_000, backoffMaxMs: 30_000, maxSessionsPerLink: 16, kickAckMs: 2_000, maxDirect: 16, maxDirectPerIp: 4, directHelloMs: 3_000, directOpenMs: 5_000 });
76
84
 
@@ -280,6 +288,10 @@ class RelayLink {
280
288
  this.pendingKicks.delete(msg.c);
281
289
  if (this.closing !== null && this.pendingKicks.size === 0) this.#finishShutdown();
282
290
  return;
291
+ case "answer":
292
+
293
+ if (typeof msg.d === "string" && msg.d.length <= 1400) for (const h of this.o.answerHandlers) try { h(msg.d); } catch { }
294
+ return;
283
295
  case "pong":
284
296
  case "error":
285
297
  return;
@@ -15,7 +15,7 @@ import { NOT_HANDLED } from "./route-groups.js";
15
15
  export async function handleAppStateRoutes(deps, req, res, url, rest, method, miss) {
16
16
  const {
17
17
  agentSessionId, assistantPrefs, authEnabled, basePath, config, ctx, error, handleMemory, handlePersona,
18
- handleReminders, ipv4Addresses, lanNoiseUrls, lanPort, liveActivity, noteUserActivity, phoneActions, pluginVersion,
18
+ handleReminders, ipv4Addresses, lanNoiseUrls, lanPort, liveActivity, noteUserActivity, phoneActions, phonePush, pluginVersion,
19
19
  privateFirst, proactive, proactiveIdleMs, readJson, sessionTitleOf, shortSessionId,
20
20
  } = deps;
21
21
  if (rest === "/bootstrap") {
@@ -79,6 +79,7 @@ export async function handleAppStateRoutes(deps, req, res, url, rest, method, mi
79
79
 
80
80
  if (rest === "/phone-action-result" && await phoneActions.handle(req, res, method)) return;
81
81
  if (rest === "/live-activity/token" && await liveActivity.handle(req, res, method)) return;
82
+ if (rest === "/push/register" && await phonePush.handle(req, res, method)) return;
82
83
 
83
84
  if (rest === "/persona" || rest.startsWith("/persona/")) {
84
85
  if (await handlePersona(req, res, rest, method)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-mobile/mobile-remote",
3
- "version": "3.5.0-beta.1",
3
+ "version": "3.5.0-beta.2",
4
4
  "description": "DSH Mobile:把 DeepSeek Harness 变成随身控制台——手机远程发消息派活、看进度、收通知、审批决策、管理会话;配套 Flutter App(Android、iPhone / iPad)",
5
5
  "homepage": "https://dsh.claud.ing/",
6
6
  "repository": {