@openclaw/inworld-speech 2026.7.2-beta.5 → 2026.8.1-beta.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/dist/speech-provider.js +29 -33
- package/package.json +4 -4
package/dist/speech-provider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DEFAULT_INWORLD_MODEL_ID, INWORLD_TTS_MODELS, inworldTTS, listInworldVoices, normalizeInworldBaseUrl } from "./tts.js";
|
|
2
2
|
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
3
|
-
import {
|
|
4
|
-
import { asFiniteNumberInRange } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { parseSpeechDirectiveNumberOverride, resolveSpeechProviderApiKey, trimToUndefined } from "openclaw/plugin-sdk/speech-core";
|
|
4
|
+
import { asFiniteNumberInRange, asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/inworld/speech-provider.ts
|
|
6
6
|
function normalizeInworldTemperature(value) {
|
|
7
7
|
return asFiniteNumberInRange(value, {
|
|
@@ -11,7 +11,7 @@ function normalizeInworldTemperature(value) {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
function normalizeInworldProviderConfig(rawConfig) {
|
|
14
|
-
const raw =
|
|
14
|
+
const raw = asOptionalRecord(asOptionalRecord(rawConfig.providers)?.inworld) ?? asOptionalRecord(rawConfig.inworld);
|
|
15
15
|
return {
|
|
16
16
|
apiKey: normalizeResolvedSecretInputString({
|
|
17
17
|
value: raw?.apiKey,
|
|
@@ -37,13 +37,29 @@ function resolveInworldApiKey(primary, fallback) {
|
|
|
37
37
|
return resolveSpeechProviderApiKey(primary, fallback, process.env.INWORLD_API_KEY);
|
|
38
38
|
}
|
|
39
39
|
function readInworldOverrides(overrides) {
|
|
40
|
-
if (!overrides) return {};
|
|
41
40
|
return {
|
|
42
|
-
voiceId: trimToUndefined(overrides
|
|
43
|
-
modelId: trimToUndefined(overrides
|
|
44
|
-
temperature: normalizeInworldTemperature(overrides
|
|
41
|
+
voiceId: trimToUndefined(overrides?.voiceId ?? overrides?.voice),
|
|
42
|
+
modelId: trimToUndefined(overrides?.modelId ?? overrides?.model),
|
|
43
|
+
temperature: normalizeInworldTemperature(overrides?.temperature)
|
|
45
44
|
};
|
|
46
45
|
}
|
|
46
|
+
async function synthesizeInworld(req) {
|
|
47
|
+
const config = readInworldProviderConfig(req.providerConfig);
|
|
48
|
+
const overrides = readInworldOverrides(req.providerOverrides);
|
|
49
|
+
const apiKey = resolveInworldApiKey(config.apiKey);
|
|
50
|
+
if (!apiKey) throw new Error("Inworld API key missing");
|
|
51
|
+
return inworldTTS({
|
|
52
|
+
text: req.text,
|
|
53
|
+
apiKey,
|
|
54
|
+
baseUrl: config.baseUrl,
|
|
55
|
+
voiceId: overrides.voiceId ?? config.voiceId,
|
|
56
|
+
modelId: overrides.modelId ?? config.modelId,
|
|
57
|
+
audioEncoding: req.audioEncoding,
|
|
58
|
+
...req.sampleRateHertz === void 0 ? {} : { sampleRateHertz: req.sampleRateHertz },
|
|
59
|
+
temperature: overrides.temperature ?? config.temperature,
|
|
60
|
+
timeoutMs: req.timeoutMs
|
|
61
|
+
});
|
|
62
|
+
}
|
|
47
63
|
function parseDirectiveToken(ctx) {
|
|
48
64
|
switch (ctx.key) {
|
|
49
65
|
case "voice":
|
|
@@ -120,22 +136,12 @@ function buildInworldSpeechProvider() {
|
|
|
120
136
|
},
|
|
121
137
|
isConfigured: ({ providerConfig }) => Boolean(resolveInworldApiKey(readInworldProviderConfig(providerConfig).apiKey)),
|
|
122
138
|
synthesize: async (req) => {
|
|
123
|
-
const config = readInworldProviderConfig(req.providerConfig);
|
|
124
|
-
const overrides = readInworldOverrides(req.providerOverrides);
|
|
125
|
-
const apiKey = resolveInworldApiKey(config.apiKey);
|
|
126
|
-
if (!apiKey) throw new Error("Inworld API key missing");
|
|
127
139
|
const useOpus = req.target === "voice-note";
|
|
128
140
|
const audioEncoding = useOpus ? "OGG_OPUS" : "MP3";
|
|
129
141
|
return {
|
|
130
|
-
audioBuffer: await
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
baseUrl: config.baseUrl,
|
|
134
|
-
voiceId: overrides.voiceId ?? config.voiceId,
|
|
135
|
-
modelId: overrides.modelId ?? config.modelId,
|
|
136
|
-
audioEncoding,
|
|
137
|
-
temperature: overrides.temperature ?? config.temperature,
|
|
138
|
-
timeoutMs: req.timeoutMs
|
|
142
|
+
audioBuffer: await synthesizeInworld({
|
|
143
|
+
...req,
|
|
144
|
+
audioEncoding
|
|
139
145
|
}),
|
|
140
146
|
outputFormat: audioEncoding.toLowerCase(),
|
|
141
147
|
fileExtension: useOpus ? ".ogg" : ".mp3",
|
|
@@ -143,22 +149,12 @@ function buildInworldSpeechProvider() {
|
|
|
143
149
|
};
|
|
144
150
|
},
|
|
145
151
|
synthesizeTelephony: async (req) => {
|
|
146
|
-
const config = readInworldProviderConfig(req.providerConfig);
|
|
147
|
-
const overrides = readInworldOverrides(req.providerOverrides);
|
|
148
|
-
const apiKey = resolveInworldApiKey(config.apiKey);
|
|
149
|
-
if (!apiKey) throw new Error("Inworld API key missing");
|
|
150
152
|
const sampleRate = 22050;
|
|
151
153
|
return {
|
|
152
|
-
audioBuffer: await
|
|
153
|
-
|
|
154
|
-
apiKey,
|
|
155
|
-
baseUrl: config.baseUrl,
|
|
156
|
-
voiceId: overrides.voiceId ?? config.voiceId,
|
|
157
|
-
modelId: overrides.modelId ?? config.modelId,
|
|
154
|
+
audioBuffer: await synthesizeInworld({
|
|
155
|
+
...req,
|
|
158
156
|
audioEncoding: "PCM",
|
|
159
|
-
sampleRateHertz: sampleRate
|
|
160
|
-
temperature: overrides.temperature ?? config.temperature,
|
|
161
|
-
timeoutMs: req.timeoutMs
|
|
157
|
+
sampleRateHertz: sampleRate
|
|
162
158
|
}),
|
|
163
159
|
outputFormat: "pcm",
|
|
164
160
|
sampleRate
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/inworld-speech",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.8.1-beta.2",
|
|
4
4
|
"description": "OpenClaw Inworld speech plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.6.8"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.
|
|
21
|
+
"pluginApi": ">=2026.8.1-beta.2"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.
|
|
24
|
+
"openclawVersion": "2026.8.1-beta.2",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"openclaw": ">=2026.
|
|
41
|
+
"openclaw": ">=2026.8.1-beta.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"openclaw": {
|