@minicode-dev/chat 0.1.10 → 0.1.12

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/index.d.ts CHANGED
@@ -122,7 +122,7 @@ export interface ChatCustomEmoji {
122
122
  }
123
123
 
124
124
  export type ChatEffectId = 'nudge' | 'pig-disco' | 'confetti';
125
- export interface ChatEffectEvent { effectId: ChatEffectId; id: string; sentAt: number; }
125
+ export interface ChatEffectEvent { effectId: ChatEffectId; id: string; sentAt: number; /** Countdown deadline, at most 24 hours after sentAt. */ endsAt?: number; sound?: boolean; }
126
126
  export interface ChatEffectDefinition {
127
127
  id: ChatEffectId;
128
128
  label: string;
@@ -151,7 +151,7 @@ export interface ChatEffectsConfig {
151
151
  export const EFFECT_CATALOG: readonly ChatEffectDefinition[];
152
152
  export function getChatEffect(id: string): ChatEffectDefinition | undefined;
153
153
  export const EFFECT_PREFIX: string;
154
- export function encodeEffect(event: { effectId: ChatEffectId; id?: string; sentAt?: number }): string;
154
+ export function encodeEffect(event: { effectId: ChatEffectId; id?: string; sentAt?: number; endsAt?: number; sound?: boolean }): string;
155
155
  export function decodeEffect(text: unknown): ChatEffectEvent | null;
156
156
 
157
157
  export interface ChatStorageAdapter {
@@ -526,14 +526,29 @@ export interface PeerSignaling {
526
526
  dispose?(): void;
527
527
  }
528
528
  export type PeerLinkPhase = 'idle' | 'listening' | 'calling' | 'negotiating' | 'connected' | 'restarting' | 'reconnecting' | 'failed';
529
+ export interface ManualTurnOptions {
530
+ /** Remaining validity in seconds; omit when the provider response has no known expiry. */
531
+ ttlSeconds?: number;
532
+ /** Default all. Use relay only to diagnose TURN connectivity. */
533
+ iceTransportPolicy?: RTCIceTransportPolicy;
534
+ }
535
+ export interface ManualTurnState {
536
+ status: 'idle' | 'waiting_peer' | 'sharing' | 'applying' | 'synchronized' | 'failed';
537
+ shared: boolean; received: boolean; expiresAt: number | null; error: string | null;
538
+ }
529
539
  export interface PeerLinkState {
530
540
  phase: PeerLinkPhase; role: 'caller' | 'answerer' | null; sid: string | null; gen: number;
531
541
  tabId: string; peerTab: string | null; ice: string; connection: string; signalingState: string; gathering: string;
532
- route: { local: string | null; remote: string | null; protocol: string | null; relay: boolean; label: string } | null;
542
+ route: { local: string | null; remote: string | null; protocol: string | null; relayProtocol?: string | null; relay: boolean; label: string } | null;
533
543
  rtt: number | null; statsRtt: number | null; reconnects: number; restarts: number; error: string | null;
534
544
  move: { sent: number; dropped: number; received: number; outOfOrder: number; lossPct: number; hzIn: number; hzOut: number };
535
545
  signals: { sent: number; received: number; sendFailures: number; retransmits: number; duplicates: number; ignored: number; invalid: number; tooLarge: number; maxLength: number };
536
546
  events: { sent: number; received: number };
547
+ turnConfigured?: boolean; manualTurn?: ManualTurnState;
548
+ candidates?: { local: number; remote: number; accepted: number; rejected: number; localRelay: number; remoteRelay: number };
549
+ iceErrors?: { code: number; stage: 'gathering' | 'remote_candidate' }[];
550
+ channels?: { move: string; events: string };
551
+ startedAt?: number | null; connectedAt?: number | null; elapsedMs?: number;
537
552
  }
538
553
  export interface PeerLink {
539
554
  tabId: string;
@@ -542,13 +557,18 @@ export interface PeerLink {
542
557
  sendMove(payload: unknown): boolean;
543
558
  sendEvent(payload: unknown): boolean;
544
559
  restartIce(): void;
560
+ /** Shares temporary ICE credentials with the bound peer. Requires HTTPS/Web Crypto. */
561
+ configureTurn(input: string | { iceServers: RTCIceServer[]; expiresAt?: number | string | null; expiresIn?: number; ttl?: number } | { result: { iceServers: RTCIceServer[] } }, options?: ManualTurnOptions): Promise<{ expiresAt: number | null }>;
562
+ /** Requests recovery through the configured authority without creating competing calls. */
563
+ requestReconnect(): void;
564
+ clearManualTurn(): void;
545
565
  getState(): PeerLinkState;
546
566
  hangup(): void;
547
567
  destroy(): void;
548
568
  }
549
569
  export function createPeerLink(options: {
550
570
  signaling: PeerSignaling; selfId: string; peerId: string; roomId?: string | null; tabId?: string;
551
- iceServers?: RTCIceServer[]; iceTransportPolicy?: RTCIceTransportPolicy; autoReconnect?: boolean; listen?: boolean;
571
+ iceServers?: RTCIceServer[]; iceTransportPolicy?: RTCIceTransportPolicy; autoReconnect?: boolean; listen?: boolean; configurationAuthority?: boolean;
552
572
  RTCPeerConnectionImpl?: typeof RTCPeerConnection;
553
573
  onChange?: (state: PeerLinkState) => void; onMove?: (payload: any, meta: { seq: number }) => void;
554
574
  onEvent?: (payload: any) => void; log?: (line: string) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minicode-dev/chat",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "private": false,
5
5
  "description": "LIRA real-time chat (WebSocket, media, games) as a React package.",
6
6
  "author": "Minicode",