@plumbus/voice-livekit 0.1.2
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/CHANGELOG.md +26 -0
- package/README.md +146 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/client/client-noise-cancellation.d.ts +15 -0
- package/dist/client/client-noise-cancellation.d.ts.map +1 -0
- package/dist/client/client-noise-cancellation.js +54 -0
- package/dist/client/client-noise-cancellation.js.map +1 -0
- package/dist/client/livekit-session.d.ts +21 -0
- package/dist/client/livekit-session.d.ts.map +1 -0
- package/dist/client/livekit-session.js +206 -0
- package/dist/client/livekit-session.js.map +1 -0
- package/dist/client/pcm-resample.d.ts +7 -0
- package/dist/client/pcm-resample.d.ts.map +1 -0
- package/dist/client/pcm-resample.js +87 -0
- package/dist/client/pcm-resample.js.map +1 -0
- package/dist/client/session-helpers.d.ts +19 -0
- package/dist/client/session-helpers.d.ts.map +1 -0
- package/dist/client/session-helpers.js +70 -0
- package/dist/client/session-helpers.js.map +1 -0
- package/dist/client.d.ts +5 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +4 -0
- package/dist/client.js.map +1 -0
- package/dist/cost/record-livekit-transport.d.ts +9 -0
- package/dist/cost/record-livekit-transport.d.ts.map +1 -0
- package/dist/cost/record-livekit-transport.js +29 -0
- package/dist/cost/record-livekit-transport.js.map +1 -0
- package/dist/credentials.d.ts +3 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +8 -0
- package/dist/credentials.js.map +1 -0
- package/dist/descriptor.d.ts +3 -0
- package/dist/descriptor.d.ts.map +1 -0
- package/dist/descriptor.js +14 -0
- package/dist/descriptor.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/noise-cancellation/create-inbound-audio-stream.d.ts +9 -0
- package/dist/noise-cancellation/create-inbound-audio-stream.d.ts.map +1 -0
- package/dist/noise-cancellation/create-inbound-audio-stream.js +13 -0
- package/dist/noise-cancellation/create-inbound-audio-stream.js.map +1 -0
- package/dist/noise-cancellation/oss/client-rnnoise-processor.d.ts +2 -0
- package/dist/noise-cancellation/oss/client-rnnoise-processor.d.ts.map +1 -0
- package/dist/noise-cancellation/oss/client-rnnoise-processor.js +2 -0
- package/dist/noise-cancellation/oss/client-rnnoise-processor.js.map +1 -0
- package/dist/noise-cancellation/oss/dtln-frame-processor.d.ts +10 -0
- package/dist/noise-cancellation/oss/dtln-frame-processor.d.ts.map +1 -0
- package/dist/noise-cancellation/oss/dtln-frame-processor.js +118 -0
- package/dist/noise-cancellation/oss/dtln-frame-processor.js.map +1 -0
- package/dist/noise-cancellation/oss/rnnoise-frame-processor.d.ts +9 -0
- package/dist/noise-cancellation/oss/rnnoise-frame-processor.d.ts.map +1 -0
- package/dist/noise-cancellation/oss/rnnoise-frame-processor.js +149 -0
- package/dist/noise-cancellation/oss/rnnoise-frame-processor.js.map +1 -0
- package/dist/noise-cancellation/resolve-noise-cancellation.d.ts +5 -0
- package/dist/noise-cancellation/resolve-noise-cancellation.d.ts.map +1 -0
- package/dist/noise-cancellation/resolve-noise-cancellation.js +38 -0
- package/dist/noise-cancellation/resolve-noise-cancellation.js.map +1 -0
- package/dist/pricing.d.ts +8 -0
- package/dist/pricing.d.ts.map +1 -0
- package/dist/pricing.js +19 -0
- package/dist/pricing.js.map +1 -0
- package/dist/runtime/consume-audio-stream.d.ts +3 -0
- package/dist/runtime/consume-audio-stream.d.ts.map +1 -0
- package/dist/runtime/consume-audio-stream.js +15 -0
- package/dist/runtime/consume-audio-stream.js.map +1 -0
- package/dist/runtime/livekit-agent-worker.d.ts +32 -0
- package/dist/runtime/livekit-agent-worker.d.ts.map +1 -0
- package/dist/runtime/livekit-agent-worker.js +491 -0
- package/dist/runtime/livekit-agent-worker.js.map +1 -0
- package/dist/runtime/optional-cloud-registrations.d.ts +12 -0
- package/dist/runtime/optional-cloud-registrations.d.ts.map +1 -0
- package/dist/runtime/optional-cloud-registrations.js +67 -0
- package/dist/runtime/optional-cloud-registrations.js.map +1 -0
- package/dist/runtime/parse-participant-context.d.ts +16 -0
- package/dist/runtime/parse-participant-context.d.ts.map +1 -0
- package/dist/runtime/parse-participant-context.js +61 -0
- package/dist/runtime/parse-participant-context.js.map +1 -0
- package/dist/runtime/voice-room-worker.d.ts +55 -0
- package/dist/runtime/voice-room-worker.d.ts.map +1 -0
- package/dist/runtime/voice-room-worker.js +151 -0
- package/dist/runtime/voice-room-worker.js.map +1 -0
- package/dist/transport/livekit-transport.d.ts +37 -0
- package/dist/transport/livekit-transport.d.ts.map +1 -0
- package/dist/transport/livekit-transport.js +324 -0
- package/dist/transport/livekit-transport.js.map +1 -0
- package/dist/types.d.ts +77 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/worker.d.ts +4 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +3 -0
- package/dist/worker.js.map +1 -0
- package/instructions/README.md +27 -0
- package/instructions/agent-worker.md +56 -0
- package/instructions/client-session.md +46 -0
- package/instructions/framework.md +111 -0
- package/instructions/noise-cancellation.md +55 -0
- package/package.json +83 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Attach `LIVEKIT_VOICE_PRICING` on `LIVEKIT_TRANSPORT_REGISTRATION.pricing` so registry bootstrap seeds transport rates (transport recording still passes an explicit `cost` override).
|
|
8
|
+
|
|
9
|
+
## 0.1.1
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Browser client bundle:** `./client` no longer imports `@plumbus/core` or `@plumbus/voice` package roots. Uses `@plumbus/core/errors` and `@plumbus/voice/noise-cancellation` so Next/Turbopack client builds do not pull CLI/drizzle/`node:fs` into the browser graph.
|
|
14
|
+
|
|
15
|
+
## 0.1.0
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Initial extraction of LiveKit transport, agent worker, noise cancellation, room join helpers, and browser session helpers from `@plumbus/voice` 0.3.0.
|
|
20
|
+
- Package entry points: `.`, `./client`, and `./worker`.
|
|
21
|
+
- Exports: `LIVEKIT_TRANSPORT_REGISTRATION` (with `toClientSessionPayload`), `mintLiveKitParticipantToken`, `startVoiceAgentWorker`, `joinVoiceRoomSession`, `startVoiceWorker`, `createVoiceAgentEntry`, `createInboundAudioStream`, `resolveAgentNoiseCancellationOption`, `createLiveKitVoiceSession`, `applyClientNoiseCancellation`, and related helpers.
|
|
22
|
+
- Workers require an explicit `registry` (from app bootstrap / `app/voice/registry.ts`). Omitting it throws — there is no soft-load fallback.
|
|
23
|
+
- An explicit registry that omits `transport.livekit` is rejected — workers do **not** silently inject `LIVEKIT_TRANSPORT_REGISTRATION`.
|
|
24
|
+
- LiveKit-named client helpers (`parseLiveKitVoiceDataPayload`, track/audio helpers) and worker contracts (`ConnectLiveKitWorkerArgs`, `StartVoiceAgentWorkerOptions`, …) live on this package (`./client` and `.`), not `@plumbus/voice` / provider-kit.
|
|
25
|
+
- Required env / credentials: `LIVEKIT_URL`, `LIVEKIT_API_KEY`, `LIVEKIT_API_SECRET`.
|
|
26
|
+
- Optional browser peers: `livekit-client`, `@livekit/krisp-noise-filter`.
|
package/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# @plumbus/voice-livekit
|
|
2
|
+
|
|
3
|
+
> **LiveKit transport, agent worker, and browser session helpers for [Plumbus](https://github.com/plumbus-framework/plumbus) voice.** Register as `transport.provider: 'livekit'`, mint room tokens, join agent workers, and run continuous or push-to-talk sessions without pulling LiveKit into `@plumbus/voice` itself.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@plumbus/voice-livekit)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
[](https://www.npmjs.com/package/@plumbus/core)
|
|
8
|
+
[](https://www.npmjs.com/package/@plumbus/voice)
|
|
9
|
+
|
|
10
|
+
## What is this?
|
|
11
|
+
|
|
12
|
+
[Plumbus](https://github.com/plumbus-framework/plumbus) is an **AI-native, contract-driven TypeScript application framework**. [`@plumbus/voice`](../voice/) is the optional voice runtime (`defineVoice`, routes, provider registry).
|
|
13
|
+
|
|
14
|
+
`@plumbus/voice-livekit` is the **LiveKit adapter** for that runtime. It owns the vendor SDK boundary for:
|
|
15
|
+
|
|
16
|
+
- Transport registration (`LIVEKIT_TRANSPORT_REGISTRATION` → `transport.provider: 'livekit'`)
|
|
17
|
+
- Participant token minting and room session metadata
|
|
18
|
+
- Agent worker entry (`startVoiceAgentWorker`, `createVoiceAgentEntry`, `joinVoiceRoomSession`)
|
|
19
|
+
- Browser session helpers (`createLiveKitVoiceSession` on `./client`)
|
|
20
|
+
- Inbound noise-cancellation helpers (Krisp / RNNoise / DTLN) and LiveKit transport cost rows
|
|
21
|
+
|
|
22
|
+
If you're not using `@plumbus/voice`, this package has nothing to plug into. Install alone does **not** register LiveKit — you must pass `LIVEKIT_TRANSPORT_REGISTRATION` into `createProviderRegistry()`.
|
|
23
|
+
|
|
24
|
+
## Why?
|
|
25
|
+
|
|
26
|
+
LiveKit (and its agent/noise-cancellation SDKs) are heavy. Keeping them out of `@plumbus/voice` means apps that only need `websocket` + browser STT/TTS never pay the install or bundle cost. This package is the explicit opt-in for room-based and continuous voice stacks.
|
|
27
|
+
|
|
28
|
+
## What you get
|
|
29
|
+
|
|
30
|
+
| Surface | What it does |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `LIVEKIT_TRANSPORT_REGISTRATION` | Factory + descriptor for `createProviderRegistry({ transport: { livekit: … } })`. |
|
|
33
|
+
| `LIVEKIT_TRANSPORT_DESCRIPTOR` | Catalog entry (`id: 'livekit'`). |
|
|
34
|
+
| `mintLiveKitParticipantToken` | Server-side participant JWT for `/token` / room join. |
|
|
35
|
+
| `startVoiceAgentWorker` / `createVoiceAgentEntry` / `joinVoiceRoomSession` | Agent dispatch and room-join worker APIs. |
|
|
36
|
+
| `createInboundAudioStream` / `resolveAgentNoiseCancellationOption` | Agent-side NC wiring. |
|
|
37
|
+
| `parseLiveKitParticipantContext` / `buildBrainInputFromParticipantContext` | Participant metadata → brain input. |
|
|
38
|
+
| `recordLiveKitTransportCost` / `LIVEKIT_VOICE_PRICING` | Transport spend into the shared AI ledger. |
|
|
39
|
+
| `@plumbus/voice-livekit/client` | `createLiveKitVoiceSession`, `applyClientNoiseCancellation`, PCM helpers. |
|
|
40
|
+
| `@plumbus/voice-livekit/worker` | Agent worker entry helpers for `plumbus voice worker`. |
|
|
41
|
+
|
|
42
|
+
## Status
|
|
43
|
+
|
|
44
|
+
Optional add-on of `@plumbus/voice` `0.4.x` and `@plumbus/core` `0.6.x`. Implements LiveKit transport registration, agent worker bootstrap, browser session helpers, NC engines, and transport cost recording. WebSocket transport stays built into `@plumbus/voice`.
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pnpm add @plumbus/voice @plumbus/voice-livekit
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Peers (copy literals):
|
|
53
|
+
|
|
54
|
+
- `@plumbus/core` `0.6.x` — required
|
|
55
|
+
- `@plumbus/voice` `0.4.x` — required
|
|
56
|
+
- `livekit-client` `^2.0.0` — optional; needed for browser sessions
|
|
57
|
+
- `@livekit/krisp-noise-filter` `^0.4.0` — optional; client Krisp NC
|
|
58
|
+
- `fastify` `^5.0.0` — optional peer (reserved for app servers)
|
|
59
|
+
|
|
60
|
+
Env: `LIVEKIT_URL`, `LIVEKIT_API_KEY`, `LIVEKIT_API_SECRET`.
|
|
61
|
+
|
|
62
|
+
## Quick start
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { createProviderRegistry, defineVoice, registerVoiceRoutes } from '@plumbus/voice';
|
|
66
|
+
import { LIVEKIT_TRANSPORT_REGISTRATION } from '@plumbus/voice-livekit';
|
|
67
|
+
import { onRoutesRegistered } from '@plumbus/core';
|
|
68
|
+
|
|
69
|
+
export const voiceProviderRegistry = createProviderRegistry({
|
|
70
|
+
transport: { livekit: LIVEKIT_TRANSPORT_REGISTRATION },
|
|
71
|
+
// also register STT/TTS *_REGISTRATION from other @plumbus/voice-* packages
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const supportVoice = defineVoice({
|
|
75
|
+
name: 'support',
|
|
76
|
+
access: { roles: ['user'] },
|
|
77
|
+
transport: { provider: 'livekit', mode: 'continuous' },
|
|
78
|
+
stt: { provider: 'web-speech', languages: ['en-US'] },
|
|
79
|
+
tts: { provider: 'browser-tts', locale: 'en-US', voiceId: 'default' },
|
|
80
|
+
brain: {
|
|
81
|
+
async run(_ctx, args) {
|
|
82
|
+
return { text: args.transcript ?? '' };
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
onRoutesRegistered((app, routeConfig) => {
|
|
88
|
+
registerVoiceRoutes(app, routeConfig, [supportVoice], {
|
|
89
|
+
registry: voiceProviderRegistry,
|
|
90
|
+
providers: {
|
|
91
|
+
providers: {
|
|
92
|
+
livekit: {
|
|
93
|
+
url: process.env['LIVEKIT_URL'],
|
|
94
|
+
apiKey: process.env['LIVEKIT_API_KEY'],
|
|
95
|
+
apiSecret: process.env['LIVEKIT_API_SECRET'],
|
|
96
|
+
},
|
|
97
|
+
'web-speech': {},
|
|
98
|
+
'browser-tts': {},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
sessionTokenSecret: process.env['VOICE_SESSION_TOKEN_SECRET'],
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Export the same `voiceProviderRegistry` from `app/voice/registry.ts` so `plumbus voice worker` can load it. Use `beforeSession.room` (not `.livekit`) for `/token` mint options.
|
|
107
|
+
|
|
108
|
+
Browser client:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { createLiveKitVoiceSession } from '@plumbus/voice-livekit/client';
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Key gotchas
|
|
115
|
+
|
|
116
|
+
- **Install alone does not register.** Pass `LIVEKIT_TRANSPORT_REGISTRATION` into `createProviderRegistry` and pass that registry to routes/workers.
|
|
117
|
+
- **No soft auto-load.** There is no `createRegistryForVoices` / `VOICE_ADDON_PACKAGES` path — CLI/workers require `app/voice/registry.ts`.
|
|
118
|
+
- **Import moves from 0.3.x:** session helpers → `@plumbus/voice-livekit/client`; worker helpers → `@plumbus/voice-livekit`. See [`docs/upgrading-voice-provider-packages.md`](../../docs/upgrading-voice-provider-packages.md).
|
|
119
|
+
- **Do not import `@livekit/*` / `livekit-client` directly** for Plumbus voice sessions — use this package's exports.
|
|
120
|
+
|
|
121
|
+
## Documentation / Agent recipes
|
|
122
|
+
|
|
123
|
+
- **Concept docs:** [`docs/voice/livekit-continuous-voice.md`](../../docs/voice/livekit-continuous-voice.md), [`docs/voice/transports.md`](../../docs/voice/transports.md), [`docs/voice/noise-cancellation.md`](../../docs/voice/noise-cancellation.md)
|
|
124
|
+
- **Upgrade guide:** [`docs/upgrading-voice-provider-packages.md`](../../docs/upgrading-voice-provider-packages.md)
|
|
125
|
+
- **Agent recipes** (after install, open these exact paths):
|
|
126
|
+
- `node_modules/@plumbus/voice-livekit/instructions/README.md` — index + critical rules
|
|
127
|
+
- `node_modules/@plumbus/voice-livekit/instructions/framework.md` — install, peers, exports, registration
|
|
128
|
+
- `node_modules/@plumbus/voice-livekit/instructions/client-session.md` — browser session
|
|
129
|
+
- `node_modules/@plumbus/voice-livekit/instructions/agent-worker.md` — worker / CLI
|
|
130
|
+
- `node_modules/@plumbus/voice-livekit/instructions/noise-cancellation.md` — NC matrix
|
|
131
|
+
|
|
132
|
+
## The Plumbus ecosystem
|
|
133
|
+
|
|
134
|
+
`@plumbus/voice-livekit` is one package in the Plumbus framework. For the full list of packages and when to use each, see the [Plumbus monorepo README](https://github.com/plumbus-framework/plumbus#packages).
|
|
135
|
+
|
|
136
|
+
## Links
|
|
137
|
+
|
|
138
|
+
- **Plumbus framework** — [github.com/plumbus-framework/plumbus](https://github.com/plumbus-framework/plumbus)
|
|
139
|
+
- **Parent package** — [`@plumbus/voice`](../voice/)
|
|
140
|
+
- **Full documentation** — [docs/](../../docs/) in the monorepo
|
|
141
|
+
- **Top-level README** — [`../../README.md`](../../README.md)
|
|
142
|
+
- **Issues** — [github.com/plumbus-framework/plumbus/issues](https://github.com/plumbus-framework/plumbus/issues)
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
MIT
|