@dsh-mobile/mobile-remote 3.2.6 → 3.2.7

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.
@@ -1,15 +1,30 @@
1
1
  # DSH Mobile store listing copy (ASO)
2
2
 
3
- > 2026-11-02。商店文案**只有英文,不含任何中文字符**(`test/store-listing.test.mjs` 会检查)。可以直接复制到 App Store Connect 和 Google Play Console 对应字段。每个字段标了字数上限和当前字数,测试会校验上限、当前字数和用词红线。
3
+ > 2026-11-17。商店文案**只有英文,不含任何中文字符**(`test/store-listing.test.mjs` 会检查)。可以直接复制到 App Store Connect 和 Google Play Console 对应字段。每个字段标了字数上限和当前字数,测试会校验上限、当前字数和用词红线。
4
4
  > 品牌关系声明用固定原句(见 `docs/STORE-LAUNCH.md` §1),放在每段完整描述的最后一行。
5
5
 
6
+ ## 本轮校正(2026-11-17,对应 3.2.6)
7
+
8
+ 线上旧文案有三处与现在的包不一致,属于 Apple 2.3 / Play 误导风险,已改:
9
+
10
+ 1. **`No account, no ads, no analytics or tracking SDKs.`** —— Gravity 上下文广告已于 2026-11-17 整体移除,所以「no ads / no analytics or tracking SDKs」现在成立;但 2025-11-16 起有可选账号(Google / Apple 登录,只用于公开网络订阅),不能写成「无账号」。现在写成「局域网不需要账号;不含广告、分析或跟踪 SDK」。
11
+ 2. **`Sessions, files and images go only between your phone and your computer, not through our servers.`** —— 3.2.6 起插件默认连接 `wss://dsh.claud.ing` 加密中继,公开网络模式下流量确实经过我们的中继。改成「局域网直连不经过服务器;公开网络经中继转发,端到端加密,中继读不到内容」。
12
+ 3. **`Your phone and computer must be on the same Wi-Fi.`** —— 现在只是局域网模式的前提;公开网络模式可以在别的网络连(需要订阅)。
13
+
14
+ 同时补进新版可见的能力:公开网络(加密中继,订阅)、多台电脑列表、对话页「轨迹」标签、Markdown 图片与发图、iPad 布局。
15
+
16
+ 新增 App Store 的 **What's New** 字段(更新说明);Google Play 的版本说明可以取同一段。
17
+
18
+ **发布前必须确认(不是文案能替代的):** 公开网络订阅商品必须在 App Store Connect / Play Console 已创建并通过审核,否则描述里的 relay 段落要删掉——写了却买不到,是 2.3 的问题。隐私政策里关于中继元数据的章节(见 `docs/STORE-LAUNCH.md` §3c 的待办)也要同步更新。
19
+
20
+ **构建开关:** 手机端的公开网络入口由 `Features.remoteAccess` 控制,源码默认关闭(`dsh-mobile-app/lib/features.dart`)。3.2.6 起发布脚本(`tools/ios-release.sh`、`scripts/build-ios.sh`、`scripts/build-android.ps1`、Android CI)统一带 `--dart-define=DSH_REMOTE_ACCESS=true`;只有用默认值手工构建时才会没有入口,那种包不能配这版文案。
21
+
6
22
  ## ASO 思路
7
23
 
8
- - **Apple 只索引 名称 + 副标题 + 关键词,不索引描述。** 名称里已有的词(DSH、Mobile、DeepSeek、Harness)不再放进关键词;副标题放最想被搜到的词(AI agent、approvals);关键词字段不留空格、用逗号隔开、只写单数,不写别人的商标(ChatGPT、Claude、Copilot 等)。描述影响的是转化,不是排名。
9
- - **Google Play 索引 标题 + 简短描述 + 完整描述。** 简短描述权重最高,放进 DeepSeek Harness、mobile companion、approve、alerts;完整描述里这些词自然重复几次,不堆砌。
10
- - **红线**(Apple 2.3 元数据必须准确,Play 禁止误导和关键词堆砌):不写 remote / anywhere(首发只支持同一个 Wi-Fi 的局域网)、不写价格和充值、不写 best / No.1 这类无法证实的话;开头先说明需要电脑上的 DeepSeek Harness,避免差评;结尾放品牌关系声明。
11
- - **Promotional Text(Apple)发布后随时可改,不用重新审核**,适合以后放活动或新功能;Description 要跟着新版本走。
12
- - 商店里只有英文版本:Apple 的 App Store Connect 里要把本地化设成 English (U.S.),网址用 `/en/` 版本。
24
+ - **Apple 只索引 名称 + 副标题 + 关键词,不索引描述。** 名称里已有的词(DSH、Mobile、DeepSeek、Harness)不再放进关键词;副标题换成开发者真正会搜的 `Coding agent`(原来只有泛词 `AI agent`),同时保留 `chat` / `approvals` 这两个差异点。关键词补 `remote` / `monitor` / `git`,删掉已经不再代表产品全貌的 `LAN`、`QR`。
25
+ - **Google Play 索引 标题 + 简短描述 + 完整描述。** 简短描述权重最高,放进 `remote`、`DeepSeek Harness`、`approve`、`alerts`;完整描述里这些词自然重复,不堆砌。
26
+ - **红线**(Apple 2.3 元数据必须准确,Play 禁止误导和关键词堆砌):价格与充值一律不写;不写 best / No.1 这类无法证实的话;不写别家商标(ChatGPT、Claude、Copilot 等);当前版本可以写「不含广告」(Gravity 广告已移除),但可选账号必须如实说明,不能写「无账号」;中继必须与「订阅」「端到端加密」成对出现,不能只说「任何网络都能连」。
27
+ - **Promotional Text(Apple)发布后随时可改,不用重新审核**,这轮放「换网络也能连」的新能力;Description 跟着版本走。
13
28
 
14
29
  ## Common
15
30
 
@@ -26,60 +41,78 @@
26
41
  ## Apple App Store (English (U.S.))
27
42
 
28
43
 
29
- #### Subtitle (≤ 30, now 25)
44
+ #### Subtitle (≤ 30, now 29)
30
45
 
31
- (在 App Information 里,不在 Product Page 这一页。)
46
+ (在 App Information 里,不在 Product Page 这一页。`Coding agent` 是这轮换进来的高意图词;`chat` / `approvals` 保留。)
32
47
 
33
48
  ```text
34
- AI agent chat & approvals
49
+ Coding agent chat & approvals
35
50
  ```
36
51
 
37
- #### Promotional Text (≤ 170, now 169)
52
+ #### Promotional Text (≤ 170, now 167)
38
53
 
39
54
  ```text
40
- Continue your DeepSeek Harness sessions on your phone. Approve or deny tool actions, follow task progress and get alerts. Scan a QR code to connect to your own computer.
55
+ Now connect from another network too: continue sessions through an encrypted relay (optional subscription) and approve tool actions live. Local Wi-Fi needs no account.
41
56
  ```
42
57
 
43
- #### Description (≤ 4000, now 2457)
58
+ #### Description (≤ 4000, now 3032)
44
59
 
45
60
  ```text
46
- Take your DeepSeek Harness sessions with you. DSH Mobile lets you continue conversations, follow task progress and approve what the AI agent wants to do, all from your iPhone, while the work keeps running on your own computer.
61
+ Take your DeepSeek Harness sessions with you. DSH Mobile is the phone companion for your AI coding agent: continue conversations, follow task progress and approve what the agent wants to do, while the work keeps running on your own computer.
47
62
 
48
63
  WHAT YOU CAN DO
49
- • Continue the conversation – pick up any session from your computer and watch replies stream in live.
64
+ • Continue the conversation – pick up any session from your computer and watch replies stream in live, with Markdown and images.
50
65
  • Approve or deny tool actions – when the agent wants to run a command or change files, you decide with one tap.
51
66
  • Answer the agent's questions – respond when it needs your input, so tasks never sit waiting.
52
- • Follow tasks at a glance – recent sessions and their running state, with active and archived sessions kept apart.
53
- • Get notified – alerts when a task finishes, the agent asks something or a run fails, plus a notification center to catch up.
54
- • Browse workspace files and send images – look through files in the workspace and send photos or screenshots to a session.
55
- • Scan to connect – scan the QR code on your computer, or type the address and access token yourself.
67
+ • Follow tasks at a glance – recent sessions and their running state, active and archived kept apart, plus a Trace tab that lays out every question, tool call and result in order.
68
+ • Get notified – alerts when a task finishes, the agent asks something or a run fails, with a notification center to catch up.
69
+ • Browse workspace files and send images – look through the workspace and send photos or screenshots to a session.
70
+ • Keep several computers – save each computer once and switch between them from one list.
56
71
  • Try the demo first – a built-in demo with sample data needs no computer and no account.
57
72
 
73
+ TWO WAYS TO CONNECT
74
+ • Same Wi-Fi – the app connects straight to your computer. Nothing goes through our servers, and no account or subscription is needed.
75
+ • Another network – switch to public network mode: traffic goes through an encrypted relay, your computer needs no public IP, and the phone can connect from another network. Content stays end-to-end encrypted, so the relay cannot read it. This mode is an optional subscription.
76
+
58
77
  HOW IT WORKS
59
- DSH Mobile is a companion, not a standalone AI. It connects to DeepSeek Harness running on your own computer over your local Wi-Fi, so your sessions, files and credentials travel between your phone and your computer, not through our servers.
78
+ DSH Mobile is a companion, not a standalone AI. It talks to DeepSeek Harness running on your own computer.
60
79
  1. Download, install and sign in to DeepSeek Harness on your computer.
61
80
  2. Open the third-party plugins page and add a plugin: More → Browse more plugins → Add plugin.
62
81
  3. Enter the plugin address: @dsh-mobile/mobile-remote
63
82
  4. Fully restart DeepSeek Harness.
64
83
  5. Click your user name at the bottom left to open Settings.
65
- 6. Open the “Connect mobile device” page and scan the QR code with the app. Your phone and computer must be on the same Wi-Fi.
84
+ 6. Open the “Connect mobile device” page and scan the QR code with the app.
66
85
 
67
86
  PRIVATE BY DESIGN
68
- • No account, no analytics or tracking SDKs. One contextual ad on the home screen; it never sees your sessions or files.
87
+ • Local Wi-Fi use needs no account. An optional account (Google or Apple) only carries the public-network subscription, and can be deleted inside the app.
88
+ • No ads, analytics or tracking SDKs.
69
89
  • The access token is kept in the iOS Keychain.
70
- • Sessions, files and images go only between your phone and your computer.
90
+ • Sessions, files and images travel between your phone and your computer. Through the relay they are end-to-end encrypted; the relay forwards them without reading them.
71
91
 
72
92
  REQUIREMENTS
73
- DeepSeek Harness for desktop with the DSH Mobile plugin, on a computer you control, and an iPhone on the same Wi-Fi. The app follows your device language: English or Simplified Chinese.
93
+ DeepSeek Harness for desktop with the DSH Mobile plugin, on a computer you control, and an iPhone or iPad. Local Wi-Fi needs no account; public network mode needs an account and a subscription. The app follows your device language: English or Simplified Chinese.
74
94
 
75
95
  Help: support@claud.ing · https://dsh.claud.ing/en/support/
76
96
  DSH Mobile is an independent mobile companion for DeepSeek Harness. It is not affiliated with or endorsed by DeepSeek.
77
97
  ```
78
98
 
79
- #### Keywords (≤ 100, now 100)
99
+ #### Keywords (≤ 100, now 97)
80
100
 
81
101
  ```text
82
- coding,developer,assistant,tasks,notifications,alerts,terminal,CLI,workspace,QR,LAN,LLM,session,code
102
+ terminal,CLI,developer,workspace,assistant,tasks,notifications,alerts,LLM,remote,monitor,git,code
103
+ ```
104
+
105
+ #### What's New (≤ 4000, now 669)
106
+
107
+ (版本号在 App Store Connect 里设;这段文字对应 3.2.6。Apple 的 What's New 不参与搜索,只影响更新转化。)
108
+
109
+ ```text
110
+ • Connect from another network: the new network mode switches between private Wi-Fi and the encrypted public relay (optional subscription).
111
+ • Keep several computers in one list; each has its own name, address and access token.
112
+ • New Trace tab in chat: every question, tool call and result in one timeline.
113
+ • Images in replies now render, and you can send photos or screenshots into a session.
114
+ • iPad layout, a model picker that keeps clear of the Dynamic Island, and image attachments that match the desktop client.
115
+ • Fixes: approval notifications no longer arrive twice, notifications follow your language, and relay connections no longer stall after a network change.
83
116
  ```
84
117
 
85
118
  #### URLs
@@ -99,44 +132,48 @@ coding,developer,assistant,tasks,notifications,alerts,terminal,CLI,workspace,QR,
99
132
  DSH Mobile - DeepSeek Harness
100
133
  ```
101
134
 
102
- #### Short description (≤ 80, now 78)
135
+ #### Short description (≤ 80, now 66)
103
136
 
104
137
  ```text
105
- Mobile companion for DeepSeek Harness: chat, approve actions, get task alerts.
138
+ Remote for DeepSeek Harness: chat, approve tool calls, get alerts.
106
139
  ```
107
140
 
108
- #### Full description (≤ 4000, now 2602)
141
+ #### Full description (≤ 4000, now 3117)
109
142
 
110
143
  ```text
111
- DSH Mobile is a mobile companion for DeepSeek Harness. Continue your AI agent conversations, follow task progress and approve tool actions from your Android phone, while the work keeps running on your own computer.
144
+ DSH Mobile is a remote companion for DeepSeek Harness, the AI coding agent running on your own computer. Continue conversations, follow task progress and approve tool actions from your Android phone — on the same Wi-Fi or from another network — while the work keeps running on your computer.
112
145
 
113
146
  WHAT YOU CAN DO
114
- • Continue the conversation – pick up any DeepSeek Harness session from your computer and watch replies stream in live.
147
+ • Continue the conversation – pick up any DeepSeek Harness session from your computer and watch replies stream in live, with Markdown and images.
115
148
  • Approve or deny tool actions – when the AI agent wants to run a command or change files, allow or deny it with one tap.
116
149
  • Answer the agent's questions – respond when it needs your input, so tasks never sit waiting.
117
- • Follow tasks at a glance – recent sessions and their running state, with active and archived sessions kept apart.
150
+ • Follow tasks at a glance – recent sessions and their running state, active and archived kept apart, plus a Trace tab that lays out every question, tool call and result in order.
118
151
  • Get task notifications – alerts when a task finishes, the agent asks something or a run fails, plus a notification center to catch up.
119
- • Browse workspace files and send images – look through files in the workspace and send photos or screenshots to a session.
120
- • Scan a QR code to connect – scan the code on your computer, or type the address and access token yourself.
152
+ • Browse workspace files and send images – look through the workspace and send photos or screenshots to a session.
153
+ • Keep several computers – save each computer once and switch between them from one list.
121
154
  • Try the demo first – a built-in demo with sample data needs no computer and no account.
122
155
  • Optional on Android – a desktop pet and background alerts, which you turn on yourself in Settings.
123
156
 
157
+ TWO WAYS TO CONNECT
158
+ • Same Wi-Fi – the app connects straight to your computer. Nothing goes through our servers, and no account or subscription is needed.
159
+ • Another network – switch to public network mode: traffic goes through an encrypted relay, your computer needs no public IP, and the phone can connect from another network. Content stays end-to-end encrypted, so the relay cannot read it. This mode is an optional subscription.
160
+
124
161
  HOW TO CONNECT
125
- DSH Mobile is a companion, not a standalone AI. It connects to DeepSeek Harness running on your own computer over your local Wi-Fi, so your sessions, files and credentials travel between your phone and your computer, not through our servers.
126
162
  1. Download, install and sign in to DeepSeek Harness on your computer.
127
163
  2. Open the third-party plugins page and add a plugin: More → Browse more plugins → Add plugin.
128
164
  3. Enter the plugin address: @dsh-mobile/mobile-remote
129
165
  4. Fully restart DeepSeek Harness.
130
166
  5. Click your user name at the bottom left to open Settings.
131
- 6. Open the “Connect mobile device” page and scan the QR code with the app. Your phone and computer must be on the same Wi-Fi.
167
+ 6. Open the “Connect mobile device” page and scan the QR code with the app.
132
168
 
133
169
  PRIVATE BY DESIGN
134
- • No account, no analytics or tracking SDKs. One contextual ad on the home screen; it never sees your sessions or files.
170
+ • Local Wi-Fi use needs no account. An optional account (Google or Apple) only carries the public-network subscription, and can be deleted inside the app.
171
+ • No ads, analytics or tracking SDKs.
135
172
  • The access token is kept in the Android Keystore.
136
- • Sessions, files and images go only between your phone and your computer.
173
+ • Sessions, files and images travel between your phone and your computer. Through the relay they are end-to-end encrypted; the relay forwards them without reading them.
137
174
 
138
175
  REQUIREMENTS
139
- DeepSeek Harness for desktop with the DSH Mobile plugin, on a computer you control, and an Android phone on the same Wi-Fi. The app follows your device language: English or Simplified Chinese.
176
+ DeepSeek Harness for desktop with the DSH Mobile plugin, on a computer you control, and an Android phone. Local Wi-Fi needs no account; public network mode needs an account and a subscription. The app follows your device language: English or Simplified Chinese.
140
177
 
141
178
  Help: support@claud.ing · https://dsh.claud.ing/en/support/
142
179
  DSH Mobile is an independent mobile companion for DeepSeek Harness. It is not affiliated with or endorsed by DeepSeek.
@@ -146,5 +183,8 @@ DSH Mobile is an independent mobile companion for DeepSeek Harness. It is not af
146
183
 
147
184
  - 描述里的六步和 App 里的连接引导、官网支持页一致;插件包名是 `@dsh-mobile/mobile-remote`(包名带 remote 是插件的真实名字,不是宣传用语)。
148
185
  - 第 6 步写的是 “Connect mobile device” 页面。电脑端插件里这个页面的名字目前是中文写死的(`lib/client.js` 的 `label: "连接移动端设备"`),英文用户在电脑上会看到中文名;要彻底英文化,插件里得加英文名。
149
- - Apple 版本号:App Store Connect 里现在是 `1.0`,工程版本是 `3.2.4`(build 32)。上传的构建的版本号要和这里一致。
150
- - 名称里的 DeepSeek 是别家的商标。名称加品牌关系声明属于说明兼容对象,但审核仍可能追问;关键词里我故意没放 deepseek,名称已经能被索引。
186
+ - Apple 版本号:App Store Connect 里的营销版本号按这次发布设(工程版本是 `3.2.5+33`,插件 `3.2.6`);What's New 要和实际构建对得上。
187
+ - **订阅商品**:`public network` 段落的准确性依赖 App Store / Play 的商品已创建并通过审核;任一商店买不到,就删掉对应描述里的 relay 段落(Apple 2.3 / Play 误导)。
188
+ - **隐私政策**:中继会短暂看到连接元数据(来源 IP、房间标识、字节数、时间),内容不可读。提交这版文案前,把 `docs/PRIVACY-POLICY*.md` 与 App 内置副本的对应章节补齐(`docs/STORE-LAUNCH.md` §3c 已列这条待办),否则「端到端加密」与隐私申报会不一致。
189
+ - App Privacy / Data safety 问卷按最终包的实际数据流填:当前包不含广告 SDK,无需申报广告数据;可选账号(Contact Info)、订阅(Purchases)与中继元数据按发布者对留存的实际判断申报。
190
+ - 名称里的 DeepSeek 是别家的商标。名称加品牌关系声明属于说明兼容对象,但审核仍可能追问;关键词里故意没放 deepseek,名称已经能被索引。
@@ -62,7 +62,7 @@ We may rate-limit, suspend or terminate relay access to protect the service, com
62
62
 
63
63
  ## 8. Privacy
64
64
 
65
- Direct local-network connections do not pass through our servers. After cloud sign-in we process account identifiers, subscription records and relay connection metadata; the relay forwards ciphertext only. The home screen shows one advertisement from a third-party ad network; the ad request does not contain your session content. The details are in the [Privacy Policy](/en/privacy/).
65
+ Direct local-network connections do not pass through our servers. After cloud sign-in we process account identifiers, subscription records and relay connection metadata; the relay forwards ciphertext only. The details are in the [Privacy Policy](/en/privacy/).
66
66
 
67
67
  ## 9. Intellectual property
68
68
 
@@ -62,7 +62,7 @@ DSH Mobile 是 DeepSeek Harness 的独立移动伴侣,与 DeepSeek 没有隶
62
62
 
63
63
  ## 8. 隐私
64
64
 
65
- 默认的局域网直连不经过我们的服务器。登录云端账号后,我们会处理账号标识、订阅记录和中继连接元数据;公开中继只转发密文。应用首页会展示一条由第三方广告网络提供的广告,广告请求不含你的会话内容。详情见[隐私政策](/privacy/)。
65
+ 默认的局域网直连不经过我们的服务器。登录云端账号后,我们会处理账号标识、订阅记录和中继连接元数据;公开中继只转发密文。详情见[隐私政策](/privacy/)。
66
66
 
67
67
  ## 9. 知识产权
68
68
 
@@ -11,6 +11,39 @@ import { normalizeCodexUsage, normalizeDeepSeekBalance, normalizeOpenCodeUsage }
11
11
  import { safeFailureReason } from "./api-helpers.js";
12
12
  import { readSettingsSection, readSettingsSectionStrict } from "./host-compat.js";
13
13
 
14
+ /** 插件自身版本:作为 DSH 账号请求的客户端版本头(读不到时退回 unknown)。 */
15
+ const pluginVersion = (() => {
16
+ try {
17
+ return createRequire(import.meta.url)("../package.json").version ?? "unknown";
18
+ } catch {
19
+ return "unknown";
20
+ }
21
+ })();
22
+
23
+ /** DSH 账号服务默认的客户端身份;手机端可覆盖语言与时区。 */
24
+ function accountClientMetadata(client = {}) {
25
+ return {
26
+ version: typeof client.version === "string" && client.version !== "" ? client.version : pluginVersion,
27
+ locale: typeof client.locale === "string" && client.locale !== "" ? client.locale : "zh-CN",
28
+ timezoneOffsetSeconds: Number.isFinite(client.timezoneOffsetSeconds)
29
+ ? client.timezoneOffsetSeconds
30
+ : -new Date().getTimezoneOffset() * 60,
31
+ };
32
+ }
33
+
34
+ /** DSH 内置的 DeepSeek 账号服务;旧版宿主没有该能力时返回 undefined。 */
35
+ function deepSeekAccountService(ctx) {
36
+ try {
37
+ const service = ctx?.get?.("deepseekAccount");
38
+ return service && typeof service.getBalance === "function" ? service : undefined;
39
+ } catch {
40
+ return undefined;
41
+ }
42
+ }
43
+
44
+ /** 充值入口:账号服务给了部署地址就用它,否则用官方平台地址。 */
45
+ const DEFAULT_DEEPSEEK_TOP_UP = "https://platform.deepseek.com/top_up";
46
+
14
47
  /** 与 PC 端设置页一致的凭据引用派生规则(v2.6):路由 id 大写 → `<ID>_API_KEY`。 */
15
48
  export function deriveKeyRef(provider) {
16
49
  return `${String(provider).toUpperCase().replace(/[^A-Z0-9]+/g, "_")}_API_KEY`;
@@ -74,9 +107,88 @@ async function loadCodexConnect() {
74
107
  throw bareError;
75
108
  }
76
109
 
77
- async function queryDeepSeekUsage(ctx) {
110
+ /**
111
+ * 读取 DSH 登录的 DeepSeek 账号余额。
112
+ *
113
+ * 很多人是在 DSH 里用 DeepSeek 账号登录(`deepseekAccount` 服务持有登录凭证),
114
+ * 而不是在「设置 → 模型」里填 API Key;只查 DEEPSEEK_API_KEY 会让他们整块余额消失。
115
+ * 返回值区分三态:`ready` / `signed-out` / `failed`,`unavailable` 表示宿主没有账号能力。
116
+ */
117
+ export async function queryDeepSeekAccountBalance(ctx, client = {}) {
118
+ const service = deepSeekAccountService(ctx);
119
+ if (!service) return { status: "unavailable" };
120
+ const metadata = accountClientMetadata(client);
121
+ let links;
122
+ try {
123
+ const state = await service.getState?.();
124
+ links = state?.links;
125
+ // getState 不可用时仍尝试 getBalance:它自己会在未登录时返回 null。
126
+ if (state && state.status !== "credential-stored") return { status: "signed-out", links };
127
+ } catch {
128
+ // 账号状态读失败不等于未登录:继续走余额查询,由它给出真实结果。
129
+ }
130
+ let balance;
131
+ try {
132
+ balance = await service.getBalance(metadata);
133
+ } catch (err) {
134
+ return { status: "failed", failedReason: safeFailureReason(err), links };
135
+ }
136
+ if (balance === null) return { status: "signed-out", links };
137
+ if (balance?.status !== "ready") return { status: "failed", failedReason: "账号余额查询失败", links };
138
+ let profile;
139
+ try {
140
+ const result = await service.getProfile?.(metadata);
141
+ if (result?.status === "ready") profile = result.value;
142
+ } catch {
143
+ // 账号标签是可选的展示信息,读失败不影响余额。
144
+ }
145
+ return {
146
+ status: "ready",
147
+ wallets: Array.isArray(balance.value) ? balance.value : [],
148
+ bonusWallets: Array.isArray(balance.bonusWallets) ? balance.bonusWallets : [],
149
+ profile,
150
+ links,
151
+ };
152
+ }
153
+
154
+ /** CNY 优先;没有 CNY 时用第一个钱包(与 API Key 余额的取值规则一致)。 */
155
+ function preferredWallet(wallets) {
156
+ return wallets.find((wallet) => wallet?.currency === "CNY") ?? wallets[0];
157
+ }
158
+
159
+ async function queryDeepSeekUsage(ctx, client = {}) {
160
+ const account = await queryDeepSeekAccountBalance(ctx, client);
161
+ const topUpUrl = account.links?.topUpUrl ?? DEFAULT_DEEPSEEK_TOP_UP;
162
+ if (account.status === "ready") {
163
+ const wallet = preferredWallet(account.wallets);
164
+ const bonus = preferredWallet(account.bonusWallets);
165
+ return {
166
+ configured: true,
167
+ source: {
168
+ id: "deepseek",
169
+ title: "DeepSeek",
170
+ kind: "balance",
171
+ ...(wallet ? { amount: wallet.balance, currency: wallet.currency } : {}),
172
+ ...(bonus ? { bonus: { amount: bonus.balance, currency: bonus.currency } } : {}),
173
+ available: true,
174
+ topUpUrl,
175
+ ...(account.profile && (account.profile.name || account.profile.contact) ? {
176
+ account: {
177
+ ...(typeof account.profile.name === "string" && account.profile.name !== "" ? { displayName: account.profile.name } : {}),
178
+ ...(typeof account.profile.contact === "string" && account.profile.contact !== "" ? { maskedEmail: account.profile.contact } : {}),
179
+ },
180
+ } : {}),
181
+ },
182
+ };
183
+ }
78
184
  const key = await resolveCredentialValue(ctx, "DEEPSEEK_API_KEY");
79
- if (!key) return { configured: false };
185
+ if (!key) {
186
+ // 账号已登录但余额查询失败:把失败原因报上去,而不是退回"未配置"。
187
+ if (account.status === "failed") {
188
+ return { configured: true, failed: true, failedId: "deepseek", failedReason: account.failedReason };
189
+ }
190
+ return { configured: false };
191
+ }
80
192
  try {
81
193
  const response = await fetch("https://api.deepseek.com/user/balance", {
82
194
  headers: { authorization: `Bearer ${key}`, "content-type": "application/json" },
@@ -95,6 +207,7 @@ async function queryDeepSeekUsage(ctx) {
95
207
  title: "DeepSeek",
96
208
  kind: "balance",
97
209
  ...balance,
210
+ topUpUrl,
98
211
  },
99
212
  };
100
213
  } catch (err) {
@@ -251,9 +364,9 @@ async function queryOpenCodeUsage(ctx) {
251
364
  }
252
365
  }
253
366
 
254
- export async function queryAccountUsage(ctx) {
367
+ export async function queryAccountUsage(ctx, client = {}) {
255
368
  const results = await Promise.all([
256
- queryDeepSeekUsage(ctx),
369
+ queryDeepSeekUsage(ctx, client),
257
370
  queryCodexUsage(ctx),
258
371
  queryOpenCodeUsage(ctx),
259
372
  ]);
package/lib/client.js CHANGED
@@ -391,7 +391,7 @@ window.__ModuleLoader__.load({
391
391
  pairing && countdown
392
392
  ? [
393
393
  jsxRuntime.jsx("img", { src: pairing.qr, alt: "配对二维码", style: { width: 216, height: 216, borderRadius: "12px", background: "#fff", padding: 8 } }, "img"),
394
- jsxRuntime.jsx("div", { style: mutedStyle, children: "手机 App → 添加电脑 → 扫码配对。一次性," + countdown + " 后失效。" }, "t"),
394
+ jsxRuntime.jsx("div", { style: mutedStyle, children: "手机 App → 连接页「粘贴配对链接」粘贴,或直接扫这个码。一次性," + countdown + " 后失效。" }, "t"),
395
395
  jsxRuntime.jsx("div", { style: { display: "flex", gap: "8px" }, children: [
396
396
  jsxRuntime.jsx("button", { style: btnStyle, onClick: function () { copyText(pairing.uri); }, children: "复制配对链接" }, "cp"),
397
397
  jsxRuntime.jsx("button", { style: btnStyle, onClick: function () { setPairing(null); }, children: "关闭" }, "x"),
package/lib/index.js CHANGED
@@ -36,7 +36,7 @@ import { b64u as relayB64u } from "./relay/crypto.js";
36
36
 
37
37
  export { Config, DEFAULT_ENUMERATION_BUDGET_MS, DEFAULT_WARM_UP_TITLE_BUDGET_MS } from "./config.js";
38
38
  import { DEFAULT_ENUMERATION_BUDGET_MS, DEFAULT_WARM_UP_TITLE_BUDGET_MS } from "./config.js";
39
- import { deriveKeyRef, queryAccountUsage } from "./account-usage-query.js";
39
+ import { deriveKeyRef, queryAccountUsage, queryDeepSeekAccountBalance } from "./account-usage-query.js";
40
40
  import { FILE_RANGE_CAPABILITIES, clampText, ifNoneMatch, parseByteRange, fileMimeOf, mapBounded, normalizeServerPath, orderQrAddresses, pruneReceiptMap, receiptExpired, redactPathText, requestAbort, requestHeaderText, validateQuestionAnswers } from "./api-helpers.js";
41
41
  import { capabilityState, hostPeerSource, jobsCallerFor, jobsNeedsSessionId, readSettingsSection, readSettingsSectionStrict, wireStreamTakesControl } from "./host-compat.js";
42
42
  import { pushToChannel as deliverPush } from "./push.js";
@@ -3829,7 +3829,12 @@ export function apply(ctx, configInput) {
3829
3829
  }
3830
3830
  if (!accountUsageInFlight) {
3831
3831
  if (forceRefresh) accountUsageLastForcedAt = now;
3832
- accountUsageInFlight = queryAccountUsage(ctx).then((body) => {
3832
+ // 手机的语言/时区只影响 DeepSeek 账号请求的身份头,不影响余额口径。
3833
+ const timezoneOffsetSeconds = Number(url.searchParams.get("tz"));
3834
+ accountUsageInFlight = queryAccountUsage(ctx, {
3835
+ locale: url.searchParams.get("lang") ?? undefined,
3836
+ timezoneOffsetSeconds: Number.isFinite(timezoneOffsetSeconds) ? timezoneOffsetSeconds : undefined,
3837
+ }).then((body) => {
3833
3838
  if (body.failedCount === 0) accountUsageCache = { at: Date.now(), body };
3834
3839
  else accountUsageCache = null;
3835
3840
  return body;
@@ -3846,7 +3851,7 @@ export function apply(ctx, configInput) {
3846
3851
  return;
3847
3852
  }
3848
3853
 
3849
- // ── 余额查询(DeepSeek 官方 /user/balance,key 不经过移动端) ──
3854
+ // ── 余额查询(DSH 登录的 DeepSeek 账号优先,其次官方 /user/balance;凭据不经过移动端) ──
3850
3855
  if (rest === "/balance") {
3851
3856
  if (requireGet(method, res)) return;
3852
3857
  const now = Date.now();
@@ -3855,6 +3860,32 @@ export function apply(ctx, configInput) {
3855
3860
  sendJson(res, 200, balanceCache.body);
3856
3861
  return;
3857
3862
  }
3863
+ // 用 DeepSeek 账号登录的用户没有 API Key:先问宿主账号服务要余额。
3864
+ const account = await queryDeepSeekAccountBalance(ctx);
3865
+ if (account.status === "ready" && account.wallets.length > 0) {
3866
+ balanceCache = {
3867
+ at: now,
3868
+ body: {
3869
+ ok: true,
3870
+ balance: {
3871
+ is_available: true,
3872
+ balance_infos: account.wallets.map((wallet) => ({
3873
+ currency: wallet.currency,
3874
+ total_balance: wallet.balance,
3875
+ })),
3876
+ },
3877
+ ...(account.bonusWallets.length > 0 ? {
3878
+ bonus_infos: account.bonusWallets.map((wallet) => ({
3879
+ currency: wallet.currency,
3880
+ total_balance: wallet.balance,
3881
+ })),
3882
+ } : {}),
3883
+ topUpUrl: account.links?.topUpUrl ?? "https://platform.deepseek.com/top_up",
3884
+ },
3885
+ };
3886
+ sendJson(res, 200, balanceCache.body);
3887
+ return;
3888
+ }
3858
3889
  let key;
3859
3890
  try {
3860
3891
  const credentials = ctx.get("credentials");
@@ -3866,7 +3897,10 @@ export function apply(ctx, configInput) {
3866
3897
  // 回退到环境变量
3867
3898
  }
3868
3899
  if (!key) key = process.env.DEEPSEEK_API_KEY;
3869
- if (!key) return error(res, 400, "no-api-key", "未配置 DEEPSEEK_API_KEY(电脑端 设置 → 模型 里填写)");
3900
+ if (!key) {
3901
+ if (account.status === "failed") return error(res, 502, "balance-failed", account.failedReason ?? "账号余额查询失败");
3902
+ return error(res, 400, "no-api-key", "未登录 DeepSeek 账号,也没有配置 DEEPSEEK_API_KEY(电脑端 设置 → 模型 里填写,或登录账号)");
3903
+ }
3870
3904
  try {
3871
3905
  const response = await fetch("https://api.deepseek.com/user/balance", {
3872
3906
  headers: { authorization: `Bearer ${key}`, "content-type": "application/json" },
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@dsh-mobile/mobile-remote",
3
- "version": "3.2.6",
3
+ "version": "3.2.7",
4
4
  "description": "DSH Mobile:把 DeepSeek Harness 变成随身控制台——手机远程发消息派活、看进度、收通知、审批决策、管理会话;配套 Flutter App(Android 已发布;iOS 工程已编译通过,尚未真机验证)",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "test": "node --test test/*.js test/*.mjs",
8
- "check": "node --check lib/index.js && node --check lib/client.js"
8
+ "check": "node --check lib/index.js && node --check lib/client.js",
9
+ "verify:deploy": "node tools/verify-deployment.mjs"
9
10
  },
10
11
  "main": "lib/index.js",
11
12
  "exports": {