dsh-mobile-plugin 0.5.120 → 0.5.122

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 CHANGED
@@ -72,7 +72,7 @@
72
72
  <img src="https://raw.githubusercontent.com/WNLUO/dsh-mobile-plugin/main/assets/remote-computer.jpg" alt="在另一台电脑上通过本机地址打开 DeepSeek Harness 的完整网页" width="720">
73
73
  </p>
74
74
 
75
- 窗口优先由插件随包分发的桌面显示壳打开,Mac 上按官方桌面端的样式排版;每次访问一小时,可自动续期。细节和撤销方式见 [docs/remote-computer.md](docs/remote-computer.md)。
75
+ 窗口优先由插件随包分发的桌面显示壳打开,Mac 上按官方桌面端的样式排版;每次访问一小时,可自动续期。用桌面壳打开时快捷键和桌面端一致,按你本机保存,只作用于这台远程窗口,用普通浏览器打开还是网页版那套。细节和撤销方式见 [docs/remote-computer.md](docs/remote-computer.md)。
76
76
 
77
77
  ## 安全与隐私
78
78
 
@@ -1,3 +1,4 @@
1
+ // 本次改动:账号读取失败复用已稳定的 host-unavailable 码,中文文案仅作日志与老客户端兜底。
1
2
  'use strict';
2
3
 
3
4
  /** Read-only DeepSeek account projection for the mobile app. */
@@ -5,6 +6,9 @@
5
6
  const { sendJson } = require('../shared/http-util');
6
7
  const { unwrap } = require('./envelope.js');
7
8
 
9
+ /** 账号读取失败的稳定码:宿主自己的码只用于日志,不下发成另一种语言都读不懂的中文。 */
10
+ const ACCOUNT_UNAVAILABLE_CODE = 'host-unavailable';
11
+
8
12
  function readClientMetadata(req) {
9
13
  let query;
10
14
  try {
@@ -23,14 +27,14 @@ function readClientMetadata(req) {
23
27
  async function callAccount(ctx, method, payload = {}) {
24
28
  try {
25
29
  const call = ctx.apiProxy && ctx.apiProxy.account && ctx.apiProxy.account[method];
26
- if (typeof call !== 'function') return { error: { code: 'host-unavailable' } };
30
+ if (typeof call !== 'function') return { error: { code: ACCOUNT_UNAVAILABLE_CODE } };
27
31
  return unwrap(await call({
28
32
  rpcId: 'mobile',
29
33
  method: `account.${method}`,
30
34
  payload,
31
35
  }));
32
36
  } catch {
33
- return { error: { code: 'host-unavailable' } };
37
+ return { error: { code: ACCOUNT_UNAVAILABLE_CODE } };
34
38
  }
35
39
  }
36
40
 
@@ -86,7 +90,7 @@ async function handleDeepSeekAccount(ctx, req, res) {
86
90
  if (stateResult.error) {
87
91
  return sendJson(res, 502, {
88
92
  ok: false,
89
- error: { code: stateResult.error.code || 'host-unavailable', message: '这台宿主暂时无法读取 DeepSeek 账号信息' },
93
+ error: { code: ACCOUNT_UNAVAILABLE_CODE, message: '这台宿主暂时无法读取 DeepSeek 账号信息' },
90
94
  });
91
95
  }
92
96
 
@@ -1,3 +1,4 @@
1
+ // 本次改动:无凭据记录的错误沿用 no-device-record 码,中文文案仅作日志与老客户端兜底。
1
2
  'use strict';
2
3
 
3
4
  /**
@@ -1,3 +1,4 @@
1
+ // 本次改动:越界拒收补稳定子码,让两种越界原因各自可翻;中文文案仅作日志与老客户端兜底。
1
2
  // 按既有允许区读取文件,并将字节范围交给统一响应实现。
2
3
  'use strict';
3
4
 
@@ -109,7 +110,7 @@ async function resolveReadableFile(ctx, declared, sessionId) {
109
110
  return { ok: false, status: 404, code: 'missing', message: '文件已经不在这台电脑上了' };
110
111
  }
111
112
  if (!inAllowedZone(await realRootsOf(roots), realTarget)) {
112
- return { ok: false, status: 403, code: 'outside-allowed', message: '这个文件的物理位置不在能看的范围里(可能经过了符号链接)' };
113
+ return { ok: false, status: 403, code: 'outside-allowed-realpath', message: '这个文件的物理位置不在能看的范围里(可能经过了符号链接)' };
113
114
  }
114
115
 
115
116
  let info;
package/lib/mobile/git.js CHANGED
@@ -1,3 +1,4 @@
1
+ // 本次改动:给手机上会显示的中文错误补稳定机器码(JSON 请求体单独成码),中文只做日志兜底。
1
2
  'use strict';
2
3
 
3
4
  /**
@@ -30,6 +31,7 @@ const { runGit, withRepoLock } = require('../git/exec');
30
31
  /** 错误码 → HTTP 状态。前端只认 code,message 只用于排障与兜底文案。 */
31
32
  const STATUS_BY_CODE = {
32
33
  BAD_REQUEST: 400,
34
+ JSON_BODY_REQUIRED: 400,
33
35
  PATH_OUTSIDE: 400,
34
36
  EMPTY_MESSAGE: 400,
35
37
  NOTHING_STAGED: 400,
@@ -103,7 +105,7 @@ function query(req) {
103
105
 
104
106
  async function bodyJson(req) {
105
107
  const body = await readJsonBody(req, 64 * 1024);
106
- if (!body || typeof body !== 'object') throw fail('BAD_REQUEST', '需要 JSON 请求体');
108
+ if (!body || typeof body !== 'object') throw fail('JSON_BODY_REQUIRED', '需要 JSON 请求体');
107
109
  return body;
108
110
  }
109
111
 
@@ -1,3 +1,4 @@
1
+ // 本次改动:消息发送失败的兜底沿用稳定 prompt-failed 码,中文只留作日志与老客户端兜底。
1
2
  // 历史工具卡、过程清单和补丁共用工具结果状态。
2
3
  'use strict';
3
4
 
@@ -1404,6 +1405,10 @@ const MODEL_UNAVAILABLE_ERROR = {
1404
1405
  message: '当前没有可用的模型,请先在模型选择器中选择一个可用模型',
1405
1406
  };
1406
1407
 
1408
+ /** 发送失败的兜底码:文案只给日志与老客户端看,App 按码取译文。 */
1409
+ const PROMPT_FAILED_CODE = 'prompt-failed';
1410
+ const PROMPT_FAILED_MESSAGE = '消息发送失败';
1411
+
1407
1412
  /**
1408
1413
  * 宿主错误的 details 原样透传。移动端据此把 attachment-error 映射成中文提示,
1409
1414
  * 读的是与桌面端 attachmentErrorText 同一个 details.reason 契约
@@ -1430,8 +1435,8 @@ function promptErrorObject(error) {
1430
1435
  if (code || message) {
1431
1436
  const details = errorDetails(error);
1432
1437
  return {
1433
- ...(code ? { code } : { code: 'prompt-failed' }),
1434
- message: message || '消息发送失败',
1438
+ ...(code ? { code } : { code: PROMPT_FAILED_CODE }),
1439
+ message: message || PROMPT_FAILED_MESSAGE,
1435
1440
  ...(details ? { details } : {}),
1436
1441
  };
1437
1442
  }
@@ -1439,7 +1444,7 @@ function promptErrorObject(error) {
1439
1444
  const message = error instanceof Error ? error.message : String(error || '');
1440
1445
  const text = message.toLowerCase();
1441
1446
  if (/no (?:usable |available |selected |configured )?model|no provider|没有(?:可用的)?模型|模型[^\n]*(?:不可用|未配置|不存在|缺失)/i.test(text)) return { ...MODEL_UNAVAILABLE_ERROR };
1442
- return { code: 'prompt-failed', message: message || '消息发送失败' };
1447
+ return { code: PROMPT_FAILED_CODE, message: message || PROMPT_FAILED_MESSAGE };
1443
1448
  }
1444
1449
 
1445
1450
  /**
@@ -1,3 +1,4 @@
1
+ // 本次改动:越界拒收沿用 outside-workspace 码、缺工作区沿用 no-cwd,中文文案仅作日志与兜底。
1
2
  // 约束会话文件读取权限与有界字节段,声明历史扫描随客户端断开取消。
2
3
  'use strict';
3
4