@openclaw/inworld-speech 2026.7.2-beta.7 → 2026.7.33

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.
@@ -1,6 +1,6 @@
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 { asObject, parseSpeechDirectiveNumberOverride, resolveSpeechProviderApiKey, trimToUndefined } from "openclaw/plugin-sdk/speech-core";
3
+ import { asObject, parseSpeechDirectiveNumberOverride, trimToUndefined } from "openclaw/plugin-sdk/speech-core";
4
4
  import { asFiniteNumberInRange } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  //#region extensions/inworld/speech-provider.ts
6
6
  function normalizeInworldTemperature(value) {
@@ -11,11 +11,12 @@ function normalizeInworldTemperature(value) {
11
11
  });
12
12
  }
13
13
  function normalizeInworldProviderConfig(rawConfig) {
14
- const raw = asObject(asObject(rawConfig.providers)?.inworld) ?? asObject(rawConfig.inworld);
14
+ const providers = asObject(rawConfig.providers);
15
+ const raw = asObject(providers?.inworld) ?? asObject(rawConfig.inworld);
15
16
  return {
16
17
  apiKey: normalizeResolvedSecretInputString({
17
18
  value: raw?.apiKey,
18
- path: "tts.providers.inworld.apiKey"
19
+ path: "messages.tts.providers.inworld.apiKey"
19
20
  }),
20
21
  baseUrl: normalizeInworldBaseUrl(trimToUndefined(raw?.baseUrl)),
21
22
  voiceId: trimToUndefined(raw?.voiceId) ?? "Sarah",
@@ -33,9 +34,6 @@ function readInworldProviderConfig(config) {
33
34
  temperature: normalizeInworldTemperature(config.temperature) ?? defaults.temperature
34
35
  };
35
36
  }
36
- function resolveInworldApiKey(primary, fallback) {
37
- return resolveSpeechProviderApiKey(primary, fallback, process.env.INWORLD_API_KEY);
38
- }
39
37
  function readInworldOverrides(overrides) {
40
38
  if (!overrides) return {};
41
39
  return {
@@ -110,19 +108,18 @@ function buildInworldSpeechProvider() {
110
108
  }),
111
109
  listVoices: async (req) => {
112
110
  const config = req.providerConfig ? readInworldProviderConfig(req.providerConfig) : void 0;
113
- const apiKey = resolveInworldApiKey(req.apiKey, config?.apiKey);
111
+ const apiKey = req.apiKey || config?.apiKey || process.env.INWORLD_API_KEY;
114
112
  if (!apiKey) throw new Error("Inworld API key missing");
115
113
  return listInworldVoices({
116
114
  apiKey,
117
- baseUrl: req.baseUrl ?? config?.baseUrl,
118
- timeoutMs: req.timeoutMs
115
+ baseUrl: req.baseUrl ?? config?.baseUrl
119
116
  });
120
117
  },
121
- isConfigured: ({ providerConfig }) => Boolean(resolveInworldApiKey(readInworldProviderConfig(providerConfig).apiKey)),
118
+ isConfigured: ({ providerConfig }) => Boolean(readInworldProviderConfig(providerConfig).apiKey || process.env.INWORLD_API_KEY),
122
119
  synthesize: async (req) => {
123
120
  const config = readInworldProviderConfig(req.providerConfig);
124
121
  const overrides = readInworldOverrides(req.providerOverrides);
125
- const apiKey = resolveInworldApiKey(config.apiKey);
122
+ const apiKey = config.apiKey || process.env.INWORLD_API_KEY;
126
123
  if (!apiKey) throw new Error("Inworld API key missing");
127
124
  const useOpus = req.target === "voice-note";
128
125
  const audioEncoding = useOpus ? "OGG_OPUS" : "MP3";
@@ -145,7 +142,7 @@ function buildInworldSpeechProvider() {
145
142
  synthesizeTelephony: async (req) => {
146
143
  const config = readInworldProviderConfig(req.providerConfig);
147
144
  const overrides = readInworldOverrides(req.providerOverrides);
148
- const apiKey = resolveInworldApiKey(config.apiKey);
145
+ const apiKey = config.apiKey || process.env.INWORLD_API_KEY;
149
146
  if (!apiKey) throw new Error("Inworld API key missing");
150
147
  const sampleRate = 22050;
151
148
  return {
package/dist/tts.js CHANGED
@@ -1,7 +1,6 @@
1
- import { MAX_AUDIO_BYTES, canonicalizeBase64 } from "openclaw/plugin-sdk/media-runtime";
1
+ import { MAX_AUDIO_BYTES } from "openclaw/plugin-sdk/media-runtime";
2
2
  import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
3
3
  import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
4
- import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
5
4
  //#region extensions/inworld/tts.ts
6
5
  const DEFAULT_INWORLD_BASE_URL = "https://api.inworld.ai";
7
6
  const DEFAULT_INWORLD_VOICE_ID = "Sarah";
@@ -9,7 +8,7 @@ const DEFAULT_INWORLD_MODEL_ID = "inworld-tts-1.5-max";
9
8
  const INWORLD_TTS_BODY_MAX_BYTES = MAX_AUDIO_BYTES * 2;
10
9
  const INWORLD_VOICES_BODY_MAX_BYTES = MAX_AUDIO_BYTES;
11
10
  const INWORLD_UPSTREAM_IDLE_TIMEOUT_MS = 3e4;
12
- const INWORLD_ERROR_BODY_MAX_BYTES = 8 * 1024;
11
+ const INWORLD_ERROR_BODY_MAX_BYTES = 8192;
13
12
  const INWORLD_ERROR_BODY_MAX_CHARS = 400;
14
13
  const INWORLD_ERROR_BODY_READ_IDLE_TIMEOUT_MS = 1e4;
15
14
  var InworldErrorBodyOverflow = class extends Error {};
@@ -35,7 +34,7 @@ async function readInworldErrorBodySnippet(response) {
35
34
  return error instanceof InworldErrorBodyOverflow ? "(error body exceeded diagnostic limit; truncated)" : "";
36
35
  }
37
36
  const collapsed = buffer.toString("utf8").replace(/\s+/g, " ").trim();
38
- if (collapsed.length > INWORLD_ERROR_BODY_MAX_CHARS) return `${truncateUtf16Safe(collapsed, INWORLD_ERROR_BODY_MAX_CHARS)}…`;
37
+ if (collapsed.length > INWORLD_ERROR_BODY_MAX_CHARS) return `${collapsed.slice(0, INWORLD_ERROR_BODY_MAX_CHARS)}…`;
39
38
  return collapsed;
40
39
  }
41
40
  const INWORLD_TTS_MODELS = [
@@ -107,13 +106,11 @@ async function inworldTTS(params) {
107
106
  try {
108
107
  parsed = JSON.parse(trimmed);
109
108
  } catch {
110
- throw new Error(`Inworld TTS stream parse error: unexpected non-JSON line: ${truncateUtf16Safe(trimmed, 80)}`);
109
+ throw new Error(`Inworld TTS stream parse error: unexpected non-JSON line: ${trimmed.slice(0, 80)}`);
111
110
  }
112
111
  if (parsed.error) throw new Error(`Inworld TTS stream error (${parsed.error.code}): ${parsed.error.message}`);
113
112
  if (parsed.result?.audioContent) {
114
- const canonicalAudio = canonicalizeBase64(parsed.result.audioContent);
115
- if (!canonicalAudio) throw new Error("Inworld TTS returned malformed base64 audio data");
116
- const chunk = Buffer.from(canonicalAudio, "base64");
113
+ const chunk = Buffer.from(parsed.result.audioContent, "base64");
117
114
  const nextDecodedAudioBytes = decodedAudioBytes + chunk.length;
118
115
  if (nextDecodedAudioBytes > MAX_AUDIO_BYTES) throw new Error(`Inworld TTS decoded audio too large: ${nextDecodedAudioBytes} bytes (limit: ${MAX_AUDIO_BYTES} bytes)`);
119
116
  decodedAudioBytes = nextDecodedAudioBytes;
@@ -128,8 +125,9 @@ async function inworldTTS(params) {
128
125
  }
129
126
  async function listInworldVoices(params) {
130
127
  const baseUrl = normalizeInworldBaseUrl(params.baseUrl);
128
+ const url = `${baseUrl}/voices/v1/voices${params.language ? `?languages=${encodeURIComponent(params.language)}` : ""}`;
131
129
  const { response, release } = await fetchWithSsrFGuard({
132
- url: `${baseUrl}/voices/v1/voices${params.language ? `?languages=${encodeURIComponent(params.language)}` : ""}`,
130
+ url,
133
131
  init: {
134
132
  method: "GET",
135
133
  headers: { Authorization: `Basic ${params.apiKey}` }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/inworld-speech",
3
- "version": "2026.7.2-beta.7",
3
+ "version": "2026.7.33",
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.7.2-beta.7"
21
+ "pluginApi": ">=2026.7.33"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.7.2-beta.7",
24
+ "openclawVersion": "2026.7.33",
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.7.2-beta.7"
41
+ "openclaw": ">=2026.7.33"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "openclaw": {