@livekit/agents-plugin-lemonslice 1.0.40
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 +201 -0
- package/README.md +66 -0
- package/dist/avatar.cjs +205 -0
- package/dist/avatar.cjs.map +1 -0
- package/dist/avatar.d.cts +127 -0
- package/dist/avatar.d.ts +127 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +187 -0
- package/dist/avatar.js.map +1 -0
- package/dist/index.cjs +35 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -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/dist/version.cjs +29 -0
- package/dist/version.cjs.map +1 -0
- package/dist/version.d.cts +2 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +51 -0
- package/src/avatar.ts +312 -0
- package/src/index.ts +19 -0
- package/src/log.ts +7 -0
- package/src/version.ts +4 -0
package/dist/avatar.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { type APIConnectOptions, voice } from '@livekit/agents';
|
|
2
|
+
import type { Room } from '@livekit/rtc-node';
|
|
3
|
+
/**
|
|
4
|
+
* Exception thrown when there are errors with the LemonSlice API.
|
|
5
|
+
*/
|
|
6
|
+
export declare class LemonSliceException extends Error {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Options for configuring an AvatarSession.
|
|
11
|
+
*/
|
|
12
|
+
export interface AvatarSessionOptions {
|
|
13
|
+
/**
|
|
14
|
+
* The ID of the LemonSlice agent to add to the session.
|
|
15
|
+
* Either agentId or agentImageUrl must be provided.
|
|
16
|
+
*/
|
|
17
|
+
agentId?: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* The URL of the image to use as the agent's avatar.
|
|
20
|
+
* Either agentId or agentImageUrl must be provided.
|
|
21
|
+
*/
|
|
22
|
+
agentImageUrl?: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* A prompt that subtly influences the avatar's movements and expressions.
|
|
25
|
+
*/
|
|
26
|
+
agentPrompt?: string | null;
|
|
27
|
+
/**
|
|
28
|
+
* The idle timeout, in seconds. Defaults to 60 seconds.
|
|
29
|
+
*/
|
|
30
|
+
idleTimeout?: number | null;
|
|
31
|
+
/**
|
|
32
|
+
* The LemonSlice API URL. Defaults to https://lemonslice.com/api/liveai/sessions
|
|
33
|
+
* or LEMONSLICE_API_URL environment variable.
|
|
34
|
+
*/
|
|
35
|
+
apiUrl?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The LemonSlice API key. Can also be set via LEMONSLICE_API_KEY environment variable.
|
|
38
|
+
*/
|
|
39
|
+
apiKey?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The identity of the avatar participant in the room. Defaults to 'lemonslice-avatar-agent'.
|
|
42
|
+
*/
|
|
43
|
+
avatarParticipantIdentity?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The name of the avatar participant in the room. Defaults to 'lemonslice-avatar-agent'.
|
|
46
|
+
*/
|
|
47
|
+
avatarParticipantName?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Connection options for API requests.
|
|
50
|
+
*/
|
|
51
|
+
connOptions?: APIConnectOptions;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Options for starting an avatar session.
|
|
55
|
+
*/
|
|
56
|
+
export interface StartOptions {
|
|
57
|
+
/**
|
|
58
|
+
* LiveKit server URL. Falls back to LIVEKIT_URL environment variable.
|
|
59
|
+
*/
|
|
60
|
+
livekitUrl?: string;
|
|
61
|
+
/**
|
|
62
|
+
* LiveKit API key. Falls back to LIVEKIT_API_KEY environment variable.
|
|
63
|
+
*/
|
|
64
|
+
livekitApiKey?: string;
|
|
65
|
+
/**
|
|
66
|
+
* LiveKit API secret. Falls back to LIVEKIT_API_SECRET environment variable.
|
|
67
|
+
*/
|
|
68
|
+
livekitApiSecret?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A LemonSlice avatar session.
|
|
72
|
+
*
|
|
73
|
+
* This class manages the connection between a LiveKit agent and a LemonSlice avatar,
|
|
74
|
+
* routing agent audio output to the avatar for visual representation.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* // Using an agent ID
|
|
79
|
+
* const avatar = new AvatarSession({
|
|
80
|
+
* agentId: 'your-agent-id',
|
|
81
|
+
* apiKey: 'your-lemonslice-api-key',
|
|
82
|
+
* });
|
|
83
|
+
* await avatar.start(agentSession, room);
|
|
84
|
+
*
|
|
85
|
+
* // Using a custom avatar image
|
|
86
|
+
* const avatar = new AvatarSession({
|
|
87
|
+
* agentImageUrl: 'your-image-url',
|
|
88
|
+
* apiKey: 'your-lemonslice-api-key',
|
|
89
|
+
* });
|
|
90
|
+
* await avatar.start(agentSession, room);
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare class AvatarSession {
|
|
94
|
+
#private;
|
|
95
|
+
private agentId;
|
|
96
|
+
private agentImageUrl;
|
|
97
|
+
private agentPrompt;
|
|
98
|
+
private idleTimeout;
|
|
99
|
+
private apiUrl;
|
|
100
|
+
private apiKey;
|
|
101
|
+
private avatarParticipantIdentity;
|
|
102
|
+
private avatarParticipantName;
|
|
103
|
+
private connOptions;
|
|
104
|
+
/**
|
|
105
|
+
* Creates a new AvatarSession.
|
|
106
|
+
*
|
|
107
|
+
* @param options - Configuration options for the avatar session
|
|
108
|
+
* @throws LemonSliceException if invalid agentId or agentImageUrl is provided, or if LemonSlice API key is not set
|
|
109
|
+
*/
|
|
110
|
+
constructor(options?: AvatarSessionOptions);
|
|
111
|
+
/**
|
|
112
|
+
* Starts the avatar session and connects it to the agent.
|
|
113
|
+
*
|
|
114
|
+
* This method:
|
|
115
|
+
* 1. Creates a LiveKit token for the avatar participant
|
|
116
|
+
* 2. Calls the LemonSlice API to start the avatar session
|
|
117
|
+
* 3. Configures the agent's audio output to stream to the avatar
|
|
118
|
+
*
|
|
119
|
+
* @param agentSession - The agent session to connect to the avatar
|
|
120
|
+
* @param room - The LiveKit room where the avatar will join
|
|
121
|
+
* @param options - Optional LiveKit credentials (falls back to environment variables)
|
|
122
|
+
* @throws LemonSliceException if LiveKit credentials are not available or if the avatar session fails to start
|
|
123
|
+
*/
|
|
124
|
+
start(agentSession: voice.AgentSession, room: Room, options?: StartOptions): Promise<void>;
|
|
125
|
+
private startAgent;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../src/avatar.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EAMtB,KAAK,EACN,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAY9C;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;OAEG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAa;;IACxB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,yBAAyB,CAAS;IAC1C,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,WAAW,CAAoB;IAIvC;;;;;OAKG;gBACS,OAAO,GAAE,oBAAyB;IA6B9C;;;;;;;;;;;;OAYG;IACG,KAAK,CACT,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,IAAI,CAAC;YA2DF,UAAU;CAmEzB"}
|
package/dist/avatar.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import {
|
|
2
|
+
APIConnectionError,
|
|
3
|
+
APIStatusError,
|
|
4
|
+
DEFAULT_API_CONNECT_OPTIONS,
|
|
5
|
+
getJobContext,
|
|
6
|
+
intervalForRetry,
|
|
7
|
+
voice
|
|
8
|
+
} from "@livekit/agents";
|
|
9
|
+
import { TrackKind } from "@livekit/rtc-node";
|
|
10
|
+
import { AccessToken } from "livekit-server-sdk";
|
|
11
|
+
import { log } from "./log.js";
|
|
12
|
+
const ATTRIBUTE_PUBLISH_ON_BEHALF = "lk.publish_on_behalf";
|
|
13
|
+
const DEFAULT_API_URL = "https://lemonslice.com/api/liveai/sessions";
|
|
14
|
+
const SAMPLE_RATE = 16e3;
|
|
15
|
+
const AVATAR_AGENT_IDENTITY = "lemonslice-avatar-agent";
|
|
16
|
+
const AVATAR_AGENT_NAME = "lemonslice-avatar-agent";
|
|
17
|
+
class LemonSliceException extends Error {
|
|
18
|
+
constructor(message) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = "LemonSliceException";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
class AvatarSession {
|
|
24
|
+
agentId;
|
|
25
|
+
agentImageUrl;
|
|
26
|
+
agentPrompt;
|
|
27
|
+
idleTimeout;
|
|
28
|
+
apiUrl;
|
|
29
|
+
apiKey;
|
|
30
|
+
avatarParticipantIdentity;
|
|
31
|
+
avatarParticipantName;
|
|
32
|
+
connOptions;
|
|
33
|
+
#logger = log();
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new AvatarSession.
|
|
36
|
+
*
|
|
37
|
+
* @param options - Configuration options for the avatar session
|
|
38
|
+
* @throws LemonSliceException if invalid agentId or agentImageUrl is provided, or if LemonSlice API key is not set
|
|
39
|
+
*/
|
|
40
|
+
constructor(options = {}) {
|
|
41
|
+
this.agentId = options.agentId ?? null;
|
|
42
|
+
this.agentImageUrl = options.agentImageUrl ?? null;
|
|
43
|
+
if (!this.agentId && !this.agentImageUrl) {
|
|
44
|
+
throw new LemonSliceException("Missing agentId or agentImageUrl");
|
|
45
|
+
}
|
|
46
|
+
if (this.agentId && this.agentImageUrl) {
|
|
47
|
+
throw new LemonSliceException("Only one of agentId or agentImageUrl can be provided");
|
|
48
|
+
}
|
|
49
|
+
this.agentPrompt = options.agentPrompt ?? null;
|
|
50
|
+
this.idleTimeout = options.idleTimeout ?? null;
|
|
51
|
+
this.apiUrl = options.apiUrl || process.env.LEMONSLICE_API_URL || DEFAULT_API_URL;
|
|
52
|
+
this.apiKey = options.apiKey || process.env.LEMONSLICE_API_KEY || "";
|
|
53
|
+
if (!this.apiKey) {
|
|
54
|
+
throw new LemonSliceException(
|
|
55
|
+
"The api_key must be set either by passing apiKey to the client or by setting the LEMONSLICE_API_KEY environment variable"
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
this.avatarParticipantIdentity = options.avatarParticipantIdentity || AVATAR_AGENT_IDENTITY;
|
|
59
|
+
this.avatarParticipantName = options.avatarParticipantName || AVATAR_AGENT_NAME;
|
|
60
|
+
this.connOptions = options.connOptions || DEFAULT_API_CONNECT_OPTIONS;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Starts the avatar session and connects it to the agent.
|
|
64
|
+
*
|
|
65
|
+
* This method:
|
|
66
|
+
* 1. Creates a LiveKit token for the avatar participant
|
|
67
|
+
* 2. Calls the LemonSlice API to start the avatar session
|
|
68
|
+
* 3. Configures the agent's audio output to stream to the avatar
|
|
69
|
+
*
|
|
70
|
+
* @param agentSession - The agent session to connect to the avatar
|
|
71
|
+
* @param room - The LiveKit room where the avatar will join
|
|
72
|
+
* @param options - Optional LiveKit credentials (falls back to environment variables)
|
|
73
|
+
* @throws LemonSliceException if LiveKit credentials are not available or if the avatar session fails to start
|
|
74
|
+
*/
|
|
75
|
+
async start(agentSession, room, options = {}) {
|
|
76
|
+
var _a;
|
|
77
|
+
const livekitUrl = options.livekitUrl || process.env.LIVEKIT_URL;
|
|
78
|
+
const livekitApiKey = options.livekitApiKey || process.env.LIVEKIT_API_KEY;
|
|
79
|
+
const livekitApiSecret = options.livekitApiSecret || process.env.LIVEKIT_API_SECRET;
|
|
80
|
+
if (!livekitUrl || !livekitApiKey || !livekitApiSecret) {
|
|
81
|
+
throw new LemonSliceException(
|
|
82
|
+
"livekitUrl, livekitApiKey, and livekitApiSecret must be set by arguments or environment variables"
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
let localParticipantIdentity;
|
|
86
|
+
try {
|
|
87
|
+
const jobCtx = getJobContext();
|
|
88
|
+
localParticipantIdentity = ((_a = jobCtx.agent) == null ? void 0 : _a.identity) || "";
|
|
89
|
+
if (!localParticipantIdentity && room.localParticipant) {
|
|
90
|
+
localParticipantIdentity = room.localParticipant.identity;
|
|
91
|
+
}
|
|
92
|
+
} catch {
|
|
93
|
+
if (!room.isConnected || !room.localParticipant) {
|
|
94
|
+
throw new LemonSliceException("failed to get local participant identity");
|
|
95
|
+
}
|
|
96
|
+
localParticipantIdentity = room.localParticipant.identity;
|
|
97
|
+
}
|
|
98
|
+
if (!localParticipantIdentity) {
|
|
99
|
+
throw new LemonSliceException("failed to get local participant identity");
|
|
100
|
+
}
|
|
101
|
+
const at = new AccessToken(livekitApiKey, livekitApiSecret, {
|
|
102
|
+
identity: this.avatarParticipantIdentity,
|
|
103
|
+
name: this.avatarParticipantName
|
|
104
|
+
});
|
|
105
|
+
at.kind = "agent";
|
|
106
|
+
at.addGrant({
|
|
107
|
+
roomJoin: true,
|
|
108
|
+
room: room.name
|
|
109
|
+
});
|
|
110
|
+
at.attributes = {
|
|
111
|
+
[ATTRIBUTE_PUBLISH_ON_BEHALF]: localParticipantIdentity
|
|
112
|
+
};
|
|
113
|
+
const livekitToken = await at.toJwt();
|
|
114
|
+
this.#logger.debug("starting avatar session");
|
|
115
|
+
await this.startAgent(livekitUrl, livekitToken);
|
|
116
|
+
agentSession.output.audio = new voice.DataStreamAudioOutput({
|
|
117
|
+
room,
|
|
118
|
+
destinationIdentity: this.avatarParticipantIdentity,
|
|
119
|
+
sampleRate: SAMPLE_RATE,
|
|
120
|
+
waitRemoteTrack: TrackKind.KIND_VIDEO
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
async startAgent(livekitUrl, livekitToken) {
|
|
124
|
+
for (let i = 0; i <= this.connOptions.maxRetry; i++) {
|
|
125
|
+
try {
|
|
126
|
+
const payload = {
|
|
127
|
+
transport_type: "livekit",
|
|
128
|
+
properties: {
|
|
129
|
+
livekit_url: livekitUrl,
|
|
130
|
+
livekit_token: livekitToken
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
if (this.agentId) {
|
|
134
|
+
payload.agent_id = this.agentId;
|
|
135
|
+
}
|
|
136
|
+
if (this.agentImageUrl) {
|
|
137
|
+
payload.agent_image_url = this.agentImageUrl;
|
|
138
|
+
}
|
|
139
|
+
if (this.agentPrompt) {
|
|
140
|
+
payload.agent_prompt = this.agentPrompt;
|
|
141
|
+
}
|
|
142
|
+
if (this.idleTimeout !== null) {
|
|
143
|
+
payload.idle_timeout = this.idleTimeout;
|
|
144
|
+
}
|
|
145
|
+
const response = await fetch(this.apiUrl, {
|
|
146
|
+
method: "POST",
|
|
147
|
+
headers: {
|
|
148
|
+
"Content-Type": "application/json",
|
|
149
|
+
"X-API-Key": this.apiKey
|
|
150
|
+
},
|
|
151
|
+
body: JSON.stringify(payload),
|
|
152
|
+
signal: AbortSignal.timeout(this.connOptions.timeoutMs)
|
|
153
|
+
});
|
|
154
|
+
if (!response.ok) {
|
|
155
|
+
const text = await response.text();
|
|
156
|
+
throw new APIStatusError({
|
|
157
|
+
message: "Server returned an error",
|
|
158
|
+
options: { statusCode: response.status, body: { error: text } }
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return;
|
|
162
|
+
} catch (e) {
|
|
163
|
+
if (e instanceof APIStatusError && !e.retryable) {
|
|
164
|
+
throw e;
|
|
165
|
+
}
|
|
166
|
+
if (e instanceof APIConnectionError) {
|
|
167
|
+
this.#logger.warn({ error: String(e) }, "failed to call lemonslice api");
|
|
168
|
+
} else {
|
|
169
|
+
this.#logger.error({ error: e }, "failed to call lemonslice api");
|
|
170
|
+
}
|
|
171
|
+
if (i <= this.connOptions.maxRetry - 1) {
|
|
172
|
+
await new Promise(
|
|
173
|
+
(resolve) => setTimeout(resolve, intervalForRetry(this.connOptions, i))
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
throw new APIConnectionError({
|
|
179
|
+
message: "Failed to start LemonSlice Avatar Session after all retries"
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
export {
|
|
184
|
+
AvatarSession,
|
|
185
|
+
LemonSliceException
|
|
186
|
+
};
|
|
187
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/avatar.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport {\n type APIConnectOptions,\n APIConnectionError,\n APIStatusError,\n DEFAULT_API_CONNECT_OPTIONS,\n getJobContext,\n intervalForRetry,\n voice,\n} from '@livekit/agents';\nimport type { Room } from '@livekit/rtc-node';\nimport { TrackKind } from '@livekit/rtc-node';\nimport type { VideoGrant } from 'livekit-server-sdk';\nimport { AccessToken } from 'livekit-server-sdk';\nimport { log } from './log.js';\n\nconst ATTRIBUTE_PUBLISH_ON_BEHALF = 'lk.publish_on_behalf';\nconst DEFAULT_API_URL = 'https://lemonslice.com/api/liveai/sessions';\nconst SAMPLE_RATE = 16000;\nconst AVATAR_AGENT_IDENTITY = 'lemonslice-avatar-agent';\nconst AVATAR_AGENT_NAME = 'lemonslice-avatar-agent';\n\n/**\n * Exception thrown when there are errors with the LemonSlice API.\n */\nexport class LemonSliceException extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'LemonSliceException';\n }\n}\n\n/**\n * Options for configuring an AvatarSession.\n */\nexport interface AvatarSessionOptions {\n /**\n * The ID of the LemonSlice agent to add to the session.\n * Either agentId or agentImageUrl must be provided.\n */\n agentId?: string | null;\n /**\n * The URL of the image to use as the agent's avatar.\n * Either agentId or agentImageUrl must be provided.\n */\n agentImageUrl?: string | null;\n /**\n * A prompt that subtly influences the avatar's movements and expressions.\n */\n agentPrompt?: string | null;\n /**\n * The idle timeout, in seconds. Defaults to 60 seconds.\n */\n idleTimeout?: number | null;\n /**\n * The LemonSlice API URL. Defaults to https://lemonslice.com/api/liveai/sessions\n * or LEMONSLICE_API_URL environment variable.\n */\n apiUrl?: string;\n /**\n * The LemonSlice API key. Can also be set via LEMONSLICE_API_KEY environment variable.\n */\n apiKey?: string;\n /**\n * The identity of the avatar participant in the room. Defaults to 'lemonslice-avatar-agent'.\n */\n avatarParticipantIdentity?: string;\n /**\n * The name of the avatar participant in the room. Defaults to 'lemonslice-avatar-agent'.\n */\n avatarParticipantName?: string;\n /**\n * Connection options for API requests.\n */\n connOptions?: APIConnectOptions;\n}\n\n/**\n * Options for starting an avatar session.\n */\nexport interface StartOptions {\n /**\n * LiveKit server URL. Falls back to LIVEKIT_URL environment variable.\n */\n livekitUrl?: string;\n /**\n * LiveKit API key. Falls back to LIVEKIT_API_KEY environment variable.\n */\n livekitApiKey?: string;\n /**\n * LiveKit API secret. Falls back to LIVEKIT_API_SECRET environment variable.\n */\n livekitApiSecret?: string;\n}\n\n/**\n * A LemonSlice avatar session.\n *\n * This class manages the connection between a LiveKit agent and a LemonSlice avatar,\n * routing agent audio output to the avatar for visual representation.\n *\n * @example\n * ```typescript\n * // Using an agent ID\n * const avatar = new AvatarSession({\n * agentId: 'your-agent-id',\n * apiKey: 'your-lemonslice-api-key',\n * });\n * await avatar.start(agentSession, room);\n *\n * // Using a custom avatar image\n * const avatar = new AvatarSession({\n * agentImageUrl: 'your-image-url',\n * apiKey: 'your-lemonslice-api-key',\n * });\n * await avatar.start(agentSession, room);\n * ```\n */\nexport class AvatarSession {\n private agentId: string | null;\n private agentImageUrl: string | null;\n private agentPrompt: string | null;\n private idleTimeout: number | null;\n private apiUrl: string;\n private apiKey: string;\n private avatarParticipantIdentity: string;\n private avatarParticipantName: string;\n private connOptions: APIConnectOptions;\n\n #logger = log();\n\n /**\n * Creates a new AvatarSession.\n *\n * @param options - Configuration options for the avatar session\n * @throws LemonSliceException if invalid agentId or agentImageUrl is provided, or if LemonSlice API key is not set\n */\n constructor(options: AvatarSessionOptions = {}) {\n this.agentId = options.agentId ?? null;\n this.agentImageUrl = options.agentImageUrl ?? null;\n\n if (!this.agentId && !this.agentImageUrl) {\n throw new LemonSliceException('Missing agentId or agentImageUrl');\n }\n if (this.agentId && this.agentImageUrl) {\n throw new LemonSliceException('Only one of agentId or agentImageUrl can be provided');\n }\n\n this.agentPrompt = options.agentPrompt ?? null;\n this.idleTimeout = options.idleTimeout ?? null;\n\n this.apiUrl = options.apiUrl || process.env.LEMONSLICE_API_URL || DEFAULT_API_URL;\n this.apiKey = options.apiKey || process.env.LEMONSLICE_API_KEY || '';\n\n if (!this.apiKey) {\n throw new LemonSliceException(\n 'The api_key must be set either by passing apiKey to the client or ' +\n 'by setting the LEMONSLICE_API_KEY environment variable',\n );\n }\n\n this.avatarParticipantIdentity = options.avatarParticipantIdentity || AVATAR_AGENT_IDENTITY;\n this.avatarParticipantName = options.avatarParticipantName || AVATAR_AGENT_NAME;\n this.connOptions = options.connOptions || DEFAULT_API_CONNECT_OPTIONS;\n }\n\n /**\n * Starts the avatar session and connects it to the agent.\n *\n * This method:\n * 1. Creates a LiveKit token for the avatar participant\n * 2. Calls the LemonSlice API to start the avatar session\n * 3. Configures the agent's audio output to stream to the avatar\n *\n * @param agentSession - The agent session to connect to the avatar\n * @param room - The LiveKit room where the avatar will join\n * @param options - Optional LiveKit credentials (falls back to environment variables)\n * @throws LemonSliceException if LiveKit credentials are not available or if the avatar session fails to start\n */\n async start(\n agentSession: voice.AgentSession,\n room: Room,\n options: StartOptions = {},\n ): Promise<void> {\n const livekitUrl = options.livekitUrl || process.env.LIVEKIT_URL;\n const livekitApiKey = options.livekitApiKey || process.env.LIVEKIT_API_KEY;\n const livekitApiSecret = options.livekitApiSecret || process.env.LIVEKIT_API_SECRET;\n\n if (!livekitUrl || !livekitApiKey || !livekitApiSecret) {\n throw new LemonSliceException(\n 'livekitUrl, livekitApiKey, and livekitApiSecret must be set ' +\n 'by arguments or environment variables',\n );\n }\n\n let localParticipantIdentity: string;\n try {\n const jobCtx = getJobContext();\n localParticipantIdentity = jobCtx.agent?.identity || '';\n if (!localParticipantIdentity && room.localParticipant) {\n localParticipantIdentity = room.localParticipant.identity;\n }\n } catch {\n if (!room.isConnected || !room.localParticipant) {\n throw new LemonSliceException('failed to get local participant identity');\n }\n localParticipantIdentity = room.localParticipant.identity;\n }\n\n if (!localParticipantIdentity) {\n throw new LemonSliceException('failed to get local participant identity');\n }\n\n const at = new AccessToken(livekitApiKey, livekitApiSecret, {\n identity: this.avatarParticipantIdentity,\n name: this.avatarParticipantName,\n });\n at.kind = 'agent';\n\n at.addGrant({\n roomJoin: true,\n room: room.name,\n } as VideoGrant);\n\n // allow the avatar agent to publish audio and video on behalf of your local agent\n at.attributes = {\n [ATTRIBUTE_PUBLISH_ON_BEHALF]: localParticipantIdentity,\n };\n\n const livekitToken = await at.toJwt();\n\n this.#logger.debug('starting avatar session');\n await this.startAgent(livekitUrl, livekitToken);\n\n agentSession.output.audio = new voice.DataStreamAudioOutput({\n room,\n destinationIdentity: this.avatarParticipantIdentity,\n sampleRate: SAMPLE_RATE,\n waitRemoteTrack: TrackKind.KIND_VIDEO,\n });\n }\n\n private async startAgent(livekitUrl: string, livekitToken: string): Promise<void> {\n for (let i = 0; i <= this.connOptions.maxRetry; i++) {\n try {\n const payload: Record<string, any> = {\n transport_type: 'livekit',\n properties: {\n livekit_url: livekitUrl,\n livekit_token: livekitToken,\n },\n };\n\n if (this.agentId) {\n payload.agent_id = this.agentId;\n }\n\n if (this.agentImageUrl) {\n payload.agent_image_url = this.agentImageUrl;\n }\n\n if (this.agentPrompt) {\n payload.agent_prompt = this.agentPrompt;\n }\n\n if (this.idleTimeout !== null) {\n payload.idle_timeout = this.idleTimeout;\n }\n\n const response = await fetch(this.apiUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'X-API-Key': this.apiKey,\n },\n body: JSON.stringify(payload),\n signal: AbortSignal.timeout(this.connOptions.timeoutMs),\n });\n\n if (!response.ok) {\n const text = await response.text();\n throw new APIStatusError({\n message: 'Server returned an error',\n options: { statusCode: response.status, body: { error: text } },\n });\n }\n return;\n } catch (e) {\n if (e instanceof APIStatusError && !e.retryable) {\n throw e;\n }\n if (e instanceof APIConnectionError) {\n this.#logger.warn({ error: String(e) }, 'failed to call lemonslice api');\n } else {\n this.#logger.error({ error: e }, 'failed to call lemonslice api');\n }\n\n if (i <= this.connOptions.maxRetry - 1) {\n await new Promise((resolve) =>\n setTimeout(resolve, intervalForRetry(this.connOptions, i)),\n );\n }\n }\n }\n\n throw new APIConnectionError({\n message: 'Failed to start LemonSlice Avatar Session after all retries',\n });\n }\n}\n"],"mappings":"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","names":[]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var index_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(index_exports);
|
|
18
|
+
var import_agents = require("@livekit/agents");
|
|
19
|
+
var import_version = require("./version.cjs");
|
|
20
|
+
__reExport(index_exports, require("./avatar.cjs"), module.exports);
|
|
21
|
+
class LemonSlicePlugin extends import_agents.Plugin {
|
|
22
|
+
constructor() {
|
|
23
|
+
super({
|
|
24
|
+
title: "lemonslice",
|
|
25
|
+
version: import_version.version,
|
|
26
|
+
package: "@livekit/agents-plugin-lemonslice"
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
import_agents.Plugin.registerPlugin(new LemonSlicePlugin());
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
...require("./avatar.cjs")
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Plugin } from '@livekit/agents';\nimport { version } from './version.js';\n\nexport * from './avatar.js';\n\nclass LemonSlicePlugin extends Plugin {\n constructor() {\n super({\n title: 'lemonslice',\n version,\n package: '@livekit/agents-plugin-lemonslice',\n });\n }\n}\n\nPlugin.registerPlugin(new LemonSlicePlugin());\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAGA,oBAAuB;AACvB,qBAAwB;AAExB,0BAAc,wBANd;AAQA,MAAM,yBAAyB,qBAAO;AAAA,EACpC,cAAc;AACZ,UAAM;AAAA,MACJ,OAAO;AAAA,MACP;AAAA,MACA,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACF;AAEA,qBAAO,eAAe,IAAI,iBAAiB,CAAC;","names":[]}
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Plugin } from "@livekit/agents";
|
|
2
|
+
import { version } from "./version.js";
|
|
3
|
+
export * from "./avatar.js";
|
|
4
|
+
class LemonSlicePlugin extends Plugin {
|
|
5
|
+
constructor() {
|
|
6
|
+
super({
|
|
7
|
+
title: "lemonslice",
|
|
8
|
+
version,
|
|
9
|
+
package: "@livekit/agents-plugin-lemonslice"
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
Plugin.registerPlugin(new LemonSlicePlugin());
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Plugin } from '@livekit/agents';\nimport { version } from './version.js';\n\nexport * from './avatar.js';\n\nclass LemonSlicePlugin extends Plugin {\n constructor() {\n super({\n title: 'lemonslice',\n version,\n package: '@livekit/agents-plugin-lemonslice',\n });\n }\n}\n\nPlugin.registerPlugin(new LemonSlicePlugin());\n"],"mappings":"AAGA,SAAS,cAAc;AACvB,SAAS,eAAe;AAExB,cAAc;AAEd,MAAM,yBAAyB,OAAO;AAAA,EACpC,cAAc;AACZ,UAAM;AAAA,MACJ,OAAO;AAAA,MACP;AAAA,MACA,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACF;AAEA,OAAO,eAAe,IAAI,iBAAiB,CAAC;","names":[]}
|
package/dist/log.cjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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 log_exports = {};
|
|
20
|
+
__export(log_exports, {
|
|
21
|
+
log: () => log
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(log_exports);
|
|
24
|
+
var import_agents = require("@livekit/agents");
|
|
25
|
+
const log = () => (0, import_agents.log)().child({ plugin: "lemonslice" });
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
log
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=log.cjs.map
|
package/dist/log.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/log.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { log as agentsLog } from '@livekit/agents';\nimport type { Logger } from 'pino';\n\nexport const log = (): Logger => agentsLog().child({ plugin: 'lemonslice' });\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAiC;AAG1B,MAAM,MAAM,UAAc,cAAAA,KAAU,EAAE,MAAM,EAAE,QAAQ,aAAa,CAAC;","names":["agentsLog"]}
|
package/dist/log.d.cts
ADDED
package/dist/log.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,eAAO,MAAM,GAAG,QAAO,MAAqD,CAAC"}
|
package/dist/log.js
ADDED
package/dist/log.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/log.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { log as agentsLog } from '@livekit/agents';\nimport type { Logger } from 'pino';\n\nexport const log = (): Logger => agentsLog().child({ plugin: 'lemonslice' });\n"],"mappings":"AAGA,SAAS,OAAO,iBAAiB;AAG1B,MAAM,MAAM,MAAc,UAAU,EAAE,MAAM,EAAE,QAAQ,aAAa,CAAC;","names":[]}
|
package/dist/version.cjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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 version_exports = {};
|
|
20
|
+
__export(version_exports, {
|
|
21
|
+
version: () => version
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(version_exports);
|
|
24
|
+
const version = "1.0.0";
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
version
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=version.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nexport const version = '1.0.0';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,UAAU;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nexport const version = '1.0.0';\n"],"mappings":"AAGO,MAAM,UAAU;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@livekit/agents-plugin-lemonslice",
|
|
3
|
+
"version": "1.0.40",
|
|
4
|
+
"description": "LemonSlice avatar plugin for LiveKit Node Agents",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"require": "dist/index.cjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
"import": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"require": {
|
|
14
|
+
"types": "./dist/index.d.cts",
|
|
15
|
+
"default": "./dist/index.cjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"author": "LiveKit",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"repository": "git@github.com:livekit/agents-js.git",
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"src",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@livekit/rtc-node": "^0.13.24",
|
|
29
|
+
"@microsoft/api-extractor": "^7.35.0",
|
|
30
|
+
"pino": "^8.19.0",
|
|
31
|
+
"tsup": "^8.3.5",
|
|
32
|
+
"typescript": "^5.0.0",
|
|
33
|
+
"@livekit/agents": "1.0.40"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"livekit-server-sdk": "^2.13.3"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@livekit/rtc-node": "^0.13.24",
|
|
40
|
+
"@livekit/agents": "1.0.40"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsup --onSuccess \"pnpm build:types\"",
|
|
44
|
+
"build:types": "tsc --declaration --emitDeclarationOnly && node ../../scripts/copyDeclarationOutput.js",
|
|
45
|
+
"clean": "rm -rf dist",
|
|
46
|
+
"clean:build": "pnpm clean && pnpm build",
|
|
47
|
+
"lint": "eslint -f unix \"src/**/*.{ts,js}\"",
|
|
48
|
+
"api:check": "api-extractor run --typescript-compiler-folder ../../node_modules/typescript",
|
|
49
|
+
"api:update": "api-extractor run --local --typescript-compiler-folder ../../node_modules/typescript --verbose"
|
|
50
|
+
}
|
|
51
|
+
}
|