@linxin666/dsh-remote-bridge 0.4.15 → 0.4.16
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 +2 -2
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/lib/index.js +143 -136
- package/lib/types/core/approvals.d.ts +10 -0
- package/lib/types/core/hub.d.ts +33 -26
- package/lib/types/core/questions.d.ts +20 -4
- package/lib/types/index.d.ts +2 -16
- package/package.json +1 -1
- package/src/core/approvals.ts +13 -0
- package/src/core/connection.ts +1 -1
- package/src/core/hub.ts +155 -156
- package/src/core/questions.ts +61 -14
- package/src/index.ts +3 -25
package/src/index.ts
CHANGED
|
@@ -24,9 +24,8 @@
|
|
|
24
24
|
* `question.answer` settles the host's own ask while it is open, or reaches a
|
|
25
25
|
* continued question through the host's Remote `answer`. With no paired
|
|
26
26
|
* connection on the wire the claim is still made when a roster device registered
|
|
27
|
-
* for notifications,
|
|
28
|
-
*
|
|
29
|
-
* delegates, and a timed question keeps the Host's own deadline.
|
|
27
|
+
* for notifications, and the alert is then its delivery (§11.3, §32). Every other
|
|
28
|
+
* case delegates, and a timed question keeps the Host's own deadline.
|
|
30
29
|
*
|
|
31
30
|
* The browser half lives in `src/client/` and is declared by `dsh.client`: one
|
|
32
31
|
* sidebar-foot panel that reads the same loopback-gated token route over a
|
|
@@ -51,7 +50,7 @@ import { DeviceRoster } from './core/devices.ts'
|
|
|
51
50
|
import { createRemoteBridgeFace, RemoteBridgeRegistry, REMOTE_BRIDGE_SERVICE } from './core/extension.ts'
|
|
52
51
|
import { JobRoster, type JobRegistryFace } from './core/jobs.ts'
|
|
53
52
|
import { ModelEffortPreferences } from './core/model-efforts.ts'
|
|
54
|
-
import { BridgeHub
|
|
53
|
+
import { BridgeHub } from './core/hub.ts'
|
|
55
54
|
import { createOwnerPeer } from './core/owner-peer.ts'
|
|
56
55
|
import { PairingService } from './core/pairing.ts'
|
|
57
56
|
import { LiveActivityNotifier } from './core/liveactivity.ts'
|
|
@@ -151,24 +150,6 @@ export const ROSTER_PATH = 'remote-bridge/devices.json'
|
|
|
151
150
|
*/
|
|
152
151
|
export const EFFORT_PATH = 'remote-bridge/model-efforts.json'
|
|
153
152
|
|
|
154
|
-
/** The environment variable that moves the offline claim window (§32.2). */
|
|
155
|
-
export const OFFLINE_CLAIM_TTL_ENV = 'DSH_REMOTE_BRIDGE_OFFLINE_CLAIM_TTL_MS'
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* The offline claim window this process runs with.
|
|
159
|
-
*
|
|
160
|
-
* The window is the bridge's own constant and never a host fact, so a deployment
|
|
161
|
-
* moves it here. A value that is missing, unreadable or not positive falls back to
|
|
162
|
-
* the constant instead of closing the window: a zero window would silently switch
|
|
163
|
-
* the channel off, and an operator who wanted that would be turning off push.
|
|
164
|
-
* @param env - the process environment, injectable for a suite.
|
|
165
|
-
* @returns the window in milliseconds.
|
|
166
|
-
*/
|
|
167
|
-
export function offlineClaimTtl(env: NodeJS.ProcessEnv = process.env): number {
|
|
168
|
-
const configured = Number(env[OFFLINE_CLAIM_TTL_ENV])
|
|
169
|
-
return Number.isFinite(configured) && configured > 0 ? configured : OFFLINE_QUESTION_CLAIM_TTL_MS
|
|
170
|
-
}
|
|
171
|
-
|
|
172
153
|
/**
|
|
173
154
|
* The environment variable that moves when a still-waiting turn end is reported (§28).
|
|
174
155
|
*
|
|
@@ -1586,8 +1567,6 @@ function applyImpl(ctx: Context, config?: unknown): void {
|
|
|
1586
1567
|
log,
|
|
1587
1568
|
})
|
|
1588
1569
|
const extensions = new RemoteBridgeRegistry()
|
|
1589
|
-
// 离线认领的窗口归桥所有,宿主从不认识它(§32.2):常量是默认值,部署可用环境变量覆盖。
|
|
1590
|
-
const offlineClaimTtlMs = offlineClaimTtl()
|
|
1591
1570
|
/**
|
|
1592
1571
|
* 第二会合点在协议面上的两处接线:`hello` 的公告与 `relay.grant` 的收帧。
|
|
1593
1572
|
*
|
|
@@ -1652,7 +1631,6 @@ function applyImpl(ctx: Context, config?: unknown): void {
|
|
|
1652
1631
|
push,
|
|
1653
1632
|
liveActivity,
|
|
1654
1633
|
turnEndQuiet,
|
|
1655
|
-
offlineClaimTtlMs,
|
|
1656
1634
|
onPushRegistered: () => { watchers.sync() },
|
|
1657
1635
|
...(relayFace === undefined ? {} : { relay: relayFace }),
|
|
1658
1636
|
onDeviceEnrolled: () => { wakeRelay() },
|