@linxin666/dsh-remote-bridge 0.4.13 → 0.4.14

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.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # node scripts/verify-docs.mjs --write <dir>
5
- README.md: 8a98b374253296b7077aa07c3a2fb46ba63ad317
6
- README.zh.md: 92d8fe0c6d65165b675eac217e8f3b6ecc537908
5
+ README.md: ace1c8b53b33dc58da128a48c8f663a88aa3b1a3
6
+ README.zh.md: 18a9d176979ab0366db0662c626dadbead5419cf
package/README.md CHANGED
@@ -31,7 +31,7 @@ The package publishes one protocol and, beside it, one small browser surface. Wh
31
31
  - **A subscription, not a poll.** `session.snapshot` opens the harness follow stream and keeps it, so the baseline and every later increment arrive over the same socket.
32
32
  - **Approvals reach the client, and a reconnecting phone is handed the ones still waiting.** A tool that asks for permission arrives as an `approval.request` event and is answered with `approval.resolve`; a request nobody answers is rejected, and a connection that declared `approvals.v1` receives every unsettled approval again after its handshake.
33
33
  - **Pairing.** A one-time bootstrap token plus a P-256 challenge-response mint a revocable device token; an unpaired connection reaches three methods only.
34
- - **A pairing panel.** The same plugin row declares a `dsh.client` browser half: a QR code icon at the bottom of the sidebar (aria-label "Pair a phone (protocol v1)") that opens a modal displaying a 30 s single-use pairing QR code and a "New code" action.
34
+ - **A pairing panel.** The same plugin row declares a `dsh.client` browser half: a QR code icon at the bottom of the sidebar (aria-label "Pair an iPhone") that opens a modal displaying a 30 s single-use pairing QR code and a "New code" action.
35
35
  - **No relay change.** The protocol rides whatever origin the instance already publishes, and the relay hop forwards it exactly as it forwards everything else.
36
36
 
37
37
  ## Transport
@@ -181,7 +181,7 @@ The device token rides the WebSocket upgrade as `Authorization: Bearer <deviceTo
181
181
 
182
182
  ### Bootstrap token
183
183
 
184
- The pairing entry is a QR code icon at the bottom of the sidebar, with the accessible label "Pair a phone (protocol v1)". Clicking it opens the pairing panel. The panel is strictly available on localhost: its token route `GET /remote-bridge/pair/token` is guarded by a two-condition loopback gate where both the socket address and the `Host` header must name this machine (remote or tunneled requests return 403).
184
+ The pairing entry is a QR code icon at the bottom of the sidebar, with the accessible label "Pair an iPhone". Clicking it opens the pairing panel. The panel is strictly available on localhost: its token route `GET /remote-bridge/pair/token` is guarded by a two-condition loopback gate where both the socket address and the `Host` header must name this machine (remote or tunneled requests return 403).
185
185
 
186
186
  The pairing code is single-use and valid for 30 seconds (`BOOTSTRAP_TOKEN_TTL_MS = 30_000`), consumed immediately upon the first `pair.begin`; clicking "New code" in the panel voids the previous code and mints a fresh one. There is no "Stop" button and no action to revoke all connected devices. The link is printed to the host log, while the code itself renders in the pairing panel for scanning.
187
187
 
@@ -240,7 +240,7 @@ Two consequences follow from that hop. It sees the request URL, so a `?token=` c
240
240
  ## Ingress stack and security model
241
241
 
242
242
  `@linxin666/dsh-remote-bridge` owns the complete public and local network ingress stack for remote access:
243
- - **Relay identity and leases**: `relay-registry` persists the relay ID and secret under `$DSH_HOME/remote-web-ui-registry/<profile>.json`; changing relay config remounts the plugin row. When mounting with `relay=false` and an on-disk identity already exists, it unregisters the previous registration row and releases its lease once via `pair.release()` (best-effort, logging any errors; unmounting neither releases nor unregisters, preserving bookmarked origins for server-side GC; mounting with `relay=false` never mints a new identity and has zero side effects if no identity file exists).
243
+ - **Relay identity and leases**: `relay-registry` persists the relay ID and secret under `$DSH_HOME/remote-web-ui-registry/<profile>.json`; changing relay config remounts the plugin row. When no tunnel is configured (`tunnel.mode === 'off'`) and no remote device is paired yet, the bridge stays idle at startup without minting an identity or claiming a relay lease; lease claiming is armed on demand once the roster loads a paired device, a local pairing token is requested, a device finishes pairing, or a tunnel is enabled (while suppressing transient `idle`/`claiming`/`dialing` state logs and deduplicating repeated identical failure lines). When mounting with `relay=false` and an on-disk identity already exists, it unregisters the previous registration row and releases its lease once via `pair.release()` (best-effort, logging any errors; unmounting neither releases nor unregisters, preserving bookmarked origins for server-side GC; mounting with `relay=false` never mints a new identity and has zero side effects if no identity file exists).
244
244
  - **Relay connectors**: `relay-connector` manages quick and named tunnel connectors side by side, and `relay-bridge-connector` connects to the Cloudflare Durable Object meeting point over WSS, recording connection state in `$DSH_HOME/remote-web-ui-relay-bridge.json` (state file writing is verified behaviorally, defaulting to `$DSH_HOME` when unspecified, not checked via source text assertions).
245
245
  - **Tunnel lifecycle**: `tunnel`, `tunnel-plan`, and `tunnel-orphan` manage platform `cloudflared` child processes with exponential backoff and reap orphaned processes left behind by crashes.
246
246
  - **Ingress sync**: `ingress-sync` converges Cloudflare named tunnel ingress rules to the local gate port when the host listens on a different port.
@@ -249,7 +249,7 @@ Two consequences follow from that hop. It sees the request URL, so a `?token=` c
249
249
  The security model enforces strict whitelisting across all external ingress paths:
250
250
  - **Internal ingress gate (`src/host/ingress-gate.ts`)**: binds exclusively to `127.0.0.1` and forwards only WebSocket upgrades to `/ios/v1` to the host's own protocol port, rewriting the `Host` header to the loopback authority. Every other plain HTTP request and non-whitelisted upgrade is answered immediately with `404 {"error":"not-found"}` and closed without opening any upstream connection.
251
251
  - **Tunnel target is the ingress gate, not the webServer**: cloudflared quick and named tunnels target the dynamic loopback port bound by `ingress-gate`, never the harness `webServer` port. A request routed through the tunnel cannot reach webServer routes, internal APIs, or other plugins.
252
- - **Relay registration and public exposure**: the relay registration row only writes the quick tunnel URL, which points to the ingress gate, so the public internet still only sees /ios/v1. When the plan is quick and the tunnel is running, the gate URL is announced to the relay Worker (proxying `<id>.dsh-market.com` to this machine); plugin disposal clears local references without withdrawing the row. QR public address selection is decided by `livePublicOriginOf`: bridge or named leases prioritize the stable subdomain; quick leases fall back to the tunnel running URL while registration is unconfirmed; no lease uses the tunnel URL; none returns no address. Fallbacks then check `DSH_REMOTE_PUBLIC_BASE_URL`, and the LAN fallback provides an address only when the LAN forwarder is actually listening using its snapshot's bound address and port (never guessing the first IP in the address list, returning no address when stopped; the disk registry row fallback has been completely removed, eliminating the last data dependency on legacy data files).
252
+ - **Relay registration and public exposure**: the relay registration row only writes the quick tunnel URL, which points to the ingress gate, so the public internet still only sees /ios/v1. When the plan is quick and the tunnel is running, the gate URL is announced to the relay Worker (proxying the stable subdomain to this machine; endpoints and suffix are determined by configuration, defaulting to `<id>.dsh-market.com`); plugin disposal clears local references without withdrawing the row. QR public address selection is decided by `livePublicOriginOf`: bridge or named leases prioritize the stable subdomain; quick leases fall back to the tunnel running URL while registration is unconfirmed; no lease uses the tunnel URL; none returns no address. Fallbacks then check `DSH_REMOTE_PUBLIC_BASE_URL`, and the LAN fallback provides an address only when the LAN forwarder is actually listening using its snapshot's bound address and port (never guessing the first IP in the address list, returning no address when stopped; the disk registry row fallback has been completely removed, eliminating the last data dependency on legacy data files).
253
253
  - **LAN forwarder target is the ingress gate**: the LAN forwarder listens on the machine's LAN IPv4 address and re-issues traffic exclusively to the `ingress-gate` port, so local network reachability is also constrained strictly to `/ios/v1`.
254
254
  - **Relay bridge connector whitelist**: the Durable Object multiplexer in `relay-bridge-connector.ts` applies the same whitelist. Non-`/ios/v1` HTTP streams receive `404 {"error":"not-found"}`, and non-whitelisted WebSocket upgrades return `ws-fail 404 {"error":"not-found"}`, establishing no upstream connection.
255
255
  - **Historical spelling retention and coexistence caveat**: the registry directory `$DSH_HOME/remote-web-ui-registry/` and state file `remote-web-ui-relay-bridge.json` intentionally retain their historical names so existing profiles maintain identity continuity and previously paired devices keep their credentials across upgrades. **Known risk and coexistence caveat**: never enable relay concurrently on both this plugin and the deprecated `dsh-remote-web-ui` in the same profile — both share the same identity file per profile; mounting the bridge with `relay=false` withdraws the registration row and releases the lease for that shared identity, breaking the legacy plugin's active relay, while running both with relay enabled causes bridge connectors to compete over the same Durable Object connection (or quick tunnel registrations to overwrite each other). This cleanup behavior is intentional.
@@ -261,7 +261,9 @@ The plugin is configured through profile YAML (`cordis.patch.yml` or profile con
261
261
 
262
262
  | Key | Type | Default | Description |
263
263
  | --- | --- | --- | --- |
264
- | `relay` | boolean | `true` | Whether to claim relay leases. Enabled by default; public availability works out of the box because leases are claimed even when no tunnel is running. |
264
+ | `relay` | boolean | `true` | Whether to claim relay leases. Enabled by default; when no tunnel is configured, leases are claimed on demand once a device is paired or pairing is requested. |
265
+ | `relayControlUrl` | string | `'https://dsh-market.com/api/relay'` | Relay control-plane base URL; claim, release, register, and unregister endpoints are all derived from it. |
266
+ | `relayPublicSuffix` | string | `'.dsh-market.com'` | Stable hostname suffix. |
265
267
  | `autoTunnel` | boolean | `false` | Whether to start a Cloudflare quick tunnel targeting the ingress gate. |
266
268
  | `lanBind` | boolean | `undefined` (off) | Whether to start the LAN-edge forwarder listening on the machine's local IPv4 address. |
267
269
  | `tunnelToken` | string | `undefined` | Cloudflare named tunnel token for running named tunnels. |
@@ -278,11 +280,13 @@ The browser half exists so that an operator who never opens a terminal still has
278
280
 
279
281
  The panel has one job — put the live one-time code in front of the operator, in one reading order:
280
282
 
281
- - **The QR symbol is the code.** It encodes either the bare 43-character base64url token or, when the host can name its own public origin, the `{token,url}` document one scan turns into a fully configured phone. A URL the host did not vouch for would let the phone's own parser rewrite its origin onto this machine's loopback address, which is precisely the address a phone cannot reach. The encoded string is mirrored once, as the `data-dsh-qr-value` attribute on the symbol's part, so a UI check can compare it without decoding anything; it is never rendered as text.
283
+ - **Header and subtitle set the scope.** Title "iOS app pairing"; subtitle "Scan the QR code with the iOS app (beta) to connect an iPhone to this computer. The code is shown only on this machine.", stating the target and security boundary.
284
+ - **The QR symbol is the code.** It encodes either the bare 43-character base64url token or, when the host can name its own public origin, the `{token,url}` document one scan turns into a fully configured iPhone. A URL the host did not vouch for would let the app's own parser rewrite its origin onto this machine's loopback address, which is precisely the address an iPhone cannot reach. The encoded string is mirrored once, as the `data-dsh-qr-value` attribute on the symbol's part, so a UI check can compare it without decoding anything; it is never rendered as text.
282
285
  - **One status line under the symbol.** A live code counts its 30 s window down beside a progress bar; an expired code states the expiry in the same fixed box, so only the sentence changes.
283
- - **One address line.** When the host located its relay origin, the line names the address the phone will dial; otherwise it says outright that no public address was found, that the phone's connection address has to be the public relay set by hand, and that `127.0.0.1:<port>` (this page) is reachable only from this machine.
284
- - **One single-use note.** The code is spent the moment the phone starts pairing, and a new code voids the previous one.
286
+ - **One address line.** When the host located its relay origin, the line states "The iPhone will dial {origin}"; otherwise it says outright "No public address found: set the connection address in the app to your public relay first, then scan. {host} (this page) is reachable only from this machine."
287
+ - **One single-use note.** The code is single-use: pairing spends it, and a new code voids the previous one.
285
288
  - **One action row.** Copy puts the very string the symbol encodes on the clipboard, and **New code** mints a fresh token and voids the previous one; both are one library control at one size, so their states never diverge. Once the code expires, mint-again is the only way back to a scannable symbol: copy is disabled and the symbol is dimmed in place instead of resized or removed.
289
+ - **One beta entry.** Provides "[The iOS app is in beta. Come talk to us on Discord](https://discord.gg/nBy28kjun)", clickable across the entire line.
286
290
  - **A refusal is never silent.** The read is the same loopback-only route an operator would curl: a `403` renders as "this page is not open on this machine" and offers nothing to press, a request that never arrives renders as its own unreachable state with a retry, and an unexpected answer names the status it got.
287
291
 
288
292
  Opening and closing are one motion in both directions: the card stays mounted and plays the dialog's own enter fade backwards, and the reduced-motion path keeps that lifecycle as one short opacity fade rather than dropping the exit. Geometry is held across every state — the symbol's box, the status row, the address line and the copy label keep their height and width — so a countdown, an expiry and a copy confirmation never move their neighbours.
@@ -349,6 +353,7 @@ The bridge is mounted like any other host plugin row. It carries no user-facing
349
353
  - **The token comparison does not leak length.** It is a fixed-length comparison rather than an early-exit one, so a wrong token cannot be narrowed byte by byte.
350
354
  - **Approvals fail closed while a client is connected.** The bridge claims a tool's permission request only while at least one paired client is connected; with none, the request goes to the next answerer rather than stalling. A claimed request that nobody answers normalizes to `unavailable`, which the harness treats as a rejection: silence from the phone is never consent.
351
355
  - **The header is the safer carrier.** `Authorization: Bearer <deviceToken>` keeps the credential out of the URL; `?token=` exists for clients that cannot set handshake headers, and the relay, the edge and the access log all see a URL that authenticates as that device.
356
+ - **Relay tier routing and grant credential boundaries.** The device roster (`devices.json`) schema upgrades from 3 to 4, adding an optional `relay: {grant, receivedAt}` to each device row. That `grant` is a 30-day HS256 credential signed by the account service, handed from the phone to the host over an **authenticated, paired connection**; the host merely passes it verbatim in the claim request body. The host therefore still does not know who the account is or what tier it holds: it only knows whether it holds a lease admitted by the relay. Tier evaluation occurs in a single loopback request between the self-hosted relay and the account service; the relay writes quotas into the lease row without recording any user identifier. The `hello.relay` announcement, capability identifier `relay.tier.v1`, and the `relay.grant` frame **exist only when a second meeting point is configured**; without configuration, the handshake is byte-for-byte identical to today, and that frame answers `unknown-method`. The two configuration keys are `relaySecondaryControlUrl` and `relaySecondaryPublicSuffix`, both unconfigured by default.
352
357
 
353
358
  ## Known limitations
354
359
 
package/README.zh.md CHANGED
@@ -30,7 +30,7 @@
30
30
  - **订阅而非轮询。** `session.snapshot` 打开宿主的 follow 流并保持它,基线与其后的每一条增量都走同一条 socket。
31
31
  - **审批直达客户端,重连的手机还能拿回仍悬着的那些。** 需要授权的工具以 `approval.request` 事件到达,客户端用 `approval.resolve` 作答;无人应答的请求按拒绝处理,而声明了 `approvals.v1` 的连接会在握手之后再次收到所有未结算的审批。
32
32
  - **配对。** 一次性 bootstrap token 加 P-256 挑战应答产出可吊销的设备令牌;未配对连接只能触达三个方法。
33
- - **一个配对面板。** 同一插件行声明 `dsh.client` 浏览器半区:侧栏底部一个二维码图标(aria-label 为「配对手机(协议 v1)」),点开弹窗展示 30 秒有效的一次性配对二维码与「重新取码」动作。
33
+ - **一个配对面板。** 同一插件行声明 `dsh.client` 浏览器半区:侧栏底部一个二维码图标(aria-label 为「配对 iPhone」),点开弹窗展示 30 秒有效的一次性配对二维码与「重新取码」动作。
34
34
  - **中继无需改动。** 协议搭在实例本来就发布的那个 origin 上,中继这一跳照原样转发它,与其他所有请求无异。
35
35
 
36
36
  ## 传输
@@ -178,7 +178,7 @@ fork 的方法同样什么都不解释。`session.fork` 把 `sessionId` 与客
178
178
 
179
179
  ### Bootstrap token
180
180
 
181
- 配对入口位于侧栏底部的二维码图标,按钮的 aria-label 为「配对手机(协议 v1)」。点击后打开配对面板。该面板只在本机可用:令牌路由 `GET /remote-bridge/pair/token` 受回环门控保护,来源地址与 `Host` header 必须均为本机(非本机或经隧道访问一律返回 403)。
181
+ 配对入口位于侧栏底部的二维码图标,按钮的 aria-label 为「配对 iPhone」。点击后打开配对面板。该面板只在本机可用:令牌路由 `GET /remote-bridge/pair/token` 受回环门控保护,来源地址与 `Host` header 必须均为本机(非本机或经隧道访问一律返回 403)。
182
182
 
183
183
  配对码一次性有效且具备 30 秒时效(`BOOTSTRAP_TOKEN_TTL_MS = 30_000`),被首次 `pair.begin` 用掉即失效;在面板中点击「重新取码」会使上一张配对码作废并生成新码。面板中没有「停止」按钮,也没有「吊销所有已连接设备」的操作。同一条链接会打印到宿主日志,配对码本身则渲染在配对面板中供扫码。
184
184
 
@@ -237,7 +237,7 @@ curl -s http://127.0.0.1:3080/remote-bridge/pair/token
237
237
  ## 接入栈与安全模型
238
238
 
239
239
  `@linxin666/dsh-remote-bridge` 拥有完整的公网与局域网接入栈:
240
- - **中继身份与租约**:`relay-registry` 在 `$DSH_HOME/remote-web-ui-registry/<profile>.json` 下持久化中继身份(id 与 secret);改 relay 配置会重挂载插件行,当以 `relay=false` 挂载且盘上存在身份时,挂载时撤销上一次留下的注册行并 `pair.release()` 释放租约各一次(失败各记一行;卸载时不释放也不撤行,保留手机收藏地址由服务端 GC 回收;`relay=false` 挂载绝不铸造新身份,盘上无身份时零副作用、不写盘)。
240
+ - **中继身份与租约**:`relay-registry` 在 `$DSH_HOME/remote-web-ui-registry/<profile>.json` 下持久化中继身份(id 与 secret);改 relay 配置会重挂载插件行。在未配置隧道(`tunnel.mode === 'off'`)且尚无已配对设备时,插件启动保持静默,不铸造身份也不申领租约;仅当名册读出已配对设备、本机打开配对面板取码、新设备完成配对或开启隧道时才按需触发申领(同时过滤 `idle`/`claiming`/`dialing` 过渡态日志并对连续相同的失败日志去重)。当以 `relay=false` 挂载且盘上存在身份时,挂载时撤销上一次留下的注册行并 `pair.release()` 释放租约各一次(失败各记一行;卸载时不释放也不撤行,保留手机收藏地址由服务端 GC 回收;`relay=false` 挂载绝不铸造新身份,盘上无身份时零副作用、不写盘)。
241
241
  - **中继连接器**:`relay-connector` 并行维护快速隧道与命名隧道连接器;`relay-bridge-connector` 经 WSS 连接 Cloudflare Durable Object 会合点,并将连接状态记录在 `$DSH_HOME/remote-web-ui-relay-bridge.json`(状态文件写入经行为级验证,缺省落到 `$DSH_HOME`,非源码文本断言)。
242
242
  - **隧道生命周期**:`tunnel`、`tunnel-plan` 与 `tunnel-orphan` 管理平台原生 `cloudflared` 子进程,具备指数退避重启机制并自动清理崩溃遗留的孤儿进程。
243
243
  - **命名隧道端口同步**:`ingress-sync` 在宿主监听端口变化时,把 Cloudflare 命名隧道的 ingress 规则原子收敛到本机闸门端口。
@@ -246,7 +246,7 @@ curl -s http://127.0.0.1:3080/remote-bridge/pair/token
246
246
  本包的安全模型对所有外部接入入口实施严格的白名单隔离:
247
247
  - **入站网关(`src/host/ingress-gate.ts`)**:仅绑定 `127.0.0.1`,且仅将 `/ios/v1` 的 WebSocket 升级转发到本机协议端口,同时将 `Host` 头改写为回环权威。其余任何普通 HTTP 请求与非白名单升级一律直接返回 `404 {"error":"not-found"}` 并关闭连接,绝不建立上游连接。
248
248
  - **隧道的目标是入站网关而非 webServer 端口**:cloudflared 快速隧道与命名隧道的目标均指向 `ingress-gate` 的动态回环端口,绝不直连 `webServer` 端口。外界经隧道传入的请求无法触达 webServer 路由、内部 API 或其他插件。
249
- - **中继注册行与公网暴露面**:中继注册行只写入快速隧道的 URL,也就是入站闸门,公网因此只看得见 /ios/v1。计划为 quick 且隧道 running 时把闸门 URL 注册给中继 Worker(`<id>.dsh-market.com` 代理到本机);卸载时只清本地引用不撤行。二维码公网地址由 `livePublicOriginOf` 裁定:bridge 或 named 租约优先稳定子域名;quick 租约在注册未成功时退回隧道 running URL;无租约用隧道 URL;皆无则无地址。其后退回 `DSH_REMOTE_PUBLIC_BASE_URL`,局域网兜底仅当局域网转发器真的在监听时才按实际绑定的 address 与 port 给出(不猜地址列表首项,转发器停止即无兜底;已彻底移除磁盘 registry 行作为兜底地址,消除了对老插件数据文件的最后一处依赖)。
249
+ - **中继注册行与公网暴露面**:中继注册行只写入快速隧道的 URL,也就是入站闸门,公网因此只看得见 /ios/v1。计划为 quick 且隧道 running 时把闸门 URL 注册给中继 Worker(代理稳定子域名到本机,端点与后缀由配置决定、缺省为 `<id>.dsh-market.com`);卸载时只清本地引用不撤行。二维码公网地址由 `livePublicOriginOf` 裁定:bridge 或 named 租约优先稳定子域名;quick 租约在注册未成功时退回隧道 running URL;无租约用隧道 URL;皆无则无地址。其后退回 `DSH_REMOTE_PUBLIC_BASE_URL`,局域网兜底仅当局域网转发器真的在监听时才按实际绑定的 address 与 port 给出(不猜地址列表首项,转发器停止即无兜底;已彻底移除磁盘 registry 行作为兜底地址,消除了对老插件数据文件的最后一处依赖)。
250
250
  - **局域网转发器的目标同样是入站网关**:局域网转发器监听本机局域网 IPv4 地址,并将请求严格转发至 `ingress-gate` 端口,因此局域网入口的暴露面同样仅有 `/ios/v1`。
251
251
  - **中继桥会合点白名单**:`relay-bridge-connector.ts` 对 Durable Object 汇聚的入站流执行完全相同的白名单检查,非 `/ios/v1` 的 HTTP 流直接应答 `404 {"error":"not-found"}`,非白名单 WebSocket 升级直接回复 `ws-fail 404 {"error":"not-found"}`,两条路都不建立上游连接。
252
252
  - **身份目录沿用历史拼写与并存禁忌**:中继身份目录 `$DSH_HOME/remote-web-ui-registry/` 与状态文件 `remote-web-ui-relay-bridge.json` 有意沿用历史拼写,确保既有 profile 保持身份连续性,已配对设备升级后无需重新配对。**已知风险与并存禁忌**:同一 profile 切勿同时启用本插件与已弃用的 `dsh-remote-web-ui` 的中继——两者按 profile 共用同一份身份文件;若新桥以 `relay=false` 挂载,会撤销该身份下的注册行并释放租约,从而打断老插件正在使用的公网中继;若两侧 relay 同时开启,bridge 传输下两个连接器会拿同一凭据竞争同一个 Durable Object 连接互相顶掉,quick 传输下后注册者覆盖前者。该收尾行为是有意设计的。
@@ -258,7 +258,9 @@ curl -s http://127.0.0.1:3080/remote-bridge/pair/token
258
258
 
259
259
  | 配置项 | 类型 | 默认值 | 说明 |
260
260
  | --- | --- | --- | --- |
261
- | `relay` | boolean | `true` | 是否申领 relay 租约。默认开启;无隧道时仍 claim 租约,因此默认配置下公网即可用。 |
261
+ | `relay` | boolean | `true` | 是否申领 relay 租约。默认开启;无隧道时在已有配对设备或发起配对时按需 claim 租约。 |
262
+ | `relayControlUrl` | string | `'https://dsh-market.com/api/relay'` | 中继控制面基址,claim/release/register/unregister 都从它派生。 |
263
+ | `relayPublicSuffix` | string | `'.dsh-market.com'` | 稳定主机名后缀。 |
262
264
  | `autoTunnel` | boolean | `false` | 是否启动指向入站网关的 Cloudflare 快速隧道。 |
263
265
  | `lanBind` | boolean | `undefined`(关) | 是否启动监听本机局域网 IPv4 地址的局域网转发器。 |
264
266
  | `tunnelToken` | string | `undefined` | 运行 Cloudflare 命名隧道所需的隧道令牌。 |
@@ -275,11 +277,13 @@ curl -s http://127.0.0.1:3080/remote-bridge/pair/token
275
277
 
276
278
  面板只做一件事——把活着的那个一次性配对码摆到操作者面前,且只有这一个阅读顺序:
277
279
 
278
- - **二维码本身就是那个码。** 它要么装 43 个 base64url 字符的裸 token,要么在宿主说得出自己公网地址时装 `{token,url}` 文档,扫一次就把手机配好。若放一个宿主没背书过的 URL,手机端的解析器会顺手把 origin 改写成这台机器的 loopback 地址,而那恰恰是手机够不到的地址。编码串只在二维码部件的 `data-dsh-qr-value` 属性里留一份镜像,供 UI 检查不必解码就比对;它从不以文字形式渲染。
280
+ - **卡头与副标题说明目标。** 标题为「iOS App 配对」,副标题「用 iOS App(内测)扫描二维码,把 iPhone 连到这台电脑上。配对码只在本机显示。」,说明操作对象与安全边界。
281
+ - **二维码本身就是那个码。** 它要么装 43 个 base64url 字符的裸 token,要么在宿主说得出自己公网地址时装 `{token,url}` 文档,扫一次就把 iPhone 配好。若放一个宿主没背书过的 URL,App 端的解析器会顺手把 origin 改写成这台机器的 loopback 地址,而那恰恰是 iPhone 够不到的地址。编码串只在二维码部件的 `data-dsh-qr-value` 属性里留一份镜像,供 UI 检查不必解码就比对;它从不以文字形式渲染。
279
282
  - **二维码下方只有一条状态行。** 活着的码在进度条旁倒数那 30 秒;过期的码在同一个固定高度里直说过期,变的只有那句话。
280
- - **一条地址说明。** 宿主定位到中继地址时,这一行就写明手机将要连到哪儿;定位不到时,它直说没找到公网地址、手机里的连接地址得手填公网中继,并点明本页所在的 `127.0.0.1:<端口>` 只有本机能连。
281
- - **一条一次性说明。** 手机一开始配对,这个码就作废;重新取码同样会作废上一张。
283
+ - **一条地址说明。** 宿主定位到中继地址时,这一行写明「iPhone 将连到 {origin}」;定位不到时,它直说「没有找到公网地址:先在 App 里把连接地址填成你的公网中继,再扫码。本页的 {host} 只有本机能连。」。
284
+ - **一条一次性说明。** 配对码一次性有效:iPhone 一开始配对就作废,重新取码也会作废上一张。
282
285
  - **一行动作。** 复制把二维码里那个字符串原样放进剪贴板,「重新取码」签发新 token 并作废上一张;两者都是同一个库控件、同一个尺寸,交互态不会各走一套。码一旦过期,回到可扫状态的唯一路径就是重新取码:复制被禁用,二维码原地降级变暗,而不是缩小或被移除。
286
+ - **一行内测入口。** 提供「[iOS App 还在内测,欢迎来 Discord 交流](https://discord.gg/nBy28kjun)」,整行可点击打开。
283
287
  - **失败不静默。** 取码走的就是操作者本可以用 curl 打的那条仅 loopback 路由:`403` 渲染成「这个页面不是从本机打开的」且不给出可点的动作;请求没到达则渲染成它自己的不可达状态并给出重试;宿主回了别的状态就把那个状态码说出来。
284
288
 
285
289
  开与关是同一段动效的两条腿:卡片保持挂载,把弹窗自己的进场淡入反向播完才卸载;reduced-motion 下这条生命周期换成一段短淡出,而不是干脆没有出场。几何在每种状态里都钉住——二维码的盒子、状态行、地址说明与复制标签都不改高度和宽度——所以倒计时、过期与复制确认都不会挪动它们旁边的元素。
@@ -346,6 +350,7 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-remote-bridge
346
350
  - **令牌比对不泄漏长度。** 用的是定长比较而非提前返回的比较,因此错误令牌无法被逐字节逼近。
347
351
  - **审批在客户端在线时 fail closed。** 只要还有一个已配对客户端在线,桥才认领工具的权限请求;一个都没有时,请求交给下一个应答者而不是卡住。已认领而无人应答的审批会被归一为 `unavailable`,宿主按拒绝处理:手机沉默永远不等于同意。
348
352
  - **header 是更安全的载体。** `Authorization: Bearer <deviceToken>` 让凭据不进入 URL;`?token=` 是给无法设置握手 header 的客户端的,此时中继、边缘与访问日志都会看到一条以该设备身份鉴权的 URL。
353
+ - **中继档位分流与授权凭据边界。** 名册(`devices.json`)schema 3 → 4,每台设备行新增可选的 `relay: {grant, receivedAt}`。那枚 `grant` 是账号服务签发的 30 天 HS256 凭据,经**已配对的加密连接**由手机交给宿主,宿主只把它原样放进 claim 请求体。宿主因此仍然不知道账号是谁、也不知道档位:它只知道「我有没有一份被中继承认的租约」。档位判定发生在自建中继与账号服务之间的一次回环请求里,中继只把额度写进租约行,不落任何用户标识。`hello.relay`、能力名 `relay.tier.v1`、`relay.grant` 这一帧**只在配置了第二个会合点时才存在**;不配置时握手逐字节等于今天,那一帧回 `unknown-method`。两个配置项名:`relaySecondaryControlUrl` 与 `relaySecondaryPublicSuffix`,缺省都不配置。
349
354
 
350
355
  ## 已知限制
351
356
 
package/lib/client.js CHANGED
@@ -1226,7 +1226,7 @@ window.__ModuleLoader__.load({
1226
1226
  const PART_PANEL = "panel";
1227
1227
  //#endregion
1228
1228
  //#region \0dsh-css:packages/dsh-remote-bridge/src/client/panel.module.css.mjs
1229
- const css$1 = ".sd7VOG_panel,.sd7VOG_trigger,.sd7VOG_dialog{--pair-space-1:4px;--pair-space-2:8px;--pair-space-3:12px;--pair-space-4:24px;--pair-title-size:15px;--pair-title-line:24px;--pair-text-size:13px;--pair-text-line:20px;--pair-state-size:12px;--pair-state-line:18px;--pair-qr:184px;--pair-bar:4px;--pair-seat:36px;--pair-close:28px;--pair-hit:44px;--pair-width:460px;--pair-faded:.35;--pair-focus-offset:2px;--pair-status:calc(var(--pair-state-line) + var(--pair-space-1) + var(--pair-bar));--pair-address:calc(var(--pair-text-line) * 2)}.sd7VOG_trigger{width:var(--pair-seat);height:var(--pair-seat);color:var(--dsw-alias-label-secondary);cursor:pointer;transition:background-color var(--ds-transition-duration) ease, color var(--ds-transition-duration) ease;background:0 0;border:none;border-radius:50%;flex:none;order:-1;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}.sd7VOG_trigger:after{content:\"\";inset:calc((var(--pair-hit) - var(--pair-seat)) / -2);border-radius:50%;position:absolute}.sd7VOG_trigger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.sd7VOG_trigger:active:not(:disabled){background:var(--dsw-alias-interactive-bg-active)}.sd7VOG_trigger:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:var(--pair-focus-offset)}.sd7VOG_trigger[data-wide=wide]{order:1;margin-inline-start:auto}[class*=footerActions]:has([data-dsh-plugin=remote-bridge][data-wide=rail]){align-items:center;gap:var(--pair-space-1,4px);flex-direction:column}.sd7VOG_dialog.sd7VOG_dialog{width:min(var(--pair-width), 100%);max-height:100%;padding:var(--pair-space-4);overflow:auto}.sd7VOG_panel{gap:var(--pair-space-3);box-sizing:border-box;width:100%;max-width:100%;color:var(--dsw-alias-label-primary);font-size:var(--pair-text-size);line-height:var(--pair-text-line);transition:opacity var(--ds-transition-duration) var(--ds-ease-in-out);flex-direction:column;display:flex}.sd7VOG_panel[data-closing]{opacity:0;animation:var(--pair-exit-name,none) var(--ds-transition-duration) var(--ds-ease-in-out) reverse both}@media (prefers-reduced-motion:reduce){.sd7VOG_panel[data-closing]{animation:none}}.sd7VOG_header{align-items:flex-start;gap:var(--pair-space-3);display:flex}.sd7VOG_heading{flex:1;min-width:0}.sd7VOG_title{font-size:var(--pair-title-size);font-weight:600;line-height:var(--pair-title-line);margin:0}.sd7VOG_subtitle{margin:var(--pair-space-1) 0 0;color:var(--dsw-alias-label-secondary);font-size:var(--pair-text-size);line-height:var(--pair-text-line)}.sd7VOG_close{width:var(--pair-close);color:var(--dsw-alias-label-secondary);flex:none;padding:0;position:relative}.sd7VOG_close:after{content:\"\";inset:calc((var(--pair-hit) - var(--pair-close)) / -2);border-radius:50%;position:absolute}.sd7VOG_body{gap:var(--pair-space-2);flex-direction:column;display:flex}.sd7VOG_qrCard{align-items:center;gap:var(--pair-space-2);padding:var(--pair-space-3);border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-1);flex-direction:column;display:flex}.sd7VOG_qrSlot{width:var(--pair-qr);height:var(--pair-qr);justify-content:center;align-items:center;display:flex}.sd7VOG_qrSlot[data-expired]{opacity:var(--pair-faded)}.sd7VOG_skeleton{width:var(--pair-qr);height:var(--pair-qr);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover);display:block}.sd7VOG_status{justify-content:center;align-items:center;gap:var(--pair-space-1);box-sizing:border-box;width:100%;height:var(--pair-status);flex-direction:column;display:flex}.sd7VOG_statusText{color:var(--dsw-alias-label-secondary);font-size:var(--pair-state-size);line-height:var(--pair-state-line);font-variant-numeric:tabular-nums;margin:0}.sd7VOG_bar{width:100%;height:var(--pair-bar);border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-interactive-bg-hover);display:block;overflow:hidden}.sd7VOG_barFill{border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-brand-primary);height:100%;transition:width var(--ds-transition-duration) linear;display:block}.sd7VOG_address{min-height:var(--pair-address);color:var(--dsw-alias-label-secondary);font-size:var(--pair-text-size);line-height:var(--pair-text-line);align-items:center;margin:0;display:flex}.sd7VOG_address[data-tone=warning]{color:var(--dsw-alias-state-warn-primary)}.sd7VOG_hint{color:var(--dsw-alias-label-tertiary);font-size:var(--pair-text-size);line-height:var(--pair-text-line);margin:0}.sd7VOG_notice{align-items:flex-start;gap:var(--pair-space-2);padding:var(--pair-space-3);border:1px solid var(--dsw-alias-state-error-primary);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);display:flex}.sd7VOG_noticeIcon{color:var(--dsw-alias-state-error-primary);flex:none;display:inline-flex}.sd7VOG_noticeCopy{min-width:0}.sd7VOG_noticeTitle{font-size:var(--pair-text-size);font-weight:600;line-height:var(--pair-text-line);margin:0}.sd7VOG_noticeText{margin:var(--pair-space-1) 0 0;color:var(--dsw-alias-label-secondary);font-size:var(--pair-text-size);line-height:var(--pair-text-line)}.sd7VOG_actions{justify-content:flex-end;align-items:center;gap:var(--pair-space-2);display:flex}.sd7VOG_labels{display:grid}.sd7VOG_label{grid-area:1/1}.sd7VOG_label[data-visible=false]{visibility:hidden}.sd7VOG_announce{clip:rect(0, 0, 0, 0);clip-path:inset(0);width:0;height:0;margin:0;position:absolute;overflow:hidden}";
1229
+ const css$1 = ".sd7VOG_panel,.sd7VOG_trigger,.sd7VOG_dialog{--pair-space-1:4px;--pair-space-2:8px;--pair-space-3:12px;--pair-space-4:24px;--pair-title-size:15px;--pair-title-line:24px;--pair-text-size:13px;--pair-text-line:20px;--pair-state-size:12px;--pair-state-line:18px;--pair-qr:184px;--pair-bar:4px;--pair-seat:36px;--pair-close:28px;--pair-hit:44px;--pair-width:460px;--pair-faded:.35;--pair-focus-offset:2px;--pair-status:calc(var(--pair-state-line) + var(--pair-space-1) + var(--pair-bar));--pair-address:calc(var(--pair-text-line) * 2)}.sd7VOG_trigger{width:var(--pair-seat);height:var(--pair-seat);color:var(--dsw-alias-label-secondary);cursor:pointer;transition:background-color var(--ds-transition-duration) ease, color var(--ds-transition-duration) ease;background:0 0;border:none;border-radius:50%;flex:none;order:-1;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}.sd7VOG_trigger:after{content:\"\";inset:calc((var(--pair-hit) - var(--pair-seat)) / -2);border-radius:50%;position:absolute}.sd7VOG_trigger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.sd7VOG_trigger:active:not(:disabled){background:var(--dsw-alias-interactive-bg-active)}.sd7VOG_trigger:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:var(--pair-focus-offset)}.sd7VOG_trigger[data-wide=wide]{order:1;margin-inline-start:auto}[class*=footerActions]:has([data-dsh-plugin=remote-bridge][data-wide=rail]){align-items:center;gap:var(--pair-space-1,4px);flex-direction:column}.sd7VOG_dialog.sd7VOG_dialog{width:min(var(--pair-width), 100%);max-height:100%;padding:var(--pair-space-4);overflow:auto}.sd7VOG_panel{gap:var(--pair-space-3);box-sizing:border-box;width:100%;max-width:100%;color:var(--dsw-alias-label-primary);font-size:var(--pair-text-size);line-height:var(--pair-text-line);transition:opacity var(--ds-transition-duration) var(--ds-ease-in-out);flex-direction:column;display:flex}.sd7VOG_panel[data-closing]{opacity:0;animation:var(--pair-exit-name,none) var(--ds-transition-duration) var(--ds-ease-in-out) reverse both}@media (prefers-reduced-motion:reduce){.sd7VOG_panel[data-closing]{animation:none}}.sd7VOG_header{align-items:flex-start;gap:var(--pair-space-3);display:flex}.sd7VOG_heading{flex:1;min-width:0}.sd7VOG_title{font-size:var(--pair-title-size);font-weight:600;line-height:var(--pair-title-line);margin:0}.sd7VOG_subtitle{margin:var(--pair-space-1) 0 0;color:var(--dsw-alias-label-secondary);font-size:var(--pair-text-size);line-height:var(--pair-text-line)}.sd7VOG_close{width:var(--pair-close);color:var(--dsw-alias-label-secondary);flex:none;padding:0;position:relative}.sd7VOG_close:after{content:\"\";inset:calc((var(--pair-hit) - var(--pair-close)) / -2);border-radius:50%;position:absolute}.sd7VOG_body{gap:var(--pair-space-2);flex-direction:column;display:flex}.sd7VOG_qrCard{align-items:center;gap:var(--pair-space-2);padding:var(--pair-space-3);border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-1);flex-direction:column;display:flex}.sd7VOG_qrSlot{width:var(--pair-qr);height:var(--pair-qr);justify-content:center;align-items:center;display:flex}.sd7VOG_qrSlot[data-expired]{opacity:var(--pair-faded)}.sd7VOG_skeleton{width:var(--pair-qr);height:var(--pair-qr);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover);display:block}.sd7VOG_status{justify-content:center;align-items:center;gap:var(--pair-space-1);box-sizing:border-box;width:100%;height:var(--pair-status);flex-direction:column;display:flex}.sd7VOG_statusText{color:var(--dsw-alias-label-secondary);font-size:var(--pair-state-size);line-height:var(--pair-state-line);font-variant-numeric:tabular-nums;margin:0}.sd7VOG_bar{width:100%;height:var(--pair-bar);border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-interactive-bg-hover);display:block;overflow:hidden}.sd7VOG_barFill{border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-brand-primary);height:100%;transition:width var(--ds-transition-duration) linear;display:block}.sd7VOG_address{min-height:var(--pair-address);color:var(--dsw-alias-label-secondary);font-size:var(--pair-text-size);line-height:var(--pair-text-line);align-items:center;margin:0;display:flex}.sd7VOG_address[data-tone=warning]{color:var(--dsw-alias-state-warn-primary)}.sd7VOG_hint{color:var(--dsw-alias-label-tertiary);font-size:var(--pair-text-size);line-height:var(--pair-text-line);margin:0}.sd7VOG_invite{color:var(--dsw-alias-label-secondary);font-size:var(--pair-text-size);line-height:var(--pair-text-line);transition:color var(--ds-transition-duration) ease;align-self:flex-start;margin:0;text-decoration:underline}.sd7VOG_invite:hover{color:var(--dsw-alias-label-primary)}.sd7VOG_invite:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:var(--pair-focus-offset)}.sd7VOG_notice{align-items:flex-start;gap:var(--pair-space-2);padding:var(--pair-space-3);border:1px solid var(--dsw-alias-state-error-primary);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);display:flex}.sd7VOG_noticeIcon{color:var(--dsw-alias-state-error-primary);flex:none;display:inline-flex}.sd7VOG_noticeCopy{min-width:0}.sd7VOG_noticeTitle{font-size:var(--pair-text-size);font-weight:600;line-height:var(--pair-text-line);margin:0}.sd7VOG_noticeText{margin:var(--pair-space-1) 0 0;color:var(--dsw-alias-label-secondary);font-size:var(--pair-text-size);line-height:var(--pair-text-line)}.sd7VOG_actions{justify-content:flex-end;align-items:center;gap:var(--pair-space-2);display:flex}.sd7VOG_labels{display:grid}.sd7VOG_label{grid-area:1/1}.sd7VOG_label[data-visible=false]{visibility:hidden}.sd7VOG_announce{clip:rect(0, 0, 0, 0);clip-path:inset(0);width:0;height:0;margin:0;position:absolute;overflow:hidden}";
1230
1230
  const tagId$1 = "@linxin666/dsh-remote-bridge/packages/dsh-remote-bridge/src/client/panel.module.css";
1231
1231
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
1232
1232
  const tag = document.createElement("style");
@@ -1247,6 +1247,7 @@ window.__ModuleLoader__.load({
1247
1247
  "header": "sd7VOG_header",
1248
1248
  "heading": "sd7VOG_heading",
1249
1249
  "hint": "sd7VOG_hint",
1250
+ "invite": "sd7VOG_invite",
1250
1251
  "label": "sd7VOG_label",
1251
1252
  "labels": "sd7VOG_labels",
1252
1253
  "notice": "sd7VOG_notice",
@@ -1281,6 +1282,13 @@ window.__ModuleLoader__.load({
1281
1282
  /** The custom property carrying the dialog's own enter keyframe name. */
1282
1283
  const EXIT_NAME_VAR = "--pair-exit-name";
1283
1284
  /**
1285
+ * Where a reader of the beta build can reach the people running it. The URL is
1286
+ * code, not copy: the dictionaries carry the sentence, this constant carries the
1287
+ * destination, so a translation cannot retarget the link and a check can assert
1288
+ * the real one.
1289
+ */
1290
+ const COMMUNITY_INVITE_URL = "https://discord.gg/nBy28kjun";
1291
+ /**
1284
1292
  * The QR symbol, memoized on the secret: the countdown re-renders the panel
1285
1293
  * every second, and qrcode.react rebuilds the whole module path on each render.
1286
1294
  * The encoded value is the host's own `pairingUrl` verbatim when there is one —
@@ -1371,84 +1379,94 @@ window.__ModuleLoader__.load({
1371
1379
  }),
1372
1380
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1373
1381
  className: panel_module_css_default.body,
1374
- children: [(state.kind === "forbidden" || state.kind === "failed" || state.kind === "unreachable") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1375
- className: panel_module_css_default.notice,
1376
- "data-dsh-part": "notice",
1377
- "data-tone": "alert",
1378
- role: "alert",
1379
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1380
- className: panel_module_css_default.noticeIcon,
1381
- "aria-hidden": "true",
1382
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineRegular, {})
1383
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1384
- className: panel_module_css_default.noticeCopy,
1385
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1386
- className: panel_module_css_default.noticeTitle,
1387
- children: [
1388
- state.kind === "forbidden" && t("forbidden.title"),
1389
- state.kind === "failed" && t("failed.title"),
1390
- state.kind === "unreachable" && t("unreachable.title")
1391
- ]
1392
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1393
- className: panel_module_css_default.noticeText,
1394
- children: [
1395
- state.kind === "forbidden" && t("forbidden.body"),
1396
- state.kind === "failed" && t("failed.body", { status: String(state.status) }),
1397
- state.kind === "unreachable" && t("unreachable.body")
1398
- ]
1399
- })]
1400
- })]
1401
- }), (state.kind === "reading" || ready) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1402
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1403
- className: panel_module_css_default.qrCard,
1404
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1405
- className: panel_module_css_default.qrSlot,
1406
- "data-dsh-part": "qr",
1407
- ["data-dsh-qr-value"]: payload,
1408
- ["data-expired"]: expired || void 0,
1409
- children: ready ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PairQrCode, {
1410
- value: payload,
1411
- label: t("pair.qrLabel")
1412
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1413
- className: panel_module_css_default.skeleton,
1414
- "aria-hidden": "true"
1415
- })
1382
+ children: [
1383
+ (state.kind === "forbidden" || state.kind === "failed" || state.kind === "unreachable") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1384
+ className: panel_module_css_default.notice,
1385
+ "data-dsh-part": "notice",
1386
+ "data-tone": "alert",
1387
+ role: "alert",
1388
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1389
+ className: panel_module_css_default.noticeIcon,
1390
+ "aria-hidden": "true",
1391
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineRegular, {})
1416
1392
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1417
- className: panel_module_css_default.status,
1418
- children: [
1419
- !ready && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1420
- className: panel_module_css_default.statusText,
1421
- children: t("state.reading")
1422
- }),
1423
- ready && expired && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1424
- className: panel_module_css_default.statusText,
1425
- role: "status",
1426
- children: t("pair.expired")
1427
- }),
1428
- ready && !expired && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1429
- className: panel_module_css_default.statusText,
1430
- children: t("pair.countdown", { s: String(seconds) })
1431
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1432
- className: panel_module_css_default.bar,
1433
- "aria-hidden": "true",
1434
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1435
- className: panel_module_css_default.barFill,
1436
- style: { width: `${String(percent)}%` }
1437
- })
1438
- })] })
1439
- ]
1393
+ className: panel_module_css_default.noticeCopy,
1394
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1395
+ className: panel_module_css_default.noticeTitle,
1396
+ children: [
1397
+ state.kind === "forbidden" && t("forbidden.title"),
1398
+ state.kind === "failed" && t("failed.title"),
1399
+ state.kind === "unreachable" && t("unreachable.title")
1400
+ ]
1401
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1402
+ className: panel_module_css_default.noticeText,
1403
+ children: [
1404
+ state.kind === "forbidden" && t("forbidden.body"),
1405
+ state.kind === "failed" && t("failed.body", { status: String(state.status) }),
1406
+ state.kind === "unreachable" && t("unreachable.body")
1407
+ ]
1408
+ })]
1440
1409
  })]
1441
1410
  }),
1442
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1443
- className: panel_module_css_default.address,
1444
- "data-tone": located ? "plain" : "warning",
1445
- children: [ready && located && t("origin.located", { origin: state.origin ?? "" }), ready && !located && t("origin.missing", { host })]
1446
- }),
1447
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1448
- className: panel_module_css_default.hint,
1449
- children: t("pair.usedHint")
1411
+ (state.kind === "reading" || ready) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1412
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1413
+ className: panel_module_css_default.qrCard,
1414
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1415
+ className: panel_module_css_default.qrSlot,
1416
+ "data-dsh-part": "qr",
1417
+ ["data-dsh-qr-value"]: payload,
1418
+ ["data-expired"]: expired || void 0,
1419
+ children: ready ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PairQrCode, {
1420
+ value: payload,
1421
+ label: t("pair.qrLabel")
1422
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1423
+ className: panel_module_css_default.skeleton,
1424
+ "aria-hidden": "true"
1425
+ })
1426
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1427
+ className: panel_module_css_default.status,
1428
+ children: [
1429
+ !ready && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1430
+ className: panel_module_css_default.statusText,
1431
+ children: t("state.reading")
1432
+ }),
1433
+ ready && expired && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1434
+ className: panel_module_css_default.statusText,
1435
+ role: "status",
1436
+ children: t("pair.expired")
1437
+ }),
1438
+ ready && !expired && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1439
+ className: panel_module_css_default.statusText,
1440
+ children: t("pair.countdown", { s: String(seconds) })
1441
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1442
+ className: panel_module_css_default.bar,
1443
+ "aria-hidden": "true",
1444
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1445
+ className: panel_module_css_default.barFill,
1446
+ style: { width: `${String(percent)}%` }
1447
+ })
1448
+ })] })
1449
+ ]
1450
+ })]
1451
+ }),
1452
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1453
+ className: panel_module_css_default.address,
1454
+ "data-tone": located ? "plain" : "warning",
1455
+ children: [ready && located && t("origin.located", { origin: state.origin ?? "" }), ready && !located && t("origin.missing", { host })]
1456
+ }),
1457
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1458
+ className: panel_module_css_default.hint,
1459
+ children: t("pair.usedHint")
1460
+ })
1461
+ ] }),
1462
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
1463
+ className: panel_module_css_default.invite,
1464
+ href: COMMUNITY_INVITE_URL,
1465
+ target: "_blank",
1466
+ rel: "noopener noreferrer",
1467
+ children: t("community.invite")
1450
1468
  })
1451
- ] })]
1469
+ ]
1452
1470
  }),
1453
1471
  state.kind !== "forbidden" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
1454
1472
  className: panel_module_css_default.actions,
@@ -2229,10 +2247,12 @@ window.__ModuleLoader__.load({
2229
2247
  * the header of an interactive card (§35.11).
2230
2248
  *
2231
2249
  * The panel has one job — put the live one-shot code in front of the operator as
2232
- * a QR symbol — so its copy carries exactly four things: what to do with the
2233
- * symbol, how long it lives, which address the phone will actually dial, and why
2234
- * the code is single-use. No key states how the host finds its public address:
2235
- * that is an implementation fact the reader cannot act on.
2250
+ * a QR symbol — so its copy carries what to do with the symbol, how long it
2251
+ * lives, which address the phone will actually dial, why the code is single-use,
2252
+ * and that the app is still in testing: the reader is told what they are joining
2253
+ * and where to ask about it. No key states how the host finds its public
2254
+ * address, and no key names the wire protocol: both are implementation facts the
2255
+ * reader cannot act on.
2236
2256
  *
2237
2257
  * The card's keys say only what the transcript row can act on: whether the page
2238
2258
  * is still waiting for the operator, that it is over, that this desktop renders
@@ -2241,17 +2261,18 @@ window.__ModuleLoader__.load({
2241
2261
  */
2242
2262
  /** Simplified Chinese dictionary (the key-set source of truth). */
2243
2263
  const zh = {
2244
- "entry.label": "配对手机(协议 v1)",
2245
- "title": "协议 v1 配对",
2246
- "subtitle": "用手机 App 扫描二维码,即可让手机以协议 v1 连上这台宿主。配对码由本机签发,只在本机显示。",
2264
+ "entry.label": "配对 iPhone",
2265
+ "title": "iOS App 配对",
2266
+ "subtitle": "用 iOS App(内测)扫描二维码,把 iPhone 连到这台电脑上。配对码只在本机显示。",
2247
2267
  "state.reading": "正在取配对码…",
2248
2268
  "pair.qrLabel": "配对二维码",
2249
2269
  "pair.countdown": "剩余 {s} 秒",
2250
2270
  "pair.expired": "配对码已过期",
2251
2271
  "pair.refresh": "重新取码",
2252
- "pair.usedHint": "配对码一次性有效:手机一开始配对即作废,重新取码也会作废上一张。",
2253
- "origin.located": "手机将连到 {origin}",
2254
- "origin.missing": "没有找到公网地址:请先在手机里把连接地址填成你的公网中继,再扫码。本页的 {host} 只有本机能连。",
2272
+ "pair.usedHint": "配对码一次性有效:iPhone 一开始配对就作废,重新取码也会作废上一张。",
2273
+ "origin.located": "iPhone 将连到 {origin}",
2274
+ "origin.missing": "没有找到公网地址:先在 App 里把连接地址填成你的公网中继,再扫码。本页的 {host} 只有本机能连。",
2275
+ "community.invite": "iOS App 还在内测,欢迎来 Discord 交流",
2255
2276
  "forbidden.title": "这个页面不是从本机打开的",
2256
2277
  "forbidden.body": "配对码只能在本机 Web UI 上取。请在本机浏览器打开 http://127.0.0.1:<端口> 后重试。",
2257
2278
  "failed.title": "取配对码失败",
@@ -2273,17 +2294,18 @@ window.__ModuleLoader__.load({
2273
2294
  };
2274
2295
  /** English dictionary, key-for-key with the zh source. */
2275
2296
  const en = {
2276
- "entry.label": "Pair a phone (protocol v1)",
2277
- "title": "Protocol v1 pairing",
2278
- "subtitle": "Scan the QR code with the phone app to let the phone reach this host over protocol v1. The code is minted by this machine and shown only here.",
2297
+ "entry.label": "Pair an iPhone",
2298
+ "title": "iOS app pairing",
2299
+ "subtitle": "Scan the QR code with the iOS app (beta) to connect an iPhone to this computer. The code is shown only on this machine.",
2279
2300
  "state.reading": "Requesting a pairing code…",
2280
2301
  "pair.qrLabel": "Pairing QR code",
2281
2302
  "pair.countdown": "{s} s left",
2282
2303
  "pair.expired": "The pairing code expired",
2283
2304
  "pair.refresh": "New code",
2284
2305
  "pair.usedHint": "The code is single-use: pairing spends it, and a new code voids the previous one.",
2285
- "origin.located": "The phone will dial {origin}",
2286
- "origin.missing": "No public address found: set the phone app to your public relay first, then scan. {host} (this page) is reachable only from this machine.",
2306
+ "origin.located": "The iPhone will dial {origin}",
2307
+ "origin.missing": "No public address found: set the connection address in the app to your public relay first, then scan. {host} (this page) is reachable only from this machine.",
2308
+ "community.invite": "The iOS app is in beta. Come talk to us on Discord",
2287
2309
  "forbidden.title": "This page is not open on this machine",
2288
2310
  "forbidden.body": "Pairing codes can only be read from the machine itself. Open http://127.0.0.1:<port> in a browser on this machine and retry.",
2289
2311
  "failed.title": "Could not read a pairing code",