@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.
@@ -0,0 +1,209 @@
1
+ /**
2
+ * The second meeting point: the self-hosted relay a configured host keeps beside
3
+ * the market edge.
4
+ *
5
+ * One relay identity serves both meetings — the id and the secret are minted once
6
+ * for this profile and never re-minted for a second endpoint — but everything else
7
+ * about the two halves is separate: their own claim, their own lease, their own
8
+ * connector and their own release. That separation is the reason this file exists.
9
+ * A second meeting point that refuses, times out or is switched off in the provider
10
+ * console must leave the lease that already serves the phone over `dsh-market.com`
11
+ * exactly as it stands, and the reverse holds as well.
12
+ *
13
+ * The half is off unless the mount is configured with both halves of a meeting
14
+ * point — a control-plane base and the public suffix its origin is built from —
15
+ * and {@link relaySecondaryOf} is the one place that decides it. A host that
16
+ * configures nothing therefore never constructs this object, never dials anything
17
+ * and never writes a grant into its roster, which is what keeps the default
18
+ * behaviour of `hello`, the roster and the network byte for byte what it was.
19
+ *
20
+ * The grant is the phone's, not this bridge's ({@link DeviceRoster.setRelayGrant}):
21
+ * this half only reads whatever the newest row holds and presents it to the second
22
+ * control plane. It learns "admitted" or "not admitted" and never learns a tier, a
23
+ * user or an account.
24
+ *
25
+ * A held lease is re-claimed every six hours ({@link SECONDARY_CLAIM_REFRESH_MS}),
26
+ * because the relay only admits a connector whose lease was claimed inside the last
27
+ * 24 hours — so what `hello` announces is a lease the relay admits right now, not one
28
+ * this host once obtained. The market edge has no such loop: its claim follows the
29
+ * plugin's own lifecycle events, and a default host keeps behaving exactly as it did.
30
+ */
31
+ import { type RelayClaimOutcome, type RelayClaimRequest } from './relay-control.ts';
32
+ import { type RelayBridgeStart, type RelayPairState } from './relay-connector.ts';
33
+ import type { RelayIdentity } from './relay-registry.ts';
34
+ /**
35
+ * How often a held second lease is refreshed: six hours.
36
+ *
37
+ * The relay stops admitting a connector when the lease behind it has not been
38
+ * claimed within 24 hours, so the refresh has to run well inside that window, and
39
+ * six hours is the interval the design itself names (a downgrade is then noticed at
40
+ * the next refresh rather than at the next restart). The market edge has no such
41
+ * loop on purpose: its lease is refreshed by the plugin's own lifecycle events, and
42
+ * the default host must keep behaving exactly as it did.
43
+ */
44
+ export declare const SECONDARY_CLAIM_REFRESH_MS: number;
45
+ /**
46
+ * Where the second connector records its state
47
+ * (`$DSH_HOME/remote-web-ui-relay-bridge-secondary.json`).
48
+ *
49
+ * Its own file, never the first half's: two connectors that wrote one record would
50
+ * each overwrite the other's state, and the record exists precisely to say which
51
+ * meeting point served which lease.
52
+ * @param home - the DSH home (a test seam).
53
+ * @returns the absolute record path.
54
+ */
55
+ export declare function relaySecondaryBridgeStateFile(home?: string): string;
56
+ /** One configured second meeting point. */
57
+ export interface RelaySecondaryMeetingPoint {
58
+ /** The second control-plane base: its `claim` and `release` both hang off it. */
59
+ readonly controlUrl: string;
60
+ /** The public suffix the announced origin is built from, leading dot included. */
61
+ readonly publicSuffix: string;
62
+ }
63
+ /**
64
+ * The second meeting point one configuration names, or undefined.
65
+ *
66
+ * Both halves are required and neither has a default: an origin cannot be built
67
+ * from a control-plane base alone, and a control plane cannot be reached from a
68
+ * suffix alone. A profile that names only one of them therefore has no second
69
+ * meeting point at all rather than half of one, which keeps every consumer of this
70
+ * answer able to treat "undefined" as "this host has one meeting point".
71
+ * @param config - the resolved bridge configuration (read structurally).
72
+ * @returns the meeting point, or undefined when this host has none.
73
+ */
74
+ export declare function relaySecondaryOf(config: {
75
+ readonly relaySecondaryControlUrl?: string;
76
+ readonly relaySecondaryPublicSuffix?: string;
77
+ }): RelaySecondaryMeetingPoint | undefined;
78
+ /**
79
+ * The origin this host announces for its second meeting point.
80
+ *
81
+ * Built from the identity and the configured suffix, never from the hostname a
82
+ * claim answered with: the id is the one this host has held since it minted its
83
+ * identity, while the suffix is the operator's statement of where that identity's
84
+ * second meeting point is. Whether it is announced at all is a different question —
85
+ * {@link RelaySecondaryHalf.origin} answers it, and only while a fresh lease is held.
86
+ * @param identity - the one relay identity both meetings share.
87
+ * @param publicSuffix - the configured suffix, leading dot included.
88
+ * @returns the `wss://` origin the greeting carries.
89
+ */
90
+ export declare function relaySecondaryOriginOf(identity: RelayIdentity, publicSuffix: string): string;
91
+ /** What one second meeting point needs from the mount. */
92
+ export interface RelaySecondaryOptions {
93
+ /** The one relay identity both meeting points share. Never a second identity. */
94
+ readonly identity: RelayIdentity;
95
+ /** The second control-plane base. */
96
+ readonly controlUrl: string;
97
+ /** The public suffix the announced origin is built from. */
98
+ readonly publicSuffix: string;
99
+ /**
100
+ * The grant the roster currently holds, read once per claim.
101
+ *
102
+ * Read rather than captured because a phone may hand one over at any moment, and
103
+ * the claim that lands after that has to carry it.
104
+ */
105
+ grant: () => string | undefined;
106
+ /** The ingress gate port a claim reports, or undefined before it settles. */
107
+ port: () => number | undefined;
108
+ /** The plugin version a claim reports. */
109
+ pluginVersion?: () => string | undefined;
110
+ /** Start (or restart) the connector for one accepted lease. */
111
+ startBridge?: (start: RelayBridgeStart) => void;
112
+ /** Stop that connector. */
113
+ stopBridge?: () => void;
114
+ /** One claim attempt (defaults to the real control plane). */
115
+ claim?: (request: RelayClaimRequest) => Promise<RelayClaimOutcome>;
116
+ /** Release one lease (defaults to the real control plane). */
117
+ release?: (identity: RelayIdentity) => Promise<void>;
118
+ /** Observe the lease state (logged by the mount, driven by the suites). */
119
+ onState?: (state: RelayPairState) => void;
120
+ baseDelayMs?: number;
121
+ maxDelayMs?: number;
122
+ /** Schedule one retry; defaults to an unref'd node timer. */
123
+ timerFn?: (fn: () => void, ms: number) => {
124
+ unref?: () => void;
125
+ };
126
+ /** How often a held lease is refreshed (defaults to {@link SECONDARY_CLAIM_REFRESH_MS}). */
127
+ refreshMs?: number;
128
+ /**
129
+ * Start the periodic refresh and return its canceller.
130
+ *
131
+ * Defaults to an unref'd `setInterval`: the loop must never be a reason for the
132
+ * process to stay alive, and it must be cancelled by `dispose` and by `release`.
133
+ */
134
+ refreshTimer?: (tick: () => void, ms: number) => () => void;
135
+ log?: (message: string) => void;
136
+ }
137
+ /**
138
+ * Own the second meeting point's lease: claim it once per port and grant, follow
139
+ * the grant the phone hands over, and answer the origin `hello` announces.
140
+ *
141
+ * Built on {@link RelayConnectorPair} on purpose — the claim/retry/release
142
+ * lifecycle is the same one the market edge runs — but with its own injected claim
143
+ * (which adds the grant) and its own connector and release, so the two halves share
144
+ * the identity and nothing else.
145
+ */
146
+ export declare class RelaySecondaryHalf {
147
+ #private;
148
+ constructor(options: RelaySecondaryOptions);
149
+ /** The lease half's current state (the market edge's own vocabulary). */
150
+ get state(): RelayPairState;
151
+ /**
152
+ * Claim the second meeting point once for the current port and grant.
153
+ *
154
+ * One claim per `port|grant` pair: a settings sync re-plans with the same key and
155
+ * must not turn into a claim per plan, while a settled port or a grant the phone
156
+ * just handed over is a genuinely new fact and claims again.
157
+ * @returns whether a claim was started.
158
+ */
159
+ claim(): boolean;
160
+ /**
161
+ * A grant just landed in the roster: claim again right away.
162
+ *
163
+ * Unconditional on purpose — a phone that resends the grant it already handed over
164
+ * is asking this host to try again, and the pending wait (which may be the
165
+ * six-hour one a downgrade armed) is cleared by the claim itself.
166
+ * @returns when this attempt settled, so a suite can drive it deterministically.
167
+ */
168
+ grantReceived(): Promise<void>;
169
+ /**
170
+ * The second connector could not attach, so the lease it presents is claimed again.
171
+ *
172
+ * This is the stale-lease repair. The relay refuses a connector whose lease nobody
173
+ * has claimed inside the 24-hour window (`403 lease-stale`), which the six-hour
174
+ * refresh is meant to prevent — a suspended process, a long offline stretch or a
175
+ * clock that jumped can still produce one, and the repair is exactly one claim with
176
+ * the identity the connector was already presenting.
177
+ *
178
+ * Only a *refusal* counts: a dial timeout or a dropped socket is the connector's own
179
+ * backoff to sort out, and asking the control plane about it every 30 seconds would
180
+ * turn a network blip into a claim storm. Only a held lease counts too — once a
181
+ * refusal has told this half it holds nothing, its own wait (six hours, or none at
182
+ * all for a terminal answer) decides when to try again.
183
+ * @param error - the failure the bridge runner reported for its connector.
184
+ */
185
+ connectorFailed(error: string): void;
186
+ /**
187
+ * The origin this host may announce right now, or undefined.
188
+ *
189
+ * Announcement follows the lease, not the configuration: an advertised meeting
190
+ * point whose origin nobody serves is worse than no advertisement at all.
191
+ * @returns `wss://<id><suffix>` while a lease is held.
192
+ */
193
+ origin(): string | undefined;
194
+ /**
195
+ * Release the second lease and stop its connector.
196
+ *
197
+ * This never touches the first half: it releases against the second control plane
198
+ * only and stops the connector this object was handed.
199
+ */
200
+ release(): Promise<void>;
201
+ /** Stop retrying and drop the connector (plugin teardown, or the relay turned off). */
202
+ dispose(): void;
203
+ }
204
+ /**
205
+ * Build the second meeting point half.
206
+ * @param options - the identity, the meeting point and the mount's seams.
207
+ * @returns the half, ready to claim.
208
+ */
209
+ export declare function createRelaySecondaryHalf(options: RelaySecondaryOptions): RelaySecondaryHalf;
@@ -33,7 +33,7 @@ import type { PushAddress, PushNotification, PushRoute, PushSendResult, PushSend
33
33
  * The account service the App already signs into: one deployment, one hostname, so
34
34
  * an operator with no relay of their own configures nothing at all.
35
35
  */
36
- export declare const RELAY_DEFAULT_URL = "https://account.dsh-market.com";
36
+ export declare const RELAY_DEFAULT_URL = "https://account.chatwithai.icu";
37
37
  /** The environment variable that moves the relay to another deployment. */
38
38
  export declare const RELAY_ENV: {
39
39
  readonly url: "DSH_REMOTE_BRIDGE_RELAY_URL";
@@ -26,6 +26,11 @@ export interface PairTokenRouteDeps {
26
26
  } | undefined;
27
27
  /** Origin discovery seam; defaults to {@link discoverPairOrigin} over the two seams above. */
28
28
  readonly pairOrigin?: () => PairOriginFacts | undefined;
29
+ /**
30
+ * 桌面端打开配对面板(或本机请求一次性令牌)时的钩子:尚未配对任何设备且未开隧道的
31
+ * 宿主在此时按需触发一次租约申领,避免无人使用远程功能时后台空转。
32
+ */
33
+ readonly onPairTokenIssued?: () => void;
29
34
  }
30
35
  /**
31
36
  * The WebSocket URL a phone dials for one one-shot ticket.
@@ -42,8 +42,9 @@ import { type IngressSyncInput } from './host/ingress-sync.ts';
42
42
  import { type ForwardPlan, type ForwardStopReason, type LanBindCapability } from './host/lan-bind-plan.ts';
43
43
  import { type LegacyBlockCleanup } from './host/lan-bind.ts';
44
44
  import { type LanForwardState } from './host/lan-forward.ts';
45
+ import { type RelayBridgeState } from './host/relay-bridge-connector.ts';
45
46
  import { type RelayClaim, type RelayConnectorMode } from './host/relay-control.ts';
46
- import { type RelayBridgeStart, type RelayConnectorPairOptions } from './host/relay-connector.ts';
47
+ import { type RelayBridgeStart, type RelayConnectorPairOptions, type RelayPairState } from './host/relay-connector.ts';
47
48
  import { RelayRegistrar, type RelayIdentity, type RelayState } from './host/relay-registry.ts';
48
49
  import { type TunnelPhase } from './host/tunnel.ts';
49
50
  import { type TunnelPlan } from './host/tunnel-plan.ts';
@@ -104,7 +105,12 @@ export declare function turnEndQuietMaxWait(env?: NodeJS.ProcessEnv): number;
104
105
  *
105
106
  * 字段名与 `dsh-remote-web-ui` 逐字一致,所以现有 profile YAML 可以直接沿用;本包
106
107
  * 没有 schema 依赖,缺省值由 {@link resolveBridgeConfig} 补齐,没写的字段一律按
107
- * 缺省处理(不新增开关)。
108
+ * 缺省处理。{@link Config.relayControlUrl} 与 {@link Config.relayPublicSuffix} 只改
109
+ * 会合点地址,缺省仍是市场端点与后缀,所以它们不引入新的开关。
110
+ *
111
+ * {@link Config.relaySecondaryControlUrl} 与 {@link Config.relaySecondaryPublicSuffix}
112
+ * 不一样:它们没有缺省值,两个都写了才多出第二个会合点(见
113
+ * `host/relay-secondary.ts` 的 {@link relaySecondaryOf})。
108
114
  */
109
115
  export interface Config {
110
116
  /** 是否申领 relay 租约(默认 true)。关掉就只有本机的回环入口可用。 */
@@ -127,6 +133,18 @@ export interface Config {
127
133
  cfAccountId?: string;
128
134
  /** 命名隧道 id(默认 undefined)。 */
129
135
  cfTunnelId?: string;
136
+ /** 中继控制面基址(默认 https://dsh-market.com/api/relay):自建会合点时
137
+ * claim/release/register/unregister 四个端点随它一起搬家。 */
138
+ relayControlUrl?: string;
139
+ /** relay 稳定子域名的公共后缀(默认 .dsh-market.com):主机名是
140
+ * https://<id> 加上它,一级子域名由它决定。 */
141
+ relayPublicSuffix?: string;
142
+ /** 第二会合点的控制面基址(默认 undefined = 没有第二会合点):配了它,同一份
143
+ * 身份在第二个中继上另申一份租约,握手也才开始公告那个地址。 */
144
+ relaySecondaryControlUrl?: string;
145
+ /** 第二会合点的公共后缀(默认 undefined):公告出去的会合点是
146
+ * `wss://<id>` 接上它,两个字段缺一就没有第二会合点。 */
147
+ relaySecondaryPublicSuffix?: string;
130
148
  }
131
149
  /** 配置面补齐缺省值后的样子:每个字段都是调用方可以直接用的值。 */
132
150
  export interface ResolvedBridgeConfig {
@@ -140,6 +158,10 @@ export interface ResolvedBridgeConfig {
140
158
  cfApiToken: string | undefined;
141
159
  cfAccountId: string | undefined;
142
160
  cfTunnelId: string | undefined;
161
+ relayControlUrl: string;
162
+ relayPublicSuffix: string;
163
+ relaySecondaryControlUrl: string | undefined;
164
+ relaySecondaryPublicSuffix: string | undefined;
143
165
  }
144
166
  /**
145
167
  * 把行配置补齐成桥要用的完整配置面。
@@ -197,6 +219,11 @@ export interface BridgeWiringFacts {
197
219
  readonly candidates?: readonly string[];
198
220
  /** 安装的 webserver schema 是否接受通配绑定(只上报,从不写)。 */
199
221
  readonly wildcardSupported?: boolean;
222
+ /**
223
+ * 远程接入是否已被激活(已有已配对设备,或用户主动请求了配对码)。
224
+ * 缺省按 true 处理以保持纯函数向后兼容;当显式传入 false 且隧道未开启时,不主动申领租约。
225
+ */
226
+ readonly remoteArmed?: boolean;
200
227
  }
201
228
  /** 一次规划的产物:隧道、租约、局域网边缘与 ingress-sync 各自的输入。 */
202
229
  export interface BridgeWiringPlan {
@@ -310,12 +337,16 @@ export interface RelayAnnouncer {
310
337
  *
311
338
  * 注册上去的 URL 就是隧道的目标,而隧道的目标是入站闸门,所以这一行只透出
312
339
  * `/ios/v1`:announcer 不会把宿主的路由表暴露给公网。
313
- * @param options - 身份来源(懒读,只有真要注册时才碰 DSH home)与失败落点。
340
+ * @param options - 身份来源(懒读,只有真要注册时才碰 DSH home)、会合点地址与失败落点。
314
341
  * @returns announcer 本身。
315
342
  */
316
343
  export declare function createRelayAnnouncer(options: {
317
344
  identity: () => RelayIdentity | undefined;
318
345
  registrar?: (identity: RelayIdentity, onState: (state: RelayState) => void) => RelayRegistrar;
346
+ /** 中继控制面基址:注册行与撤行走它派生的两条路径(缺省仍是市场端点)。 */
347
+ controlUrl?: string;
348
+ /** 稳定子域名的公共后缀(缺省仍是 .dsh-market.com)。 */
349
+ publicSuffix?: string;
319
350
  log?: (message: string) => void;
320
351
  }): RelayAnnouncer;
321
352
  /** relay 半区的开关:打开时由计划驱动,关掉时撤行并释放租约。 */
@@ -504,8 +535,39 @@ export declare function disposeBridgeStack(stack: BridgeIngressStack, log?: (mes
504
535
  */
505
536
  export declare function retireStaleRelayHalfOf(parts: {
506
537
  identity: RelayIdentity;
538
+ /** 中继控制面基址:撤行与释放都打到配好的那一个(缺省仍是市场端点)。 */
539
+ controlUrl?: string;
507
540
  log?: (message: string) => void;
508
541
  }): Promise<void>;
542
+ /**
543
+ * 租约状态的一行日志文本。
544
+ *
545
+ * `idle` 与 `claiming` 是每次尝试前的内部过渡态,不产生控制台输出;只保留可观测结果
546
+ * (`claimed` 与 `failed`)。
547
+ * @param state - 租约半区此刻的状态。
548
+ * @returns 一行可读的状态,或 undefined(无需打印的过渡态)。
549
+ */
550
+ export declare function relayStateLine(state: RelayPairState): string | undefined;
551
+ /**
552
+ * 桥连接器状态的一行日志文本。
553
+ *
554
+ * `idle` 与 `dialing` 是重连过程的内部过渡态,只保留 `connected` 与 `failed`。
555
+ * @param state - 桥连接器此刻的状态。
556
+ * @returns 一行可读的状态,或 undefined(无需打印的过渡态)。
557
+ */
558
+ export declare function relayBridgeStateLine(state: RelayBridgeState): string | undefined;
559
+ /**
560
+ * 为状态回调套一层去重与过渡态过滤:忽略 undefined 行,且连续完全相同的行只打一次。
561
+ *
562
+ * 后台指数退避重试在网络不通或上游故障(如 `cf-api-unavailable`)时会反复经历
563
+ * `claiming -> failed`;过滤过渡态并对结果行去重后,同一故障只报告一次,恢复为
564
+ * `claimed` 时再正常输出。
565
+ * @param prefix - 日志前缀(如 `'relay lease: '`)。
566
+ * @param lineOf - 状态到文本行的映射,返回 undefined 表示忽略该状态。
567
+ * @param log - 底层日志函数。
568
+ * @returns 状态观察回调。
569
+ */
570
+ export declare function createDedupedStateLogger<T>(prefix: string, lineOf: (state: T) => string | undefined, log: (message: string) => void): (state: T) => void;
509
571
  /**
510
572
  * Mount the bridge.
511
573
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-remote-bridge",
3
3
  "description": "DSH remote bridge: the host half serves protocol v1 over one exact /ios/v1 WebSocket route — session roster, history baseline, prompting, live turn increments with tool activity, interrupt, and in-process agent approval — to a device paired by a one-shot bootstrap token and a P-256 challenge-response, with the token endpoint admitted only from this machine; the browser half adds one sidebar-foot panel that shows that same one-shot token as a QR symbol and draws an interactive card inside the tool row without answering it, and adds no wire surface",
4
- "version": "0.4.13",
4
+ "version": "0.4.14",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",
7
7
  "engines": {
@@ -25,6 +25,14 @@ import css from './panel.module.css'
25
25
  /** The custom property carrying the dialog's own enter keyframe name. */
26
26
  const EXIT_NAME_VAR = '--pair-exit-name'
27
27
 
28
+ /**
29
+ * Where a reader of the beta build can reach the people running it. The URL is
30
+ * code, not copy: the dictionaries carry the sentence, this constant carries the
31
+ * destination, so a translation cannot retarget the link and a check can assert
32
+ * the real one.
33
+ */
34
+ export const COMMUNITY_INVITE_URL = 'https://discord.gg/nBy28kjun'
35
+
28
36
  /** What the panel is currently showing. */
29
37
  export type PairPanelState =
30
38
  /** A read is in flight. */
@@ -211,6 +219,19 @@ export function PairPanel({
211
219
  <p className={css.hint}>{t('pair.usedHint')}</p>
212
220
  </>
213
221
  )}
222
+
223
+ {/* The one way out of a beta, offered in every state including a
224
+ refusal: a reader who cannot pair is exactly the one with a
225
+ question. It closes the body, so the last thing on the card is the
226
+ way to ask rather than the code they already have. */}
227
+ <a
228
+ className={css.invite}
229
+ href={COMMUNITY_INVITE_URL}
230
+ target="_blank"
231
+ rel="noopener noreferrer"
232
+ >
233
+ {t('community.invite')}
234
+ </a>
214
235
  </div>
215
236
 
216
237
  {/* The row exists only while it holds an action: a refusal offers
@@ -3,10 +3,12 @@
3
3
  * the header of an interactive card (§35.11).
4
4
  *
5
5
  * The panel has one job — put the live one-shot code in front of the operator as
6
- * a QR symbol — so its copy carries exactly four things: what to do with the
7
- * symbol, how long it lives, which address the phone will actually dial, and why
8
- * the code is single-use. No key states how the host finds its public address:
9
- * that is an implementation fact the reader cannot act on.
6
+ * a QR symbol — so its copy carries what to do with the symbol, how long it
7
+ * lives, which address the phone will actually dial, why the code is single-use,
8
+ * and that the app is still in testing: the reader is told what they are joining
9
+ * and where to ask about it. No key states how the host finds its public
10
+ * address, and no key names the wire protocol: both are implementation facts the
11
+ * reader cannot act on.
10
12
  *
11
13
  * The card's keys say only what the transcript row can act on: whether the page
12
14
  * is still waiting for the operator, that it is over, that this desktop renders
@@ -16,17 +18,18 @@
16
18
 
17
19
  /** Simplified Chinese dictionary (the key-set source of truth). */
18
20
  export const zh = {
19
- 'entry.label': '配对手机(协议 v1)',
20
- 'title': '协议 v1 配对',
21
- 'subtitle': '用手机 App 扫描二维码,即可让手机以协议 v1 连上这台宿主。配对码由本机签发,只在本机显示。',
21
+ 'entry.label': '配对 iPhone',
22
+ 'title': 'iOS App 配对',
23
+ 'subtitle': '用 iOS App(内测)扫描二维码,把 iPhone 连到这台电脑上。配对码只在本机显示。',
22
24
  'state.reading': '正在取配对码…',
23
25
  'pair.qrLabel': '配对二维码',
24
26
  'pair.countdown': '剩余 {s} 秒',
25
27
  'pair.expired': '配对码已过期',
26
28
  'pair.refresh': '重新取码',
27
- 'pair.usedHint': '配对码一次性有效:手机一开始配对即作废,重新取码也会作废上一张。',
28
- 'origin.located': '手机将连到 {origin}',
29
- 'origin.missing': '没有找到公网地址:请先在手机里把连接地址填成你的公网中继,再扫码。本页的 {host} 只有本机能连。',
29
+ 'pair.usedHint': '配对码一次性有效:iPhone 一开始配对就作废,重新取码也会作废上一张。',
30
+ 'origin.located': 'iPhone 将连到 {origin}',
31
+ 'origin.missing': '没有找到公网地址:先在 App 里把连接地址填成你的公网中继,再扫码。本页的 {host} 只有本机能连。',
32
+ 'community.invite': 'iOS App 还在内测,欢迎来 Discord 交流',
30
33
  'forbidden.title': '这个页面不是从本机打开的',
31
34
  'forbidden.body': '配对码只能在本机 Web UI 上取。请在本机浏览器打开 http://127.0.0.1:<端口> 后重试。',
32
35
  'failed.title': '取配对码失败',
@@ -49,17 +52,18 @@ export const zh = {
49
52
 
50
53
  /** English dictionary, key-for-key with the zh source. */
51
54
  export const en: Record<RemoteBridgeKey, string> = {
52
- 'entry.label': 'Pair a phone (protocol v1)',
53
- 'title': 'Protocol v1 pairing',
54
- '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.',
55
+ 'entry.label': 'Pair an iPhone',
56
+ 'title': 'iOS app pairing',
57
+ '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.',
55
58
  'state.reading': 'Requesting a pairing code…',
56
59
  'pair.qrLabel': 'Pairing QR code',
57
60
  'pair.countdown': '{s} s left',
58
61
  'pair.expired': 'The pairing code expired',
59
62
  'pair.refresh': 'New code',
60
63
  'pair.usedHint': 'The code is single-use: pairing spends it, and a new code voids the previous one.',
61
- 'origin.located': 'The phone will dial {origin}',
62
- '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.',
64
+ 'origin.located': 'The iPhone will dial {origin}',
65
+ '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.',
66
+ 'community.invite': 'The iOS app is in beta. Come talk to us on Discord',
63
67
  'forbidden.title': 'This page is not open on this machine',
64
68
  '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.',
65
69
  'failed.title': 'Could not read a pairing code',
@@ -336,6 +336,38 @@
336
336
  line-height: var(--pair-text-line);
337
337
  }
338
338
 
339
+ /* ── Beta community invite ──
340
+
341
+ The body's closing line in every state, and the card's only outbound
342
+ destination while the app is in testing. It sits in the supporting tier the
343
+ subtitle already uses and borrows its type from the same token, so the view
344
+ keeps three sizes; the hue is the secondary label slot rather than the
345
+ tertiary hint slot above it, because this line is the one interactive string
346
+ on the card and the tertiary slot does not clear the text contrast floor on
347
+ the light surface. Underlining it is deliberate: the affordance must not be
348
+ carried by colour alone, and the whole sentence is the target, so the
349
+ element is sized to its text instead of filling the row (A6 keeps no empty
350
+ stretch of card clickable). Hover and focus return the two slots the seat
351
+ trigger already uses, so one family of states reads the same everywhere. */
352
+ .invite {
353
+ align-self: flex-start;
354
+ margin: 0;
355
+ color: var(--dsw-alias-label-secondary);
356
+ font-size: var(--pair-text-size);
357
+ line-height: var(--pair-text-line);
358
+ text-decoration: underline;
359
+ transition: color var(--ds-transition-duration) ease;
360
+ }
361
+
362
+ .invite:hover {
363
+ color: var(--dsw-alias-label-primary);
364
+ }
365
+
366
+ .invite:focus-visible {
367
+ outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
368
+ outline-offset: var(--pair-focus-offset);
369
+ }
370
+
339
371
  /* ── Refusals ── */
340
372
 
341
373
  .notice {