@d-id/client-sdk 1.1.11 → 1.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/dist/index-BHt2AhLb.js +1284 -0
- package/dist/index.js +27 -1399
- package/dist/index.umd.cjs +38 -1
- package/dist/livekit-client.esm-C1GRQdZY.js +16663 -0
- package/dist/livekit-manager-DZ_BAT5P.js +123 -0
- package/dist/src/api/agents.d.ts +1 -0
- package/dist/src/api/apiClient.d.ts +4 -3
- package/dist/src/api/knowledge.d.ts +1 -0
- package/dist/src/api/streams/streamApi.d.ts +1 -0
- package/dist/src/api/streams/streamsApiV2.d.ts +5 -0
- package/dist/src/auth/get-auth-header.d.ts +1 -0
- package/dist/src/errors/chat/chat-creation-failed.d.ts +1 -0
- package/dist/src/errors/chat/chat-mode-downgraded.d.ts +1 -0
- package/dist/src/errors/validation-error.d.ts +1 -0
- package/dist/src/errors/ws-error.d.ts +1 -0
- package/dist/src/services/agent-manager/connect-to-manager.d.ts +1 -0
- package/dist/src/services/agent-manager/connect-to-manager.test.d.ts +1 -0
- package/dist/src/services/agent-manager/index.d.ts +1 -0
- package/dist/src/services/agent-manager/index.test.d.ts +1 -0
- package/dist/src/services/analytics/mixpanel.d.ts +1 -0
- package/dist/src/services/chat/index.d.ts +2 -2
- package/dist/src/services/chat/intial-messages.d.ts +1 -0
- package/dist/src/services/interrupt/index.d.ts +1 -0
- package/dist/src/services/socket-manager/index.d.ts +1 -0
- package/dist/src/services/socket-manager/message-queue.d.ts +1 -0
- package/dist/src/services/streaming-manager/advanced.test.d.ts +5 -0
- package/dist/src/services/streaming-manager/business-flows.test.d.ts +5 -0
- package/dist/src/services/streaming-manager/common.d.ts +43 -0
- package/dist/src/services/streaming-manager/disconnect.test.d.ts +5 -0
- package/dist/src/services/streaming-manager/edge-cases.test.d.ts +5 -0
- package/dist/src/services/streaming-manager/factory.d.ts +3 -0
- package/dist/src/services/streaming-manager/factory.test.d.ts +1 -0
- package/dist/src/services/streaming-manager/index.d.ts +4 -27
- package/dist/src/services/streaming-manager/livekit-manager.d.ts +5 -0
- package/dist/src/services/streaming-manager/stats/poll.d.ts +1 -1
- package/dist/src/services/streaming-manager/stats/report.d.ts +1 -0
- package/dist/src/services/streaming-manager/webrtc-core.test.d.ts +5 -0
- package/dist/src/services/streaming-manager/webrtc-manager.d.ts +12 -0
- package/dist/src/services/streaming-manager/webrtc-utils.test.d.ts +5 -0
- package/dist/src/test-utils/factories/agent-manager.factory.d.ts +3 -0
- package/dist/src/test-utils/factories/agent.factory.d.ts +4 -0
- package/dist/src/test-utils/factories/agents-api.factory.d.ts +1 -0
- package/dist/src/test-utils/factories/analytics.factory.d.ts +1 -0
- package/dist/src/test-utils/factories/chat.factory.d.ts +1 -0
- package/dist/src/test-utils/factories/index.d.ts +8 -0
- package/dist/src/test-utils/factories/socket-manager.factory.d.ts +1 -0
- package/dist/src/test-utils/factories/stream-api.factory.d.ts +1 -0
- package/dist/src/test-utils/factories/streaming-manager.factory.d.ts +4 -0
- package/dist/src/types/entities/agents/agent.d.ts +1 -0
- package/dist/src/types/entities/agents/manager.d.ts +7 -1
- package/dist/src/types/entities/agents/presenter.d.ts +6 -2
- package/dist/src/types/entities/knowledge/document.d.ts +1 -0
- package/dist/src/types/entities/knowledge/record.d.ts +1 -0
- package/dist/src/types/entities/video.d.ts +2 -1
- package/dist/src/types/stream/api/clip.d.ts +1 -0
- package/dist/src/types/stream/api/talk.d.ts +1 -0
- package/dist/src/types/stream/index.d.ts +1 -0
- package/dist/src/types/stream/rtc.d.ts +1 -0
- package/dist/src/types/stream/stream.d.ts +1 -0
- package/dist/src/types/stream/streams-v2.d.ts +12 -0
- package/dist/src/types/stream-script.d.ts +1 -0
- package/dist/src/utils/agent.d.ts +2 -1
- package/dist/src/utils/analytics.d.ts +3 -2
- package/dist/src/utils/chat.d.ts +1 -0
- package/package.json +21 -2
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { c as x, a as N, S as O, C as g, b as U, d as P, e as V, A as w, f as q, T as J } from "./index-BHt2AhLb.js";
|
|
2
|
+
function Q(u, T, h, i) {
|
|
3
|
+
const p = x(u, `${T}/v2/agents/${h}`, i);
|
|
4
|
+
return {
|
|
5
|
+
async createStream(d) {
|
|
6
|
+
return p.post("/streams", d);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
async function W() {
|
|
11
|
+
try {
|
|
12
|
+
return await import("./livekit-client.esm-C1GRQdZY.js");
|
|
13
|
+
} catch {
|
|
14
|
+
throw new Error(
|
|
15
|
+
"LiveKit client is required for this streaming manager. Please install it using: npm install livekit-client"
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function H(u, T, h) {
|
|
20
|
+
var E, K, I;
|
|
21
|
+
const i = N(h.debug || !1, "LiveKitStreamingManager"), {
|
|
22
|
+
Room: p,
|
|
23
|
+
RoomEvent: d,
|
|
24
|
+
ConnectionState: C,
|
|
25
|
+
RemoteParticipant: z,
|
|
26
|
+
RemoteTrack: B
|
|
27
|
+
} = await W(), { callbacks: e, auth: j, baseURL: F, analytics: M } = h;
|
|
28
|
+
let a = null, v = !1, y = null, c = null;
|
|
29
|
+
const L = O.Fluent;
|
|
30
|
+
a = new p({
|
|
31
|
+
adaptiveStream: !0,
|
|
32
|
+
dynacast: !0
|
|
33
|
+
}), a.on(d.ConnectionStateChanged, (n) => {
|
|
34
|
+
var t, o, r, s, S;
|
|
35
|
+
switch (i("Connection state changed:", n), n) {
|
|
36
|
+
case C.Connecting:
|
|
37
|
+
(t = e.onConnectionStateChange) == null || t.call(e, g.Connecting);
|
|
38
|
+
break;
|
|
39
|
+
case C.Connected:
|
|
40
|
+
i("LiveKit room connected successfully"), v = !0, (o = e.onConnectionStateChange) == null || o.call(e, g.Connected);
|
|
41
|
+
break;
|
|
42
|
+
case C.Disconnected:
|
|
43
|
+
i("LiveKit room disconnected"), v = !1, (r = e.onConnectionStateChange) == null || r.call(e, g.Disconnected);
|
|
44
|
+
break;
|
|
45
|
+
case C.Reconnecting:
|
|
46
|
+
i("LiveKit room reconnecting..."), (s = e.onConnectionStateChange) == null || s.call(e, g.Connecting);
|
|
47
|
+
break;
|
|
48
|
+
case C.SignalReconnecting:
|
|
49
|
+
i("LiveKit room signal reconnecting..."), (S = e.onConnectionStateChange) == null || S.call(e, g.Connecting);
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}), a.on(d.ConnectionQualityChanged, (n, t) => {
|
|
53
|
+
var o;
|
|
54
|
+
t != null && t.isLocal && n === "poor" && (i("Connection quality is poor"), (o = e.onConnectivityStateChange) == null || o.call(e, U.Weak));
|
|
55
|
+
}), a.on(d.ParticipantConnected, (n) => {
|
|
56
|
+
i("Participant connected:", n.identity);
|
|
57
|
+
}), a.on(d.TrackSubscribed, (n, t, o) => {
|
|
58
|
+
var r, s;
|
|
59
|
+
i(`Track subscribed: ${n.kind} from ${o.identity}`), c ? c.addTrack(n.mediaStreamTrack) : c = new MediaStream([n.mediaStreamTrack]), (r = e.onSrcObjectReady) == null || r.call(e, c), n.kind === "video" && ((s = e.onVideoStateChange) == null || s.call(e, P.Start));
|
|
60
|
+
}), a.on(d.TrackUnsubscribed, (n, t, o) => {
|
|
61
|
+
var r;
|
|
62
|
+
i(`Track unsubscribed: ${n.kind} from ${o.identity}`), n.kind === "video" && ((r = e.onVideoStateChange) == null || r.call(e, P.Stop));
|
|
63
|
+
}), a.on(d.DataReceived, (n, t) => {
|
|
64
|
+
var r, s, S, D, $;
|
|
65
|
+
const o = new TextDecoder().decode(n);
|
|
66
|
+
i("Data received:", o);
|
|
67
|
+
try {
|
|
68
|
+
const m = JSON.parse(o);
|
|
69
|
+
m.subject === V.StreamStarted && ((r = m.metadata) != null && r.videoId) ? (y = m.metadata.videoId, (s = e.onVideoIdChange) == null || s.call(e, y), (S = e.onAgentActivityStateChange) == null || S.call(e, w.Talking)) : m.subject === V.StreamDone && (y = null, (D = e.onVideoIdChange) == null || D.call(e, y), ($ = e.onAgentActivityStateChange) == null || $.call(e, w.Idle));
|
|
70
|
+
} catch (m) {
|
|
71
|
+
i("Failed to parse data channel message:", m);
|
|
72
|
+
}
|
|
73
|
+
}), (E = e.onConnectionStateChange) == null || E.call(e, g.New);
|
|
74
|
+
const _ = Q(j, F || q, u, e.onError);
|
|
75
|
+
let f, A;
|
|
76
|
+
try {
|
|
77
|
+
const n = await _.createStream({
|
|
78
|
+
transport: J.Livekit
|
|
79
|
+
}), { agent_id: t, session_id: o, session_token: r, session_url: s } = n;
|
|
80
|
+
f = t, A = o, await a.connect(s, r), i("LiveKit room joined successfully");
|
|
81
|
+
} catch (n) {
|
|
82
|
+
throw i("Failed to connect to LiveKit room:", n), (K = e.onConnectionStateChange) == null || K.call(e, g.Fail), (I = e.onError) == null || I.call(e, n, { streamId: "" }), n;
|
|
83
|
+
}
|
|
84
|
+
M.enrich({
|
|
85
|
+
"stream-type": L
|
|
86
|
+
});
|
|
87
|
+
async function R(n) {
|
|
88
|
+
var t, o;
|
|
89
|
+
if (!v || !a) {
|
|
90
|
+
i("Room is not connected for sending messages"), (t = e.onError) == null || t.call(e, new Error("Room is not connected for sending messages"), {
|
|
91
|
+
streamId: f
|
|
92
|
+
});
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
await a.localParticipant.publishData(new TextEncoder().encode(n), { reliable: !0 });
|
|
97
|
+
} catch (r) {
|
|
98
|
+
i("Error sending data channel message", r), (o = e.onError) == null || o.call(e, r, { streamId: f });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
speak(n) {
|
|
103
|
+
const t = JSON.stringify({
|
|
104
|
+
type: "speak",
|
|
105
|
+
payload: n
|
|
106
|
+
});
|
|
107
|
+
return R(t);
|
|
108
|
+
},
|
|
109
|
+
async disconnect() {
|
|
110
|
+
var n, t;
|
|
111
|
+
a && (await a.disconnect(), a = null), c && (c.getTracks().forEach((o) => o.stop()), c = null), v = !1, (n = e.onConnectionStateChange) == null || n.call(e, g.Completed), (t = e.onAgentActivityStateChange) == null || t.call(e, w.Idle);
|
|
112
|
+
},
|
|
113
|
+
sendDataChannelMessage: R,
|
|
114
|
+
sessionId: A,
|
|
115
|
+
streamId: f,
|
|
116
|
+
streamType: L,
|
|
117
|
+
interruptAvailable: !0,
|
|
118
|
+
triggersAvailable: !1
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
H as createLiveKitStreamingManager
|
|
123
|
+
};
|
package/dist/src/api/agents.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Agent, AgentPayload, Auth, Chat, ChatPayload, ChatResponse, RatingEntity, RatingPayload, STTTokenResponse } from '../types/index';
|
|
2
2
|
import { RequestOptions } from './apiClient';
|
|
3
|
+
|
|
3
4
|
export declare function createAgentsApi(auth: Auth, host?: string, onError?: (error: Error, errorData: object) => void): {
|
|
4
5
|
create(payload: AgentPayload, options?: RequestOptions): Promise<Agent>;
|
|
5
6
|
getAgents(tag?: string, options?: RequestOptions): Promise<Agent[]>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Auth } from '../types/auth';
|
|
2
|
+
|
|
2
3
|
export type RequestOptions = RequestInit & {
|
|
3
4
|
skipErrorHandler?: boolean;
|
|
4
5
|
};
|
|
5
6
|
export declare function createClient(auth: Auth, host?: string, onError?: (error: Error, errorData: object) => void): {
|
|
6
7
|
get<T = any>(url: string, options?: RequestOptions): Promise<T>;
|
|
7
|
-
post<
|
|
8
|
-
delete<
|
|
9
|
-
patch<
|
|
8
|
+
post<T = any>(url: string, body?: any, options?: RequestOptions): Promise<T>;
|
|
9
|
+
delete<T = any>(url: string, body?: any, options?: RequestOptions): Promise<T>;
|
|
10
|
+
patch<T = any>(url: string, body?: any, options?: RequestOptions): Promise<T>;
|
|
10
11
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Auth, CreateDocumentPayload, DocumentData, KnowledgeData, KnowledgePayload, QueryResult, RecordData } from '../types/index';
|
|
2
|
+
|
|
2
3
|
export declare function createKnowledgeApi(auth: Auth, host?: string, onError?: (error: Error, errorData: object) => void): {
|
|
3
4
|
createKnowledge(payload: KnowledgePayload, options?: RequestInit): Promise<KnowledgeData>;
|
|
4
5
|
getKnowledgeBase(options?: RequestInit): Promise<KnowledgeData[]>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Auth, CreateStreamV2Options, CreateStreamV2Response } from '../../types';
|
|
2
|
+
|
|
3
|
+
export declare function createStreamApiV2(auth: Auth, host: string, agentId: string, onError?: (error: Error, errorData: object) => void): {
|
|
4
|
+
createStream(options: CreateStreamV2Options): Promise<CreateStreamV2Response>;
|
|
5
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StreamingManager } from '../streaming-manager';
|
|
2
2
|
import { Agent, AgentManagerOptions, AgentsAPI, Chat, CreateStreamOptions } from '../../types';
|
|
3
3
|
import { Analytics } from '../analytics/mixpanel';
|
|
4
|
+
|
|
4
5
|
type ConnectToManagerOptions = AgentManagerOptions & {
|
|
5
6
|
callbacks: AgentManagerOptions['callbacks'] & {
|
|
6
7
|
onVideoIdChange?: (videoId: string | null) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Agent, AgentManager, AgentManagerOptions, Auth, Chat, ChatMode, CreateStreamOptions, Message } from '../../types';
|
|
2
2
|
import { SocketManager } from '../socket-manager';
|
|
3
3
|
import { StreamingManager } from '../streaming-manager';
|
|
4
|
+
|
|
4
5
|
export interface AgentManagerItems {
|
|
5
6
|
chat?: Chat;
|
|
6
7
|
streamingManager?: StreamingManager<CreateStreamOptions>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ChatMode } from '../../types';
|
|
1
|
+
import { Agent, AgentsAPI, Chat, ChatMode } from '../../types';
|
|
3
2
|
import { Analytics } from '../analytics/mixpanel';
|
|
3
|
+
|
|
4
4
|
export declare function getRequestHeaders(chatMode?: ChatMode): Record<string, Record<string, string>>;
|
|
5
5
|
export declare function createChat(agent: Agent, agentsApi: AgentsAPI, analytics: Analytics, chatMode?: ChatMode, persist?: boolean, chat?: Chat): Promise<{
|
|
6
6
|
chat: Chat | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CreateStreamOptions, StreamType } from '../../types';
|
|
2
2
|
import { StreamingManager } from '../streaming-manager';
|
|
3
|
+
|
|
3
4
|
export declare function validateInterrupt(streamingManager: StreamingManager<CreateStreamOptions> | undefined, streamType: StreamType | undefined, videoId: string | null): void;
|
|
4
5
|
export declare function sendInterrupt(streamingManager: StreamingManager<CreateStreamOptions>, videoId: string): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Agent, AgentManagerOptions, ChatProgress, StreamEvents } from '../../types';
|
|
2
2
|
import { AgentManagerItems } from '../agent-manager';
|
|
3
3
|
import { Analytics } from '../analytics/mixpanel';
|
|
4
|
+
|
|
4
5
|
export interface ChatEventQueue {
|
|
5
6
|
[sequence: number]: string;
|
|
6
7
|
answer?: string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CreateStreamOptions, PayloadType, StreamType } from '../../types';
|
|
2
|
+
|
|
3
|
+
export declare const createStreamingLogger: (debug: boolean, prefix: string) => (message: string, extra?: any) => false | void;
|
|
4
|
+
/**
|
|
5
|
+
* Shared type for all streaming managers (LiveKit, WebRTC, etc.)
|
|
6
|
+
* This type represents the return value of any streaming manager implementation
|
|
7
|
+
*/
|
|
8
|
+
export type StreamingManager<T extends CreateStreamOptions> = {
|
|
9
|
+
/**
|
|
10
|
+
* Method to send request to server to get clip or talk depending on payload
|
|
11
|
+
* @param payload The payload to send to the streaming service
|
|
12
|
+
*/
|
|
13
|
+
speak(payload: PayloadType<T>): Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Method to close the streaming connection
|
|
16
|
+
*/
|
|
17
|
+
disconnect(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Method to send data channel messages to the server
|
|
20
|
+
* @param payload The message payload to send
|
|
21
|
+
*/
|
|
22
|
+
sendDataChannelMessage(payload: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Session identifier information, should be returned in the body of all streaming requests
|
|
25
|
+
*/
|
|
26
|
+
sessionId: string;
|
|
27
|
+
/**
|
|
28
|
+
* Id of current streaming session
|
|
29
|
+
*/
|
|
30
|
+
streamId: string;
|
|
31
|
+
/**
|
|
32
|
+
* Type of streaming implementation being used
|
|
33
|
+
*/
|
|
34
|
+
streamType: StreamType;
|
|
35
|
+
/**
|
|
36
|
+
* Whether interrupt functionality is available for this stream
|
|
37
|
+
*/
|
|
38
|
+
interruptAvailable: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether triggers functionality is available for this stream
|
|
41
|
+
*/
|
|
42
|
+
triggersAvailable: boolean;
|
|
43
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Agent, CreateStreamOptions, StreamingManagerOptions } from '../../types';
|
|
2
|
+
|
|
3
|
+
export declare function createStreamingManager<T extends CreateStreamOptions>(agent: Agent, streamOptions: T, options: StreamingManagerOptions): Promise<import('./common').StreamingManager<T>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,27 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @param payload
|
|
6
|
-
*/
|
|
7
|
-
speak(payload: PayloadType<T>): Promise<import('../../types/index').SendStreamPayloadResponse>;
|
|
8
|
-
/**
|
|
9
|
-
* Method to close RTC connection
|
|
10
|
-
*/
|
|
11
|
-
disconnect(): Promise<void>;
|
|
12
|
-
/**
|
|
13
|
-
* Method to send data channel messages to the server
|
|
14
|
-
*/
|
|
15
|
-
sendDataChannelMessage(payload: string): void;
|
|
16
|
-
/**
|
|
17
|
-
* Session identifier information, should be returned in the body of all streaming requests
|
|
18
|
-
*/
|
|
19
|
-
sessionId: string;
|
|
20
|
-
/**
|
|
21
|
-
* Id of current RTC stream
|
|
22
|
-
*/
|
|
23
|
-
streamId: string;
|
|
24
|
-
streamType: StreamType;
|
|
25
|
-
interruptAvailable: boolean | undefined;
|
|
26
|
-
}>;
|
|
27
|
-
export type StreamingManager<T extends CreateStreamOptions> = Awaited<ReturnType<typeof createStreamingManager<T>>>;
|
|
1
|
+
export { createStreamingManager } from './factory';
|
|
2
|
+
export type { StreamingManager } from './common';
|
|
3
|
+
export type { LiveKitStreamingManager } from './livekit-manager';
|
|
4
|
+
export * from './webrtc-manager';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CreateStreamOptions, StreamingManagerOptions } from '../../types';
|
|
2
|
+
import { StreamingManager } from './common';
|
|
3
|
+
|
|
4
|
+
export declare function createLiveKitStreamingManager<T extends CreateStreamOptions>(agentId: string, agent: T, options: StreamingManagerOptions): Promise<StreamingManager<T>>;
|
|
5
|
+
export type LiveKitStreamingManager<T extends CreateStreamOptions> = StreamingManager<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { ConnectivityState, StreamingState } from '../../../types';
|
|
3
2
|
import { VideoRTCStatsReport } from './report';
|
|
3
|
+
|
|
4
4
|
export declare function pollStats(peerConnection: RTCPeerConnection, getIsConnected: () => boolean, onConnected: () => void, onVideoStateChange?: (state: StreamingState, statsReport?: VideoRTCStatsReport) => void, onConnectivityStateChange?: (state: ConnectivityState) => void, warmup?: boolean): NodeJS.Timeout;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConnectionState, CreateStreamOptions, StreamEvents, StreamingManagerOptions } from '../../types';
|
|
2
|
+
import { createStreamingLogger, StreamingManager } from './common';
|
|
3
|
+
|
|
4
|
+
type DataChannelPayload = string | Record<string, unknown>;
|
|
5
|
+
export declare function mapConnectionState(state: RTCIceConnectionState): ConnectionState;
|
|
6
|
+
export declare const createParseDataChannelMessage: (log: ReturnType<typeof createStreamingLogger>) => (message: string) => {
|
|
7
|
+
subject: StreamEvents;
|
|
8
|
+
data: DataChannelPayload;
|
|
9
|
+
};
|
|
10
|
+
export declare function createWebRTCStreamingManager<T extends CreateStreamOptions>(agentId: string, streamOptions: T, { debug, callbacks, auth, baseURL, analytics }: StreamingManagerOptions): Promise<StreamingManager<T>>;
|
|
11
|
+
export type WebRTCStreamingManager<T extends CreateStreamOptions> = StreamingManager<T>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AgentsApiFactory: import('rosie').IFactory<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AnalyticsFactory: import('rosie').IFactory<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ChatFactory: import('rosie').IFactory<any>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { AgentManagerOptionsFactory } from './agent-manager.factory';
|
|
2
|
+
export { AgentFactory, StreamingAgentFactory } from './agent.factory';
|
|
3
|
+
export { AgentsApiFactory } from './agents-api.factory';
|
|
4
|
+
export { AnalyticsFactory } from './analytics.factory';
|
|
5
|
+
export { ChatFactory } from './chat.factory';
|
|
6
|
+
export { SocketManagerFactory } from './socket-manager.factory';
|
|
7
|
+
export { StreamApiFactory } from './stream-api.factory';
|
|
8
|
+
export { StreamingManagerFactory, StreamingManagerOptionsFactory } from './streaming-manager.factory';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SocketManagerFactory: import('rosie').IFactory<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const StreamApiFactory: import('rosie').IFactory<any>;
|
|
@@ -2,9 +2,10 @@ import { STTTokenResponse } from '../..';
|
|
|
2
2
|
import { Auth } from '../../auth';
|
|
3
3
|
import { AgentActivityState, CompatibilityMode, ConnectionState, ConnectivityState, SendStreamPayloadResponse, StreamEvents, StreamType, StreamingState } from '../../stream';
|
|
4
4
|
import { SupportedStreamScript } from '../../stream-script';
|
|
5
|
-
import
|
|
5
|
+
import { ManagerCallbacks as StreamManagerCallbacks } from '../../stream/stream';
|
|
6
6
|
import { Agent } from './agent';
|
|
7
7
|
import { ChatMode, ChatResponse, Interrupt, Message, RatingEntity } from './chat';
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* Types of events provided in Chat Progress Callback
|
|
10
11
|
*/
|
|
@@ -132,6 +133,7 @@ export interface AgentManagerOptions {
|
|
|
132
133
|
debug?: boolean;
|
|
133
134
|
enableAnalitics?: boolean;
|
|
134
135
|
mixpanelKey?: string;
|
|
136
|
+
mixpanelAdditionalProperties?: Record<string, any>;
|
|
135
137
|
/**
|
|
136
138
|
* Unique ID of agent user used in analytics. Pass it to override the default way to get distinctId
|
|
137
139
|
*/
|
|
@@ -154,6 +156,10 @@ export interface AgentManager {
|
|
|
154
156
|
* Get if the stream supports interrupt
|
|
155
157
|
*/
|
|
156
158
|
getIsInterruptAvailable: () => boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Get if the stream supports triggers
|
|
161
|
+
*/
|
|
162
|
+
getIsTriggersAvailable: () => boolean;
|
|
157
163
|
/**
|
|
158
164
|
* Array of starter messages that will be sent to the agent when the chat starts
|
|
159
165
|
*/
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ExtendedTextToSpeechProviders } from '../../voice/tts';
|
|
2
2
|
import { Rect } from '../../face-rect';
|
|
3
|
-
|
|
4
|
-
export type
|
|
3
|
+
|
|
4
|
+
export type videoType = 'talk' | 'clip' | 'expressive';
|
|
5
|
+
export type Presenter = TalkPresenter | ClipPresenter | ExpresivePresenter;
|
|
5
6
|
export interface BasePresenter {
|
|
6
7
|
type: videoType;
|
|
7
8
|
voice?: ExtendedTextToSpeechProviders & {
|
|
@@ -24,3 +25,6 @@ export interface ClipPresenter extends BasePresenter {
|
|
|
24
25
|
presenter_id: string;
|
|
25
26
|
is_greenscreen?: boolean;
|
|
26
27
|
}
|
|
28
|
+
export interface ExpresivePresenter extends BasePresenter {
|
|
29
|
+
type: 'expressive';
|
|
30
|
+
}
|
|
@@ -3,6 +3,7 @@ import { VideoRTCStatsReport } from '../../services/streaming-manager/stats/repo
|
|
|
3
3
|
import { Auth } from '../auth';
|
|
4
4
|
import { CreateClipStreamRequest, CreateTalkStreamRequest, SendClipStreamPayload, SendTalkStreamPayload } from './api';
|
|
5
5
|
import { ICreateStreamRequestResponse, IceCandidate, SendStreamPayloadResponse, Status } from './rtc';
|
|
6
|
+
|
|
6
7
|
export type CompatibilityMode = 'on' | 'off' | 'auto';
|
|
7
8
|
export declare enum StreamingState {
|
|
8
9
|
Start = "START",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum Transport {
|
|
2
|
+
Livekit = "livekit"
|
|
3
|
+
}
|
|
4
|
+
export interface CreateStreamV2Options {
|
|
5
|
+
transport: Transport.Livekit;
|
|
6
|
+
}
|
|
7
|
+
export interface CreateStreamV2Response {
|
|
8
|
+
agent_id: 'string';
|
|
9
|
+
session_id: 'string';
|
|
10
|
+
session_url: 'string';
|
|
11
|
+
session_token: 'string';
|
|
12
|
+
}
|