@urun-sh/core 0.2.59 → 0.3.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/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { g as AppOptions, f as App$1, a2 as SessionPhase, a8 as SessionStatus, a4 as SessionPhaseName, A as AccessTokenOptions, Q as RuntimeArtifact, S as RuntimeArtifactDownload, R as Recording, Y as Session$1, C as ChannelEndpoint, af as TransportSession, h as AttachOptions, Z as SessionDiagnostic, b as ActivationEvent, a7 as SessionStatsSample, J as RecordingsAccessor, T as RuntimeArtifactsAccessor, a0 as SessionEndResult, a9 as SessionStream$1, ae as StreamDataTransport, $ as SessionDocumentImpl, ad as StreamChunkOptions, m as ChunkReadable, P as Presence, t as DocConnector, u as DocTokenSupplier, N as RequestOptions, O as RequestStreamOptions, ac as StoreOptions, ab as Store, k as ChannelMultiplexer, a1 as SessionFailureKind, ah as TransportState } from './stream-data-B5wxsIPL.mjs';
2
- export { c as ActivationState, i as AudioPlayoutOptions, D as DERIVED_LEG_SEP, q as DerivedLegRole, s as DocConnectionState, I as InboundStatsSample, M as MediaChunkBinding, v as MediaChunkSource, w as MediaChunkSourceFactory, x as MediaRecorderChunkSourceOptions, y as PresenceState, z as PrewakeOptions, B as PrewakeResult, E as PrewakeStatus, F as RecordingBucket, G as RecordingLifecycle, H as RecordingStatus, K as ReleaseSessionBeaconOptions, U as RuntimeAvailability, V as RuntimeWakeDetail, W as RuntimeWakeGolden, X as RuntimeWakeReasonCode, _ as SessionDocument, a3 as SessionPhaseError, a6 as SessionStatsOptions, aa as SessionText, ai as VideoPlayoutOptions, an as derivedLegName, ao as derivedLegRole, ap as isPendingRecording, aq as mediaRecorderChunkSource, ar as prewake, as as releaseSessionBeacon } from './stream-data-B5wxsIPL.mjs';
1
+ import { g as AppOptions, f as App$1, a9 as SessionPhase, af as SessionStatus, ab as SessionPhaseName, A as AccessTokenOptions, X as RuntimeArtifact, Y as RuntimeArtifactDownload, R as Recording, a3 as Session$1, C as ChannelEndpoint, as as TransportSession, h as AttachOptions, a4 as SessionDiagnostic, b as ActivationEvent, ae as SessionStatsSample, T as RecordingsAccessor, Z as RuntimeArtifactsAccessor, a7 as SessionEndResult, ag as SessionStream$1, an as StreamDataTransport, a6 as SessionDocumentImpl, am as StreamChunkOptions, m as ChunkReadable, P as Presence, v as DocConnector, w as DocTokenSupplier, V as RequestOptions, W as RequestStreamOptions, al as StoreOptions, ak as Store, k as ChannelMultiplexer, a8 as SessionFailureKind, B as MediaSession, ar as TransportOfferResponse, az as WtAudioLaneSeam, aA as WtAudioUplinkSeam, aH as WtVideoUplinkSeam, aG as WtDataUplinkSender, aE as WtDataLaneSink, av as TransportState } from './stream-data-ChGPDdoN.mjs';
2
+ export { c as ActivationState, i as AudioPlayoutOptions, D as DERIVED_LEG_SEP, n as DGRAM_HEADER_BYTES, r as DerivedLegRole, s as DgramHeader, u as DocConnectionState, I as InboundStatsSample, M as MediaChunkBinding, x as MediaChunkSource, y as MediaChunkSourceFactory, z as MediaRecorderChunkSourceOptions, N as NegotiatorDataLaneSeam, E as NegotiatorOptions, F as PresenceState, G as PrewakeOptions, H as PrewakeResult, J as PrewakeStatus, Q as QuicStreamDataTransport, K as RecordingBucket, O as RecordingLifecycle, S as RecordingStatus, U as ReleaseSessionBeaconOptions, _ as RuntimeAvailability, $ as RuntimeWakeDetail, a0 as RuntimeWakeGolden, a1 as RuntimeWakeReasonCode, a2 as SIGNALING_PROTOCOL_VERSION, a5 as SessionDocument, aa as SessionPhaseError, ad as SessionStatsOptions, ah as SessionText, ai as SignalCarrier, aj as Signaling, ao as TransportEstablishedNotify, ap as TransportNegotiator, aq as TransportOfferRequest, au as TransportSessionSignaling, aw as VideoPlayoutOptions, ax as WT_CONTROL_FRAME_MAX, ay as WT_DATA_STREAM_VERSION, aB as WtControlDecoder, aC as WtControlMessage, aD as WtDataEnvelope, aF as WtDataStreamParser, aJ as consumeWtDataStreams, aN as derivedLegName, aO as derivedLegRole, aP as encodeWtControlFrame, aQ as isPendingRecording, aR as mediaRecorderChunkSource, aS as parseDgramHeader, aT as prewake, aU as releaseSessionBeacon, aX as writeDgramHeader } from './stream-data-ChGPDdoN.mjs';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
5
5
 
@@ -47,6 +47,8 @@ declare function createClientToken(apiKey: string, options?: CreateClientTokenOp
47
47
 
48
48
  declare function isWakingPhase(phase: SessionPhase | SessionPhaseName | null | undefined): boolean;
49
49
 
50
+ declare function isServerTerminalPhase(phase: SessionPhase | null | undefined): boolean;
51
+
50
52
  interface PhaseObservable {
51
53
 
52
54
  readonly phase: SessionPhase;
@@ -366,6 +368,7 @@ declare class Session implements Session$1 {
366
368
 
367
369
  negotiateMediaTransport(opts?: {
368
370
  allowWebTransport?: boolean;
371
+ allowWebRtcFallback?: boolean;
369
372
  }): void;
370
373
 
371
374
  get mediaTransport(): 'webtransport' | 'webrtc' | null;
@@ -792,233 +795,18 @@ interface CameraWarp {
792
795
  }
793
796
  declare function createCameraWarp(options?: CameraWarpOptions): CameraWarp;
794
797
 
795
- declare const WT_DATA_STREAM_VERSION = 1;
796
-
797
- interface WtDataEnvelope {
798
- name: string;
799
- payload: unknown;
800
- }
801
-
802
- interface WtDataLaneSink {
803
- onData(name: string, payload: unknown): void;
804
- onLaneError(err: Error): void;
805
- }
806
-
807
- interface QuicStreamDataTransport {
808
-
809
- markStreamDataLaneQuic(): void;
810
-
811
- dispatchQuicStreamData(name: string, payload: unknown): void;
812
-
813
- quicStreamDataLaneLost(reason: string): void;
814
-
815
- raiseQuicStreamDataError(err: Error): void;
816
- }
817
-
818
- declare class WtDataStreamParser {
819
- private buf;
820
- private name;
821
- private ended;
822
-
823
- get streamName(): string | null;
824
- push(chunk: Uint8Array): WtDataEnvelope[];
825
-
826
- finish(): void;
827
- }
828
-
829
- interface WtByteReader {
830
- read(): Promise<{
831
- value?: Uint8Array;
832
- done: boolean;
833
- }>;
834
- cancel?(reason?: unknown): Promise<void>;
835
- }
836
- interface WtIncomingUniStream {
837
- getReader(): WtByteReader;
838
- }
839
- interface WtIncomingUniStreams {
840
- getReader(): {
841
- read(): Promise<{
842
- value?: WtIncomingUniStream;
843
- done: boolean;
844
- }>;
845
- };
846
- }
847
-
848
- declare function consumeWtDataStreams(incoming: WtIncomingUniStreams, sink: WtDataLaneSink): Promise<void>;
849
-
850
- interface MediaSession {
851
- readonly kind: 'webtransport' | 'webrtc';
852
- start(): Promise<void>;
853
- stop(): Promise<void>;
854
-
855
- onDead(cb: (reason: string) => void): void;
856
-
857
- stats(): {
858
- recvBps: number;
859
- lossPct: number;
860
- jitterMs: number;
861
- };
862
-
863
- readonly firstMedia: Promise<void>;
864
-
865
- consumeDataStreams?(sink: WtDataLaneSink): void;
866
- }
867
-
868
- interface Signaling {
869
- request<T = unknown>(method: string, params?: unknown): Promise<T>;
870
- notify(method: string, params?: unknown): void;
871
-
872
- on(method: string, handler: (params: Record<string, unknown>) => void): () => void;
873
- }
874
-
875
- interface SignalCarrier {
876
-
877
- sendSignal(msg: Record<string, unknown>): void;
878
-
879
- onSignal(handler: (msg: Record<string, unknown>) => void): () => void;
880
- }
881
- declare class TransportSessionSignaling implements Signaling {
882
- private carrier;
883
- private requestTimeoutMs;
884
- constructor(carrier: SignalCarrier, requestTimeoutMs?: number);
885
- request<T = unknown>(method: string, params?: unknown): Promise<T>;
886
- notify(method: string, params?: unknown): void;
887
- on(method: string, handler: (params: Record<string, unknown>) => void): () => void;
888
- }
889
-
890
- interface TransportOfferRequest {
891
- sessionId: string;
892
- capabilities: {
893
-
894
- webtransport: boolean;
895
-
896
- webcodecs: boolean;
897
-
898
- codecs: string[];
899
-
900
- wtData?: boolean;
901
- };
902
- }
903
- interface TransportOfferResponse {
904
-
905
- webrtc: {
906
- routerRtpCapabilities: unknown;
907
- };
908
-
909
- webtransport?: {
910
- url: string;
911
-
912
- certHashes: string[];
913
-
914
- token: string;
915
- codec: string;
916
-
917
- data?: boolean;
918
- };
919
- }
920
- interface TransportEstablishedNotify {
921
- sessionId: string;
922
- transport: 'webtransport' | 'webrtc';
923
-
924
- fallbackReason?: string;
925
- }
926
- type WtControlMessage = {
927
- t: 'hello';
928
- token: string;
929
- sessionId: string;
930
- } | {
931
- t: 'hello-ack';
932
- codec: string;
933
- width: number;
934
- height: number;
935
- } | {
936
- t: 'ping';
937
- ts: number;
938
- } | {
939
- t: 'pong';
940
- ts: number;
941
- } | {
942
- t: 'keyframe-request';
943
- } | {
944
- t: 'feedback';
945
- recvBps: number;
946
- lossPct: number;
947
- jitterMs: number;
948
- };
949
-
950
- declare const WT_CONTROL_FRAME_MAX: number;
951
-
952
- declare function encodeWtControlFrame(msg: WtControlMessage): Uint8Array;
953
-
954
- declare class WtControlDecoder {
955
- private buf;
956
- push(bytes: Uint8Array): WtControlMessage[];
957
- }
958
- declare const DGRAM_HEADER_BYTES = 12;
959
- interface DgramHeader {
960
- groupId: number;
961
- frameSeq: number;
962
- keyframe: boolean;
963
- fragIndex: number;
964
- fragCount: number;
965
- }
966
-
967
- declare function parseDgramHeader(view: DataView): DgramHeader;
968
-
969
- declare function writeDgramHeader(h: DgramHeader): Uint8Array;
970
-
971
- interface NegotiatorDataLaneSeam {
972
-
973
- onData(name: string, payload: unknown): void;
974
-
975
- onQuicLane(): void;
976
-
977
- onQuicLaneLost(reason: string): void;
978
-
979
- onLaneError(err: Error): void;
980
- }
981
- interface NegotiatorOptions {
982
-
983
- quicDeadlineMs?: number;
984
-
985
- allowWebTransport?: boolean;
986
- onTransportChange?: (kind: MediaSession['kind'], reason?: string) => void;
987
-
988
- canvas?: HTMLCanvasElement;
989
-
990
- createWebRtcSession: () => MediaSession;
991
- createWebTransportSession?: (offer: NonNullable<TransportOfferResponse['webtransport']>) => MediaSession;
992
-
993
- dataLane?: NegotiatorDataLaneSeam;
994
- }
995
- declare class TransportNegotiator {
996
- private signaling;
997
- private sessionId;
998
- private opts;
999
- private session;
798
+ declare class WebTransportSession implements MediaSession {
1000
799
  private offer;
800
+ private sessionId;
801
+ private canvas;
1001
802
 
1002
- private quicDataLane;
1003
- constructor(signaling: Signaling, sessionId: string, opts: NegotiatorOptions);
1004
- get activeTransport(): MediaSession['kind'] | null;
1005
- connect(): Promise<MediaSession>;
1006
- disconnect(): Promise<void>;
803
+ private audioLane?;
1007
804
 
1008
- retryWebTransport(): Promise<MediaSession | null>;
805
+ private audioUplink?;
1009
806
 
1010
- private engageQuicDataLane;
1011
- private createWebTransportSession;
1012
- private startWebRtc;
807
+ private videoUplink?;
1013
808
 
1014
- private armFailover;
1015
- private notifyEstablished;
1016
- }
1017
-
1018
- declare class WebTransportSession implements MediaSession {
1019
- private offer;
1020
- private sessionId;
1021
- private canvas;
809
+ private dataUplink?;
1022
810
  readonly kind: "webtransport";
1023
811
  private wt;
1024
812
  private decoder;
@@ -1037,17 +825,40 @@ declare class WebTransportSession implements MediaSession {
1037
825
  private lastStats;
1038
826
 
1039
827
  private dataLaneSink;
828
+
829
+ private audioPlayout;
830
+
831
+ private audioUplinkLane;
832
+
833
+ private videoUplinkLane;
834
+
835
+ private dataUplinkSender;
1040
836
  private firstFrameResolve;
1041
837
  private firstFrameReject;
1042
838
 
1043
839
  private firstFrameOutput;
840
+
841
+ private hasVideoLane;
1044
842
  private firstDecodeTimer;
1045
843
 
1046
844
  readonly firstMedia: Promise<void>;
1047
- constructor(offer: NonNullable<TransportOfferResponse['webtransport']>, sessionId: string, canvas: HTMLCanvasElement);
845
+ constructor(offer: NonNullable<TransportOfferResponse['webtransport']>, sessionId: string, canvas: HTMLCanvasElement,
846
+
847
+ audioLane?: WtAudioLaneSeam | undefined,
848
+
849
+ audioUplink?: WtAudioUplinkSeam | undefined,
850
+
851
+ videoUplink?: WtVideoUplinkSeam | undefined,
852
+
853
+ dataUplink?: {
854
+ onUplink(sender: WtDataUplinkSender): void;
855
+ onUplinkLost(reason: string): void;
856
+ } | undefined);
1048
857
 
1049
858
  start(): Promise<void>;
1050
859
  stop(): Promise<void>;
860
+
861
+ private dropUplinks;
1051
862
  onDead(cb: (reason: string) => void): void;
1052
863
  stats(): {
1053
864
  recvBps: number;
@@ -1146,4 +957,4 @@ declare class FrameReassembler {
1146
957
  private requestKeyframe;
1147
958
  }
1148
959
 
1149
- 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 CameraWarp, type CameraWarpOptions, type CameraWarpTransform, type CaptureClaim, CaptureController, type CaptureControllerOptions, type CaptureKind, CaptureUnavailableError, ChunkReadable, type ClientToken, ClientTokenError, type ConsumingTransport, type CreateClientTokenOptions, DATA_CHANNEL_MESSAGE_CEILING, DEFAULT_DOC_SYNC_TIMEOUT_MS, DEFAULT_GATEWAY_URL, DEFAULT_PRODUCE_ACK_TIMEOUT_MS, DEFAULT_REFERENCE_JPEG_QUALITY, DEFAULT_REFERENCE_MAX_SIZE, DEFAULT_WHEN_LIVE_TIMEOUT_MS, DGRAM_HEADER_BYTES, type DgramHeader, DocTokenSupplier, FOREGROUND_COALESCE_MS, FrameReassembler, INPUT_PRESENCE_DEFAULT_HZ, INPUT_PRESENCE_FIELD, type InputPresenceAwareness, type InputPresencePublisher, type InputPresencePublisherOptions, type InputPresenceState, InvalidDurationError, LEGACY_ACTIVATION_HINT_PATH, type MediaSession, type NegotiatorDataLaneSeam, type NegotiatorOptions, type NormalizeReferenceImageOptions, PLATFORM_DOC_NAME, PermanentLockedError, type PhaseObservable, PinRequiresActiveTempError, Presence, ProduceAckTimeoutError, type QuicStreamDataTransport, type ReassembledFrame, type ReassemblerCallbacks, type ReassemblerOptions, Recording, RecordingNotFoundError, RecordingsAccessor, RecordingsClient, type RecordingsClientOptions, RecordingsError, RecordingsUnauthorizedError, type ReferenceImage, type ReferenceImageSource, type ReferenceImageType, 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, SessionStatsSample, SessionStatus, SessionStream$1 as SessionStream, type SignalCarrier, type Signaling, Store, StoreOptions, StreamChunkOptions, StreamDirectionConflict, type TransportEstablishedNotify, TransportNegotiator, type TransportOfferRequest, type TransportOfferResponse, TransportSessionMismatchError, TransportSessionSignaling, TransportState, URUN_DEV_ENV, VISIBILITY_FIELD, type VideoStreamOptions, WIRE_MESSAGE_BUDGET, WT_CONTROL_FRAME_MAX, WT_DATA_STREAM_VERSION, WebRtcSession, WebTransportSession, type WhenLiveOptions, WtControlDecoder, type WtControlMessage, type WtDataEnvelope, type WtDataLaneSink, WtDataStreamParser, activationHintFrom, cameraCaptureAvailable, captureStillFromVideo, computeBackoffDelay, consumeWtDataStreams, createActivityTracker, createCameraWarp, createClientToken, createInputPresencePublisher, createRecordingsClient, createRuntimeArtifactsClient, createStore, describeSessionFailure, describeSessionPhase, encodeWtControlFrame, fitWithin, isDurationString, isRetryableSessionError, isWakingPhase, normalizeReferenceImage, normalizeRetention, observeLeaveConfirm, observePageLifecycle, observePageTeardown, parseDgramHeader, referenceImageErrorMessage, sessionFailureFromMediaError, sharedCaptureController, videoStream, whenLive, writeDgramHeader };
960
+ 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 CameraWarp, type CameraWarpOptions, type CameraWarpTransform, type CaptureClaim, CaptureController, type CaptureControllerOptions, type CaptureKind, CaptureUnavailableError, ChunkReadable, type ClientToken, ClientTokenError, type ConsumingTransport, type CreateClientTokenOptions, DATA_CHANNEL_MESSAGE_CEILING, DEFAULT_DOC_SYNC_TIMEOUT_MS, DEFAULT_GATEWAY_URL, DEFAULT_PRODUCE_ACK_TIMEOUT_MS, DEFAULT_REFERENCE_JPEG_QUALITY, DEFAULT_REFERENCE_MAX_SIZE, DEFAULT_WHEN_LIVE_TIMEOUT_MS, DocTokenSupplier, FOREGROUND_COALESCE_MS, FrameReassembler, INPUT_PRESENCE_DEFAULT_HZ, INPUT_PRESENCE_FIELD, type InputPresenceAwareness, type InputPresencePublisher, type InputPresencePublisherOptions, type InputPresenceState, InvalidDurationError, LEGACY_ACTIVATION_HINT_PATH, MediaSession, type NormalizeReferenceImageOptions, PLATFORM_DOC_NAME, PermanentLockedError, type PhaseObservable, PinRequiresActiveTempError, Presence, ProduceAckTimeoutError, type ReassembledFrame, type ReassemblerCallbacks, type ReassemblerOptions, Recording, RecordingNotFoundError, RecordingsAccessor, RecordingsClient, type RecordingsClientOptions, RecordingsError, RecordingsUnauthorizedError, type ReferenceImage, type ReferenceImageSource, type ReferenceImageType, 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, SessionStatsSample, SessionStatus, SessionStream$1 as SessionStream, Store, StoreOptions, StreamChunkOptions, StreamDirectionConflict, TransportOfferResponse, TransportSessionMismatchError, TransportState, URUN_DEV_ENV, VISIBILITY_FIELD, type VideoStreamOptions, WIRE_MESSAGE_BUDGET, WebRtcSession, WebTransportSession, type WhenLiveOptions, WtDataLaneSink, activationHintFrom, cameraCaptureAvailable, captureStillFromVideo, computeBackoffDelay, createActivityTracker, createCameraWarp, createClientToken, createInputPresencePublisher, createRecordingsClient, createRuntimeArtifactsClient, createStore, describeSessionFailure, describeSessionPhase, fitWithin, isDurationString, isRetryableSessionError, isServerTerminalPhase, isWakingPhase, normalizeReferenceImage, normalizeRetention, observeLeaveConfirm, observePageLifecycle, observePageTeardown, referenceImageErrorMessage, sessionFailureFromMediaError, sharedCaptureController, videoStream, whenLive };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { g as AppOptions, f as App$1, a2 as SessionPhase, a8 as SessionStatus, a4 as SessionPhaseName, A as AccessTokenOptions, Q as RuntimeArtifact, S as RuntimeArtifactDownload, R as Recording, Y as Session$1, C as ChannelEndpoint, af as TransportSession, h as AttachOptions, Z as SessionDiagnostic, b as ActivationEvent, a7 as SessionStatsSample, J as RecordingsAccessor, T as RuntimeArtifactsAccessor, a0 as SessionEndResult, a9 as SessionStream$1, ae as StreamDataTransport, $ as SessionDocumentImpl, ad as StreamChunkOptions, m as ChunkReadable, P as Presence, t as DocConnector, u as DocTokenSupplier, N as RequestOptions, O as RequestStreamOptions, ac as StoreOptions, ab as Store, k as ChannelMultiplexer, a1 as SessionFailureKind, ah as TransportState } from './stream-data-B5wxsIPL.js';
2
- export { c as ActivationState, i as AudioPlayoutOptions, D as DERIVED_LEG_SEP, q as DerivedLegRole, s as DocConnectionState, I as InboundStatsSample, M as MediaChunkBinding, v as MediaChunkSource, w as MediaChunkSourceFactory, x as MediaRecorderChunkSourceOptions, y as PresenceState, z as PrewakeOptions, B as PrewakeResult, E as PrewakeStatus, F as RecordingBucket, G as RecordingLifecycle, H as RecordingStatus, K as ReleaseSessionBeaconOptions, U as RuntimeAvailability, V as RuntimeWakeDetail, W as RuntimeWakeGolden, X as RuntimeWakeReasonCode, _ as SessionDocument, a3 as SessionPhaseError, a6 as SessionStatsOptions, aa as SessionText, ai as VideoPlayoutOptions, an as derivedLegName, ao as derivedLegRole, ap as isPendingRecording, aq as mediaRecorderChunkSource, ar as prewake, as as releaseSessionBeacon } from './stream-data-B5wxsIPL.js';
1
+ import { g as AppOptions, f as App$1, a9 as SessionPhase, af as SessionStatus, ab as SessionPhaseName, A as AccessTokenOptions, X as RuntimeArtifact, Y as RuntimeArtifactDownload, R as Recording, a3 as Session$1, C as ChannelEndpoint, as as TransportSession, h as AttachOptions, a4 as SessionDiagnostic, b as ActivationEvent, ae as SessionStatsSample, T as RecordingsAccessor, Z as RuntimeArtifactsAccessor, a7 as SessionEndResult, ag as SessionStream$1, an as StreamDataTransport, a6 as SessionDocumentImpl, am as StreamChunkOptions, m as ChunkReadable, P as Presence, v as DocConnector, w as DocTokenSupplier, V as RequestOptions, W as RequestStreamOptions, al as StoreOptions, ak as Store, k as ChannelMultiplexer, a8 as SessionFailureKind, B as MediaSession, ar as TransportOfferResponse, az as WtAudioLaneSeam, aA as WtAudioUplinkSeam, aH as WtVideoUplinkSeam, aG as WtDataUplinkSender, aE as WtDataLaneSink, av as TransportState } from './stream-data-ChGPDdoN.js';
2
+ export { c as ActivationState, i as AudioPlayoutOptions, D as DERIVED_LEG_SEP, n as DGRAM_HEADER_BYTES, r as DerivedLegRole, s as DgramHeader, u as DocConnectionState, I as InboundStatsSample, M as MediaChunkBinding, x as MediaChunkSource, y as MediaChunkSourceFactory, z as MediaRecorderChunkSourceOptions, N as NegotiatorDataLaneSeam, E as NegotiatorOptions, F as PresenceState, G as PrewakeOptions, H as PrewakeResult, J as PrewakeStatus, Q as QuicStreamDataTransport, K as RecordingBucket, O as RecordingLifecycle, S as RecordingStatus, U as ReleaseSessionBeaconOptions, _ as RuntimeAvailability, $ as RuntimeWakeDetail, a0 as RuntimeWakeGolden, a1 as RuntimeWakeReasonCode, a2 as SIGNALING_PROTOCOL_VERSION, a5 as SessionDocument, aa as SessionPhaseError, ad as SessionStatsOptions, ah as SessionText, ai as SignalCarrier, aj as Signaling, ao as TransportEstablishedNotify, ap as TransportNegotiator, aq as TransportOfferRequest, au as TransportSessionSignaling, aw as VideoPlayoutOptions, ax as WT_CONTROL_FRAME_MAX, ay as WT_DATA_STREAM_VERSION, aB as WtControlDecoder, aC as WtControlMessage, aD as WtDataEnvelope, aF as WtDataStreamParser, aJ as consumeWtDataStreams, aN as derivedLegName, aO as derivedLegRole, aP as encodeWtControlFrame, aQ as isPendingRecording, aR as mediaRecorderChunkSource, aS as parseDgramHeader, aT as prewake, aU as releaseSessionBeacon, aX as writeDgramHeader } from './stream-data-ChGPDdoN.js';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
5
5
 
@@ -47,6 +47,8 @@ declare function createClientToken(apiKey: string, options?: CreateClientTokenOp
47
47
 
48
48
  declare function isWakingPhase(phase: SessionPhase | SessionPhaseName | null | undefined): boolean;
49
49
 
50
+ declare function isServerTerminalPhase(phase: SessionPhase | null | undefined): boolean;
51
+
50
52
  interface PhaseObservable {
51
53
 
52
54
  readonly phase: SessionPhase;
@@ -366,6 +368,7 @@ declare class Session implements Session$1 {
366
368
 
367
369
  negotiateMediaTransport(opts?: {
368
370
  allowWebTransport?: boolean;
371
+ allowWebRtcFallback?: boolean;
369
372
  }): void;
370
373
 
371
374
  get mediaTransport(): 'webtransport' | 'webrtc' | null;
@@ -792,233 +795,18 @@ interface CameraWarp {
792
795
  }
793
796
  declare function createCameraWarp(options?: CameraWarpOptions): CameraWarp;
794
797
 
795
- declare const WT_DATA_STREAM_VERSION = 1;
796
-
797
- interface WtDataEnvelope {
798
- name: string;
799
- payload: unknown;
800
- }
801
-
802
- interface WtDataLaneSink {
803
- onData(name: string, payload: unknown): void;
804
- onLaneError(err: Error): void;
805
- }
806
-
807
- interface QuicStreamDataTransport {
808
-
809
- markStreamDataLaneQuic(): void;
810
-
811
- dispatchQuicStreamData(name: string, payload: unknown): void;
812
-
813
- quicStreamDataLaneLost(reason: string): void;
814
-
815
- raiseQuicStreamDataError(err: Error): void;
816
- }
817
-
818
- declare class WtDataStreamParser {
819
- private buf;
820
- private name;
821
- private ended;
822
-
823
- get streamName(): string | null;
824
- push(chunk: Uint8Array): WtDataEnvelope[];
825
-
826
- finish(): void;
827
- }
828
-
829
- interface WtByteReader {
830
- read(): Promise<{
831
- value?: Uint8Array;
832
- done: boolean;
833
- }>;
834
- cancel?(reason?: unknown): Promise<void>;
835
- }
836
- interface WtIncomingUniStream {
837
- getReader(): WtByteReader;
838
- }
839
- interface WtIncomingUniStreams {
840
- getReader(): {
841
- read(): Promise<{
842
- value?: WtIncomingUniStream;
843
- done: boolean;
844
- }>;
845
- };
846
- }
847
-
848
- declare function consumeWtDataStreams(incoming: WtIncomingUniStreams, sink: WtDataLaneSink): Promise<void>;
849
-
850
- interface MediaSession {
851
- readonly kind: 'webtransport' | 'webrtc';
852
- start(): Promise<void>;
853
- stop(): Promise<void>;
854
-
855
- onDead(cb: (reason: string) => void): void;
856
-
857
- stats(): {
858
- recvBps: number;
859
- lossPct: number;
860
- jitterMs: number;
861
- };
862
-
863
- readonly firstMedia: Promise<void>;
864
-
865
- consumeDataStreams?(sink: WtDataLaneSink): void;
866
- }
867
-
868
- interface Signaling {
869
- request<T = unknown>(method: string, params?: unknown): Promise<T>;
870
- notify(method: string, params?: unknown): void;
871
-
872
- on(method: string, handler: (params: Record<string, unknown>) => void): () => void;
873
- }
874
-
875
- interface SignalCarrier {
876
-
877
- sendSignal(msg: Record<string, unknown>): void;
878
-
879
- onSignal(handler: (msg: Record<string, unknown>) => void): () => void;
880
- }
881
- declare class TransportSessionSignaling implements Signaling {
882
- private carrier;
883
- private requestTimeoutMs;
884
- constructor(carrier: SignalCarrier, requestTimeoutMs?: number);
885
- request<T = unknown>(method: string, params?: unknown): Promise<T>;
886
- notify(method: string, params?: unknown): void;
887
- on(method: string, handler: (params: Record<string, unknown>) => void): () => void;
888
- }
889
-
890
- interface TransportOfferRequest {
891
- sessionId: string;
892
- capabilities: {
893
-
894
- webtransport: boolean;
895
-
896
- webcodecs: boolean;
897
-
898
- codecs: string[];
899
-
900
- wtData?: boolean;
901
- };
902
- }
903
- interface TransportOfferResponse {
904
-
905
- webrtc: {
906
- routerRtpCapabilities: unknown;
907
- };
908
-
909
- webtransport?: {
910
- url: string;
911
-
912
- certHashes: string[];
913
-
914
- token: string;
915
- codec: string;
916
-
917
- data?: boolean;
918
- };
919
- }
920
- interface TransportEstablishedNotify {
921
- sessionId: string;
922
- transport: 'webtransport' | 'webrtc';
923
-
924
- fallbackReason?: string;
925
- }
926
- type WtControlMessage = {
927
- t: 'hello';
928
- token: string;
929
- sessionId: string;
930
- } | {
931
- t: 'hello-ack';
932
- codec: string;
933
- width: number;
934
- height: number;
935
- } | {
936
- t: 'ping';
937
- ts: number;
938
- } | {
939
- t: 'pong';
940
- ts: number;
941
- } | {
942
- t: 'keyframe-request';
943
- } | {
944
- t: 'feedback';
945
- recvBps: number;
946
- lossPct: number;
947
- jitterMs: number;
948
- };
949
-
950
- declare const WT_CONTROL_FRAME_MAX: number;
951
-
952
- declare function encodeWtControlFrame(msg: WtControlMessage): Uint8Array;
953
-
954
- declare class WtControlDecoder {
955
- private buf;
956
- push(bytes: Uint8Array): WtControlMessage[];
957
- }
958
- declare const DGRAM_HEADER_BYTES = 12;
959
- interface DgramHeader {
960
- groupId: number;
961
- frameSeq: number;
962
- keyframe: boolean;
963
- fragIndex: number;
964
- fragCount: number;
965
- }
966
-
967
- declare function parseDgramHeader(view: DataView): DgramHeader;
968
-
969
- declare function writeDgramHeader(h: DgramHeader): Uint8Array;
970
-
971
- interface NegotiatorDataLaneSeam {
972
-
973
- onData(name: string, payload: unknown): void;
974
-
975
- onQuicLane(): void;
976
-
977
- onQuicLaneLost(reason: string): void;
978
-
979
- onLaneError(err: Error): void;
980
- }
981
- interface NegotiatorOptions {
982
-
983
- quicDeadlineMs?: number;
984
-
985
- allowWebTransport?: boolean;
986
- onTransportChange?: (kind: MediaSession['kind'], reason?: string) => void;
987
-
988
- canvas?: HTMLCanvasElement;
989
-
990
- createWebRtcSession: () => MediaSession;
991
- createWebTransportSession?: (offer: NonNullable<TransportOfferResponse['webtransport']>) => MediaSession;
992
-
993
- dataLane?: NegotiatorDataLaneSeam;
994
- }
995
- declare class TransportNegotiator {
996
- private signaling;
997
- private sessionId;
998
- private opts;
999
- private session;
798
+ declare class WebTransportSession implements MediaSession {
1000
799
  private offer;
800
+ private sessionId;
801
+ private canvas;
1001
802
 
1002
- private quicDataLane;
1003
- constructor(signaling: Signaling, sessionId: string, opts: NegotiatorOptions);
1004
- get activeTransport(): MediaSession['kind'] | null;
1005
- connect(): Promise<MediaSession>;
1006
- disconnect(): Promise<void>;
803
+ private audioLane?;
1007
804
 
1008
- retryWebTransport(): Promise<MediaSession | null>;
805
+ private audioUplink?;
1009
806
 
1010
- private engageQuicDataLane;
1011
- private createWebTransportSession;
1012
- private startWebRtc;
807
+ private videoUplink?;
1013
808
 
1014
- private armFailover;
1015
- private notifyEstablished;
1016
- }
1017
-
1018
- declare class WebTransportSession implements MediaSession {
1019
- private offer;
1020
- private sessionId;
1021
- private canvas;
809
+ private dataUplink?;
1022
810
  readonly kind: "webtransport";
1023
811
  private wt;
1024
812
  private decoder;
@@ -1037,17 +825,40 @@ declare class WebTransportSession implements MediaSession {
1037
825
  private lastStats;
1038
826
 
1039
827
  private dataLaneSink;
828
+
829
+ private audioPlayout;
830
+
831
+ private audioUplinkLane;
832
+
833
+ private videoUplinkLane;
834
+
835
+ private dataUplinkSender;
1040
836
  private firstFrameResolve;
1041
837
  private firstFrameReject;
1042
838
 
1043
839
  private firstFrameOutput;
840
+
841
+ private hasVideoLane;
1044
842
  private firstDecodeTimer;
1045
843
 
1046
844
  readonly firstMedia: Promise<void>;
1047
- constructor(offer: NonNullable<TransportOfferResponse['webtransport']>, sessionId: string, canvas: HTMLCanvasElement);
845
+ constructor(offer: NonNullable<TransportOfferResponse['webtransport']>, sessionId: string, canvas: HTMLCanvasElement,
846
+
847
+ audioLane?: WtAudioLaneSeam | undefined,
848
+
849
+ audioUplink?: WtAudioUplinkSeam | undefined,
850
+
851
+ videoUplink?: WtVideoUplinkSeam | undefined,
852
+
853
+ dataUplink?: {
854
+ onUplink(sender: WtDataUplinkSender): void;
855
+ onUplinkLost(reason: string): void;
856
+ } | undefined);
1048
857
 
1049
858
  start(): Promise<void>;
1050
859
  stop(): Promise<void>;
860
+
861
+ private dropUplinks;
1051
862
  onDead(cb: (reason: string) => void): void;
1052
863
  stats(): {
1053
864
  recvBps: number;
@@ -1146,4 +957,4 @@ declare class FrameReassembler {
1146
957
  private requestKeyframe;
1147
958
  }
1148
959
 
1149
- 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 CameraWarp, type CameraWarpOptions, type CameraWarpTransform, type CaptureClaim, CaptureController, type CaptureControllerOptions, type CaptureKind, CaptureUnavailableError, ChunkReadable, type ClientToken, ClientTokenError, type ConsumingTransport, type CreateClientTokenOptions, DATA_CHANNEL_MESSAGE_CEILING, DEFAULT_DOC_SYNC_TIMEOUT_MS, DEFAULT_GATEWAY_URL, DEFAULT_PRODUCE_ACK_TIMEOUT_MS, DEFAULT_REFERENCE_JPEG_QUALITY, DEFAULT_REFERENCE_MAX_SIZE, DEFAULT_WHEN_LIVE_TIMEOUT_MS, DGRAM_HEADER_BYTES, type DgramHeader, DocTokenSupplier, FOREGROUND_COALESCE_MS, FrameReassembler, INPUT_PRESENCE_DEFAULT_HZ, INPUT_PRESENCE_FIELD, type InputPresenceAwareness, type InputPresencePublisher, type InputPresencePublisherOptions, type InputPresenceState, InvalidDurationError, LEGACY_ACTIVATION_HINT_PATH, type MediaSession, type NegotiatorDataLaneSeam, type NegotiatorOptions, type NormalizeReferenceImageOptions, PLATFORM_DOC_NAME, PermanentLockedError, type PhaseObservable, PinRequiresActiveTempError, Presence, ProduceAckTimeoutError, type QuicStreamDataTransport, type ReassembledFrame, type ReassemblerCallbacks, type ReassemblerOptions, Recording, RecordingNotFoundError, RecordingsAccessor, RecordingsClient, type RecordingsClientOptions, RecordingsError, RecordingsUnauthorizedError, type ReferenceImage, type ReferenceImageSource, type ReferenceImageType, 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, SessionStatsSample, SessionStatus, SessionStream$1 as SessionStream, type SignalCarrier, type Signaling, Store, StoreOptions, StreamChunkOptions, StreamDirectionConflict, type TransportEstablishedNotify, TransportNegotiator, type TransportOfferRequest, type TransportOfferResponse, TransportSessionMismatchError, TransportSessionSignaling, TransportState, URUN_DEV_ENV, VISIBILITY_FIELD, type VideoStreamOptions, WIRE_MESSAGE_BUDGET, WT_CONTROL_FRAME_MAX, WT_DATA_STREAM_VERSION, WebRtcSession, WebTransportSession, type WhenLiveOptions, WtControlDecoder, type WtControlMessage, type WtDataEnvelope, type WtDataLaneSink, WtDataStreamParser, activationHintFrom, cameraCaptureAvailable, captureStillFromVideo, computeBackoffDelay, consumeWtDataStreams, createActivityTracker, createCameraWarp, createClientToken, createInputPresencePublisher, createRecordingsClient, createRuntimeArtifactsClient, createStore, describeSessionFailure, describeSessionPhase, encodeWtControlFrame, fitWithin, isDurationString, isRetryableSessionError, isWakingPhase, normalizeReferenceImage, normalizeRetention, observeLeaveConfirm, observePageLifecycle, observePageTeardown, parseDgramHeader, referenceImageErrorMessage, sessionFailureFromMediaError, sharedCaptureController, videoStream, whenLive, writeDgramHeader };
960
+ 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 CameraWarp, type CameraWarpOptions, type CameraWarpTransform, type CaptureClaim, CaptureController, type CaptureControllerOptions, type CaptureKind, CaptureUnavailableError, ChunkReadable, type ClientToken, ClientTokenError, type ConsumingTransport, type CreateClientTokenOptions, DATA_CHANNEL_MESSAGE_CEILING, DEFAULT_DOC_SYNC_TIMEOUT_MS, DEFAULT_GATEWAY_URL, DEFAULT_PRODUCE_ACK_TIMEOUT_MS, DEFAULT_REFERENCE_JPEG_QUALITY, DEFAULT_REFERENCE_MAX_SIZE, DEFAULT_WHEN_LIVE_TIMEOUT_MS, DocTokenSupplier, FOREGROUND_COALESCE_MS, FrameReassembler, INPUT_PRESENCE_DEFAULT_HZ, INPUT_PRESENCE_FIELD, type InputPresenceAwareness, type InputPresencePublisher, type InputPresencePublisherOptions, type InputPresenceState, InvalidDurationError, LEGACY_ACTIVATION_HINT_PATH, MediaSession, type NormalizeReferenceImageOptions, PLATFORM_DOC_NAME, PermanentLockedError, type PhaseObservable, PinRequiresActiveTempError, Presence, ProduceAckTimeoutError, type ReassembledFrame, type ReassemblerCallbacks, type ReassemblerOptions, Recording, RecordingNotFoundError, RecordingsAccessor, RecordingsClient, type RecordingsClientOptions, RecordingsError, RecordingsUnauthorizedError, type ReferenceImage, type ReferenceImageSource, type ReferenceImageType, 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, SessionStatsSample, SessionStatus, SessionStream$1 as SessionStream, Store, StoreOptions, StreamChunkOptions, StreamDirectionConflict, TransportOfferResponse, TransportSessionMismatchError, TransportState, URUN_DEV_ENV, VISIBILITY_FIELD, type VideoStreamOptions, WIRE_MESSAGE_BUDGET, WebRtcSession, WebTransportSession, type WhenLiveOptions, WtDataLaneSink, activationHintFrom, cameraCaptureAvailable, captureStillFromVideo, computeBackoffDelay, createActivityTracker, createCameraWarp, createClientToken, createInputPresencePublisher, createRecordingsClient, createRuntimeArtifactsClient, createStore, describeSessionFailure, describeSessionPhase, fitWithin, isDurationString, isRetryableSessionError, isServerTerminalPhase, isWakingPhase, normalizeReferenceImage, normalizeRetention, observeLeaveConfirm, observePageLifecycle, observePageTeardown, referenceImageErrorMessage, sessionFailureFromMediaError, sharedCaptureController, videoStream, whenLive };