dsh-mobile-plugin 0.5.115 → 0.5.117
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/config/agent-presets/standard/skills/dsh-mobile-kb/SKILL.md +1 -0
- package/lib/client.js +1 -0
- package/lib/impl.js +3 -1
- package/lib/mobile/feedback.js +34 -0
- package/lib/panel/index.html +4 -4
- package/lib/zeronews/runner.cjs +36 -2
- package/lib/zeronews/wiring.cjs +26 -2
- package/package.json +15 -14
package/lib/zeronews/runner.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// 2026-11-25:running 认守护进程而非早退出的启动进程;连上后可由接线层定时体检判活。
|
|
1
2
|
// 2026-11-25:复用隧道前比对 local_port,旧端口隧道不再静默复用。
|
|
2
3
|
// ZeroNews 客户端运行器:ensure→login→start→建隧道→读域名,进程生命周期与状态。
|
|
3
4
|
'use strict';
|
|
@@ -166,11 +167,17 @@ function createZeroNewsRunner(options = {}) {
|
|
|
166
167
|
let phase = 'off'; // off | installing | login | starting | connecting | connected | error
|
|
167
168
|
let retryable = true;
|
|
168
169
|
let generation = 0;
|
|
170
|
+
/**
|
|
171
|
+
* 真正的守护进程在不在跑。`start` 命令后台化自己后会退出,它不是客户端句柄;
|
|
172
|
+
* 连上之后的存活只能认 CLI status 报的 running,不能认那个早退出的启动进程。
|
|
173
|
+
*/
|
|
174
|
+
let daemonRunning = false;
|
|
175
|
+
let aliveCheckPromise = null;
|
|
169
176
|
|
|
170
177
|
function status() {
|
|
171
178
|
return {
|
|
172
179
|
available: Boolean(binary) || phase !== 'off',
|
|
173
|
-
running: Boolean(child) || attached,
|
|
180
|
+
running: Boolean(child) || attached || (phase === 'connected' && daemonRunning),
|
|
174
181
|
phase,
|
|
175
182
|
url: phase === 'connected' ? url : '',
|
|
176
183
|
error,
|
|
@@ -404,6 +411,8 @@ function createZeroNewsRunner(options = {}) {
|
|
|
404
411
|
if (gen !== generation) return status();
|
|
405
412
|
if (!url) throw new Error('客户端已连上,但还没拿到隧道公网地址,请稍后刷新');
|
|
406
413
|
phase = 'connected';
|
|
414
|
+
// 隧道地址是从守护进程的本地 API 读到的:能读到就说明它活着,running 认这一格。
|
|
415
|
+
daemonRunning = true;
|
|
407
416
|
} catch (err) {
|
|
408
417
|
if (gen !== generation) return status();
|
|
409
418
|
// 「还没登录」不是错误,是缺一步:停在 login 阶段,交给面板去打开确认页。
|
|
@@ -431,18 +440,43 @@ function createZeroNewsRunner(options = {}) {
|
|
|
431
440
|
return startPromise;
|
|
432
441
|
}
|
|
433
442
|
|
|
443
|
+
/**
|
|
444
|
+
* 连上之后定时问一次 CLI:守护进程是不是还在跑。launcher 早退出,手里没有它的退出事件,
|
|
445
|
+
* 只能靠这里发现「状态说连着、进程其实没了」,再交接线层安排自愈重连。
|
|
446
|
+
* CLI 读不到(命令报错)时当「不知道」,不动状态——别因为一次抖动把还能用的线路抖掉。
|
|
447
|
+
*/
|
|
448
|
+
async function checkAlive() {
|
|
449
|
+
if (phase !== 'connected' || aliveCheckPromise) return status();
|
|
450
|
+
const gen = generation;
|
|
451
|
+
aliveCheckPromise = (async () => {
|
|
452
|
+
const st = await cliStatus();
|
|
453
|
+
if (gen !== generation || phase !== 'connected' || !st) return;
|
|
454
|
+
daemonRunning = st.running === true;
|
|
455
|
+
if (daemonRunning) return;
|
|
456
|
+
attached = false;
|
|
457
|
+
url = '';
|
|
458
|
+
phase = 'error';
|
|
459
|
+
error = 'ZeroNews 客户端意外退出';
|
|
460
|
+
retryable = true;
|
|
461
|
+
if (onUnexpectedExit) { try { onUnexpectedExit(error); } catch { /* 回调失败不影响状态 */ } }
|
|
462
|
+
})();
|
|
463
|
+
try { await aliveCheckPromise; } finally { aliveCheckPromise = null; }
|
|
464
|
+
return status();
|
|
465
|
+
}
|
|
466
|
+
|
|
434
467
|
function stop() {
|
|
435
468
|
generation += 1;
|
|
436
469
|
if (child && typeof child.kill === 'function') { try { child.kill(); } catch {} }
|
|
437
470
|
child = null;
|
|
438
471
|
attached = false;
|
|
472
|
+
daemonRunning = false;
|
|
439
473
|
url = '';
|
|
440
474
|
error = '';
|
|
441
475
|
phase = 'off';
|
|
442
476
|
return status();
|
|
443
477
|
}
|
|
444
478
|
|
|
445
|
-
return { start, stop, status, pickEndpoint, endpointUrl };
|
|
479
|
+
return { start, stop, status, checkAlive, pickEndpoint, endpointUrl };
|
|
446
480
|
}
|
|
447
481
|
|
|
448
482
|
module.exports = { DEFAULT_BASE, LOGIN_TIMEOUT_MS, START_TIMEOUT_MS, endpointUrl, pickEndpoint, createZeroNewsRunner };
|
package/lib/zeronews/wiring.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// 2026-11-25:连上后定时体检守护进程,发现进程没了自动走自愈重连。
|
|
1
2
|
// 2026-11-24:首次接入先开代理商邀请链接埋归属 cookie,让新注册用户无感归到代理商名下。
|
|
2
3
|
// ZeroNews 线路挂载:把运行器接进装配层,隧道地址写回独立字段,随 effect 启停。
|
|
3
4
|
// 第一次接入的登录:`zeronews login` 要一直活着轮询设备授权码,浏览器确认后才把 token 落盘,
|
|
@@ -158,6 +159,22 @@ function mountZeroNews(options) {
|
|
|
158
159
|
if (retryTimer && typeof retryTimer.unref === 'function') retryTimer.unref();
|
|
159
160
|
};
|
|
160
161
|
|
|
162
|
+
// `start` 命令一后台化就退出,没有退出事件能告诉接线层守护进程后来挂了。连着的时候
|
|
163
|
+
// 定时问一次 CLI:运行器把状态打回 error 并回调,就走上面同一条自愈重连。
|
|
164
|
+
const healthCheckMs = Number(options.healthCheckMs) > 0 ? Number(options.healthCheckMs) : 15_000;
|
|
165
|
+
let healthTimer = null;
|
|
166
|
+
const clearHealth = () => { if (healthTimer) { clearTimeout(healthTimer); healthTimer = null; } };
|
|
167
|
+
const startHealth = () => {
|
|
168
|
+
if (healthTimer || typeof runner.checkAlive !== 'function') return;
|
|
169
|
+
healthTimer = setTimeout(() => {
|
|
170
|
+
healthTimer = null;
|
|
171
|
+
if (!isConfigured()) return;
|
|
172
|
+
void runner.checkAlive().catch(() => {});
|
|
173
|
+
startHealth();
|
|
174
|
+
}, healthCheckMs);
|
|
175
|
+
if (healthTimer && typeof healthTimer.unref === 'function') healthTimer.unref();
|
|
176
|
+
};
|
|
177
|
+
|
|
161
178
|
/** 身份看过没有:runner 这一进程见过的,或者落盘记录里做过都算。 */
|
|
162
179
|
const statusOf = () => {
|
|
163
180
|
const current = runner.status();
|
|
@@ -238,6 +255,7 @@ function mountZeroNews(options) {
|
|
|
238
255
|
|
|
239
256
|
const stop = async () => {
|
|
240
257
|
clearRetry();
|
|
258
|
+
clearHealth();
|
|
241
259
|
retryMs = retryBaseMs;
|
|
242
260
|
killLogin();
|
|
243
261
|
const result = runner.stop();
|
|
@@ -257,6 +275,7 @@ function mountZeroNews(options) {
|
|
|
257
275
|
*/
|
|
258
276
|
const purge = async () => {
|
|
259
277
|
clearRetry();
|
|
278
|
+
clearHealth();
|
|
260
279
|
retryMs = retryBaseMs;
|
|
261
280
|
killLogin();
|
|
262
281
|
const stopped = runner.stop();
|
|
@@ -279,8 +298,13 @@ function mountZeroNews(options) {
|
|
|
279
298
|
// 所以清空之后不会自动再拉起。连不上让状态停在错误上,不阻塞启动。
|
|
280
299
|
const s = getState();
|
|
281
300
|
const configured = s.zeroNewsEnabled === true || (typeof s.zeroNewsUrl === 'string' && s.zeroNewsUrl.trim() !== '');
|
|
282
|
-
if (configured) {
|
|
283
|
-
|
|
301
|
+
if (configured) {
|
|
302
|
+
startHealth();
|
|
303
|
+
void start().catch(() => {});
|
|
304
|
+
} else {
|
|
305
|
+
clearHealth();
|
|
306
|
+
}
|
|
307
|
+
return () => { clearRetry(); clearHealth(); killLogin(); runner.stop(); };
|
|
284
308
|
}, `${name}: zeronews runner`));
|
|
285
309
|
return facade;
|
|
286
310
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mobile-plugin",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.117",
|
|
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,22 +117,23 @@
|
|
|
117
117
|
"yaml": "2.9.1"
|
|
118
118
|
},
|
|
119
119
|
"dshMobileReleaseNotes": {
|
|
120
|
-
"version": "0.5.
|
|
120
|
+
"version": "0.5.117",
|
|
121
121
|
"kinds": [
|
|
122
|
-
"fix"
|
|
122
|
+
"fix",
|
|
123
|
+
"feature"
|
|
123
124
|
],
|
|
124
125
|
"notes": {
|
|
125
|
-
"zh-Hans": "-
|
|
126
|
-
"zh-Hant": "-
|
|
127
|
-
"en": "- Fixed an
|
|
128
|
-
"ja": "-
|
|
129
|
-
"ko": "-
|
|
130
|
-
"de": "-
|
|
131
|
-
"es": "-
|
|
132
|
-
"fr": "- Correction
|
|
133
|
-
"pt": "-
|
|
134
|
-
"ru": "- Исправлена
|
|
135
|
-
"tr": "-
|
|
126
|
+
"zh-Hans": "- 修复零讯线路的问题:客户端意外退出后不再一直显示「已连接」,会定期检查客户端状态,掉线后自动恢复。\n- 从引导页或失败页提交问题时,会自动带上问题来源、场景和版本信息,反馈更容易被定位。",
|
|
127
|
+
"zh-Hant": "- 修復零訊線路的問題:用戶端意外結束後不再一直顯示「已連線」,會定期檢查用戶端狀態,掉線後自動恢復。\n- 從引導頁或失敗頁提交問題時,會自動帶上問題來源、場景與版本資訊,讓回報更容易被定位。",
|
|
128
|
+
"en": "- Fixed an issue where the ZeroNews route kept showing \"Connected\" after the client exited unexpectedly and never reconnected. The client is now checked periodically and the route is restored automatically after a drop.\n- Feedback sent from the guide or an error page now includes its source, scenario and version details, making reports easier to trace.",
|
|
129
|
+
"ja": "- クライアントが予期せず終了しても ZeroNews 回線が「接続済み」のまま自動再接続しない問題を修正しました。定期的にクライアントの状態を確認し、切断後は自動で復旧します。\n- ガイド画面やエラー画面から問題を送信すると、発生元・場面・バージョン情報が自動で付き、報告を追いやすくなりました。",
|
|
130
|
+
"ko": "- 클라이언트가 예기치 않게 종료된 뒤에도 ZeroNews 회선이 '연결됨'으로만 표시되고 자동 재연결되지 않던 문제를 수정했습니다. 이제 클라이언트 상태를 주기적으로 확인하고, 연결이 끊기면 자동으로 복구합니다.\n- 안내 화면이나 오류 화면에서 문제를 제출할 때 출처, 상황, 버전 정보가 함께 전송되어 보고 내용을 더 쉽게 추적할 수 있습니다.",
|
|
131
|
+
"de": "- Behoben: Die ZeroNews-Verbindung zeigte nach einem unerwarteten Client-Absturz weiterhin „Verbunden\" und stellte die Verbindung nicht wieder her. Der Client wird jetzt regelmäßig geprüft und nach einem Abbruch automatisch wiederhergestellt.\n- Feedback aus dem Einrichtungs- oder Fehlerbildschirm enthält jetzt automatisch Quelle, Szene und Versionsangaben, sodass Meldungen leichter nachvollziehbar sind.",
|
|
132
|
+
"es": "- Se corrigió un problema por el cual la línea ZeroNews seguía mostrando «Conectado» después de que el cliente saliera de forma inesperada y nunca se reconectaba. Ahora se comprueba periódicamente el cliente y la línea se restaura automáticamente tras una caída.\n- Los informes enviados desde la guía o una pantalla de error incluyen automáticamente el origen, la situación y la versión, lo que facilita su seguimiento.",
|
|
133
|
+
"fr": "- Correction d'un problème où la ligne ZeroNews affichait toujours « Connecté » après la fermeture inattendue du client et ne se reconnectait jamais. Le client est désormais vérifié régulièrement et la ligne est restaurée automatiquement après une coupure.\n- Les signalements envoyés depuis le guide ou un écran d'erreur incluent désormais automatiquement la source, le contexte et la version, ce qui facilite leur suivi.",
|
|
134
|
+
"pt": "- Corrigido um problema em que a linha ZeroNews continuava mostrando \"Conectado\" depois que o cliente saía inesperadamente e nunca se reconectava. Agora o cliente é verificado periodicamente e a linha é restaurada automaticamente após uma queda.\n- Os relatórios enviados pelo guia ou por uma tela de erro agora incluem automaticamente a origem, o cenário e a versão, facilitando o acompanhamento.",
|
|
135
|
+
"ru": "- Исправлена проблема, при которой линия ZeroNews продолжала показывать «Подключено» после непредвиденного завершения клиента и не восстанавливала соединение. Теперь состояние клиента проверяется периодически, и после обрыва линия восстанавливается автоматически.\n- Отзывы, отправленные из руководства или экрана ошибки, теперь автоматически содержат источник, сценарий и версию, что упрощает их отслеживание.",
|
|
136
|
+
"tr": "- İstemci beklenmedik şekilde kapandıktan sonra ZeroNews hattının \"Bağlı\" görünmeye devam edip hiç yeniden bağlanmaması sorunu düzeltildi. Artık istemci düzenli olarak kontrol ediliyor ve kopma sonrası hat otomatik olarak geri yükleniyor.\n- Kılavuz veya hata ekranından gönderilen geri bildirimler artık kaynak, senaryo ve sürüm bilgilerini otomatik olarak içeriyor; böylece takip kolaylaşıyor."
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
}
|