@linxin666/dsh-remote-bridge 0.4.13 → 0.4.15

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.
Files changed (41) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +17 -12
  3. package/README.zh.md +17 -12
  4. package/lib/client.js +160 -109
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +3053 -4804
  7. package/lib/types/client/PairPanel.d.ts +13 -1
  8. package/lib/types/client/locales.d.ts +18 -10
  9. package/lib/types/client/pair-token.d.ts +7 -0
  10. package/lib/types/core/connection.d.ts +41 -0
  11. package/lib/types/core/devices.d.ts +60 -7
  12. package/lib/types/core/pair-address.d.ts +25 -0
  13. package/lib/types/core/protocol.d.ts +22 -0
  14. package/lib/types/core/push.d.ts +19 -1
  15. package/lib/types/host/relay-bridge-connector.d.ts +19 -0
  16. package/lib/types/host/relay-connector.d.ts +4 -0
  17. package/lib/types/host/relay-control.d.ts +77 -6
  18. package/lib/types/host/relay-registry.d.ts +12 -3
  19. package/lib/types/host/relay-secondary.d.ts +209 -0
  20. package/lib/types/host/relay.d.ts +1 -1
  21. package/lib/types/host/routes.d.ts +5 -0
  22. package/lib/types/index.d.ts +65 -3
  23. package/package.json +16 -16
  24. package/src/client/PairEntry.tsx +1 -0
  25. package/src/client/PairPanel.tsx +44 -5
  26. package/src/client/locales.ts +25 -15
  27. package/src/client/pair-token.ts +17 -2
  28. package/src/client/panel.module.css +32 -0
  29. package/src/core/connection.ts +110 -0
  30. package/src/core/devices.ts +141 -17
  31. package/src/core/pair-address.ts +50 -0
  32. package/src/core/protocol.ts +24 -0
  33. package/src/core/push.ts +20 -1
  34. package/src/host/relay-bridge-connector.ts +68 -2
  35. package/src/host/relay-connector.ts +9 -2
  36. package/src/host/relay-control.ts +98 -7
  37. package/src/host/relay-registry.ts +17 -5
  38. package/src/host/relay-secondary.ts +478 -0
  39. package/src/host/relay.ts +1 -1
  40. package/src/host/routes.ts +22 -5
  41. package/src/index.ts +270 -35
package/lib/client.js CHANGED
@@ -1211,6 +1211,36 @@ window.__ModuleLoader__.load({
1211
1211
  });
1212
1212
  QRCodeSVG.displayName = "QRCodeSVG";
1213
1213
  //#endregion
1214
+ //#region src/core/pair-address.ts
1215
+ /**
1216
+ * Hosts a phone can only reach from the same network: the private IPv4 ranges,
1217
+ * the unspecified address, and the IPv6 loopback, unique-local and link-local
1218
+ * prefixes. IPv4-mapped IPv6 and anything else this does not place stays public,
1219
+ * because the failure this predicate may never have is printing a name the host
1220
+ * did not vouch for.
1221
+ */
1222
+ const LAN_HOST_RE = /^(?:localhost|0\.0\.0\.0|(?:(?:10|127)(?:\.\d{1,3}){3}|192\.168(?:\.\d{1,3}){2}|172\.(?:1[6-9]|2\d|3[01])(?:\.\d{1,3}){2}|169\.254(?:\.\d{1,3}){2})|\[(?:::1|f[cd][0-9a-f]{2}:|fe[89ab][0-9a-f]:)[0-9a-f:]*\])$/i;
1223
+ /** The hostname a URL carries, or null when the value is not a URL at all. */
1224
+ function hostnameOf(origin) {
1225
+ try {
1226
+ return new URL(origin).hostname;
1227
+ } catch {
1228
+ return null;
1229
+ }
1230
+ }
1231
+ /**
1232
+ * Whether a located origin answers only inside this network.
1233
+ * @param origin - the located origin, or null when there is none.
1234
+ * @param source - where the host said that origin came from.
1235
+ * @returns true when a phone must be on the same network to dial it.
1236
+ */
1237
+ function isLanOrigin(origin, source) {
1238
+ if (source === "lan") return true;
1239
+ if (origin === null) return false;
1240
+ const host = hostnameOf(origin);
1241
+ return host !== null && LAN_HOST_RE.test(host);
1242
+ }
1243
+ //#endregion
1214
1244
  //#region src/client/semantic.ts
1215
1245
  /**
1216
1246
  * Semantic attribute values for the protocol v1 pairing panel (contract:
@@ -1226,7 +1256,7 @@ window.__ModuleLoader__.load({
1226
1256
  const PART_PANEL = "panel";
1227
1257
  //#endregion
1228
1258
  //#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}";
1259
+ 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
1260
  const tagId$1 = "@linxin666/dsh-remote-bridge/packages/dsh-remote-bridge/src/client/panel.module.css";
1231
1261
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
1232
1262
  const tag = document.createElement("style");
@@ -1247,6 +1277,7 @@ window.__ModuleLoader__.load({
1247
1277
  "header": "sd7VOG_header",
1248
1278
  "heading": "sd7VOG_heading",
1249
1279
  "hint": "sd7VOG_hint",
1280
+ "invite": "sd7VOG_invite",
1250
1281
  "label": "sd7VOG_label",
1251
1282
  "labels": "sd7VOG_labels",
1252
1283
  "notice": "sd7VOG_notice",
@@ -1268,8 +1299,8 @@ window.__ModuleLoader__.load({
1268
1299
  //#region src/client/PairPanel.tsx
1269
1300
  /**
1270
1301
  * The protocol v1 pairing panel: the QR symbol, the countdown with its expiry
1271
- * state, the one address fact the reader must not miss, and the two actions that
1272
- * keep a fresh code on screen.
1302
+ * state, the line that says which kind of address the code carries, and the two
1303
+ * actions that keep a fresh code on screen.
1273
1304
  *
1274
1305
  * The shell is the official headless `Modal` and every action is the official
1275
1306
  * `Button`, so the overlay, the mask, the card, the focus trap, the Escape
@@ -1281,6 +1312,13 @@ window.__ModuleLoader__.load({
1281
1312
  /** The custom property carrying the dialog's own enter keyframe name. */
1282
1313
  const EXIT_NAME_VAR = "--pair-exit-name";
1283
1314
  /**
1315
+ * Where a reader of the beta build can reach the people running it. The URL is
1316
+ * code, not copy: the dictionaries carry the sentence, this constant carries the
1317
+ * destination, so a translation cannot retarget the link and a check can assert
1318
+ * the real one.
1319
+ */
1320
+ const COMMUNITY_INVITE_URL = "https://discord.gg/nBy28kjun";
1321
+ /**
1284
1322
  * The QR symbol, memoized on the secret: the countdown re-renders the panel
1285
1323
  * every second, and qrcode.react rebuilds the whole module path on each render.
1286
1324
  * The encoded value is the host's own `pairingUrl` verbatim when there is one —
@@ -1318,6 +1356,7 @@ window.__ModuleLoader__.load({
1318
1356
  const canCopy = !expired && payload !== "";
1319
1357
  const primaryLabel = state.kind === "failed" || state.kind === "unreachable" ? t("action.retry") : t("pair.refresh");
1320
1358
  const located = ready && state.pairingUrl !== null;
1359
+ const onLan = located && isLanOrigin(state.origin, state.originSource);
1321
1360
  (0, react.useLayoutEffect)(() => {
1322
1361
  const element = panel.current;
1323
1362
  if (element === null) return;
@@ -1371,84 +1410,98 @@ window.__ModuleLoader__.load({
1371
1410
  }),
1372
1411
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1373
1412
  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
- })
1413
+ children: [
1414
+ (state.kind === "forbidden" || state.kind === "failed" || state.kind === "unreachable") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1415
+ className: panel_module_css_default.notice,
1416
+ "data-dsh-part": "notice",
1417
+ "data-tone": "alert",
1418
+ role: "alert",
1419
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1420
+ className: panel_module_css_default.noticeIcon,
1421
+ "aria-hidden": "true",
1422
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineRegular, {})
1416
1423
  }), /* @__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
- ]
1424
+ className: panel_module_css_default.noticeCopy,
1425
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1426
+ className: panel_module_css_default.noticeTitle,
1427
+ children: [
1428
+ state.kind === "forbidden" && t("forbidden.title"),
1429
+ state.kind === "failed" && t("failed.title"),
1430
+ state.kind === "unreachable" && t("unreachable.title")
1431
+ ]
1432
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1433
+ className: panel_module_css_default.noticeText,
1434
+ children: [
1435
+ state.kind === "forbidden" && t("forbidden.body"),
1436
+ state.kind === "failed" && t("failed.body", { status: String(state.status) }),
1437
+ state.kind === "unreachable" && t("unreachable.body")
1438
+ ]
1439
+ })]
1440
1440
  })]
1441
1441
  }),
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")
1442
+ (state.kind === "reading" || ready) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1443
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1444
+ className: panel_module_css_default.qrCard,
1445
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1446
+ className: panel_module_css_default.qrSlot,
1447
+ "data-dsh-part": "qr",
1448
+ ["data-dsh-qr-value"]: payload,
1449
+ ["data-expired"]: expired || void 0,
1450
+ children: ready ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PairQrCode, {
1451
+ value: payload,
1452
+ label: t("pair.qrLabel")
1453
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1454
+ className: panel_module_css_default.skeleton,
1455
+ "aria-hidden": "true"
1456
+ })
1457
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1458
+ className: panel_module_css_default.status,
1459
+ children: [
1460
+ !ready && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1461
+ className: panel_module_css_default.statusText,
1462
+ children: t("state.reading")
1463
+ }),
1464
+ ready && expired && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1465
+ className: panel_module_css_default.statusText,
1466
+ role: "status",
1467
+ children: t("pair.expired")
1468
+ }),
1469
+ ready && !expired && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1470
+ className: panel_module_css_default.statusText,
1471
+ children: t("pair.countdown", { s: String(seconds) })
1472
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1473
+ className: panel_module_css_default.bar,
1474
+ "aria-hidden": "true",
1475
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1476
+ className: panel_module_css_default.barFill,
1477
+ style: { width: `${String(percent)}%` }
1478
+ })
1479
+ })] })
1480
+ ]
1481
+ })]
1482
+ }),
1483
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1484
+ className: panel_module_css_default.address,
1485
+ "data-tone": located ? "plain" : "warning",
1486
+ children: [
1487
+ ready && located && !onLan && t("origin.public"),
1488
+ ready && onLan && t("origin.lan", { origin: state.origin ?? "" }),
1489
+ ready && !located && t("origin.missing", { host })
1490
+ ]
1491
+ }),
1492
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1493
+ className: panel_module_css_default.hint,
1494
+ children: t("pair.usedHint")
1495
+ })
1496
+ ] }),
1497
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
1498
+ className: panel_module_css_default.invite,
1499
+ href: COMMUNITY_INVITE_URL,
1500
+ target: "_blank",
1501
+ rel: "noopener noreferrer",
1502
+ children: t("community.invite")
1450
1503
  })
1451
- ] })]
1504
+ ]
1452
1505
  }),
1453
1506
  state.kind !== "forbidden" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
1454
1507
  className: panel_module_css_default.actions,
@@ -1556,6 +1609,7 @@ window.__ModuleLoader__.load({
1556
1609
  issuedAt,
1557
1610
  expiresAt: outcome.expiresAt,
1558
1611
  origin: outcome.origin,
1612
+ originSource: outcome.originSource,
1559
1613
  pairingUrl: outcome.pairingUrl
1560
1614
  };
1561
1615
  case "forbidden": return { kind: "forbidden" };
@@ -1660,22 +1714,6 @@ window.__ModuleLoader__.load({
1660
1714
  }
1661
1715
  //#endregion
1662
1716
  //#region src/client/pair-token.ts
1663
- /**
1664
- * The panel's one wire call: read the one-shot bootstrap token from this
1665
- * package's own Host route.
1666
- *
1667
- * The route is same-origin and document-relative (the GUI is served with
1668
- * `<base href="./">`, so a sub-path deployment resolves it against its entry
1669
- * directory instead of escaping to the origin root — the same rule
1670
- * `dsh-remote-web-ui`'s pair API follows). It is NOT consumed here: the panel
1671
- * only displays the secret, and the phone spends it in `pair.begin`, so a
1672
- * mis-click on "new code" voids a token without ever pairing a device.
1673
- *
1674
- * `403` is a fact, not an error: the loopback gate in `core/loopback.ts`
1675
- * refuses any page whose socket or `Host` is not this machine, which is exactly
1676
- * the case the panel must name out loud.
1677
- * @module dsh-remote-bridge/client/pair-token
1678
- */
1679
1717
  /** Document-relative form of the Host route, for a page served under any base. */
1680
1718
  const PAIR_TOKEN_URL = "/remote-bridge/pair/token".replace(/^\/+/, "");
1681
1719
  /** Read a string field, treating a missing, mistyped or empty value as absent. */
@@ -1733,12 +1771,15 @@ window.__ModuleLoader__.load({
1733
1771
  };
1734
1772
  const origin = stringOrNull(body.origin);
1735
1773
  const candidate = stringOrNull(body.pairingUrl);
1774
+ const pairingUrl = candidate !== null && /^wss?:\/\/\S+$/.test(candidate) ? candidate : null;
1775
+ const source = body.originSource;
1736
1776
  return {
1737
1777
  kind: "ok",
1738
1778
  token,
1739
1779
  expiresAt,
1740
1780
  origin,
1741
- pairingUrl: candidate !== null && /^wss?:\/\/\S+$/.test(candidate) ? candidate : null
1781
+ originSource: source === "realtime" || source === "env" || source === "lan" ? source : null,
1782
+ pairingUrl
1742
1783
  };
1743
1784
  }
1744
1785
  //#endregion
@@ -2229,10 +2270,16 @@ window.__ModuleLoader__.load({
2229
2270
  * the header of an interactive card (§35.11).
2230
2271
  *
2231
2272
  * 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.
2273
+ * a QR symbol — so its copy carries what to do with the symbol, how long it
2274
+ * lives, what kind of address the phone will dial, why the code is single-use,
2275
+ * and that the app is still in testing: the reader is told what they are joining
2276
+ * and where to ask about it. No key renders the public origin: the symbol
2277
+ * already carries it, and a durable public hostname printed as text would
2278
+ * outlive every screenshot it appears in. A LAN literal is not that fact — it
2279
+ * answers only inside the network this page is already on — so the LAN line
2280
+ * keeps naming it. No key states how the host finds either address, and no key
2281
+ * names the wire protocol: both are implementation facts the reader cannot act
2282
+ * on.
2236
2283
  *
2237
2284
  * The card's keys say only what the transcript row can act on: whether the page
2238
2285
  * is still waiting for the operator, that it is over, that this desktop renders
@@ -2241,17 +2288,19 @@ window.__ModuleLoader__.load({
2241
2288
  */
2242
2289
  /** Simplified Chinese dictionary (the key-set source of truth). */
2243
2290
  const zh = {
2244
- "entry.label": "配对手机(协议 v1)",
2245
- "title": "协议 v1 配对",
2246
- "subtitle": "用手机 App 扫描二维码,即可让手机以协议 v1 连上这台宿主。配对码由本机签发,只在本机显示。",
2291
+ "entry.label": "配对 iPhone",
2292
+ "title": "iOS App 配对",
2293
+ "subtitle": "用 iOS App(内测)扫描二维码,把 iPhone 连到这台电脑上。配对码只在本机显示。",
2247
2294
  "state.reading": "正在取配对码…",
2248
2295
  "pair.qrLabel": "配对二维码",
2249
2296
  "pair.countdown": "剩余 {s} 秒",
2250
2297
  "pair.expired": "配对码已过期",
2251
2298
  "pair.refresh": "重新取码",
2252
- "pair.usedHint": "配对码一次性有效:手机一开始配对即作废,重新取码也会作废上一张。",
2253
- "origin.located": "手机将连到 {origin}",
2254
- "origin.missing": "没有找到公网地址:请先在手机里把连接地址填成你的公网中继,再扫码。本页的 {host} 只有本机能连。",
2299
+ "pair.usedHint": "配对码一次性有效:iPhone 一开始配对就作废,重新取码也会作废上一张。",
2300
+ "origin.public": "二维码已包含公网地址,扫码后 iPhone 自动连上这台电脑",
2301
+ "origin.lan": "二维码指向局域网地址 {origin},iPhone 需与本机在同一网络",
2302
+ "origin.missing": "没有找到公网地址:先在 App 里把连接地址填成你的公网中继,再扫码。本页的 {host} 只有本机能连。",
2303
+ "community.invite": "iOS App 还在内测,欢迎来 Discord 交流",
2255
2304
  "forbidden.title": "这个页面不是从本机打开的",
2256
2305
  "forbidden.body": "配对码只能在本机 Web UI 上取。请在本机浏览器打开 http://127.0.0.1:<端口> 后重试。",
2257
2306
  "failed.title": "取配对码失败",
@@ -2273,17 +2322,19 @@ window.__ModuleLoader__.load({
2273
2322
  };
2274
2323
  /** English dictionary, key-for-key with the zh source. */
2275
2324
  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.",
2325
+ "entry.label": "Pair an iPhone",
2326
+ "title": "iOS app pairing",
2327
+ "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
2328
  "state.reading": "Requesting a pairing code…",
2280
2329
  "pair.qrLabel": "Pairing QR code",
2281
2330
  "pair.countdown": "{s} s left",
2282
2331
  "pair.expired": "The pairing code expired",
2283
2332
  "pair.refresh": "New code",
2284
2333
  "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.",
2334
+ "origin.public": "The QR code carries the public address: the iPhone connects to this computer as soon as it scans",
2335
+ "origin.lan": "The QR code points at the LAN address {origin}: the iPhone must be on the same network",
2336
+ "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.",
2337
+ "community.invite": "The iOS app is in beta. Come talk to us on Discord",
2287
2338
  "forbidden.title": "This page is not open on this machine",
2288
2339
  "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
2340
  "failed.title": "Could not read a pairing code",