@urun-sh/core 0.5.6 → 0.6.1
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/CHANGELOG.md +19 -0
- package/dist/adapter/index.d.mts +41 -0
- package/dist/adapter/index.d.ts +41 -0
- package/dist/adapter/index.js +7 -0
- package/dist/adapter/index.mjs +2 -0
- package/dist/adapter/test-util.d.mts +32 -0
- package/dist/adapter/test-util.d.ts +32 -0
- package/dist/adapter/test-util.js +1 -0
- package/dist/adapter/test-util.mjs +2 -0
- package/dist/app-PYXBLQXD.mjs +2 -0
- package/dist/{chunk-JPBAXYWN.mjs → chunk-6UCN2ZJF.mjs} +5 -5
- package/dist/{chunk-5WV27LHH.mjs → chunk-AL3FYYQK.mjs} +2 -2
- package/dist/chunk-K2FMSSHL.mjs +2 -0
- package/dist/chunk-NLAOQUYQ.mjs +2 -0
- package/dist/index.browser.d.mts +40 -2
- package/dist/index.browser.d.ts +40 -2
- package/dist/index.browser.js +2 -2
- package/dist/index.browser.mjs +1 -1
- package/dist/index.d.mts +40 -2
- package/dist/index.d.ts +40 -2
- package/dist/index.js +5 -5
- package/dist/index.mjs +1 -1
- package/dist/internal.browser.d.mts +1 -1
- package/dist/internal.browser.d.ts +1 -1
- package/dist/internal.browser.js +2 -2
- package/dist/internal.browser.mjs +1 -1
- package/dist/internal.d.mts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +5 -5
- package/dist/internal.mjs +1 -1
- package/dist/{stream-data-s7maju0w.d.mts → stream-data-C4gkxwoJ.d.mts} +29 -0
- package/dist/{stream-data-s7maju0w.d.ts → stream-data-C4gkxwoJ.d.ts} +29 -0
- package/dist/stream-data-DWvEgRbF.d.mts +1746 -0
- package/dist/stream-data-DWvEgRbF.d.ts +1746 -0
- package/package.json +12 -2
|
@@ -0,0 +1,1746 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
3
|
+
|
|
4
|
+
interface MediaChunkSource {
|
|
5
|
+
|
|
6
|
+
start(onChunk: (chunk: Uint8Array) => void, onEnd: () => void): void;
|
|
7
|
+
|
|
8
|
+
stop(): void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface MediaChunkBinding {
|
|
12
|
+
|
|
13
|
+
track(): MediaStreamTrack | null;
|
|
14
|
+
|
|
15
|
+
onTrack(cb: (track: MediaStreamTrack | null) => void): () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type MediaChunkSourceFactory = (binding: MediaChunkBinding) => MediaChunkSource;
|
|
19
|
+
|
|
20
|
+
type ChunkReadable = ReadableStream<Uint8Array> & AsyncIterable<Uint8Array>;
|
|
21
|
+
|
|
22
|
+
interface StreamChunkOptions {
|
|
23
|
+
|
|
24
|
+
source?: MediaChunkSourceFactory;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface MediaRecorderChunkSourceOptions {
|
|
28
|
+
|
|
29
|
+
mimeType?: string;
|
|
30
|
+
|
|
31
|
+
timesliceMs?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare function mediaRecorderChunkSource(binding: MediaChunkBinding, options?: MediaRecorderChunkSourceOptions): MediaChunkSource;
|
|
35
|
+
|
|
36
|
+
interface GenerationTick {
|
|
37
|
+
|
|
38
|
+
seconds: number;
|
|
39
|
+
|
|
40
|
+
estimatedCredits?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare const GENERATION_TICK_EMIT_INTERVAL_MS = 1000;
|
|
44
|
+
|
|
45
|
+
declare const GENERATION_TICK_MAX_EXTRAPOLATION_MS = 12000;
|
|
46
|
+
interface WatchGenerationTickOptions {
|
|
47
|
+
|
|
48
|
+
creditsPerSecond?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare function watchGenerationTick(control: Pick<SessionDocument, 'get' | 'on'>, handler: (tick: GenerationTick) => void, options?: WatchGenerationTickOptions): () => void;
|
|
52
|
+
|
|
53
|
+
declare const DOC_SYNC_WIRE_CONTRACT_VERSION = 1;
|
|
54
|
+
|
|
55
|
+
interface DocConnectionState {
|
|
56
|
+
|
|
57
|
+
connected: boolean;
|
|
58
|
+
|
|
59
|
+
consecutiveFailures: number;
|
|
60
|
+
|
|
61
|
+
lastCloseCode: number | null;
|
|
62
|
+
|
|
63
|
+
lastCloseReason: string | null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type DocTokenSupplier = () => string | undefined | Promise<string | undefined>;
|
|
67
|
+
|
|
68
|
+
type DocServerUrlResolver = () => string | undefined | Promise<string | undefined>;
|
|
69
|
+
|
|
70
|
+
interface DocConnection {
|
|
71
|
+
|
|
72
|
+
readonly awareness: Awareness;
|
|
73
|
+
|
|
74
|
+
readonly synced: boolean;
|
|
75
|
+
|
|
76
|
+
onSync(handler: (synced: boolean) => void): () => void;
|
|
77
|
+
|
|
78
|
+
ensureConnected?(): void;
|
|
79
|
+
|
|
80
|
+
onConnectionState?(handler: (state: DocConnectionState) => void): () => void;
|
|
81
|
+
|
|
82
|
+
disconnect?(): void;
|
|
83
|
+
|
|
84
|
+
destroy(): void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
type DocConnector = (docName: string, doc: Y.Doc, awareness: Awareness) => DocConnection;
|
|
88
|
+
|
|
89
|
+
declare function deriveYjsServerUrl(signalingWsUrl: string): string;
|
|
90
|
+
|
|
91
|
+
interface WebsocketDocConnectorOptions {
|
|
92
|
+
|
|
93
|
+
serverUrl: string;
|
|
94
|
+
|
|
95
|
+
sessionId: string;
|
|
96
|
+
|
|
97
|
+
token?: string | DocTokenSupplier;
|
|
98
|
+
|
|
99
|
+
WebSocketPolyfill?: typeof WebSocket;
|
|
100
|
+
|
|
101
|
+
maxBackoffTimeMs?: number;
|
|
102
|
+
|
|
103
|
+
dialTimeoutMs?: number;
|
|
104
|
+
|
|
105
|
+
resolveServerUrl?: DocServerUrlResolver;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare function createWebsocketDocConnector(opts: WebsocketDocConnectorOptions): DocConnector;
|
|
109
|
+
|
|
110
|
+
declare class DeferredDocConnector {
|
|
111
|
+
private _target;
|
|
112
|
+
|
|
113
|
+
private _bridges;
|
|
114
|
+
|
|
115
|
+
readonly connect: DocConnector;
|
|
116
|
+
|
|
117
|
+
get connected(): boolean;
|
|
118
|
+
|
|
119
|
+
setTarget(target: DocConnector): void;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
type PresenceState = Record<string, unknown>;
|
|
123
|
+
|
|
124
|
+
interface Presence {
|
|
125
|
+
|
|
126
|
+
readonly clientId: number;
|
|
127
|
+
|
|
128
|
+
set(state: PresenceState | null): void;
|
|
129
|
+
|
|
130
|
+
setField(field: string, value: unknown): void;
|
|
131
|
+
|
|
132
|
+
getLocal(): PresenceState | null;
|
|
133
|
+
|
|
134
|
+
getStates(): Map<number, PresenceState>;
|
|
135
|
+
|
|
136
|
+
on(event: 'change', handler: (states: Map<number, PresenceState>) => void): () => void;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
declare function createPresence(awareness: Awareness): Presence;
|
|
140
|
+
|
|
141
|
+
type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiating' | 'disconnected' | 'failed';
|
|
142
|
+
|
|
143
|
+
type SessionPhaseName = 'idle' | 'queued' | 'unavailable' | 'provisioning' | 'waiting_for_capacity' | 'connecting' | 'live' | 'paused' | 'error' | 'unknown';
|
|
144
|
+
|
|
145
|
+
interface RuntimeAvailability {
|
|
146
|
+
state: 'unavailable' | 'starting' | 'busy';
|
|
147
|
+
|
|
148
|
+
reason?: string;
|
|
149
|
+
|
|
150
|
+
wake?: RuntimeWakeDetail;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
type RuntimeWakeReasonCode = 'capture-attested' | 'no-portable-golden' | 'portable-golden-release-mismatch' | 'portable-golden-attestation-invalid';
|
|
154
|
+
|
|
155
|
+
interface RuntimeWakeGolden {
|
|
156
|
+
snapshotId: string;
|
|
157
|
+
snapshotCompatKey: string;
|
|
158
|
+
artifactSizeBytes: number;
|
|
159
|
+
durableArenaBytes: number;
|
|
160
|
+
volatileArenaBytes: 0;
|
|
161
|
+
uncoveredWeightBytes: number;
|
|
162
|
+
}
|
|
163
|
+
interface RuntimeWakeDetailBase {
|
|
164
|
+
schema: 'urun.runtime.wake.v1';
|
|
165
|
+
expectationBasis: 'snapshot-registry';
|
|
166
|
+
restoreObservation: 'not-observed';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
type RuntimeWakeDetail = (RuntimeWakeDetailBase & {
|
|
170
|
+
portability: 'portable';
|
|
171
|
+
expectedWakePath: 'portable-golden-restore';
|
|
172
|
+
reasonCode: 'capture-attested';
|
|
173
|
+
golden: RuntimeWakeGolden;
|
|
174
|
+
}) | (RuntimeWakeDetailBase & {
|
|
175
|
+
portability: 'none';
|
|
176
|
+
expectedWakePath: 'cold-boot';
|
|
177
|
+
reasonCode: Exclude<RuntimeWakeReasonCode, 'capture-attested'>;
|
|
178
|
+
|
|
179
|
+
golden?: never;
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
type SessionFailureKind = 'create-failed' | 'never-live' | 'transport-failed' | 'media-permission' | 'runtime-failed' | 'insufficient-credits' | 'produce-timeout';
|
|
183
|
+
|
|
184
|
+
interface SessionPhaseError {
|
|
185
|
+
|
|
186
|
+
reason: string;
|
|
187
|
+
|
|
188
|
+
code?: string;
|
|
189
|
+
|
|
190
|
+
kind?: SessionFailureKind;
|
|
191
|
+
|
|
192
|
+
httpStatus?: number;
|
|
193
|
+
|
|
194
|
+
retryAfterSeconds?: number;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
interface SessionDiagnostic {
|
|
198
|
+
|
|
199
|
+
level: 'debug' | 'info' | 'warning' | 'error';
|
|
200
|
+
|
|
201
|
+
kind: string;
|
|
202
|
+
|
|
203
|
+
message: string;
|
|
204
|
+
|
|
205
|
+
detail?: Record<string, unknown>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
type ActivationState = 'activating' | 'still-activating' | 'cold-boot' | 'degraded' | 'first-media';
|
|
209
|
+
|
|
210
|
+
interface ActivationEvent {
|
|
211
|
+
|
|
212
|
+
state: ActivationState;
|
|
213
|
+
|
|
214
|
+
elapsedMs: number;
|
|
215
|
+
|
|
216
|
+
hint?: string;
|
|
217
|
+
|
|
218
|
+
stream?: string;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface SessionPhase {
|
|
222
|
+
|
|
223
|
+
name: SessionPhaseName;
|
|
224
|
+
|
|
225
|
+
queue?: {
|
|
226
|
+
position: number;
|
|
227
|
+
depth: number;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
runtime?: RuntimeAvailability;
|
|
231
|
+
|
|
232
|
+
wakingSince?: number;
|
|
233
|
+
|
|
234
|
+
requestId?: string;
|
|
235
|
+
|
|
236
|
+
sessionId?: string;
|
|
237
|
+
|
|
238
|
+
endsAt?: Date;
|
|
239
|
+
|
|
240
|
+
error?: SessionPhaseError;
|
|
241
|
+
|
|
242
|
+
reason?: string;
|
|
243
|
+
|
|
244
|
+
region?: string | null;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
interface SessionStatus {
|
|
248
|
+
|
|
249
|
+
phase: SessionPhaseName;
|
|
250
|
+
|
|
251
|
+
transportState: TransportState;
|
|
252
|
+
|
|
253
|
+
sessionId?: string;
|
|
254
|
+
|
|
255
|
+
requestId?: string;
|
|
256
|
+
|
|
257
|
+
lastServerStatus?: string;
|
|
258
|
+
|
|
259
|
+
elapsedMs?: number;
|
|
260
|
+
|
|
261
|
+
queue?: {
|
|
262
|
+
position: number;
|
|
263
|
+
depth: number;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
runtime?: RuntimeAvailability;
|
|
267
|
+
|
|
268
|
+
endsAt?: Date;
|
|
269
|
+
|
|
270
|
+
wakingSince?: number;
|
|
271
|
+
|
|
272
|
+
error?: SessionPhaseError;
|
|
273
|
+
|
|
274
|
+
region?: string | null;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
interface TransportSessionOptions {
|
|
278
|
+
|
|
279
|
+
url: string;
|
|
280
|
+
|
|
281
|
+
fallbackUrls?: readonly string[];
|
|
282
|
+
|
|
283
|
+
orgId?: string;
|
|
284
|
+
|
|
285
|
+
jwt?: string;
|
|
286
|
+
|
|
287
|
+
authProvider?: string;
|
|
288
|
+
|
|
289
|
+
sessionId?: string;
|
|
290
|
+
|
|
291
|
+
iceServers?: RTCIceServer[];
|
|
292
|
+
|
|
293
|
+
mediaLiveness?: MediaLivenessOptions;
|
|
294
|
+
|
|
295
|
+
audioPlayout?: AudioPlayoutOptions;
|
|
296
|
+
|
|
297
|
+
videoPlayout?: VideoPlayoutOptions;
|
|
298
|
+
|
|
299
|
+
sessionStats?: SessionStatsOptions;
|
|
300
|
+
|
|
301
|
+
diagnosticSink?: (diagnostic: SessionDiagnostic) => void;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
interface AudioPlayoutOptions {
|
|
305
|
+
|
|
306
|
+
jitterBufferTargetMs?: number;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
interface VideoPlayoutOptions {
|
|
310
|
+
|
|
311
|
+
jitterBufferTargetMs?: number;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
interface SessionStatsOptions {
|
|
315
|
+
|
|
316
|
+
pollMs?: number;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
interface InboundStatsSample {
|
|
320
|
+
|
|
321
|
+
consumerId: string;
|
|
322
|
+
|
|
323
|
+
total: number;
|
|
324
|
+
framesDecoded: number | null;
|
|
325
|
+
|
|
326
|
+
jitter: number | null;
|
|
327
|
+
packetsReceived: number | null;
|
|
328
|
+
packetsLost: number | null;
|
|
329
|
+
nackCount: number | null;
|
|
330
|
+
pliCount: number | null;
|
|
331
|
+
firCount: number | null;
|
|
332
|
+
keyFramesDecoded: number | null;
|
|
333
|
+
framesReceived: number | null;
|
|
334
|
+
framesDropped: number | null;
|
|
335
|
+
retransmittedPacketsReceived: number | null;
|
|
336
|
+
retransmittedBytesReceived: number | null;
|
|
337
|
+
jitterBufferDelay: number | null;
|
|
338
|
+
jitterBufferEmittedCount: number | null;
|
|
339
|
+
|
|
340
|
+
estimatedPlayoutTimestamp: number | null;
|
|
341
|
+
jitterBufferTargetDelay: number | null;
|
|
342
|
+
jitterBufferMinimumDelay: number | null;
|
|
343
|
+
concealedSamples: number | null;
|
|
344
|
+
insertedSamplesForDeceleration: number | null;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
interface SessionStatsSample {
|
|
348
|
+
|
|
349
|
+
timestamp: number;
|
|
350
|
+
|
|
351
|
+
stream: string | null;
|
|
352
|
+
|
|
353
|
+
avSyncMs: number | null;
|
|
354
|
+
|
|
355
|
+
audio: InboundStatsSample | null;
|
|
356
|
+
|
|
357
|
+
video: InboundStatsSample | null;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
interface MediaLivenessOptions {
|
|
361
|
+
|
|
362
|
+
pollMs?: number;
|
|
363
|
+
|
|
364
|
+
stallTimeoutMs?: number;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
type ChannelName = 'scene_graph' | 'ui_components' | 'events' | 'agent_status' | 'control';
|
|
368
|
+
|
|
369
|
+
interface ChannelMessage {
|
|
370
|
+
|
|
371
|
+
channel: string;
|
|
372
|
+
|
|
373
|
+
type: string;
|
|
374
|
+
|
|
375
|
+
[key: string]: unknown;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
interface StoreOptions {
|
|
379
|
+
|
|
380
|
+
baseUrl: string;
|
|
381
|
+
|
|
382
|
+
orgId: string;
|
|
383
|
+
|
|
384
|
+
jwt?: string;
|
|
385
|
+
|
|
386
|
+
authProvider?: string;
|
|
387
|
+
|
|
388
|
+
apiKey?: string;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
interface Store {
|
|
392
|
+
|
|
393
|
+
get(key: string): Promise<unknown>;
|
|
394
|
+
|
|
395
|
+
has(key: string): Promise<boolean>;
|
|
396
|
+
|
|
397
|
+
on(name: string, handler: (data: unknown) => void): () => void;
|
|
398
|
+
|
|
399
|
+
emit(name: string, data: unknown): void;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
interface SessionText {
|
|
403
|
+
|
|
404
|
+
append(text: string): void;
|
|
405
|
+
|
|
406
|
+
toString(): string;
|
|
407
|
+
|
|
408
|
+
readonly length: number;
|
|
409
|
+
|
|
410
|
+
on(event: 'delta', handler: (inserted: string) => void): () => void;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
interface SessionDocument {
|
|
414
|
+
|
|
415
|
+
set(patch: Record<string, unknown>): void;
|
|
416
|
+
|
|
417
|
+
get(path?: string, defaultValue?: unknown): unknown;
|
|
418
|
+
|
|
419
|
+
on(event: 'change', handler: (snapshot: Record<string, unknown>) => void): () => void;
|
|
420
|
+
|
|
421
|
+
text(field: string): SessionText;
|
|
422
|
+
|
|
423
|
+
readonly synced: boolean;
|
|
424
|
+
|
|
425
|
+
onSynced(handler: () => void): () => void;
|
|
426
|
+
|
|
427
|
+
onConnectionState?(handler: (state: DocConnectionState) => void): () => void;
|
|
428
|
+
|
|
429
|
+
disconnect?(): void;
|
|
430
|
+
|
|
431
|
+
reconnect?(): void;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
interface SessionStream {
|
|
435
|
+
|
|
436
|
+
readonly track: MediaStreamTrack | null;
|
|
437
|
+
|
|
438
|
+
attach(track: MediaStreamTrack): Promise<void>;
|
|
439
|
+
|
|
440
|
+
attachVideo(track: MediaStreamTrack): Promise<void>;
|
|
441
|
+
|
|
442
|
+
detach(): Promise<void>;
|
|
443
|
+
|
|
444
|
+
detachVideo(): Promise<void>;
|
|
445
|
+
|
|
446
|
+
seek(target: number | 'live'): Promise<void>;
|
|
447
|
+
|
|
448
|
+
chunks(options?: StreamChunkOptions): ChunkReadable;
|
|
449
|
+
|
|
450
|
+
onSeeked(handler: (target: number | 'live') => void): () => void;
|
|
451
|
+
|
|
452
|
+
on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
|
|
453
|
+
|
|
454
|
+
messages(): AsyncIterable<unknown>;
|
|
455
|
+
|
|
456
|
+
emit(payload: unknown, options?: {
|
|
457
|
+
to?: string;
|
|
458
|
+
}): Promise<void>;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
interface RequestOptions {
|
|
462
|
+
|
|
463
|
+
timeout?: number;
|
|
464
|
+
|
|
465
|
+
signal?: AbortSignal;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
interface RequestStreamOptions {
|
|
469
|
+
|
|
470
|
+
signal?: AbortSignal;
|
|
471
|
+
|
|
472
|
+
docSyncTimeout?: number;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
type SessionEndResult = {
|
|
476
|
+
status: 'paused';
|
|
477
|
+
|
|
478
|
+
sessionId: string;
|
|
479
|
+
|
|
480
|
+
reason: string;
|
|
481
|
+
} | {
|
|
482
|
+
status: 'canceled';
|
|
483
|
+
requestId: string;
|
|
484
|
+
platformStatus?: string;
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
interface Session {
|
|
488
|
+
|
|
489
|
+
readonly id: string;
|
|
490
|
+
|
|
491
|
+
readonly phase: SessionPhase;
|
|
492
|
+
|
|
493
|
+
readonly endsAt: Date | null;
|
|
494
|
+
|
|
495
|
+
readonly status: SessionStatus;
|
|
496
|
+
|
|
497
|
+
readonly region?: string | null;
|
|
498
|
+
|
|
499
|
+
stream(name: string): SessionStream;
|
|
500
|
+
|
|
501
|
+
doc(key: string): SessionDocument;
|
|
502
|
+
|
|
503
|
+
readonly mediaTransport: 'webtransport' | 'webrtc' | null;
|
|
504
|
+
|
|
505
|
+
watchDownlinkStall(opts?: {
|
|
506
|
+
stallMs?: number;
|
|
507
|
+
}): () => void;
|
|
508
|
+
|
|
509
|
+
readonly presence: Presence;
|
|
510
|
+
|
|
511
|
+
touch(): void;
|
|
512
|
+
|
|
513
|
+
activity?(): void;
|
|
514
|
+
|
|
515
|
+
request(payload: unknown, options?: RequestOptions): Promise<unknown>;
|
|
516
|
+
|
|
517
|
+
requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
|
|
518
|
+
|
|
519
|
+
complete(payload: unknown, options?: RequestStreamOptions): Promise<unknown>;
|
|
520
|
+
|
|
521
|
+
onPhase(handler: (phase: SessionPhase) => void): () => void;
|
|
522
|
+
|
|
523
|
+
onDiagnostic(handler: (diagnostic: SessionDiagnostic) => void): () => void;
|
|
524
|
+
|
|
525
|
+
onActivation?(handler: (event: ActivationEvent) => void): () => void;
|
|
526
|
+
|
|
527
|
+
onStats?(handler: (sample: SessionStatsSample) => void): () => void;
|
|
528
|
+
|
|
529
|
+
on(event: 'generationTick', handler: (tick: GenerationTick) => void): () => void;
|
|
530
|
+
|
|
531
|
+
whenLive(options?: {
|
|
532
|
+
timeout?: number;
|
|
533
|
+
signal?: AbortSignal;
|
|
534
|
+
}): Promise<void>;
|
|
535
|
+
|
|
536
|
+
readonly recordings: RecordingsAccessor;
|
|
537
|
+
|
|
538
|
+
readonly artifacts: RuntimeArtifactsAccessor;
|
|
539
|
+
|
|
540
|
+
recover(): void;
|
|
541
|
+
|
|
542
|
+
onRecovery(hook: () => void): () => void;
|
|
543
|
+
|
|
544
|
+
end(): Promise<SessionEndResult>;
|
|
545
|
+
|
|
546
|
+
cancel(): Promise<SessionEndResult>;
|
|
547
|
+
|
|
548
|
+
detach(): void;
|
|
549
|
+
|
|
550
|
+
disconnect(): void;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
type RecordingBucket = 'temp' | 'pinned';
|
|
554
|
+
|
|
555
|
+
type RecordingLifecycle = 'temp' | 'pinned' | 'permanent';
|
|
556
|
+
|
|
557
|
+
type RecordingStatus = 'active' | 'deleting' | 'deleted' | 'pending_pin' | 'pending_unpin' | 'pending_permanent' | 'pending_delete';
|
|
558
|
+
|
|
559
|
+
interface Recording {
|
|
560
|
+
|
|
561
|
+
id: string;
|
|
562
|
+
|
|
563
|
+
org_id: string;
|
|
564
|
+
|
|
565
|
+
session_id: string;
|
|
566
|
+
|
|
567
|
+
stream_name: string;
|
|
568
|
+
|
|
569
|
+
bucket: RecordingBucket;
|
|
570
|
+
|
|
571
|
+
s3_key: string;
|
|
572
|
+
|
|
573
|
+
init_key: string;
|
|
574
|
+
|
|
575
|
+
manifest_key: string;
|
|
576
|
+
|
|
577
|
+
expires_at: string | null;
|
|
578
|
+
|
|
579
|
+
lifecycle: RecordingLifecycle;
|
|
580
|
+
|
|
581
|
+
retention: string | null;
|
|
582
|
+
|
|
583
|
+
size_bytes: number | null;
|
|
584
|
+
|
|
585
|
+
duration_s: number | null;
|
|
586
|
+
|
|
587
|
+
status: RecordingStatus;
|
|
588
|
+
|
|
589
|
+
created_at: string;
|
|
590
|
+
|
|
591
|
+
updated_at: string;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
declare function isPendingRecording(recording: Pick<Recording, 'status'>): boolean;
|
|
595
|
+
|
|
596
|
+
interface RecordingsAccessor {
|
|
597
|
+
|
|
598
|
+
list(sessionId?: string): Promise<Recording[]>;
|
|
599
|
+
|
|
600
|
+
get(id: string): Promise<Recording>;
|
|
601
|
+
|
|
602
|
+
retain(id: string, duration: string): Promise<Recording>;
|
|
603
|
+
|
|
604
|
+
pin(id: string): Promise<Recording>;
|
|
605
|
+
|
|
606
|
+
unpin(id: string): Promise<Recording>;
|
|
607
|
+
|
|
608
|
+
permanent(id: string): Promise<Recording>;
|
|
609
|
+
|
|
610
|
+
delete(id: string): Promise<Recording>;
|
|
611
|
+
}
|
|
612
|
+
interface RuntimeArtifact {
|
|
613
|
+
artifactId: string;
|
|
614
|
+
kind: string;
|
|
615
|
+
filename: string;
|
|
616
|
+
contentType: string;
|
|
617
|
+
sizeBytes: number;
|
|
618
|
+
sha256: string;
|
|
619
|
+
status: string;
|
|
620
|
+
createdAt?: string;
|
|
621
|
+
expiresAt?: string;
|
|
622
|
+
}
|
|
623
|
+
interface RuntimeArtifactDownload {
|
|
624
|
+
artifact: RuntimeArtifact;
|
|
625
|
+
downloadUrl: string;
|
|
626
|
+
}
|
|
627
|
+
interface RuntimeArtifactsAccessor {
|
|
628
|
+
|
|
629
|
+
list(sessionId?: string): Promise<RuntimeArtifact[]>;
|
|
630
|
+
|
|
631
|
+
getDownloadUrl(artifactId: string, sessionId?: string): Promise<RuntimeArtifactDownload>;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
interface AppOptions {
|
|
635
|
+
|
|
636
|
+
baseUrl: string;
|
|
637
|
+
|
|
638
|
+
fallbackUrls?: readonly string[];
|
|
639
|
+
|
|
640
|
+
orgId: string;
|
|
641
|
+
|
|
642
|
+
jwt?: string;
|
|
643
|
+
|
|
644
|
+
getAccessToken?: (options?: AccessTokenOptions$1) => string | null | undefined | Promise<string | null | undefined>;
|
|
645
|
+
|
|
646
|
+
authProvider?: string;
|
|
647
|
+
|
|
648
|
+
diagnosticSink?: (diagnostic: SessionDiagnostic) => void;
|
|
649
|
+
|
|
650
|
+
functionsUrl?: string;
|
|
651
|
+
|
|
652
|
+
allowWebTransport?: boolean;
|
|
653
|
+
|
|
654
|
+
allowWebRtcFallback?: boolean;
|
|
655
|
+
|
|
656
|
+
releaseOnLeave?: boolean;
|
|
657
|
+
|
|
658
|
+
sessionKey?: string;
|
|
659
|
+
|
|
660
|
+
priority?: 'preempt';
|
|
661
|
+
|
|
662
|
+
audioPlayout?: AudioPlayoutOptions;
|
|
663
|
+
|
|
664
|
+
videoPlayout?: VideoPlayoutOptions;
|
|
665
|
+
|
|
666
|
+
sessionStats?: SessionStatsOptions;
|
|
667
|
+
}
|
|
668
|
+
interface AccessTokenOptions$1 {
|
|
669
|
+
forceRefresh?: boolean;
|
|
670
|
+
reason?: 'initial' | 'unauthorized' | 'background';
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
interface AttachOptions {
|
|
674
|
+
|
|
675
|
+
baseUrl: string;
|
|
676
|
+
|
|
677
|
+
fallbackUrls?: readonly string[];
|
|
678
|
+
|
|
679
|
+
orgId: string;
|
|
680
|
+
|
|
681
|
+
jwt?: string;
|
|
682
|
+
|
|
683
|
+
getAccessToken?: (options?: AccessTokenOptions$1) => string | null | undefined | Promise<string | null | undefined>;
|
|
684
|
+
|
|
685
|
+
authProvider?: string;
|
|
686
|
+
|
|
687
|
+
functionsUrl?: string;
|
|
688
|
+
|
|
689
|
+
activity?: ActivitySignalMode;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
type ActivitySignalMode = 'auto' | 'explicit';
|
|
693
|
+
|
|
694
|
+
interface StartSessionOptions {
|
|
695
|
+
|
|
696
|
+
sessionId?: string;
|
|
697
|
+
|
|
698
|
+
label?: string;
|
|
699
|
+
|
|
700
|
+
sharedApp?: boolean;
|
|
701
|
+
|
|
702
|
+
activity?: ActivitySignalMode;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
interface App {
|
|
706
|
+
[fnName: string]: (args?: Record<string, unknown>, options?: StartSessionOptions) => Session;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
type SessionGatewayStatus = 'allocated' | 'pending' | 'queued' | 'rejected' | 'failed' | 'canceled'
|
|
710
|
+
|
|
711
|
+
| 'paused'
|
|
712
|
+
|
|
713
|
+
| 'redirect'
|
|
714
|
+
|
|
715
|
+
| 'waiting_for_capacity'
|
|
716
|
+
|
|
717
|
+
| (string & {});
|
|
718
|
+
interface SessionGatewayResponse {
|
|
719
|
+
status?: SessionGatewayStatus;
|
|
720
|
+
|
|
721
|
+
location?: string;
|
|
722
|
+
|
|
723
|
+
session_api_base?: string;
|
|
724
|
+
|
|
725
|
+
serving_region?: string | null;
|
|
726
|
+
request_id?: string;
|
|
727
|
+
session_id?: string;
|
|
728
|
+
ws_url?: string;
|
|
729
|
+
|
|
730
|
+
ice_servers?: RTCIceServer[];
|
|
731
|
+
queued?: boolean;
|
|
732
|
+
retry_after_seconds?: number;
|
|
733
|
+
queue_position?: number;
|
|
734
|
+
queue_depth?: number;
|
|
735
|
+
|
|
736
|
+
runtime_state?: string;
|
|
737
|
+
|
|
738
|
+
runtime_reason?: string;
|
|
739
|
+
|
|
740
|
+
reason?: string;
|
|
741
|
+
|
|
742
|
+
decision_reason?: string;
|
|
743
|
+
|
|
744
|
+
provisioning_refusal_source?: string;
|
|
745
|
+
|
|
746
|
+
provisioning_refusal_message?: string;
|
|
747
|
+
|
|
748
|
+
runtime_wake?: unknown;
|
|
749
|
+
|
|
750
|
+
ends_at?: string;
|
|
751
|
+
error_code?: string;
|
|
752
|
+
error_message?: string;
|
|
753
|
+
|
|
754
|
+
message?: string;
|
|
755
|
+
error?: string;
|
|
756
|
+
|
|
757
|
+
balance_credits?: number;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
interface AdmissionUpdate {
|
|
761
|
+
|
|
762
|
+
status: string;
|
|
763
|
+
|
|
764
|
+
requestId?: string;
|
|
765
|
+
|
|
766
|
+
sessionId?: string;
|
|
767
|
+
|
|
768
|
+
queue?: {
|
|
769
|
+
position: number;
|
|
770
|
+
depth: number;
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
runtime?: RuntimeAvailability;
|
|
774
|
+
|
|
775
|
+
reason?: string;
|
|
776
|
+
|
|
777
|
+
decisionReason?: string;
|
|
778
|
+
|
|
779
|
+
refusalSource?: string;
|
|
780
|
+
|
|
781
|
+
refusalMessage?: string;
|
|
782
|
+
|
|
783
|
+
region?: string | null;
|
|
784
|
+
}
|
|
785
|
+
interface AllocateSessionOptions {
|
|
786
|
+
baseUrl: string;
|
|
787
|
+
fallbackUrls?: readonly string[];
|
|
788
|
+
app: string;
|
|
789
|
+
functionName: string;
|
|
790
|
+
orgId: string;
|
|
791
|
+
jwt?: string;
|
|
792
|
+
getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
|
|
793
|
+
authProvider?: string;
|
|
794
|
+
idempotencyKey: string;
|
|
795
|
+
|
|
796
|
+
onAdmission?: (update: AdmissionUpdate) => void;
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
onRequest?: (handle: {
|
|
800
|
+
requestId: string;
|
|
801
|
+
baseUrl: string;
|
|
802
|
+
sessionId?: string;
|
|
803
|
+
}) => void;
|
|
804
|
+
|
|
805
|
+
sessionKey?: string;
|
|
806
|
+
|
|
807
|
+
label?: string;
|
|
808
|
+
|
|
809
|
+
priority?: 'preempt';
|
|
810
|
+
|
|
811
|
+
sharedApp?: boolean;
|
|
812
|
+
}
|
|
813
|
+
interface AccessTokenOptions {
|
|
814
|
+
forceRefresh?: boolean;
|
|
815
|
+
reason?: 'initial' | 'unauthorized' | 'background';
|
|
816
|
+
}
|
|
817
|
+
interface AllocatedSession {
|
|
818
|
+
baseUrl: string;
|
|
819
|
+
sessionId: string;
|
|
820
|
+
wsUrl: string;
|
|
821
|
+
|
|
822
|
+
endsAt: Date | null;
|
|
823
|
+
response: SessionGatewayResponse;
|
|
824
|
+
}
|
|
825
|
+
interface ReleaseSessionBeaconOptions {
|
|
826
|
+
baseUrl: string;
|
|
827
|
+
requestId: string;
|
|
828
|
+
|
|
829
|
+
sessionId?: string;
|
|
830
|
+
orgId: string;
|
|
831
|
+
|
|
832
|
+
jwt?: string;
|
|
833
|
+
authProvider?: string;
|
|
834
|
+
|
|
835
|
+
reason?: string;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
declare function releaseSessionBeacon(options: ReleaseSessionBeaconOptions): void;
|
|
839
|
+
declare function allocateSession(options: AllocateSessionOptions): Promise<AllocatedSession>;
|
|
840
|
+
|
|
841
|
+
interface SessionDirectoryRequestOptions {
|
|
842
|
+
baseUrl: string;
|
|
843
|
+
fallbackUrls?: readonly string[];
|
|
844
|
+
orgId: string;
|
|
845
|
+
jwt?: string;
|
|
846
|
+
getAccessToken?: AllocateSessionOptions['getAccessToken'];
|
|
847
|
+
authProvider?: string;
|
|
848
|
+
}
|
|
849
|
+
interface PrewakeOptions {
|
|
850
|
+
baseUrl: string;
|
|
851
|
+
|
|
852
|
+
app: string;
|
|
853
|
+
|
|
854
|
+
functionName: string;
|
|
855
|
+
orgId: string;
|
|
856
|
+
jwt?: string;
|
|
857
|
+
getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
|
|
858
|
+
authProvider?: string;
|
|
859
|
+
}
|
|
860
|
+
type PrewakeStatus = 'warming' | 'prebound' | 'unknown-app' | 'unavailable';
|
|
861
|
+
interface PrewakeResult {
|
|
862
|
+
|
|
863
|
+
status: PrewakeStatus;
|
|
864
|
+
|
|
865
|
+
expiresAt?: string;
|
|
866
|
+
|
|
867
|
+
warmCapable?: boolean;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
declare function prewake(options: PrewakeOptions): Promise<PrewakeResult>;
|
|
871
|
+
|
|
872
|
+
interface ChannelEndpoint {
|
|
873
|
+
on(channel: string, handler: (data: ChannelMessage) => void): () => void;
|
|
874
|
+
emit(channel: string, data: Record<string, unknown>): void;
|
|
875
|
+
}
|
|
876
|
+
declare class ChannelMultiplexer implements ChannelEndpoint {
|
|
877
|
+
private _handlers;
|
|
878
|
+
private _ws;
|
|
879
|
+
private _onMessage;
|
|
880
|
+
private _onOpen;
|
|
881
|
+
private _listeningForOpen;
|
|
882
|
+
private _pendingSends;
|
|
883
|
+
private _disposed;
|
|
884
|
+
constructor(ws: WebSocket);
|
|
885
|
+
|
|
886
|
+
on(channel: string, handler: (data: ChannelMessage) => void): () => void;
|
|
887
|
+
|
|
888
|
+
emit(channel: string, data: Record<string, unknown>): void;
|
|
889
|
+
|
|
890
|
+
dispose(): void;
|
|
891
|
+
private flushPendingSends;
|
|
892
|
+
private listenForOpen;
|
|
893
|
+
}
|
|
894
|
+
declare class DeferredChannelMultiplexer implements ChannelEndpoint {
|
|
895
|
+
private _handlers;
|
|
896
|
+
private _pendingSends;
|
|
897
|
+
private _target;
|
|
898
|
+
private _targetUnsubscribes;
|
|
899
|
+
private _disposed;
|
|
900
|
+
setTarget(target: ChannelEndpoint): void;
|
|
901
|
+
rewriteSessionChannels(oldSessionId: string, newSessionId: string): void;
|
|
902
|
+
on(channel: string, handler: (data: ChannelMessage) => void): () => void;
|
|
903
|
+
emit(channel: string, data: Record<string, unknown>): void;
|
|
904
|
+
dispose(): void;
|
|
905
|
+
private detachTarget;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
type WtMicSource = MediaStreamTrack | AudioNode;
|
|
909
|
+
|
|
910
|
+
interface WtMicUplinkHandle {
|
|
911
|
+
setSource(source: WtMicSource | null): void;
|
|
912
|
+
|
|
913
|
+
deliveredDatagrams(): number;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
interface WtAudioUplinkSeam {
|
|
917
|
+
onUplink(handle: WtMicUplinkHandle): void;
|
|
918
|
+
onUplinkLost(reason: string): void;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
interface WtCamUplinkHandle {
|
|
922
|
+
setSource(track: MediaStreamTrack | null): void;
|
|
923
|
+
|
|
924
|
+
requestKeyframe(): void;
|
|
925
|
+
|
|
926
|
+
deliveredDatagrams(): number;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
interface WtVideoUplinkSeam {
|
|
930
|
+
onUplink(handle: WtCamUplinkHandle): void;
|
|
931
|
+
onUplinkLost(reason: string): void;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
declare const WT_DATA_STREAM_VERSION = 1;
|
|
935
|
+
|
|
936
|
+
interface WtDataEnvelope {
|
|
937
|
+
name: string;
|
|
938
|
+
payload: unknown;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
interface WtDataLaneSink {
|
|
942
|
+
onData(name: string, payload: unknown): void;
|
|
943
|
+
onLaneError(err: Error): void;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
interface QuicStreamDataTransport {
|
|
947
|
+
|
|
948
|
+
markStreamDataLaneQuic(): void;
|
|
949
|
+
|
|
950
|
+
dispatchQuicStreamData(name: string, payload: unknown): void;
|
|
951
|
+
|
|
952
|
+
quicStreamDataLaneLost(reason: string): void;
|
|
953
|
+
|
|
954
|
+
raiseQuicStreamDataError(err: Error): void;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
declare class WtDataStreamParser {
|
|
958
|
+
private buf;
|
|
959
|
+
private name;
|
|
960
|
+
private ended;
|
|
961
|
+
|
|
962
|
+
get streamName(): string | null;
|
|
963
|
+
push(chunk: Uint8Array): WtDataEnvelope[];
|
|
964
|
+
|
|
965
|
+
finish(): void;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
interface WtByteReader {
|
|
969
|
+
read(): Promise<{
|
|
970
|
+
value?: Uint8Array;
|
|
971
|
+
done: boolean;
|
|
972
|
+
}>;
|
|
973
|
+
cancel?(reason?: unknown): Promise<void>;
|
|
974
|
+
}
|
|
975
|
+
interface WtIncomingUniStream {
|
|
976
|
+
getReader(): WtByteReader;
|
|
977
|
+
}
|
|
978
|
+
interface WtIncomingUniStreams {
|
|
979
|
+
getReader(): {
|
|
980
|
+
read(): Promise<{
|
|
981
|
+
value?: WtIncomingUniStream;
|
|
982
|
+
done: boolean;
|
|
983
|
+
}>;
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
declare function consumeWtDataStreams(incoming: WtIncomingUniStreams, sink: WtDataLaneSink): Promise<void>;
|
|
988
|
+
|
|
989
|
+
interface PathLiveness {
|
|
990
|
+
|
|
991
|
+
alive: boolean;
|
|
992
|
+
|
|
993
|
+
evidence: string;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
interface PathHealthReporting {
|
|
997
|
+
|
|
998
|
+
pathLiveness(): PathLiveness;
|
|
999
|
+
|
|
1000
|
+
fail(reason: string): void;
|
|
1001
|
+
}
|
|
1002
|
+
interface MediaSession {
|
|
1003
|
+
readonly kind: 'webtransport' | 'webrtc';
|
|
1004
|
+
start(): Promise<void>;
|
|
1005
|
+
stop(): Promise<void>;
|
|
1006
|
+
|
|
1007
|
+
onDead(cb: (reason: string) => void): void;
|
|
1008
|
+
|
|
1009
|
+
stats(): {
|
|
1010
|
+
recvBps: number;
|
|
1011
|
+
lossPct: number;
|
|
1012
|
+
jitterMs: number;
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
readonly firstMedia: Promise<void>;
|
|
1016
|
+
|
|
1017
|
+
consumeDataStreams?(sink: WtDataLaneSink): void;
|
|
1018
|
+
|
|
1019
|
+
watchDownlinkStall?(opts: {
|
|
1020
|
+
stallMs?: number;
|
|
1021
|
+
}): void;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
interface Signaling {
|
|
1025
|
+
request<T = unknown>(method: string, params?: unknown): Promise<T>;
|
|
1026
|
+
notify(method: string, params?: unknown): void;
|
|
1027
|
+
|
|
1028
|
+
on(method: string, handler: (params: Record<string, unknown>) => void): () => void;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
interface SignalCarrier {
|
|
1032
|
+
|
|
1033
|
+
sendSignal(msg: Record<string, unknown>): boolean;
|
|
1034
|
+
|
|
1035
|
+
onSignal(handler: (msg: Record<string, unknown>) => void): () => void;
|
|
1036
|
+
|
|
1037
|
+
emitDiagnostic(diagnostic: SessionDiagnostic): void;
|
|
1038
|
+
}
|
|
1039
|
+
declare class TransportSessionSignaling implements Signaling {
|
|
1040
|
+
private carrier;
|
|
1041
|
+
private requestTimeoutMs;
|
|
1042
|
+
constructor(carrier: SignalCarrier, requestTimeoutMs?: number);
|
|
1043
|
+
request<T = unknown>(method: string, params?: unknown): Promise<T>;
|
|
1044
|
+
notify(method: string, params?: unknown): void;
|
|
1045
|
+
on(method: string, handler: (params: Record<string, unknown>) => void): () => void;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
interface TransportOfferRequest {
|
|
1049
|
+
sessionId: string;
|
|
1050
|
+
capabilities: {
|
|
1051
|
+
|
|
1052
|
+
webtransport: boolean;
|
|
1053
|
+
|
|
1054
|
+
webcodecs: boolean;
|
|
1055
|
+
|
|
1056
|
+
codecs: string[];
|
|
1057
|
+
|
|
1058
|
+
wtData?: boolean;
|
|
1059
|
+
|
|
1060
|
+
wtAudio?: boolean;
|
|
1061
|
+
|
|
1062
|
+
wtAudioUp?: boolean;
|
|
1063
|
+
|
|
1064
|
+
wtVideoUp?: boolean;
|
|
1065
|
+
|
|
1066
|
+
wtDataUp?: boolean;
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
interface TransportOfferResponse {
|
|
1070
|
+
|
|
1071
|
+
webrtc: {
|
|
1072
|
+
routerRtpCapabilities: unknown;
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
webtransport?: {
|
|
1076
|
+
url: string;
|
|
1077
|
+
|
|
1078
|
+
certHashes: string[];
|
|
1079
|
+
|
|
1080
|
+
token: string;
|
|
1081
|
+
|
|
1082
|
+
codec?: string;
|
|
1083
|
+
|
|
1084
|
+
data?: boolean;
|
|
1085
|
+
|
|
1086
|
+
audio?: {
|
|
1087
|
+
codec: string;
|
|
1088
|
+
sampleRate: number;
|
|
1089
|
+
channels: number;
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
audioUp?: boolean;
|
|
1093
|
+
|
|
1094
|
+
videoUp?: boolean;
|
|
1095
|
+
|
|
1096
|
+
dataUp?: boolean;
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
interface TransportEstablishedNotify {
|
|
1100
|
+
sessionId: string;
|
|
1101
|
+
transport: 'webtransport' | 'webrtc';
|
|
1102
|
+
|
|
1103
|
+
fallbackReason?: string;
|
|
1104
|
+
}
|
|
1105
|
+
type WtControlMessage = {
|
|
1106
|
+
t: 'hello';
|
|
1107
|
+
token: string;
|
|
1108
|
+
sessionId: string;
|
|
1109
|
+
} | {
|
|
1110
|
+
t: 'hello-ack';
|
|
1111
|
+
codec: string;
|
|
1112
|
+
width: number;
|
|
1113
|
+
height: number;
|
|
1114
|
+
} | {
|
|
1115
|
+
t: 'ping';
|
|
1116
|
+
ts: number;
|
|
1117
|
+
} | {
|
|
1118
|
+
t: 'pong';
|
|
1119
|
+
ts: number;
|
|
1120
|
+
} | {
|
|
1121
|
+
t: 'keyframe-request';
|
|
1122
|
+
} | {
|
|
1123
|
+
t: 'feedback';
|
|
1124
|
+
recvBps: number;
|
|
1125
|
+
lossPct: number;
|
|
1126
|
+
jitterMs: number;
|
|
1127
|
+
};
|
|
1128
|
+
|
|
1129
|
+
declare const WT_CONTROL_FRAME_MAX: number;
|
|
1130
|
+
|
|
1131
|
+
declare function encodeWtControlFrame(msg: WtControlMessage): Uint8Array;
|
|
1132
|
+
|
|
1133
|
+
declare class WtControlDecoder {
|
|
1134
|
+
private buf;
|
|
1135
|
+
push(bytes: Uint8Array): WtControlMessage[];
|
|
1136
|
+
}
|
|
1137
|
+
declare const DGRAM_HEADER_BYTES = 12;
|
|
1138
|
+
interface DgramHeader {
|
|
1139
|
+
groupId: number;
|
|
1140
|
+
frameSeq: number;
|
|
1141
|
+
keyframe: boolean;
|
|
1142
|
+
fragIndex: number;
|
|
1143
|
+
fragCount: number;
|
|
1144
|
+
|
|
1145
|
+
lane: number;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
declare function parseDgramHeader(view: DataView): DgramHeader;
|
|
1149
|
+
|
|
1150
|
+
declare function writeDgramHeader(h: Omit<DgramHeader, 'lane'> & {
|
|
1151
|
+
lane?: number;
|
|
1152
|
+
}): Uint8Array;
|
|
1153
|
+
|
|
1154
|
+
interface WtAudioLaneSeam {
|
|
1155
|
+
|
|
1156
|
+
jitterBufferTargetMs?: number;
|
|
1157
|
+
|
|
1158
|
+
onTrack: (track: MediaStreamTrack | null) => void;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
interface WtDataUplinkTransport {
|
|
1162
|
+
openUniStream(): Promise<{
|
|
1163
|
+
write(chunk: Uint8Array): Promise<void>;
|
|
1164
|
+
close(): Promise<void>;
|
|
1165
|
+
}>;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
declare class WtDataUplinkSender {
|
|
1169
|
+
private transport;
|
|
1170
|
+
private streams;
|
|
1171
|
+
private dead;
|
|
1172
|
+
private deadCb;
|
|
1173
|
+
|
|
1174
|
+
private chain;
|
|
1175
|
+
constructor(transport: WtDataUplinkTransport);
|
|
1176
|
+
onDead(cb: (reason: string) => void): void;
|
|
1177
|
+
|
|
1178
|
+
send(name: string, envelope: Uint8Array): Promise<void>;
|
|
1179
|
+
stop(reason?: string): void;
|
|
1180
|
+
private die;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
interface WtDataUplinkSeam {
|
|
1184
|
+
onUplink(sender: WtDataUplinkSender): void;
|
|
1185
|
+
onUplinkLost(reason: string): void;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
interface NegotiatorDataLaneSeam {
|
|
1189
|
+
|
|
1190
|
+
onData(name: string, payload: unknown): void;
|
|
1191
|
+
|
|
1192
|
+
onQuicLane(): void;
|
|
1193
|
+
|
|
1194
|
+
onQuicLaneLost(reason: string): void;
|
|
1195
|
+
|
|
1196
|
+
onLaneError(err: Error): void;
|
|
1197
|
+
}
|
|
1198
|
+
interface NegotiatorOptions {
|
|
1199
|
+
|
|
1200
|
+
quicDeadlineMs?: number;
|
|
1201
|
+
|
|
1202
|
+
allowWebTransport?: boolean;
|
|
1203
|
+
onTransportChange?: (kind: MediaSession['kind'], reason?: string) => void;
|
|
1204
|
+
|
|
1205
|
+
canvas?: HTMLCanvasElement;
|
|
1206
|
+
|
|
1207
|
+
createWebRtcSession: () => MediaSession;
|
|
1208
|
+
createWebTransportSession?: (offer: NonNullable<TransportOfferResponse['webtransport']>) => MediaSession;
|
|
1209
|
+
|
|
1210
|
+
dataLane?: NegotiatorDataLaneSeam;
|
|
1211
|
+
|
|
1212
|
+
audioLane?: WtAudioLaneSeam;
|
|
1213
|
+
|
|
1214
|
+
audioUplink?: WtAudioUplinkSeam;
|
|
1215
|
+
|
|
1216
|
+
videoUplink?: WtVideoUplinkSeam;
|
|
1217
|
+
|
|
1218
|
+
dataUplink?: WtDataUplinkSeam;
|
|
1219
|
+
|
|
1220
|
+
webRtcDial?: {
|
|
1221
|
+
proceed(reason: string): void;
|
|
1222
|
+
skip(reason: string): void;
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
allowWebRtcFallback?: boolean;
|
|
1226
|
+
|
|
1227
|
+
onWtRequiredOutage?: (reason: string) => void;
|
|
1228
|
+
|
|
1229
|
+
webRtcFailoverDeadlineMs?: number;
|
|
1230
|
+
|
|
1231
|
+
onMediaTransportLost?: (reason: string) => void;
|
|
1232
|
+
}
|
|
1233
|
+
declare class TransportNegotiator {
|
|
1234
|
+
private signaling;
|
|
1235
|
+
private sessionId;
|
|
1236
|
+
private opts;
|
|
1237
|
+
private session;
|
|
1238
|
+
private offer;
|
|
1239
|
+
|
|
1240
|
+
private quicDataLane;
|
|
1241
|
+
|
|
1242
|
+
private wtOnlyLeg;
|
|
1243
|
+
|
|
1244
|
+
private webRtcDialProceeded;
|
|
1245
|
+
static readonly WT_REDIAL_BASE_MS = 2000;
|
|
1246
|
+
static readonly WT_REDIAL_MAX = 3;
|
|
1247
|
+
static readonly WT_REDIAL_CAP_MS = 30000;
|
|
1248
|
+
|
|
1249
|
+
private wtRedialFailures;
|
|
1250
|
+
private wtRedialTimer;
|
|
1251
|
+
|
|
1252
|
+
private disconnected;
|
|
1253
|
+
|
|
1254
|
+
private downlinkStallWatch;
|
|
1255
|
+
|
|
1256
|
+
watchDownlinkStall(opts?: {
|
|
1257
|
+
stallMs?: number;
|
|
1258
|
+
}): void;
|
|
1259
|
+
private applyStallWatch;
|
|
1260
|
+
constructor(signaling: Signaling, sessionId: string, opts: NegotiatorOptions);
|
|
1261
|
+
get activeTransport(): MediaSession['kind'] | null;
|
|
1262
|
+
|
|
1263
|
+
get isWtOnlyLeg(): boolean;
|
|
1264
|
+
connect(): Promise<MediaSession>;
|
|
1265
|
+
disconnect(): Promise<void>;
|
|
1266
|
+
|
|
1267
|
+
retryWebTransport(): Promise<MediaSession | null>;
|
|
1268
|
+
|
|
1269
|
+
private engageQuicDataLane;
|
|
1270
|
+
private createWebTransportSession;
|
|
1271
|
+
|
|
1272
|
+
private createWebRtc;
|
|
1273
|
+
|
|
1274
|
+
private startWebRtcOn;
|
|
1275
|
+
private startWebRtc;
|
|
1276
|
+
|
|
1277
|
+
private skipWebRtcDial;
|
|
1278
|
+
|
|
1279
|
+
private proceedWebRtcDial;
|
|
1280
|
+
|
|
1281
|
+
private armFailover;
|
|
1282
|
+
|
|
1283
|
+
private redialWtAfterDeath;
|
|
1284
|
+
|
|
1285
|
+
private attemptWtRedial;
|
|
1286
|
+
|
|
1287
|
+
private lateWebRtcFailover;
|
|
1288
|
+
private notifyEstablished;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
interface TransportConnection {
|
|
1292
|
+
url: string;
|
|
1293
|
+
sessionId: string;
|
|
1294
|
+
jwt?: string;
|
|
1295
|
+
|
|
1296
|
+
iceServers?: RTCIceServer[];
|
|
1297
|
+
|
|
1298
|
+
endsAt?: Date | null;
|
|
1299
|
+
}
|
|
1300
|
+
declare function streamDataLabel(name: string): string;
|
|
1301
|
+
|
|
1302
|
+
declare const DERIVED_LEG_SEP = "--";
|
|
1303
|
+
declare const DERIVED_LEG_ROLES: readonly ["video", "audio"];
|
|
1304
|
+
type DerivedLegRole = (typeof DERIVED_LEG_ROLES)[number];
|
|
1305
|
+
|
|
1306
|
+
declare function derivedLegRole(name: string): DerivedLegRole | undefined;
|
|
1307
|
+
|
|
1308
|
+
declare function derivedLegName(parent: string, role: DerivedLegRole): string;
|
|
1309
|
+
interface TransportEvents {
|
|
1310
|
+
connected: () => void;
|
|
1311
|
+
disconnected: () => void;
|
|
1312
|
+
track: (track: MediaStreamTrack) => void;
|
|
1313
|
+
error: (error: Error) => void;
|
|
1314
|
+
started: () => void;
|
|
1315
|
+
audioTransportReady: () => void;
|
|
1316
|
+
|
|
1317
|
+
stateChange: (state: TransportState) => void;
|
|
1318
|
+
|
|
1319
|
+
phase: (phase: SessionPhase) => void;
|
|
1320
|
+
|
|
1321
|
+
diagnostic: (diagnostic: SessionDiagnostic) => void;
|
|
1322
|
+
|
|
1323
|
+
stats: (sample: SessionStatsSample) => void;
|
|
1324
|
+
|
|
1325
|
+
seeked: (stream: string, target: number | 'live') => void;
|
|
1326
|
+
|
|
1327
|
+
signal: (msg: Record<string, unknown>) => void;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
declare const SIGNALING_PROTOCOL_VERSION = "v1";
|
|
1331
|
+
interface SessionStartOptions {
|
|
1332
|
+
app?: string;
|
|
1333
|
+
functionName?: string;
|
|
1334
|
+
prompt?: string;
|
|
1335
|
+
cameraControl?: Record<string, unknown>;
|
|
1336
|
+
args?: Record<string, unknown>;
|
|
1337
|
+
video?: {
|
|
1338
|
+
width?: number;
|
|
1339
|
+
height?: number;
|
|
1340
|
+
frameRate?: number;
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
role?: 'viewer';
|
|
1344
|
+
}
|
|
1345
|
+
declare class TransportSession {
|
|
1346
|
+
private _state;
|
|
1347
|
+
private _sessionId;
|
|
1348
|
+
private _tracks;
|
|
1349
|
+
|
|
1350
|
+
private _tracksByName;
|
|
1351
|
+
private _options;
|
|
1352
|
+
private _emitter;
|
|
1353
|
+
private _ws;
|
|
1354
|
+
|
|
1355
|
+
private _connectedUrl;
|
|
1356
|
+
private _device;
|
|
1357
|
+
private _mediaUnavailableReason;
|
|
1358
|
+
private _mediaVerdictResolve;
|
|
1359
|
+
private _mediaVerdict;
|
|
1360
|
+
private _recvTransport;
|
|
1361
|
+
private _pendingConsumeData;
|
|
1362
|
+
private _sendTransport;
|
|
1363
|
+
private _consumers;
|
|
1364
|
+
private _audioProducer;
|
|
1365
|
+
private _videoProducer;
|
|
1366
|
+
private _publishedAudio;
|
|
1367
|
+
private _publishedVideo;
|
|
1368
|
+
private _wtMicUplink;
|
|
1369
|
+
private _wtCamUplink;
|
|
1370
|
+
private _wtDataUpSender;
|
|
1371
|
+
private _pendingProduce;
|
|
1372
|
+
private _multiplexer;
|
|
1373
|
+
private _reconnectAttempts;
|
|
1374
|
+
private _intentionalDisconnect;
|
|
1375
|
+
private _reconnectTimer;
|
|
1376
|
+
|
|
1377
|
+
private _cancelPendingDial;
|
|
1378
|
+
|
|
1379
|
+
private _stableResetTimer;
|
|
1380
|
+
private _generation;
|
|
1381
|
+
private _lastStartOptions;
|
|
1382
|
+
private _resolveConnection;
|
|
1383
|
+
private _recvIceRestartAttempts;
|
|
1384
|
+
private _recvIceRestartTimer;
|
|
1385
|
+
private _sendIceRestartAttempts;
|
|
1386
|
+
private _sendIceRestartTimer;
|
|
1387
|
+
private _phase;
|
|
1388
|
+
private _requestId;
|
|
1389
|
+
private _liveReached;
|
|
1390
|
+
|
|
1391
|
+
private _lastServerStatus;
|
|
1392
|
+
|
|
1393
|
+
private _endsAt;
|
|
1394
|
+
|
|
1395
|
+
private _forceResolveOnNextConnect;
|
|
1396
|
+
|
|
1397
|
+
private _connectStartedAt;
|
|
1398
|
+
|
|
1399
|
+
private _wakingSince;
|
|
1400
|
+
|
|
1401
|
+
private _mediaProbeTimer;
|
|
1402
|
+
|
|
1403
|
+
private _statsTimer;
|
|
1404
|
+
|
|
1405
|
+
private _statsSampleInFlight;
|
|
1406
|
+
|
|
1407
|
+
private _joinProbes;
|
|
1408
|
+
|
|
1409
|
+
private _decodeDeathHandled;
|
|
1410
|
+
|
|
1411
|
+
private _selectedCandidatePair;
|
|
1412
|
+
|
|
1413
|
+
private _reportedCandidatePairKey;
|
|
1414
|
+
|
|
1415
|
+
private _candidatePairRefreshSeq;
|
|
1416
|
+
|
|
1417
|
+
private _diagnosticSinkFailed;
|
|
1418
|
+
|
|
1419
|
+
private _currentEpoch;
|
|
1420
|
+
|
|
1421
|
+
private _selfEpochAdoptUntil;
|
|
1422
|
+
|
|
1423
|
+
private _pausedIncarnation;
|
|
1424
|
+
|
|
1425
|
+
private _consumerId;
|
|
1426
|
+
|
|
1427
|
+
private _streamDataHandlers;
|
|
1428
|
+
|
|
1429
|
+
private _streamDataLane;
|
|
1430
|
+
|
|
1431
|
+
private _dataProducers;
|
|
1432
|
+
|
|
1433
|
+
private _dataProducerPromises;
|
|
1434
|
+
|
|
1435
|
+
private _dataConsumers;
|
|
1436
|
+
|
|
1437
|
+
private _pendingDataProduce;
|
|
1438
|
+
|
|
1439
|
+
private _sendTransportWaiters;
|
|
1440
|
+
|
|
1441
|
+
get consumerId(): string;
|
|
1442
|
+
get state(): TransportState;
|
|
1443
|
+
|
|
1444
|
+
get currentIncarnation(): number;
|
|
1445
|
+
get phase(): SessionPhase;
|
|
1446
|
+
|
|
1447
|
+
get isProducingMedia(): boolean;
|
|
1448
|
+
|
|
1449
|
+
get endsAt(): Date | null;
|
|
1450
|
+
|
|
1451
|
+
setEndsAt(endsAt: Date | null): void;
|
|
1452
|
+
|
|
1453
|
+
seedRegion(region: string | null | undefined): void;
|
|
1454
|
+
|
|
1455
|
+
private _pastDeadline;
|
|
1456
|
+
|
|
1457
|
+
get status(): SessionStatus;
|
|
1458
|
+
|
|
1459
|
+
get region(): string | null | undefined;
|
|
1460
|
+
get sessionId(): string | null;
|
|
1461
|
+
get tracks(): Map<string, MediaStreamTrack>;
|
|
1462
|
+
get multiplexer(): ChannelMultiplexer | null;
|
|
1463
|
+
get isOpen(): boolean;
|
|
1464
|
+
|
|
1465
|
+
get connectedUrl(): string | null;
|
|
1466
|
+
|
|
1467
|
+
get intentionalDisconnect(): boolean;
|
|
1468
|
+
|
|
1469
|
+
getTrackByName(name: string): MediaStreamTrack | undefined;
|
|
1470
|
+
|
|
1471
|
+
private _streamNameOf;
|
|
1472
|
+
setAuth(options: Pick<TransportSessionOptions, 'orgId' | 'jwt' | 'authProvider'>): void;
|
|
1473
|
+
constructor(options?: TransportSessionOptions);
|
|
1474
|
+
setConnection(options: Pick<TransportSessionOptions, 'url' | 'fallbackUrls' | 'sessionId' | 'iceServers'>): void;
|
|
1475
|
+
setConnectionResolver(resolveConnection: (() => Promise<TransportConnection>) | null): void;
|
|
1476
|
+
|
|
1477
|
+
applyControlDocState(state: Record<string, unknown> | null | undefined): void;
|
|
1478
|
+
|
|
1479
|
+
setIncarnation(epoch: number): void;
|
|
1480
|
+
|
|
1481
|
+
isStaleIncarnation(epoch: number): boolean;
|
|
1482
|
+
|
|
1483
|
+
isStaleClosedMarker(marker: Record<string, unknown> | null | undefined): boolean;
|
|
1484
|
+
|
|
1485
|
+
private _isStaleLivenessEvidence;
|
|
1486
|
+
connect(startOptions?: SessionStartOptions): Promise<void>;
|
|
1487
|
+
|
|
1488
|
+
leaveLeg(): boolean;
|
|
1489
|
+
|
|
1490
|
+
disconnect(reason?: string): void;
|
|
1491
|
+
on<E extends keyof TransportEvents>(event: E, handler: TransportEvents[E]): () => void;
|
|
1492
|
+
|
|
1493
|
+
private _emitDiagnostic;
|
|
1494
|
+
sendInput(data: Record<string, unknown>, sequence?: number): void;
|
|
1495
|
+
|
|
1496
|
+
sendSignal(msg: Record<string, unknown>): boolean;
|
|
1497
|
+
|
|
1498
|
+
onSignal(handler: (msg: Record<string, unknown>) => void): () => void;
|
|
1499
|
+
|
|
1500
|
+
emitDiagnostic(diagnostic: SessionDiagnostic): void;
|
|
1501
|
+
|
|
1502
|
+
onStreamData(name: string, handler: (payload: unknown) => void): () => void;
|
|
1503
|
+
|
|
1504
|
+
sendStreamData(name: string, payload: unknown, _options?: {
|
|
1505
|
+
to?: string;
|
|
1506
|
+
}): Promise<void>;
|
|
1507
|
+
|
|
1508
|
+
get wtDataUplinkSeam(): WtDataUplinkSeam;
|
|
1509
|
+
|
|
1510
|
+
private _awaitSendTransport;
|
|
1511
|
+
|
|
1512
|
+
private _settleSendTransportWaiters;
|
|
1513
|
+
|
|
1514
|
+
private _ensureDataProducer;
|
|
1515
|
+
|
|
1516
|
+
private _awaitDataChannelOpen;
|
|
1517
|
+
|
|
1518
|
+
private _dispatchStreamData;
|
|
1519
|
+
|
|
1520
|
+
markStreamDataLaneQuic(): void;
|
|
1521
|
+
|
|
1522
|
+
dispatchQuicStreamData(name: string, payload: unknown): void;
|
|
1523
|
+
|
|
1524
|
+
raiseQuicStreamDataError(err: Error): void;
|
|
1525
|
+
|
|
1526
|
+
quicStreamDataLaneLost(reason: string): void;
|
|
1527
|
+
|
|
1528
|
+
private _streamNameFromLabel;
|
|
1529
|
+
|
|
1530
|
+
mediaUnavailableReason(): string | null;
|
|
1531
|
+
|
|
1532
|
+
mediaAvailability(): Promise<string | null>;
|
|
1533
|
+
|
|
1534
|
+
private _requireMediaSupport;
|
|
1535
|
+
addTrack(track: MediaStreamTrack, name?: string): Promise<void>;
|
|
1536
|
+
|
|
1537
|
+
private _publishTrack;
|
|
1538
|
+
private _rememberPublishIntent;
|
|
1539
|
+
removeTrack(): void;
|
|
1540
|
+
|
|
1541
|
+
addVideoTrack(track: MediaStreamTrack, name?: string): Promise<void>;
|
|
1542
|
+
|
|
1543
|
+
stopVideo(): void;
|
|
1544
|
+
requestDiagnostics(): void;
|
|
1545
|
+
seekStream(name: string, target: number | 'live'): void;
|
|
1546
|
+
private _handleMessage;
|
|
1547
|
+
|
|
1548
|
+
private _onServerError;
|
|
1549
|
+
|
|
1550
|
+
private _onStreamSeeked;
|
|
1551
|
+
|
|
1552
|
+
private _reportUnknownServerStatus;
|
|
1553
|
+
|
|
1554
|
+
private _onStatus;
|
|
1555
|
+
|
|
1556
|
+
private _webRtcDialHeld;
|
|
1557
|
+
|
|
1558
|
+
private _heldRouterCaps;
|
|
1559
|
+
|
|
1560
|
+
holdWebRtcDial(): {
|
|
1561
|
+
proceed: (reason: string) => void;
|
|
1562
|
+
skip: (reason: string) => void;
|
|
1563
|
+
};
|
|
1564
|
+
private _onRouterCapabilities;
|
|
1565
|
+
private _onCreateRecvTransport;
|
|
1566
|
+
|
|
1567
|
+
private _buildRecvTransport;
|
|
1568
|
+
private _reportSelectedCandidatePair;
|
|
1569
|
+
|
|
1570
|
+
private _tryRestartRecvIce;
|
|
1571
|
+
private _trySendIceRestart;
|
|
1572
|
+
|
|
1573
|
+
private _requestIceRestart;
|
|
1574
|
+
|
|
1575
|
+
private _onIceRestarted;
|
|
1576
|
+
private _armRecvIceRestartWatchdog;
|
|
1577
|
+
private _armSendIceRestartWatchdog;
|
|
1578
|
+
private _clearRecvIceRestart;
|
|
1579
|
+
private _clearSendIceRestart;
|
|
1580
|
+
private _onCreateSendTransport;
|
|
1581
|
+
|
|
1582
|
+
private _republishPublishedTracks;
|
|
1583
|
+
|
|
1584
|
+
private _onConsumeData;
|
|
1585
|
+
private _onConsume;
|
|
1586
|
+
|
|
1587
|
+
|
|
1588
|
+
get audioPlayoutOptions(): {
|
|
1589
|
+
jitterBufferTargetMs?: number;
|
|
1590
|
+
} | undefined;
|
|
1591
|
+
|
|
1592
|
+
get wtMicUplinkSeam(): WtAudioUplinkSeam;
|
|
1593
|
+
|
|
1594
|
+
get wtCamUplinkSeam(): WtVideoUplinkSeam;
|
|
1595
|
+
private _jitterBufferTargetMs;
|
|
1596
|
+
|
|
1597
|
+
private _capJitterBuffer;
|
|
1598
|
+
|
|
1599
|
+
private _closeConsumer;
|
|
1600
|
+
|
|
1601
|
+
private _closeConsumersByProducer;
|
|
1602
|
+
private _mediaPollMs;
|
|
1603
|
+
|
|
1604
|
+
private _firstFrameWindowMs;
|
|
1605
|
+
|
|
1606
|
+
private _startMediaProbe;
|
|
1607
|
+
private _stopMediaProbe;
|
|
1608
|
+
|
|
1609
|
+
private _statsPollMs;
|
|
1610
|
+
private _startStatsSampler;
|
|
1611
|
+
private _stopStatsSampler;
|
|
1612
|
+
|
|
1613
|
+
private _lanePairKey;
|
|
1614
|
+
private _sampleSessionStats;
|
|
1615
|
+
|
|
1616
|
+
private _resetJoinProbes;
|
|
1617
|
+
private _sampleMediaArrival;
|
|
1618
|
+
|
|
1619
|
+
private _renegotiate;
|
|
1620
|
+
|
|
1621
|
+
recover(): void;
|
|
1622
|
+
private _attemptReconnect;
|
|
1623
|
+
private _connectUrls;
|
|
1624
|
+
private _connectOnce;
|
|
1625
|
+
private _startMessage;
|
|
1626
|
+
private _cleanupSocket;
|
|
1627
|
+
|
|
1628
|
+
private _replaceCurrentLegForReconnect;
|
|
1629
|
+
|
|
1630
|
+
private _scheduleReconnectBudgetReset;
|
|
1631
|
+
private _clearReconnectBudgetReset;
|
|
1632
|
+
|
|
1633
|
+
private _cleanupDataChannels;
|
|
1634
|
+
private _cleanupMedia;
|
|
1635
|
+
|
|
1636
|
+
private _send;
|
|
1637
|
+
private _setState;
|
|
1638
|
+
|
|
1639
|
+
|
|
1640
|
+
private _isParkedPhase;
|
|
1641
|
+
private _setPhase;
|
|
1642
|
+
|
|
1643
|
+
reportAdmission(update: AdmissionUpdate): void;
|
|
1644
|
+
|
|
1645
|
+
private _emitError;
|
|
1646
|
+
|
|
1647
|
+
reportAllocationFailure(error: Error, httpStatus?: number, code?: string, retryAfterSeconds?: number): void;
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
declare class SessionDocumentImpl implements SessionDocument {
|
|
1651
|
+
private _doc;
|
|
1652
|
+
private _root;
|
|
1653
|
+
private _awareness;
|
|
1654
|
+
private _listeners;
|
|
1655
|
+
private _key;
|
|
1656
|
+
private _sessionId;
|
|
1657
|
+
private _connection;
|
|
1658
|
+
private _connUnsub;
|
|
1659
|
+
|
|
1660
|
+
private _synced;
|
|
1661
|
+
|
|
1662
|
+
private _syncWaiters;
|
|
1663
|
+
|
|
1664
|
+
private _texts;
|
|
1665
|
+
private _observer;
|
|
1666
|
+
constructor(key: string, sessionId: string, connector?: DocConnector | null);
|
|
1667
|
+
|
|
1668
|
+
get awareness(): Awareness;
|
|
1669
|
+
|
|
1670
|
+
setSessionId(sessionId: string): void;
|
|
1671
|
+
|
|
1672
|
+
get synced(): boolean;
|
|
1673
|
+
|
|
1674
|
+
ensureConnected(): void;
|
|
1675
|
+
|
|
1676
|
+
reconnect(): void;
|
|
1677
|
+
|
|
1678
|
+
disconnect(): void;
|
|
1679
|
+
|
|
1680
|
+
onConnectionState(handler: (state: DocConnectionState) => void): () => void;
|
|
1681
|
+
|
|
1682
|
+
onSynced(handler: () => void): () => void;
|
|
1683
|
+
|
|
1684
|
+
set(patch: Record<string, unknown>): void;
|
|
1685
|
+
get(path?: string, defaultValue?: unknown): unknown;
|
|
1686
|
+
on(event: 'change', handler: (snap: Record<string, unknown>) => void): () => void;
|
|
1687
|
+
|
|
1688
|
+
text(field: string): SessionTextImpl;
|
|
1689
|
+
dispose(): void;
|
|
1690
|
+
private _markSynced;
|
|
1691
|
+
|
|
1692
|
+
private applyPatch;
|
|
1693
|
+
private snapshot;
|
|
1694
|
+
private notify;
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
declare class SessionTextImpl implements SessionText {
|
|
1698
|
+
private _ytext;
|
|
1699
|
+
private _delta;
|
|
1700
|
+
private _observer;
|
|
1701
|
+
constructor(_ytext: Y.Text);
|
|
1702
|
+
append(text: string): void;
|
|
1703
|
+
toString(): string;
|
|
1704
|
+
get length(): number;
|
|
1705
|
+
on(event: 'delta', handler: (inserted: string) => void): () => void;
|
|
1706
|
+
dispose(): void;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
declare const STREAM_END: unique symbol;
|
|
1710
|
+
|
|
1711
|
+
declare function encodeStreamEnvelope(payload: unknown): Uint8Array;
|
|
1712
|
+
|
|
1713
|
+
declare function decodeStreamEnvelope(frame: Uint8Array | ArrayBuffer): unknown;
|
|
1714
|
+
|
|
1715
|
+
interface StreamDataTransport {
|
|
1716
|
+
|
|
1717
|
+
readonly consumerId: string;
|
|
1718
|
+
|
|
1719
|
+
onData(name: string, handler: (payload: unknown) => void): () => void;
|
|
1720
|
+
|
|
1721
|
+
sendData(name: string, payload: unknown, options?: {
|
|
1722
|
+
to?: string;
|
|
1723
|
+
}): Promise<void>;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
declare class LoopbackStreamData implements StreamDataTransport {
|
|
1727
|
+
readonly consumerId: string;
|
|
1728
|
+
private _handlers;
|
|
1729
|
+
constructor(consumerId?: string);
|
|
1730
|
+
onData(name: string, handler: (payload: unknown) => void): () => void;
|
|
1731
|
+
sendData(name: string, payload: unknown, options?: {
|
|
1732
|
+
to?: string;
|
|
1733
|
+
}): Promise<void>;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
interface DataChannelTransport {
|
|
1737
|
+
readonly consumerId: string;
|
|
1738
|
+
onStreamData(name: string, handler: (payload: unknown) => void): () => void;
|
|
1739
|
+
sendStreamData(name: string, payload: unknown, options?: {
|
|
1740
|
+
to?: string;
|
|
1741
|
+
}): Promise<void>;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
|
|
1745
|
+
|
|
1746
|
+
export { type ReleaseSessionBeaconOptions as $, type AccessTokenOptions as A, type GenerationTick as B, type ChannelEndpoint as C, DERIVED_LEG_SEP as D, type MediaChunkSource as E, type MediaChunkSourceFactory as F, GENERATION_TICK_EMIT_INTERVAL_MS as G, type MediaRecorderChunkSourceOptions as H, type InboundStatsSample as I, type MediaSession as J, type NegotiatorOptions as K, LoopbackStreamData as L, type MediaChunkBinding as M, type NegotiatorDataLaneSeam as N, type PathLiveness as O, type PathHealthReporting as P, type Presence as Q, type PresenceState as R, type PrewakeOptions as S, type PrewakeResult as T, type PrewakeStatus as U, type QuicStreamDataTransport as V, type Recording as W, type RecordingBucket as X, type RecordingLifecycle as Y, type RecordingStatus as Z, type RecordingsAccessor as _, type AccessTokenOptions$1 as a, encodeStreamEnvelope as a$, type RequestOptions as a0, type RequestStreamOptions as a1, type RuntimeArtifact as a2, type RuntimeArtifactDownload as a3, type RuntimeArtifactsAccessor as a4, type RuntimeAvailability as a5, type RuntimeWakeDetail as a6, type RuntimeWakeGolden as a7, type RuntimeWakeReasonCode as a8, SIGNALING_PROTOCOL_VERSION as a9, type TransportOfferRequest as aA, type TransportOfferResponse as aB, TransportSession as aC, type TransportSessionOptions as aD, TransportSessionSignaling as aE, type TransportState as aF, type VideoPlayoutOptions as aG, WT_CONTROL_FRAME_MAX as aH, WT_DATA_STREAM_VERSION as aI, type WatchGenerationTickOptions as aJ, type WtAudioLaneSeam as aK, type WtAudioUplinkSeam as aL, WtControlDecoder as aM, type WtControlMessage as aN, type WtDataEnvelope as aO, type WtDataLaneSink as aP, WtDataStreamParser as aQ, WtDataUplinkSender as aR, type WtVideoUplinkSeam as aS, allocateSession as aT, consumeWtDataStreams as aU, createPresence as aV, createWebsocketDocConnector as aW, decodeStreamEnvelope as aX, deriveYjsServerUrl as aY, derivedLegName as aZ, derivedLegRole as a_, STREAM_END as aa, type Session as ab, type SessionDiagnostic as ac, type SessionDirectoryRequestOptions as ad, type SessionDocument as ae, SessionDocumentImpl as af, type SessionEndResult as ag, type SessionFailureKind as ah, type SessionPhase as ai, type SessionPhaseError as aj, type SessionPhaseName as ak, type SessionStartOptions as al, type SessionStatsOptions as am, type SessionStatsSample as an, type SessionStatus as ao, type SessionStream as ap, type SessionText as aq, type SignalCarrier as ar, type Signaling as as, type StartSessionOptions as at, type Store as au, type StoreOptions as av, type StreamChunkOptions as aw, type StreamDataTransport as ax, type TransportEstablishedNotify as ay, TransportNegotiator as az, type ActivationEvent as b, encodeWtControlFrame as b0, isPendingRecording as b1, mediaRecorderChunkSource as b2, parseDgramHeader as b3, prewake as b4, releaseSessionBeacon as b5, streamDataLabel as b6, transportStreamData as b7, watchGenerationTick as b8, writeDgramHeader as b9, type ActivationState as c, type ActivitySignalMode as d, type AllocateSessionOptions as e, type AllocatedSession as f, type App as g, type AppOptions as h, type AttachOptions as i, type AudioPlayoutOptions as j, type ChannelMessage as k, ChannelMultiplexer as l, type ChannelName as m, type ChunkReadable as n, DGRAM_HEADER_BYTES as o, DOC_SYNC_WIRE_CONTRACT_VERSION as p, DeferredChannelMultiplexer as q, DeferredDocConnector as r, type DerivedLegRole as s, type DgramHeader as t, type DocConnection as u, type DocConnectionState as v, type DocConnector as w, type DocServerUrlResolver as x, type DocTokenSupplier as y, GENERATION_TICK_MAX_EXTRAPOLATION_MS as z };
|