@urun-sh/core 0.2.3 → 0.2.5

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/internal.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,b as r,c as o,d as t,e as a,g as n,h as p,i as s,j as m,l as c,m as i,n as f,o as x}from"./chunk-O4WPKVLL.mjs";export{e as ChannelMultiplexer,r as DeferredChannelMultiplexer,f as DeferredDocConnector,n as LoopbackStreamData,m as TransportSession,x as createPresence,i as createWebsocketDocConnector,c as deriveYjsServerUrl,a as ensureNodeWebRTC,o as isNodeRuntime,t as nodeMediasoupHandlerName,s as streamDataLabel,p as transportStreamData};
1
+ import{a as e,b as r,c as o,d as t,e as a,g as n,h as p,i as s,j as m,l as c,m as i,n as f,o as x}from"./chunk-XOU67U3G.mjs";export{e as ChannelMultiplexer,r as DeferredChannelMultiplexer,f as DeferredDocConnector,n as LoopbackStreamData,m as TransportSession,x as createPresence,i as createWebsocketDocConnector,c as deriveYjsServerUrl,a as ensureNodeWebRTC,o as isNodeRuntime,t as nodeMediasoupHandlerName,s as streamDataLabel,p as transportStreamData};
@@ -95,6 +95,19 @@ type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiati
95
95
 
96
96
  type SessionPhaseName = 'idle' | 'queued' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended';
97
97
 
98
+ type SessionFailureKind = 'create-failed' | 'never-live' | 'transport-failed' | 'media-permission' | 'ended';
99
+
100
+ interface SessionPhaseError {
101
+
102
+ reason: string;
103
+
104
+ code?: string;
105
+
106
+ kind?: SessionFailureKind;
107
+
108
+ httpStatus?: number;
109
+ }
110
+
98
111
  interface SessionPhase {
99
112
 
100
113
  name: SessionPhaseName;
@@ -108,10 +121,29 @@ interface SessionPhase {
108
121
 
109
122
  sessionId?: string;
110
123
 
111
- error?: {
112
- reason: string;
113
- code?: string;
124
+ error?: SessionPhaseError;
125
+ }
126
+
127
+ interface SessionStatus {
128
+
129
+ phase: SessionPhaseName;
130
+
131
+ transportState: TransportState;
132
+
133
+ sessionId?: string;
134
+
135
+ requestId?: string;
136
+
137
+ lastServerStatus?: string;
138
+
139
+ elapsedMs?: number;
140
+
141
+ queue?: {
142
+ position: number;
143
+ depth: number;
114
144
  };
145
+
146
+ error?: SessionPhaseError;
115
147
  }
116
148
 
117
149
  interface TransportSessionOptions {
@@ -314,6 +346,8 @@ interface Session {
314
346
 
315
347
  readonly phase: SessionPhase;
316
348
 
349
+ readonly status: SessionStatus;
350
+
317
351
  stream(name: string): SessionStream;
318
352
 
319
353
  doc(key: string): SessionDocument;
@@ -328,6 +362,11 @@ interface Session {
328
362
 
329
363
  onPhase(handler: (phase: SessionPhase) => void): () => void;
330
364
 
365
+ whenLive(options?: {
366
+ timeout?: number;
367
+ signal?: AbortSignal;
368
+ }): Promise<void>;
369
+
331
370
  readonly recordings: RecordingsAccessor;
332
371
 
333
372
  readonly artifacts: RuntimeArtifactsAccessor;
@@ -551,14 +590,12 @@ declare class TransportSession {
551
590
  private _intentionalDisconnect;
552
591
  private _reconnectTimer;
553
592
 
593
+ private _cancelPendingDial;
594
+
554
595
  private _stableResetTimer;
555
596
  private _generation;
556
597
  private _lastStartOptions;
557
598
  private _resolveConnection;
558
- private _recvTransportMsg;
559
- private _lastConsumeMsg;
560
- private _recvConnectWatchdog;
561
- private _recvTcpFailoverDone;
562
599
  private _recvIceRestartAttempts;
563
600
  private _recvIceRestartTimer;
564
601
  private _sendIceRestartAttempts;
@@ -567,6 +604,12 @@ declare class TransportSession {
567
604
  private _requestId;
568
605
  private _liveReached;
569
606
 
607
+ private _lastServerStatus;
608
+
609
+ private _forceResolveOnNextConnect;
610
+
611
+ private _connectStartedAt;
612
+
570
613
  private _mediaMonitorTimer;
571
614
 
572
615
  private _lastInboundTotal;
@@ -577,6 +620,14 @@ declare class TransportSession {
577
620
 
578
621
  private _mediaDeathHandled;
579
622
 
623
+ private _decodeSignalSeen;
624
+
625
+ private _lastFramesDecoded;
626
+
627
+ private _lastDecodeAdvanceAt;
628
+
629
+ private _decodeDeathHandled;
630
+
580
631
  private _currentEpoch;
581
632
 
582
633
  private _consumerId;
@@ -598,6 +649,8 @@ declare class TransportSession {
598
649
 
599
650
  get currentIncarnation(): number;
600
651
  get phase(): SessionPhase;
652
+
653
+ get status(): SessionStatus;
601
654
  get sessionId(): string | null;
602
655
  get tracks(): Map<string, MediaStreamTrack>;
603
656
  get multiplexer(): ChannelMultiplexer | null;
@@ -649,6 +702,8 @@ declare class TransportSession {
649
702
  private _flushStreamSubscribes;
650
703
  private _handleMessage;
651
704
 
705
+ private _onServerError;
706
+
652
707
  private _onStreamSeeked;
653
708
 
654
709
  private _onStatus;
@@ -656,9 +711,6 @@ declare class TransportSession {
656
711
  private _onCreateRecvTransport;
657
712
 
658
713
  private _buildRecvTransport;
659
- private _clearRecvWatchdog;
660
-
661
- private _failoverRecvToTcp;
662
714
 
663
715
  private _tryRestartRecvIce;
664
716
  private _trySendIceRestart;
@@ -674,6 +726,10 @@ declare class TransportSession {
674
726
 
675
727
  private _onConsumeData;
676
728
  private _onConsume;
729
+
730
+ private _closeConsumer;
731
+
732
+ private _closeConsumersByProducer;
677
733
  private _mediaPollMs;
678
734
  private _mediaStallTimeoutMs;
679
735
 
@@ -681,6 +737,8 @@ declare class TransportSession {
681
737
  private _stopMediaMonitor;
682
738
  private _sampleMediaLiveness;
683
739
 
740
+ private _checkDecodeLiveness;
741
+
684
742
  private _renegotiate;
685
743
  private _attemptReconnect;
686
744
  private _connectUrls;
@@ -699,6 +757,8 @@ declare class TransportSession {
699
757
  private _setPhase;
700
758
 
701
759
  private _emitError;
760
+
761
+ reportAllocationFailure(error: Error, httpStatus?: number): void;
702
762
  }
703
763
 
704
764
  interface StreamDataTransport {
@@ -732,4 +792,4 @@ interface DataChannelTransport {
732
792
 
733
793
  declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
734
794
 
735
- export { mediaRecorderChunkSource as $, type AccessTokenOptions as A, type SceneGraph as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type Session as E, type SessionDocument as F, type SessionPhase as G, type SessionPhaseName as H, type SessionStartOptions as I, type SessionStream as J, type SessionText as K, type Layer as L, type MediaChunkBinding as M, type Store as N, type StoreOptions as O, type Presence as P, type StreamChunkOptions as Q, type Recording as R, type SceneContext as S, type StreamDataTransport as T, TransportSession as U, type TransportSessionOptions as V, type TransportState as W, createPresence as X, createWebsocketDocConnector as Y, deriveYjsServerUrl as Z, isPendingRecording as _, type App as a, streamDataLabel as a0, transportStreamData as a1, type AppOptions as b, type AttachOptions as c, type ChannelMessage as d, ChannelMultiplexer as e, type ChannelName as f, type ChunkReadable as g, DeferredDocConnector as h, type DocConnection as i, type DocConnector as j, type LayoutConfig as k, type LayoutContext as l, LoopbackStreamData as m, type MediaChunkSource as n, type MediaChunkSourceFactory as o, type MediaRecorderChunkSourceOptions as p, type PresenceState as q, type RecordingBucket as r, type RecordingLifecycle as s, type RecordingStatus as t, type RecordingsAccessor as u, type RequestOptions as v, type RequestStreamOptions as w, type RuntimeArtifact as x, type RuntimeArtifactDownload as y, type RuntimeArtifactsAccessor as z };
795
+ export { createWebsocketDocConnector as $, type AccessTokenOptions as A, type SceneGraph as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type Session as E, type SessionDocument as F, type SessionFailureKind as G, type SessionPhase as H, type SessionPhaseError as I, type SessionPhaseName as J, type SessionStartOptions as K, type Layer as L, type MediaChunkBinding as M, type SessionStatus as N, type SessionStream as O, type Presence as P, type SessionText as Q, type Recording as R, type SceneContext as S, type Store as T, type StoreOptions as U, type StreamChunkOptions as V, type StreamDataTransport as W, TransportSession as X, type TransportSessionOptions as Y, type TransportState as Z, createPresence as _, type App as a, deriveYjsServerUrl as a0, isPendingRecording as a1, mediaRecorderChunkSource as a2, streamDataLabel as a3, transportStreamData as a4, type AppOptions as b, type AttachOptions as c, type ChannelMessage as d, ChannelMultiplexer as e, type ChannelName as f, type ChunkReadable as g, DeferredDocConnector as h, type DocConnection as i, type DocConnector as j, type LayoutConfig as k, type LayoutContext as l, LoopbackStreamData as m, type MediaChunkSource as n, type MediaChunkSourceFactory as o, type MediaRecorderChunkSourceOptions as p, type PresenceState as q, type RecordingBucket as r, type RecordingLifecycle as s, type RecordingStatus as t, type RecordingsAccessor as u, type RequestOptions as v, type RequestStreamOptions as w, type RuntimeArtifact as x, type RuntimeArtifactDownload as y, type RuntimeArtifactsAccessor as z };
@@ -95,6 +95,19 @@ type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiati
95
95
 
96
96
  type SessionPhaseName = 'idle' | 'queued' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended';
97
97
 
98
+ type SessionFailureKind = 'create-failed' | 'never-live' | 'transport-failed' | 'media-permission' | 'ended';
99
+
100
+ interface SessionPhaseError {
101
+
102
+ reason: string;
103
+
104
+ code?: string;
105
+
106
+ kind?: SessionFailureKind;
107
+
108
+ httpStatus?: number;
109
+ }
110
+
98
111
  interface SessionPhase {
99
112
 
100
113
  name: SessionPhaseName;
@@ -108,10 +121,29 @@ interface SessionPhase {
108
121
 
109
122
  sessionId?: string;
110
123
 
111
- error?: {
112
- reason: string;
113
- code?: string;
124
+ error?: SessionPhaseError;
125
+ }
126
+
127
+ interface SessionStatus {
128
+
129
+ phase: SessionPhaseName;
130
+
131
+ transportState: TransportState;
132
+
133
+ sessionId?: string;
134
+
135
+ requestId?: string;
136
+
137
+ lastServerStatus?: string;
138
+
139
+ elapsedMs?: number;
140
+
141
+ queue?: {
142
+ position: number;
143
+ depth: number;
114
144
  };
145
+
146
+ error?: SessionPhaseError;
115
147
  }
116
148
 
117
149
  interface TransportSessionOptions {
@@ -314,6 +346,8 @@ interface Session {
314
346
 
315
347
  readonly phase: SessionPhase;
316
348
 
349
+ readonly status: SessionStatus;
350
+
317
351
  stream(name: string): SessionStream;
318
352
 
319
353
  doc(key: string): SessionDocument;
@@ -328,6 +362,11 @@ interface Session {
328
362
 
329
363
  onPhase(handler: (phase: SessionPhase) => void): () => void;
330
364
 
365
+ whenLive(options?: {
366
+ timeout?: number;
367
+ signal?: AbortSignal;
368
+ }): Promise<void>;
369
+
331
370
  readonly recordings: RecordingsAccessor;
332
371
 
333
372
  readonly artifacts: RuntimeArtifactsAccessor;
@@ -551,14 +590,12 @@ declare class TransportSession {
551
590
  private _intentionalDisconnect;
552
591
  private _reconnectTimer;
553
592
 
593
+ private _cancelPendingDial;
594
+
554
595
  private _stableResetTimer;
555
596
  private _generation;
556
597
  private _lastStartOptions;
557
598
  private _resolveConnection;
558
- private _recvTransportMsg;
559
- private _lastConsumeMsg;
560
- private _recvConnectWatchdog;
561
- private _recvTcpFailoverDone;
562
599
  private _recvIceRestartAttempts;
563
600
  private _recvIceRestartTimer;
564
601
  private _sendIceRestartAttempts;
@@ -567,6 +604,12 @@ declare class TransportSession {
567
604
  private _requestId;
568
605
  private _liveReached;
569
606
 
607
+ private _lastServerStatus;
608
+
609
+ private _forceResolveOnNextConnect;
610
+
611
+ private _connectStartedAt;
612
+
570
613
  private _mediaMonitorTimer;
571
614
 
572
615
  private _lastInboundTotal;
@@ -577,6 +620,14 @@ declare class TransportSession {
577
620
 
578
621
  private _mediaDeathHandled;
579
622
 
623
+ private _decodeSignalSeen;
624
+
625
+ private _lastFramesDecoded;
626
+
627
+ private _lastDecodeAdvanceAt;
628
+
629
+ private _decodeDeathHandled;
630
+
580
631
  private _currentEpoch;
581
632
 
582
633
  private _consumerId;
@@ -598,6 +649,8 @@ declare class TransportSession {
598
649
 
599
650
  get currentIncarnation(): number;
600
651
  get phase(): SessionPhase;
652
+
653
+ get status(): SessionStatus;
601
654
  get sessionId(): string | null;
602
655
  get tracks(): Map<string, MediaStreamTrack>;
603
656
  get multiplexer(): ChannelMultiplexer | null;
@@ -649,6 +702,8 @@ declare class TransportSession {
649
702
  private _flushStreamSubscribes;
650
703
  private _handleMessage;
651
704
 
705
+ private _onServerError;
706
+
652
707
  private _onStreamSeeked;
653
708
 
654
709
  private _onStatus;
@@ -656,9 +711,6 @@ declare class TransportSession {
656
711
  private _onCreateRecvTransport;
657
712
 
658
713
  private _buildRecvTransport;
659
- private _clearRecvWatchdog;
660
-
661
- private _failoverRecvToTcp;
662
714
 
663
715
  private _tryRestartRecvIce;
664
716
  private _trySendIceRestart;
@@ -674,6 +726,10 @@ declare class TransportSession {
674
726
 
675
727
  private _onConsumeData;
676
728
  private _onConsume;
729
+
730
+ private _closeConsumer;
731
+
732
+ private _closeConsumersByProducer;
677
733
  private _mediaPollMs;
678
734
  private _mediaStallTimeoutMs;
679
735
 
@@ -681,6 +737,8 @@ declare class TransportSession {
681
737
  private _stopMediaMonitor;
682
738
  private _sampleMediaLiveness;
683
739
 
740
+ private _checkDecodeLiveness;
741
+
684
742
  private _renegotiate;
685
743
  private _attemptReconnect;
686
744
  private _connectUrls;
@@ -699,6 +757,8 @@ declare class TransportSession {
699
757
  private _setPhase;
700
758
 
701
759
  private _emitError;
760
+
761
+ reportAllocationFailure(error: Error, httpStatus?: number): void;
702
762
  }
703
763
 
704
764
  interface StreamDataTransport {
@@ -732,4 +792,4 @@ interface DataChannelTransport {
732
792
 
733
793
  declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
734
794
 
735
- export { mediaRecorderChunkSource as $, type AccessTokenOptions as A, type SceneGraph as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type Session as E, type SessionDocument as F, type SessionPhase as G, type SessionPhaseName as H, type SessionStartOptions as I, type SessionStream as J, type SessionText as K, type Layer as L, type MediaChunkBinding as M, type Store as N, type StoreOptions as O, type Presence as P, type StreamChunkOptions as Q, type Recording as R, type SceneContext as S, type StreamDataTransport as T, TransportSession as U, type TransportSessionOptions as V, type TransportState as W, createPresence as X, createWebsocketDocConnector as Y, deriveYjsServerUrl as Z, isPendingRecording as _, type App as a, streamDataLabel as a0, transportStreamData as a1, type AppOptions as b, type AttachOptions as c, type ChannelMessage as d, ChannelMultiplexer as e, type ChannelName as f, type ChunkReadable as g, DeferredDocConnector as h, type DocConnection as i, type DocConnector as j, type LayoutConfig as k, type LayoutContext as l, LoopbackStreamData as m, type MediaChunkSource as n, type MediaChunkSourceFactory as o, type MediaRecorderChunkSourceOptions as p, type PresenceState as q, type RecordingBucket as r, type RecordingLifecycle as s, type RecordingStatus as t, type RecordingsAccessor as u, type RequestOptions as v, type RequestStreamOptions as w, type RuntimeArtifact as x, type RuntimeArtifactDownload as y, type RuntimeArtifactsAccessor as z };
795
+ export { createWebsocketDocConnector as $, type AccessTokenOptions as A, type SceneGraph as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type Session as E, type SessionDocument as F, type SessionFailureKind as G, type SessionPhase as H, type SessionPhaseError as I, type SessionPhaseName as J, type SessionStartOptions as K, type Layer as L, type MediaChunkBinding as M, type SessionStatus as N, type SessionStream as O, type Presence as P, type SessionText as Q, type Recording as R, type SceneContext as S, type Store as T, type StoreOptions as U, type StreamChunkOptions as V, type StreamDataTransport as W, TransportSession as X, type TransportSessionOptions as Y, type TransportState as Z, createPresence as _, type App as a, deriveYjsServerUrl as a0, isPendingRecording as a1, mediaRecorderChunkSource as a2, streamDataLabel as a3, transportStreamData as a4, type AppOptions as b, type AttachOptions as c, type ChannelMessage as d, ChannelMultiplexer as e, type ChannelName as f, type ChunkReadable as g, DeferredDocConnector as h, type DocConnection as i, type DocConnector as j, type LayoutConfig as k, type LayoutContext as l, LoopbackStreamData as m, type MediaChunkSource as n, type MediaChunkSourceFactory as o, type MediaRecorderChunkSourceOptions as p, type PresenceState as q, type RecordingBucket as r, type RecordingLifecycle as s, type RecordingStatus as t, type RecordingsAccessor as u, type RequestOptions as v, type RequestStreamOptions as w, type RuntimeArtifact as x, type RuntimeArtifactDownload as y, type RuntimeArtifactsAccessor as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urun-sh/core",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Core transport and channel primitives for the urun TypeScript SDK",
5
5
  "repository": {
6
6
  "type": "git",