@csntgao/ai-employee-client 0.15.4 → 0.15.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/index.d.ts +25 -1
- package/dist/index.js +407 -198
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -79,6 +79,11 @@ interface AiEmployeeClientEventMap {
|
|
|
79
79
|
sessionId: string;
|
|
80
80
|
message: AiEmployeeMessage;
|
|
81
81
|
source: 'local' | 'realtime';
|
|
82
|
+
replacesMessageId?: string;
|
|
83
|
+
};
|
|
84
|
+
'message-stream': {
|
|
85
|
+
sessionId: string;
|
|
86
|
+
message: AiEmployeeMessage;
|
|
82
87
|
};
|
|
83
88
|
title: {
|
|
84
89
|
sessionId: string;
|
|
@@ -145,6 +150,7 @@ declare class AiEmployeeClient {
|
|
|
145
150
|
private readonly listeners;
|
|
146
151
|
private readonly seenMessageIds;
|
|
147
152
|
private readonly pendingLocalMessages;
|
|
153
|
+
private readonly activeAssistantStreams;
|
|
148
154
|
private assistantReceivedInCurrentTurn;
|
|
149
155
|
private socket;
|
|
150
156
|
private reconnectTimer;
|
|
@@ -193,6 +199,8 @@ declare class AiEmployeeClient {
|
|
|
193
199
|
private handleSocketData;
|
|
194
200
|
private handleServerMessage;
|
|
195
201
|
private handleAiEmployeeEvent;
|
|
202
|
+
private applyAssistantStreamEvent;
|
|
203
|
+
private takeAssistantStream;
|
|
196
204
|
private subscribeCurrentSession;
|
|
197
205
|
private rememberPendingLocalMessage;
|
|
198
206
|
/**
|
|
@@ -395,6 +403,7 @@ declare class CustomerSupportClient {
|
|
|
395
403
|
private currentState;
|
|
396
404
|
private socket;
|
|
397
405
|
private heartbeatTimer;
|
|
406
|
+
private fallbackHistoryRefreshTimer;
|
|
398
407
|
private reconnectTimer;
|
|
399
408
|
private reconnectAttempt;
|
|
400
409
|
private tokenReconnectAttempt;
|
|
@@ -440,6 +449,8 @@ declare class CustomerSupportClient {
|
|
|
440
449
|
private refreshSessionFromRealtime;
|
|
441
450
|
private appendMessage;
|
|
442
451
|
private startHeartbeat;
|
|
452
|
+
private startFallbackHistoryRefresh;
|
|
453
|
+
private stopFallbackHistoryRefresh;
|
|
443
454
|
private handleSocketClose;
|
|
444
455
|
private scheduleAvailabilityReconnect;
|
|
445
456
|
private scheduleReconnect;
|
|
@@ -691,9 +702,22 @@ interface PingFrame {
|
|
|
691
702
|
interface ParsedSessionMessage {
|
|
692
703
|
messages: AiEmployeeMessage[];
|
|
693
704
|
activities: string[];
|
|
705
|
+
streamEvents: ParsedAssistantStreamEvent[];
|
|
706
|
+
messageStreamReferences: ParsedAssistantMessageStreamReference[];
|
|
694
707
|
fallbackResult?: AiEmployeeMessage;
|
|
695
708
|
processing?: boolean;
|
|
696
709
|
}
|
|
710
|
+
interface ParsedAssistantStreamEvent {
|
|
711
|
+
phase: 'start' | 'delta' | 'stop';
|
|
712
|
+
streamKey: string;
|
|
713
|
+
modelMessageId: string;
|
|
714
|
+
index: number;
|
|
715
|
+
delta?: string;
|
|
716
|
+
}
|
|
717
|
+
interface ParsedAssistantMessageStreamReference {
|
|
718
|
+
messageId: string;
|
|
719
|
+
modelMessageId: string;
|
|
720
|
+
}
|
|
697
721
|
type ParsedAiEmployeeEvent = {
|
|
698
722
|
kind: 'session-message';
|
|
699
723
|
sessionId: string;
|
|
@@ -712,4 +736,4 @@ declare function parseJsonRecord(raw: string): JsonRecord | null;
|
|
|
712
736
|
declare function parseAiEmployeeEvent(raw: unknown): ParsedAiEmployeeEvent;
|
|
713
737
|
declare function hashText(value: string): string;
|
|
714
738
|
|
|
715
|
-
export { type AiEmployeeAssistantAction, type AiEmployeeAttachmentReference, AiEmployeeClient, AiEmployeeClientError, type AiEmployeeClientErrorDetail, type AiEmployeeClientEventMap, type AiEmployeeClientListener, type AiEmployeeClientOptions, type AiEmployeeClientStartResult, type AiEmployeeConnectionState, type AiEmployeeErrorCode, type AiEmployeeFirstMessageOptions, type AiEmployeeFirstMessageRequest, type AiEmployeeFirstMessageRequestState, type AiEmployeeFirstMessageRequestStore, type AiEmployeeFirstMessageResult, type AiEmployeeMessage, type AiEmployeeMessageRole, type AiEmployeeReconnectOptions, type AiEmployeeSessionSummary, type AiEmployeeTransport, AiEmployeeTransportError, type AiEmployeeTransportErrorCode, type AiEmployeeWebSocketFactory, type AuthenticateFrame, type CustomerSupportAgent, type CustomerSupportAttachment, type CustomerSupportAttachmentDownloadRequest, CustomerSupportClient, CustomerSupportClientError, type CustomerSupportClientEventMap, type CustomerSupportClientListener, type CustomerSupportClientOptions, type CustomerSupportCreateSessionRequest, type CustomerSupportCreateSessionResult, type CustomerSupportErrorCode, type CustomerSupportErrorDetail, type CustomerSupportHandoffRequest, type CustomerSupportHandoffResult, type CustomerSupportMessage, type CustomerSupportMessagePage, type CustomerSupportSenderType, type CustomerSupportSession, type CustomerSupportSessionStatus, type CustomerSupportTransport, type NotificationAttachment, NotificationCenterClient, NotificationCenterClientError, type NotificationCenterClientEventMap, type NotificationCenterClientListener, type NotificationCenterClientOptions, type NotificationCenterErrorCode, type NotificationCenterErrorDetail, type NotificationCenterTransport, type NotificationContentType, type NotificationDto, type NotificationInboxQuery, type NotificationInboxResult, type NotificationMarkAllReadResult, type NotificationMarkReadResult, type NotificationReadStatus, type NotificationRealtimeChange, type NotificationResource, type NotificationSource, type NotificationTypeSummary, type OpenCustomerSupportAssistantAction, type OpenFileAssistantAction, type ParsedAiEmployeeAssistantContent, type ParsedAiEmployeeEvent, type ParsedSessionMessage, type PingFrame, type SessionSubscriptionFrame, createAuthenticateFrame, createPingFrame, createSubscriptionFrame, hashText, isUuidV4, parseAiEmployeeAssistantContent, parseAiEmployeeEvent, parseJsonRecord };
|
|
739
|
+
export { type AiEmployeeAssistantAction, type AiEmployeeAttachmentReference, AiEmployeeClient, AiEmployeeClientError, type AiEmployeeClientErrorDetail, type AiEmployeeClientEventMap, type AiEmployeeClientListener, type AiEmployeeClientOptions, type AiEmployeeClientStartResult, type AiEmployeeConnectionState, type AiEmployeeErrorCode, type AiEmployeeFirstMessageOptions, type AiEmployeeFirstMessageRequest, type AiEmployeeFirstMessageRequestState, type AiEmployeeFirstMessageRequestStore, type AiEmployeeFirstMessageResult, type AiEmployeeMessage, type AiEmployeeMessageRole, type AiEmployeeReconnectOptions, type AiEmployeeSessionSummary, type AiEmployeeTransport, AiEmployeeTransportError, type AiEmployeeTransportErrorCode, type AiEmployeeWebSocketFactory, type AuthenticateFrame, type CustomerSupportAgent, type CustomerSupportAttachment, type CustomerSupportAttachmentDownloadRequest, CustomerSupportClient, CustomerSupportClientError, type CustomerSupportClientEventMap, type CustomerSupportClientListener, type CustomerSupportClientOptions, type CustomerSupportCreateSessionRequest, type CustomerSupportCreateSessionResult, type CustomerSupportErrorCode, type CustomerSupportErrorDetail, type CustomerSupportHandoffRequest, type CustomerSupportHandoffResult, type CustomerSupportMessage, type CustomerSupportMessagePage, type CustomerSupportSenderType, type CustomerSupportSession, type CustomerSupportSessionStatus, type CustomerSupportTransport, type NotificationAttachment, NotificationCenterClient, NotificationCenterClientError, type NotificationCenterClientEventMap, type NotificationCenterClientListener, type NotificationCenterClientOptions, type NotificationCenterErrorCode, type NotificationCenterErrorDetail, type NotificationCenterTransport, type NotificationContentType, type NotificationDto, type NotificationInboxQuery, type NotificationInboxResult, type NotificationMarkAllReadResult, type NotificationMarkReadResult, type NotificationReadStatus, type NotificationRealtimeChange, type NotificationResource, type NotificationSource, type NotificationTypeSummary, type OpenCustomerSupportAssistantAction, type OpenFileAssistantAction, type ParsedAiEmployeeAssistantContent, type ParsedAiEmployeeEvent, type ParsedAssistantMessageStreamReference, type ParsedAssistantStreamEvent, type ParsedSessionMessage, type PingFrame, type SessionSubscriptionFrame, createAuthenticateFrame, createPingFrame, createSubscriptionFrame, hashText, isUuidV4, parseAiEmployeeAssistantContent, parseAiEmployeeEvent, parseJsonRecord };
|