Skip to content

Commit 8ffbaf1

Browse files
committed
retry logic update + var name update + changeset
1 parent 6fc4dea commit 8ffbaf1

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

.changeset/nine-wings-enter.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@livekit/agents-plugin-lemonslice': patch
3+
---
4+
5+
Added the LemonSlice avatar plugin for LiveKit agent-js

plugins/lemonslice/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
},
3636
"devDependencies": {
3737
"@livekit/agents": "workspace:*",
38-
"@livekit/rtc-node": "^0.13.22",
38+
"@livekit/rtc-node": "catalog:",
3939
"@microsoft/api-extractor": "^7.35.0",
4040
"pino": "^8.19.0",
4141
"tsup": "^8.3.5",
@@ -46,6 +46,6 @@
4646
},
4747
"peerDependencies": {
4848
"@livekit/agents": "workspace:*",
49-
"@livekit/rtc-node": "^0.13.22"
49+
"@livekit/rtc-node": "catalog:"
5050
}
5151
}

plugins/lemonslice/src/avatar.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ export class AvatarSession {
142142
this.agentImageUrl = options.agentImageUrl ?? null;
143143

144144
if (!this.agentId && !this.agentImageUrl) {
145-
throw new LemonSliceException('Missing agent_id or agent_image_url');
145+
throw new LemonSliceException('Missing agentId or agentImageUrl');
146146
}
147147
if (this.agentId && this.agentImageUrl) {
148-
throw new LemonSliceException('Only one of agent_id or agent_image_url can be provided');
148+
throw new LemonSliceException('Only one of agentId or agentImageUrl can be provided');
149149
}
150150

151151
this.agentPrompt = options.agentPrompt ?? null;
@@ -198,7 +198,7 @@ export class AvatarSession {
198198
let localParticipantIdentity: string;
199199
try {
200200
const jobCtx = getJobContext();
201-
localParticipantIdentity = jobCtx.job.participant?.identity || '';
201+
localParticipantIdentity = jobCtx.agent?.identity || '';
202202
if (!localParticipantIdentity && room.localParticipant) {
203203
localParticipantIdentity = room.localParticipant.identity;
204204
}
@@ -243,7 +243,7 @@ export class AvatarSession {
243243
}
244244

245245
private async startAgent(livekitUrl: string, livekitToken: string): Promise<void> {
246-
for (let i = 0; i < this.connOptions.maxRetry; i++) {
246+
for (let i = 0; i <= this.connOptions.maxRetry; i++) {
247247
try {
248248
const payload: Record<string, any> = {
249249
transport_type: 'livekit',
@@ -297,7 +297,7 @@ export class AvatarSession {
297297
this.#logger.error({ error: e }, 'failed to call lemonslice api');
298298
}
299299

300-
if (i < this.connOptions.maxRetry - 1) {
300+
if (i <= this.connOptions.maxRetry - 1) {
301301
await new Promise((resolve) =>
302302
setTimeout(resolve, intervalForRetry(this.connOptions, i)),
303303
);

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)