@syengup/fridaynext-hermes-channel 0.1.0-beta.1 → 0.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syengup/fridaynext-hermes-channel",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.2",
4
4
  "type": "module",
5
5
  "description": "通过Hermes官方CLI安装FridayNext标准平台插件并生成配对码",
6
6
  "license": "UNLICENSED",
@@ -85,7 +85,7 @@ export class FridayServiceHost {
85
85
  const adapter = this.adapter = await this.options.createBackend({ store, profileId, facilities,
86
86
  isCurrent: () => this.mediaLease === mediaLease, mediaSignal: mediaAbort.signal, attachmentTransfer, outputTransport });
87
87
  adapter.descriptor.capabilities = [...new Set([...adapter.descriptor.capabilities, "prompt-capsules", "server-name", "link-preview", "push-v1"])];
88
- let lanUrl = "", proxyPort = 0;
88
+ let lanUrl = () => "", proxyPort = 0;
89
89
  const service = this.service = new ChannelService({ dataDir: root, authToken: identity.token, store, adapter,
90
90
  // 正常终态由宿主完成事件即时唤醒;漏提示或重连只按固定节奏对账,不随时长退避。
91
91
  reconciliation: { initialDelayMs: 1000, maxDelayMs: 1000 },
@@ -100,7 +100,7 @@ export class FridayServiceHost {
100
100
  }, ...(publicConfig && infrastructure?.publicAccess ? { publicAccess: { ...infrastructure.publicAccess,
101
101
  config: () => ({ ...publicConfig, corePort: proxyPort, authToken: identity.token }),
102
102
  environment: { ...infrastructure.publicAccess.environment, role: () => "service", gateRequired: () => true,
103
- tls: { identity: tls, lanUrl: () => lanUrl } } } } : {}),
103
+ tls: { identity: tls, lanUrl: () => lanUrl() } } } } : {}),
104
104
  pairing: { ...infrastructure?.pairing, coordinates: () => {
105
105
  const active = tls.pairingIdentity();
106
106
  if (!active)
@@ -108,7 +108,7 @@ export class FridayServiceHost {
108
108
  const shared = publicConfig?.enabled ? service.infrastructure.publicAccess?.getPairingInfo() : undefined;
109
109
  if (publicConfig?.enabled && (!shared || shared.fingerprint !== active.fingerprint))
110
110
  return null;
111
- return { ...shared, v: 2, backendId: "hermes", lanUrl, fingerprint: active.fingerprint, token: identity.token };
111
+ return { ...shared, v: 2, backendId: "hermes", lanUrl: lanUrl(), fingerprint: active.fingerprint, token: identity.token };
112
112
  } } },
113
113
  });
114
114
  adapter.setRunChangeHandler?.(async (runId) => {
@@ -141,8 +141,11 @@ export class FridayServiceHost {
141
141
  saveListenCoordinates(root, host, address.port);
142
142
  const reachable = ["0.0.0.0", "::"].includes(host) ? "127.0.0.1" : host;
143
143
  const formatHost = (value) => value.includes(":") ? "[" + value + "]" : value;
144
- const lanHost = ["0.0.0.0", "::"].includes(host) ? Object.values(os.networkInterfaces()).flat().find(item => item && item.family === "IPv4" && !item.internal)?.address ?? reachable : reachable;
145
- lanUrl = `https://${formatHost(lanHost)}:${address.port}`;
144
+ // 新券读取当前网络坐标;监听端口、服务身份、TLS和显式绑定地址均保持原归属。
145
+ lanUrl = () => {
146
+ const lanHost = ["0.0.0.0", "::"].includes(host) ? Object.values(os.networkInterfaces()).flat().find(item => item && item.family === "IPv4" && !item.internal)?.address ?? reachable : reachable;
147
+ return `https://${formatHost(lanHost)}:${address.port}`;
148
+ };
146
149
  if (publicConfig) {
147
150
  const proxy = this.proxyServer = http.createServer(handler);
148
151
  proxy.requestTimeout = 30000;