@d-id/client-sdk 3.0.0-staging.414 → 3.0.0-staging.416
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/LICENSE +21 -0
- package/README.md +2 -0
- package/dist/index-DCAt0P7O.js +2062 -0
- package/dist/index.d.ts +3525 -0
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +13 -13
- package/dist/{index-DBWnR72S.js → livekit-client.esm-QkbCKsng.js} +6234 -8269
- package/dist/livekit-manager-Cj0YXe2U.js +557 -0
- package/package.json +33 -9
- package/dist/livekit-manager-BM3JMzT5.js +0 -531
- package/dist/src/api/agents.d.ts +0 -18
- package/dist/src/api/apiClient.d.ts +0 -11
- package/dist/src/api/apiClient.test.d.ts +0 -1
- package/dist/src/api/knowledge.d.ts +0 -15
- package/dist/src/api/streams/index.d.ts +0 -1
- package/dist/src/api/streams/streamApi.d.ts +0 -3
- package/dist/src/api/streams/streamApi.test.d.ts +0 -1
- package/dist/src/api/streams/streamsApiV2.d.ts +0 -5
- package/dist/src/auth/get-auth-header.d.ts +0 -5
- package/dist/src/auth/get-auth-header.test.d.ts +0 -1
- package/dist/src/config/consts.d.ts +0 -3
- package/dist/src/config/environment.d.ts +0 -5
- package/dist/src/errors/base-error.d.ts +0 -182
- package/dist/src/errors/chat/chat-creation-failed.d.ts +0 -30
- package/dist/src/errors/chat/chat-mode-downgraded.d.ts +0 -35
- package/dist/src/errors/errors.test.d.ts +0 -1
- package/dist/src/errors/http-error.d.ts +0 -74
- package/dist/src/errors/index.d.ts +0 -9
- package/dist/src/errors/network-error.d.ts +0 -72
- package/dist/src/errors/request-meta.d.ts +0 -12
- package/dist/src/errors/stream-error.d.ts +0 -37
- package/dist/src/errors/validation-error.d.ts +0 -67
- package/dist/src/errors/ws-error.d.ts +0 -34
- package/dist/src/index.d.ts +0 -20
- package/dist/src/public-api.test.d.ts +0 -1
- package/dist/src/services/agent-manager/connect-to-manager.d.ts +0 -19
- package/dist/src/services/agent-manager/connect-to-manager.test.d.ts +0 -1
- package/dist/src/services/agent-manager/index.d.ts +0 -64
- package/dist/src/services/agent-manager/index.test.d.ts +0 -1
- package/dist/src/services/analytics/mixpanel.d.ts +0 -22
- package/dist/src/services/analytics/mixpanel.test.d.ts +0 -1
- package/dist/src/services/analytics/timestamp-tracker.d.ts +0 -15
- package/dist/src/services/chat/index.d.ts +0 -10
- package/dist/src/services/chat/index.test.d.ts +0 -1
- package/dist/src/services/chat/intial-messages.d.ts +0 -3
- package/dist/src/services/chat/intial-messages.test.d.ts +0 -1
- package/dist/src/services/socket-manager/index.d.ts +0 -12
- package/dist/src/services/socket-manager/message-queue.d.ts +0 -12
- package/dist/src/services/socket-manager/message-queue.test.d.ts +0 -1
- package/dist/src/services/streaming-manager/advanced.test.d.ts +0 -1
- package/dist/src/services/streaming-manager/business-flows.test.d.ts +0 -5
- package/dist/src/services/streaming-manager/common.d.ts +0 -101
- package/dist/src/services/streaming-manager/data-channel-handlers.d.ts +0 -3
- package/dist/src/services/streaming-manager/disconnect.test.d.ts +0 -5
- package/dist/src/services/streaming-manager/edge-cases.test.d.ts +0 -1
- package/dist/src/services/streaming-manager/factory.d.ts +0 -13
- package/dist/src/services/streaming-manager/factory.test.d.ts +0 -1
- package/dist/src/services/streaming-manager/index.d.ts +0 -5
- package/dist/src/services/streaming-manager/livekit-manager.d.ts +0 -10
- package/dist/src/services/streaming-manager/livekit-manager.test.d.ts +0 -1
- package/dist/src/services/streaming-manager/stats/av-sync.d.ts +0 -3
- package/dist/src/services/streaming-manager/stats/av-sync.test.d.ts +0 -1
- package/dist/src/services/streaming-manager/stats/poll.d.ts +0 -16
- package/dist/src/services/streaming-manager/stats/report.d.ts +0 -19
- package/dist/src/services/streaming-manager/stats/report.test.d.ts +0 -1
- package/dist/src/services/streaming-manager/webrtc-core.test.d.ts +0 -1
- package/dist/src/services/streaming-manager/webrtc-manager.d.ts +0 -12
- package/dist/src/services/streaming-manager/webrtc-utils.test.d.ts +0 -5
- package/dist/src/test-utils/factories/agent-manager.factory.d.ts +0 -3
- package/dist/src/test-utils/factories/agent.factory.d.ts +0 -4
- package/dist/src/test-utils/factories/agents-api.factory.d.ts +0 -1
- package/dist/src/test-utils/factories/analytics.factory.d.ts +0 -1
- package/dist/src/test-utils/factories/chat.factory.d.ts +0 -1
- package/dist/src/test-utils/factories/index.d.ts +0 -8
- package/dist/src/test-utils/factories/socket-manager.factory.d.ts +0 -1
- package/dist/src/test-utils/factories/stream-api.factory.d.ts +0 -1
- package/dist/src/test-utils/factories/streaming-manager.factory.d.ts +0 -4
- package/dist/src/types/auth.d.ts +0 -95
- package/dist/src/types/entities/agents/agent.d.ts +0 -202
- package/dist/src/types/entities/agents/chat.d.ts +0 -476
- package/dist/src/types/entities/agents/index.d.ts +0 -3
- package/dist/src/types/entities/agents/manager.d.ts +0 -897
- package/dist/src/types/entities/avatar.d.ts +0 -21
- package/dist/src/types/entities/index.d.ts +0 -3
- package/dist/src/types/entities/knowledge/document.d.ts +0 -31
- package/dist/src/types/entities/knowledge/index.d.ts +0 -4
- package/dist/src/types/entities/knowledge/knowledge.d.ts +0 -56
- package/dist/src/types/entities/knowledge/record.d.ts +0 -24
- package/dist/src/types/entities/knowledge/retrival.d.ts +0 -9
- package/dist/src/types/face-rect.d.ts +0 -6
- package/dist/src/types/index.d.ts +0 -6
- package/dist/src/types/stream/api/clip.d.ts +0 -122
- package/dist/src/types/stream/api/index.d.ts +0 -2
- package/dist/src/types/stream/api/talk.d.ts +0 -77
- package/dist/src/types/stream/data-channel.d.ts +0 -16
- package/dist/src/types/stream/index.d.ts +0 -4
- package/dist/src/types/stream/rtc.d.ts +0 -125
- package/dist/src/types/stream/stream.d.ts +0 -856
- package/dist/src/types/stream/streams-v2.d.ts +0 -28
- package/dist/src/types/stream-script.d.ts +0 -138
- package/dist/src/types/voice/stt.d.ts +0 -16
- package/dist/src/types/voice/tts.d.ts +0 -238
- package/dist/src/utils/agent.d.ts +0 -8
- package/dist/src/utils/analytics.d.ts +0 -31
- package/dist/src/utils/analytics.test.d.ts +0 -1
- package/dist/src/utils/chat.d.ts +0 -4
- package/dist/src/utils/content-parser.d.ts +0 -35
- package/dist/src/utils/content-parser.test.d.ts +0 -1
- package/dist/src/utils/defer.d.ts +0 -7
- package/dist/src/utils/error-analytics.d.ts +0 -4
- package/dist/src/utils/error-analytics.test.d.ts +0 -1
- package/dist/src/utils/index.d.ts +0 -3
- package/dist/src/utils/retry-operation.d.ts +0 -38
- package/dist/src/utils/stream-end.d.ts +0 -5
- package/dist/src/utils/stream-end.test.d.ts +0 -1
- package/dist/src/utils/tool-calls.d.ts +0 -27
- package/dist/src/utils/tool-calls.test.d.ts +0 -1
- package/dist/src/utils/user-context.d.ts +0 -15
- package/dist/src/utils/user-context.test.d.ts +0 -1
- package/dist/src/version.d.ts +0 -7
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { AgentManager, AgentManagerOptions, Chat, ChatMode, CreateStreamOptions, Message } from '../../types';
|
|
2
|
-
import { SocketManager } from '../socket-manager';
|
|
3
|
-
import { StreamingManager } from '../streaming-manager';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Mutable state shared between the agent manager's connect/chat/stream helpers.
|
|
7
|
-
* @internal Implementation type; not part of the public SDK surface.
|
|
8
|
-
*/
|
|
9
|
-
export interface AgentManagerItems {
|
|
10
|
-
chat?: Chat;
|
|
11
|
-
streamingManager?: StreamingManager<CreateStreamOptions>;
|
|
12
|
-
socketManager?: SocketManager;
|
|
13
|
-
messages: Message[];
|
|
14
|
-
chatMode: ChatMode;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Creates an {@link AgentManager} for one agent: its chat, its video stream and its connections.
|
|
18
|
-
*
|
|
19
|
-
* Fetches the agent from the Agents API before it resolves, so the returned manager already has
|
|
20
|
-
* {@link AgentManager.agent | agent} and {@link AgentManager.starterMessages | starterMessages}
|
|
21
|
-
* filled in. No stream is opened until {@link AgentManager.connect | connect()} is called.
|
|
22
|
-
* {@link AgentManagerOptions.callbacks | callbacks} must include
|
|
23
|
-
* {@link AgentManagerCallbacks.onSrcObjectReady | onSrcObjectReady}, which is what attaches the
|
|
24
|
-
* streamed media to a video element.
|
|
25
|
-
*
|
|
26
|
-
* One option is checked here: an Expressive (V4) agent asked for {@link ChatMode.Off} or
|
|
27
|
-
* {@link ChatMode.DirectPlayback}, which only Talks (V2) and Clips (V3) agents support, rejects
|
|
28
|
-
* with a {@link ValidationError}. Every other bad argument surfaces later, as a
|
|
29
|
-
* {@link ValidationError} rejected by the method that was called on the returned manager, such as
|
|
30
|
-
* {@link AgentManager.chat | chat()} or {@link AgentManager.speak | speak()}.
|
|
31
|
-
*
|
|
32
|
-
* @param agent - Id of the agent to talk to: the `data-agent-id` from its Embed snippet, or the `id`
|
|
33
|
-
* returned by the Agents API.
|
|
34
|
-
* @param options - Credentials, callbacks and everything else the manager needs. See
|
|
35
|
-
* {@link AgentManagerOptions}.
|
|
36
|
-
* @returns A manager for that agent, ready to {@link AgentManager.connect | connect()}.
|
|
37
|
-
* @throws {@link ValidationError} When an Expressive (V4) agent is created with
|
|
38
|
-
* {@link ChatMode.Off} or {@link ChatMode.DirectPlayback}.
|
|
39
|
-
* @throws {@link HttpError} When the agent cannot be fetched — an unknown id, or a client key that
|
|
40
|
-
* is not authorized for the agent or the calling domain.
|
|
41
|
-
* @throws {@link NetworkError} When the request for the agent never reaches the server: the browser
|
|
42
|
-
* is offline, DNS or TLS fails, or the request is blocked.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```ts
|
|
46
|
-
* import * as sdk from '@d-id/client-sdk';
|
|
47
|
-
*
|
|
48
|
-
* const agentManager = await sdk.createAgentManager('agt_fumf1234', {
|
|
49
|
-
* auth: { type: 'key', clientKey: 'YOUR_CLIENT_KEY' },
|
|
50
|
-
* callbacks: {
|
|
51
|
-
* // Required: hand the streamed media to your video element.
|
|
52
|
-
* onSrcObjectReady(value) {
|
|
53
|
-
* videoElement.srcObject = value;
|
|
54
|
-
* },
|
|
55
|
-
* },
|
|
56
|
-
* });
|
|
57
|
-
*
|
|
58
|
-
* await agentManager.connect();
|
|
59
|
-
* await agentManager.chat('What is the distance to the moon?');
|
|
60
|
-
* ```
|
|
61
|
-
*
|
|
62
|
-
* @category Agent Manager
|
|
63
|
-
*/
|
|
64
|
-
export declare function createAgentManager(agent: string, options: AgentManagerOptions): Promise<AgentManager>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export interface AnalyticsOptions {
|
|
2
|
-
token: string;
|
|
3
|
-
agentId: string;
|
|
4
|
-
isEnabled?: boolean;
|
|
5
|
-
externalId?: string;
|
|
6
|
-
mixpanelAdditionalProperties?: Record<string, any>;
|
|
7
|
-
}
|
|
8
|
-
export interface Analytics {
|
|
9
|
-
token: string;
|
|
10
|
-
distinct_id?: string;
|
|
11
|
-
isEnabled: boolean;
|
|
12
|
-
chatId?: string;
|
|
13
|
-
agentId: string;
|
|
14
|
-
owner_id?: string;
|
|
15
|
-
getRandom(): string;
|
|
16
|
-
track(event: string, props?: Record<string, any>, eventTimestamp?: number): Promise<any>;
|
|
17
|
-
linkTrack(mixpanelEvent: string, props: Record<string, any>, event: string, dependencies: string[]): any;
|
|
18
|
-
enrich(props: Record<string, any>): void;
|
|
19
|
-
additionalProperties: Record<string, any>;
|
|
20
|
-
}
|
|
21
|
-
export declare function _resetOfflineBufferForTests(): void;
|
|
22
|
-
export declare function initializeAnalytics(config: AnalyticsOptions): Analytics;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const latencyTimestampTracker: {
|
|
2
|
-
reset: () => number;
|
|
3
|
-
update: () => number;
|
|
4
|
-
get: (delta?: boolean) => number;
|
|
5
|
-
};
|
|
6
|
-
export declare const interruptTimestampTracker: {
|
|
7
|
-
reset: () => number;
|
|
8
|
-
update: () => number;
|
|
9
|
-
get: (delta?: boolean) => number;
|
|
10
|
-
};
|
|
11
|
-
export declare const streamReadyTimestampTracker: {
|
|
12
|
-
reset: () => number;
|
|
13
|
-
update: () => number;
|
|
14
|
-
get: (delta?: boolean) => number;
|
|
15
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Agent, AgentsAPI, Chat, ChatMode } from '../../types';
|
|
2
|
-
import { Analytics } from '../analytics/mixpanel';
|
|
3
|
-
|
|
4
|
-
export declare function getRequestHeaders(chatMode?: ChatMode): {
|
|
5
|
-
headers?: Record<string, string>;
|
|
6
|
-
};
|
|
7
|
-
export declare function createChat(agent: Agent, agentsApi: AgentsAPI, analytics: Analytics, chatMode?: ChatMode, persist?: boolean, chat?: Chat): Promise<{
|
|
8
|
-
chat: Chat | undefined;
|
|
9
|
-
chatMode: ChatMode | undefined;
|
|
10
|
-
}>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ChatProgressCallback } from '../../types';
|
|
2
|
-
import { Auth } from '../../types/auth';
|
|
3
|
-
|
|
4
|
-
export interface SocketManager {
|
|
5
|
-
socket?: WebSocket;
|
|
6
|
-
disconnect: () => void;
|
|
7
|
-
subscribeToEvents: (data: any) => void;
|
|
8
|
-
}
|
|
9
|
-
export declare function createSocketManager(auth: Auth, host: string, callbacks: {
|
|
10
|
-
onMessage: ChatProgressCallback;
|
|
11
|
-
onError?: (error: Error) => void;
|
|
12
|
-
}, externalId?: string): Promise<SocketManager>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Agent, AgentManagerOptions, ChatProgress, StreamEvents } from '../../types';
|
|
2
|
-
import { AgentManagerItems } from '../agent-manager';
|
|
3
|
-
import { Analytics } from '../analytics/mixpanel';
|
|
4
|
-
|
|
5
|
-
export interface ChatEventQueue {
|
|
6
|
-
[sequence: number]: string;
|
|
7
|
-
answer?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function createMessageEventQueue(analytics: Analytics, items: AgentManagerItems, options: AgentManagerOptions, agentEntity: Agent, onStreamDone: (reason?: string) => void): {
|
|
10
|
-
clearQueue: () => void;
|
|
11
|
-
onMessage: (event: ChatProgress | StreamEvents, data: any) => void;
|
|
12
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { CreateSessionV2Options, CreateStreamOptions, InterruptOptions, PayloadType, StreamType } from '../../types';
|
|
2
|
-
import { InternalDataChannelTopic } from '../../types/stream/data-channel';
|
|
3
|
-
|
|
4
|
-
export declare const createStreamingLogger: (debug: boolean, prefix: string) => (message: string, extra?: any) => false | void;
|
|
5
|
-
/**
|
|
6
|
-
* Shared type for all streaming managers (LiveKit, WebRTC, etc.)
|
|
7
|
-
* This type represents the return value of any streaming manager implementation
|
|
8
|
-
*/
|
|
9
|
-
export type StreamingManager<T extends CreateStreamOptions | CreateSessionV2Options> = {
|
|
10
|
-
/**
|
|
11
|
-
* Method to send request to server to get clip or talk depending on payload
|
|
12
|
-
* @param payload The payload to send to the streaming service
|
|
13
|
-
*/
|
|
14
|
-
speak(payload: PayloadType<T>): Promise<any>;
|
|
15
|
-
/**
|
|
16
|
-
* Method to close the streaming connection
|
|
17
|
-
*/
|
|
18
|
-
disconnect(): Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* The single send primitive: every message leaving the client goes out through here.
|
|
21
|
-
* V2 routes on the topic; V1 has no topic concept and ignores it.
|
|
22
|
-
* The promise tracks the send attempt and never rejects - failures go to `callbacks.onError`.
|
|
23
|
-
* @param topic Data-channel topic to send on
|
|
24
|
-
* @param payload The message payload to send, already serialized
|
|
25
|
-
*/
|
|
26
|
-
sendDataChannelMessage(topic: InternalDataChannelTopic, payload: string): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Publish a microphone stream to the DataChannel
|
|
29
|
-
* Can be called after connection to add microphone input
|
|
30
|
-
* @param stream The MediaStream containing the microphone audio track
|
|
31
|
-
* supported only for livekit manager
|
|
32
|
-
*/
|
|
33
|
-
publishMicrophoneStream?(stream: MediaStream): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Unpublish the currently published microphone stream
|
|
36
|
-
* Can be called after connection to remove microphone input
|
|
37
|
-
* supported only for livekit manager
|
|
38
|
-
*/
|
|
39
|
-
unpublishMicrophoneStream?(): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Replace the currently published microphone MediaStreamTrack without
|
|
42
|
-
* unpublishing. Preserves the LiveKit publication (SSRC, trackSid) so the
|
|
43
|
-
* server sees continuous audio. Resolves once LiveKit has switched the
|
|
44
|
-
* underlying RTCRtpSender's track. Rejects if no publication exists —
|
|
45
|
-
* caller should fall back to `publishMicrophoneStream` in that case.
|
|
46
|
-
* supported only for livekit manager
|
|
47
|
-
*/
|
|
48
|
-
replaceMicrophoneTrack?(track: MediaStreamTrack): Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Publish a camera video stream to the LiveKit room.
|
|
51
|
-
* Can be called after connection to enable vision.
|
|
52
|
-
* supported only for livekit manager
|
|
53
|
-
*/
|
|
54
|
-
publishCameraStream?(stream: MediaStream): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* Unpublish the currently published camera stream.
|
|
57
|
-
* Can be called after connection to disable vision.
|
|
58
|
-
* supported only for livekit manager
|
|
59
|
-
*/
|
|
60
|
-
unpublishCameraStream?(): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Session identifier information, should be returned in the body of all streaming requests
|
|
63
|
-
*/
|
|
64
|
-
sessionId: string;
|
|
65
|
-
/**
|
|
66
|
-
* Id of current streaming session
|
|
67
|
-
*/
|
|
68
|
-
streamId: string;
|
|
69
|
-
/**
|
|
70
|
-
* Type of streaming implementation being used
|
|
71
|
-
*/
|
|
72
|
-
streamType: StreamType;
|
|
73
|
-
/**
|
|
74
|
-
* Whether interrupt functionality is available for this stream
|
|
75
|
-
*/
|
|
76
|
-
interruptAvailable: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Whether the current stream segment can be interrupted by the user
|
|
79
|
-
*/
|
|
80
|
-
isInterruptible: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Send an interrupt for the current stream segment.
|
|
83
|
-
*
|
|
84
|
-
* Returns whether an interrupt was actually sent: `false` when there is nothing to interrupt
|
|
85
|
-
* (the stream does not support it, it is not a Fluent stream, no video is playing, or the
|
|
86
|
-
* interrupt type is one this transport drops), and `false` when the transport could not carry
|
|
87
|
-
* it because the connection or the data channel is not up.
|
|
88
|
-
*/
|
|
89
|
-
interrupt(type: InterruptOptions['type']): boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Register an RPC method handler on the LiveKit room.
|
|
92
|
-
* Used internally by the agent-manager for client tool delegation.
|
|
93
|
-
* supported only for livekit manager
|
|
94
|
-
*/
|
|
95
|
-
registerRpcMethod?(method: string, handler: (data: any) => Promise<string>): void;
|
|
96
|
-
/**
|
|
97
|
-
* Unregister a previously registered RPC method.
|
|
98
|
-
* supported only for livekit manager
|
|
99
|
-
*/
|
|
100
|
-
unregisterRpcMethod?(method: string): void;
|
|
101
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Agent, CreateSessionV2Options, CreateStreamOptions, StreamingManagerOptions } from '../../types';
|
|
2
|
-
import { StreamingManager } from './common';
|
|
3
|
-
|
|
4
|
-
export declare enum StreamApiVersion {
|
|
5
|
-
V1 = "v1",
|
|
6
|
-
V2 = "v2"
|
|
7
|
-
}
|
|
8
|
-
export type ExtendedStreamOptions = ({
|
|
9
|
-
version: StreamApiVersion.V1;
|
|
10
|
-
} & CreateStreamOptions) | ({
|
|
11
|
-
version: StreamApiVersion.V2;
|
|
12
|
-
} & CreateSessionV2Options);
|
|
13
|
-
export declare function createStreamingManager(agent: Agent, streamOptions: ExtendedStreamOptions, options: StreamingManagerOptions, signal?: AbortSignal): Promise<StreamingManager<CreateStreamOptions | CreateSessionV2Options>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { StreamApiVersion as StreamApiVersion, createStreamingManager } from './factory';
|
|
2
|
-
export type { ExtendedStreamOptions } from './factory';
|
|
3
|
-
export type { StreamingManager } from './common';
|
|
4
|
-
export type { LiveKitStreamingManager } from './livekit-manager';
|
|
5
|
-
export * from './webrtc-manager';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CreateSessionV2Options, CreateStreamOptions, StreamingManagerOptions } from '../../types';
|
|
2
|
-
import { StreamingManager } from './common';
|
|
3
|
-
|
|
4
|
-
export declare function handleInitError(error: unknown, log: (message?: any, ...optionalParams: any[]) => void, callbacks: StreamingManagerOptions['callbacks']): void;
|
|
5
|
-
export declare function createLiveKitStreamingManager<T extends CreateSessionV2Options>(agentId: string, sessionOptions: CreateSessionV2Options, options: StreamingManagerOptions): Promise<StreamingManager<T> & {
|
|
6
|
-
reconnect(): Promise<void>;
|
|
7
|
-
}>;
|
|
8
|
-
export type LiveKitStreamingManager<T extends CreateStreamOptions> = StreamingManager<T> & {
|
|
9
|
-
reconnect(): Promise<void>;
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ConnectivityState, StreamingState } from '../../../types';
|
|
2
|
-
import { VideoRTCStatsReport } from './report';
|
|
3
|
-
|
|
4
|
-
export interface AudioArmContext {
|
|
5
|
-
sttLatency?: number;
|
|
6
|
-
serviceLatency?: number;
|
|
7
|
-
}
|
|
8
|
-
export declare function createAudioStatsDetector(getStats: () => Promise<RTCStatsReport | undefined>, onFirstAudioDetected: (context: AudioArmContext) => void): {
|
|
9
|
-
arm(context?: AudioArmContext): void;
|
|
10
|
-
destroy(): void;
|
|
11
|
-
};
|
|
12
|
-
export declare function createVideoStatsMonitor(getStats: () => Promise<RTCStatsReport | undefined>, getIsConnected: () => boolean, onConnected: () => void, onVideoStateChange?: (state: StreamingState, statsReport?: VideoRTCStatsReport) => void, onConnectivityStateChange?: (state: ConnectivityState) => void): {
|
|
13
|
-
start: () => void;
|
|
14
|
-
stop: () => void;
|
|
15
|
-
getReport: () => VideoRTCStatsReport | null;
|
|
16
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AnalyticsRTCStatsReport, AvSyncReport, SlimRTCStatsReport } from '../../../types';
|
|
2
|
-
|
|
3
|
-
export interface VideoRTCStatsReport {
|
|
4
|
-
webRTCStats: {
|
|
5
|
-
anomalies: AnalyticsRTCStatsReport[];
|
|
6
|
-
avSync: AvSyncReport | null;
|
|
7
|
-
aggregateReport: AnalyticsRTCStatsReport;
|
|
8
|
-
minRtt: number;
|
|
9
|
-
maxRtt: number;
|
|
10
|
-
avgRtt: number;
|
|
11
|
-
minJitterDelayInInterval: number;
|
|
12
|
-
maxJitterDelayInInterval: number;
|
|
13
|
-
avgJitterDelayInInterval: number;
|
|
14
|
-
};
|
|
15
|
-
codec: string;
|
|
16
|
-
resolution: string;
|
|
17
|
-
}
|
|
18
|
-
export declare function formatStats(stats: RTCStatsReport): SlimRTCStatsReport;
|
|
19
|
-
export declare function createVideoStatsReport(stats: SlimRTCStatsReport[], interval: number, previousStats?: SlimRTCStatsReport): VideoRTCStatsReport | null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
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, signal?: AbortSignal): Promise<StreamingManager<T>>;
|
|
11
|
-
export type WebRTCStreamingManager<T extends CreateStreamOptions> = StreamingManager<T>;
|
|
12
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const AgentsApiFactory: import('rosie').IFactory<any>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const AnalyticsFactory: import('rosie').IFactory<any>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ChatFactory: import('rosie').IFactory<any>;
|
|
@@ -1,8 +0,0 @@
|
|
|
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';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const SocketManagerFactory: import('rosie').IFactory<any>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const StreamApiFactory: import('rosie').IFactory<any>;
|
package/dist/src/types/auth.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A bearer token for the Agents API.
|
|
3
|
-
*
|
|
4
|
-
* Account-wide, so it is meant for a trusted environment — a server, a build step, an internal
|
|
5
|
-
* tool. Anyone who reads the token can spend the account's credits, so do not ship one in a page
|
|
6
|
-
* you serve to users; use {@link ClientKeyAuth} there. The SDK sends it as
|
|
7
|
-
* `Authorization: Bearer <token>~<connectionId>`, appending a per-connection id the D-ID
|
|
8
|
-
* authorizer strips before it validates the token.
|
|
9
|
-
*
|
|
10
|
-
* @category Authentication
|
|
11
|
-
*/
|
|
12
|
-
export interface BearerToken {
|
|
13
|
-
/**
|
|
14
|
-
* Discriminator selecting this variant of {@link Auth}.
|
|
15
|
-
*/
|
|
16
|
-
type: 'bearer';
|
|
17
|
-
/**
|
|
18
|
-
* The bearer token itself, sent in the `Authorization` header.
|
|
19
|
-
*/
|
|
20
|
-
token: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* HTTP basic credentials for the Agents API, given either pre-encoded or as a username and
|
|
24
|
-
* password.
|
|
25
|
-
*
|
|
26
|
-
* Like {@link BearerToken} these are account-wide and belong in a trusted environment, never in a
|
|
27
|
-
* client bundle. The SDK sends them as `Authorization: Basic <credentials>~<connectionId>`, where
|
|
28
|
-
* the `token` form is used as the credentials as-is and the `username`/`password` form is
|
|
29
|
-
* base64-encoded as `username:password` first; the trailing per-connection id is stripped by the
|
|
30
|
-
* D-ID authorizer before the credentials are validated.
|
|
31
|
-
*
|
|
32
|
-
* @category Authentication
|
|
33
|
-
*/
|
|
34
|
-
export type BasicAuth = {
|
|
35
|
-
/**
|
|
36
|
-
* Discriminator selecting this variant of {@link Auth}.
|
|
37
|
-
*/
|
|
38
|
-
type: 'basic';
|
|
39
|
-
/**
|
|
40
|
-
* Credentials that are already base64-encoded, as `username:password`. Used as they
|
|
41
|
-
* are, so they are not encoded a second time.
|
|
42
|
-
*/
|
|
43
|
-
token: string;
|
|
44
|
-
} | {
|
|
45
|
-
/**
|
|
46
|
-
* Discriminator selecting this variant of {@link Auth}.
|
|
47
|
-
*/
|
|
48
|
-
type: 'basic';
|
|
49
|
-
/**
|
|
50
|
-
* The account's user name; base64-encoded with the password before it is sent.
|
|
51
|
-
*/
|
|
52
|
-
username: string;
|
|
53
|
-
/**
|
|
54
|
-
* The account's password; base64-encoded with the user name before it is sent.
|
|
55
|
-
*/
|
|
56
|
-
password: string;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* A client key for the Agents API — the credential to use in a browser.
|
|
60
|
-
*
|
|
61
|
-
* This is the one shape that is safe to ship in a page: a client key is scoped to a single agent
|
|
62
|
-
* and only works from the domains allowed for it, so it cannot be reused elsewhere. Copy it from the
|
|
63
|
-
* agent's Embed snippet, where it appears as `data-client-key`, or create one with the Agents API
|
|
64
|
-
* (see the link below). The SDK sends it
|
|
65
|
-
* as `Authorization: Client-Key <clientKey>.<externalId>_<connectionId>`, where the external id is
|
|
66
|
-
* either {@link AgentManagerOptions.externalId | externalId} or a per-browser id the SDK keeps in
|
|
67
|
-
* `localStorage`.
|
|
68
|
-
*
|
|
69
|
-
* @see [Create a client key](https://docs.d-id.com/reference/createclientkey)
|
|
70
|
-
* @category Authentication
|
|
71
|
-
*/
|
|
72
|
-
export interface ClientKeyAuth {
|
|
73
|
-
/**
|
|
74
|
-
* Discriminator selecting this variant of {@link Auth}.
|
|
75
|
-
*/
|
|
76
|
-
type: 'key';
|
|
77
|
-
/**
|
|
78
|
-
* The client key: the `data-client-key` value from the agent's Embed snippet, or a key created with
|
|
79
|
-
* the Agents API.
|
|
80
|
-
*/
|
|
81
|
-
clientKey: string;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* The credentials {@link createAgentManager} accepts, as
|
|
85
|
-
* {@link AgentManagerOptions.auth | options.auth}.
|
|
86
|
-
*
|
|
87
|
-
* Pick {@link ClientKeyAuth} (`{ type: 'key', clientKey }`) for anything that runs in a browser: it
|
|
88
|
-
* is the only variant scoped to one agent and to the domains you allowed. {@link BearerToken} and
|
|
89
|
-
* {@link BasicAuth} carry account-wide credentials and belong in a trusted environment. Whichever
|
|
90
|
-
* you pass is used for every request the SDK makes — the REST calls, the video stream and the
|
|
91
|
-
* notifications web socket.
|
|
92
|
-
*
|
|
93
|
-
* @category Authentication
|
|
94
|
-
*/
|
|
95
|
-
export type Auth = BearerToken | BasicAuth | ClientKeyAuth;
|