Skip to content

Add krisp viva plugin#1904

Draft
lukasIO wants to merge 6 commits into
mainfrom
lukas/krisp-viva
Draft

Add krisp viva plugin#1904
lukasIO wants to merge 6 commits into
mainfrom
lukas/krisp-viva

Conversation

@lukasIO

@lukasIO lukasIO commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a plugin for the Krisp Viva SDK, allowing for direct LK cloud usage and the custom license wrapper, mirroring livekit/agents#5914

Changes Made

Pre-Review Checklist

  • Build passes: All builds (lint, typecheck, tests) pass locally
  • AI-generated code reviewed: Removed unnecessary comments and ensured code quality
  • Changes explained: All changes are properly documented and justified above
  • Scope appropriate: All changes relate to the PR title, or explanations provided for why they're included
  • Video demo: A small video demo showing changes works as expected and did not break any existing functionality using Agent Playground (if applicable)

Testing

  • Automated tests added/updated (if applicable)
  • All tests pass
  • Make sure both restaurant_agent.ts and realtime_agent.ts work properly (for major changes)

Additional Notes


Note to reviewers: Please ensure the pre-review checklist is completed before starting your review.

@changeset-bot

changeset-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1a29534

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@lukasIO lukasIO requested a review from 1egoman June 29, 2026 13:04

@1egoman 1egoman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally makes sense to me!

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let mod: any;
try {
mod = require('krisp-audio-node-sdk');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is it worth making this an await import(...)? I'm not sure that all platforms would support mixed import / require usage in one file properly. It might be worth trying this out in deno / bun to make sure const require = createRequire(import.meta.url); still works as expected.

Comment on lines +149 to +153
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private module: any;
private sdkAcquired = false;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private session: any = null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Is it worth defining dts type interfaces for module / session here since it looks like krisp-audio-node-sdk is not on npm? Then I think these could be made to not be any and all the type checking would run on these two objects.

this.frameDurationMs = opts.frameDurationMs;
this.modelPath = opts.modelPath;

if (!SUPPORTED_FRAME_DURATIONS_MS.includes(this.frameDurationMs as never)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Shouldn't this be number, not never?

Suggested change
if (!SUPPORTED_FRAME_DURATIONS_MS.includes(this.frameDurationMs as never)) {
if (!SUPPORTED_FRAME_DURATIONS_MS.includes(this.frameDurationMs as number)) {

Comment on lines +299 to +311
// Emit exactly as many samples as we received this call. Before the first
// full chunk is ready the deficit is zero-padded; samples in and out stay
// balanced over time, so there is no drift.
const n = frame.samplesPerChannel;
let out: Int16Array;
if (this.outBuf.length >= n) {
out = this.outBuf.slice(0, n);
this.outBuf = this.outBuf.slice(n);
} else {
out = new Int16Array(n);
out.set(this.outBuf, n - this.outBuf.length);
this.outBuf = new Int16Array(0);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant comment from associated agents pull request: livekit/agents#5914 (comment). I think this could be vulnerable to the same problem.

Comment thread plugins/krisp/README.md

> **Most users should use the default LiveKit Cloud path above.** This alternative is for running the public Krisp SDK directly with your own Krisp license — for example, when using the LiveKit OSS server.

This path uses the public `krisp-audio-node-sdk` together with a Krisp license key and a `.kef` model file that you obtain from Krisp.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: You've used the phrasing "public krisp-audio-node-sdk" a bunch across the readme as well as docs comments. That to me implies that krisp-audio-node-sdk is a public npm package, but it isn't. Is there a different way that this could be phrased? Maybe like "private, krisp provided krisp-audio-node-sdk"?

"typescript": "^5.0.0"
},
"dependencies": {
"@livekit/plugins-krisp-viva-internal": "file:../../../plugin-krisp-viva-internal/target/packages/node"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Fix this before merging to point to an actual npm published package version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants