dsh-mobile-plugin 0.5.122 → 0.5.123

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/lib/impl.js CHANGED
@@ -1,3 +1,4 @@
1
+ // 2026-11-26:零讯旧隧道落点端口失效时接线层清掉地址,通知 Cloudflare 兜底重新判定顶上。
1
2
  // 2026-11-25:三条线路的本地端口接上回环入口判据;自检结论记入 ingress-guard,状态带出绕开与兜底原因。
2
3
  // 热重载跨代:隧道助手/点对点的父地址取值器改为挂载时缓存,回滚或半装载后不再现读失效 ctx.webServer。
3
4
  // 本次改动:网页版预览的宿主绑定地址随 ctx.webServer.host 传入,老宿主缺省时维持环回行为。
@@ -471,7 +472,7 @@ function apply(ctx) {
471
472
  mount('镜像推送', () => ctx.effect(() => mirror.start(), `${name}: mobile mirror sync`))
472
473
 
473
474
  // ZeroNews 线路:二进制获取、浏览器登录、建隧道与写回都在 wiring/runner/provision,装配层只挂一下。
474
- const zeroNews = mountZeroNews({ mount, settings, getState: () => state, control, warn, ctx, name, portOf: () => tunnelPortFor('zeronews') })
475
+ const zeroNews = mountZeroNews({ mount, settings, getState: () => state, control, warn, ctx, name, portOf: () => tunnelPortFor('zeronews'), onRouteStale: () => cloudflare?.reconcile?.() })
475
476
  // ZeroNews 状态 / 连接 / 断开给面板(见 lib/zeronews/wiring.cjs)。
476
477
 
477
478
  ctx.effect(() => {
@@ -28,6 +28,8 @@ const LOCAL_PORTS = Object.fromEntries(
28
28
  /** /detect/version 是轻量探针,超时短;/bind 要等它去云端换短链,实测 5~16 秒。 */
29
29
  const PROBE_TIMEOUT_MS = 3000;
30
30
  const BIND_TIMEOUT_MS = 30_000;
31
+ /** status 每 3 秒被轮询,判绑定时顺带问 /bind 只用探测级短超时:等不到就按没绑定算,不把用户卡在「已绑定」上。 */
32
+ const BIND_STATUS_TIMEOUT_MS = PROBE_TIMEOUT_MS;
31
33
 
32
34
  function endpointsFor(platform) {
33
35
  const key = String(platform || process.platform);
@@ -85,7 +87,7 @@ async function probePort(port, options = {}) {
85
87
  * @returns {Promise<{ supported: boolean, installed: boolean, bound: boolean, peerid: string,
86
88
  * tun: string, host: string, port: number, service: {installed:boolean}, error: string }>}
87
89
  * `supported=false` 是这一版没接的平台(Windows 只接 x64,Linux 接 x64/arm64);
88
- * `installed=false` 表示本机找不到设备端;`bound=false` 表示装了但还没登录绑定。
90
+ * `installed=false` 表示本机找不到设备端;`bound` 由 /bind 是否仍给链接判定(给链接=没绑)。
89
91
  */
90
92
  async function readStatus(options = {}) {
91
93
  const platform = String(options.platform || process.platform);
@@ -102,10 +104,14 @@ async function readStatus(options = {}) {
102
104
  for (const { host, port } of endpoints) {
103
105
  const result = await probePort(port, { ...options, host });
104
106
  if (result.ok) {
107
+ const bind = await readBindUrl({ ...options, host, port, timeoutMs: BIND_STATUS_TIMEOUT_MS });
108
+ // 是否绑定只看 /bind:仍给链接=没绑;设备端答话却不给链接=已绑;超时或连不上按没绑算,
109
+ // 让面板继续给绑定链接,别把用户卡死在误判的「已绑定」上。
110
+ const bound = bind.ok === false && bind.answered === true;
105
111
  return {
106
112
  supported: true,
107
113
  installed: true,
108
- bound: result.peerid !== '',
114
+ bound,
109
115
  peerid: result.peerid,
110
116
  tun: result.tun,
111
117
  host,
@@ -124,21 +130,23 @@ async function readStatus(options = {}) {
124
130
 
125
131
  /**
126
132
  * 取设备端的绑定链接。设备端回 302 指向它的云端绑定页,把那一段 Location 原样交给面板。
127
- * 已经绑过的设备不会再给链接(它回 404 或直接给已绑页面),这里按 `ok:false` 如实说明。
133
+ * 已经绑过的设备不会再给链接(它回 404 或直接给已绑页面),这里按 `ok:false` 如实说明;
134
+ * 返回的 `answered` 区分「设备端答话但不给链接」(已绑)与「超时/连不上」(无从判断)。
128
135
  * 只给了端口没给主机时,按平台的候选主机逐个问(Windows 要先问它的虚拟回环)。
129
136
  */
130
137
  async function readBindUrl(options = {}) {
131
138
  const doFetch = typeof options.fetchImpl === 'function'
132
139
  ? options.fetchImpl
133
140
  : (typeof globalThis.fetch === 'function' ? globalThis.fetch : null);
134
- if (!doFetch) return { ok: false, url: '', error: '当前环境没有可用的 fetch' };
141
+ if (!doFetch) return { ok: false, url: '', answered: false, error: '当前环境没有可用的 fetch' };
135
142
  const platform = String(options.platform || process.platform);
136
143
  const port = Number(options.port) > 0 ? Number(options.port) : 0;
137
144
  const hosts = typeof options.host === 'string' && options.host ? [options.host] : hostsFor(platform);
138
145
  const endpoints = port ? hosts.map((host) => ({ host, port })) : endpointsFor(platform);
139
- if (!endpoints.length) return { ok: false, url: '', error: '这一版没接这个平台' };
146
+ if (!endpoints.length) return { ok: false, url: '', answered: false, error: '这一版没接这个平台' };
140
147
  const timeoutMs = Number(options.timeoutMs) > 0 ? Number(options.timeoutMs) : BIND_TIMEOUT_MS;
141
148
  let lastError = '';
149
+ let answered = false;
142
150
  for (const { host, port: candidatePort } of endpoints) {
143
151
  const controller = typeof AbortController === 'function' ? new AbortController() : null;
144
152
  const timer = controller ? setTimeout(() => controller.abort(), timeoutMs) : null;
@@ -149,10 +157,11 @@ async function readBindUrl(options = {}) {
149
157
  headers: { accept: 'text/html' },
150
158
  ...(controller ? { signal: controller.signal } : {}),
151
159
  });
160
+ answered = true;
152
161
  const location = response && response.headers && typeof response.headers.get === 'function'
153
162
  ? response.headers.get('location') : '';
154
163
  if (typeof location === 'string' && /^https?:\/\//i.test(location.trim())) {
155
- return { ok: true, url: location.trim(), error: '' };
164
+ return { ok: true, url: location.trim(), answered: true, error: '' };
156
165
  }
157
166
  lastError = '设备端没有给出绑定链接(可能已经绑定过)';
158
167
  } catch (error) {
@@ -165,7 +174,7 @@ async function readBindUrl(options = {}) {
165
174
  if (timer) clearTimeout(timer);
166
175
  }
167
176
  }
168
- return { ok: false, url: '', error: lastError };
177
+ return { ok: false, url: '', answered, error: lastError };
169
178
  }
170
179
 
171
180
  /**
@@ -0,0 +1,355 @@
1
+ // 2026-11-26:设备画像核心模块,采集宿主会话/工作区信号、归纳用途、开关与变化检测(插件侧每实例一份)。
2
+ 'use strict';
3
+
4
+ /**
5
+ * 设备画像的源头在电脑插件:一台电脑一份画像,手机只读同步过去的副本。
6
+ *
7
+ * 这个模块只做四件事:把宿主已有的会话/工作区清单折成少量信号(不碰模型),把信号交给
8
+ * 电脑上那把 Key 归纳成一句话,管两个开关,以及在信号真变了时才更新画像。所有磁盘读写
9
+ * 都吞掉失败——画像只是锦上添花的上下文,不该让路由或事件因为它挂掉。
10
+ */
11
+
12
+ const fs = require('node:fs');
13
+ const os = require('node:os');
14
+ const path = require('node:path');
15
+
16
+ const { dshHome } = require('../shared/paths.js');
17
+ const { stableRevision } = require('../shared/list-revision.js');
18
+ const { unwrap } = require('./envelope.js');
19
+ const { callSessions } = require('./rpc.js');
20
+ const { listTitle } = require('./history-derive.js');
21
+ const { customChannelWithKey, PI_AI_NS } = require('./channels.js');
22
+ const { chatCompletionUrlOf } = require('./channel-proxy.js');
23
+ const { deviceProfileRefreshStateOf } = require('./session-cache.js');
24
+
25
+ /** 画像与开关都落在 dshHome 下,固定文件名;与移动端其它插件状态互不干扰。 */
26
+ const PROFILE_FILE = 'mobile-device-profile.json';
27
+ const SWITCHES_FILE = 'mobile-learning-switches.json';
28
+
29
+ /** 工作区与最近会话各留几条:够模型认出这台电脑在干什么,不把整份清单塞进提示词。 */
30
+ const MAX_TITLES = 8;
31
+ /** 事件帧来得很密:最短间隔内只算一次,在途的那一次多方共用。 */
32
+ const REFRESH_MIN_INTERVAL_MS = 60 * 1000;
33
+ /** 归纳请求的上限;归纳卡住不该一直占着请求。 */
34
+ const UPSTREAM_TIMEOUT_MS = 30 * 1000;
35
+ /** 一句话用途的长度兜底。 */
36
+ const NOTE_MAX_CHARS = 400;
37
+
38
+ /** system 提示只许一到两句中文,不解释、不列表——这段文案直接决定画像有没有噪声。 */
39
+ const SYSTEM_PROMPT = '只输出一到两句中文,概括这台电脑的主要用途。不要解释,不要列表,不要引号。';
40
+
41
+ function profileFile() {
42
+ return path.join(dshHome(), PROFILE_FILE);
43
+ }
44
+
45
+ function switchesFile() {
46
+ return path.join(dshHome(), SWITCHES_FILE);
47
+ }
48
+
49
+ function emptyProfile() {
50
+ return { workspaces: [], recentTitles: [], updatedAt: 0, revision: '' };
51
+ }
52
+
53
+ function defaultSwitches() {
54
+ return { passiveEnabled: true, modelEnabled: false };
55
+ }
56
+
57
+ /** 去掉 revision 之后的本体算指纹;键序排一遍,落盘再读回来不会因插入顺序不同而误判成变化。 */
58
+ function makeRevision(profile) {
59
+ if (!profile || typeof profile !== 'object' || Array.isArray(profile)) return '';
60
+ const body = { ...profile };
61
+ delete body.revision;
62
+ const canonical = {};
63
+ for (const key of Object.keys(body).sort()) canonical[key] = body[key];
64
+ return stableRevision(canonical);
65
+ }
66
+
67
+ /**
68
+ * 读画像:文件不在、读不动、坏了都当没有(null),不把异常交给调用方。
69
+ * 数组字段逐项筛一遍,坏条目不该让整份画像在后面拼接时炸掉。
70
+ */
71
+ function load() {
72
+ try {
73
+ const raw = JSON.parse(fs.readFileSync(profileFile(), 'utf8'));
74
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return null;
75
+ if (!Array.isArray(raw.workspaces) || !Array.isArray(raw.recentTitles)) return null;
76
+ return {
77
+ ...(typeof raw.name === 'string' ? { name: raw.name } : {}),
78
+ ...(typeof raw.platform === 'string' ? { platform: raw.platform } : {}),
79
+ workspaces: raw.workspaces.filter((title) => typeof title === 'string'),
80
+ recentTitles: raw.recentTitles.filter((title) => typeof title === 'string'),
81
+ ...(typeof raw.note === 'string' ? { note: raw.note } : {}),
82
+ updatedAt: Number.isFinite(raw.updatedAt) ? raw.updatedAt : 0,
83
+ revision: typeof raw.revision === 'string' ? raw.revision : '',
84
+ };
85
+ } catch {
86
+ return null;
87
+ }
88
+ }
89
+
90
+ /** 原子写:同目录临时文件 + rename,写一半断电也不会留下半份 JSON。写不进去就吞掉。 */
91
+ async function save(profile) {
92
+ if (!profile || typeof profile !== 'object' || Array.isArray(profile)) return;
93
+ try {
94
+ const file = profileFile();
95
+ fs.mkdirSync(path.dirname(file), { recursive: true });
96
+ const tmp = `${file}.${process.pid}.tmp`;
97
+ fs.writeFileSync(tmp, `${JSON.stringify(profile)}\n`, { mode: 0o600 });
98
+ fs.renameSync(tmp, file);
99
+ } catch {
100
+ /* 画像写不进去不影响这次请求 */
101
+ }
102
+ }
103
+
104
+ /**
105
+ * 采集宿主信号,一步一 try:哪扇门不可用就少那一项,其余照常返回。
106
+ * 只用宿主已有的 sessions.list / workspace.list,不查模型、不发额度请求。
107
+ */
108
+ async function collect(ctx) {
109
+ const out = {};
110
+
111
+ try {
112
+ const name = typeof os.hostname === 'function' ? os.hostname() : '';
113
+ if (typeof name === 'string' && name.trim()) out.name = name.trim();
114
+ } catch { /* 设备名拿不到就少这一项 */ }
115
+
116
+ try {
117
+ if (typeof process.platform === 'string' && process.platform) out.platform = process.platform;
118
+ } catch { /* 系统标识拿不到就少这一项 */ }
119
+
120
+ try {
121
+ const { value, error } = unwrap(await ctx.apiProxy.workspace.list({
122
+ rpcId: 'mobile', method: 'workspace.list', payload: {},
123
+ }));
124
+ if (!error) {
125
+ const items = Array.isArray(value) ? value : (value && Array.isArray(value.items) ? value.items : []);
126
+ out.workspaces = items
127
+ .map((item) => (item && typeof item.title === 'string' ? item.title.trim() : ''))
128
+ .filter(Boolean)
129
+ .slice(0, MAX_TITLES);
130
+ }
131
+ } catch { /* 工作区清单失败只少这一项 */ }
132
+
133
+ try {
134
+ const { value, error } = unwrap(await callSessions(ctx, 'list', {}));
135
+ if (!error) {
136
+ const items = Array.isArray(value) ? value : (value && Array.isArray(value.items) ? value.items : []);
137
+ out.recentTitles = items
138
+ .map((item) => listTitle(item))
139
+ .filter((title) => typeof title === 'string' && title.trim())
140
+ .slice(0, MAX_TITLES)
141
+ .map((title) => title.trim());
142
+ }
143
+ } catch { /* 会话清单失败只少这一项 */ }
144
+
145
+ return out;
146
+ }
147
+
148
+ /**
149
+ * 读开关。被动采集默认开、花额度的归纳默认关;读坏一律回默认值,不抛。
150
+ */
151
+ function getSwitches() {
152
+ const defaults = defaultSwitches();
153
+ try {
154
+ const raw = JSON.parse(fs.readFileSync(switchesFile(), 'utf8'));
155
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return defaults;
156
+ return {
157
+ passiveEnabled: typeof raw.passiveEnabled === 'boolean' ? raw.passiveEnabled : defaults.passiveEnabled,
158
+ modelEnabled: typeof raw.modelEnabled === 'boolean' ? raw.modelEnabled : defaults.modelEnabled,
159
+ };
160
+ } catch {
161
+ return defaults;
162
+ }
163
+ }
164
+
165
+ /** 写开关:只认两个布尔,其余键不落盘;读坏或写不动都不抛给调用方。 */
166
+ function setSwitches(next) {
167
+ const current = getSwitches();
168
+ const merged = {
169
+ passiveEnabled: next && typeof next.passiveEnabled === 'boolean' ? next.passiveEnabled : current.passiveEnabled,
170
+ modelEnabled: next && typeof next.modelEnabled === 'boolean' ? next.modelEnabled : current.modelEnabled,
171
+ };
172
+ try {
173
+ const file = switchesFile();
174
+ fs.mkdirSync(path.dirname(file), { recursive: true });
175
+ const tmp = `${file}.${process.pid}.tmp`;
176
+ fs.writeFileSync(tmp, `${JSON.stringify(merged, null, 2)}\n`, { mode: 0o600 });
177
+ fs.renameSync(tmp, file);
178
+ } catch {
179
+ /* 开关写不进去不抛;下一次读仍是磁盘上的真值 */
180
+ }
181
+ return merged;
182
+ }
183
+
184
+ /**
185
+ * 电脑上第一条可用的自建渠道。只认 llm-pi-ai 的 providers —— customChannelWithKey 也只认
186
+ * 这一处,挑别的 id 只会换来 channel-not-found。这里有地址就算可用,模型由调用方指定或
187
+ * 取这条渠道的第一个。
188
+ */
189
+ async function firstCustomChannelId(ctx) {
190
+ const described = unwrap(await ctx.apiProxy.settings.describe({
191
+ rpcId: 'mobile', method: 'settings.describe', payload: {},
192
+ }));
193
+ if (described.error) return '';
194
+ const namespaces = Array.isArray(described.value && described.value.namespaces) ? described.value.namespaces : [];
195
+ const piAi = namespaces.find((entry) => entry && entry.ns === PI_AI_NS);
196
+ const value = piAi && piAi.value;
197
+ const providers = value && typeof value === 'object' && value.providers
198
+ && typeof value.providers === 'object' && !Array.isArray(value.providers) ? value.providers : {};
199
+ for (const id of Object.keys(providers)) {
200
+ const row = providers[id];
201
+ if (row && typeof row === 'object' && typeof row.baseURL === 'string' && row.baseURL.trim()) return id;
202
+ }
203
+ return '';
204
+ }
205
+
206
+ function titlesLine(values, fallback) {
207
+ const source = Array.isArray(values) ? values : fallback;
208
+ return source.filter((title) => typeof title === 'string' && title.trim()).slice(0, MAX_TITLES).join('、') || '无';
209
+ }
210
+
211
+ /**
212
+ * 归纳一句话用途。额度闸在最前面:关着时连宿主都不问,更不发请求。
213
+ * 渠道与 Key 都取自电脑自己那一份(customChannelWithKey),Key 只放进这一发请求头,
214
+ * 不回包、不落盘。任何失败都只用契约里的三个错误码。
215
+ */
216
+ async function summarize(ctx, options = {}) {
217
+ if (getSwitches().modelEnabled !== true) return { ok: false, errorCode: 'learning-disabled' };
218
+
219
+ let found = null;
220
+ try {
221
+ const requested = typeof options.channelId === 'string' ? options.channelId.trim() : '';
222
+ const id = requested || await firstCustomChannelId(ctx);
223
+ if (!id) return { ok: false, errorCode: 'no-channel' };
224
+ found = await customChannelWithKey(ctx, id);
225
+ } catch {
226
+ return { ok: false, errorCode: 'no-channel' };
227
+ }
228
+ if (!found || found.error || !found.channel || !chatCompletionUrlOf(found.channel.baseUrl)) {
229
+ return { ok: false, errorCode: 'no-channel' };
230
+ }
231
+
232
+ const supplied = typeof options.model === 'string' ? options.model : '';
233
+ const first = Array.isArray(found.channel.models) && found.channel.models[0]
234
+ ? found.channel.models[0].id : '';
235
+ const model = (typeof supplied === 'string' && supplied.trim()) || (typeof first === 'string' ? first.trim() : '');
236
+ if (!model) return { ok: false, errorCode: 'summary-failed' };
237
+
238
+ const profile = load() || emptyProfile();
239
+ let signals = {};
240
+ try {
241
+ signals = await collect(ctx);
242
+ } catch {
243
+ signals = {};
244
+ }
245
+ const userContent = [
246
+ '以下是这台电脑的已知信号,请据此归纳它的一到两句用途。',
247
+ `设备名:${signals.name || profile.name || '未知'}`,
248
+ `系统:${signals.platform || profile.platform || '未知'}`,
249
+ `工作区:${titlesLine(signals.workspaces || profile.workspaces, [])}`,
250
+ `最近会话:${titlesLine(signals.recentTitles || profile.recentTitles, [])}`,
251
+ ...(profile.note ? [`上一版用途:${profile.note}`] : []),
252
+ ].join('\n');
253
+
254
+ const controller = new AbortController();
255
+ const timer = setTimeout(() => controller.abort(), UPSTREAM_TIMEOUT_MS);
256
+ try {
257
+ const response = await fetch(chatCompletionUrlOf(found.channel.baseUrl), {
258
+ method: 'POST',
259
+ signal: controller.signal,
260
+ headers: {
261
+ 'content-type': 'application/json',
262
+ ...(found.apiKey ? { authorization: `Bearer ${found.apiKey}` } : {}),
263
+ },
264
+ body: JSON.stringify({
265
+ model,
266
+ stream: false,
267
+ messages: [
268
+ { role: 'system', content: SYSTEM_PROMPT },
269
+ { role: 'user', content: userContent },
270
+ ],
271
+ max_tokens: 120,
272
+ }),
273
+ });
274
+ if (!response || !response.ok) return { ok: false, errorCode: 'summary-failed' };
275
+ const data = await response.json();
276
+ const choices = data && Array.isArray(data.choices) ? data.choices : [];
277
+ const message = choices[0] && choices[0].message;
278
+ let content = message ? message.content : '';
279
+ if (Array.isArray(content)) {
280
+ content = content.map((part) => (part && typeof part.text === 'string' ? part.text : '')).join('');
281
+ }
282
+ if (typeof content !== 'string') return { ok: false, errorCode: 'summary-failed' };
283
+ const note = content.trim().replace(/\s+/g, ' ').slice(0, NOTE_MAX_CHARS);
284
+ if (!note) return { ok: false, errorCode: 'summary-failed' };
285
+ return { ok: true, note };
286
+ } catch {
287
+ return { ok: false, errorCode: 'summary-failed' };
288
+ } finally {
289
+ clearTimeout(timer);
290
+ }
291
+ }
292
+
293
+ /**
294
+ * 变化检测:每 60 秒最多问一次宿主,在途的那一次多方合并。
295
+ * 用「保留旧 updatedAt 的候选」算指纹再比,空转时指纹不变就不写盘、不回 true;
296
+ * 真变了才改 updatedAt 并重算指纹,配合 makeRevision 的口径(指纹只盖本体)。
297
+ */
298
+ const fallbackRefreshState = { lastAt: 0, inFlight: null };
299
+
300
+ function refreshStateOf(ctx) {
301
+ if (!ctx || (typeof ctx !== 'object' && typeof ctx !== 'function')) return fallbackRefreshState;
302
+ return deviceProfileRefreshStateOf(ctx);
303
+ }
304
+
305
+ async function refreshIfChanged(ctx) {
306
+ const state = refreshStateOf(ctx);
307
+ if (state.inFlight) return state.inFlight;
308
+
309
+ const now = Date.now();
310
+ if (now - state.lastAt < REFRESH_MIN_INTERVAL_MS) return false;
311
+ state.lastAt = now;
312
+
313
+ const task = (async () => {
314
+ const existing = load();
315
+ const base = existing || emptyProfile();
316
+ let signals = {};
317
+ try {
318
+ signals = await collect(ctx);
319
+ } catch {
320
+ signals = {};
321
+ }
322
+ const candidate = {
323
+ ...base,
324
+ ...signals,
325
+ workspaces: Array.isArray(signals.workspaces) ? signals.workspaces : base.workspaces,
326
+ recentTitles: Array.isArray(signals.recentTitles) ? signals.recentTitles : base.recentTitles,
327
+ updatedAt: base.updatedAt,
328
+ };
329
+ const seen = makeRevision(candidate);
330
+ if (seen && seen === base.revision) return false;
331
+
332
+ const next = { ...candidate, updatedAt: Date.now() };
333
+ next.revision = makeRevision(next);
334
+ await save(next);
335
+ return true;
336
+ })();
337
+
338
+ state.inFlight = task;
339
+ try {
340
+ return await task;
341
+ } finally {
342
+ if (state.inFlight === task) state.inFlight = null;
343
+ }
344
+ }
345
+
346
+ module.exports = {
347
+ load,
348
+ save,
349
+ collect,
350
+ makeRevision,
351
+ summarize,
352
+ getSwitches,
353
+ setSwitches,
354
+ refreshIfChanged,
355
+ };
@@ -1,3 +1,4 @@
1
+ // 2026-11-26:会话/工作区变化帧顺带刷新本机画像,revision 真变才推 device/profile-changed。
1
2
  // 清单事件同时识别 event.type 与 event.data.type,正文仍只走会话流。
2
3
  // 转发设备事件,并按已鉴权实例登记可吊销的 SSE 连接。
3
4
  /**
@@ -15,6 +16,8 @@
15
16
  'use strict';
16
17
 
17
18
  const streamRegistry = require('./stream-registry.js');
19
+ // 画像采集调度(refreshIfChanged 自带节流与 in-flight 合并;导出签名见契约 A 块)。
20
+ const deviceProfile = require('./device-profile.js');
18
21
  const { createFrameSealer } = require('./stream.js');
19
22
  const { listSignal: sharedListSignal } = require('../shared/list-signal.js');
20
23
  const { sessionSignal: sharedSessionSignal } = require('../shared/session-signal.js');
@@ -104,6 +107,18 @@ function lightPayload(payload) {
104
107
  // irrelevant to the sidebar and are the bulk of the flood whenever any session
105
108
  // is generating; they belong to the per-session /session/stream instead.
106
109
  const LIST_EVENT_INNER = new Set(['turn/start', 'turn/end', 'session/title', 'session/disposed']);
110
+
111
+ /**
112
+ * 只有会话 / 工作区**清单**变化才动画像(recentTitles / workspaces):
113
+ * 清单变更走 session/summary,工作区变更走 host/workspace。
114
+ * session/event 的 turn/title/disposed 是单会话的正文水位信号,清单 revision 本来就会跟着变,
115
+ * 不在这里重复触发 —— 否则正文那种高频帧会把这条只推 revision 的信号一起带热。
116
+ */
117
+ function isProfileRelevantPayload(payload) {
118
+ if (!payload || typeof payload !== 'object') return false;
119
+ return payload.type === 'host/workspace' || payload.type === 'session/summary';
120
+ }
121
+
107
122
  function listRelevantPayload(rawPayload) {
108
123
  if (!rawPayload || typeof rawPayload !== 'object') return null;
109
124
  const type = rawPayload.type;
@@ -291,6 +306,17 @@ async function handleDeviceStream(ctx, req, res) {
291
306
  // 才收尾。
292
307
  if (sent.needDrain && !(await waitForDrain(res, ac.signal))) { clientGone = true; break; }
293
308
  framesSent += 1;
309
+ // 画像信号:refreshIfChanged 自带最小间隔与 in-flight 合并,返回 true 才是 revision 真变。
310
+ // 只推 type / revision / at 三个字段,不推画像内容;现有去重窗口与心跳都不改。
311
+ if (isProfileRelevantPayload(payload)) {
312
+ let changed = false;
313
+ try { changed = await deviceProfile.refreshIfChanged(ctx); } catch { /* 采集失败不掐断 SSE */ }
314
+ if (changed && !ac.signal.aborted) {
315
+ let revision = '';
316
+ try { revision = (deviceProfile.load() || {}).revision || ''; } catch { /* 读不到回空 revision */ }
317
+ if (!writeFrame({ type: 'device/profile-changed', revision, at: Date.now() })) ac.abort();
318
+ }
319
+ }
294
320
  }
295
321
  if (!clientGone) loopEnded = true;
296
322
  } catch (error) {
@@ -1,3 +1,4 @@
1
+ // 2026-11-26:画像 / 学习开关五条路由登记权限档,读归 view,写与归纳归 config。
1
2
  // 升级权限优先使用本次已认证记录,身份轮换后不回查过期实例快照。
2
3
  'use strict';
3
4
 
@@ -431,6 +432,14 @@ const MAP = Object.freeze({
431
432
  '/api/mobile/v1/agent-presets/remove': V.CONFIG,
432
433
  '/api/mobile/v1/agent-presets/default': V.CONFIG,
433
434
  '/api/mobile/v1/magpie/web': V.CONFIG,
435
+
436
+ // ── 学习画像与开关(契约 B 块):读画像 / 读开关归 view;刷新画像、写开关与归纳归 config。
437
+ // study 会花电脑侧渠道的额度,按「花额度的 config」与 channels/chat 同档,不放给只读设备。
438
+ '/api/mobile/v1/device-profile': V.VIEW,
439
+ '/api/mobile/v1/device-profile/refresh': V.CONFIG,
440
+ '/api/mobile/v1/device-profile/study': V.CONFIG,
441
+ // 同路径按方法分读写:GET 看当前开关、POST 写开关(宿主注册器不分方法)。
442
+ '/api/mobile/v1/learning-switches': { GET: V.VIEW, POST: V.CONFIG },
434
443
  });
435
444
 
436
445
  const BASE_SET = new Set(BASE);
@@ -3,7 +3,7 @@
3
3
  'use strict';
4
4
 
5
5
  /**
6
- * 会话侧的按 ctx 隔离状态:十九张表,一个入口。
6
+ * 会话侧的按 ctx 隔离状态:二十一张表,一个入口。
7
7
  *
8
8
  * 这些表此前全是 sessions.js 的模块级 WeakMap。它们之所以必须按 ctx 隔离,是因为
9
9
  * 它们的值属于**宿主进程状态**(某个会话正在跑、某个列表刚构建完、某条发送已经
@@ -76,6 +76,10 @@ const workflowLiveStates = new WeakMap();
76
76
  // 收尾那一发挂在会话列表刷新上,是热点路径 —— 每台宿主各一份,不能跨 ctx 串。
77
77
  const isolationSweepStates = new WeakMap();
78
78
 
79
+ // 学习画像的变化检测节流(见 device-profile.js):上次重算的时刻与在途那一次。
80
+ // 它挂在会话 / 工作区清单帧上,每台宿主各算各的 —— 串了就是「A 宿主算过,B 宿主这一轮直接跳过」。
81
+ const deviceProfileRefreshStates = new WeakMap();
82
+
79
83
  // 交付声明补格的账(见 presented-file-stats.js):这一台宿主上「`deriveMessages` 交回来的
80
84
  // 数组 → 那次补齐的结果(可能还在飞)」。**下面那层按数组引用认**:派生缓存对同一份输入交回
81
85
  // 的就是同一个数组,于是「同指纹第二次调用」连 stat 都不用发;换一份输入就是新数组,自然重算。
@@ -313,6 +317,20 @@ function isolationSweepStateOf(ctx) {
313
317
  return state;
314
318
  }
315
319
 
320
+ /**
321
+ * 学习画像变化检测的节流状态:`{ lastAt, inFlight }`。
322
+ *
323
+ * 与其它访问器同一口径 —— 保证返回的一定是给这个 ctx 建好的那个对象,调用方拿到直接用。
324
+ */
325
+ function deviceProfileRefreshStateOf(ctx) {
326
+ let state = deviceProfileRefreshStates.get(ctx);
327
+ if (!state) {
328
+ state = { lastAt: 0, inFlight: null };
329
+ deviceProfileRefreshStates.set(ctx, state);
330
+ }
331
+ return state;
332
+ }
333
+
316
334
  /**
317
335
  * 交付声明补格的账:这一台宿主上「`deriveMessages` 交回来的数组 → 那次补齐的结果
318
336
  * (可能还在飞的 promise)」。
@@ -553,6 +571,7 @@ module.exports = {
553
571
  workspaceShortcutStateOf,
554
572
  autoContinueTurnsOf,
555
573
  isolationSweepStateOf,
574
+ deviceProfileRefreshStateOf,
556
575
  presentedFileStatsOf,
557
576
  rememberPresentedFileStats,
558
577
  forgetPresentedFileStats,
@@ -1,3 +1,4 @@
1
+ // 2026-11-26:挂画像 / 学习开关五条路由,采集与归纳实现在 mobile/device-profile.js;不扩能力面。
1
2
  // 本次改动:隧道暂不可用沿用 tunnel-unavailable 码,中文文案仅作日志与老客户端兜底。
2
3
  // 2026-11-23:心跳里的服务商线路改走 provider-lines,与配对二维码 / 总控同源。
3
4
  // 公开健康响应保留服务与实例身份、API 代号,不公开精确插件版本。
@@ -51,6 +52,8 @@ const stats = require('../mobile/stats.js');
51
52
  const agentPresets = require('../mobile/agent-presets.js');
52
53
  const stream = require('../mobile/stream.js');
53
54
  const events = require('../mobile/events.js');
55
+ // 本机画像:采集 / 归纳 / 开关落盘都在 mobile/device-profile.js,本文件只接线成五条路由。
56
+ const deviceProfile = require('../mobile/device-profile.js');
54
57
  const questions = require('../mobile/questions.js');
55
58
  const approvals = require('../mobile/approvals.js');
56
59
  const workspaces = require('../mobile/workspaces.js');
@@ -197,6 +200,79 @@ const withTraffic = (handler) => {
197
200
  return wrapped
198
201
  }
199
202
 
203
+ /**
204
+ * 没落盘时回的画像空壳:结构对齐契约的 Profile,`workspaces` / `recentTitles` 必须是数组、
205
+ * `revision` 必须是空串(App 据此知道「电脑还没有画像」,不去读旧缓存)。
206
+ */
207
+ const EMPTY_PROFILE = Object.freeze({
208
+ name: '',
209
+ platform: '',
210
+ workspaces: [],
211
+ recentTitles: [],
212
+ note: '',
213
+ updatedAt: 0,
214
+ revision: '',
215
+ });
216
+
217
+ const profileOrEmpty = () => deviceProfile.load() || EMPTY_PROFILE;
218
+
219
+ /** GET /device-profile:只读当前画像,不触发采集。 */
220
+ async function handleDeviceProfile(_ctx, _req, res) {
221
+ sendJson(res, 200, { ok: true, profile: profileOrEmpty() });
222
+ }
223
+
224
+ /** POST /device-profile/refresh:先试一次节流内的重算,再回当前画像。 */
225
+ async function handleDeviceProfileRefresh(ctx, _req, res) {
226
+ // 重算失败照旧回已有画像:这条是「给 App 一份最新快照」,不该因为一次采集失败变 500。
227
+ try { await deviceProfile.refreshIfChanged(ctx); } catch { /* 如实回当前画像 */ }
228
+ sendJson(res, 200, { ok: true, profile: profileOrEmpty() });
229
+ }
230
+
231
+ /**
232
+ * POST /device-profile/study body { channelId?, model? }:归纳交给 A 块(电脑代问模型,
233
+ * key 不出电脑)。成功把 note 并进画像、重算 revision 落盘后回最新画像;失败只回错误码。
234
+ */
235
+ async function handleDeviceProfileStudy(ctx, req, res) {
236
+ const body = (await readJsonBody(req, 16 * 1024)) || {};
237
+ let result;
238
+ try {
239
+ result = await deviceProfile.summarize(ctx, {
240
+ channelId: typeof body.channelId === 'string' ? body.channelId : undefined,
241
+ model: typeof body.model === 'string' ? body.model : undefined,
242
+ });
243
+ } catch {
244
+ result = { ok: false, errorCode: 'summary-failed' };
245
+ }
246
+ if (!result || !result.ok) {
247
+ sendJson(res, 200, { ok: false, error: { code: (result && result.errorCode) || 'summary-failed' } });
248
+ return;
249
+ }
250
+ const profile = {
251
+ ...profileOrEmpty(),
252
+ note: typeof result.note === 'string' ? result.note : '',
253
+ updatedAt: Date.now(),
254
+ };
255
+ profile.revision = deviceProfile.makeRevision(profile);
256
+ await deviceProfile.save(profile);
257
+ sendJson(res, 200, { ok: true, profile });
258
+ }
259
+
260
+ /**
261
+ * GET 读开关;POST 按 body 里出现的布尔项局部更新后回最终值。
262
+ * 宿主注册器不按方法分派,所以两条收在同一路径上由 req.method 分派(同 /relay/config)。
263
+ */
264
+ async function handleLearningSwitches(_ctx, req, res) {
265
+ if (req && req.method === 'POST') {
266
+ const body = (await readJsonBody(req, 16 * 1024)) || {};
267
+ const next = {};
268
+ if (typeof body.passiveEnabled === 'boolean') next.passiveEnabled = body.passiveEnabled;
269
+ if (typeof body.modelEnabled === 'boolean') next.modelEnabled = body.modelEnabled;
270
+ await deviceProfile.setSwitches(next);
271
+ }
272
+ const switches = deviceProfile.getSwitches() || {};
273
+ sendJson(res, 200, { ok: true, passiveEnabled: switches.passiveEnabled, modelEnabled: switches.modelEnabled });
274
+ }
275
+
200
276
  function registerMobileRoutes(deps) {
201
277
  const { registerRoute: registerRouteRaw, registerUpgradeRoute: registerUpgradeRouteRaw, tailcat, p2p, guarded, state, getControl, hostMetadata, getSidecarSnapshot, safeLanCandidates, safeIpv6Candidates, lanPortInUse, mux = { handleUpgrade: () => {} }, preview, core, pairingApproval, rotatePairing, getHistoryKey, credentials, dropDeviceStreams } = deps;
202
278
  /**
@@ -939,6 +1015,16 @@ function registerMobileRoutes(deps) {
939
1015
  // 与「自动清理」同一个位置:都是这台电脑自己的偏好,跟会话无关。
940
1016
  route('/api/mobile/v1/narration', narration.handleNarration)
941
1017
 
1018
+ // 本机画像与学习开关(契约 B 块;实现见 mobile/device-profile.js):画像每实例一份、
1019
+ // 落 dshHome,学习层改为从电脑读;归纳由电脑代问模型,手机不直连模型 / 不花自己额度。
1020
+ // 五个端点:GET /device-profile、POST /device-profile/refresh、POST /device-profile/study、
1021
+ // GET/POST /learning-switches(同路径按 method 分派)。全走 route() 即包 guarded。
1022
+ // 三条 POST 套 postOnly:注册器不分方法,不挡的话 GET 带查询串也能触发重算 / 归纳。
1023
+ route('/api/mobile/v1/device-profile', handleDeviceProfile)
1024
+ route('/api/mobile/v1/device-profile/refresh', postOnly(handleDeviceProfileRefresh))
1025
+ route('/api/mobile/v1/device-profile/study', postOnly(handleDeviceProfileStudy))
1026
+ route('/api/mobile/v1/learning-switches', handleLearningSwitches)
1027
+
942
1028
  // 电脑上的 DSH 网页版(见 mobile/host-web.js):App 的内置浏览器要直接用它,而那个页面
943
1029
  // 只绑在宿主自己的环回端口上、且要一枚一次性登录令牌。令牌是凭据,所以这条**必须**
944
1030
  // 包 guarded(不是 PUBLIC_ROUTES)——只有已配对设备才拿得到。
@@ -1,3 +1,4 @@
1
+ // 2026-11-26:体检发现旧隧道落点端口没人监听就判失效(只改本机状态,不删不建云端隧道),交接线层清地址让兜底顶上。
1
2
  // 2026-11-25:CLI status 的 connected 也认作在跑,兼容新版客户端字段,别把活线路抖成掉线重连。
2
3
  // 2026-11-25:端口失配带上可识别的 reason,让接线层清掉旧地址(配对码不再带失效线路)。
3
4
  // 2026-11-25:running 认守护进程而非早退出的启动进程;连上后可由接线层定时体检判活。
@@ -21,6 +22,7 @@
21
22
  */
22
23
 
23
24
  const { spawn, execFile } = require('node:child_process');
25
+ const net = require('node:net');
24
26
  const path = require('node:path');
25
27
 
26
28
  const { loginErrorHint, friendlyAuthError } = require('./login-error.cjs');
@@ -49,6 +51,23 @@ function defaultRun(binary, args, opts = {}) {
49
51
  });
50
52
  }
51
53
 
54
+ /**
55
+ * 落点探活:连一下隧道指向的本机端口,连得上才算有人监听。只判「有没有监听」,不认协议——
56
+ * 端口上跑着别的服务也当作还通,不在这里替用户判断那是不是他的服务。
57
+ */
58
+ function defaultProbePort(port) {
59
+ return new Promise((resolve) => {
60
+ const socket = new net.Socket();
61
+ let done = false;
62
+ const finish = (ok) => { if (!done) { done = true; socket.destroy(); resolve(ok); } };
63
+ socket.setTimeout(1200);
64
+ socket.once('connect', () => finish(true));
65
+ socket.once('timeout', () => finish(false));
66
+ socket.once('error', () => finish(false));
67
+ try { socket.connect(port, '127.0.0.1'); } catch { finish(false); }
68
+ });
69
+ }
70
+
52
71
  /**
53
72
  * 一条隧道条目指向的本机端口:本地 API 常平铺 `local_port`,账号侧那份是
54
73
  * `route_rules[].forward_rules[].load_balance_policy.backend_endpoints[].local_port`(见 account.cjs)。
@@ -140,6 +159,7 @@ function terminalError(message, reason) {
140
159
  * @param {object} [options.spawnImpl] spawn 注入
141
160
  * @param {(url:string, init:object)=>Promise<any>} [options.fetchImpl] 本地 API fetch 注入
142
161
  * @param {(bin:string,args:string[],opts:object)=>Promise<{code:number,stdout:string,stderr:string}>} [options.runImpl] 一次性命令注入
162
+ * @param {(port:number)=>Promise<boolean>} [options.probePort] 隧道落点端口有没有人监听(体检用,测试注入)
143
163
  * @param {string} [options.base] 本地 API 根
144
164
  */
145
165
  function createZeroNewsRunner(options = {}) {
@@ -149,6 +169,7 @@ function createZeroNewsRunner(options = {}) {
149
169
  const doFetch = typeof options.fetchImpl === 'function' ? options.fetchImpl
150
170
  : (typeof globalThis.fetch === 'function' ? globalThis.fetch : null);
151
171
  const runImpl = typeof options.runImpl === 'function' ? options.runImpl : defaultRun;
172
+ const probePort = typeof options.probePort === 'function' ? options.probePort : defaultProbePort;
152
173
  const base = String(options.base || DEFAULT_BASE).replace(/\/+$/, '');
153
174
  const sleep = typeof options.sleepImpl === 'function' ? options.sleepImpl : (ms) => new Promise((r) => setTimeout(r, ms));
154
175
 
@@ -467,7 +488,26 @@ function createZeroNewsRunner(options = {}) {
467
488
  const st = await cliStatus();
468
489
  if (gen !== generation || phase !== 'connected' || !st) return;
469
490
  daemonRunning = st.running === true;
470
- if (daemonRunning) return;
491
+ if (daemonRunning) {
492
+ // CLI 说守护进程在跑、云端也还留着这条隧道,但它指向的本机端口可能已经没人监听
493
+ // (老隧道落在旧端口上):手机拨过去照样连不上。探一下落点,没监听就判失效。
494
+ // 只改本机这份状态:不删云端隧道、不重建(官方 CLI 没公开删除参数,删错不可回滚)。
495
+ const port = tunnelLocalPort;
496
+ if (port > 0) {
497
+ let listening = true;
498
+ try { listening = await probePort(port); } catch { /* 探活本身失败当不知道,别抖掉还能用的线路 */ }
499
+ if (gen !== generation || phase !== 'connected') return;
500
+ if (!listening) {
501
+ attached = false;
502
+ url = '';
503
+ phase = 'error';
504
+ error = `旧隧道指向的本机端口 ${port} 没有服务监听,请在控制台删除旧隧道后重新接入`;
505
+ errorReason = 'port-dead';
506
+ retryable = false;
507
+ }
508
+ }
509
+ return;
510
+ }
471
511
  attached = false;
472
512
  url = '';
473
513
  phase = 'error';
@@ -1,3 +1,4 @@
1
+ // 2026-11-26:体检发现旧隧道落点端口没监听就清掉失效地址(notify:false)并通知兜底重新判定;不自动删/建云端隧道。
1
2
  // 2026-11-25:端口失配时清掉状态里的旧地址,配对码 / 心跳 / 总控都不再带失效线路。
2
3
  // 2026-11-25:连上后定时体检守护进程,发现进程没了自动走自愈重连。
3
4
  // 2026-11-24:首次接入先开代理商邀请链接埋归属 cookie,让新注册用户无感归到代理商名下。
@@ -123,9 +124,12 @@ const facade = {
123
124
  purge: () => (readCurrent() ? readCurrent().purge() : Promise.resolve({ ok: false, error: '这台宿主没有接入 ZeroNews 线路能力' })),
124
125
  };
125
126
 
126
- /** @param {{mount:Function, settings:object, getState:Function, control:object, warn:Function, ctx:object, name:string, portOf?:Function, runnerFactory?:Function, ensure?:Function, accountFactory?:Function, loginFlow?:Function, loginClient?:string, openUrl?:Function}} options */
127
+ /** @param {{mount:Function, settings:object, getState:Function, control:object, warn:Function, ctx:object, name:string, portOf?:Function, runnerFactory?:Function, ensure?:Function, accountFactory?:Function, loginFlow?:Function, loginClient?:string, openUrl?:Function, onRouteStale?:Function}} options */
127
128
  function mountZeroNews(options) {
128
129
  const { mount, settings, getState, control, warn, ctx, name } = options;
130
+ // 落点失效清掉地址后要显式叫一次兜底重判:notify:false 不走 settings.watch,那边的
131
+ // reconcile 不会自己跑。装配层把它接到 Cloudflare 的 reconcile。
132
+ const onRouteStale = typeof options.onRouteStale === 'function' ? options.onRouteStale : null;
129
133
  const makeRunner = typeof options.runnerFactory === 'function' ? options.runnerFactory : createZeroNewsRunner;
130
134
  const provision = typeof options.ensure === 'function' ? options.ensure : ensureZeroNews;
131
135
  const purgeImpl = typeof options.purgeLocal === 'function' ? options.purgeLocal : purgeZeroNews;
@@ -170,8 +174,22 @@ function mountZeroNews(options) {
170
174
  healthTimer = setTimeout(() => {
171
175
  healthTimer = null;
172
176
  if (!isConfigured()) return;
173
- void runner.checkAlive().catch(() => {});
174
- startHealth();
177
+ void runner.checkAlive().then((result) => {
178
+ // 落点端口没人监听:这条旧隧道名义上连着、实际拨不通。清掉地址,让
179
+ // hasOtherRoute 不再把它算作可用线路,再通知兜底起一条能用的顶上。
180
+ // notify:false 沿用既有约定:只落盘改内存,不走 watch → control.sync(),
181
+ // 免得「configured 就自动重连」那条 mount effect 被同一份状态变更反复叫醒。
182
+ if (result && result.phase === 'error' && result.errorReason === 'port-dead') {
183
+ clearHealth();
184
+ if (getState().zeroNewsUrl) {
185
+ void settings.update({ zeroNewsUrl: '' }, { notify: false })
186
+ .then(() => { if (onRouteStale) onRouteStale(); })
187
+ .catch((error) => warn('清掉失效的 ZeroNews 旧地址失败:%s', error && error.message ? error.message : error));
188
+ } else if (onRouteStale) onRouteStale();
189
+ return;
190
+ }
191
+ startHealth();
192
+ }).catch(() => { startHealth(); });
175
193
  }, healthCheckMs);
176
194
  if (healthTimer && typeof healthTimer.unref === 'function') healthTimer.unref();
177
195
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mobile-plugin",
3
- "version": "0.5.122",
3
+ "version": "0.5.123",
4
4
  "description": "Mobile API (/api/mobile/v1) and relay client for the DSH mobile app — desktop profile build (dsh 0.2.x, peers resolved by the host)",
5
5
  "license": "MIT",
6
6
  "icon": "./icon.png",
@@ -117,23 +117,23 @@
117
117
  "yaml": "2.9.1"
118
118
  },
119
119
  "dshMobileReleaseNotes": {
120
- "version": "0.5.122",
120
+ "version": "0.5.123",
121
121
  "kinds": [
122
122
  "feature",
123
123
  "fix"
124
124
  ],
125
125
  "notes": {
126
- "zh-Hans": "- 远程桌面窗口(Mac/Windows)现在支持 ⌘N、⌘B、⌘K 等桌面快捷键,改过的键位按本机保存,页面排版不变。\n- 修复新版宿主下远程电脑取不到启动令牌、被误判为「对方电脑暂时不可用」的问题,连接更稳。",
127
- "zh-Hant": "- 遠端桌面視窗(Mac/Windows)現在支援 ⌘N、⌘B、⌘K 等桌面快捷鍵,改過的鍵位按本機儲存,頁面排版不變。\n- 修正新版宿主下遠端電腦取不到啟動令牌、被誤判為「對方電腦暫時不可用」的問題,連線更穩。",
128
- "en": "- Remote desktop windows on Mac and Windows now support desktop shortcuts such as Cmd-N, Cmd-B and Cmd-K; your custom key bindings are saved on the local machine and the page layout is unchanged.\n- Fixed an issue where newer hosts could leave a remote computer without its launch token, causing a false \"computer temporarily unavailable\" message. Connections are now more reliable.",
129
- "ja": "- Mac/Windows のリモートデスクトップ画面で、Cmd-N や Cmd-B、Cmd-K などのデスクトップショートカットが使えるようになりました。変更したキー設定はそのパソコンに保存され、画面のレイアウトは変わりません。\n- 新しいホスト環境でリモートパソコンが起動トークンを取得できず、「相手のパソコンが一時的に利用できません」と誤表示される問題を修正し、接続がより安定しました。",
130
- "ko": "- Mac/Windows 원격 데스크톱 창에서 Cmd-N, Cmd-B, Cmd-K 같은 데스크톱 단축키를 이제 사용할 수 있습니다. 변경한 키 설정은 해당 컴퓨터에 저장되며 화면 배치는 그대로입니다.\n- 새로운 호스트 환경에서 원격 컴퓨터가 시작 토큰을 가져오지 못해 '상대 컴퓨터를 일시적으로 사용할 수 없습니다'라고 잘못 표시되던 문제를 수정했습니다. 연결이 더 안정적입니다.",
131
- "de": "- Remote-Desktop-Fenster unter Mac und Windows unterstützen jetzt Desktop-Tastenkürzel wie Cmd-N, Cmd-B und Cmd-K. Eigene Tastenbelegungen werden auf dem jeweiligen Rechner gespeichert, das Seitenlayout bleibt unverändert.\n- Behoben: Unter neueren Hosts konnte ein Remoterechner seinen Start-Token nicht abrufen und wurde fälschlich als „vorübergehend nicht verfügbar“ gemeldet. Verbindungen sind jetzt stabiler.",
132
- "es": "- Las ventanas de escritorio remoto en Mac y Windows ahora admiten atajos de escritorio como Cmd-N, Cmd-B y Cmd-K; tus combinaciones personalizadas se guardan en ese equipo y el diseño de la página no cambia.\n- Se corrigió un problema por el que, en hosts más recientes, un equipo remoto no obtenía su token de inicio y se mostraba erróneamente como «temporalmente no disponible». Las conexiones son más estables.",
133
- "fr": "- Les fenêtres de bureau distant sous Mac et Windows prennent désormais en charge les raccourcis bureau comme Cmd-N, Cmd-B et Cmd-K ; vos raccourcis personnalisés sont enregistrés sur l'ordinateur local et la mise en page reste inchangée.\n- Correction : avec les hôtes récents, un ordinateur distant n'obtenait pas son jeton de lancement et était signalé à tort comme « temporairement indisponible ». Les connexions sont plus stables.",
134
- "pt": "- As janelas de área de trabalho remota no Mac e no Windows agora aceitam atalhos de desktop como Cmd-N, Cmd-B e Cmd-K; suas teclas personalizadas ficam salvas naquele computador e o layout da página não muda.\n- Corrigido um problema em que, em hosts mais recentes, um computador remoto não conseguia obter o token de inicialização e era exibido incorretamente como «temporariamente indisponível». As conexões ficaram mais estáveis.",
135
- "ru": "- Окна удалённого рабочего стола на Mac и Windows теперь поддерживают системные сочетания клавиш, например Cmd-N, Cmd-B и Cmd-K; ваши настройки клавиш сохраняются на этом компьютере, а вёрстка страницы не меняется.\n- Исправлена проблема, когда на новых хостах удалённый компьютер не получал токен запуска и ошибочно отображался как «временно недоступный». Соединения стали стабильнее.",
136
- "tr": "- Mac ve Windows'taki uzak masaüstü pencereleri artık Cmd-N, Cmd-B, Cmd-K gibi masaüstü kısayollarını destekliyor; değiştirdiğiniz tuş atamaları o bilgisayarda saklanıyor, sayfa düzeni değişmiyor.\n- Yeni host sürümlerinde uzak bilgisayarın başlangıç jetonunu alamayıp yanlışlıkla 'karşı taraf geçici olarak kullanılamıyor' diye görünmesi sorunu düzeltildi; bağlantılar artık daha kararlı."
126
+ "zh-Hans": "- 学习画像改由电脑采集和归纳:手机上的学习页直接读这台电脑的工作区与最近会话,归纳默认关闭,可在设置里打开。\n- 修复节点小宝已安装、但账号还没绑定时被误判为已绑定,导致取不到绑定链接的问题。\n- 修复零讯旧隧道的本机端口失效后仍显示「已连接」的问题:现在会及时清掉失效地址,并让兜底线路自动顶上。",
127
+ "zh-Hant": "- 學習畫像改由電腦採集和歸納:手機上的學習頁直接讀這台電腦的工作區與最近會話,歸納預設關閉,可在設定裡開啟。\n- 修正節點小寶已安裝、但帳號還沒綁定時被誤判為已綁定,導致取不到綁定連結的問題。\n- 修正零訊舊隧道的本機連接埠失效後仍顯示「已連線」的問題:現在會及時清掉失效位址,並讓備援線路自動接手。",
128
+ "en": "- Learning profiles now come from the computer: the Learning page on your phone reads this computer's workspaces and recent sessions directly, and summarising is off by default but can be turned on in settings.\n- Fixed an issue where JDXB was treated as bound even though the account had not been linked yet, so no binding link could be fetched.\n- Fixed an issue where an old ZeroNews tunnel with a dead local port still showed as connected; the stale address is now cleared in time and the fallback route takes over automatically.",
129
+ "ja": "- 学習プロファイルはパソコン側で収集・要約するようになりました。スマホの学習ページはこのパソコンのワークスペースと最近のセッションを直接読み、要約は既定でオフ、設定でオンにできます。\n- ノード小宝がインストール済みでもアカウント未連携のときに連携済みと誤判定され、連携リンクを取得できない問題を修正しました。\n- ゼロニュースの古いトンネルでローカルポートが無効になっても「接続済み」と表示される問題を修正しました。無効なアドレスは速やかに消去され、予備の回線が自動で切り替わります。",
130
+ "ko": "- 학습 프로필을 이제 컴퓨터에서 수집하고 정리합니다. 휴대폰의 학습 페이지는 이 컴퓨터의 작업 공간과 최근 세션을 바로 읽으며, 정리는 기본적으로 꺼져 있고 설정에서 켤 수 있습니다.\n- 노드샤오바오가 설치되어 있어도 계정이 아직 연결되지 않았을 때 연결된 것으로 잘못 판단해 연결 링크를 받지 못하던 문제를 수정했습니다.\n- 제로뉴스 이전 터널의 로컬 포트가 죽었는데도 '연결됨'으로 표시되던 문제를 수정했습니다. 이제 만료된 주소를 즉시 지우고 대체 회선이 자동으로 이어받습니다.",
131
+ "de": "- Lernprofile werden jetzt vom Computer erfasst und zusammengefasst: Die Lernseite auf dem Telefon liest Arbeitsbereiche und letzte Sitzungen dieses Computers direkt; das Zusammenfassen ist standardmäßig aus und lässt sich in den Einstellungen aktivieren.\n- Behoben: JDXB galt als gebunden, obwohl das Konto noch nicht verknüpft war, sodass kein Verknüpfungslink abgerufen werden konnte.\n- Behoben: Ein alter ZeroNews-Tunnel mit totem lokalen Port wurde weiterhin als verbunden angezeigt; die ungültige Adresse wird jetzt rechtzeitig entfernt und die Ausweichroute übernimmt automatisch.",
132
+ "es": "- Los perfiles de aprendizaje ahora se recopilan y resumen en el ordenador: la página Aprendizaje del teléfono lee directamente los espacios de trabajo y las sesiones recientes de este equipo, y el resumen está desactivado por defecto pero puede activarse en los ajustes.\n- Se corrigió que JDXB se diera por vinculado sin estarlo, de modo que no se podía obtener el enlace de vinculación.\n- Se corrigió que un túnel ZeroNews antiguo con el puerto local caído siguiera mostrándose como conectado; ahora la dirección no válida se borra a tiempo y la ruta de respaldo entra automáticamente.",
133
+ "fr": "- Les profils d'apprentissage sont désormais collectés et résumés par l'ordinateur : la page Apprentissage du téléphone lit directement les espaces de travail et les sessions récentes de ce poste, et le résumé est désactivé par défaut, activable dans les réglages.\n- Correction : JDXB était considéré comme lié alors que le compte ne l'était pas, ce qui empêchait d'obtenir le lien de liaison.\n- Correction : un ancien tunnel ZeroNews dont le port local était mort restait affiché comme connecté ; l'adresse invalide est maintenant effacée à temps et la route de secours prend le relais automatiquement.",
134
+ "pt": "- Os perfis de aprendizagem passam a ser recolhidos e resumidos no computador: a página Aprendizagem do telefone lê diretamente os espaços de trabalho e as sessões recentes deste computador, e o resumo vem desligado por predefinição, podendo ser ativado nas definições.\n- Corrigido o caso em que o JDXB era dado como vinculado sem a conta estar vinculada, impedindo obter o link de vinculação.\n- Corrigido o caso em que um túnel ZeroNews antigo com a porta local inativa continuava a aparecer como ligado; o endereço inválido passa a ser removido a tempo e a rota de reserva assume automaticamente.",
135
+ "ru": "- Профили обучения теперь собирает и обобщает компьютер: страница обучения на телефоне читает рабочие пространства и недавние сессии этого компьютера напрямую, а обобщение по умолчанию выключено и включается в настройках.\n- Исправлено: JDXB считался привязанным, хотя аккаунт ещё не был привязан, из-за чего не удавалось получить ссылку для привязки.\n- Исправлено: старый туннель ZeroNews с неработающим локальным портом продолжал отображаться как подключённый; теперь недействительный адрес вовремя удаляется, а резервный маршрут включается автоматически.",
136
+ "tr": "- Öğrenme profilleri artık bilgisayarda toplanıp özetleniyor: telefondaki Öğrenme sayfası bu bilgisayarın çalışma alanlarını ve son oturumlarını doğrudan okur; özetleme varsayılan olarak kapalıdır ve ayarlardan açılabilir.\n- JDXB kurulu olduğu hâlde hesap henüz bağlı değilken bağlı sayıldığı ve bağlama bağlantısının alınamadığı sorun düzeltildi.\n- Yerel bağlantı noktası ölmüş eski bir ZeroNews tünelinin hâlâ «bağlı» görünmesi sorunu düzeltildi; artık geçersiz adres zamanında siliniyor ve yedek hat otomatik devreye giriyor."
137
137
  }
138
138
  }
139
139
  }