@vibexnpm/talkx 2.3.1 → 3.0.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/README.md +3 -4
- package/dist/index.d.ts +57 -10
- package/dist/talkflow-sdk.esm.js +1 -1
- package/dist/talkflow-sdk.esm.js.map +1 -1
- package/dist/talkflow-sdk.standalone.js +1 -1
- package/dist/talkflow-sdk.standalone.js.map +1 -1
- package/dist/talkflow-sdk.umd.js +1 -1
- package/dist/talkflow-sdk.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/chat/ChatClient.js +182 -16
- package/src/constants.js +2 -0
- package/src/talkflow/eventForwarding.js +1 -0
- package/types/index.d.ts +57 -10
package/README.md
CHANGED
|
@@ -198,14 +198,13 @@ if (summary.outcome !== 'EMITTED') console.warn(summary.detail); // SKIPPED/FAIL
|
|
|
198
198
|
|
|
199
199
|
// 3) 번역 — 특정 메시지를 목표 언어로 번역
|
|
200
200
|
const translated = await client.translateWithAssistant(roomId, {
|
|
201
|
-
personaId,
|
|
202
201
|
sourceMessageId: message.messageId,
|
|
203
|
-
targetLang: 'en' //
|
|
202
|
+
targetLang: 'en' // 필수
|
|
204
203
|
});
|
|
205
|
-
//
|
|
204
|
+
renderTranslatedText(translated.translatedText); // 요청자 전용 응답, 방 broadcast 없음
|
|
206
205
|
```
|
|
207
206
|
|
|
208
|
-
요약/번역은 동기 호출이라 LLM 처리(수 초) 후
|
|
207
|
+
요약/번역은 동기 호출이라 LLM 처리(수 초) 후 반환됩니다. 요약은 생성된 어시스턴트 메시지가 일반 `chatMessage` 이벤트로도 도착하고, 번역은 요청자 전용 응답으로만 반환됩니다.
|
|
209
208
|
|
|
210
209
|
---
|
|
211
210
|
|
package/dist/index.d.ts
CHANGED
|
@@ -236,7 +236,7 @@ export interface AssistantPersonaResponse {
|
|
|
236
236
|
|
|
237
237
|
/**
|
|
238
238
|
* 어시스턴트 도구 실행 결과 — 서버 {@code AssistantToolResult}.
|
|
239
|
-
* {@link ChatClient.summarizeWithAssistant}
|
|
239
|
+
* {@link ChatClient.summarizeWithAssistant} 반환.
|
|
240
240
|
*/
|
|
241
241
|
export interface AssistantToolResult {
|
|
242
242
|
/**
|
|
@@ -254,6 +254,16 @@ export interface AssistantToolResult {
|
|
|
254
254
|
detail: string | null;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
+
/** {@link ChatClient.translateWithAssistant} 반환 — 요청자 전용 온디맨드 번역 응답. */
|
|
258
|
+
export interface OnDemandTranslationResponse {
|
|
259
|
+
/** 번역된 텍스트. */
|
|
260
|
+
translatedText: string;
|
|
261
|
+
/** 번역 대상 원본 메시지의 {@code messageId}. */
|
|
262
|
+
sourceMessageId: string;
|
|
263
|
+
/** 요청한 목표 언어. */
|
|
264
|
+
targetLang: string;
|
|
265
|
+
}
|
|
266
|
+
|
|
257
267
|
/** {@link ChatClient.summarizeWithAssistant} 옵션 — 서버 {@code SummarizeToolRequest}. */
|
|
258
268
|
export interface SummarizeToolRequest {
|
|
259
269
|
/** 요약을 수행할 어시스턴트 ID ({@link AssistantPersonaResponse.id}). 필수. */
|
|
@@ -266,12 +276,10 @@ export interface SummarizeToolRequest {
|
|
|
266
276
|
|
|
267
277
|
/** {@link ChatClient.translateWithAssistant} 옵션 — 서버 {@code TranslateToolRequest}. */
|
|
268
278
|
export interface TranslateToolRequest {
|
|
269
|
-
/** 번역을 수행할 어시스턴트 ID ({@link AssistantPersonaResponse.id}). 필수. */
|
|
270
|
-
personaId: string;
|
|
271
279
|
/** 번역 대상 메시지의 {@code messageId}. 필수. */
|
|
272
280
|
sourceMessageId: string;
|
|
273
|
-
/** 목표 언어 (예: {@code 'en'}).
|
|
274
|
-
targetLang
|
|
281
|
+
/** 목표 언어 (예: {@code 'en'}). 필수. */
|
|
282
|
+
targetLang: string;
|
|
275
283
|
}
|
|
276
284
|
|
|
277
285
|
/**
|
|
@@ -378,6 +386,7 @@ export const WebSocketPaths: {
|
|
|
378
386
|
getChatDestination(roomId: string): string;
|
|
379
387
|
getChatReadDestination(roomId: string): string;
|
|
380
388
|
getChatTypingDestination(roomId: string): string;
|
|
389
|
+
getChatAssistantStreamDestination(roomId: string): string;
|
|
381
390
|
readonly ROOM_LIST_USER_DESTINATION: string;
|
|
382
391
|
getWebRTCDestination(roomId: string): string;
|
|
383
392
|
getWebRTCUserDestination(): string;
|
|
@@ -735,6 +744,42 @@ export interface TypingEvent {
|
|
|
735
744
|
senderType: 'USER' | 'ASSISTANT';
|
|
736
745
|
}
|
|
737
746
|
|
|
747
|
+
/**
|
|
748
|
+
* AI 진행 표시 이벤트 — `/topic/chat/{roomId}/assistant-stream` 의 PHASE/DONE.
|
|
749
|
+
*
|
|
750
|
+
* typing 과 별개의 가산 UX 레이어(설계 ASSISTANT_PROGRESS_STREAMING_DESIGN.md). 서버가 typing 도 이중발행하므로
|
|
751
|
+
* 구버전 SDK 는 본 이벤트를 못 받아도 기존 typing 으로 정상 동작한다. UI 는 `active:true` 면 `label`(또는 `phase`)
|
|
752
|
+
* 로 단계를 표시하고, `active:false`(DONE·어시 메시지 도착·TTL 만료) 면 해제한다.
|
|
753
|
+
*
|
|
754
|
+
* 현재는 PM_BACKSTAGE(방당 단일 PM) 만 phase 를 발행 — 멘션/버튼/14인 경로는 본 이벤트 없이 typing 만.
|
|
755
|
+
*/
|
|
756
|
+
export interface AssistantProgressEvent {
|
|
757
|
+
/** 채팅방 ID. */
|
|
758
|
+
roomId: string;
|
|
759
|
+
/** 어시 응답 1회분 식별(멀티 응답/중복 dedup). 일부 종료 emit 에선 null. */
|
|
760
|
+
streamId: string | null;
|
|
761
|
+
/** 진행 주체 페르소나 ID. */
|
|
762
|
+
personaId: string | null;
|
|
763
|
+
/** 진행 단계 — `active:true` 일 때. 종료 시 null. */
|
|
764
|
+
phase: 'THINKING' | 'SEARCHING' | 'PLANNING' | 'WRITING' | null;
|
|
765
|
+
/** phase 의 기본 표시 라벨(예: "생각 중…"). SDK 매핑 — 커스텀하려면 `phase` 사용. 종료 시 null. */
|
|
766
|
+
label: string | null;
|
|
767
|
+
/** true=진행중(PHASE/DELTA) / false=종료(DONE·메시지 도착·TTL). */
|
|
768
|
+
active: boolean;
|
|
769
|
+
/** 토큰 스트림 누적 텍스트(B) — DELTA 수신 시 지금까지 모인 전체. 버블에 그대로 렌더. PHASE-only/종료 시 null. */
|
|
770
|
+
text?: string | null;
|
|
771
|
+
/** 이번 토큰 청크(B) — append 렌더를 선호할 때. DELTA 수신 시만. */
|
|
772
|
+
delta?: string | null;
|
|
773
|
+
/** 토큰 청크 순서/누락 감지(B) — DELTA 수신 시만. */
|
|
774
|
+
seq?: number | null;
|
|
775
|
+
/** 종료(DONE) 결과 — DONE 수신 시만. */
|
|
776
|
+
status?: 'SUCCEEDED' | 'FAILED' | 'CANCELLED' | 'TIMEOUT' | null;
|
|
777
|
+
/** 종료(DONE, SUCCEEDED) 시 영속된 최종 메시지 ID. */
|
|
778
|
+
messageId?: string | null;
|
|
779
|
+
/** 종료 사유 — 'message'(어시 메시지 도착) / 'timeout'(TTL). DONE 수신 해제엔 없음. */
|
|
780
|
+
reason?: 'message' | 'timeout' | null;
|
|
781
|
+
}
|
|
782
|
+
|
|
738
783
|
// ============================================================================
|
|
739
784
|
// Options — constructor & method
|
|
740
785
|
// ============================================================================
|
|
@@ -1056,7 +1101,7 @@ export interface RetentionCleanupPayload {
|
|
|
1056
1101
|
* TalkFlowClient 이벤트 맵 — 런타임 {@code TalkFlowClient.js} 의 {@code this.emit(...)} 호출 기반.
|
|
1057
1102
|
*
|
|
1058
1103
|
* <p><b>Connection 관련</b>: stateChange, connected, disconnected, reconnecting, connectionError, tokenSet, loggedOut</p>
|
|
1059
|
-
* <p><b>Chat 관련 (ChatClient 이벤트를 이 이름으로 re-emit)</b>: chatMessage, newChatMessage, messageUpdated, messageDeleted, reactionChanged, linkPreviewAttached, messageRead, typing, memberJoined, memberLeft, roomSubscribed, roomUnsubscribed, roomListSubscribed, roomListUnsubscribed, roomListUpdate, roomListMessage, roomListCreated, roomListJoined, roomListLeft, roomListSelfLeft, roomListRoomUpdated, retentionCleanup</p>
|
|
1104
|
+
* <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>
|
|
1060
1105
|
* <p><b>Push 관련</b>: pushEnabled, pushFailed, pushNotification</p>
|
|
1061
1106
|
* <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>
|
|
1062
1107
|
*/
|
|
@@ -1085,6 +1130,7 @@ export interface TalkFlowClientEvents {
|
|
|
1085
1130
|
messageTranslated: ChatMessageReceivedPayload;
|
|
1086
1131
|
messageRead: MessageReadEventPayload;
|
|
1087
1132
|
typing: TypingEvent;
|
|
1133
|
+
assistantProgress: AssistantProgressEvent;
|
|
1088
1134
|
memberJoined: MemberChangePayload;
|
|
1089
1135
|
memberLeft: MemberChangePayload;
|
|
1090
1136
|
roomSubscribed: { roomId: string };
|
|
@@ -1198,6 +1244,7 @@ export interface ChatClientEvents {
|
|
|
1198
1244
|
retentionCleanup: RetentionCleanupPayload;
|
|
1199
1245
|
messageRead: MessageReadEventPayload;
|
|
1200
1246
|
typing: TypingEvent;
|
|
1247
|
+
assistantProgress: AssistantProgressEvent;
|
|
1201
1248
|
}
|
|
1202
1249
|
|
|
1203
1250
|
/**
|
|
@@ -1261,8 +1308,8 @@ export class ChatClient implements SdkEventEmitter<ChatClientEvents> {
|
|
|
1261
1308
|
rateAssistantMessage(roomId: string, messageId: string, rating: number, comment?: string): Promise<void>;
|
|
1262
1309
|
/** 어시스턴트로 대화 요약 (버튼 진입점, 동기). */
|
|
1263
1310
|
summarizeWithAssistant(roomId: string, options: SummarizeToolRequest): Promise<AssistantToolResult>;
|
|
1264
|
-
/**
|
|
1265
|
-
translateWithAssistant(roomId: string, options: TranslateToolRequest): Promise<
|
|
1311
|
+
/** 특정 메시지 온디맨드 번역 (버튼 진입점, 동기, 요청자 전용 응답). */
|
|
1312
|
+
translateWithAssistant(roomId: string, options: TranslateToolRequest): Promise<OnDemandTranslationResponse>;
|
|
1266
1313
|
/** 방 PM 프롬프트 레이어 조회 — PM_BACKSTAGE 방 전용, 참여자 전체. 미등록 시 404. */
|
|
1267
1314
|
getRoomPmPrompt(roomId: string): Promise<PmPromptLayerResponse>;
|
|
1268
1315
|
/** 방 PM 프롬프트 레이어 등록/수정 (upsert, 새 버전 자동 기록) — 방 주인(OWNER) 전용. content 1~2,000자. */
|
|
@@ -1602,8 +1649,8 @@ export default class TalkFlowClient implements SdkEventEmitter<TalkFlowClientEve
|
|
|
1602
1649
|
rateAssistantMessage(roomId: string, messageId: string, rating: number, comment?: string): Promise<void>;
|
|
1603
1650
|
/** 어시스턴트로 대화 요약 (버튼 진입점, 동기). */
|
|
1604
1651
|
summarizeWithAssistant(roomId: string, options: SummarizeToolRequest): Promise<AssistantToolResult>;
|
|
1605
|
-
/**
|
|
1606
|
-
translateWithAssistant(roomId: string, options: TranslateToolRequest): Promise<
|
|
1652
|
+
/** 특정 메시지 온디맨드 번역 (버튼 진입점, 동기, 요청자 전용 응답). */
|
|
1653
|
+
translateWithAssistant(roomId: string, options: TranslateToolRequest): Promise<OnDemandTranslationResponse>;
|
|
1607
1654
|
/** 방 PM 프롬프트 레이어 조회 — PM_BACKSTAGE 방 전용, 참여자 전체. 미등록 시 404. */
|
|
1608
1655
|
getRoomPmPrompt(roomId: string): Promise<PmPromptLayerResponse>;
|
|
1609
1656
|
/** 방 PM 프롬프트 레이어 등록/수정 (upsert, 새 버전 자동 기록) — 방 주인(OWNER) 전용. content 1~2,000자. */
|