toc-ocra 0.3.24 → 0.5.0
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.md +47 -26
- package/dist/cli/cli.mjs +6358 -5951
- package/dist/service/agent.mjs +6598 -1545
- package/dist/src/config.d.ts +18 -22
- package/dist/src/config.js +66 -49
- package/dist/src/config.js.map +1 -1
- package/dist/src/hub/dpop.d.ts +61 -0
- package/dist/src/hub/dpop.js +131 -0
- package/dist/src/hub/dpop.js.map +1 -0
- package/dist/src/hub/event-store.d.ts +33 -0
- package/dist/src/hub/event-store.js +109 -0
- package/dist/src/hub/event-store.js.map +1 -0
- package/dist/src/hub/fs-list.d.ts +11 -0
- package/dist/src/hub/fs-list.js +40 -0
- package/dist/src/hub/fs-list.js.map +1 -0
- package/dist/src/hub/hub-link.d.ts +138 -0
- package/dist/src/hub/hub-link.js +617 -0
- package/dist/src/hub/hub-link.js.map +1 -0
- package/dist/src/hub/link-guard.d.ts +22 -0
- package/dist/src/hub/link-guard.js +37 -0
- package/dist/src/hub/link-guard.js.map +1 -0
- package/dist/src/hub/protocol.d.ts +59 -0
- package/dist/src/hub/protocol.js +40 -0
- package/dist/src/hub/protocol.js.map +1 -0
- package/dist/src/hub/proxy.d.ts +23 -0
- package/dist/src/hub/proxy.js +292 -0
- package/dist/src/hub/proxy.js.map +1 -0
- package/dist/src/index.js +84 -28
- package/dist/src/index.js.map +1 -1
- package/dist/src/providers/cli/claude.d.ts +9 -0
- package/dist/src/providers/cli/claude.js +1 -1
- package/dist/src/providers/cli/claude.js.map +1 -1
- package/dist/src/providers/tb-switch-control.d.ts +1 -1
- package/dist/src/runs/run-supervisor.d.ts +6 -0
- package/dist/src/runs/run-supervisor.js +2 -0
- package/dist/src/runs/run-supervisor.js.map +1 -1
- package/dist/src/runtime/agent-service.d.ts +3 -2
- package/dist/src/runtime/agent-service.js +20 -17
- package/dist/src/runtime/agent-service.js.map +1 -1
- package/dist/src/runtime/hub-runtime.d.ts +37 -0
- package/dist/src/runtime/hub-runtime.js +109 -0
- package/dist/src/runtime/hub-runtime.js.map +1 -0
- package/dist/src/t3/provider-catalog.d.ts +83 -0
- package/dist/src/t3/provider-catalog.js +155 -0
- package/dist/src/t3/provider-catalog.js.map +1 -0
- package/dist/src/t3/skills.d.ts +53 -0
- package/dist/src/t3/skills.js +160 -0
- package/dist/src/t3/skills.js.map +1 -0
- package/dist/src/t3/t3-backend.d.ts +96 -0
- package/dist/src/t3/t3-backend.js +689 -0
- package/dist/src/t3/t3-backend.js.map +1 -0
- package/dist/src/t3/thread-store.d.ts +95 -0
- package/dist/src/t3/thread-store.js +162 -0
- package/dist/src/t3/thread-store.js.map +1 -0
- package/dist/src/t3/turn-items.d.ts +39 -0
- package/dist/src/t3/turn-items.js +180 -0
- package/dist/src/t3/turn-items.js.map +1 -0
- package/dist/src/types/protocol.d.ts +1 -1
- package/package.json +4 -4
- package/scripts/service.mjs +3 -3
- package/dist/src/control/device-link.d.ts +0 -13
- package/dist/src/control/device-link.js +0 -113
- package/dist/src/control/device-link.js.map +0 -1
- package/dist/src/control/terminal-qr.d.ts +0 -1
- package/dist/src/control/terminal-qr.js +0 -27
- package/dist/src/control/terminal-qr.js.map +0 -1
- package/dist/src/runtime/agent-runtime.d.ts +0 -81
- package/dist/src/runtime/agent-runtime.js +0 -523
- package/dist/src/runtime/agent-runtime.js.map +0 -1
- package/dist/src/transport/gateway-client.d.ts +0 -53
- package/dist/src/transport/gateway-client.js +0 -138
- package/dist/src/transport/gateway-client.js.map +0 -1
|
@@ -0,0 +1,617 @@
|
|
|
1
|
+
import WebSocket from 'ws';
|
|
2
|
+
import { createDpopProof, renewHubToken } from './dpop.js';
|
|
3
|
+
import { EventStateStore, loadPersistedEvents } from './event-store.js';
|
|
4
|
+
import { listDirectories } from './fs-list.js';
|
|
5
|
+
import { reconnectDelay, STABLE_LINK_MS, startSleepDetector } from './link-guard.js';
|
|
6
|
+
import { ERROR_TAGS, rpcError, toRpcError } from './protocol.js';
|
|
7
|
+
import { createHubWebSocketAgent, ensureProcessProxyEnv } from './proxy.js';
|
|
8
|
+
/**
|
|
9
|
+
* The device's long-lived link to the Echo Hub
|
|
10
|
+
* (`wss://<hub>/api/t3/device/link`), ported from echo-t3-bridge
|
|
11
|
+
* `src/bridge.ts`. It owns everything about the connection: the DPoP
|
|
12
|
+
* handshake, token renewal, liveness, reconnect with jittered backoff,
|
|
13
|
+
* event acknowledgements, the on-disk buffer of unacknowledged events and
|
|
14
|
+
* their paced resend. What the device does with a Hub request is the
|
|
15
|
+
* `DeviceBackend`'s business; this file never starts a CLI.
|
|
16
|
+
*/
|
|
17
|
+
/** Max events held until the Hub confirms them; the rest is replayed from the backend's own state. */
|
|
18
|
+
const MAX_BUFFERED_EVENTS = 5_000;
|
|
19
|
+
/** Protocol-level ping to the Hub; answered by the Hub's WebSocket layer. */
|
|
20
|
+
const HUB_PING_INTERVAL_MS = 15_000;
|
|
21
|
+
const LIVENESS_CHECK_MS = 5_000;
|
|
22
|
+
/** Silence after which the link is dead, unless our own send backlog is still draining. */
|
|
23
|
+
const DEAD_SILENCE_MS = 60_000;
|
|
24
|
+
/** Silence after which the link is dead whatever the backlog says. */
|
|
25
|
+
const HARD_DEAD_SILENCE_MS = 150_000;
|
|
26
|
+
const HANDSHAKE_TIMEOUT_MS = 15_000;
|
|
27
|
+
/** From starting a connection to the Hub's welcome. */
|
|
28
|
+
const WELCOME_TIMEOUT_MS = 30_000;
|
|
29
|
+
/** Resend after reconnect: events per step, max unacknowledged, max socket backlog. */
|
|
30
|
+
const RESEND_BATCH = 50;
|
|
31
|
+
const RESEND_WINDOW = 200;
|
|
32
|
+
/** Kept small: command results and heartbeats are written behind whatever the resend queued. */
|
|
33
|
+
const RESEND_MAX_SOCKET_BUFFER = 256 * 1024;
|
|
34
|
+
/** The Hub closes a link that sends a frame over 16 MB; a larger result becomes a ResultTooLarge error. */
|
|
35
|
+
const MAX_RESULT_FRAME_BYTES = 12 * 1024 * 1024;
|
|
36
|
+
const SLOW_REQUEST_MS = 5_000;
|
|
37
|
+
export class HubLink {
|
|
38
|
+
credentials;
|
|
39
|
+
store;
|
|
40
|
+
backend;
|
|
41
|
+
appVersion;
|
|
42
|
+
logger;
|
|
43
|
+
ws = null;
|
|
44
|
+
stopped = false;
|
|
45
|
+
started = false;
|
|
46
|
+
heartbeatTimer = null;
|
|
47
|
+
pingTimer = null;
|
|
48
|
+
livenessTimer = null;
|
|
49
|
+
stableTimer = null;
|
|
50
|
+
tokenRefreshTimer = null;
|
|
51
|
+
reconnectTimer = null;
|
|
52
|
+
stopSleepDetector = null;
|
|
53
|
+
/** Failed attempts since the last stable link (drives the backoff). */
|
|
54
|
+
reconnectAttempt = 0;
|
|
55
|
+
connectStartedAt = 0;
|
|
56
|
+
lastInboundAt = 0;
|
|
57
|
+
lastBufferedAmount = 0;
|
|
58
|
+
lastBufferedProgressAt = 0;
|
|
59
|
+
/** Sequences waiting to be resent after a reconnect (oldest first), and those sent but unacked. */
|
|
60
|
+
resendQueue = [];
|
|
61
|
+
resendInflight = new Set();
|
|
62
|
+
resendTimer = null;
|
|
63
|
+
sendFailures = 0;
|
|
64
|
+
/** message.dispatch / thread.create in flight by commandId: a repeat joins it. */
|
|
65
|
+
inflightCommands = new Map();
|
|
66
|
+
requestsInFlight = 0;
|
|
67
|
+
bypassProxyOnNextAttempt = false;
|
|
68
|
+
/** True once the Hub's welcome arrived on the current link; events flow only then. */
|
|
69
|
+
ready = false;
|
|
70
|
+
hubAcksEvents = false;
|
|
71
|
+
/** Events not yet known to be stored by the Hub. */
|
|
72
|
+
bufferedEvents = new Map();
|
|
73
|
+
/** Lowest sequence dropped because the buffer was full; replayed after welcome. */
|
|
74
|
+
overflowFromSequence = null;
|
|
75
|
+
stateStore;
|
|
76
|
+
stateFlushed = false;
|
|
77
|
+
state = 'disconnected';
|
|
78
|
+
unauthorized = false;
|
|
79
|
+
lastDisconnectReason;
|
|
80
|
+
lastDisconnectAt;
|
|
81
|
+
constructor(options) {
|
|
82
|
+
this.credentials = options.credentials;
|
|
83
|
+
this.store = options.store;
|
|
84
|
+
this.backend = options.backend;
|
|
85
|
+
this.appVersion = options.appVersion;
|
|
86
|
+
this.logger = options.logger;
|
|
87
|
+
const persisted = loadPersistedEvents(options.eventStatePath);
|
|
88
|
+
if (persisted) {
|
|
89
|
+
for (const envelope of persisted.events)
|
|
90
|
+
this.bufferedEvents.set(envelope.sequence, envelope);
|
|
91
|
+
this.overflowFromSequence = persisted.overflowFromSequence;
|
|
92
|
+
if (persisted.events.length)
|
|
93
|
+
this.logger.info('hub-events-restored', { events: persisted.events.length });
|
|
94
|
+
}
|
|
95
|
+
this.stateStore = new EventStateStore(options.eventStatePath, () => ({ events: [...this.bufferedEvents.values()], overflowFromSequence: this.overflowFromSequence }), () => this.bufferedEvents.size, (message) => this.logger.warn('hub-events-save-failed', { error: message }));
|
|
96
|
+
}
|
|
97
|
+
start() {
|
|
98
|
+
if (this.started)
|
|
99
|
+
return;
|
|
100
|
+
this.started = true;
|
|
101
|
+
ensureProcessProxyEnv();
|
|
102
|
+
this.stopSleepDetector = startSleepDetector((gapMs) => {
|
|
103
|
+
this.logger.info('hub-wake-detected', { gapSeconds: Math.round(gapMs / 1000) });
|
|
104
|
+
this.reconnectAttempt = 0;
|
|
105
|
+
this.dropLink(`休眠唤醒/时钟跳变 ${Math.round(gapMs / 1000)}s`, { immediate: true });
|
|
106
|
+
});
|
|
107
|
+
void this.connect();
|
|
108
|
+
}
|
|
109
|
+
/** Stops the link; everything the Hub has not acknowledged is saved for the next start. */
|
|
110
|
+
stop() {
|
|
111
|
+
this.stopped = true;
|
|
112
|
+
if (this.reconnectTimer) {
|
|
113
|
+
clearTimeout(this.reconnectTimer);
|
|
114
|
+
this.reconnectTimer = null;
|
|
115
|
+
}
|
|
116
|
+
this.stopSleepDetector?.();
|
|
117
|
+
this.teardown();
|
|
118
|
+
this.state = 'disconnected';
|
|
119
|
+
if (!this.stateFlushed) {
|
|
120
|
+
this.stateFlushed = true;
|
|
121
|
+
const kept = this.stateStore.flushSync();
|
|
122
|
+
if (kept > 0)
|
|
123
|
+
this.logger.info('hub-events-saved', { events: kept });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
status() {
|
|
127
|
+
return {
|
|
128
|
+
state: this.state,
|
|
129
|
+
unauthorized: this.unauthorized,
|
|
130
|
+
serverUrl: this.credentials.serverUrl,
|
|
131
|
+
...(this.lastDisconnectReason ? { lastDisconnectReason: this.lastDisconnectReason } : {}),
|
|
132
|
+
...(this.lastDisconnectAt ? { lastDisconnectAt: this.lastDisconnectAt } : {}),
|
|
133
|
+
bufferedEvents: this.bufferedEvents.size,
|
|
134
|
+
requestsInFlight: this.requestsInFlight
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/** The full CLI / model catalog; sent now when the link is up, and again on every connect. */
|
|
138
|
+
publishCatalog(providers) {
|
|
139
|
+
this.sendFrame({ type: 'catalog', data: { providers } });
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* One device event. It counts as delivered only once the Hub acknowledged
|
|
143
|
+
* its sequence; until then it stays buffered (bounded, saved to disk) and
|
|
144
|
+
* is resent in sequence order after the next welcome.
|
|
145
|
+
*/
|
|
146
|
+
publishEvent(envelope) {
|
|
147
|
+
const sequence = envelope.sequence;
|
|
148
|
+
if (this.bufferedEvents.size >= MAX_BUFFERED_EVENTS) {
|
|
149
|
+
this.noteOverflow(sequence);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
this.bufferedEvents.set(sequence, envelope);
|
|
153
|
+
this.stateStore.schedule();
|
|
154
|
+
if (!this.isReady())
|
|
155
|
+
return;
|
|
156
|
+
if (this.resendQueue.length > 0) {
|
|
157
|
+
// A resend is in progress: keep sequence order behind it.
|
|
158
|
+
this.resendQueue.push(sequence);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
this.sendEventNow(envelope);
|
|
162
|
+
}
|
|
163
|
+
isReady() {
|
|
164
|
+
return this.ready && this.ws?.readyState === WebSocket.OPEN;
|
|
165
|
+
}
|
|
166
|
+
noteOverflow(sequence) {
|
|
167
|
+
if (this.overflowFromSequence === null || sequence < this.overflowFromSequence) {
|
|
168
|
+
this.overflowFromSequence = sequence;
|
|
169
|
+
this.logger.warn('hub-events-overflow', { sequence, limit: MAX_BUFFERED_EVENTS });
|
|
170
|
+
}
|
|
171
|
+
this.stateStore.schedule();
|
|
172
|
+
}
|
|
173
|
+
sendEventNow(envelope) {
|
|
174
|
+
const ws = this.ws;
|
|
175
|
+
if (!ws || ws.readyState !== WebSocket.OPEN)
|
|
176
|
+
return;
|
|
177
|
+
const sequence = envelope.sequence;
|
|
178
|
+
ws.send(JSON.stringify({ type: 'event', data: envelope }), (error) => {
|
|
179
|
+
if (!error) {
|
|
180
|
+
// A Hub without acks: a written frame is all the confirmation there is.
|
|
181
|
+
if (!this.hubAcksEvents) {
|
|
182
|
+
this.bufferedEvents.delete(sequence);
|
|
183
|
+
this.stateStore.schedule();
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
this.resendInflight.delete(sequence);
|
|
188
|
+
// A dropped socket cancels every queued write: log once per link, not per event.
|
|
189
|
+
this.sendFailures += 1;
|
|
190
|
+
if (this.sendFailures === 1)
|
|
191
|
+
this.logger.warn('hub-event-send-failed', { sequence, error: error.message });
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
handleEventAck(data) {
|
|
195
|
+
const ack = (data ?? {});
|
|
196
|
+
const sequences = [];
|
|
197
|
+
if (typeof ack.sequence === 'number')
|
|
198
|
+
sequences.push(ack.sequence);
|
|
199
|
+
if (Array.isArray(ack.sequences))
|
|
200
|
+
for (const value of ack.sequences)
|
|
201
|
+
if (typeof value === 'number')
|
|
202
|
+
sequences.push(value);
|
|
203
|
+
for (const sequence of sequences) {
|
|
204
|
+
this.bufferedEvents.delete(sequence);
|
|
205
|
+
this.resendInflight.delete(sequence);
|
|
206
|
+
}
|
|
207
|
+
if (sequences.length > 0)
|
|
208
|
+
this.stateStore.schedule();
|
|
209
|
+
if (this.resendQueue.length > 0)
|
|
210
|
+
this.scheduleResendPump(0);
|
|
211
|
+
}
|
|
212
|
+
/** Resends everything not yet confirmed, oldest first, paced so heartbeats and results are not starved. */
|
|
213
|
+
flushBufferedEvents() {
|
|
214
|
+
this.resendQueue = [...this.bufferedEvents.keys()].sort((a, b) => a - b);
|
|
215
|
+
this.resendInflight.clear();
|
|
216
|
+
if (this.resendQueue.length > 0) {
|
|
217
|
+
this.logger.info('hub-events-resend', { events: this.resendQueue.length, from: this.resendQueue[0], to: this.resendQueue[this.resendQueue.length - 1] });
|
|
218
|
+
}
|
|
219
|
+
this.scheduleResendPump(0);
|
|
220
|
+
}
|
|
221
|
+
scheduleResendPump(delayMs) {
|
|
222
|
+
if (this.resendTimer)
|
|
223
|
+
return;
|
|
224
|
+
this.resendTimer = setTimeout(() => {
|
|
225
|
+
this.resendTimer = null;
|
|
226
|
+
this.pumpResend();
|
|
227
|
+
}, delayMs);
|
|
228
|
+
}
|
|
229
|
+
pumpResend() {
|
|
230
|
+
const ws = this.ws;
|
|
231
|
+
if (!this.isReady() || !ws)
|
|
232
|
+
return;
|
|
233
|
+
if (ws.bufferedAmount > RESEND_MAX_SOCKET_BUFFER || (this.hubAcksEvents && this.resendInflight.size >= RESEND_WINDOW)) {
|
|
234
|
+
// Wait for the socket to drain / the Hub to confirm.
|
|
235
|
+
this.scheduleResendPump(200);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
let sent = 0;
|
|
239
|
+
while (this.resendQueue.length > 0 && sent < RESEND_BATCH) {
|
|
240
|
+
const sequence = this.resendQueue.shift();
|
|
241
|
+
const envelope = this.bufferedEvents.get(sequence);
|
|
242
|
+
if (!envelope)
|
|
243
|
+
continue; // acked meanwhile
|
|
244
|
+
if (this.hubAcksEvents)
|
|
245
|
+
this.resendInflight.add(sequence);
|
|
246
|
+
this.sendEventNow(envelope);
|
|
247
|
+
sent += 1;
|
|
248
|
+
}
|
|
249
|
+
if (this.resendQueue.length > 0)
|
|
250
|
+
this.scheduleResendPump(50);
|
|
251
|
+
}
|
|
252
|
+
teardown() {
|
|
253
|
+
this.ready = false;
|
|
254
|
+
this.hubAcksEvents = false;
|
|
255
|
+
this.resendQueue = [];
|
|
256
|
+
this.resendInflight.clear();
|
|
257
|
+
if (this.resendTimer) {
|
|
258
|
+
clearTimeout(this.resendTimer);
|
|
259
|
+
this.resendTimer = null;
|
|
260
|
+
}
|
|
261
|
+
for (const timer of [this.heartbeatTimer, this.pingTimer, this.livenessTimer, this.tokenRefreshTimer])
|
|
262
|
+
if (timer)
|
|
263
|
+
clearInterval(timer);
|
|
264
|
+
this.heartbeatTimer = this.pingTimer = this.livenessTimer = this.tokenRefreshTimer = null;
|
|
265
|
+
if (this.stableTimer) {
|
|
266
|
+
clearTimeout(this.stableTimer);
|
|
267
|
+
this.stableTimer = null;
|
|
268
|
+
}
|
|
269
|
+
const ws = this.ws;
|
|
270
|
+
this.ws = null;
|
|
271
|
+
if (ws) {
|
|
272
|
+
// terminate, not close: a close handshake on a dead link waits and keeps queued writes around.
|
|
273
|
+
try {
|
|
274
|
+
ws.terminate();
|
|
275
|
+
}
|
|
276
|
+
catch { /* already gone */ }
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/** The single way a link ends: record why, drop the socket, schedule a reconnect. */
|
|
280
|
+
dropLink(reason, options = {}) {
|
|
281
|
+
const wasUp = this.state === 'connected' || this.ws !== null;
|
|
282
|
+
this.state = 'disconnected';
|
|
283
|
+
this.lastDisconnectAt = new Date().toISOString();
|
|
284
|
+
this.lastDisconnectReason = reason;
|
|
285
|
+
if (wasUp)
|
|
286
|
+
this.logger.info('hub-link-dropped', { reason, ...(options.closeCode !== undefined ? { closeCode: options.closeCode } : {}) });
|
|
287
|
+
this.teardown();
|
|
288
|
+
if (options.immediate && this.reconnectTimer) {
|
|
289
|
+
clearTimeout(this.reconnectTimer);
|
|
290
|
+
this.reconnectTimer = null;
|
|
291
|
+
}
|
|
292
|
+
this.scheduleReconnect(options.immediate ? 500 : undefined);
|
|
293
|
+
}
|
|
294
|
+
scheduleReconnect(fixedDelayMs) {
|
|
295
|
+
if (this.stopped || this.reconnectTimer)
|
|
296
|
+
return;
|
|
297
|
+
const wait = fixedDelayMs ?? reconnectDelay(this.reconnectAttempt);
|
|
298
|
+
this.reconnectAttempt += 1;
|
|
299
|
+
this.reconnectTimer = setTimeout(() => {
|
|
300
|
+
this.reconnectTimer = null;
|
|
301
|
+
void this.connect().catch((error) => this.dropLink(`连接过程异常: ${errorMessage(error)}`));
|
|
302
|
+
}, wait);
|
|
303
|
+
}
|
|
304
|
+
checkLiveness(ws) {
|
|
305
|
+
if (this.ws !== ws)
|
|
306
|
+
return;
|
|
307
|
+
const now = Date.now();
|
|
308
|
+
if (!this.ready) {
|
|
309
|
+
if (now - this.connectStartedAt > WELCOME_TIMEOUT_MS)
|
|
310
|
+
this.dropLink(`${WELCOME_TIMEOUT_MS / 1000} 秒内未完成握手/未收到 welcome`);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const buffered = ws.bufferedAmount;
|
|
314
|
+
if (buffered < this.lastBufferedAmount || buffered === 0)
|
|
315
|
+
this.lastBufferedProgressAt = now;
|
|
316
|
+
this.lastBufferedAmount = buffered;
|
|
317
|
+
const silence = now - this.lastInboundAt;
|
|
318
|
+
const draining = buffered > 0 && now - this.lastBufferedProgressAt < DEAD_SILENCE_MS;
|
|
319
|
+
if (silence > HARD_DEAD_SILENCE_MS || (silence > DEAD_SILENCE_MS && !draining)) {
|
|
320
|
+
this.dropLink(`${Math.round(silence / 1000)} 秒未收到 Hub 任何数据`);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/** Another process (a re-pair from the terminal) may have saved newer credentials. */
|
|
324
|
+
async adoptNewerCredentials() {
|
|
325
|
+
try {
|
|
326
|
+
const onDisk = await this.store.load();
|
|
327
|
+
if (onDisk && onDisk.accessToken !== this.credentials.accessToken
|
|
328
|
+
&& (onDisk.environmentId !== this.credentials.environmentId || onDisk.accessTokenExpiresAt > this.credentials.accessTokenExpiresAt)) {
|
|
329
|
+
this.credentials = onDisk;
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
catch { /* keep the ones in memory */ }
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
async freshCredentials(minRemainingMs = 5 * 60_000) {
|
|
337
|
+
await this.adoptNewerCredentials();
|
|
338
|
+
if (this.credentials.accessTokenExpiresAt - Date.now() < minRemainingMs) {
|
|
339
|
+
this.credentials = await renewHubToken(this.credentials, this.appVersion);
|
|
340
|
+
await this.store.save(this.credentials);
|
|
341
|
+
this.logger.info('hub-token-renewed');
|
|
342
|
+
}
|
|
343
|
+
return this.credentials;
|
|
344
|
+
}
|
|
345
|
+
async connect(retriedAfterRenew = false) {
|
|
346
|
+
if (this.stopped || this.ws)
|
|
347
|
+
return;
|
|
348
|
+
this.connectStartedAt = Date.now();
|
|
349
|
+
this.state = 'connecting';
|
|
350
|
+
let credentials;
|
|
351
|
+
try {
|
|
352
|
+
credentials = await this.freshCredentials();
|
|
353
|
+
}
|
|
354
|
+
catch (error) {
|
|
355
|
+
this.dropLink(`续期失败: ${errorMessage(error)}`);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
if (this.stopped || this.ws)
|
|
359
|
+
return;
|
|
360
|
+
const linkHttpUrl = `${credentials.serverUrl}/api/t3/device/link`;
|
|
361
|
+
const wsUrl = new URL(linkHttpUrl);
|
|
362
|
+
wsUrl.protocol = wsUrl.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
363
|
+
const proof = createDpopProof({ keyPair: credentials.dpop, method: 'GET', url: linkHttpUrl, accessToken: credentials.accessToken });
|
|
364
|
+
const proxy = this.bypassProxyOnNextAttempt ? null : createHubWebSocketAgent(wsUrl.toString());
|
|
365
|
+
if (proxy)
|
|
366
|
+
this.bypassProxyOnNextAttempt = false;
|
|
367
|
+
const ws = new WebSocket(wsUrl.toString(), {
|
|
368
|
+
headers: { Authorization: `DPoP ${credentials.accessToken}`, DPoP: proof },
|
|
369
|
+
...(proxy ? { agent: proxy.agent } : {}),
|
|
370
|
+
maxPayload: 16 * 1024 * 1024,
|
|
371
|
+
handshakeTimeout: HANDSHAKE_TIMEOUT_MS,
|
|
372
|
+
// Events and snapshots are JSON and shrink 5–10x; used only when the Hub accepts it.
|
|
373
|
+
perMessageDeflate: { threshold: 1024, clientNoContextTakeover: true, serverNoContextTakeover: true, zlibDeflateOptions: { level: 1 } }
|
|
374
|
+
});
|
|
375
|
+
this.ws = ws;
|
|
376
|
+
this.sendFailures = 0;
|
|
377
|
+
this.lastInboundAt = Date.now();
|
|
378
|
+
this.lastBufferedAmount = 0;
|
|
379
|
+
this.lastBufferedProgressAt = Date.now();
|
|
380
|
+
let opened = false;
|
|
381
|
+
// Covers the handshake and the wait for welcome too.
|
|
382
|
+
this.livenessTimer = setInterval(() => this.checkLiveness(ws), LIVENESS_CHECK_MS);
|
|
383
|
+
ws.on('unexpected-response', (_request, response) => {
|
|
384
|
+
if (this.ws !== ws)
|
|
385
|
+
return;
|
|
386
|
+
const status = response.statusCode ?? 0;
|
|
387
|
+
response.resume();
|
|
388
|
+
this.teardown();
|
|
389
|
+
void this.onHandshakeRefused(status, credentials, retriedAfterRenew);
|
|
390
|
+
});
|
|
391
|
+
ws.on('open', () => {
|
|
392
|
+
if (this.ws !== ws)
|
|
393
|
+
return;
|
|
394
|
+
opened = true;
|
|
395
|
+
this.lastInboundAt = Date.now();
|
|
396
|
+
this.bypassProxyOnNextAttempt = false;
|
|
397
|
+
this.unauthorized = false;
|
|
398
|
+
this.pingTimer = setInterval(() => {
|
|
399
|
+
if (this.ws !== ws || ws.readyState !== WebSocket.OPEN)
|
|
400
|
+
return;
|
|
401
|
+
try {
|
|
402
|
+
ws.ping();
|
|
403
|
+
}
|
|
404
|
+
catch { /* the close handler reconnects */ }
|
|
405
|
+
}, HUB_PING_INTERVAL_MS);
|
|
406
|
+
this.logger.info('hub-link-open', { serverUrl: credentials.serverUrl, environmentId: credentials.environmentId, proxied: Boolean(proxy) });
|
|
407
|
+
this.tokenRefreshTimer = setInterval(() => {
|
|
408
|
+
void this.freshCredentials(10 * 60_000).catch((error) => this.logger.warn('hub-token-renew-failed', { error: errorMessage(error) }));
|
|
409
|
+
}, 5 * 60_000);
|
|
410
|
+
this.sendFrame({ type: 'hello', data: { platform: process.platform, appVersion: this.appVersion } });
|
|
411
|
+
const cached = this.backend.providers();
|
|
412
|
+
if (cached.length > 0)
|
|
413
|
+
this.sendFrame({ type: 'catalog', data: { providers: cached } });
|
|
414
|
+
else
|
|
415
|
+
void this.backend.refreshProviders({ quota: false }).then((result) => this.publishCatalog(result.providers)).catch((error) => this.logger.warn('catalog-probe-failed', { error: errorMessage(error) }));
|
|
416
|
+
});
|
|
417
|
+
ws.on('message', (raw) => {
|
|
418
|
+
if (this.ws !== ws)
|
|
419
|
+
return;
|
|
420
|
+
// Any frame from the Hub proves the link is alive, not only heartbeat_ack.
|
|
421
|
+
this.lastInboundAt = Date.now();
|
|
422
|
+
void this.handleFrame(raw.toString()).catch((error) => this.logger.error('hub-frame-failed', { error: errorMessage(error) }));
|
|
423
|
+
});
|
|
424
|
+
ws.on('pong', () => { if (this.ws === ws)
|
|
425
|
+
this.lastInboundAt = Date.now(); });
|
|
426
|
+
// ws answers a ping with a pong by itself; a Hub ping also proves liveness.
|
|
427
|
+
ws.on('ping', () => { if (this.ws === ws)
|
|
428
|
+
this.lastInboundAt = Date.now(); });
|
|
429
|
+
ws.on('close', (code, reason) => {
|
|
430
|
+
if (this.ws !== ws)
|
|
431
|
+
return;
|
|
432
|
+
this.dropLink(`Hub 关闭连接 ${reason.toString() || ''}`.trim(), { closeCode: code });
|
|
433
|
+
});
|
|
434
|
+
ws.on('error', (error) => {
|
|
435
|
+
if (this.ws !== ws)
|
|
436
|
+
return;
|
|
437
|
+
if (!opened)
|
|
438
|
+
this.bypassProxyOnNextAttempt = Boolean(proxy);
|
|
439
|
+
this.logger.warn('hub-socket-error', { error: error.message, proxied: Boolean(proxy) });
|
|
440
|
+
// ws normally emits close after error; make sure the attempt ends anyway.
|
|
441
|
+
if (!opened)
|
|
442
|
+
this.dropLink(`连接失败: ${error.message}`);
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
async onHandshakeRefused(status, credentials, retriedAfterRenew) {
|
|
446
|
+
this.logger.warn('hub-handshake-refused', { status });
|
|
447
|
+
if (status === 401 && !retriedAfterRenew) {
|
|
448
|
+
try {
|
|
449
|
+
if (!(await this.adoptNewerCredentials())) {
|
|
450
|
+
this.credentials = await renewHubToken(credentials, this.appVersion);
|
|
451
|
+
await this.store.save(this.credentials);
|
|
452
|
+
}
|
|
453
|
+
void this.connect(true);
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
catch (error) {
|
|
457
|
+
// The key is no longer accepted: the device was unpaired on the web.
|
|
458
|
+
this.unauthorized = true;
|
|
459
|
+
this.logger.warn('hub-credentials-rejected', { error: errorMessage(error) });
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
else if (status === 401)
|
|
463
|
+
this.unauthorized = true;
|
|
464
|
+
this.dropLink(`握手被拒绝 HTTP ${status}`);
|
|
465
|
+
}
|
|
466
|
+
sendFrame(frame) {
|
|
467
|
+
if (this.ws?.readyState === WebSocket.OPEN)
|
|
468
|
+
this.ws.send(JSON.stringify(frame));
|
|
469
|
+
}
|
|
470
|
+
reply(type, id, payload) {
|
|
471
|
+
if (!id)
|
|
472
|
+
return;
|
|
473
|
+
const ws = this.ws;
|
|
474
|
+
if (!ws || ws.readyState !== WebSocket.OPEN) {
|
|
475
|
+
// The Hub treats the missing answer as "delivery unknown" and verifies by snapshot.
|
|
476
|
+
this.logger.warn('hub-reply-not-sent', { type, id, ok: payload.ok });
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
let text = JSON.stringify({ type: `${type}.result`, id, data: payload });
|
|
480
|
+
if (text.length > MAX_RESULT_FRAME_BYTES) {
|
|
481
|
+
const bytes = Buffer.byteLength(text, 'utf8');
|
|
482
|
+
this.logger.warn('hub-reply-too-large', { type, bytes });
|
|
483
|
+
text = JSON.stringify({
|
|
484
|
+
type: `${type}.result`, id,
|
|
485
|
+
data: { ok: false, error: rpcError(ERROR_TAGS.resultTooLarge, `设备返回的数据过大(${Math.round(bytes / 1024 / 1024)} MB),已拒绝通过长连接传输`, `frame=${type}.result bytes=${bytes}`) }
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
ws.send(text);
|
|
489
|
+
}
|
|
490
|
+
/** Answers a request frame with the action's result or its tagged error. */
|
|
491
|
+
async answer(frame, label, action) {
|
|
492
|
+
const startedAt = Date.now();
|
|
493
|
+
this.requestsInFlight += 1;
|
|
494
|
+
try {
|
|
495
|
+
const result = await action();
|
|
496
|
+
const took = Date.now() - startedAt;
|
|
497
|
+
this.logger.info('hub-request', { request: label, ok: true, ...(took > SLOW_REQUEST_MS ? { ms: took } : {}) });
|
|
498
|
+
this.reply(frame.type, frame.id, { ok: true, result });
|
|
499
|
+
}
|
|
500
|
+
catch (error) {
|
|
501
|
+
const failure = toRpcError(error);
|
|
502
|
+
this.logger.warn('hub-request', { request: label, ok: false, tag: failure.tag, error: failure.message, ms: Date.now() - startedAt });
|
|
503
|
+
this.reply(frame.type, frame.id, { ok: false, error: failure });
|
|
504
|
+
}
|
|
505
|
+
finally {
|
|
506
|
+
this.requestsInFlight -= 1;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
/** Runs a command once per commandId: a repeat that arrives while it is in flight shares its outcome. */
|
|
510
|
+
dispatchOnce(command) {
|
|
511
|
+
const commandId = typeof command.commandId === 'string' ? command.commandId : '';
|
|
512
|
+
const type = typeof command.type === 'string' ? command.type : '';
|
|
513
|
+
if (!commandId || (type !== 'message.dispatch' && type !== 'thread.create'))
|
|
514
|
+
return this.backend.dispatchCommand(command);
|
|
515
|
+
const existing = this.inflightCommands.get(commandId);
|
|
516
|
+
if (existing)
|
|
517
|
+
return existing;
|
|
518
|
+
const run = this.backend.dispatchCommand(command).finally(() => this.inflightCommands.delete(commandId));
|
|
519
|
+
this.inflightCommands.set(commandId, run);
|
|
520
|
+
return run;
|
|
521
|
+
}
|
|
522
|
+
onWelcome(data) {
|
|
523
|
+
const interval = Math.max(5_000, Number(data.heartbeatIntervalMs) || 20_000);
|
|
524
|
+
if (this.heartbeatTimer)
|
|
525
|
+
clearInterval(this.heartbeatTimer);
|
|
526
|
+
// Application heartbeat: keeps the Hub's presence fresh. Liveness is checkLiveness's job.
|
|
527
|
+
this.heartbeatTimer = setInterval(() => this.sendFrame({ type: 'heartbeat', id: `hb_${Date.now()}` }), interval);
|
|
528
|
+
this.state = 'connected';
|
|
529
|
+
if (this.stableTimer)
|
|
530
|
+
clearTimeout(this.stableTimer);
|
|
531
|
+
this.stableTimer = setTimeout(() => {
|
|
532
|
+
this.stableTimer = null;
|
|
533
|
+
if (this.ready)
|
|
534
|
+
this.reconnectAttempt = 0;
|
|
535
|
+
}, STABLE_LINK_MS);
|
|
536
|
+
this.ready = true;
|
|
537
|
+
this.hubAcksEvents = data.eventAck === true;
|
|
538
|
+
const cursor = typeof data.lastEventSequence === 'number' ? data.lastEventSequence : null;
|
|
539
|
+
this.logger.info('hub-welcome', { cursor, eventAck: this.hubAcksEvents, pending: this.bufferedEvents.size });
|
|
540
|
+
if (cursor !== null)
|
|
541
|
+
this.backend.noteHubCursor(cursor);
|
|
542
|
+
// Resend what the Hub has not confirmed, in order, then replay whatever its
|
|
543
|
+
// cursor (or a buffer overflow) says it is missing from the device's own state.
|
|
544
|
+
this.flushBufferedEvents();
|
|
545
|
+
const overflow = this.overflowFromSequence;
|
|
546
|
+
this.overflowFromSequence = null;
|
|
547
|
+
let resumeAfter = cursor !== null && cursor > 0 ? cursor : null;
|
|
548
|
+
if (overflow !== null) {
|
|
549
|
+
const beforeOverflow = Math.max(0, overflow - 1);
|
|
550
|
+
resumeAfter = resumeAfter === null ? beforeOverflow : Math.min(resumeAfter, beforeOverflow);
|
|
551
|
+
}
|
|
552
|
+
if (resumeAfter !== null)
|
|
553
|
+
this.resumeAfter(resumeAfter);
|
|
554
|
+
}
|
|
555
|
+
resumeAfter(after) {
|
|
556
|
+
const sequence = typeof after === 'number' ? after : Number(after);
|
|
557
|
+
if (!Number.isFinite(sequence) || sequence < 0)
|
|
558
|
+
return;
|
|
559
|
+
this.backend.replayAfter(sequence, (candidate) => this.bufferedEvents.has(candidate));
|
|
560
|
+
}
|
|
561
|
+
async handleFrame(raw) {
|
|
562
|
+
let frame;
|
|
563
|
+
try {
|
|
564
|
+
frame = JSON.parse(raw);
|
|
565
|
+
}
|
|
566
|
+
catch {
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
if (!frame || typeof frame.type !== 'string')
|
|
570
|
+
return;
|
|
571
|
+
const data = (frame.data ?? {});
|
|
572
|
+
switch (frame.type) {
|
|
573
|
+
case 'welcome':
|
|
574
|
+
this.onWelcome(data);
|
|
575
|
+
return;
|
|
576
|
+
case 'heartbeat_ack':
|
|
577
|
+
return;
|
|
578
|
+
case 'event.ack':
|
|
579
|
+
this.handleEventAck(frame.data);
|
|
580
|
+
return;
|
|
581
|
+
case 'events.resume':
|
|
582
|
+
this.resumeAfter(data.lastEventSequence ?? data.afterSequence);
|
|
583
|
+
return;
|
|
584
|
+
case 'providers.refresh': {
|
|
585
|
+
const providerId = typeof data.providerId === 'string' ? data.providerId : undefined;
|
|
586
|
+
return this.answer(frame, 'providers.refresh', async () => {
|
|
587
|
+
const result = await this.backend.refreshProviders({ quota: true, ...(providerId ? { providerId } : {}) });
|
|
588
|
+
this.publishCatalog(result.providers);
|
|
589
|
+
return providerId ? { ...result, quotaProviderId: providerId } : result;
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
case 'fs.list':
|
|
593
|
+
return this.answer(frame, 'fs.list', () => listDirectories(typeof data.path === 'string' ? data.path : undefined));
|
|
594
|
+
case 'project.ensure':
|
|
595
|
+
return this.answer(frame, 'project.ensure', () => this.backend.ensureProject(typeof data.workspaceRoot === 'string' ? data.workspaceRoot : undefined));
|
|
596
|
+
case 'command':
|
|
597
|
+
// Only the command type and ids are logged, never message text.
|
|
598
|
+
return this.answer(frame, `command ${String(data.type ?? '')}${data.threadId ? ` thread=${String(data.threadId)}` : ''}`, () => this.dispatchOnce(data));
|
|
599
|
+
case 'snapshot':
|
|
600
|
+
return this.answer(frame, 'snapshot', () => this.backend.snapshot(typeof data.threadId === 'string' ? data.threadId : ''));
|
|
601
|
+
case 'error':
|
|
602
|
+
this.logger.warn('hub-error-frame', { data: JSON.stringify(frame.data ?? null).slice(0, 500) });
|
|
603
|
+
return;
|
|
604
|
+
default:
|
|
605
|
+
// Web terminal is not part of this device package (the Hub's device exec runs through
|
|
606
|
+
// the same terminal frames): say so with a tag the Hub can show.
|
|
607
|
+
if (frame.type.startsWith('terminal.')) {
|
|
608
|
+
this.reply(frame.type, frame.id, { ok: false, error: rpcError(ERROR_TAGS.terminalUnsupported, 'ocra 设备包暂不支持 Web 终端和设备命令执行(exec),请在设备本机的终端里操作', `frame=${frame.type}`) });
|
|
609
|
+
}
|
|
610
|
+
// Other unknown types are ignored on purpose, as the protocol requires.
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
function errorMessage(error) {
|
|
615
|
+
return error instanceof Error ? error.message : String(error);
|
|
616
|
+
}
|
|
617
|
+
//# sourceMappingURL=hub-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-link.js","sourceRoot":"","sources":["../../../src/hub/hub-link.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,IAAI,CAAA;AAG1B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAuB,MAAM,WAAW,CAAA;AAC/E,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,kBAA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