@livekit/agents-plugin-liveavatar 1.3.0 → 1.3.3
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/api.cjs +150 -0
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.cts +81 -0
- package/dist/api.d.ts +81 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +128 -0
- package/dist/api.js.map +1 -0
- package/dist/avatar.cjs +525 -0
- package/dist/avatar.cjs.map +1 -0
- package/dist/avatar.d.cts +148 -0
- package/dist/avatar.d.ts +148 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +509 -0
- package/dist/avatar.js.map +1 -0
- package/dist/index.cjs +36 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/log.cjs +30 -0
- package/dist/log.cjs.map +1 -0
- package/dist/log.d.cts +3 -0
- package/dist/log.d.ts +3 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +6 -0
- package/dist/log.js.map +1 -0
- package/package.json +3 -3
package/dist/api.cjs
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var api_exports = {};
|
|
20
|
+
__export(api_exports, {
|
|
21
|
+
DEFAULT_API_URL: () => DEFAULT_API_URL,
|
|
22
|
+
LiveAvatarAPI: () => LiveAvatarAPI,
|
|
23
|
+
LiveAvatarException: () => LiveAvatarException
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(api_exports);
|
|
26
|
+
var import_agents = require("@livekit/agents");
|
|
27
|
+
var import_log = require("./log.cjs");
|
|
28
|
+
const DEFAULT_API_URL = "https://api.liveavatar.com/v1/sessions";
|
|
29
|
+
class LiveAvatarException extends Error {
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = "LiveAvatarException";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class LiveAvatarAPI {
|
|
36
|
+
apiKey;
|
|
37
|
+
apiUrl;
|
|
38
|
+
connOptions;
|
|
39
|
+
#logger = (0, import_log.log)();
|
|
40
|
+
constructor(options = {}) {
|
|
41
|
+
const apiKey = options.apiKey ?? process.env.LIVEAVATAR_API_KEY ?? "";
|
|
42
|
+
if (!apiKey) {
|
|
43
|
+
throw new LiveAvatarException("api_key or LIVEAVATAR_API_KEY must be set");
|
|
44
|
+
}
|
|
45
|
+
this.apiKey = apiKey;
|
|
46
|
+
this.apiUrl = options.apiUrl || DEFAULT_API_URL;
|
|
47
|
+
this.connOptions = options.connOptions || import_agents.DEFAULT_API_CONNECT_OPTIONS;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create a new streaming session, returning the session id and session token.
|
|
51
|
+
*
|
|
52
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 51-87 lines
|
|
53
|
+
*/
|
|
54
|
+
async createStreamingSession(opts) {
|
|
55
|
+
const livekitConfig = {
|
|
56
|
+
livekit_room: opts.roomName,
|
|
57
|
+
livekit_url: opts.livekitUrl,
|
|
58
|
+
livekit_client_token: opts.livekitToken
|
|
59
|
+
};
|
|
60
|
+
const payload = {
|
|
61
|
+
mode: "LITE",
|
|
62
|
+
avatar_id: opts.avatarId,
|
|
63
|
+
is_sandbox: opts.isSandbox ?? false,
|
|
64
|
+
livekit_config: livekitConfig
|
|
65
|
+
};
|
|
66
|
+
if (opts.videoQuality != null) {
|
|
67
|
+
payload.video_quality = opts.videoQuality;
|
|
68
|
+
}
|
|
69
|
+
const headers = {
|
|
70
|
+
accept: "application/json",
|
|
71
|
+
"content-type": "application/json",
|
|
72
|
+
"X-API-KEY": this.apiKey
|
|
73
|
+
};
|
|
74
|
+
return await this.post("/token", payload, headers);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Start a previously created streaming session.
|
|
78
|
+
*
|
|
79
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 92-97 lines
|
|
80
|
+
*/
|
|
81
|
+
async startStreamingSession(sessionId, sessionToken) {
|
|
82
|
+
const payload = { session_id: sessionId };
|
|
83
|
+
const headers = {
|
|
84
|
+
"content-type": "application/json",
|
|
85
|
+
Authorization: `Bearer ${sessionToken}`
|
|
86
|
+
};
|
|
87
|
+
return await this.post("/start", payload, headers);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Stop a running streaming session.
|
|
91
|
+
*
|
|
92
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 99-107 lines
|
|
93
|
+
*/
|
|
94
|
+
async stopStreamingSession(sessionId, sessionToken) {
|
|
95
|
+
const payload = { session_id: sessionId, reason: "USER_DISCONNECTED" };
|
|
96
|
+
const headers = {
|
|
97
|
+
"content-type": "application/json",
|
|
98
|
+
Authorization: `Bearer ${sessionToken}`
|
|
99
|
+
};
|
|
100
|
+
return await this.post("/stop", payload, headers);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* POST helper with the same retry/backoff semantics as the Python plugin.
|
|
104
|
+
*
|
|
105
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 109-138 lines
|
|
106
|
+
*/
|
|
107
|
+
async post(endpoint, payload, headers) {
|
|
108
|
+
const url = this.apiUrl + endpoint;
|
|
109
|
+
const maxRetry = this.connOptions.maxRetry;
|
|
110
|
+
for (let i = 0; i <= maxRetry; i++) {
|
|
111
|
+
try {
|
|
112
|
+
const response = await fetch(url, {
|
|
113
|
+
method: "POST",
|
|
114
|
+
headers,
|
|
115
|
+
body: JSON.stringify(payload),
|
|
116
|
+
signal: AbortSignal.timeout(this.connOptions.timeoutMs)
|
|
117
|
+
});
|
|
118
|
+
if (!response.ok) {
|
|
119
|
+
const text = await response.text();
|
|
120
|
+
throw new import_agents.APIStatusError({
|
|
121
|
+
message: `Server returned an error for ${url}: ${response.status}`,
|
|
122
|
+
options: { statusCode: response.status, body: { error: text } }
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return await response.json();
|
|
126
|
+
} catch (e) {
|
|
127
|
+
if (e instanceof import_agents.APIStatusError && !e.retryable) {
|
|
128
|
+
throw e;
|
|
129
|
+
}
|
|
130
|
+
this.#logger.warn(
|
|
131
|
+
{ error: String(e), url, attempt: i },
|
|
132
|
+
`API request to ${url} failed on attempt ${i}`
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
if (i < maxRetry) {
|
|
136
|
+
await new Promise((resolve) => setTimeout(resolve, this.connOptions.retryIntervalMs));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
throw new import_agents.APIConnectionError({
|
|
140
|
+
message: `Failed to call LiveAvatar API after ${maxRetry + 1} attempts`
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
145
|
+
0 && (module.exports = {
|
|
146
|
+
DEFAULT_API_URL,
|
|
147
|
+
LiveAvatarAPI,
|
|
148
|
+
LiveAvatarException
|
|
149
|
+
});
|
|
150
|
+
//# sourceMappingURL=api.cjs.map
|
package/dist/api.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport {\n type APIConnectOptions,\n APIConnectionError,\n APIStatusError,\n DEFAULT_API_CONNECT_OPTIONS,\n} from '@livekit/agents';\nimport { log } from './log.js';\n\nexport const DEFAULT_API_URL = 'https://api.liveavatar.com/v1/sessions';\n\nexport type VideoQuality = 'very_high' | 'high' | 'medium' | 'low';\n\n/**\n * Exception thrown when the LiveAvatar plugin or the LiveAvatar service errors.\n */\nexport class LiveAvatarException extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'LiveAvatarException';\n }\n}\n\nexport interface CreateStreamingSessionOptions {\n livekitUrl: string;\n livekitToken: string;\n roomName: string;\n avatarId: string;\n isSandbox?: boolean;\n videoQuality?: VideoQuality | null;\n}\n\nexport interface SessionResponse {\n data: {\n session_id: string;\n session_token: string;\n [key: string]: unknown;\n };\n code: number;\n [key: string]: unknown;\n}\n\nexport interface StartSessionResponse {\n data: {\n ws_url: string;\n [key: string]: unknown;\n };\n code: number;\n [key: string]: unknown;\n}\n\nexport interface StopSessionResponse {\n data: Record<string, unknown>;\n code: number;\n [key: string]: unknown;\n}\n\nexport interface LiveAvatarAPIOptions {\n apiKey?: string;\n apiUrl?: string;\n connOptions?: APIConnectOptions;\n}\n\n/**\n * Thin client for the LiveAvatar HTTP API.\n *\n * Mirrors `livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py`.\n */\nexport class LiveAvatarAPI {\n private apiKey: string;\n private apiUrl: string;\n private connOptions: APIConnectOptions;\n\n #logger = log();\n\n constructor(options: LiveAvatarAPIOptions = {}) {\n const apiKey = options.apiKey ?? process.env.LIVEAVATAR_API_KEY ?? '';\n if (!apiKey) {\n throw new LiveAvatarException('api_key or LIVEAVATAR_API_KEY must be set');\n }\n this.apiKey = apiKey;\n this.apiUrl = options.apiUrl || DEFAULT_API_URL;\n this.connOptions = options.connOptions || DEFAULT_API_CONNECT_OPTIONS;\n }\n\n /**\n * Create a new streaming session, returning the session id and session token.\n *\n * Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 51-87 lines\n */\n async createStreamingSession(opts: CreateStreamingSessionOptions): Promise<SessionResponse> {\n const livekitConfig = {\n livekit_room: opts.roomName,\n livekit_url: opts.livekitUrl,\n livekit_client_token: opts.livekitToken,\n };\n\n const payload: Record<string, unknown> = {\n mode: 'LITE',\n avatar_id: opts.avatarId,\n is_sandbox: opts.isSandbox ?? false,\n livekit_config: livekitConfig,\n };\n\n if (opts.videoQuality != null) {\n payload.video_quality = opts.videoQuality;\n }\n\n const headers = {\n accept: 'application/json',\n 'content-type': 'application/json',\n 'X-API-KEY': this.apiKey,\n };\n return (await this.post('/token', payload, headers)) as SessionResponse;\n }\n\n /**\n * Start a previously created streaming session.\n *\n * Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 92-97 lines\n */\n async startStreamingSession(\n sessionId: string,\n sessionToken: string,\n ): Promise<StartSessionResponse> {\n const payload = { session_id: sessionId };\n const headers = {\n 'content-type': 'application/json',\n Authorization: `Bearer ${sessionToken}`,\n };\n return (await this.post('/start', payload, headers)) as StartSessionResponse;\n }\n\n /**\n * Stop a running streaming session.\n *\n * Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 99-107 lines\n */\n async stopStreamingSession(\n sessionId: string,\n sessionToken: string,\n ): Promise<StopSessionResponse> {\n const payload = { session_id: sessionId, reason: 'USER_DISCONNECTED' };\n const headers = {\n 'content-type': 'application/json',\n Authorization: `Bearer ${sessionToken}`,\n };\n return (await this.post('/stop', payload, headers)) as StopSessionResponse;\n }\n\n /**\n * POST helper with the same retry/backoff semantics as the Python plugin.\n *\n * Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 109-138 lines\n */\n private async post(\n endpoint: string,\n payload: Record<string, unknown>,\n headers: Record<string, string>,\n ): Promise<unknown> {\n const url = this.apiUrl + endpoint;\n const maxRetry = this.connOptions.maxRetry;\n // `maxRetry` is the number of retries on top of the initial attempt, so we\n // run up to `maxRetry + 1` total attempts. This matches the convention used\n // by other agents-js plugins (e.g. lemonslice/runway) and ensures a single\n // attempt still fires when callers configure `maxRetry: 0`.\n for (let i = 0; i <= maxRetry; i++) {\n try {\n const response = await fetch(url, {\n method: 'POST',\n headers,\n body: JSON.stringify(payload),\n signal: AbortSignal.timeout(this.connOptions.timeoutMs),\n });\n if (!response.ok) {\n const text = await response.text();\n throw new APIStatusError({\n message: `Server returned an error for ${url}: ${response.status}`,\n options: { statusCode: response.status, body: { error: text } },\n });\n }\n return await response.json();\n } catch (e) {\n if (e instanceof APIStatusError && !e.retryable) {\n throw e;\n }\n this.#logger.warn(\n { error: String(e), url, attempt: i },\n `API request to ${url} failed on attempt ${i}`,\n );\n }\n\n if (i < maxRetry) {\n await new Promise((resolve) => setTimeout(resolve, this.connOptions.retryIntervalMs));\n }\n }\n throw new APIConnectionError({\n message: `Failed to call LiveAvatar API after ${maxRetry + 1} attempts`,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAKO;AACP,iBAAoB;AAEb,MAAM,kBAAkB;AAOxB,MAAM,4BAA4B,MAAM;AAAA,EAC7C,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AA+CO,MAAM,cAAc;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA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ectOptions } from '@livekit/agents';
|
|
2
|
+
export declare const DEFAULT_API_URL = "https://api.liveavatar.com/v1/sessions";
|
|
3
|
+
export type VideoQuality = 'very_high' | 'high' | 'medium' | 'low';
|
|
4
|
+
/**
|
|
5
|
+
* Exception thrown when the LiveAvatar plugin or the LiveAvatar service errors.
|
|
6
|
+
*/
|
|
7
|
+
export declare class LiveAvatarException extends Error {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
export interface CreateStreamingSessionOptions {
|
|
11
|
+
livekitUrl: string;
|
|
12
|
+
livekitToken: string;
|
|
13
|
+
roomName: string;
|
|
14
|
+
avatarId: string;
|
|
15
|
+
isSandbox?: boolean;
|
|
16
|
+
videoQuality?: VideoQuality | null;
|
|
17
|
+
}
|
|
18
|
+
export interface SessionResponse {
|
|
19
|
+
data: {
|
|
20
|
+
session_id: string;
|
|
21
|
+
session_token: string;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
code: number;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
export interface StartSessionResponse {
|
|
28
|
+
data: {
|
|
29
|
+
ws_url: string;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
code: number;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
export interface StopSessionResponse {
|
|
36
|
+
data: Record<string, unknown>;
|
|
37
|
+
code: number;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
export interface LiveAvatarAPIOptions {
|
|
41
|
+
apiKey?: string;
|
|
42
|
+
apiUrl?: string;
|
|
43
|
+
connOptions?: APIConnectOptions;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Thin client for the LiveAvatar HTTP API.
|
|
47
|
+
*
|
|
48
|
+
* Mirrors `livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py`.
|
|
49
|
+
*/
|
|
50
|
+
export declare class LiveAvatarAPI {
|
|
51
|
+
#private;
|
|
52
|
+
private apiKey;
|
|
53
|
+
private apiUrl;
|
|
54
|
+
private connOptions;
|
|
55
|
+
constructor(options?: LiveAvatarAPIOptions);
|
|
56
|
+
/**
|
|
57
|
+
* Create a new streaming session, returning the session id and session token.
|
|
58
|
+
*
|
|
59
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 51-87 lines
|
|
60
|
+
*/
|
|
61
|
+
createStreamingSession(opts: CreateStreamingSessionOptions): Promise<SessionResponse>;
|
|
62
|
+
/**
|
|
63
|
+
* Start a previously created streaming session.
|
|
64
|
+
*
|
|
65
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 92-97 lines
|
|
66
|
+
*/
|
|
67
|
+
startStreamingSession(sessionId: string, sessionToken: string): Promise<StartSessionResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Stop a running streaming session.
|
|
70
|
+
*
|
|
71
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 99-107 lines
|
|
72
|
+
*/
|
|
73
|
+
stopStreamingSession(sessionId: string, sessionToken: string): Promise<StopSessionResponse>;
|
|
74
|
+
/**
|
|
75
|
+
* POST helper with the same retry/backoff semantics as the Python plugin.
|
|
76
|
+
*
|
|
77
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 109-138 lines
|
|
78
|
+
*/
|
|
79
|
+
private post;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=api.d.ts.map
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type APIConnectOptions } from '@livekit/agents';
|
|
2
|
+
export declare const DEFAULT_API_URL = "https://api.liveavatar.com/v1/sessions";
|
|
3
|
+
export type VideoQuality = 'very_high' | 'high' | 'medium' | 'low';
|
|
4
|
+
/**
|
|
5
|
+
* Exception thrown when the LiveAvatar plugin or the LiveAvatar service errors.
|
|
6
|
+
*/
|
|
7
|
+
export declare class LiveAvatarException extends Error {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
export interface CreateStreamingSessionOptions {
|
|
11
|
+
livekitUrl: string;
|
|
12
|
+
livekitToken: string;
|
|
13
|
+
roomName: string;
|
|
14
|
+
avatarId: string;
|
|
15
|
+
isSandbox?: boolean;
|
|
16
|
+
videoQuality?: VideoQuality | null;
|
|
17
|
+
}
|
|
18
|
+
export interface SessionResponse {
|
|
19
|
+
data: {
|
|
20
|
+
session_id: string;
|
|
21
|
+
session_token: string;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
code: number;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
export interface StartSessionResponse {
|
|
28
|
+
data: {
|
|
29
|
+
ws_url: string;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
code: number;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
export interface StopSessionResponse {
|
|
36
|
+
data: Record<string, unknown>;
|
|
37
|
+
code: number;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
export interface LiveAvatarAPIOptions {
|
|
41
|
+
apiKey?: string;
|
|
42
|
+
apiUrl?: string;
|
|
43
|
+
connOptions?: APIConnectOptions;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Thin client for the LiveAvatar HTTP API.
|
|
47
|
+
*
|
|
48
|
+
* Mirrors `livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py`.
|
|
49
|
+
*/
|
|
50
|
+
export declare class LiveAvatarAPI {
|
|
51
|
+
#private;
|
|
52
|
+
private apiKey;
|
|
53
|
+
private apiUrl;
|
|
54
|
+
private connOptions;
|
|
55
|
+
constructor(options?: LiveAvatarAPIOptions);
|
|
56
|
+
/**
|
|
57
|
+
* Create a new streaming session, returning the session id and session token.
|
|
58
|
+
*
|
|
59
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 51-87 lines
|
|
60
|
+
*/
|
|
61
|
+
createStreamingSession(opts: CreateStreamingSessionOptions): Promise<SessionResponse>;
|
|
62
|
+
/**
|
|
63
|
+
* Start a previously created streaming session.
|
|
64
|
+
*
|
|
65
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 92-97 lines
|
|
66
|
+
*/
|
|
67
|
+
startStreamingSession(sessionId: string, sessionToken: string): Promise<StartSessionResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Stop a running streaming session.
|
|
70
|
+
*
|
|
71
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 99-107 lines
|
|
72
|
+
*/
|
|
73
|
+
stopStreamingSession(sessionId: string, sessionToken: string): Promise<StopSessionResponse>;
|
|
74
|
+
/**
|
|
75
|
+
* POST helper with the same retry/backoff semantics as the Python plugin.
|
|
76
|
+
*
|
|
77
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 109-138 lines
|
|
78
|
+
*/
|
|
79
|
+
private post;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EAIvB,MAAM,iBAAiB,CAAC;AAGzB,eAAO,MAAM,eAAe,2CAA2C,CAAC;AAExE,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEnE;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED,MAAM,WAAW,6BAA6B;IAC5C,UAAU,EAAE,MA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B,CACzB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,oBAAoB,CAAC;IAShC;;;;OAIG;IACG,oBAAoB,CACxB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,mBAAmB,CAAC;IAS/B;;;;OAIG;YACW,IAAI;CA6CnB"}
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {
|
|
2
|
+
APIConnectionError,
|
|
3
|
+
APIStatusError,
|
|
4
|
+
DEFAULT_API_CONNECT_OPTIONS
|
|
5
|
+
} from "@livekit/agents";
|
|
6
|
+
import { log } from "./log.js";
|
|
7
|
+
const DEFAULT_API_URL = "https://api.liveavatar.com/v1/sessions";
|
|
8
|
+
class LiveAvatarException extends Error {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "LiveAvatarException";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
class LiveAvatarAPI {
|
|
15
|
+
apiKey;
|
|
16
|
+
apiUrl;
|
|
17
|
+
connOptions;
|
|
18
|
+
#logger = log();
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
const apiKey = options.apiKey ?? process.env.LIVEAVATAR_API_KEY ?? "";
|
|
21
|
+
if (!apiKey) {
|
|
22
|
+
throw new LiveAvatarException("api_key or LIVEAVATAR_API_KEY must be set");
|
|
23
|
+
}
|
|
24
|
+
this.apiKey = apiKey;
|
|
25
|
+
this.apiUrl = options.apiUrl || DEFAULT_API_URL;
|
|
26
|
+
this.connOptions = options.connOptions || DEFAULT_API_CONNECT_OPTIONS;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a new streaming session, returning the session id and session token.
|
|
30
|
+
*
|
|
31
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 51-87 lines
|
|
32
|
+
*/
|
|
33
|
+
async createStreamingSession(opts) {
|
|
34
|
+
const livekitConfig = {
|
|
35
|
+
livekit_room: opts.roomName,
|
|
36
|
+
livekit_url: opts.livekitUrl,
|
|
37
|
+
livekit_client_token: opts.livekitToken
|
|
38
|
+
};
|
|
39
|
+
const payload = {
|
|
40
|
+
mode: "LITE",
|
|
41
|
+
avatar_id: opts.avatarId,
|
|
42
|
+
is_sandbox: opts.isSandbox ?? false,
|
|
43
|
+
livekit_config: livekitConfig
|
|
44
|
+
};
|
|
45
|
+
if (opts.videoQuality != null) {
|
|
46
|
+
payload.video_quality = opts.videoQuality;
|
|
47
|
+
}
|
|
48
|
+
const headers = {
|
|
49
|
+
accept: "application/json",
|
|
50
|
+
"content-type": "application/json",
|
|
51
|
+
"X-API-KEY": this.apiKey
|
|
52
|
+
};
|
|
53
|
+
return await this.post("/token", payload, headers);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Start a previously created streaming session.
|
|
57
|
+
*
|
|
58
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 92-97 lines
|
|
59
|
+
*/
|
|
60
|
+
async startStreamingSession(sessionId, sessionToken) {
|
|
61
|
+
const payload = { session_id: sessionId };
|
|
62
|
+
const headers = {
|
|
63
|
+
"content-type": "application/json",
|
|
64
|
+
Authorization: `Bearer ${sessionToken}`
|
|
65
|
+
};
|
|
66
|
+
return await this.post("/start", payload, headers);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Stop a running streaming session.
|
|
70
|
+
*
|
|
71
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 99-107 lines
|
|
72
|
+
*/
|
|
73
|
+
async stopStreamingSession(sessionId, sessionToken) {
|
|
74
|
+
const payload = { session_id: sessionId, reason: "USER_DISCONNECTED" };
|
|
75
|
+
const headers = {
|
|
76
|
+
"content-type": "application/json",
|
|
77
|
+
Authorization: `Bearer ${sessionToken}`
|
|
78
|
+
};
|
|
79
|
+
return await this.post("/stop", payload, headers);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* POST helper with the same retry/backoff semantics as the Python plugin.
|
|
83
|
+
*
|
|
84
|
+
* Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 109-138 lines
|
|
85
|
+
*/
|
|
86
|
+
async post(endpoint, payload, headers) {
|
|
87
|
+
const url = this.apiUrl + endpoint;
|
|
88
|
+
const maxRetry = this.connOptions.maxRetry;
|
|
89
|
+
for (let i = 0; i <= maxRetry; i++) {
|
|
90
|
+
try {
|
|
91
|
+
const response = await fetch(url, {
|
|
92
|
+
method: "POST",
|
|
93
|
+
headers,
|
|
94
|
+
body: JSON.stringify(payload),
|
|
95
|
+
signal: AbortSignal.timeout(this.connOptions.timeoutMs)
|
|
96
|
+
});
|
|
97
|
+
if (!response.ok) {
|
|
98
|
+
const text = await response.text();
|
|
99
|
+
throw new APIStatusError({
|
|
100
|
+
message: `Server returned an error for ${url}: ${response.status}`,
|
|
101
|
+
options: { statusCode: response.status, body: { error: text } }
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return await response.json();
|
|
105
|
+
} catch (e) {
|
|
106
|
+
if (e instanceof APIStatusError && !e.retryable) {
|
|
107
|
+
throw e;
|
|
108
|
+
}
|
|
109
|
+
this.#logger.warn(
|
|
110
|
+
{ error: String(e), url, attempt: i },
|
|
111
|
+
`API request to ${url} failed on attempt ${i}`
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
if (i < maxRetry) {
|
|
115
|
+
await new Promise((resolve) => setTimeout(resolve, this.connOptions.retryIntervalMs));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
throw new APIConnectionError({
|
|
119
|
+
message: `Failed to call LiveAvatar API after ${maxRetry + 1} attempts`
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
DEFAULT_API_URL,
|
|
125
|
+
LiveAvatarAPI,
|
|
126
|
+
LiveAvatarException
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport {\n type APIConnectOptions,\n APIConnectionError,\n APIStatusError,\n DEFAULT_API_CONNECT_OPTIONS,\n} from '@livekit/agents';\nimport { log } from './log.js';\n\nexport const DEFAULT_API_URL = 'https://api.liveavatar.com/v1/sessions';\n\nexport type VideoQuality = 'very_high' | 'high' | 'medium' | 'low';\n\n/**\n * Exception thrown when the LiveAvatar plugin or the LiveAvatar service errors.\n */\nexport class LiveAvatarException extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'LiveAvatarException';\n }\n}\n\nexport interface CreateStreamingSessionOptions {\n livekitUrl: string;\n livekitToken: string;\n roomName: string;\n avatarId: string;\n isSandbox?: boolean;\n videoQuality?: VideoQuality | null;\n}\n\nexport interface SessionResponse {\n data: {\n session_id: string;\n session_token: string;\n [key: string]: unknown;\n };\n code: number;\n [key: string]: unknown;\n}\n\nexport interface StartSessionResponse {\n data: {\n ws_url: string;\n [key: string]: unknown;\n };\n code: number;\n [key: string]: unknown;\n}\n\nexport interface StopSessionResponse {\n data: Record<string, unknown>;\n code: number;\n [key: string]: unknown;\n}\n\nexport interface LiveAvatarAPIOptions {\n apiKey?: string;\n apiUrl?: string;\n connOptions?: APIConnectOptions;\n}\n\n/**\n * Thin client for the LiveAvatar HTTP API.\n *\n * Mirrors `livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py`.\n */\nexport class LiveAvatarAPI {\n private apiKey: string;\n private apiUrl: string;\n private connOptions: APIConnectOptions;\n\n #logger = log();\n\n constructor(options: LiveAvatarAPIOptions = {}) {\n const apiKey = options.apiKey ?? process.env.LIVEAVATAR_API_KEY ?? '';\n if (!apiKey) {\n throw new LiveAvatarException('api_key or LIVEAVATAR_API_KEY must be set');\n }\n this.apiKey = apiKey;\n this.apiUrl = options.apiUrl || DEFAULT_API_URL;\n this.connOptions = options.connOptions || DEFAULT_API_CONNECT_OPTIONS;\n }\n\n /**\n * Create a new streaming session, returning the session id and session token.\n *\n * Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 51-87 lines\n */\n async createStreamingSession(opts: CreateStreamingSessionOptions): Promise<SessionResponse> {\n const livekitConfig = {\n livekit_room: opts.roomName,\n livekit_url: opts.livekitUrl,\n livekit_client_token: opts.livekitToken,\n };\n\n const payload: Record<string, unknown> = {\n mode: 'LITE',\n avatar_id: opts.avatarId,\n is_sandbox: opts.isSandbox ?? false,\n livekit_config: livekitConfig,\n };\n\n if (opts.videoQuality != null) {\n payload.video_quality = opts.videoQuality;\n }\n\n const headers = {\n accept: 'application/json',\n 'content-type': 'application/json',\n 'X-API-KEY': this.apiKey,\n };\n return (await this.post('/token', payload, headers)) as SessionResponse;\n }\n\n /**\n * Start a previously created streaming session.\n *\n * Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 92-97 lines\n */\n async startStreamingSession(\n sessionId: string,\n sessionToken: string,\n ): Promise<StartSessionResponse> {\n const payload = { session_id: sessionId };\n const headers = {\n 'content-type': 'application/json',\n Authorization: `Bearer ${sessionToken}`,\n };\n return (await this.post('/start', payload, headers)) as StartSessionResponse;\n }\n\n /**\n * Stop a running streaming session.\n *\n * Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 99-107 lines\n */\n async stopStreamingSession(\n sessionId: string,\n sessionToken: string,\n ): Promise<StopSessionResponse> {\n const payload = { session_id: sessionId, reason: 'USER_DISCONNECTED' };\n const headers = {\n 'content-type': 'application/json',\n Authorization: `Bearer ${sessionToken}`,\n };\n return (await this.post('/stop', payload, headers)) as StopSessionResponse;\n }\n\n /**\n * POST helper with the same retry/backoff semantics as the Python plugin.\n *\n * Ref: python livekit-plugins/livekit-plugins-liveavatar/livekit/plugins/liveavatar/api.py - 109-138 lines\n */\n private async post(\n endpoint: string,\n payload: Record<string, unknown>,\n headers: Record<string, string>,\n ): Promise<unknown> {\n const url = this.apiUrl + endpoint;\n const maxRetry = this.connOptions.maxRetry;\n // `maxRetry` is the number of retries on top of the initial attempt, so we\n // run up to `maxRetry + 1` total attempts. This matches the convention used\n // by other agents-js plugins (e.g. lemonslice/runway) and ensures a single\n // attempt still fires when callers configure `maxRetry: 0`.\n for (let i = 0; i <= maxRetry; i++) {\n try {\n const response = await fetch(url, {\n method: 'POST',\n headers,\n body: JSON.stringify(payload),\n signal: AbortSignal.timeout(this.connOptions.timeoutMs),\n });\n if (!response.ok) {\n const text = await response.text();\n throw new APIStatusError({\n message: `Server returned an error for ${url}: ${response.status}`,\n options: { statusCode: response.status, body: { error: text } },\n });\n }\n return await response.json();\n } catch (e) {\n if (e instanceof APIStatusError && !e.retryable) {\n throw e;\n }\n this.#logger.warn(\n { error: String(e), url, attempt: i },\n `API request to ${url} failed on attempt ${i}`,\n );\n }\n\n if (i < maxRetry) {\n await new Promise((resolve) => setTimeout(resolve, this.connOptions.retryIntervalMs));\n }\n }\n throw new APIConnectionError({\n message: `Failed to call LiveAvatar API after ${maxRetry + 1} attempts`,\n });\n }\n}\n"],"mappings":"AAGA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW;AAEb,MAAM,kBAAkB;AAOxB,MAAM,4BAA4B,MAAM;AAAA,EAC7C,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AA+CO,MAAM,cAAc;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EAER,UAAU,IAAI;AAAA,EAEd,YAAY,UAAgC,CAAC,GAAG;AAC9C,UAAM,SAAS,QAAQ,UAAU,QAAQ,IAAI,sBAAsB;AACnE,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,o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