@voxevolv/client 0.1.0
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 +12 -0
- package/LICENSE +21 -0
- package/README.md +130 -0
- package/dist/browser/index.js +40 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/index.js.sha384 +1 -0
- package/dist/browser/manifest.json +4 -0
- package/dist/generated/protocol-codecs.d.ts +19 -0
- package/dist/generated/protocol-codecs.d.ts.map +1 -0
- package/dist/generated/protocol-codecs.js +819 -0
- package/dist/generated/protocol-codecs.js.map +1 -0
- package/dist/index.d.ts +160 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +796 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.d.ts +110 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +101 -0
- package/dist/protocol.js.map +1 -0
- package/package.json +55 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@voxevolv/client` are recorded here.
|
|
4
|
+
|
|
5
|
+
## 0.1.0 - 2026-07-18
|
|
6
|
+
|
|
7
|
+
- Add application-owned audio-track publication and remote-audio access.
|
|
8
|
+
- Add `RealtimeSession.create()`, lifecycle helpers, typed convenience events,
|
|
9
|
+
credential refresh, and guarded rejoin behavior.
|
|
10
|
+
- Add a self-contained browser ESM bundle with source maps and SHA-384
|
|
11
|
+
integrity metadata.
|
|
12
|
+
- Add explicit package exports for npm and CDN consumers.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VoxEvolv contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# `@voxevolv/client`
|
|
2
|
+
|
|
3
|
+
Browser SDK for connecting to a scoped VoxEvolv realtime session.
|
|
4
|
+
|
|
5
|
+
## Build and test
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install
|
|
9
|
+
npm test
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The build emits ESM JavaScript, declarations, declaration maps, and source maps
|
|
13
|
+
into `dist/`. It also emits a self-contained browser bundle at
|
|
14
|
+
`dist/browser/index.js`; that bundle does not need an import map. Its SHA-384
|
|
15
|
+
integrity value is written to `dist/browser/index.js.sha384` and
|
|
16
|
+
`dist/browser/manifest.json`.
|
|
17
|
+
|
|
18
|
+
Bundlers should use the package export:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { RealtimeSession } from "@voxevolv/client";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Browsers without a build step can use the versioned bundle after publication:
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<script type="module">
|
|
28
|
+
import { RealtimeSession } from
|
|
29
|
+
"https://cdn.jsdelivr.net/npm/@voxevolv/client@0.1.0/dist/browser/index.js";
|
|
30
|
+
</script>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Create through an application backend
|
|
34
|
+
|
|
35
|
+
`RealtimeSession.create()` calls an application-owned endpoint that creates the
|
|
36
|
+
VoxEvolv session without exposing an organization API key:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
const session = await RealtimeSession.create({
|
|
40
|
+
endpoint: "/api/voice-session",
|
|
41
|
+
// Recommended: expose the scoped lifecycle routes through your backend.
|
|
42
|
+
// An allowlisted absolute VoxEvolv API URL is also supported.
|
|
43
|
+
apiBase: "/api/voxevolv/v1",
|
|
44
|
+
tools: {
|
|
45
|
+
present_attachment: (arguments_) => presentAttachment(arguments_),
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
session.onUserTranscript(({ text, final }) => renderUser(text, final));
|
|
50
|
+
session.onAgentTranscript(({ text, final }) => renderAgent(text, final));
|
|
51
|
+
session.onError((event) => reportVoiceError(event.payload));
|
|
52
|
+
|
|
53
|
+
await session.connect();
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## SDK-owned microphone
|
|
57
|
+
|
|
58
|
+
Call from a user action so the browser may request microphone permission and
|
|
59
|
+
play remote audio:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
const session = new RealtimeSession(credentials, {
|
|
63
|
+
connect: { apiBase: "/api/voxevolv/v1" },
|
|
64
|
+
});
|
|
65
|
+
await session.connect({ microphone: true });
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Application-owned or mixed audio
|
|
69
|
+
|
|
70
|
+
Applications that already captured a microphone or produced a mixed audio track
|
|
71
|
+
must pass that track instead of opening the microphone twice:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
const sourceTrack = mixedStream.getAudioTracks()[0];
|
|
75
|
+
|
|
76
|
+
session.onRemoteAudioTrack((track, stream) => {
|
|
77
|
+
recordingMixer.addRemoteAudio(stream);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
session.onRemoteAudioTrackUnsubscribed((track, stream) => {
|
|
81
|
+
recordingMixer.removeRemoteAudio(stream);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
await session.connect({
|
|
85
|
+
microphone: false,
|
|
86
|
+
audioTrack: sourceTrack,
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The SDK validates that `audioTrack` is a live audio `MediaStreamTrack`, publishes
|
|
91
|
+
an SDK-owned clone, and publishes a fresh clone when `rejoin()` obtains a new
|
|
92
|
+
room token. It never stops the application-owned source. The application remains
|
|
93
|
+
responsible for stopping that source during its own media teardown.
|
|
94
|
+
|
|
95
|
+
`microphone: true` and `audioTrack` are mutually exclusive. Use
|
|
96
|
+
`session.setMicrophoneEnabled()` to mute or unmute the published input.
|
|
97
|
+
|
|
98
|
+
`onRemoteAudioTrack` does not replace automatic agent-audio playback. It exposes
|
|
99
|
+
a native `MediaStreamTrack` and single-track `MediaStream` for recording,
|
|
100
|
+
metering, or another application-owned audio graph. Both listener registration
|
|
101
|
+
methods return an unsubscribe function.
|
|
102
|
+
|
|
103
|
+
## Rejoin and end
|
|
104
|
+
|
|
105
|
+
`rejoin()` can be called from a connected or disconnected state. It obtains a
|
|
106
|
+
fresh room token, disconnects an existing room connection when necessary, and
|
|
107
|
+
reconnects with the original microphone or application-owned track choice.
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
await session.rejoin();
|
|
111
|
+
await session.end();
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`RealtimeSession.create()` requires `apiBase` because rejoin, durable replay,
|
|
115
|
+
and scoped ending happen after the application-owned creation request. Set it
|
|
116
|
+
to either an explicit absolute VoxEvolv `/v1` base whose deployment allowlists
|
|
117
|
+
the application origin, or a same-origin proxy base that forwards only:
|
|
118
|
+
|
|
119
|
+
- `POST /sessions/{id}/room-tokens`
|
|
120
|
+
- `GET /sessions/{id}/events`
|
|
121
|
+
- `DELETE /sessions/{id}`
|
|
122
|
+
|
|
123
|
+
The proxy must forward the browser's `Authorization: Bearer vsa_...` header. It
|
|
124
|
+
must not replace that credential with an organization API key.
|
|
125
|
+
|
|
126
|
+
`end()` uses the browser-safe `vsa_...` credential to end only that session and
|
|
127
|
+
then leaves the LiveKit room. Pass `endEndpoint` to the constructor or
|
|
128
|
+
`end({ endpoint })` when application policy requires a backend completion route.
|
|
129
|
+
The optional `refreshCredentials` constructor callback is used after a `401`
|
|
130
|
+
during rejoin, durable replay, or scoped session ending.
|