@vibexnpm/talkx 3.0.6 → 3.0.8

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.ts CHANGED
@@ -332,16 +332,16 @@ export interface RoomSummaryRollup {
332
332
  format: string;
333
333
  /** 이 rollup 의 언어(소문자 BCP-47 / {@code 'OFF'}=원문). {@link RoomSummaryView.language} 와 동일. */
334
334
  language: string;
335
- /** rollup 이 커버하는 가장 오래된 지점. */
336
- coverStartAt: string | null;
337
- /** 마지막으로 요약된 지점. */
338
- watermarkAt: string | null;
335
+ /** rollup 이 커버하는 가장 오래된 지점(epoch millis). */
336
+ coverStartAt: number | null;
337
+ /** 마지막으로 요약된 지점(epoch millis). */
338
+ watermarkAt: number | null;
339
339
  /** 전체 segment 수(페이지 총량 힌트). */
340
340
  segmentCount: number;
341
341
  /** 이 키(포맷×언어)가 최신 대화를 아직 반영 안 함(reducedSegmentCount < segmentCount) — refreshSummary 로 최신화 가능. */
342
342
  stale: boolean;
343
- /** 마지막 갱신 시각. */
344
- updatedAt: string;
343
+ /** 마지막 갱신 시각(epoch millis). */
344
+ updatedAt: number;
345
345
  }
346
346
 
347
347
  /** Rolling 누적 요약 구간 부분요약 — {@link RoomSummaryView.segments} 항목. 항상 {@code contentFormat==='neutral'}. */
@@ -352,9 +352,9 @@ export interface RoomSummarySegment {
352
352
  content: string;
353
353
  /** 항상 {@code 'neutral'}(format 미적용). */
354
354
  contentFormat: string;
355
- fromSentAt: string | null;
355
+ fromSentAt: number | null;
356
356
  fromMessageId: string | null;
357
- toSentAt: string | null;
357
+ toSentAt: number | null;
358
358
  toMessageId: string | null;
359
359
  /** 이 구간이 담은 메시지 수. */
360
360
  messageCount: number;
@@ -407,8 +407,8 @@ export interface SummaryUpdateEvent {
407
407
  * 그 외 null. 각 사용자는 자기 언어가 이 목록에 있으면 {@code getSummary({ format, lang })} 로 읽는다(§S1).
408
408
  */
409
409
  languages: string[] | null;
410
- /** 갱신 시각. {@code READY} 만 포함, 그 외 null. */
411
- updatedAt: string | null;
410
+ /** 갱신 시각(epoch millis). {@code READY} 만 포함, 그 외 null. */
411
+ updatedAt: number | null;
412
412
  }
413
413
 
414
414
  /**
@@ -723,7 +723,8 @@ export interface ParticipantResponse {
723
723
  * 과도기 동안 {@code ADMIN} 생성자가 보일 수 있으나 권한은 동일.</p>
724
724
  */
725
725
  role: 'OWNER' | 'ADMIN' | 'MEMBER' | 'ASSISTANT';
726
- joinedAt: string;
726
+ /** 참가 시각(epoch millis). */
727
+ joinedAt: number;
727
728
  }
728
729
 
729
730
  /** 채팅방 last message preview. */
@@ -734,7 +735,8 @@ export interface LastMessageResponse {
734
735
  senderProfileUrl?: string | null;
735
736
  content: string;
736
737
  messageType: string;
737
- sentAt: string;
738
+ /** 마지막 메시지 시각(epoch millis). */
739
+ sentAt: number;
738
740
  /**
739
741
  * 파일 메시지일 때 첫 파일의 사용자 metadata (opaque pass-through).
740
742
  * <p>고객사가 파일 업로드 시 함께 보낸 데이터 (스티커 ID 등) 가 채팅방 리스트에서도 식별 가능하도록 보존.
@@ -771,8 +773,10 @@ export interface ChatRoomResponse {
771
773
  pinnedMessageId?: string | null;
772
774
  participants?: ParticipantResponse[];
773
775
  lastMessage?: LastMessageResponse | null;
774
- lastMessageAt?: string | null;
775
- createdAt: string;
776
+ /** 마지막 메시지 시각(epoch millis) — 방 목록 정렬용. */
777
+ lastMessageAt?: number | null;
778
+ /** 방 생성 시각(epoch millis). */
779
+ createdAt: number;
776
780
  }
777
781
 
778
782
  /** 커서 페이지네이션 응답. */
@@ -825,6 +829,10 @@ export interface RoomListUpdateEvent {
825
829
  eventType: RoomListEventTypeValue;
826
830
  roomId: string;
827
831
  actorId?: string;
832
+ /** {@code MESSAGE_*} 이벤트의 방 마지막 메시지 시각(epoch millis). 그 외 이벤트에서는 undefined. */
833
+ lastMessageAt?: number | null;
834
+ /** 이벤트 발행 시각(epoch millis). */
835
+ timestamp?: number;
828
836
  cutoffTime?: number;
829
837
  /** {@code ROOM_UPDATED} 전용 — 저장된 최신 메타 snapshot. 다른 eventType 에서는 undefined. */
830
838
  room?: RoomMeta;
@@ -926,10 +934,35 @@ export interface TalkFlowClientOptions {
926
934
  serverUrl?: string;
927
935
  /** SockJS 사용 여부. 기본 true. */
928
936
  useSockJS?: boolean;
929
- /** 재연결 지연 (ms). 기본 5000. */
937
+ /** 최초 재연결 지연 (ms). 기본 5000. 이후 지수적으로 증가한다. */
930
938
  reconnectDelay?: number;
939
+ /** 지수 백오프 상한 (ms). 기본 30000. */
940
+ maxReconnectDelay?: number;
931
941
  /** 최대 재연결 시도. 기본 10. */
932
942
  maxReconnectAttempts?: number;
943
+ /** 수신 하트비트 간격 (ms). 기본 10000. */
944
+ heartbeatIncoming?: number;
945
+ /** 발신 하트비트 간격 (ms). 기본 10000. */
946
+ heartbeatOutgoing?: number;
947
+ /**
948
+ * 탭 복귀(visibilitychange/pageshow) · 네트워크 복구(online) 시 자동 재연결. 기본 true.
949
+ *
950
+ * <p>재시도 횟수를 소진해 죽은 연결도 되살린다. 단 {@code connect()} 를 한 번도 호출하지 않았거나
951
+ * {@code disconnect()} 로 명시적으로 끊은 경우에는 동작하지 않는다.</p>
952
+ */
953
+ resumeOnVisibility?: boolean;
954
+ /**
955
+ * 재연결/복귀 후 끊긴 구간의 메시지를 자동으로 다시 불러올지. 기본 true.
956
+ *
957
+ * <p>복구된 메시지는 일반 `chatMessage` 이벤트로 재생되므로 수신 코드를 바꿀 필요가 없다.</p>
958
+ */
959
+ syncOnReconnect?: boolean;
960
+ /** 갭 복구 첫 페이지에만 적용되는 되감기 폭 (ms). 기본 3000. 서버가 상한 clamp 후 1회 차감. */
961
+ rewindMillis?: number;
962
+ /** 갭 복구 페이지 상한. 기본 5. 초과 시 최신 페이지 재로드로 전환하고 `gapTruncated` 를 발행. */
963
+ maxSyncPages?: number;
964
+ /** 갭 복구 페이지 크기. 기본 100. */
965
+ syncPageSize?: number;
933
966
  /** WebRTC ICE 서버. */
934
967
  iceServers?: RTCIceServer[];
935
968
  /** connect() 시 채팅방 리스트 자동 구독. 기본 true. */
@@ -1229,7 +1262,7 @@ export interface RetentionCleanupPayload {
1229
1262
  /**
1230
1263
  * TalkFlowClient 이벤트 맵 — 런타임 {@code TalkFlowClient.js} 의 {@code this.emit(...)} 호출 기반.
1231
1264
  *
1232
- * <p><b>Connection 관련</b>: stateChange, connected, disconnected, reconnecting, connectionError, tokenSet, loggedOut</p>
1265
+ * <p><b>Connection 관련</b>: stateChange, connected, disconnected, reconnecting, reconnected, resumed, connectionError, tokenSet, loggedOut</p>
1233
1266
  * <p><b>Chat 관련 (ChatClient 이벤트를 이 이름으로 re-emit)</b>: chatMessage, newChatMessage, messageUpdated, messageDeleted, reactionChanged, linkPreviewAttached, messageRead, typing, assistantProgress, memberJoined, memberLeft, roomSubscribed, roomUnsubscribed, roomListSubscribed, roomListUnsubscribed, roomListUpdate, roomListMessage, roomListCreated, roomListJoined, roomListLeft, roomListSelfLeft, roomListRoomUpdated, retentionCleanup</p>
1234
1267
  * <p><b>Push 관련</b>: pushEnabled, pushFailed, pushNotification</p>
1235
1268
  * <p><b>WebRTC 관련</b>: localStreamStarted, localStreamStopped, remoteTrack, screenShareStarted, screenShareEnded, deviceChange, mediaStateChanged, callStarted, callEnded, callRequested, callAccepted, callRejected, callCancelled, callInvitation, callBusy, incomingCall, incomingCallWhileBusy, userJoined, userLeft, participantLeft, participantMediaState, peerConnected, peerDisconnected, peerClosed, webrtcError</p>
@@ -1240,6 +1273,20 @@ export interface TalkFlowClientEvents {
1240
1273
  connected: unknown;
1241
1274
  disconnected: unknown;
1242
1275
  reconnecting: { attempt: number };
1276
+ /**
1277
+ * 재연결 **성공**. 최초 연결에는 발행되지 않는다.
1278
+ *
1279
+ * <p>{@link TalkFlowClientEvents.resumed} 와 상호 배타적 — 재동기화 시점을 모두 잡으려면 둘 다 구독한다.</p>
1280
+ */
1281
+ reconnected: { attempts: number };
1282
+ /**
1283
+ * 탭 복귀 / 네트워크 복구 감지 — **연결이 살아 있어 재연결이 불필요했던** 경우에만 발행된다.
1284
+ *
1285
+ * <p>백그라운드 동안 프레임을 놓쳤을 수 있으므로 소비자는 이 시점에도 재동기화해야 한다.
1286
+ * 복귀가 재연결을 유발한 경우에는 이 이벤트 대신 {@link TalkFlowClientEvents.reconnected} 가
1287
+ * 발행된다(두 이벤트가 겹치지 않아 재동기화가 중복 실행되지 않는다).</p>
1288
+ */
1289
+ resumed: { reason: 'visibilitychange' | 'pageshow' | 'online' };
1243
1290
  connectionError: unknown;
1244
1291
  tokenSet: { userId: string };
1245
1292
  loggedOut: void;
@@ -1288,6 +1335,21 @@ export interface TalkFlowClientEvents {
1288
1335
  roomListRoomUpdated: RoomListUpdateEvent;
1289
1336
  retentionCleanup: RetentionCleanupPayload;
1290
1337
 
1338
+ // 갭 복구 — 복구된 메시지 자체는 일반 chatMessage 로 재생되므로 아래는 모두 선택 구독용.
1339
+ /** 갭 복구 시작 (전 방 1회). */
1340
+ syncStarted: { roomIds: string[]; reason: string };
1341
+ /** 갭 복구 완료 (전 방 1회). */
1342
+ syncCompleted: {
1343
+ rooms: Array<{ roomId: string; recovered: number; truncated: boolean; durationMs: number }>;
1344
+ totalRecovered: number;
1345
+ durationMs: number;
1346
+ reason: string;
1347
+ };
1348
+ /** 갭이 `maxSyncPages` 를 넘거나 커서가 만료돼 최신 페이지 재로드로 전환됨 (방 단위). */
1349
+ gapTruncated: { roomId: string; fetched: number; reason?: 'cursorExpired' };
1350
+ /** 재연결 시 방 목록 전체 스냅샷. delta 계약인 `roomListUpdate` 와 별개. */
1351
+ roomListSynced: { rooms: ChatRoomResponse[]; reason: string };
1352
+
1291
1353
  // Push
1292
1354
  pushEnabled: void;
1293
1355
  /**