@urun-sh/core 0.2.17 → 0.2.19

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.
@@ -1,10 +1,46 @@
1
- import { b as AppOptions, a as App$1, N as SessionPhase, U as SessionStatus, Q as SessionPhaseName, A as AccessTokenOptions$1, y as RuntimeArtifact, z as RuntimeArtifactDownload, R as Recording, G as Session$1, C as ChannelEndpoint, $ as TransportSession, c as AttachOptions, v as RecordingsAccessor, B as RuntimeArtifactsAccessor, J as SessionEndResult, V as SessionStream$1, _ as StreamDataTransport, I as SessionDocumentImpl, Z as StreamChunkOptions, g as ChunkReadable, P as Presence, k as DocConnector, w as RequestOptions, x as RequestStreamOptions, Y as StoreOptions, X as Store, e as ChannelMultiplexer, K as SessionFailureKind, a1 as TransportState } from './stream-data-rqyqR75F.mjs';
2
- export { L as Layer, l as LayoutConfig, m as LayoutContext, M as MediaChunkBinding, o as MediaChunkSource, p as MediaChunkSourceFactory, q as MediaRecorderChunkSourceOptions, r as PresenceState, s as RecordingBucket, t as RecordingLifecycle, u as RecordingStatus, E as RuntimeAvailability, S as SceneContext, F as SceneGraph, H as SessionDocument, O as SessionPhaseError, W as SessionText, a5 as isPendingRecording, a6 as mediaRecorderChunkSource } from './stream-data-rqyqR75F.mjs';
1
+ import { d as AppOptions, c as App$1, T as SessionPhase, X as SessionStatus, V as SessionPhaseName, A as AccessTokenOptions$1, B as RuntimeArtifact, E as RuntimeArtifactDownload, R as Recording, I as Session$1, C as ChannelEndpoint, a2 as TransportSession, e as AttachOptions, J as SessionDiagnostic, a as ActivationEvent, x as RecordingsAccessor, F as RuntimeArtifactsAccessor, O as SessionEndResult, Y as SessionStream$1, a1 as StreamDataTransport, N as SessionDocumentImpl, a0 as StreamChunkOptions, i as ChunkReadable, P as Presence, m as DocConnector, y as RequestOptions, z as RequestStreamOptions, $ as StoreOptions, _ as Store, g as ChannelMultiplexer, Q as SessionFailureKind, a4 as TransportState } from './stream-data-bZAHTqK-.mjs';
2
+ export { b as ActivationState, L as Layer, n as LayoutConfig, o as LayoutContext, M as MediaChunkBinding, q as MediaChunkSource, r as MediaChunkSourceFactory, s as MediaRecorderChunkSourceOptions, t as PresenceState, u as RecordingBucket, v as RecordingLifecycle, w as RecordingStatus, G as RuntimeAvailability, S as SceneContext, H as SceneGraph, K as SessionDocument, U as SessionPhaseError, Z as SessionText, a8 as isPendingRecording, a9 as mediaRecorderChunkSource } from './stream-data-bZAHTqK-.mjs';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
5
5
 
6
6
  declare function App(appId: string, options: AppOptions): App$1;
7
7
 
8
+ declare const DEFAULT_GATEWAY_URL = "https://api.urun.sh";
9
+ interface CreateClientTokenOptions {
10
+
11
+ baseUrl?: string;
12
+
13
+ expiresIn?: number;
14
+
15
+ allowedFunctions?: string[];
16
+
17
+ allowedOrigins?: string[];
18
+
19
+ maxSessionS?: number;
20
+
21
+ subject?: string;
22
+
23
+ metadata?: Record<string, unknown>;
24
+
25
+ fetch?: typeof fetch;
26
+ }
27
+
28
+ interface ClientToken {
29
+
30
+ token: string;
31
+
32
+ expiresAt: Date;
33
+
34
+ orgId: string;
35
+ }
36
+
37
+ declare class ClientTokenError extends Error {
38
+ readonly status?: number;
39
+ constructor(message: string, status?: number);
40
+ }
41
+
42
+ declare function createClientToken(apiKey: string, options?: CreateClientTokenOptions): Promise<ClientToken>;
43
+
8
44
  interface AccessTokenOptions {
9
45
  forceRefresh?: boolean;
10
46
  reason?: 'initial' | 'unauthorized' | 'background';
@@ -191,6 +227,8 @@ declare class SessionStream implements SessionStream$1 {
191
227
 
192
228
  private _onActivity?;
193
229
  private _track;
230
+
231
+ private _overrideTrack;
194
232
  private _handlers;
195
233
  private _unsubscribeTransport;
196
234
 
@@ -217,6 +255,8 @@ declare class SessionStream implements SessionStream$1 {
217
255
  private _deliver;
218
256
  get track(): MediaStreamTrack | null;
219
257
 
258
+ _setOverrideTrack(track: MediaStreamTrack | null): void;
259
+
220
260
  private _claimBrowserProducer;
221
261
  attach(track: MediaStreamTrack): Promise<void>;
222
262
 
@@ -255,6 +295,8 @@ declare class Session implements Session$1 {
255
295
 
256
296
  private _activity;
257
297
 
298
+ private _activation;
299
+
258
300
  private _activeRequests;
259
301
  private _endHandler?;
260
302
  private _endPromise?;
@@ -270,6 +312,10 @@ declare class Session implements Session$1 {
270
312
  private _recoveryHooks;
271
313
 
272
314
  private _lifecycleUnsub;
315
+
316
+ private _dialNegotiation;
317
+
318
+ private _dialNegotiationStarted;
273
319
  constructor(sessionId: string, multiplexer: ChannelEndpoint, transport: TransportSession, recordingsAuth?: RecordingsClientOptions, artifactsAuth?: RuntimeArtifactsClientOptions);
274
320
  private _wireControlDocIncarnation;
275
321
 
@@ -284,6 +330,10 @@ declare class Session implements Session$1 {
284
330
 
285
331
  onPhase(handler: (phase: SessionPhase) => void): () => void;
286
332
 
333
+ onDiagnostic(handler: (diagnostic: SessionDiagnostic) => void): () => void;
334
+
335
+ onActivation(handler: (event: ActivationEvent) => void): () => void;
336
+
287
337
  whenLive(options?: WhenLiveOptions): Promise<void>;
288
338
 
289
339
  get recordings(): RecordingsAccessor;
@@ -326,6 +376,12 @@ declare class Session implements Session$1 {
326
376
  recover(): void;
327
377
 
328
378
  onRecovery(hook: () => void): () => void;
379
+
380
+ negotiateMediaTransport(opts?: {
381
+ allowWebTransport?: boolean;
382
+ }): void;
383
+
384
+ get mediaTransport(): 'webtransport' | 'webrtc' | null;
329
385
  end(): Promise<SessionEndResult>;
330
386
  disconnect(): void;
331
387
  }
@@ -334,6 +390,70 @@ declare const FOREGROUND_COALESCE_MS = 250;
334
390
 
335
391
  declare function observePageLifecycle(onForeground: () => void): () => void;
336
392
 
393
+ declare const ACTIVATION_STILL_AFTER_MS = 15000;
394
+
395
+ declare const ACTIVATION_COLD_BOOT_AFTER_MS = 45000;
396
+
397
+ declare const ACTIVATION_DEGRADED_AFTER_MS = 120000;
398
+
399
+ declare const ACTIVATION_HINT_PATH = "desired.activation";
400
+
401
+ declare function activationHintFrom(value: unknown): string | undefined;
402
+
403
+ interface ActivationStreamLike {
404
+
405
+ readonly track: MediaStreamTrack | null;
406
+
407
+ on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
408
+ }
409
+
410
+ interface ActivationMonitorOptions {
411
+
412
+ onPhase(handler: (phase: SessionPhase) => void): () => void;
413
+
414
+ hint(): unknown;
415
+
416
+ onData?(name: string, handler: (payload: unknown) => void): () => void;
417
+ }
418
+
419
+ declare class ActivationMonitor {
420
+ private _options;
421
+ private _watches;
422
+ private _handlers;
423
+
424
+ private _liveAt;
425
+ private _stopped;
426
+ private _offPhase;
427
+ constructor(_options: ActivationMonitorOptions);
428
+
429
+ watch(name: string, stream: ActivationStreamLike): void;
430
+
431
+ unwatch(name: string): void;
432
+
433
+ onActivation(handler: (event: ActivationEvent) => void): () => void;
434
+
435
+ dispose(): void;
436
+
437
+ private _hookFirstMediaSignals;
438
+
439
+ private _arm;
440
+
441
+ private _firstMedia;
442
+
443
+ private _settle;
444
+ private _emit;
445
+ }
446
+
447
+ declare const BACKOFF_BASE_MS = 500;
448
+
449
+ declare const BACKOFF_MAX_MS = 15000;
450
+
451
+ declare const BACKOFF_MAX_ATTEMPTS = 6;
452
+
453
+ declare function computeBackoffDelay(attempt: number, random?: () => number): number;
454
+
455
+ declare function isRetryableSessionError(error: unknown): boolean;
456
+
337
457
  declare function createStore(options: StoreOptions): Store & {
338
458
  _getInternals(): {
339
459
  multiplexer: ChannelMultiplexer;
@@ -586,6 +706,8 @@ interface MediaSession {
586
706
  lossPct: number;
587
707
  jitterMs: number;
588
708
  };
709
+
710
+ readonly firstMedia: Promise<void>;
589
711
  }
590
712
 
591
713
  interface Signaling {
@@ -734,6 +856,8 @@ declare class WebTransportSession implements MediaSession {
734
856
  private lastStats;
735
857
  private firstFrameResolve;
736
858
  private firstFrameReject;
859
+
860
+ readonly firstMedia: Promise<void>;
737
861
  constructor(offer: NonNullable<TransportOfferResponse['webtransport']>, sessionId: string, canvas: HTMLCanvasElement);
738
862
 
739
863
  start(): Promise<void>;
@@ -767,6 +891,10 @@ declare class WebRtcSession implements MediaSession {
767
891
  private deadCb;
768
892
  private deadFired;
769
893
  private unsubscribers;
894
+ private firstMediaResolve;
895
+ private firstMediaReject;
896
+
897
+ readonly firstMedia: Promise<void>;
770
898
  constructor(transport: ConsumingTransport, streamName?: string);
771
899
 
772
900
  start(): Promise<void>;
@@ -824,4 +952,4 @@ declare class FrameReassembler {
824
952
  private requestKeyframe;
825
953
  }
826
954
 
827
- export { ACTIVITY_DOM_EVENTS, ACTIVITY_FIELD, ACTIVITY_STAMP_MIN_INTERVAL_MS, type ActivityAwareness, type ActivityTracker, type ActivityTrackerOptions, App, App$1 as AppInterface, AppOptions, AttachOptions, type CaptureClaim, CaptureController, type CaptureControllerOptions, type CaptureKind, CaptureUnavailableError, ChunkReadable, type ConsumingTransport, DEFAULT_DOC_SYNC_TIMEOUT_MS, DEFAULT_PRODUCE_ACK_TIMEOUT_MS, DEFAULT_WHEN_LIVE_TIMEOUT_MS, DGRAM_HEADER_BYTES, type DgramHeader, FOREGROUND_COALESCE_MS, FrameReassembler, INPUT_PRESENCE_DEFAULT_HZ, INPUT_PRESENCE_FIELD, type InputPresenceAwareness, type InputPresencePublisher, type InputPresencePublisherOptions, type InputPresenceState, InvalidDurationError, type MediaSession, type NegotiatorOptions, PermanentLockedError, type PhaseObservable, PinRequiresActiveTempError, Presence, type PrewakeOptions, type PrewakeResult, type PrewakeStatus, ProduceAckTimeoutError, type ReassembledFrame, type ReassemblerCallbacks, type ReassemblerOptions, Recording, RecordingNotFoundError, RecordingsAccessor, RecordingsClient, type RecordingsClientOptions, RecordingsError, RecordingsUnauthorizedError, RequestAbortError, RequestCancelledError, RequestDocSyncError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, RetainNotTempError, type RetentionIntent, RuntimeArtifact, RuntimeArtifactDownload, RuntimeArtifactNotFoundError, RuntimeArtifactsAccessor, RuntimeArtifactsClient, type RuntimeArtifactsClientOptions, RuntimeArtifactsError, RuntimeArtifactsUnauthorizedError, Session, SessionAllocationError, SessionEndError, SessionEndResult, SessionEndUnavailableError, SessionFailedError, SessionFailureKind, Session$1 as SessionInterface, SessionPhase, SessionPhaseName, SessionStatus, SessionStream$1 as SessionStream, type SignalCarrier, type Signaling, Store, StoreOptions, StreamChunkOptions, StreamDirectionConflict, type TransportEstablishedNotify, TransportNegotiator, type TransportOfferRequest, type TransportOfferResponse, TransportSessionSignaling, TransportState, type VideoStreamOptions, WT_CONTROL_FRAME_MAX, WebRtcSession, WebTransportSession, type WhenLiveOptions, WtControlDecoder, type WtControlMessage, createActivityTracker, createInputPresencePublisher, createRecordingsClient, createRuntimeArtifactsClient, createStore, describeSessionFailure, describeSessionPhase, encodeWtControlFrame, isDurationString, isWakingPhase, normalizeRetention, observePageLifecycle, parseDgramHeader, prewake, sessionFailureFromMediaError, sharedCaptureController, videoStream, whenLive, writeDgramHeader };
955
+ export { ACTIVATION_COLD_BOOT_AFTER_MS, ACTIVATION_DEGRADED_AFTER_MS, ACTIVATION_HINT_PATH, ACTIVATION_STILL_AFTER_MS, ACTIVITY_DOM_EVENTS, ACTIVITY_FIELD, ACTIVITY_STAMP_MIN_INTERVAL_MS, ActivationEvent, ActivationMonitor, type ActivationMonitorOptions, type ActivationStreamLike, type ActivityAwareness, type ActivityTracker, type ActivityTrackerOptions, App, App$1 as AppInterface, AppOptions, AttachOptions, BACKOFF_BASE_MS, BACKOFF_MAX_ATTEMPTS, BACKOFF_MAX_MS, type CaptureClaim, CaptureController, type CaptureControllerOptions, type CaptureKind, CaptureUnavailableError, ChunkReadable, type ClientToken, ClientTokenError, type ConsumingTransport, type CreateClientTokenOptions, DEFAULT_DOC_SYNC_TIMEOUT_MS, DEFAULT_GATEWAY_URL, DEFAULT_PRODUCE_ACK_TIMEOUT_MS, DEFAULT_WHEN_LIVE_TIMEOUT_MS, DGRAM_HEADER_BYTES, type DgramHeader, FOREGROUND_COALESCE_MS, FrameReassembler, INPUT_PRESENCE_DEFAULT_HZ, INPUT_PRESENCE_FIELD, type InputPresenceAwareness, type InputPresencePublisher, type InputPresencePublisherOptions, type InputPresenceState, InvalidDurationError, type MediaSession, type NegotiatorOptions, PermanentLockedError, type PhaseObservable, PinRequiresActiveTempError, Presence, type PrewakeOptions, type PrewakeResult, type PrewakeStatus, ProduceAckTimeoutError, type ReassembledFrame, type ReassemblerCallbacks, type ReassemblerOptions, Recording, RecordingNotFoundError, RecordingsAccessor, RecordingsClient, type RecordingsClientOptions, RecordingsError, RecordingsUnauthorizedError, RequestAbortError, RequestCancelledError, RequestDocSyncError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, RetainNotTempError, type RetentionIntent, RuntimeArtifact, RuntimeArtifactDownload, RuntimeArtifactNotFoundError, RuntimeArtifactsAccessor, RuntimeArtifactsClient, type RuntimeArtifactsClientOptions, RuntimeArtifactsError, RuntimeArtifactsUnauthorizedError, Session, SessionAllocationError, SessionDiagnostic, SessionEndError, SessionEndResult, SessionEndUnavailableError, SessionFailedError, SessionFailureKind, Session$1 as SessionInterface, SessionPhase, SessionPhaseName, SessionStatus, SessionStream$1 as SessionStream, type SignalCarrier, type Signaling, Store, StoreOptions, StreamChunkOptions, StreamDirectionConflict, type TransportEstablishedNotify, TransportNegotiator, type TransportOfferRequest, type TransportOfferResponse, TransportSessionSignaling, TransportState, type VideoStreamOptions, WT_CONTROL_FRAME_MAX, WebRtcSession, WebTransportSession, type WhenLiveOptions, WtControlDecoder, type WtControlMessage, activationHintFrom, computeBackoffDelay, createActivityTracker, createClientToken, createInputPresencePublisher, createRecordingsClient, createRuntimeArtifactsClient, createStore, describeSessionFailure, describeSessionPhase, encodeWtControlFrame, isDurationString, isRetryableSessionError, isWakingPhase, normalizeRetention, observePageLifecycle, parseDgramHeader, prewake, sessionFailureFromMediaError, sharedCaptureController, videoStream, whenLive, writeDgramHeader };
@@ -1,10 +1,46 @@
1
- import { b as AppOptions, a as App$1, N as SessionPhase, U as SessionStatus, Q as SessionPhaseName, A as AccessTokenOptions$1, y as RuntimeArtifact, z as RuntimeArtifactDownload, R as Recording, G as Session$1, C as ChannelEndpoint, $ as TransportSession, c as AttachOptions, v as RecordingsAccessor, B as RuntimeArtifactsAccessor, J as SessionEndResult, V as SessionStream$1, _ as StreamDataTransport, I as SessionDocumentImpl, Z as StreamChunkOptions, g as ChunkReadable, P as Presence, k as DocConnector, w as RequestOptions, x as RequestStreamOptions, Y as StoreOptions, X as Store, e as ChannelMultiplexer, K as SessionFailureKind, a1 as TransportState } from './stream-data-rqyqR75F.js';
2
- export { L as Layer, l as LayoutConfig, m as LayoutContext, M as MediaChunkBinding, o as MediaChunkSource, p as MediaChunkSourceFactory, q as MediaRecorderChunkSourceOptions, r as PresenceState, s as RecordingBucket, t as RecordingLifecycle, u as RecordingStatus, E as RuntimeAvailability, S as SceneContext, F as SceneGraph, H as SessionDocument, O as SessionPhaseError, W as SessionText, a5 as isPendingRecording, a6 as mediaRecorderChunkSource } from './stream-data-rqyqR75F.js';
1
+ import { d as AppOptions, c as App$1, T as SessionPhase, X as SessionStatus, V as SessionPhaseName, A as AccessTokenOptions$1, B as RuntimeArtifact, E as RuntimeArtifactDownload, R as Recording, I as Session$1, C as ChannelEndpoint, a2 as TransportSession, e as AttachOptions, J as SessionDiagnostic, a as ActivationEvent, x as RecordingsAccessor, F as RuntimeArtifactsAccessor, O as SessionEndResult, Y as SessionStream$1, a1 as StreamDataTransport, N as SessionDocumentImpl, a0 as StreamChunkOptions, i as ChunkReadable, P as Presence, m as DocConnector, y as RequestOptions, z as RequestStreamOptions, $ as StoreOptions, _ as Store, g as ChannelMultiplexer, Q as SessionFailureKind, a4 as TransportState } from './stream-data-bZAHTqK-.js';
2
+ export { b as ActivationState, L as Layer, n as LayoutConfig, o as LayoutContext, M as MediaChunkBinding, q as MediaChunkSource, r as MediaChunkSourceFactory, s as MediaRecorderChunkSourceOptions, t as PresenceState, u as RecordingBucket, v as RecordingLifecycle, w as RecordingStatus, G as RuntimeAvailability, S as SceneContext, H as SceneGraph, K as SessionDocument, U as SessionPhaseError, Z as SessionText, a8 as isPendingRecording, a9 as mediaRecorderChunkSource } from './stream-data-bZAHTqK-.js';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
5
5
 
6
6
  declare function App(appId: string, options: AppOptions): App$1;
7
7
 
8
+ declare const DEFAULT_GATEWAY_URL = "https://api.urun.sh";
9
+ interface CreateClientTokenOptions {
10
+
11
+ baseUrl?: string;
12
+
13
+ expiresIn?: number;
14
+
15
+ allowedFunctions?: string[];
16
+
17
+ allowedOrigins?: string[];
18
+
19
+ maxSessionS?: number;
20
+
21
+ subject?: string;
22
+
23
+ metadata?: Record<string, unknown>;
24
+
25
+ fetch?: typeof fetch;
26
+ }
27
+
28
+ interface ClientToken {
29
+
30
+ token: string;
31
+
32
+ expiresAt: Date;
33
+
34
+ orgId: string;
35
+ }
36
+
37
+ declare class ClientTokenError extends Error {
38
+ readonly status?: number;
39
+ constructor(message: string, status?: number);
40
+ }
41
+
42
+ declare function createClientToken(apiKey: string, options?: CreateClientTokenOptions): Promise<ClientToken>;
43
+
8
44
  interface AccessTokenOptions {
9
45
  forceRefresh?: boolean;
10
46
  reason?: 'initial' | 'unauthorized' | 'background';
@@ -191,6 +227,8 @@ declare class SessionStream implements SessionStream$1 {
191
227
 
192
228
  private _onActivity?;
193
229
  private _track;
230
+
231
+ private _overrideTrack;
194
232
  private _handlers;
195
233
  private _unsubscribeTransport;
196
234
 
@@ -217,6 +255,8 @@ declare class SessionStream implements SessionStream$1 {
217
255
  private _deliver;
218
256
  get track(): MediaStreamTrack | null;
219
257
 
258
+ _setOverrideTrack(track: MediaStreamTrack | null): void;
259
+
220
260
  private _claimBrowserProducer;
221
261
  attach(track: MediaStreamTrack): Promise<void>;
222
262
 
@@ -255,6 +295,8 @@ declare class Session implements Session$1 {
255
295
 
256
296
  private _activity;
257
297
 
298
+ private _activation;
299
+
258
300
  private _activeRequests;
259
301
  private _endHandler?;
260
302
  private _endPromise?;
@@ -270,6 +312,10 @@ declare class Session implements Session$1 {
270
312
  private _recoveryHooks;
271
313
 
272
314
  private _lifecycleUnsub;
315
+
316
+ private _dialNegotiation;
317
+
318
+ private _dialNegotiationStarted;
273
319
  constructor(sessionId: string, multiplexer: ChannelEndpoint, transport: TransportSession, recordingsAuth?: RecordingsClientOptions, artifactsAuth?: RuntimeArtifactsClientOptions);
274
320
  private _wireControlDocIncarnation;
275
321
 
@@ -284,6 +330,10 @@ declare class Session implements Session$1 {
284
330
 
285
331
  onPhase(handler: (phase: SessionPhase) => void): () => void;
286
332
 
333
+ onDiagnostic(handler: (diagnostic: SessionDiagnostic) => void): () => void;
334
+
335
+ onActivation(handler: (event: ActivationEvent) => void): () => void;
336
+
287
337
  whenLive(options?: WhenLiveOptions): Promise<void>;
288
338
 
289
339
  get recordings(): RecordingsAccessor;
@@ -326,6 +376,12 @@ declare class Session implements Session$1 {
326
376
  recover(): void;
327
377
 
328
378
  onRecovery(hook: () => void): () => void;
379
+
380
+ negotiateMediaTransport(opts?: {
381
+ allowWebTransport?: boolean;
382
+ }): void;
383
+
384
+ get mediaTransport(): 'webtransport' | 'webrtc' | null;
329
385
  end(): Promise<SessionEndResult>;
330
386
  disconnect(): void;
331
387
  }
@@ -334,6 +390,70 @@ declare const FOREGROUND_COALESCE_MS = 250;
334
390
 
335
391
  declare function observePageLifecycle(onForeground: () => void): () => void;
336
392
 
393
+ declare const ACTIVATION_STILL_AFTER_MS = 15000;
394
+
395
+ declare const ACTIVATION_COLD_BOOT_AFTER_MS = 45000;
396
+
397
+ declare const ACTIVATION_DEGRADED_AFTER_MS = 120000;
398
+
399
+ declare const ACTIVATION_HINT_PATH = "desired.activation";
400
+
401
+ declare function activationHintFrom(value: unknown): string | undefined;
402
+
403
+ interface ActivationStreamLike {
404
+
405
+ readonly track: MediaStreamTrack | null;
406
+
407
+ on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
408
+ }
409
+
410
+ interface ActivationMonitorOptions {
411
+
412
+ onPhase(handler: (phase: SessionPhase) => void): () => void;
413
+
414
+ hint(): unknown;
415
+
416
+ onData?(name: string, handler: (payload: unknown) => void): () => void;
417
+ }
418
+
419
+ declare class ActivationMonitor {
420
+ private _options;
421
+ private _watches;
422
+ private _handlers;
423
+
424
+ private _liveAt;
425
+ private _stopped;
426
+ private _offPhase;
427
+ constructor(_options: ActivationMonitorOptions);
428
+
429
+ watch(name: string, stream: ActivationStreamLike): void;
430
+
431
+ unwatch(name: string): void;
432
+
433
+ onActivation(handler: (event: ActivationEvent) => void): () => void;
434
+
435
+ dispose(): void;
436
+
437
+ private _hookFirstMediaSignals;
438
+
439
+ private _arm;
440
+
441
+ private _firstMedia;
442
+
443
+ private _settle;
444
+ private _emit;
445
+ }
446
+
447
+ declare const BACKOFF_BASE_MS = 500;
448
+
449
+ declare const BACKOFF_MAX_MS = 15000;
450
+
451
+ declare const BACKOFF_MAX_ATTEMPTS = 6;
452
+
453
+ declare function computeBackoffDelay(attempt: number, random?: () => number): number;
454
+
455
+ declare function isRetryableSessionError(error: unknown): boolean;
456
+
337
457
  declare function createStore(options: StoreOptions): Store & {
338
458
  _getInternals(): {
339
459
  multiplexer: ChannelMultiplexer;
@@ -586,6 +706,8 @@ interface MediaSession {
586
706
  lossPct: number;
587
707
  jitterMs: number;
588
708
  };
709
+
710
+ readonly firstMedia: Promise<void>;
589
711
  }
590
712
 
591
713
  interface Signaling {
@@ -734,6 +856,8 @@ declare class WebTransportSession implements MediaSession {
734
856
  private lastStats;
735
857
  private firstFrameResolve;
736
858
  private firstFrameReject;
859
+
860
+ readonly firstMedia: Promise<void>;
737
861
  constructor(offer: NonNullable<TransportOfferResponse['webtransport']>, sessionId: string, canvas: HTMLCanvasElement);
738
862
 
739
863
  start(): Promise<void>;
@@ -767,6 +891,10 @@ declare class WebRtcSession implements MediaSession {
767
891
  private deadCb;
768
892
  private deadFired;
769
893
  private unsubscribers;
894
+ private firstMediaResolve;
895
+ private firstMediaReject;
896
+
897
+ readonly firstMedia: Promise<void>;
770
898
  constructor(transport: ConsumingTransport, streamName?: string);
771
899
 
772
900
  start(): Promise<void>;
@@ -824,4 +952,4 @@ declare class FrameReassembler {
824
952
  private requestKeyframe;
825
953
  }
826
954
 
827
- export { ACTIVITY_DOM_EVENTS, ACTIVITY_FIELD, ACTIVITY_STAMP_MIN_INTERVAL_MS, type ActivityAwareness, type ActivityTracker, type ActivityTrackerOptions, App, App$1 as AppInterface, AppOptions, AttachOptions, type CaptureClaim, CaptureController, type CaptureControllerOptions, type CaptureKind, CaptureUnavailableError, ChunkReadable, type ConsumingTransport, DEFAULT_DOC_SYNC_TIMEOUT_MS, DEFAULT_PRODUCE_ACK_TIMEOUT_MS, DEFAULT_WHEN_LIVE_TIMEOUT_MS, DGRAM_HEADER_BYTES, type DgramHeader, FOREGROUND_COALESCE_MS, FrameReassembler, INPUT_PRESENCE_DEFAULT_HZ, INPUT_PRESENCE_FIELD, type InputPresenceAwareness, type InputPresencePublisher, type InputPresencePublisherOptions, type InputPresenceState, InvalidDurationError, type MediaSession, type NegotiatorOptions, PermanentLockedError, type PhaseObservable, PinRequiresActiveTempError, Presence, type PrewakeOptions, type PrewakeResult, type PrewakeStatus, ProduceAckTimeoutError, type ReassembledFrame, type ReassemblerCallbacks, type ReassemblerOptions, Recording, RecordingNotFoundError, RecordingsAccessor, RecordingsClient, type RecordingsClientOptions, RecordingsError, RecordingsUnauthorizedError, RequestAbortError, RequestCancelledError, RequestDocSyncError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, RetainNotTempError, type RetentionIntent, RuntimeArtifact, RuntimeArtifactDownload, RuntimeArtifactNotFoundError, RuntimeArtifactsAccessor, RuntimeArtifactsClient, type RuntimeArtifactsClientOptions, RuntimeArtifactsError, RuntimeArtifactsUnauthorizedError, Session, SessionAllocationError, SessionEndError, SessionEndResult, SessionEndUnavailableError, SessionFailedError, SessionFailureKind, Session$1 as SessionInterface, SessionPhase, SessionPhaseName, SessionStatus, SessionStream$1 as SessionStream, type SignalCarrier, type Signaling, Store, StoreOptions, StreamChunkOptions, StreamDirectionConflict, type TransportEstablishedNotify, TransportNegotiator, type TransportOfferRequest, type TransportOfferResponse, TransportSessionSignaling, TransportState, type VideoStreamOptions, WT_CONTROL_FRAME_MAX, WebRtcSession, WebTransportSession, type WhenLiveOptions, WtControlDecoder, type WtControlMessage, createActivityTracker, createInputPresencePublisher, createRecordingsClient, createRuntimeArtifactsClient, createStore, describeSessionFailure, describeSessionPhase, encodeWtControlFrame, isDurationString, isWakingPhase, normalizeRetention, observePageLifecycle, parseDgramHeader, prewake, sessionFailureFromMediaError, sharedCaptureController, videoStream, whenLive, writeDgramHeader };
955
+ export { ACTIVATION_COLD_BOOT_AFTER_MS, ACTIVATION_DEGRADED_AFTER_MS, ACTIVATION_HINT_PATH, ACTIVATION_STILL_AFTER_MS, ACTIVITY_DOM_EVENTS, ACTIVITY_FIELD, ACTIVITY_STAMP_MIN_INTERVAL_MS, ActivationEvent, ActivationMonitor, type ActivationMonitorOptions, type ActivationStreamLike, type ActivityAwareness, type ActivityTracker, type ActivityTrackerOptions, App, App$1 as AppInterface, AppOptions, AttachOptions, BACKOFF_BASE_MS, BACKOFF_MAX_ATTEMPTS, BACKOFF_MAX_MS, type CaptureClaim, CaptureController, type CaptureControllerOptions, type CaptureKind, CaptureUnavailableError, ChunkReadable, type ClientToken, ClientTokenError, type ConsumingTransport, type CreateClientTokenOptions, DEFAULT_DOC_SYNC_TIMEOUT_MS, DEFAULT_GATEWAY_URL, DEFAULT_PRODUCE_ACK_TIMEOUT_MS, DEFAULT_WHEN_LIVE_TIMEOUT_MS, DGRAM_HEADER_BYTES, type DgramHeader, FOREGROUND_COALESCE_MS, FrameReassembler, INPUT_PRESENCE_DEFAULT_HZ, INPUT_PRESENCE_FIELD, type InputPresenceAwareness, type InputPresencePublisher, type InputPresencePublisherOptions, type InputPresenceState, InvalidDurationError, type MediaSession, type NegotiatorOptions, PermanentLockedError, type PhaseObservable, PinRequiresActiveTempError, Presence, type PrewakeOptions, type PrewakeResult, type PrewakeStatus, ProduceAckTimeoutError, type ReassembledFrame, type ReassemblerCallbacks, type ReassemblerOptions, Recording, RecordingNotFoundError, RecordingsAccessor, RecordingsClient, type RecordingsClientOptions, RecordingsError, RecordingsUnauthorizedError, RequestAbortError, RequestCancelledError, RequestDocSyncError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, RetainNotTempError, type RetentionIntent, RuntimeArtifact, RuntimeArtifactDownload, RuntimeArtifactNotFoundError, RuntimeArtifactsAccessor, RuntimeArtifactsClient, type RuntimeArtifactsClientOptions, RuntimeArtifactsError, RuntimeArtifactsUnauthorizedError, Session, SessionAllocationError, SessionDiagnostic, SessionEndError, SessionEndResult, SessionEndUnavailableError, SessionFailedError, SessionFailureKind, Session$1 as SessionInterface, SessionPhase, SessionPhaseName, SessionStatus, SessionStream$1 as SessionStream, type SignalCarrier, type Signaling, Store, StoreOptions, StreamChunkOptions, StreamDirectionConflict, type TransportEstablishedNotify, TransportNegotiator, type TransportOfferRequest, type TransportOfferResponse, TransportSessionSignaling, TransportState, type VideoStreamOptions, WT_CONTROL_FRAME_MAX, WebRtcSession, WebTransportSession, type WhenLiveOptions, WtControlDecoder, type WtControlMessage, activationHintFrom, computeBackoffDelay, createActivityTracker, createClientToken, createInputPresencePublisher, createRecordingsClient, createRuntimeArtifactsClient, createStore, describeSessionFailure, describeSessionPhase, encodeWtControlFrame, isDurationString, isRetryableSessionError, isWakingPhase, normalizeRetention, observePageLifecycle, parseDgramHeader, prewake, sessionFailureFromMediaError, sharedCaptureController, videoStream, whenLive, writeDgramHeader };