dsh-plugin-weapp-gateway 0.8.41 → 0.8.48

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
@@ -6,6 +6,48 @@
6
6
 
7
7
  `dsh-plugin-weapp-gateway` · DeepSeek Harness 移动客户端连接插件
8
8
 
9
+ ### v0.8.48 · 配对界面拆分为两个模块(App 连接修复)
10
+
11
+ - 「连接与配对」拆成两个独立模块,避免把小程序中继码当 App 码用:
12
+ - **小程序连接(推荐)**:自动选择 / 鲸尾公网 · 小程序,独立的中继状态与「生成小程序二维码」按钮;
13
+ - **App 直连(备用)**:局域网直连 / Cloudflare 外网 / Tailscale 私有网络 / 公网或其他手动地址,统一的配对入口地址与「生成 App 二维码」按钮(上游插件的直连方式)。
14
+ - 两个模块各自生成二维码、各自维护地址与按钮状态,互不影响;中继信息块只出现在小程序模块,App 模块不再出现鲸尾公网内容。
15
+ - 协议层排查:本机复现 App 配对(LAN 入口 `dsh-pair` 握手 → `paired`/`hello` v3 → token 重连)正常;LAN / 自定义地址 / Tailscale / Cloudflare 四种 App 路线均返回 201 的 v2 直连载荷。此前 App 连不上最可能的原因是扫了「鲸尾公网 · 小程序」的中继专用码(v3,App 无法使用)。
16
+ - 渲染测试与帮助文案同步;全量测试通过。
17
+ ### v0.8.47 · 手动地址方案不再显示鲸尾公网内容
18
+
19
+ - 中继信息块(「鲸尾公网服务 · 已注册」、中继连接器状态、单独中继二维码提示)只在「自动选择」和「鲸尾公网 · 小程序」方案下显示;「公网或其他手动地址」「局域网直连」「Cloudflare 外网」「Tailscale 私有网络」方案不再出现鲸尾公网相关内容。
20
+ - 切换到「公网或其他手动地址」时不再继承中继地址:有已配置的公网 WSS 入口则预填该地址,否则留空等待填写。
21
+ - 「鲸尾公网 · 小程序」方案下配对入口地址只读(地址由注册信息决定);需要自定义地址时改选「公网或其他手动地址」。自动选择的载荷与行为不变。
22
+ ### v0.8.46 · 一键清除离线设备
23
+
24
+ - 「可信设备」新增 **一键清除离线设备(N)**:一次性吊销当前所有离线设备(确认后执行),在线设备不受影响;清除后这些设备需要重新配对才能连接。
25
+ - 新增仅回环管理接口 `POST /mgw/devices/revoke-offline`,返回 `{ removed, count }`;在线连接断开后的设备会被计入离线集合。
26
+ - 测试:auth 集成测试覆盖「关闭连接 → 标记离线 → 一键吊销 → 设备列表无残留」全流程;渲染测试断言按钮与离线数量。全量测试通过。
27
+ ### v0.8.45 · 恢复「鲸尾公网 · 小程序」方案
28
+
29
+ - 去掉 v0.8.44 加入的「公网入口 + 优先 P2P(建设中)」占位项。
30
+ - 恢复「鲸尾公网 · 小程序」独立方案(未注册时禁用):选中即切换服务端配对模式并生成中继专用二维码;帮助气泡、注册提示与文档同步恢复,保存的 relay 配对模式重新作为默认方案(与整合前一致)。
31
+ - 「连接方案」其余选项保持 v0.8.44 的整合结果:自动选择 / 局域网直连 / Cloudflare 外网 / Tailscale 私有网络 / 公网或其他手动地址,统一地址输入框不变。全量测试通过。
32
+ ### v0.8.44 · 配对选项整合(对齐上游「连接方案」)
33
+
34
+ - 「配对连接方式」更名为「连接方案」,选项按上游整合:**自动选择 / 局域网直连 / 公网入口 + 优先 P2P(建设中,禁用)/ Cloudflare 外网 / Tailscale 私有网络 / 公网或其他手动地址**。
35
+ - 去掉独立的「鲸尾公网 · 小程序」选项:已注册的中继由「自动选择」自动带上(小程序仍优先使用中继);旧保存的 relay 配对模式在面板打开时自动迁回 direct,保证自动选择继续生成含公网/局域网/中继的多路载荷。
36
+ - 所有方案共用统一的「配对入口地址」输入框(与上游一致):编辑即切到「公网或其他手动地址」;Tailscale 方案下该输入框变为主机 Tailscale 地址,保留裸 IP 自动补全与校验。
37
+ - 帮助气泡按上游重写;Tailscale 方案下隐藏局域网状态行(上游样式)。自动选择、局域网、Cloudflare、Tailscale 的配对载荷与鉴权逻辑均未改动。
38
+ ### v0.8.43 · 安装页移除与侧边栏开关
39
+
40
+ - 暂时移除「安装应用」分组:左侧栏保留 4 个分组(通用设置 / 连接与配对 / 可信设备 / 网络检测)。
41
+ - 「通用设置」新增「在左侧栏显示入口」开关:控制 Harness 侧边栏底部「鲸尾移动设备」按钮是否显示;偏好持久化到独立的 `0600` UI 状态文件,关闭后仍可从设置页打开并重新开启。
42
+ - 配对方式中的 **Tailscale 直连** 改为常显:检测到本机 Tailscale 地址时自动填入;没有检测到时可直接填写运行网关这台主机的 Tailscale IP(`100.x.x.x`,IPv6 用方括号),提交时自动补成 `ws://<ip>:3081/ws/mobile`;局域网入口未监听时选项禁用。
43
+ - 管理接口新增 `GET/POST /mgw/ui`(仅回环,`sidebarEntry` 布尔值);新增 `test/ui-state.test.mjs` 与 auth 集成断言。全量测试通过。
44
+ ### v0.8.42 · 同步上游面板结构
45
+
46
+ - 左侧栏分组补齐为上游的 5 项:**通用设置 / 连接与配对 / 可信设备 / 网络检测 / 安装应用**;「服务端网络检测」从通用设置移到独立的「网络检测」分组。
47
+ - 新增「安装应用」分组:iOS(TestFlight 公测 + App Store 安装 TestFlight)与 Android(APK 下载 / Release 页)分页引导,自动读取官方 Release 最新版本(GitHub API + 本地 6 小时缓存);不内置上游的大体积截图,保留步骤、按钮与版本信息。
48
+ - 新增上游的**侧边栏入口**:Harness WebUI 侧边栏底部「鲸尾移动设备」按钮 + `shell.overlay` 弹窗,与设置页入口共享同一 open 状态;设置页入口保留。
49
+ - 配对方式中的 Tailscale 直连选项沿用 v0.8.41(检测到地址且局域网入口监听时可用)。
50
+ - 渲染测试同步更新(三个 slot 注册、5 个分组、安装引导内容),全量测试保持通过。
9
51
  ### v0.8.41 · Tailscale 参与配对选路
10
52
 
11
53
  - 「配对连接方式」新增 **Tailscale 直连**:只使用本机 Tailscale 地址(`ws://100.x` / IPv6),二维码只包含 Tailscale 端点,不泄露公网或中继;检测不到地址或局域网入口未监听时该选项禁用。
@@ -312,7 +354,7 @@ dsh web
312
354
  1. 在 WebUI 的「设置」中打开“鲸尾网关助手”。
313
355
  2. 将“网关运行模式”设为“常驻开启”(短期配对也可选“临时开启”)。
314
356
  3. 保持“设备鉴权”开启。
315
- 4. 在“配对连接方式”选择“局域网直连”,确认 WebSocket 地址为 `ws://<电脑局域网 IP>:3081/ws/mobile`。即使 Cloudflare Tunnel 已开启,也无需关闭它。选择框旁的问号会按当前网关环境解释各入口并给出场景建议,不会自动更改选择。
357
+ 4. 在「连接方案」选择「局域网直连」,确认配对入口地址为 `ws://<电脑局域网 IP>:3081/ws/mobile`。即使 Cloudflare Tunnel 已开启,也无需关闭它。选择框旁的问号会按当前网关环境解释各入口并给出场景建议,不会自动更改选择。
316
358
  5. 填写设备名称并点击“生成配对二维码”。
317
359
  6. 在 DSH App 或鲸尾小程序扫描二维码。
318
360
  7. WebUI 的可信设备显示“在线”后即完成。
@@ -382,7 +424,7 @@ http://127.0.0.1:<本地端口>
382
424
 
383
425
  二维码只能使用一次,并会在 5 分钟后过期;超时后在 WebUI 重新生成即可。
384
426
  “自动选择”会生成带 `routes` 分类路由表的二维码,客户端按自身能力自动选路:DSH App 依次尝试上次连通地址、公网 WSS、局域网;小程序依次尝试上次连通地址、已注册的鲸尾中继(小程序的公网)、局域网——小程序不拨 Cloudflare/反代公网直连,因为这些域名不在小程序 socket 合法域名里。
385
- 原有“鲸尾公网 · 小程序”专用中继配对选项也保留:需要强制使用鲸尾中继、且二维码只给小程序使用时选择它;想用同一张码配对 App 和小程序时选择自动模式。
427
+ 原有「鲸尾公网 · 小程序」专用中继配对选项也保留:需要强制使用鲸尾中继、且二维码只给小程序使用时选择它;想用同一张码配对 App 和小程序时选择「自动选择」。
386
428
 
387
429
  ## Windows / macOS 家用电脑远程连接
388
430
 
@@ -392,7 +434,7 @@ http://127.0.0.1:<本地端口>
392
434
 
393
435
  ### Cloudflare Quick Tunnel(一键临时接入)
394
436
 
395
- 在「鲸尾网关助手 → 连接与配对」展开 Cloudflare 外网设置,选择「Quick Tunnel · 无需域名」并点击「一键开启」。面板连接后会取得随机的 `wss://<名称>.trycloudflare.com/ws/mobile`。生成“自动选择”二维码后,DSH App 会自动尝试公网 WSS 与局域网候选地址;小程序则走鲸尾中继或局域网。原有“鲸尾公网 · 小程序”专用中继选项仍可单独使用。关闭开关会停止隧道;DSH 再次启动时会恢复已开启的 Quick 模式并取得**新的随机地址**。
437
+ 在「鲸尾网关助手 → 连接与配对」展开 Cloudflare 外网设置,选择「Quick Tunnel · 无需域名」并点击「一键开启」。面板连接后会取得随机的 `wss://<名称>.trycloudflare.com/ws/mobile`。生成“自动选择”二维码后,DSH App 会自动尝试公网 WSS 与局域网候选地址;小程序则走鲸尾中继或局域网。原有「鲸尾公网 · 小程序」专用中继选项仍可单独使用。关闭开关会停止隧道;DSH 再次启动时会恢复已开启的 Quick 模式并取得**新的随机地址**。
396
438
 
397
439
  Quick Tunnel 无需 Cloudflare 账户、Token 或自己的公网域名,但地址在 DSH 重启或隧道重连后可能变化。若隧道地址变化,重新生成二维码供 DSH App 或小程序配对;**仅凭 PC 在线不能保证旧地址继续可用**。Cloudflare 将 Quick Tunnel 定位于测试和开发,当前有并发请求上限且不提供可用性保证。参见 [Cloudflare Quick Tunnel 文档](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/do-more-with-tunnels/trycloudflare/)。
398
440
 
@@ -4,11 +4,11 @@
4
4
 
5
5
  ## App 与小程序同时连接
6
6
 
7
- “配对连接方式”仅决定**新生成的配对码**使用直连地址还是鲸尾公网中继,不限制当前网关接受的客户端类型,也不会关闭已建立的 WebSocket。已注册的鲸尾公网连接器在切换到直连配对后仍会保持运行;网关重启后也会根据已保存的中继注册信息恢复连接器。因此 App 可用直连地址配对,同时小程序继续使用原有中继连接。
7
+ “连接方案”仅决定**新生成的配对码**使用哪种入口(直连地址 / Cloudflare / Tailscale / 手动地址),不限制当前网关接受的客户端类型,也不会关闭已建立的 WebSocket。已注册的鲸尾公网连接器在切换到直连配对后仍会保持运行;网关重启后也会根据已保存的中继注册信息恢复连接器。因此 App 可用直连地址配对,同时小程序继续使用原有中继连接。
8
8
 
9
9
  新版管理页的“自动选择”会生成一个兼容双端的 v2 二维码:除顶层 `publicUrl` 与 `endpoints`(公网优先、局域网在后)外,还带可选的 `routes` 分类路由表(`lan` / `public` / `relay`)。客户端按自身能力自动选路:**小程序**第一候选是上次连通的地址,其后走已注册的鲸尾中继(小程序的公网)、再局域网,不拨 Cloudflare/反代公网直连(其域名不在小程序 socket 合法域名里,硬连只会失败);**DSH App** 走公网直连、再局域网,不使用中继。选择“局域网直连”则二维码只包含局域网候选地址。
10
10
 
11
- 原有“鲸尾公网 · 小程序”选项继续保留,用于强制生成仅供小程序使用的鲸尾中继二维码;它不包含 App 使用的局域网直连字段。需要一张二维码同时兼容 App 和小程序时,选择“自动选择”。
11
+ 原有「鲸尾公网 · 小程序」选项继续保留,用于强制生成仅供小程序使用的鲸尾中继二维码;它不包含 App 使用的局域网直连字段。需要一张二维码同时兼容 App 和小程序时,选择「自动选择」。
12
12
 
13
13
  公网入口可供 App 和小程序使用,服务端仍要求设备鉴权;完整二维码包含一次性配对码,属于敏感凭据,不要公开分享二维码或 Base64URL 字符串。
14
14
 
package/lib/client.js CHANGED
@@ -20,6 +20,22 @@ window.__ModuleLoader__.load({
20
20
  }
21
21
  const getOpen = () => open
22
22
 
23
+ // 侧边栏入口开关:由管理接口 /mgw/ui 持久化;apply() 时读取一次,
24
+ // 面板内切换后立即通知侧边栏按钮显示/隐藏。
25
+ let sidebarEntry = true
26
+ const sidebarListeners = new Set()
27
+ const getSidebarEntry = () => sidebarEntry
28
+ const setSidebarEntry = (value) => {
29
+ const next = value !== false
30
+ if (next === sidebarEntry) return
31
+ sidebarEntry = next
32
+ for (const listener of sidebarListeners) listener()
33
+ }
34
+ const subscribeSidebar = (listener) => {
35
+ sidebarListeners.add(listener)
36
+ return () => sidebarListeners.delete(listener)
37
+ }
38
+
23
39
  // Shared Web UI / Desktop semantic tokens update with the host theme.
24
40
  const restartNoticeStorageKey = 'mobile-gateway-dismissed-restart-notice'
25
41
  let dismissedRestartInstance = null
@@ -342,6 +358,38 @@ window.__ModuleLoader__.load({
342
358
  return tunnelUrl || statusUrl || lanUrl || inferredUrl(status.wsPath)
343
359
  }
344
360
 
361
+ // 从手动输入里取主机:支持 `100.x.x.x`、`ws://100.x.x.x:3081/ws/mobile`、
362
+ // 以及带方括号的 IPv6。用于 Tailscale 路线的手动填写校验与补全。
363
+ function tailscaleHostOf(value) {
364
+ let raw = String(value || '').trim()
365
+ if (!raw) return ''
366
+ raw = raw.replace(/^(?:wss?|https?):\/\//i, '')
367
+ raw = raw.split(/[/?#]/)[0]
368
+ raw = raw.replace(/^\[|\]$/g, '')
369
+ return raw.replace(/:\d+$/, '')
370
+ }
371
+
372
+ function isTailscaleInput(value) {
373
+ const host = tailscaleHostOf(value)
374
+ if (!host) return false
375
+ const octets = host.split('.').map(Number)
376
+ if (octets.length === 4 && octets.every((part) => Number.isInteger(part) && part >= 0 && part <= 255)) {
377
+ return octets[0] === 100 && octets[1] >= 64 && octets[1] <= 127
378
+ }
379
+ return /^fd7a:115c:a1e0:/i.test(host)
380
+ }
381
+
382
+ // 手动输入的裸 IP 补成 ws://<ip>:<lanPort><wsPath>;已是 URL 的原样返回。
383
+ function tailscaleEndpointOf(value, status) {
384
+ const raw = String(value || '').trim()
385
+ if (!raw) return ''
386
+ if (/^(?:wss?|https?):\/\//i.test(raw)) return raw
387
+ const port = status?.lan?.port || 3081
388
+ const wsPath = status?.wsPath || '/ws/mobile'
389
+ const host = raw.includes(':') ? `[${raw.replace(/^\[|\]$/g, '')}]` : raw
390
+ return `ws://${host}:${port}${wsPath}`
391
+ }
392
+
345
393
  function connectionAdvice(status, publicSetup) {
346
394
  if (!status) return { detected: '正在读取网关环境…', local: '', remote: '' }
347
395
  const system = status.platform === 'darwin' ? 'macOS 电脑' : status.platform === 'win32' ? 'Windows 电脑' : status.platform === 'linux' ? 'Linux 服务器' : '当前设备'
@@ -490,13 +538,17 @@ window.__ModuleLoader__.load({
490
538
  }
491
539
 
492
540
  function DevicePanel() {
541
+ // 侧边栏入口开关:与侧边栏按钮共享同一状态(切换后立即生效)。
542
+ const sidebarOn = React.useSyncExternalStore(subscribeSidebar, getSidebarEntry, () => true)
493
543
  const [activeSection, setActiveSection] = React.useState('general')
494
544
  const [devices, setDevices] = React.useState(null)
495
545
  const [showAllDevices, setShowAllDevices] = React.useState(false)
496
546
  const [status, setStatus] = React.useState(null)
497
547
  const [dismissedNotice, setDismissedNotice] = React.useState(() => dismissedRestartInstance)
498
- const [publicUrl, setPublicUrl] = React.useState('')
499
- const [pairingRoute, setPairingRoute] = React.useState('auto')
548
+ // 两个配对模块各自维护方案:小程序(主用)与 App 直连(备用)。
549
+ const [appUrl, setAppUrl] = React.useState('')
550
+ const [miniPlan, setMiniPlan] = React.useState('auto')
551
+ const [appRoute, setAppRoute] = React.useState('lan')
500
552
  const [connectionHelpOpen, setConnectionHelpOpen] = React.useState(false)
501
553
  const [toolsOpen, setToolsOpen] = React.useState(false)
502
554
  const [toolBusy, setToolBusy] = React.useState(false)
@@ -559,10 +611,15 @@ window.__ModuleLoader__.load({
559
611
  const [deviceNotice, setDeviceNotice] = React.useState(null)
560
612
  const [deviceNoticeError, setDeviceNoticeError] = React.useState(false)
561
613
  const [revokingIds, setRevokingIds] = React.useState(() => new Set())
614
+ const [sidebarBusy, setSidebarBusy] = React.useState(false)
615
+ const [offlineClearing, setOfflineClearing] = React.useState(false)
616
+
562
617
  const revokingIdsRef = React.useRef(new Set())
563
- const automaticUrlRef = React.useRef('')
564
- const pairingRouteRef = React.useRef('auto')
565
- const pairingRouteSelectedRef = React.useRef(false)
618
+ const manualAppUrlRef = React.useRef(false)
619
+ const appUrlRef = React.useRef('')
620
+ const appRouteRef = React.useRef('lan')
621
+ const appRouteChosenRef = React.useRef(false)
622
+ const miniChosenRef = React.useRef(false)
566
623
  const cloudflareModeLoadedRef = React.useRef(false)
567
624
 
568
625
  const refresh = React.useCallback(async () => {
@@ -594,18 +651,15 @@ window.__ModuleLoader__.load({
594
651
  cloudflareModeLoadedRef.current = true
595
652
  setCloudflareMode(statusData.cloudflare.mode || 'quick')
596
653
  }
597
- // Adopt the saved legacy mode only until the operator makes a choice;
598
- // polling must not overwrite an in-progress route change.
599
- if (!pairingRouteSelectedRef.current) {
600
- const savedRoute = statusData.pairingMode === 'relay' ? 'relay' : 'auto'
601
- pairingRouteRef.current = savedRoute
602
- setPairingRoute(savedRoute)
603
- }
604
- if (pairingRouteRef.current !== 'custom') {
605
- const preferredUrl = pairingUrlFor(pairingRouteRef.current, statusData)
606
- if (automaticUrlRef.current && preferredUrl !== automaticUrlRef.current) setQr(null)
607
- automaticUrlRef.current = preferredUrl
608
- setPublicUrl(preferredUrl)
654
+ // 小程序方案只在首次加载时按保存的配对模式选择,之后不覆盖运营者选择。
655
+ if (!miniChosenRef.current) setMiniPlan(statusData.pairingMode === 'relay' ? 'relay' : 'auto')
656
+ // App 模块地址跟随环境刷新;自定义地址与手动填写的 Tailscale 地址不被覆盖。
657
+ if (appRouteRef.current !== 'custom'
658
+ && !(appRouteRef.current === 'tailscale' && manualAppUrlRef.current)) {
659
+ const preferredUrl = pairingUrlFor(appRouteRef.current, statusData)
660
+ if (appUrlRef.current && preferredUrl !== appUrlRef.current) setQr(null)
661
+ appUrlRef.current = preferredUrl
662
+ setAppUrl(preferredUrl)
609
663
  }
610
664
  return true
611
665
  } catch (cause) {
@@ -762,6 +816,7 @@ window.__ModuleLoader__.load({
762
816
  return () => { active = false; window.clearInterval(timer) }
763
817
  }, [refresh])
764
818
 
819
+
765
820
  React.useEffect(() => {
766
821
  if (!qr) return
767
822
  const previousFocus = document.activeElement
@@ -769,41 +824,25 @@ window.__ModuleLoader__.load({
769
824
  return () => previousFocus?.focus()
770
825
  }, [qr])
771
826
 
772
- const changePairingMode = async (mode) => {
773
- setBusy(true)
774
- setError(null)
775
- try {
776
- const data = await request('/mgw/mode', {
777
- method: 'POST',
778
- headers: { 'Content-Type': 'application/json' },
779
- body: JSON.stringify({ mode }),
780
- })
781
- setStatus((current) => ({ ...(current || {}), pairingMode: data.pairingMode, relay: data.relay }))
782
- } catch (cause) {
783
- setError(cause.message)
784
- } finally {
785
- setBusy(false)
786
- }
827
+
828
+ const chooseMiniPlan = (plan) => {
829
+ setQr(null)
830
+ miniChosenRef.current = true
831
+ setMiniPlan(plan)
787
832
  }
788
833
 
789
- const choosePairingRoute = (route) => {
834
+ // App 模块方案:自定义地址与手动 Tailscale 地址不随轮询覆盖。
835
+ const chooseAppRoute = (route) => {
790
836
  setQr(null)
791
- const previousRoute = pairingRouteRef.current
792
- pairingRouteSelectedRef.current = true
793
- pairingRouteRef.current = route
794
- setPairingRoute(route)
795
- if (route === 'custom') {
796
- automaticUrlRef.current = ''
797
- } else if (status) {
798
- const nextUrl = pairingUrlFor(route, status)
799
- automaticUrlRef.current = nextUrl
800
- setPublicUrl(nextUrl)
801
- }
802
- const targetMode = route === 'relay' ? 'relay' : 'direct'
803
- if (status && status.pairingMode !== targetMode &&
804
- (route === 'relay' || previousRoute === 'relay')) {
805
- void changePairingMode(targetMode)
806
- }
837
+ appRouteChosenRef.current = true
838
+ appRouteRef.current = route
839
+ setAppRoute(route)
840
+ manualAppUrlRef.current = false
841
+ const nextUrl = route === 'custom'
842
+ ? (publicSetup && publicSetup.publicUrl) || ''
843
+ : (status ? pairingUrlFor(route, status) : '')
844
+ appUrlRef.current = nextUrl
845
+ setAppUrl(nextUrl)
807
846
  }
808
847
 
809
848
  const configurePublicAccess = async () => {
@@ -817,9 +856,10 @@ window.__ModuleLoader__.load({
817
856
  body: JSON.stringify({ publicIp }),
818
857
  })
819
858
  setPublicSetup(data)
820
- if (data.publicUrl && pairingRouteRef.current === 'auto') {
821
- automaticUrlRef.current = data.publicUrl
822
- setPublicUrl(data.publicUrl)
859
+ // 手动地址模块尚未编辑时,把刚配置好的公网入口预填进去。
860
+ if (data.publicUrl && appRouteRef.current === 'custom' && !manualAppUrlRef.current) {
861
+ appUrlRef.current = data.publicUrl
862
+ setAppUrl(data.publicUrl)
823
863
  }
824
864
  } catch (cause) {
825
865
  setError(cause.message)
@@ -878,30 +918,41 @@ window.__ModuleLoader__.load({
878
918
  }
879
919
  }
880
920
 
881
- const createPairing = async (endpoint) => request('/mgw/pair', {
921
+ const requestPairing = async (body) => request('/mgw/pair', {
882
922
  method: 'POST',
883
923
  headers: { 'Content-Type': 'application/json' },
884
- body: JSON.stringify({
885
- publicUrl: endpoint,
886
- route: pairingRoute,
887
- lanUrl: lanPairingUrl(status),
888
- }),
924
+ body: JSON.stringify({ lanUrl: lanPairingUrl(status), ...body }),
889
925
  })
890
926
 
891
- const pair = async () => {
927
+ // 两个模块各自生成二维码:
928
+ // 小程序:自动选择(多路载荷,小程序优先中继)或鲸尾公网中继专用码;
929
+ // App:局域网 / Cloudflare / Tailscale / 手动地址(上游插件的直连方式)。
930
+ const pairFor = async (module) => {
892
931
  setBusy(true)
893
932
  setError(null)
894
933
  setPairingTokenCopied(false)
895
934
  try {
896
- if (pairingRoute === 'relay' && status?.pairingMode !== 'relay') {
897
- const modeData = await request('/mgw/mode', {
898
- method: 'POST',
899
- headers: { 'Content-Type': 'application/json' },
900
- body: JSON.stringify({ mode: 'relay' }),
935
+ let data
936
+ if (module === 'mini') {
937
+ if (miniPlan === 'relay') {
938
+ if (status?.pairingMode !== 'relay') {
939
+ const modeData = await request('/mgw/mode', {
940
+ method: 'POST',
941
+ headers: { 'Content-Type': 'application/json' },
942
+ body: JSON.stringify({ mode: 'relay' }),
943
+ })
944
+ setStatus((current) => ({ ...(current || {}), pairingMode: modeData.pairingMode, relay: modeData.relay }))
945
+ }
946
+ data = await requestPairing({})
947
+ } else {
948
+ data = await requestPairing({ route: 'auto' })
949
+ }
950
+ } else {
951
+ data = await requestPairing({
952
+ publicUrl: appRoute === 'tailscale' ? tailscaleEndpointOf(appUrl, status) : appUrl,
953
+ route: appRoute,
901
954
  })
902
- setStatus((current) => ({ ...(current || {}), pairingMode: modeData.pairingMode, relay: modeData.relay }))
903
955
  }
904
- const data = await createPairing(publicUrl)
905
956
  pairingIdRef.current = data.pairing?.id || null
906
957
  setQr(data)
907
958
  } catch (cause) {
@@ -998,6 +1049,49 @@ window.__ModuleLoader__.load({
998
1049
  }
999
1050
  }
1000
1051
 
1052
+ // 左侧栏入口开关:持久化到 /mgw/ui,并立即通知侧边栏按钮。
1053
+ const toggleSidebarEntry = async () => {
1054
+ if (sidebarBusy) return
1055
+ setSidebarBusy(true)
1056
+ setError(null)
1057
+ try {
1058
+ const data = await request('/mgw/ui', {
1059
+ method: 'POST',
1060
+ headers: { 'Content-Type': 'application/json' },
1061
+ body: JSON.stringify({ sidebarEntry: !sidebarOn }),
1062
+ })
1063
+ setSidebarEntry(data.sidebarEntry !== false)
1064
+ } catch (cause) {
1065
+ setError(cause.message)
1066
+ } finally {
1067
+ setSidebarBusy(false)
1068
+ }
1069
+ }
1070
+
1071
+ // 一键清除离线设备:吊销所有当前离线的已配对设备,在线设备不受影响。
1072
+ const clearOfflineDevices = async () => {
1073
+ const targets = Array.isArray(devices) ? devices.filter((device) => !device.online) : []
1074
+ if (targets.length === 0 || offlineClearing) return
1075
+ if (!window.confirm(`清除 ${targets.length} 台离线设备?清除后需要重新配对才能连接。`)) return
1076
+ setOfflineClearing(true)
1077
+ setDeviceNotice(null)
1078
+ setDeviceNoticeError(false)
1079
+ setError(null)
1080
+ try {
1081
+ const data = await request('/mgw/devices/revoke-offline', { method: 'POST' })
1082
+ const removedIds = new Set(Array.isArray(data.removed) ? data.removed : [])
1083
+ setDevices((current) => Array.isArray(current) ? current.filter((item) => !removedIds.has(item.id)) : current)
1084
+ setDeviceNotice(`已清除 ${data.count ?? removedIds.size} 台离线设备`)
1085
+ window.setTimeout(() => setDeviceNotice(null), 2200)
1086
+ } catch (cause) {
1087
+ setDeviceNoticeError(true)
1088
+ setDeviceNotice(`清除失败:${cause.message}`)
1089
+ setError(cause.message)
1090
+ } finally {
1091
+ setOfflineClearing(false)
1092
+ }
1093
+ }
1094
+
1001
1095
  const revoke = async (device) => {
1002
1096
  if (revokingIdsRef.current.has(device.id)) return
1003
1097
  setDeviceNotice(null)
@@ -1040,8 +1134,13 @@ window.__ModuleLoader__.load({
1040
1134
  // routing is carried in an optional field that older apps ignore.
1041
1135
  const relayInfo = status && status.relay ? status.relay : null
1042
1136
  const relayConnector = status && status.relayConnector ? status.relayConnector : null
1043
- const effectiveRoute = pairingRoute
1044
1137
  const cloudflareReady = !!(status?.cloudflare?.enabled && status.cloudflare.publicReady === true && status.cloudflare.publicUrl)
1138
+ // App 模块的生成按钮:入口就绪才可点,避免生成无法连接的二维码。
1139
+ const appPairingDisabled = busy || !(status && status.gatewayEnabled) ||
1140
+ (appRoute === 'custom' && !appUrl.trim()) ||
1141
+ (appRoute === 'cloudflare' && !cloudflareReady) ||
1142
+ (appRoute === 'lan' && !lanPairingUrl(status)) ||
1143
+ (appRoute === 'tailscale' && !(status?.lan?.listening && isTailscaleInput(appUrl)))
1045
1144
 
1046
1145
  const advice = connectionAdvice(status, publicSetup)
1047
1146
  const helpLine = (name, description) => React.createElement('div', { style: { marginTop: 7 } },
@@ -1115,7 +1214,7 @@ window.__ModuleLoader__.load({
1115
1214
  React.createElement('path', { d: 'M6 6l12 12M18 6L6 18' }))))),
1116
1215
  React.createElement('div', { className: 'mgw-body' },
1117
1216
  React.createElement('nav', { ref: navRef, className: 'mgw-nav', 'aria-label': '鲸尾网关助手设置分组' },
1118
- [['general', '通用设置'], ['pairing', '连接与配对'], ['devices', '可信设备']].map(([id, label]) =>
1217
+ [['general', '通用设置'], ['pairing', '连接与配对'], ['devices', '可信设备'], ['network', '网络检测']].map(([id, label]) =>
1119
1218
  React.createElement('button', { key: id, type: 'button', 'aria-current': activeSection === id ? 'page' : undefined,
1120
1219
  onClick: () => { setActiveSection(id); setConnectionHelpOpen(false); setToolsOpen(false) } }, label))),
1121
1220
  React.createElement('div', { className: 'mgw-content', key: activeSection },
@@ -1177,7 +1276,26 @@ window.__ModuleLoader__.load({
1177
1276
  status && !status.requireAuth
1178
1277
  ? React.createElement('p', { style: { ...styles.error, margin: '12px 0 0' } }, 'Debug 模式:本机 DSH 入口将跳过设备凭证校验;独立局域网入口仍强制鉴权。')
1179
1278
  : null),
1180
- React.createElement(ServerNetworkDiagnostics, null),
1279
+ React.createElement('section', { style: styles.card },
1280
+ React.createElement('div', { style: { display: 'flex', justifyContent: 'space-between', gap: 14, alignItems: 'center' } },
1281
+ React.createElement('div', null,
1282
+ React.createElement('strong', null, '在左侧栏显示入口'),
1283
+ React.createElement('div', { style: { ...styles.muted, marginTop: 4 } }, sidebarOn
1284
+ ? 'Harness 侧边栏底部显示「鲸尾移动设备」按钮;关闭后仅从设置页打开。'
1285
+ : '已隐藏侧边栏入口;可在这里重新开启。')),
1286
+ React.createElement('label', { style: { ...styles.switch, opacity: sidebarBusy ? .55 : 1 }, title: sidebarOn ? '隐藏左侧栏入口' : '在左侧栏显示入口' },
1287
+ React.createElement('input', {
1288
+ type: 'checkbox',
1289
+ role: 'switch',
1290
+ 'aria-label': '在左侧栏显示入口',
1291
+ 'aria-checked': sidebarOn,
1292
+ checked: sidebarOn,
1293
+ disabled: sidebarBusy,
1294
+ onChange: toggleSidebarEntry,
1295
+ style: styles.switchInput,
1296
+ }),
1297
+ React.createElement('span', { style: { ...styles.switchTrack, background: sidebarOn ? colors.success : colors.muted } }),
1298
+ React.createElement('span', { style: { ...styles.switchKnob, left: sidebarOn ? 21 : 3 } })))),
1181
1299
  React.createElement('section', { style: styles.card },
1182
1300
  React.createElement('div', { style: { display: 'flex', justifyContent: 'space-between', gap: 14, alignItems: 'flex-start' } },
1183
1301
  React.createElement('div', null,
@@ -1213,11 +1331,13 @@ window.__ModuleLoader__.load({
1213
1331
  onClick: checkForPluginUpdate,
1214
1332
  }, updateChecking ? '检查中…' : '重新检查')))),
1215
1333
  ),
1334
+ React.createElement('div', { hidden: activeSection !== 'network' },
1335
+ React.createElement(ServerNetworkDiagnostics, null)),
1216
1336
  React.createElement('div', { hidden: activeSection !== 'pairing' },
1337
+ // ── 模块一:小程序连接(主用)────────────────────────────────────
1217
1338
  React.createElement('section', { style: styles.card },
1218
- React.createElement('div', { className: 'mgw-setting-row' },
1219
1339
  React.createElement('div', { style: { position: 'relative', display: 'flex', alignItems: 'center', gap: 6, marginBottom: 6 }, onMouseLeave: () => setConnectionHelpOpen(false) },
1220
- React.createElement('h3', { className: 'mgw-section-title', style: { marginBottom: 0 } }, '配对连接方式'),
1340
+ React.createElement('h3', { className: 'mgw-section-title', style: { marginBottom: 0 } }, '小程序连接(推荐)'),
1221
1341
  React.createElement('button', {
1222
1342
  type: 'button',
1223
1343
  style: styles.helpButton,
@@ -1232,12 +1352,14 @@ window.__ModuleLoader__.load({
1232
1352
  }, '?'),
1233
1353
  connectionHelpOpen ? React.createElement('div', { id: 'mgw-route-help', role: 'tooltip', style: styles.helpBubble },
1234
1354
  React.createElement('strong', null, '怎么选连接方式'),
1235
- helpLine('局域网直连', 'DSH App 和鲸尾小程序都可使用 ws:// 私有地址;手机与 DSH 位于可互访的局域网或 VPN 时可直连。'),
1236
- helpLine('Tailscale 直连', '手机与电脑登录同一 tailnet 时,可用本机 Tailscale 地址(ws://100.x 或 IPv6)直接配对,无需 tailscale serve;微信小程序线上环境要求 wss 域名,可能只能供 DSH App 使用。'),
1237
- helpLine('Cloudflare Tunnel(命名)', 'PC 主动连接 Cloudflare,DSH App 和小程序都可通过固定域名的 wss:// 公网入口连接;需要 Cloudflare 账户和域名。'),
1238
- helpLine('Quick Tunnel', '无需账户或域名,两种客户端都可通过临时 wss:// 地址连接;隧道重建后地址可能变化。'),
1239
- helpLine('公网服务器连接', '配置 Linux 服务器公网 WSS 入口,DSH App 和小程序都可使用。'),
1240
- helpLine('鲸尾公网 · 小程序', '生成仅供小程序使用的鲸尾中继二维码;要同时配对 DSH App 和小程序,请选“自动选择”。'),
1355
+ helpLine('小程序连接(推荐)', '鲸尾小程序在微信里通过鲸尾公网中继连接,不受 wss 域名限制;「自动选择」的二维码同时带上 App 可用的地址。'),
1356
+ helpLine('自动选择', '优先已就绪的公网入口,同时保留局域网与 Tailscale 地址;没有公网入口时小程序自动使用已注册的鲸尾中继。'),
1357
+ helpLine('鲸尾公网 · 小程序', '生成仅供鲸尾小程序使用的中继二维码。'),
1358
+ helpLine('App 直连(备用)', 'DSH App 使用直连入口:局域网直连、Cloudflare 外网、Tailscale 私有网络或公网/手动地址。'),
1359
+ helpLine('局域网直连', '手机与 DSH 在同一个可互访的局域网,使用 ws:// 私有地址;离开该网络就无法直连。'),
1360
+ helpLine('Cloudflare 外网', 'PC 主动连接 Cloudflare,外网用固定域名的 wss://;需要 Cloudflare 账户和域名。'),
1361
+ helpLine('Tailscale 私有网络', '可检测本机地址,或填写主机的 100.x 私有地址;手机与电脑需登录同一 tailnet。'),
1362
+ helpLine('公网或其他手动地址', '已配置公网 WSS 反代或只想指定一个固定地址时使用;编辑下方地址即可。'),
1241
1363
  React.createElement('div', { style: { borderTop: `1px solid ${colors.border}`, marginTop: 10, paddingTop: 8 } },
1242
1364
  React.createElement('strong', null, '结合当前环境'),
1243
1365
  React.createElement('div', { style: { color: colors.muted, marginTop: 4 } }, advice.detected),
@@ -1245,70 +1367,90 @@ window.__ModuleLoader__.load({
1245
1367
  React.createElement('div', { style: { marginTop: 6 } }, advice.remote),
1246
1368
  React.createElement('div', { style: { color: colors.muted, marginTop: 6 } }, '面板无法判断手机当前网络;请按手机所在位置选择,提示不会替你修改选择。')))
1247
1369
  : null),
1370
+ React.createElement('p', { style: styles.muted }, '鲸尾小程序通过鲸尾公网中继连接,不需要公网域名;「自动选择」生成的二维码同时兼容 App。'),
1248
1371
  React.createElement('div', { style: { display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '8px 14px', maxWidth: '100%' } },
1249
- React.createElement(GatewaySelect, { style: styles.input, value: effectiveRoute, onChange: (event) => choosePairingRoute(event.target.value), disabled: !status, 'aria-label': '配对连接方式' },
1372
+ React.createElement(GatewaySelect, { style: styles.input, value: miniPlan, onChange: (event) => chooseMiniPlan(event.target.value), disabled: !status, 'aria-label': '小程序连接方式' },
1250
1373
  React.createElement('option', { value: 'auto' }, '自动选择'),
1251
1374
  React.createElement('option', { value: 'relay', disabled: !status?.relay }, status?.relay
1252
- ? '鲸尾公网 · 小程序' : '鲸尾公网 · 尚未注册'),
1253
- lanPairingUrl(status) || pairingRoute === 'lan'
1254
- ? React.createElement('option', { value: 'lan', disabled: !lanPairingUrl(status) }, lanPairingUrl(status)
1255
- ? '局域网直连'
1256
- : '局域网直连 · 当前不可用')
1257
- : null,
1375
+ ? '鲸尾公网 · 小程序' : '鲸尾公网 · 尚未注册'))),
1376
+ React.createElement('p', { style: { ...styles.muted, margin: '-6px 0 10px' } }, miniPlan === 'relay'
1377
+ ? '此方案生成仅供鲸尾小程序使用的中继二维码;App 请使用下方「App 直连(备用)」。'
1378
+ : '自动选择会优先已就绪的公网入口,同时保留局域网与 Tailscale 地址;小程序没有公网入口时自动使用已注册的鲸尾中继;App 也可使用该二维码。生成新二维码不会断开已连接设备。'),
1379
+ // 中继信息块属于小程序模块(自动选择 / 鲸尾公网中继)。
1380
+ (relayInfo || relayConnector?.running || relayConnector?.delegatedTo || relayConnector?.lastError)
1381
+ ? (relayInfo
1382
+ ? React.createElement('div', { style: { ...styles.muted, margin: '2px 0 0', fontWeight: 500 } },
1383
+ '鲸尾公网服务 · 已注册', ' · ',
1384
+ React.createElement('span', { style: { opacity: .8 } }, `设备 ID ${relayInfo.nodeId.slice(0, 8)}… · ${relayInfo.gatewayName}`),
1385
+ React.createElement('div', { style: { marginTop: 6, padding: '9px 11px', borderRadius: 10, border: '1px solid color-mix(in srgb, var(--dsw-alias-state-warning-primary, #d98324) 26%, transparent)', background: 'color-mix(in srgb, var(--dsw-alias-state-warning-primary, #d98324) 9%, transparent)', fontWeight: 400 } },
1386
+ React.createElement('div', null, '公网 WSS 就绪时,DSH App 和小程序都会获得公网与局域网候选地址;没有公网入口时,App 使用局域网,小程序优先使用已注册的鲸尾公网中继,否则使用局域网。也可单独选择「鲸尾公网 · 小程序」强制生成专用中继二维码。'),
1387
+ React.createElement('div', { style: { marginTop: 5 } }, relayConnector?.running || relayConnector?.delegatedTo
1388
+ ? '中继连接保持运行;切换配对方式不会断开已配对设备。'
1389
+ : relayConnector?.lastError ? '中继连接器暂不可用,请检查网络或重新开启公网连接。'
1390
+ : '中继身份已保存,连接器正在恢复…'),
1391
+ React.createElement('div', { style: { marginTop: 5 } }, '设备配对与公网有效期独立;公网到期不影响局域网。已注册不代表手机端完整链路已通过验证。')))
1392
+ : relayConnector && relayConnector.running
1393
+ ? React.createElement('div', { style: { ...styles.muted, margin: '2px 0 0', fontWeight: 500,
1394
+ color: 'var(--dsw-alias-link, #4176e6)' } }, '内置连接器已自动启动,正在连接中继并上报身份…')
1395
+ : relayConnector && relayConnector.lastError
1396
+ ? React.createElement('div', { style: { ...styles.muted, margin: '2px 0 0', fontWeight: 500, color: colors.danger } },
1397
+ '公网连接器暂时不可用,请检查网络或重新开启公网连接。', ' ',
1398
+ React.createElement('span', { style: { opacity: .8 } }, '如已自行部署连接器,请执行 systemctl restart dsh-connector。'))
1399
+ : React.createElement('div', { style: { ...styles.muted, margin: '2px 0 0' } }, '正在启动内置连接器…(中继模式需要一个本地连接器把小程序流量桥接进来,插件会自动准备)'))
1400
+ : null,
1401
+ React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 12, flexWrap: 'wrap', marginTop: 10 } },
1402
+ React.createElement('button', {
1403
+ style: { ...styles.button, ...styles.primary, opacity: busy || !(status && status.gatewayEnabled) || (miniPlan === 'relay' && !status?.relay) ? .65 : 1 },
1404
+ disabled: busy || !(status && status.gatewayEnabled) || (miniPlan === 'relay' && !status?.relay),
1405
+ onClick: () => pairFor('mini'),
1406
+ }, busy ? '正在生成…' : !(status && status.gatewayEnabled) ? '请先开启移动网关'
1407
+ : miniPlan === 'relay' ? '生成小程序中继二维码' : '生成小程序二维码'),
1408
+ React.createElement('span', { style: styles.muted }, '配对码仅可使用一次,5 分钟内有效。'))),
1409
+ // ── 模块二:App 直连(备用)──────────────────────────────────────
1410
+ React.createElement('section', { style: { ...styles.card, marginTop: 16 } },
1411
+ React.createElement('h3', { className: 'mgw-section-title' }, 'App 直连(备用)'),
1412
+ React.createElement('p', { style: styles.muted }, 'DSH App 使用直连入口(上游移动网关的方式);小程序已在上方模块配对时,这里只用于 App。'),
1413
+ React.createElement('div', { style: { display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '8px 14px', maxWidth: '100%' } },
1414
+ React.createElement(GatewaySelect, { style: styles.input, value: appRoute, onChange: (event) => chooseAppRoute(event.target.value), disabled: !status, 'aria-label': 'App 连接方式' },
1415
+ React.createElement('option', { value: 'lan', disabled: !lanPairingUrl(status) }, lanPairingUrl(status)
1416
+ ? '局域网直连'
1417
+ : '局域网直连 · 当前不可用'),
1258
1418
  status?.cloudflare?.supported
1259
- ? React.createElement('option', {
1260
- value: 'cloudflare',
1261
- }, status.cloudflare.enabled && status.cloudflare.publicReady === true && status.cloudflare.publicUrl
1262
- ? 'Cloudflare 外网' : 'Cloudflare 外网 · 尚未就绪') : null,
1263
- // 仅在检测到 Tailscale 接口时提供专用路线;局域网入口未监听时禁用。
1264
- status?.tailscale && Array.isArray(status.tailscale.addresses) && status.tailscale.addresses.length
1265
- ? React.createElement('option', { value: 'tailscale', disabled: !(Array.isArray(status.tailscale.urls) && status.tailscale.urls.length) },
1266
- Array.isArray(status.tailscale.urls) && status.tailscale.urls.length
1267
- ? 'Tailscale 直连' : 'Tailscale 直连 · 请先开启局域网入口')
1268
- : null,
1269
- React.createElement('option', { value: 'custom' }, '手动输入地址')),
1270
- status?.cloudflare?.supported && pairingRoute === 'auto'
1271
- ? React.createElement('span', { style: { fontSize: 12, lineHeight: 1.5, fontWeight: 500,
1272
- color: 'var(--dsw-alias-link, #4176e6)' } }, '自动选择会优先尝试已就绪的公网入口,并同时保留局域网与 Tailscale 地址;DSH App 和小程序都可使用这些候选地址。配置 Cloudflare 请切换到“Cloudflare 外网”。')
1273
- : pairingRoute === 'tailscale'
1274
- ? React.createElement('span', { style: { fontSize: 12, lineHeight: 1.5, fontWeight: 500,
1275
- color: 'var(--dsw-alias-link, #4176e6)' } }, '只使用本机 Tailscale 地址(ws://100.x 或 IPv6);手机需登录同一 tailnet。微信小程序线上环境要求 wss 域名,可能只能供 DSH App 使用。')
1276
- : status?.cloudflare?.supported && pairingRoute === 'cloudflare'
1277
- ? React.createElement('span', { style: { fontSize: 12, lineHeight: 1.5, fontWeight: 500,
1278
- color: 'var(--dsw-alias-link, #4176e6)' } }, cloudflareReady
1279
- ? 'Cloudflare 外网已就绪;DSH App 和小程序都可使用公网入口,也会保留局域网候选地址。'
1280
- : 'Cloudflare 尚未就绪,可在本页 Cloudflare 设置中开启并完成连通性检测。')
1281
- : null),
1282
- React.createElement('p', { style: { ...styles.muted, margin: '-6px 0 10px' } }, pairingRoute === 'relay'
1283
- ? '此模式生成仅供鲸尾小程序使用的中继二维码;DSH App 请选“自动选择”或“局域网直连”。'
1284
- : pairingRoute === 'tailscale'
1285
- ? '此模式只生成 Tailscale 直连二维码;手机与电脑需登录同一 tailnet。微信小程序线上环境要求 wss 域名,可能无法使用,请改用局域网/公网地址或 tailscale serve。'
1286
- : '公网 WSS 就绪时,DSH App 和小程序都会尝试公网、局域网与 Tailscale 地址;没有公网入口时,App 使用局域网或 Tailscale,小程序优先使用已注册的鲸尾中继,否则也使用局域网。生成新二维码不会断开已连接设备。'),
1287
- // Fork: 中继模式下展示连接器状态与已注册中继信息
1288
- (relayInfo || relayConnector?.running || relayConnector?.delegatedTo || relayConnector?.lastError)
1289
- ? (relayInfo
1290
- ? React.createElement('div', { style: { ...styles.muted, margin: '2px 0 0', fontWeight: 500 } },
1291
- '鲸尾公网服务 · 已注册', ' · ',
1292
- React.createElement('span', { style: { opacity: .8 } }, `设备 ID ${relayInfo.nodeId.slice(0, 8)}… · ${relayInfo.gatewayName}`),
1293
- React.createElement('div', { style: { marginTop: 6, padding: '9px 11px', borderRadius: 10, border: '1px solid color-mix(in srgb, var(--dsw-alias-state-warning-primary, #d98324) 26%, transparent)', background: 'color-mix(in srgb, var(--dsw-alias-state-warning-primary, #d98324) 9%, transparent)', fontWeight: 400 } },
1294
- React.createElement('div', null, '公网 WSS 就绪时,DSH App 和小程序都会获得公网与局域网候选地址;没有公网入口时,App 使用局域网,小程序优先使用已注册的鲸尾公网中继,否则使用局域网。也可单独选择“鲸尾公网 · 小程序”强制生成专用中继二维码。'),
1295
- React.createElement('div', { style: { marginTop: 5 } }, relayConnector?.running || relayConnector?.delegatedTo
1296
- ? '中继连接保持运行;切换配对方式不会断开已配对设备。'
1297
- : relayConnector?.lastError ? '中继连接器暂不可用,请检查网络或重新开启公网连接。'
1298
- : '中继身份已保存,连接器正在恢复…'),
1299
- React.createElement('div', { style: { marginTop: 5 } }, '设备配对与公网有效期独立;公网到期不影响局域网。已注册不代表手机端完整链路已通过验证。')))
1300
- : relayConnector && relayConnector.running
1301
- ? React.createElement('div', { style: { ...styles.muted, margin: '2px 0 0', fontWeight: 500,
1302
- color: 'var(--dsw-alias-link, #4176e6)' } }, '内置连接器已自动启动,正在连接中继并上报身份…')
1303
- : relayConnector && relayConnector.lastError
1304
- ? React.createElement('div', { style: { ...styles.muted, margin: '2px 0 0', fontWeight: 500, color: colors.danger } },
1305
- '公网连接器暂时不可用,请检查网络或重新开启公网连接。', ' ',
1306
- React.createElement('span', { style: { opacity: .8 } }, '如已自行部署连接器,请执行 systemctl restart dsh-connector。'))
1307
- : React.createElement('div', { style: { ...styles.muted, margin: '2px 0 0' } }, '正在启动内置连接器…(中继模式需要一个本地连接器把小程序流量桥接进来,插件会自动准备)'))
1308
- : null),
1309
- pairingRoute === 'custom' ? React.createElement('label', { style: styles.label }, 'DSH App / 小程序连接地址') : null,
1310
- pairingRoute === 'custom' ? React.createElement('input', { style: styles.input, value: publicUrl, onChange: (event) => setPublicUrl(event.target.value), placeholder: 'ws://192.168.1.10:3081/ws/mobile 或 wss://gateway.example.com/ws/mobile', spellCheck: false }) : null,
1311
- status && status.lan && status.lan.enabled
1419
+ ? React.createElement('option', { value: 'cloudflare' }, 'Cloudflare 外网') : null,
1420
+ React.createElement('option', { value: 'tailscale', disabled: !(status && status.lan && status.lan.listening) },
1421
+ (status && status.lan && status.lan.listening) ? 'Tailscale 私有网络' : 'Tailscale 私有网络 · 请先开启局域网入口'),
1422
+ React.createElement('option', { value: 'custom' }, '公网或其他手动地址'))),
1423
+ React.createElement('label', { style: styles.label, htmlFor: 'mgw-pair-address' }, appRoute === 'tailscale'
1424
+ ? '主机 Tailscale 地址(运行网关的电脑,不是手机)'
1425
+ : '配对入口地址(手机需能访问)'),
1426
+ React.createElement('input', {
1427
+ id: 'mgw-pair-address',
1428
+ style: styles.input,
1429
+ value: appUrl,
1430
+ onChange: (event) => {
1431
+ const value = event.target.value
1432
+ if (appRoute === 'tailscale') { manualAppUrlRef.current = true; setAppUrl(value); return }
1433
+ if (appRoute !== 'custom') { chooseAppRoute('custom'); setAppUrl(value); return }
1434
+ setAppUrl(value)
1435
+ },
1436
+ placeholder: appRoute === 'tailscale'
1437
+ ? '100.x.x.x 或 ws://100.x.x.x:3081/ws/mobile(IPv6 用 [fd7a:…])'
1438
+ : 'ws://192.168.1.10:3081/ws/mobile 或 wss://gateway.example.com/ws/mobile',
1439
+ spellCheck: false,
1440
+ }),
1441
+ appRoute === 'tailscale' && appUrl.trim() && !isTailscaleInput(appUrl)
1442
+ ? React.createElement('div', { style: { ...styles.error, margin: '-4px 0 8px' } }, '这里要填 100.64.0.0/10(或 fd7a:115c:a1e0::/48)的 Tailscale 私有地址。')
1443
+ : null,
1444
+ // Tailscale 手动地址指引:检测到本机地址时提示可直接使用。
1445
+ appRoute === 'tailscale'
1446
+ ? React.createElement('div', { style: { ...styles.muted, margin: '-4px 0 10px', fontWeight: 500 } }, (() => {
1447
+ const detected = Array.isArray(status?.tailscale?.urls) ? status.tailscale.urls : []
1448
+ return detected.length
1449
+ ? `已检测到本机 Tailscale 地址:${detected.join('、')}(可直接生成二维码)。手机需登录同一 tailnet。`
1450
+ : '未检测到本机 Tailscale 地址:请填写运行网关这台主机的 Tailscale IP(不是手机 IP),例如 100.x.x.x。手机与电脑需登录同一 tailnet。'
1451
+ })())
1452
+ : null,
1453
+ appRoute !== 'tailscale' && status && status.lan && status.lan.enabled
1312
1454
  ? React.createElement('div', { style: { ...styles.muted, margin: '-7px 0 10px', fontWeight: 500, color: status.lan.error ? colors.danger : status.lan.listening ? colors.success : 'var(--dsw-alias-link, #4176e6)' } },
1313
1455
  status.lan.error
1314
1456
  ? `局域网监听失败:${status.lan.error}`
@@ -1316,29 +1458,25 @@ window.__ModuleLoader__.load({
1316
1458
  ? `局域网入口已开启${status.lan.urls && status.lan.urls.length ? `:${status.lan.urls.join('、')}` : `,端口 ${status.lan.port}`}`
1317
1459
  : '局域网入口启动中…')
1318
1460
  : null,
1319
- // Tailscale 直连:同一 tailnet 的手机可直接连 ws://100.x 地址,无需 tailscale serve。
1320
- status && status.tailscale && Array.isArray(status.tailscale.urls) && status.tailscale.urls.length
1321
- ? React.createElement('div', { style: { ...styles.muted, margin: '-7px 0 10px', fontWeight: 500, color: colors.success } },
1322
- `Tailscale 直连可用:${status.tailscale.urls.join('、')}`)
1323
- : status && status.tailscale && Array.isArray(status.tailscale.addresses) && status.tailscale.addresses.length
1324
- ? React.createElement('div', { style: { ...styles.muted, margin: '-7px 0 10px', fontWeight: 500, color: 'var(--dsw-alias-link, #4176e6)' } },
1325
- `检测到 Tailscale 地址 ${status.tailscale.addresses.join('、')};开启局域网入口后可直接使用。`)
1326
- : null,
1327
- React.createElement('button', {
1328
- style: { ...styles.button, ...styles.primary, opacity: busy || !(status && status.gatewayEnabled) || (pairingRoute === 'custom' && !publicUrl.trim()) || (pairingRoute === 'cloudflare' && !cloudflareReady) || (pairingRoute === 'tailscale' && !(status?.tailscale?.urls?.length)) ? .65 : 1 },
1329
- disabled: busy || !(status && status.gatewayEnabled) ||
1330
- (pairingRoute === 'custom' && !publicUrl.trim()) ||
1331
- (pairingRoute === 'cloudflare' && !cloudflareReady) ||
1332
- (pairingRoute === 'tailscale' && !(status?.tailscale?.urls?.length)) ||
1333
- (pairingRoute === 'relay' && !status?.relay),
1334
- onClick: pair,
1335
- }, busy ? '正在生成…' : !(status && status.gatewayEnabled) ? '请先开启移动网关'
1336
- : pairingRoute === 'cloudflare' && !cloudflareReady
1337
- ? status?.cloudflare?.enabled ? '等待 Cloudflare 外网就绪' : '先开启 Cloudflare Tunnel'
1338
- : (pairingRoute === 'tailscale' && !(status?.tailscale?.urls?.length)) ? '等待 Tailscale 地址'
1339
- : (pairingRoute === 'custom' && !publicUrl.trim()) ? '等待连接地址' : '生成配对二维码'),
1340
- React.createElement('p', { style: { ...styles.muted, margin: '10px 0 0' } }, '配对码仅可使用一次,5 分钟内有效。')),
1341
- pairingRoute === 'cloudflare' && status?.cloudflare?.supported
1461
+ appRoute === 'cloudflare' && !cloudflareReady
1462
+ ? React.createElement('div', { style: { ...styles.muted, margin: '-4px 0 10px', fontWeight: 500 } }, status?.cloudflare?.enabled
1463
+ ? 'Cloudflare 外网尚未就绪,请稍候或查看下方 Cloudflare 设置。'
1464
+ : '尚未开启 Cloudflare Tunnel,可在下方设置中一键开启。')
1465
+ : null,
1466
+ React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 12, flexWrap: 'wrap' } },
1467
+ React.createElement('button', {
1468
+ style: { ...styles.button, ...styles.primary, opacity: appPairingDisabled ? .65 : 1 },
1469
+ disabled: appPairingDisabled,
1470
+ onClick: () => pairFor('app'),
1471
+ }, busy ? '正在生成…' : !(status && status.gatewayEnabled) ? '请先开启移动网关'
1472
+ : appRoute === 'cloudflare' && !cloudflareReady
1473
+ ? status?.cloudflare?.enabled ? '等待 Cloudflare 外网就绪' : '先开启 Cloudflare Tunnel'
1474
+ : appRoute === 'tailscale' && !status?.lan?.listening ? '请先开启局域网入口'
1475
+ : appRoute === 'tailscale' && !isTailscaleInput(appUrl) ? '填写主机 Tailscale 地址'
1476
+ : appRoute === 'lan' && !lanPairingUrl(status) ? '当前不可用'
1477
+ : appRoute === 'custom' && !appUrl.trim() ? '等待连接地址' : '生成 App 二维码'),
1478
+ React.createElement('span', { style: styles.muted }, '二维码只发给 App;小程序请用上方模块。'))),
1479
+ appRoute === 'cloudflare' && status?.cloudflare?.supported
1342
1480
  ? React.createElement('section', { className: 'mgw-cloudflare-block', style: { ...styles.card, background: colors.card, border: 0, borderRadius: 16, padding: 18, marginTop: 16 } },
1343
1481
  React.createElement('h3', { className: 'mgw-section-title' }, 'Cloudflare Tunnel · 外网接入'),
1344
1482
  React.createElement('p', { style: styles.muted }, status.platform === 'linux'
@@ -1432,6 +1570,12 @@ window.__ModuleLoader__.load({
1432
1570
  deviceNotice || refreshNotice ? React.createElement('span', {
1433
1571
  style: { ...styles.muted, color: deviceNoticeError ? colors.danger : colors.success },
1434
1572
  }, deviceNotice || refreshNotice) : null,
1573
+ React.createElement('button', {
1574
+ style: { ...styles.button, opacity: offlineDevices.length === 0 ? .55 : 1, color: colors.danger },
1575
+ disabled: offlineDevices.length === 0 || offlineClearing,
1576
+ title: '吊销所有当前离线的已配对设备',
1577
+ onClick: clearOfflineDevices,
1578
+ }, offlineClearing ? '清除中…' : `一键清除离线设备(${offlineDevices.length})`),
1435
1579
  React.createElement('button', {
1436
1580
  style: { ...styles.button, opacity: refreshing ? .6 : 1 },
1437
1581
  disabled: refreshing,
@@ -1471,6 +1615,32 @@ window.__ModuleLoader__.load({
1471
1615
  return isOpen ? React.createElement(DevicePanel) : null
1472
1616
  }
1473
1617
 
1618
+ // 侧边栏入口:与上游一致,在 Harness WebUI 侧边栏底部放一个「鲸尾移动设备」
1619
+ // 按钮,点击打开同一个管理弹窗;设置页入口保留,两个入口共享同一 open 状态。
1620
+ function FooterButton(props) {
1621
+ const isOpen = React.useSyncExternalStore(subscribe, getOpen, () => false)
1622
+ const visible = React.useSyncExternalStore(subscribeSidebar, getSidebarEntry, () => true)
1623
+ if (!visible) return null
1624
+ const wide = !!props.wide
1625
+ const iconSize = wide ? 20 : 22
1626
+ const icon = React.createElement('svg', { width: iconSize, height: iconSize, viewBox: '0 0 24 24', fill: 'none',
1627
+ stroke: 'currentColor', strokeWidth: 1.8, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true, style: { flexShrink: 0 } },
1628
+ React.createElement('rect', { x: 6, y: 2, width: 12, height: 20, rx: 2.5 }),
1629
+ React.createElement('path', { d: 'M10 18h4' }))
1630
+ return React.createElement('button', {
1631
+ type: 'button', title: '鲸尾移动设备', 'aria-label': '鲸尾移动设备', 'aria-pressed': isOpen,
1632
+ onClick: () => setOpen(!isOpen),
1633
+ style: { cursor: 'pointer', background: 'transparent', border: 'none', color: 'inherit', font: 'inherit',
1634
+ display: 'flex', alignItems: 'center', justifyContent: wide ? 'flex-start' : 'center', gap: wide ? 8 : 0,
1635
+ boxSizing: 'border-box', width: wide ? 'calc(100% + 4px)' : 36, height: wide ? 42 : 36,
1636
+ margin: wide ? '4px -2px' : '3px 0', padding: wide ? '0 10px 0 8px' : 0, lineHeight: wide ? '22px' : 'normal' },
1637
+ }, icon, wide ? React.createElement('span', null, '鲸尾移动设备') : null)
1638
+ }
1639
+
1640
+ function OverlayEntry() {
1641
+ const isOpen = React.useSyncExternalStore(subscribe, getOpen, () => false)
1642
+ return isOpen ? React.createElement(DevicePanel, null) : null
1643
+ }
1474
1644
  const inject = ['slots']
1475
1645
  function apply(ctx) {
1476
1646
  // Upstream 0.10.1: the panel stylesheet is injected once through an
@@ -1490,6 +1660,17 @@ window.__ModuleLoader__.load({
1490
1660
  { name: 'settings.section', id: 'mobile-gateway', order: 35, label: () => NAV_LABEL },
1491
1661
  () => React.createElement(SettingsEntry, null),
1492
1662
  ))
1663
+ // 侧边栏入口的显示开关来自管理接口;读取失败时保持默认显示。
1664
+ void request('/mgw/ui').then((data) => setSidebarEntry(data.sidebarEntry !== false)).catch(() => {})
1665
+ // 与上游一致:侧边栏底部入口 + shell overlay,共享同一个 open 状态。
1666
+ ctx.slots.inject('sidebar.footer.action', () => ctx.slots.register(
1667
+ { name: 'sidebar.footer.action', id: 'mobile-gateway-devices', order: 80, label: '鲸尾移动设备' },
1668
+ (props) => React.createElement(FooterButton, props),
1669
+ ))
1670
+ ctx.slots.inject('shell.overlay', () => ctx.slots.register(
1671
+ { name: 'shell.overlay', id: 'mobile-gateway-devices-panel', order: 100, label: '移动设备' },
1672
+ () => React.createElement(OverlayEntry, null),
1673
+ ))
1493
1674
  }
1494
1675
 
1495
1676
  exports.apply = apply
package/lib/index.mjs CHANGED
@@ -162,6 +162,7 @@ import { createFileUploadManager, FILE_UPLOAD_REQUEST_TYPES, FILE_UPLOAD_DEFAULT
162
162
  import { assistantFinish, failureDetails, toolResultDetails, turnReasonDetails } from './session-event-details.mjs'
163
163
  import { createNetworkDiagnostics } from './network-diagnostics.mjs'
164
164
  import { isTailscaleIp, tailscaleInterfaceStatus } from './tailscale-addresses.mjs'
165
+ import { createUiState } from './ui-state.mjs'
165
166
 
166
167
  const { createRegistry } = devicesModule
167
168
 
@@ -2871,6 +2872,7 @@ const plugin = {
2871
2872
  relayEnsureTimer.unref?.()
2872
2873
  }
2873
2874
  const registry = createRegistry(deviceFile, { pairingTtlMs: options.pairingTtlMs })
2875
+ const uiState = createUiState(`${deviceFile}.ui.json`)
2874
2876
  const wss = new WebSocketServer({
2875
2877
  noServer: true,
2876
2878
  maxPayload: options.maxPayloadBytes,
@@ -3443,6 +3445,14 @@ const plugin = {
3443
3445
  if (body.mode === undefined && typeof body.enabled !== 'boolean') throw badRequest('mode or boolean enabled is required')
3444
3446
  setGatewayMode(body.mode !== undefined ? body.mode : (body.enabled ? 'temporary' : 'disabled'), 'changed from management UI')
3445
3447
  sendJson(res, 200, { gatewayEnabled, gatewayMode, waitExpiresAt, connectedClients: clients.size })
3448
+ } else if (req.method === 'GET' && p === '/mgw/ui') {
3449
+ sendJson(res, 200, { sidebarEntry: uiState.sidebarEntry })
3450
+ } else if (req.method === 'POST' && p === '/mgw/ui') {
3451
+ const body = await readBody(req)
3452
+ if (typeof body.sidebarEntry !== 'boolean') throw badRequest('sidebarEntry must be a boolean')
3453
+ uiState.setSidebarEntry(body.sidebarEntry)
3454
+ log(`sidebar entry ${body.sidebarEntry ? 'enabled' : 'disabled'} from management UI`)
3455
+ sendJson(res, 200, { sidebarEntry: uiState.sidebarEntry })
3446
3456
  } else if (req.method === 'POST' && p === '/mgw/network-test') {
3447
3457
  const abort = new AbortController()
3448
3458
  const cancel = () => abort.abort()
@@ -3532,8 +3542,14 @@ const plugin = {
3532
3542
  error.status = 409
3533
3543
  throw error
3534
3544
  }
3535
- const candidate = typeof body.publicUrl === 'string' && body.publicUrl.trim()
3536
- ? normalizePublicUrl(body.publicUrl.trim(), req, wsPath)
3545
+ // 面板允许直接填主机 Tailscale IP;这里补成 ws://<ip>:<lanPort><wsPath>。
3546
+ const rawCandidate = typeof body.publicUrl === 'string' ? body.publicUrl.trim() : ''
3547
+ const bareTailscale = /^(?:\d{1,3}\.){3}\d{1,3}$/.test(rawCandidate)
3548
+ || (/^[0-9a-f:]+$/i.test(rawCandidate) && rawCandidate.includes(':'))
3549
+ const candidate = rawCandidate
3550
+ ? normalizePublicUrl(bareTailscale
3551
+ ? `ws://${rawCandidate.includes(':') ? `[${rawCandidate}]` : rawCandidate}:${lanBoundPort}${wsPath}`
3552
+ : rawCandidate, req, wsPath)
3537
3553
  : tailscaleUrls[0] || ''
3538
3554
  if (!candidate) {
3539
3555
  const error = new Error('no Tailscale address detected; connect this host to a tailnet and keep the LAN listener enabled')
@@ -3709,6 +3725,19 @@ const plugin = {
3709
3725
  qrPayload,
3710
3726
  svg,
3711
3727
  })
3728
+ } else if (req.method === 'POST' && p === '/mgw/devices/revoke-offline') {
3729
+ // 一键清除离线设备:只吊销当前没有活跃连接的设备,在线设备不受影响。
3730
+ const offline = registry.list().filter((device) => !device.online || device.connections === 0)
3731
+ const removed = []
3732
+ for (const device of offline) {
3733
+ if (!registry.revoke(device.id)) continue
3734
+ removed.push(device.id)
3735
+ for (const client of clients) {
3736
+ if (client.deviceId === device.id) client.close(4003, 'device revoked')
3737
+ }
3738
+ }
3739
+ if (removed.length > 0) log(`offline devices revoked: ${removed.length}`)
3740
+ sendJson(res, 200, { removed, count: removed.length })
3712
3741
  } else if (req.method === 'POST' && p.startsWith('/mgw/devices/') && p.endsWith('/revoke')) {
3713
3742
  const id = decodeURIComponent(p.slice('/mgw/devices/'.length, -'/revoke'.length))
3714
3743
  const revoked = registry.revoke(id)
@@ -0,0 +1,36 @@
1
+ // 面板 UI 偏好:与网关身份/模式分开存储。该文件损坏时回退默认值,
2
+ // 不让插件启动失败(身份文件损坏才会 fail closed)。
3
+ import fs from 'node:fs'
4
+ import path from 'node:path'
5
+ import crypto from 'node:crypto'
6
+
7
+ const DEFAULTS = { version: 1, sidebarEntry: true }
8
+
9
+ export function createUiState(file) {
10
+ let state = { ...DEFAULTS }
11
+ try {
12
+ const parsed = JSON.parse(fs.readFileSync(file, 'utf8'))
13
+ if (parsed && parsed.version === 1 && typeof parsed.sidebarEntry === 'boolean') {
14
+ state = { version: 1, sidebarEntry: parsed.sidebarEntry }
15
+ }
16
+ } catch { /* 首次运行或文件损坏:使用默认值 */ }
17
+ const write = (value) => {
18
+ fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 })
19
+ const tmp = `${file}.${process.pid}.${crypto.randomUUID()}.tmp`
20
+ try {
21
+ fs.writeFileSync(tmp, `${JSON.stringify(value)}\n`, { mode: 0o600, flag: 'wx' })
22
+ fs.renameSync(tmp, file)
23
+ } finally {
24
+ fs.rmSync(tmp, { force: true })
25
+ }
26
+ }
27
+ return {
28
+ get sidebarEntry() { return state.sidebarEntry },
29
+ setSidebarEntry(value) {
30
+ if (typeof value !== 'boolean') throw new TypeError('sidebarEntry must be a boolean')
31
+ const next = { version: 1, sidebarEntry: value }
32
+ write(next)
33
+ state = next
34
+ },
35
+ }
36
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-weapp-gateway",
3
- "version": "0.8.41",
3
+ "version": "0.8.48",
4
4
  "description": "鲸尾网关助手:DeepSeek Harness 移动客户端连接与会话同步,支持安全配对、远程访问、上下文、编队、额度和语音输入",
5
5
  "main": "lib/index.mjs",
6
6
  "files": [
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "bin": "bin/setup-ip.mjs",
31
31
  "scripts": {
32
- "test": "node test/wire-json.test.mjs && node --test test/history-cache.test.mjs && node test/session-target.test.mjs && node test/setup-ip.test.mjs && node test/host-adapter.test.mjs && node test/file-upload-adapter.test.mjs && node test/file-upload.test.mjs && node test/agent-team.test.mjs && node test/account-bridge.test.mjs && node test/context-bridge.test.mjs && node test/cost-meter.test.mjs && node --test test/cost-meter-dashboard.test.mjs && node test/clawbot-service.test.mjs && node test/speech-input.test.mjs && node test/speech-official.test.mjs && node test/plugin-management.test.mjs && node test/model-config.test.mjs && node test/plugin-updates.test.mjs && node test/session-preset.test.mjs && node test/session-follower.test.mjs && node test/completion-notifications.test.mjs && node --test test/workspace-changes.test.mjs && node --test test/question-replay.test.mjs && node --test test/network-diagnostics.test.mjs && node --test test/tailscale-addresses.test.mjs && node test/gateway.test.mjs && node test/auth.test.mjs && node test/lan.test.mjs && node test/cloudflared-binary.test.mjs && node test/cloudflare-tunnel.test.mjs && node --test test/public-endpoint-check.test.mjs && node test/gateway-tools.test.mjs && node test/relay-connector.test.mjs && node test/restart-reconnect.test.mjs && node test/cloudflare-linux.test.mjs && node test/multi-gateway.test.mjs"
32
+ "test": "node test/wire-json.test.mjs && node --test test/history-cache.test.mjs && node test/session-target.test.mjs && node test/setup-ip.test.mjs && node test/host-adapter.test.mjs && node test/file-upload-adapter.test.mjs && node test/file-upload.test.mjs && node test/agent-team.test.mjs && node test/account-bridge.test.mjs && node test/context-bridge.test.mjs && node test/cost-meter.test.mjs && node --test test/cost-meter-dashboard.test.mjs && node test/clawbot-service.test.mjs && node test/speech-input.test.mjs && node test/speech-official.test.mjs && node test/plugin-management.test.mjs && node test/model-config.test.mjs && node test/plugin-updates.test.mjs && node test/session-preset.test.mjs && node test/session-follower.test.mjs && node test/completion-notifications.test.mjs && node --test test/workspace-changes.test.mjs && node --test test/question-replay.test.mjs && node --test test/network-diagnostics.test.mjs && node --test test/tailscale-addresses.test.mjs && node --test test/ui-state.test.mjs && node test/gateway.test.mjs && node test/auth.test.mjs && node test/lan.test.mjs && node test/cloudflared-binary.test.mjs && node test/cloudflare-tunnel.test.mjs && node --test test/public-endpoint-check.test.mjs && node test/gateway-tools.test.mjs && node test/relay-connector.test.mjs && node test/restart-reconnect.test.mjs && node test/cloudflare-linux.test.mjs && node test/multi-gateway.test.mjs"
33
33
  },
34
34
  "exports": {
35
35
  ".": "./lib/index.mjs",