@rimelabs/sdk 0.1.0-alpha.6 → 0.1.0-alpha.8
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 +14 -0
- package/README.md +37 -56
- package/docs/realtime.md +14 -8
- package/docs/tts.md +4 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.0-alpha.8](https://github.com/rimelabs/rime-sdk/compare/typescript-v0.1.0-alpha.7...typescript-v0.1.0-alpha.8) (2026-10-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add voice examples and automate example dependency updates ([#22](https://github.com/rimelabs/rime-sdk/issues/22)) ([dea7044](https://github.com/rimelabs/rime-sdk/commit/dea7044831058ebee9ae536e8d822a4d7fabbd3d))
|
|
9
|
+
|
|
10
|
+
## [0.1.0-alpha.7](https://github.com/rimelabs/rime-sdk/compare/typescript-v0.1.0-alpha.6...typescript-v0.1.0-alpha.7) (2026-10-07)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* publish npm releases under the latest tag ([#20](https://github.com/rimelabs/rime-sdk/issues/20)) ([40cf8a4](https://github.com/rimelabs/rime-sdk/commit/40cf8a44720be24cd42acc5f9f97f1269b786e3e))
|
|
16
|
+
|
|
3
17
|
## [0.1.0-alpha.6](https://github.com/rimelabs/rime-sdk/compare/typescript-v0.1.0-alpha.5...typescript-v0.1.0-alpha.6) (2026-10-07)
|
|
4
18
|
|
|
5
19
|
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Requires Node.js 22 or later. This alpha package uses ESM and includes TypeScrip
|
|
|
10
10
|
types. Browser use is not supported.
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
|
-
npm install @rimelabs/sdk
|
|
13
|
+
npm install @rimelabs/sdk
|
|
14
14
|
export RIME_API_KEY="your-api-key"
|
|
15
15
|
```
|
|
16
16
|
|
|
@@ -19,70 +19,51 @@ does not load `.env` files.
|
|
|
19
19
|
|
|
20
20
|
## TTS quick start
|
|
21
21
|
|
|
22
|
-
Save
|
|
22
|
+
Save playable speech with the
|
|
23
|
+
[WAV example](https://github.com/rimelabs/rime-sdk/blob/main/examples/typescript/tts/save.ts).
|
|
24
|
+
After the [example setup](https://github.com/rimelabs/rime-sdk/blob/main/examples/README.md#nodejs), run from the repository root:
|
|
23
25
|
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
import { Rime } from "@rimelabs/sdk";
|
|
27
|
-
|
|
28
|
-
const client = new Rime();
|
|
29
|
-
try {
|
|
30
|
-
const audio = client.tts.stream("Hello. This is Rime.");
|
|
31
|
-
await writeFile("speech.pcm", audio);
|
|
32
|
-
console.log(audio.requestId);
|
|
33
|
-
} finally {
|
|
34
|
-
await client.close();
|
|
35
|
-
}
|
|
26
|
+
```sh
|
|
27
|
+
npm --prefix examples/typescript run tts:save
|
|
36
28
|
```
|
|
37
29
|
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
Open `examples/typescript/speech.wav` in your audio player. To hear streamed text
|
|
31
|
+
as it arrives, run `npm --prefix examples/typescript run tts:play`, open the printed
|
|
32
|
+
local URL, and press **Start**. **Stop** cancels generation and playback.
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
Replace the example's async text source with your LLM's text stream. The SDK
|
|
35
|
+
handles sentence boundaries. Coda is the default; select Mist v3 with
|
|
36
|
+
`new Rime({ model: "mistv3" })`.
|
|
37
|
+
The [TTS guide](https://github.com/rimelabs/rime-sdk/blob/main/typescript/docs/tts.md)
|
|
38
|
+
covers voices, formats, and cancellation.
|
|
44
39
|
|
|
45
40
|
## Prism quick start
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (payload.status !== "completed")
|
|
67
|
-
throw new Error(`Response ${payload.status}`);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
throw new Error("Session closed before the response ended");
|
|
72
|
-
})();
|
|
73
|
-
await Promise.all([reading, session.sendText("Hello!")]);
|
|
74
|
-
} finally {
|
|
75
|
-
clearTimeout(deadline);
|
|
76
|
-
await client.close();
|
|
77
|
-
await reading?.catch(() => {});
|
|
78
|
-
}
|
|
42
|
+
Start a voice conversation in your browser. The Node.js server uses the SDK;
|
|
43
|
+
the browser captures your microphone and plays replies. Use headphones, and
|
|
44
|
+
speak during a reply to interrupt it. The API key stays on the local server.
|
|
45
|
+
|
|
46
|
+
Set `PRISM_URL` to your deployment's full WebSocket URL ending in `/v1/realtime`.
|
|
47
|
+
Set `PRISM_VOICE` unless that deployment has a default. Obtain these values from
|
|
48
|
+
your deployment operator; the TTS endpoint does not serve Prism.
|
|
49
|
+
|
|
50
|
+
After the [example setup](https://github.com/rimelabs/rime-sdk/blob/main/examples/README.md#nodejs), run from the repository root:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
npm --prefix examples/typescript run prism:voice
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Open the printed local URL and press **Start**. Without a microphone, send the
|
|
57
|
+
included speech recording and save `reply.wav`:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
npm --prefix examples/typescript run prism:recorded
|
|
79
61
|
```
|
|
80
62
|
|
|
81
|
-
|
|
82
|
-
[Realtime guide](https://github.com/rimelabs/rime-sdk/blob/main/typescript/docs/realtime.md)
|
|
83
|
-
covers audio
|
|
84
|
-
|
|
85
|
-
save audio and handle tools. TTS settings do not apply to Prism sessions.
|
|
63
|
+
Run `prism:voice-tools` for the same conversation with a demo order lookup.
|
|
64
|
+
The [Realtime guide](https://github.com/rimelabs/rime-sdk/blob/main/typescript/docs/realtime.md)
|
|
65
|
+
covers audio, tools, playback reports, errors, and optional typed input.
|
|
66
|
+
TTS settings do not configure Prism sessions.
|
|
86
67
|
|
|
87
68
|
## License
|
|
88
69
|
|
package/docs/realtime.md
CHANGED
|
@@ -4,10 +4,16 @@ Keep one event consumer running while your application sends input, runs tools,
|
|
|
4
4
|
and plays audio. The SDK manages the protocol state. Your application owns
|
|
5
5
|
microphone capture, tool execution, and playback.
|
|
6
6
|
|
|
7
|
-
Start with the [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
Start with the [voice conversation](https://github.com/rimelabs/rime-sdk/blob/main/examples/typescript/realtime/voice.ts)
|
|
8
|
+
for microphone input, playback, and caller interruption. The
|
|
9
|
+
[recorded-speech example](https://github.com/rimelabs/rime-sdk/blob/main/examples/typescript/realtime/recorded.ts)
|
|
10
|
+
saves a spoken reply without audio hardware. See the
|
|
11
|
+
[example setup](https://github.com/rimelabs/rime-sdk/blob/main/examples/README.md)
|
|
12
|
+
for commands, device requirements, and the voice tool example.
|
|
13
|
+
|
|
14
|
+
Typed turns remain useful for connection checks and mixed text/voice applications.
|
|
15
|
+
The live examples keep the session open after normal cancellation and report
|
|
16
|
+
playback from the output clock. Saving a file is not playback.
|
|
11
17
|
|
|
12
18
|
## Connect
|
|
13
19
|
|
|
@@ -174,8 +180,8 @@ nonnegative milliseconds. The SDK waits for generation completion and supplies
|
|
|
174
180
|
the server's drain token.
|
|
175
181
|
|
|
176
182
|
Saving audio does not establish playback. Reports are optional. If you cannot
|
|
177
|
-
measure playback, omit them and let the server use its estimate. The examples
|
|
178
|
-
|
|
183
|
+
measure playback, omit them and let the server use its estimate. The recorded and typed examples have no player and omit these reports.
|
|
184
|
+
The voice examples report actual playback.
|
|
179
185
|
|
|
180
186
|
## Timeouts and failures
|
|
181
187
|
|
|
@@ -185,8 +191,8 @@ tool readiness, and waiting for generation to end before a playback report.
|
|
|
185
191
|
Once a request is submitted, `requestS` bounds its write and acknowledgment.
|
|
186
192
|
|
|
187
193
|
These limits do not bound the entire conversation or generation after creation.
|
|
188
|
-
Set an application deadline and close the session when it expires.
|
|
189
|
-
|
|
194
|
+
Set an application deadline and close the session when it expires. The recorded and typed examples use a 60-second deadline. Voice conversations
|
|
195
|
+
run until stopped or the connection fails.
|
|
190
196
|
|
|
191
197
|
`RealtimeAdmissionTimeout` means readiness expired with no request outstanding;
|
|
192
198
|
the session remains usable. An unknown request outcome closes the connection and
|
package/docs/tts.md
CHANGED
|
@@ -4,6 +4,10 @@ You supply text; the SDK handles sentence boundaries and streams audio back.
|
|
|
4
4
|
Your application owns playback. Start with the [package quick start](../README.md),
|
|
5
5
|
or run the [streaming example](https://github.com/rimelabs/rime-sdk/blob/main/examples/typescript/tts/stream.mjs).
|
|
6
6
|
|
|
7
|
+
For a playable file, use [save speech](https://github.com/rimelabs/rime-sdk/blob/main/examples/typescript/tts/save.ts).
|
|
8
|
+
For immediate playback and cancellation, use [stream and play](https://github.com/rimelabs/rime-sdk/blob/main/examples/typescript/tts/play.ts).
|
|
9
|
+
Both accept the same SDK text stream; device dependencies stay in the examples.
|
|
10
|
+
|
|
7
11
|
## Stream incoming text
|
|
8
12
|
|
|
9
13
|
An async text source can supply text as it arrives:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rimelabs/sdk",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.8",
|
|
4
4
|
"description": "Rime streaming TTS and Prism realtime SDK for Node.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"check": "tsc -p tsconfig.json --noEmit",
|
|
35
35
|
"test": "npm run build && node --test tests/*.test.mjs",
|
|
36
36
|
"prepack": "npm run build",
|
|
37
|
-
"lint": "prettier --check src tests ../examples/typescript/tts ../examples/typescript/realtime"
|
|
37
|
+
"lint": "prettier --check src tests ../examples/typescript/tts ../examples/typescript/realtime ../examples/typescript/common ../examples/typescript/browser ../examples/typescript/tests"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@bufbuild/protobuf": "^2.11.0",
|