@mrrisega/dsh-remote 0.7.6-beta.8 → 0.7.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrisega/dsh-remote",
3
- "version": "0.7.6-beta.8",
3
+ "version": "0.7.6",
4
4
  "description": "手机远程控制 DeepSeek Harness · Remote control DeepSeek Harness (dsh web) from any phone browser — 100% 全功能 App 级体验:发消息、看工具执行、审批权限、改设置、管凭据,含特权操作,免内网穿透。一条命令安装 npx @mrrisega/dsh-remote。Mobile remote control for DSH, self-host or SaaS, no server needed on LAN.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -98,7 +98,7 @@ window.__ModuleLoader__.load({
98
98
  // 绝不写 :root / body —— 否则会污染整个 GUI。JS 解析出主题后往根节点写
99
99
  // data-dru-theme="dark|light",下面按属性切换;末一条 `:not([data-dru-theme])`
100
100
  // 是 JS 尚未执行时的纯 CSS 兜底(一旦 JS 写过属性就不再参与,不会打架)。
101
- ".dru-settings-section,.dru-popup,.dru-nav-remote{",
101
+ ".dru-settings-section,.dru-popup,.dru-nav-remote,.dru-standalone-card{",
102
102
  " color-scheme:light;",
103
103
  " --dru-surface:#f6f8fa;", // 卡片底
104
104
  " --dru-surface-2:#ffffff;", // 抬升面(输入框/行/弹窗卡)
@@ -149,10 +149,11 @@ window.__ModuleLoader__.load({
149
149
  // 深色:JS 写的 data-dru-theme 优先;宿主属性作 JS 未执行时的兜底。
150
150
  // 取值跟着宿主的深色基色走(body 实测 #151517 / 层 1 #232324 / 层 2 #2c2c2e / 层 3 #353638),
151
151
  // 语义色**在深底上重新取值**,不是沿用亮色值(亮色的 #1a7f37 / #cf222e 在深底对比度不足)。
152
- ".dru-settings-section[data-dru-theme=\"dark\"],.dru-popup[data-dru-theme=\"dark\"],.dru-nav-remote[data-dru-theme=\"dark\"],",
152
+ ".dru-settings-section[data-dru-theme=\"dark\"],.dru-popup[data-dru-theme=\"dark\"],.dru-nav-remote[data-dru-theme=\"dark\"],.dru-standalone-card[data-dru-theme=\"dark\"],",
153
153
  "body[data-ds-dark-theme] .dru-settings-section:not([data-dru-theme]),",
154
154
  "body[data-ds-dark-theme] .dru-popup:not([data-dru-theme]),",
155
- "body[data-ds-dark-theme] .dru-nav-remote:not([data-dru-theme]){",
155
+ "body[data-ds-dark-theme] .dru-nav-remote:not([data-dru-theme]),",
156
+ "body[data-ds-dark-theme] .dru-standalone-card:not([data-dru-theme]){",
156
157
  " color-scheme:dark;",
157
158
  " --dru-surface:#232324;",
158
159
  " --dru-surface-2:#2c2c2e;",
@@ -202,6 +203,15 @@ window.__ModuleLoader__.load({
202
203
  "}",
203
204
  // 设置页栏目容器(nav 选中后渲染在 settings.section 内容区)
204
205
  ".dru-settings-section{max-width:720px;display:flex;flex-direction:column;gap:14px;padding-top:2px;color:var(--dru-fg)}",
206
+ // 📱 独立「远程访问」弹层(2026-10-25):入口点击不再去"猜"官方设置面板的 DOM,
207
+ // 直接弹我们自己的一份设置页 —— 宿主改版也影响不到它。
208
+ ".dru-standalone-overlay{position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;padding:24px;background:var(--dru-overlay)}",
209
+ ".dru-standalone-card{width:min(760px,100%);max-height:88vh;overflow:auto;box-sizing:border-box;padding:18px 20px 22px;border:1px solid var(--dru-border);border-radius:14px;background:var(--dru-surface-2);color:var(--dru-fg);box-shadow:0 18px 60px var(--dru-shadow)}",
210
+ ".dru-standalone-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}",
211
+ ".dru-standalone-title{font-size:16px;font-weight:700}",
212
+ ".dru-standalone-close{appearance:none;border:1px solid var(--dru-border-ctl);background:var(--dru-surface-2);color:var(--dru-fg-muted);width:30px;height:30px;border-radius:8px;font-size:18px;line-height:1;cursor:pointer}",
213
+ ".dru-standalone-close:hover{background:var(--dru-hover);color:var(--dru-fg)}",
214
+ "@media (max-width:640px){.dru-standalone-overlay{padding:8px}.dru-standalone-card{max-height:94vh;border-radius:12px;padding:14px 14px 18px}}",
205
215
  ".dru-settings-head{display:flex;align-items:center;gap:10px;padding:6px 2px 2px}",
206
216
  ".dru-settings-icon{font-size:24px;line-height:1;flex:none}",
207
217
  // 标题/副标题优先沿用宿主语义令牌(自带深浅两套),取不到再退回本插件令牌
@@ -1117,6 +1127,61 @@ window.__ModuleLoader__.load({
1117
1127
  0.2 实测该槽就在侧栏底部、且**当前是空的**)—— 位置、宽度、折叠态全由宿主负责。
1118
1128
  所以这里不再注入任何 DOM,直接注册进槽位。id 仍保留 `dru-nav-remote`:
1119
1129
  公告徽标 / 首次红点那套按 id 取节点的既有逻辑因此不用改。 */
1130
+ /* 📱 独立「远程访问」弹层(2026-10-25 用户拍板):
1131
+ 桌面端点击侧栏入口时,不再去"点官方设置/找栏目"(宿主一改版就点错或没反应,
1132
+ 实测会点到左上角「更多→浏览插件」),而是弹出我们自己的一份设置页。
1133
+ 「设置 → 远程访问」栏目保留,正常从官方设置页进入的用户仍走那条路。
1134
+ 实现上用 shell.overlay 槽(宿主最上层,不受侧栏容器裁剪),组件常驻、按事件开关。 */
1135
+ var standaloneOverlayMounted = false;
1136
+ function openRemoteStandalonePanel() {
1137
+ try { window.dispatchEvent(new CustomEvent("dsh-remote:open-standalone")); } catch (e) { /* 忽略 */ }
1138
+ }
1139
+ function RemoteStandaloneOverlay() {
1140
+ var st = useState(false);
1141
+ var open = st[0];
1142
+ var setOpen = st[1];
1143
+ useEffect(function () {
1144
+ standaloneOverlayMounted = true;
1145
+ function onOpen() { try { setOpen(true); } catch (e) { /* 忽略 */ } }
1146
+ function onKey(e) {
1147
+ if (!e) return;
1148
+ if (e.key === "Escape" || e.keyCode === 27) { try { setOpen(false); } catch (e2) { /* 忽略 */ } }
1149
+ }
1150
+ try {
1151
+ window.addEventListener("dsh-remote:open-standalone", onOpen);
1152
+ window.addEventListener("keydown", onKey);
1153
+ } catch (e3) { /* 忽略 */ }
1154
+ return function () {
1155
+ standaloneOverlayMounted = false;
1156
+ try {
1157
+ window.removeEventListener("dsh-remote:open-standalone", onOpen);
1158
+ window.removeEventListener("keydown", onKey);
1159
+ } catch (e4) { /* 忽略 */ }
1160
+ };
1161
+ }, []);
1162
+ if (!open) return null;
1163
+ var dark = false;
1164
+ try { dark = !!document.body && document.body.hasAttribute("data-ds-dark-theme"); } catch (e5) { /* 忽略 */ }
1165
+ return h("div", {
1166
+ className: "dru-standalone-overlay",
1167
+ role: "dialog",
1168
+ "aria-modal": "true",
1169
+ "aria-label": "远程访问",
1170
+ onClick: function (e) { if (e && e.target === e.currentTarget) setOpen(false); }
1171
+ },
1172
+ h("div", { className: "dru-standalone-card", "data-dru-theme": dark ? "dark" : "light" },
1173
+ h("div", { className: "dru-standalone-head" },
1174
+ h("b", { className: "dru-standalone-title" }, "📱 远程访问"),
1175
+ h("button", {
1176
+ type: "button",
1177
+ className: "dru-standalone-close",
1178
+ "aria-label": "关闭",
1179
+ onClick: function () { setOpen(false); }
1180
+ }, "×")),
1181
+ h(RemoteControlSection, { standalone: true })
1182
+ ));
1183
+ }
1184
+
1120
1185
  function RemoteNavEntry(props) {
1121
1186
  var wide = !(props && props.wide === false);
1122
1187
  var seenArr = useState(false);
@@ -1133,12 +1198,15 @@ window.__ModuleLoader__.load({
1133
1198
  try { e.preventDefault(); } catch (err) { /* 忽略 */ }
1134
1199
  setClicked(true);
1135
1200
  dotMarkSeen(); // 用过入口 = 已了解位置 → 收起首次红点
1136
- // 2026-10-25(用户实测「点不动、只能从更多→设置里打开」):
1137
- // 不再依赖 remoteNavOpen 的赋值时序/是否被调用过,直接走内部打开链;
1138
- // 打开链内部自带兜底:侧栏候选 → 官方快捷键 → 更多/账号菜单 → 栏目点击。
1201
+ // 2026-10-25(用户拍板):优先弹**我们自己的独立设置页**(不再依赖官方设置面板 DOM);
1202
+ // 只有宿主没有 shell.overlay 槽(极老版本)时才退回旧的"打开官方设置栏目"链路。
1139
1203
  try {
1140
- if (typeof remoteNavOpen === "function") remoteNavOpen();
1141
- else openRemoteSettings();
1204
+ openRemoteStandalonePanel();
1205
+ setTimeout(function () {
1206
+ if (!standaloneOverlayMounted) {
1207
+ try { openRemoteSettings(); } catch (e2) { /* 忽略 */ }
1208
+ }
1209
+ }, 150);
1142
1210
  } catch (errOpen) { /* 绝不因打开失败抛到宿主 */ }
1143
1211
  }
1144
1212
  }, [
@@ -1198,6 +1266,7 @@ window.__ModuleLoader__.load({
1198
1266
  * 之所以是模块级的:拉取发生在 apply() 里(组件还没挂载),而消费方有两个
1199
1267
  * (设置面板的卡片 / shell.overlay 上的弹窗),模块级 store 才能让两边看到同一份数据。
1200
1268
  */
1269
+ var annRetryCount = 0; // 公告首次拉取瞬态失败的有界重试计数(成功即清零)
1201
1270
  var annState = {
1202
1271
  ok: false, // 拉取成功且结构是我们认识的那一种(老服务端 404 / 结构不符 → 一直是 false)
1203
1272
  bubble: false, // bubble_enabled === true 才置真(字段缺失一律当 false = fail closed)
@@ -1360,6 +1429,7 @@ window.__ModuleLoader__.load({
1360
1429
  var norm = annNormalize(b);
1361
1430
  if (!norm) { annState.ok = false; annState.bubble = false; annState.items = []; annState.unread = 0; annEmit(); return false; }
1362
1431
  annState.ok = true;
1432
+ annRetryCount = 0;
1363
1433
  annState.bubble = norm.bubble;
1364
1434
  annState.items = norm.items;
1365
1435
  annState.unread = norm.unread;
@@ -1368,13 +1438,24 @@ window.__ModuleLoader__.load({
1368
1438
  }
1369
1439
  annEmit();
1370
1440
  return true;
1371
- }).catch(function () {
1441
+ }).catch(function (err) {
1372
1442
  // 404(老服务端)/ 不可达 / 超时:fail closed —— 不显示入口、不弹窗,**绝不抛**
1373
1443
  annState.ok = false;
1374
1444
  annState.bubble = false;
1375
1445
  annState.items = [];
1376
1446
  annState.unread = 0;
1377
1447
  annEmit();
1448
+ // 2026-10-25(用户反馈「公告板块没了」):dsh 重启后页面常常比插件宿主路由先就绪,
1449
+ // 首次拉取失败一次,整页(sessionStorage 一次性标记)就再也没有公告入口。
1450
+ // 这里只对**瞬态失败**做有界重试(最多 2 次、间隔 1.5s/3s);404 明确是老服务端,不重试。
1451
+ // 注意:这只发生在**失败后**,成功路径仍然严格"每次页面加载只拉一次"。
1452
+ var st = Number(err && (err.status || err.statusCode));
1453
+ if (st !== 404 && annRetryCount < 2) {
1454
+ annRetryCount += 1;
1455
+ try {
1456
+ setTimeout(function () { annFetch({ openPopup: false }); }, 1500 * annRetryCount);
1457
+ } catch (e2) { /* 忽略 */ }
1458
+ }
1378
1459
  return false;
1379
1460
  });
1380
1461
  }
@@ -5264,8 +5345,12 @@ window.__ModuleLoader__.load({
5264
5345
  function renderAnnouncementsCard() {
5265
5346
  if (!annState.ok || !annState.bubble) return null;
5266
5347
  var items = annState.items;
5267
- if (!items.length) return null;
5268
5348
  var unread = annState.unread;
5349
+ // 2026-10-25:列表为空时**保留板块**(显示「暂无公告」)而不是整卡消失 ——
5350
+ // 板块本身是用户确认"公告功能还在"的锚点,静默消失会被当成功能坏了。
5351
+ if (!items.length) {
5352
+ return card("📣 公告", [h("div", { className: "dru-hint" }, "暂无公告")]);
5353
+ }
5269
5354
  return card("📣 公告" + (unread > 0 ? "(" + unread + " 条未读)" : ""), [
5270
5355
  h("div", { className: "dru-ann-list" }, items.map(function (it) {
5271
5356
  return h("button", {
@@ -6136,6 +6221,13 @@ window.__ModuleLoader__.load({
6136
6221
  // 公告是锦上添花,**没有任何资格**把门关上 —— 任何异常都只是"这次没有弹窗"。
6137
6222
  }
6138
6223
 
6224
+ // 📱 独立「远程访问」弹层(入口点击用;见 RemoteStandaloneOverlay 注释)
6225
+ try {
6226
+ ctx.slots.inject("shell.overlay", function () {
6227
+ return ctx.slots.register({ name: "shell.overlay", id: "dsh-remote-standalone", order: 95 }, RemoteStandaloneOverlay);
6228
+ });
6229
+ } catch (eStand) { /* 老宿主没有 shell.overlay:入口会在 150ms 后回退到官方设置栏目链路 */ }
6230
+
6139
6231
  // 📣 公告:每次页面加载**只拉一次**(sessionStorage 一次性标记,见 annPullOnce)。
6140
6232
  // 放在 apply() 里是刻意的:apply 跑在 app mount **之前**,所以这里**绝不能碰产品 DOM**
6141
6233
  // (那时还没有),只做数据拉取;UI 全部交给上面那个槽位与面板卡片。
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-remote-web",
3
- "version": "0.7.6-beta.8",
3
+ "version": "0.7.6",
4
4
  "description": "公网远程控制 DeepSeek Harness(dsh web):安装即得专属加密地址,人在外面也能用手机访问电脑上的 dsh——无需同一局域网/WiFi、无需公网 IP 与内网穿透,全程加密;手机端 100% 还原电脑体验(对话/工具/审批/设置)。技术用户可选自建服务,流量走自己的服务器。Remote control DeepSeek Harness (dsh web) from anywhere over the public internet — install, get an encrypted URL, use it from your phone on any network (dual-half cordis plugin: Settings panel + same-origin /dsh-remote routes). (2026-09 由 dsh-remote-ui 更名 / renamed from dsh-remote-ui; dsh-remote 的 dsh web 插件半,不是纯 UI/皮肤插件)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -193,11 +193,13 @@ test("入口:settings.section 栏目(id/order/label)+ 侧栏底部官方
193
193
  assert.ok(String(label).includes("📱"), "栏目名应带 📱 远程访问图标(手机访问语义)");
194
194
  assert.ok(!String(label).includes("远程控制"), "栏目名不应再残留旧称「远程控制」");
195
195
 
196
- // shell.overlay 仅保留满意度弹窗,浮动面板已移除
196
+ // shell.overlay:满意度弹窗 + 公告弹窗 + 「远程访问」独立弹层(2026-10-25 新增)
197
197
  assert.ok(plugin.injects.has("shell.overlay"));
198
198
  plugin.injects.get("shell.overlay")();
199
199
  assert.ok(plugin.registered.has("dsh-feedback-popup"), "满意度弹窗应保留在 shell.overlay");
200
- assert.equal(plugin.registered.has("dsh-remote-panel"), false, "浮动配置面板不应再注册");
200
+ assert.ok(plugin.registered.has("dsh-remote-standalone"),
201
+ "入口点击要弹**独立**的远程访问设置页(不再依赖官方设置面板 DOM)");
202
+ assert.equal(plugin.registered.has("dsh-remote-panel"), false, "旧的浮动配置面板不应复活");
201
203
  });
202
204
 
203
205
  test("入口迁移:settings.section 里**只有一个**栏目(id=dsh-remote)——微信机器人不再是第二个栏目", () => {
@@ -214,17 +214,23 @@ test("★ launchd bootout 后必须等 label 摘干净再 bootstrap(否则随
214
214
  assert.match(fn, /bootok|!boot\.ok[\s\S]{0,400}launchctl bootstrap/, "bootstrap 失败应重试一次再兜底");
215
215
  });
216
216
 
217
- test("★ 自启动配置里可以钉住上游(多 profile 时代,各宿主会互抢 .dsh-upstream)", () => {
217
+ test("★ 自启动配置**默认不钉**上游端口;仅在 DSH_BRIDGE_PIN_UPSTREAM=1 时显式 opt-in", () => {
218
+ // 2026-10-25 事故:把安装时的动态端口写进 launchd plist 后,dsh 每次重启换端口,
219
+ // 守护/桥就永远连旧端口(upstream_unreachable / 设备掉线)。所以默认改为不钉。
218
220
  const src = readFileSync(SETUP, "utf8");
219
221
  assert.match(src, /function desktopAppPort\(/, "要有桌面端端口探测(lsof -c DeepSeek)");
220
- assert.match(src, /PINNED_UPSTREAM/, "要有钉住上游的机制");
221
- // plist 模板里必须把它写进 EnvironmentVariables(环境变量优先级高于 .dsh-upstream 文件)
222
+ assert.match(src, /DSH_BRIDGE_PIN_UPSTREAM/, "要有显式 opt-in 开关(部署方需要固定上游时用)");
223
+ // plist 模板仍支持写 DSH_BRIDGE_UPSTREAM(opt-in 时),但默认 PINNED_UPSTREAM 必须为空
222
224
  assert.match(src, /DSH_BRIDGE_UPSTREAM<\/key><string>\$\{PINNED_UPSTREAM\}/,
223
- "plist 里要写入 DSH_BRIDGE_UPSTREAM,否则两端宿主会互相覆盖上游");
224
- // ⚠️ 顺序:必须在写自启动文件**之前**算出来,否则 plist 里带不上(实测踩到过)
225
- const pinAt = src.indexOf("PINNED_UPSTREAM = `http://127.0.0.1:${p}`");
225
+ "opt-in 时 plist 仍要能写入 DSH_BRIDGE_UPSTREAM");
226
+ // 关键回归锁:安装流程里不能再出现「把探测到的端口赋给 PINNED_UPSTREAM」
227
+ assert.doesNotMatch(src, /PINNED_UPSTREAM = `http:\/\/127\.0\.0\.1:\$\{p\}`/,
228
+ "不得再把动态端口回填进 PINNED_UPSTREAM(否则又会写进 plist,dsh 换端口即掉线)");
229
+ // 运行时端口仍必须写进 .dsh-upstream(守护/桥按它取最新端口)
230
+ assert.match(src, /UPSTREAM_FILE\)[^\n]*\n/);
231
+ const writeFileAt = src.indexOf("fs.writeFileSync(path.join(CONFIG_DIR, UPSTREAM_FILE)");
226
232
  const svcAt = src.indexOf("svc = installAutostart()");
227
- assert.ok(pinAt > 0 && svcAt > 0 && pinAt < svcAt, "钉定必须发生在 installAutostart() 之前");
233
+ assert.ok(writeFileAt > 0 && svcAt > 0 && writeFileAt < svcAt, "运行时端口文件要在 installAutostart() 之前写好");
228
234
  });
229
235
 
230
236
  test("★ 桌面应用在运行时,绝不改写它的 profile(否则应用会自己退出/重启)", () => {
@@ -467,8 +467,8 @@ test("主题不变量:根节点带 .dru-settings-section + data-dru-theme;
467
467
  assert.doesNotMatch(block, /--dru-[a-z0-9-]+\s*:/, "新样式不得**声明**令牌(只许引用)");
468
468
  assert.doesNotMatch(block, /:root|\bbody\b/, "新样式不得挂在 :root/body 上(会污染整个 GUI)");
469
469
  assert.match(block, /var\(--dru-/, "新样式应复用既有令牌");
470
- // 令牌声明只允许出现在那三个选择器上(原有注释所述的不变量)
471
- assert.match(SOURCE, /"\.dru-settings-section,\.dru-popup,\.dru-nav-remote\{"/, "亮色令牌块的选择器不得扩大");
470
+ // 令牌声明只允许出现在那四个选择器上(2026-10-25 新增 .dru-standalone-card:独立远程访问弹层)
471
+ assert.match(SOURCE, /"\.dru-settings-section,\.dru-popup,\.dru-nav-remote,\.dru-standalone-card\{"/, "亮色令牌块的选择器不得再扩大");
472
472
  assert.doesNotMatch(SOURCE, /":root\{/);
473
473
  });
474
474