@dsh-remote/relay 3.2.8 → 3.2.10

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 (2) hide show
  1. package/dist/bundle/main.js +48 -12
  2. package/package.json +1 -1
@@ -23443,7 +23443,7 @@ function date4(params) {
23443
23443
  return _coercedDate(ZodDate, params);
23444
23444
  }
23445
23445
 
23446
- // node_modules/.pnpm/@dsh-remote+protocol@3.2.7/node_modules/@dsh-remote/protocol/dist/src/wire/limits.js
23446
+ // node_modules/.pnpm/@dsh-remote+protocol@3.2.9/node_modules/@dsh-remote/protocol/dist/src/wire/limits.js
23447
23447
  var MAX_RELAY_MESSAGE_BYTES = 1024 * 1024;
23448
23448
  var MAX_CIPHERTEXT_BYTES = MAX_RELAY_MESSAGE_BYTES - 8 * 1024;
23449
23449
  var MAX_IMAGE_ATTACHMENTS = 4;
@@ -23452,7 +23452,7 @@ var MAX_ATTACHMENT_BYTES = 512 * 1024;
23452
23452
  var MAX_ATTACHMENT_TOTAL_BYTES = 512 * 1024;
23453
23453
  var IDEMPOTENCY_WINDOW_MS = 5 * 60 * 1e3;
23454
23454
 
23455
- // node_modules/.pnpm/@dsh-remote+protocol@3.2.7/node_modules/@dsh-remote/protocol/dist/src/wire/frames.js
23455
+ // node_modules/.pnpm/@dsh-remote+protocol@3.2.9/node_modules/@dsh-remote/protocol/dist/src/wire/frames.js
23456
23456
  var PROTOCOL_VERSION = 1;
23457
23457
  var PAIRING_TOKEN_RE = /^\d{6}$/;
23458
23458
  var nonEmpty = external_exports.string().min(1);
@@ -23479,7 +23479,26 @@ var helloFrame = external_exports.object({
23479
23479
  label: external_exports.string().max(128).optional(),
23480
23480
  /** 安装 id,弱随机、非秘密;缺省时由中继分配。上限防一条超长字符串白占内存。 */
23481
23481
  clientId: external_exports.string().min(1).max(128).optional(),
23482
- clientMeta: clientMeta.optional()
23482
+ clientMeta: clientMeta.optional(),
23483
+ /**
23484
+ * 发送方的**软件版本**(2026-10-22):主机填插件版本,小程序填小程序版本。
23485
+ *
23486
+ * ## 为什么加它
23487
+ * 排查"为什么这人的两端配不上"时,最缺的**就是**版本号 ——
23488
+ * 3.1.x 的插件配不上 3.2.x 的小程序,而**两端都不报错**
23489
+ * (见 `packages/client/core/version.js` 的头注:这是 2026-10-21 线上事故的形状)。
23490
+ * 有了它,中继就能按版本分组,一眼看出"这批全是老版本"。
23491
+ *
23492
+ * ## ⚠️ 为什么**默认不带**(零知识)
23493
+ * `hello` 是**明文**控制帧 ⇒ 中继**看得见**这个字段。
23494
+ * ⇒ **默认两端都不填**(⇒ 行为与加这个字段之前**逐字节相同**),
23495
+ * 只有**显式开启**(`DRC_REPORT_VERSION=1`)的部署才会填。
23496
+ * ⇒ **开源版默认不带** ⇒ 不因为加了这个字段而多暴露任何东西。
23497
+ *
23498
+ * 它**不是**协议协商位:两端**永远不因它不同而拒连**(版本兼容性由各自的应用层判,
23499
+ * 见小程序的 `MIN_PLUGIN_VERSION`)⇒ 它只是给人看的读数。
23500
+ */
23501
+ softwareVersion: external_exports.string().min(1).max(64).optional()
23483
23502
  });
23484
23503
  var publicKeyB64 = external_exports.string().regex(/^[A-Za-z0-9+/]{43}=$/, "\u5FC5\u987B\u662F 32 \u5B57\u8282 base64 \u516C\u94A5");
23485
23504
  var pairBeginFrame = external_exports.object({
@@ -23724,6 +23743,13 @@ function parseEndpointFrame(value) {
23724
23743
  return parsed.success ? parsed.data : null;
23725
23744
  }
23726
23745
 
23746
+ // node_modules/.pnpm/@dsh-remote+protocol@3.2.9/node_modules/@dsh-remote/protocol/dist/src/wire/report-version.js
23747
+ var REPORT_VERSION_ENV = "DRC_REPORT_VERSION";
23748
+ function reportSoftwareVersion(env) {
23749
+ const raw = (env[REPORT_VERSION_ENV] ?? "").trim().toLowerCase();
23750
+ return raw === "1" || raw === "true";
23751
+ }
23752
+
23727
23753
  // src/limits.ts
23728
23754
  var Budget = class {
23729
23755
  constructor(perWindow, windowMs = 1e3) {
@@ -23927,6 +23953,10 @@ function loadConfig(env, version2) {
23927
23953
  ),
23928
23954
  logLevel: level,
23929
23955
  pairStatusEnabled: env.DRC_PAIR_STATUS === "1" || env.DRC_PAIR_STATUS === "true",
23956
+ // 默认关 ⇒ 开源版不记对端版本(零知识不变);私有部署开这个才记。
23957
+ // ⚠️ 判定**走 protocol 的共享实现**(插件/中继/小程序三处同一份)
23958
+ // ⇒ 不会出现"我开了但没生效"这种极难查的分叉。
23959
+ reportSoftwareVersion: reportSoftwareVersion(env),
23930
23960
  // 空串显式当作"关闭":DRC_STATE_FILE= 也要能关掉,而不是被 ?? 还原成默认路径。
23931
23961
  stateFile: env.DRC_STATE_FILE ?? "",
23932
23962
  stateSaveMs: integer2(env.DRC_STATE_SAVE_MS, 6e4, "DRC_STATE_SAVE_MS", problems),
@@ -23965,7 +23995,7 @@ var import_subprotocol = __toESM(require_subprotocol(), 1);
23965
23995
  var import_websocket = __toESM(require_websocket(), 1);
23966
23996
  var import_websocket_server = __toESM(require_websocket_server(), 1);
23967
23997
 
23968
- // node_modules/.pnpm/@dsh-remote+protocol@3.2.7/node_modules/@dsh-remote/protocol/dist/src/identity/ids.js
23998
+ // node_modules/.pnpm/@dsh-remote+protocol@3.2.9/node_modules/@dsh-remote/protocol/dist/src/identity/ids.js
23969
23999
  import { randomBytes, randomUUID } from "node:crypto";
23970
24000
  var CONVERSATION_ID_PREFIX = "c_";
23971
24001
  function newConversationId() {
@@ -23975,7 +24005,7 @@ function newHostId() {
23975
24005
  return randomBytes(4).toString("hex");
23976
24006
  }
23977
24007
 
23978
- // node_modules/.pnpm/@dsh-remote+protocol@3.2.7/node_modules/@dsh-remote/protocol/dist/src/wire/negotiate.js
24008
+ // node_modules/.pnpm/@dsh-remote+protocol@3.2.9/node_modules/@dsh-remote/protocol/dist/src/wire/negotiate.js
23979
24009
  function negotiateProtocol(peerProtocol, own2 = PROTOCOL_VERSION) {
23980
24010
  if (peerProtocol === void 0 || peerProtocol === null) {
23981
24011
  return {
@@ -24095,16 +24125,16 @@ function createMpCodeIssuer(options) {
24095
24125
  };
24096
24126
  }
24097
24127
 
24098
- // node_modules/.pnpm/@dsh-remote+protocol@3.2.7/node_modules/@dsh-remote/protocol/dist/src/wire/errors.js
24128
+ // node_modules/.pnpm/@dsh-remote+protocol@3.2.9/node_modules/@dsh-remote/protocol/dist/src/wire/errors.js
24099
24129
  var WAIT_HINTABLE = /* @__PURE__ */ new Set(["rate_limited", "pair_table_full"]);
24100
24130
  function wantsRetryAfter(code) {
24101
24131
  return typeof code === "string" && WAIT_HINTABLE.has(code);
24102
24132
  }
24103
24133
 
24104
- // node_modules/.pnpm/@dsh-remote+protocol@3.2.7/node_modules/@dsh-remote/protocol/dist/src/platform/sleep.js
24134
+ // node_modules/.pnpm/@dsh-remote+protocol@3.2.9/node_modules/@dsh-remote/protocol/dist/src/platform/sleep.js
24105
24135
  var SLEEP_BACKENDS = ["caffeinate", "systemd-inhibit", "unsupported"];
24106
24136
 
24107
- // node_modules/.pnpm/@dsh-remote+protocol@3.2.7/node_modules/@dsh-remote/protocol/dist/src/wire/payloads.js
24137
+ // node_modules/.pnpm/@dsh-remote+protocol@3.2.9/node_modules/@dsh-remote/protocol/dist/src/wire/payloads.js
24108
24138
  var SESSION_STATES = [
24109
24139
  "idle",
24110
24140
  "running",
@@ -24544,7 +24574,7 @@ var PAYLOAD_TYPES = {
24544
24574
  evSessionHistory: "ev.session_history"
24545
24575
  };
24546
24576
 
24547
- // node_modules/.pnpm/@dsh-remote+protocol@3.2.7/node_modules/@dsh-remote/protocol/dist/src/wire/outbound.js
24577
+ // node_modules/.pnpm/@dsh-remote+protocol@3.2.9/node_modules/@dsh-remote/protocol/dist/src/wire/outbound.js
24548
24578
  function helloOkForClient(clientId, protocol) {
24549
24579
  return { t: "hello-ok", role: "client", clientId, ...protocol === void 0 ? {} : { protocol } };
24550
24580
  }
@@ -24631,7 +24661,7 @@ function encBatchToRelay(sessionId, items) {
24631
24661
  return { t: "enc-batch", sessionId, items: items.map((item) => ({ ...item })) };
24632
24662
  }
24633
24663
 
24634
- // node_modules/.pnpm/@dsh-remote+protocol@3.2.7/node_modules/@dsh-remote/protocol/dist/src/wire/registry.js
24664
+ // node_modules/.pnpm/@dsh-remote+protocol@3.2.9/node_modules/@dsh-remote/protocol/dist/src/wire/registry.js
24635
24665
  var ENDPOINT_FRAME_NAMES = [
24636
24666
  "hello",
24637
24667
  "pair-begin",
@@ -24696,7 +24726,7 @@ var EV_TYPES = [
24696
24726
  ];
24697
24727
  var PAYLOAD_TYPE_SET = /* @__PURE__ */ new Set([...CMD_TYPES, ...EV_TYPES]);
24698
24728
 
24699
- // node_modules/.pnpm/@dsh-remote+protocol@3.2.7/node_modules/@dsh-remote/protocol/dist/src/wire/classify.js
24729
+ // node_modules/.pnpm/@dsh-remote+protocol@3.2.9/node_modules/@dsh-remote/protocol/dist/src/wire/classify.js
24700
24730
  function frameTypeOf(value) {
24701
24731
  if (typeof value !== "object" || value === null || Array.isArray(value))
24702
24732
  return void 0;
@@ -25665,6 +25695,9 @@ function createRelay(config2) {
25665
25695
  peer.hostId = hostId;
25666
25696
  sendToPeer(peer, helloOkForHost(hostId, frame.protocol));
25667
25697
  log.info("host online", { hostId, label: frame.label ?? "", replaced: replaced ? 1 : 0 });
25698
+ if (config2.reportSoftwareVersion && frame.softwareVersion) {
25699
+ log.info("host software version", { hostId, version: frame.softwareVersion });
25700
+ }
25668
25701
  if (replaced) replaced.close(CLOSE_REPLACED, "replaced_by_newer_socket");
25669
25702
  return;
25670
25703
  }
@@ -25680,6 +25713,9 @@ function createRelay(config2) {
25680
25713
  }
25681
25714
  sendToPeer(peer, helloOkForClient(clientId, frame.protocol));
25682
25715
  log.info("client online", { clientId, platform: frame.clientMeta?.platform });
25716
+ if (config2.reportSoftwareVersion && frame.softwareVersion) {
25717
+ log.info("client software version", { clientId, version: frame.softwareVersion });
25718
+ }
25683
25719
  return;
25684
25720
  }
25685
25721
  }
@@ -26464,7 +26500,7 @@ function registerSignalHandlers(shutdown) {
26464
26500
 
26465
26501
  // src/main.ts
26466
26502
  function readVersion() {
26467
- if ("3.2.8") return "3.2.8";
26503
+ if ("3.2.10") return "3.2.10";
26468
26504
  try {
26469
26505
  const pkg = JSON.parse(readFileSync2(new URL("../../package.json", import.meta.url), "utf8"));
26470
26506
  if (typeof pkg.version === "string") return pkg.version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-remote/relay",
3
- "version": "3.2.8",
3
+ "version": "3.2.10",
4
4
  "description": "DSH Remote Control 的零知识 WebSocket 中继:只做路由,不碰载荷明文。可自托管的单文件产物。",
5
5
  "type": "module",
6
6
  "license": "MIT",