@openclaw/volcengine-provider 2026.9.5 → 2026.9.7
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/assets/icon.png +0 -0
- package/dist/speech-provider.js +8 -28
- package/dist/tts.js +4 -13
- package/package.json +4 -4
package/assets/icon.png
CHANGED
|
Binary file
|
package/dist/speech-provider.js
CHANGED
|
@@ -57,30 +57,10 @@ function resolveLegacyVolcengineCredentials(config) {
|
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
function readProviderConfig(config) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
path: "tts.providers.volcengine.apiKey"
|
|
65
|
-
}) ?? normalized.apiKey,
|
|
66
|
-
appId: normalizeOptionalString(config.appId) ?? normalized.appId,
|
|
67
|
-
token: normalizeOptionalString(config.token) ?? normalized.token,
|
|
68
|
-
voice: normalizeOptionalString(config.voice) ?? normalized.voice,
|
|
69
|
-
cluster: normalizeOptionalString(config.cluster) ?? normalized.cluster,
|
|
70
|
-
resourceId: normalizeOptionalString(config.resourceId) ?? normalized.resourceId,
|
|
71
|
-
appKey: normalizeOptionalString(config.appKey) ?? normalized.appKey,
|
|
72
|
-
baseUrl: normalizeOptionalString(config.baseUrl) ?? normalized.baseUrl,
|
|
73
|
-
speedRatio: normalizeSpeedRatio(config.speedRatio) ?? normalized.speedRatio,
|
|
74
|
-
emotion: normalizeOptionalString(config.emotion) ?? normalized.emotion
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function readVolcengineOverrides(overrides) {
|
|
78
|
-
if (!overrides) return {};
|
|
79
|
-
return {
|
|
80
|
-
voice: normalizeOptionalString(overrides.voice),
|
|
81
|
-
speedRatio: normalizeSpeedRatio(overrides.speedRatio),
|
|
82
|
-
emotion: normalizeOptionalString(overrides.emotion)
|
|
83
|
-
};
|
|
60
|
+
return normalizeVolcengineProviderConfig({ volcengine: {
|
|
61
|
+
...config,
|
|
62
|
+
token: normalizeOptionalString(config.token)
|
|
63
|
+
} });
|
|
84
64
|
}
|
|
85
65
|
function parseDirectiveToken(ctx) {
|
|
86
66
|
switch (ctx.key) {
|
|
@@ -141,7 +121,7 @@ function buildVolcengineSpeechProvider() {
|
|
|
141
121
|
},
|
|
142
122
|
synthesize: async (req) => {
|
|
143
123
|
const cfg = readProviderConfig(req.providerConfig);
|
|
144
|
-
const overrides =
|
|
124
|
+
const overrides = req.providerOverrides;
|
|
145
125
|
const apiKey = resolveSeedSpeechApiKey(cfg.apiKey);
|
|
146
126
|
const { appId, token } = resolveLegacyVolcengineCredentials(cfg);
|
|
147
127
|
if (!apiKey && (!appId || !token)) throw new Error("Volcengine TTS credentials missing. Set VOLCENGINE_TTS_API_KEY, BYTEPLUS_SEED_SPEECH_API_KEY, or legacy VOLCENGINE_TTS_APPID and VOLCENGINE_TTS_TOKEN.");
|
|
@@ -153,13 +133,13 @@ function buildVolcengineSpeechProvider() {
|
|
|
153
133
|
apiKey,
|
|
154
134
|
appId,
|
|
155
135
|
token,
|
|
156
|
-
voice: overrides
|
|
136
|
+
voice: normalizeOptionalString(overrides?.voice) ?? cfg.voice,
|
|
157
137
|
cluster: cfg.cluster,
|
|
158
138
|
resourceId: cfg.resourceId,
|
|
159
139
|
appKey: cfg.appKey,
|
|
160
140
|
baseUrl: cfg.baseUrl,
|
|
161
|
-
speedRatio: overrides
|
|
162
|
-
emotion: overrides
|
|
141
|
+
speedRatio: normalizeSpeedRatio(overrides?.speedRatio) ?? cfg.speedRatio,
|
|
142
|
+
emotion: normalizeOptionalString(overrides?.emotion) ?? cfg.emotion,
|
|
163
143
|
encoding,
|
|
164
144
|
timeoutMs: req.timeoutMs
|
|
165
145
|
}),
|
package/dist/tts.js
CHANGED
|
@@ -26,9 +26,6 @@ function toTtsResponse(parsed) {
|
|
|
26
26
|
data: typeof parsed.data === "string" ? parsed.data : void 0
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
function parseLegacyTtsResponse(text) {
|
|
30
|
-
return toTtsResponse(parseJsonObject(text, "Volcengine"));
|
|
31
|
-
}
|
|
32
29
|
function parseSeedTtsFrames(text) {
|
|
33
30
|
const trimmed = text.trim();
|
|
34
31
|
if (!trimmed) return [];
|
|
@@ -44,15 +41,9 @@ function parseSeedTtsFrames(text) {
|
|
|
44
41
|
}
|
|
45
42
|
return frames;
|
|
46
43
|
}
|
|
47
|
-
function hostnameAllowlist(url) {
|
|
48
|
-
return [new URL(url).hostname];
|
|
49
|
-
}
|
|
50
|
-
function seedAudioFormat(encoding) {
|
|
51
|
-
return encoding === "wav" ? "pcm" : encoding;
|
|
52
|
-
}
|
|
53
44
|
async function seedSpeechTTS(params) {
|
|
54
45
|
const { text, apiKey, voice = DEFAULT_SEED_VOICE, resourceId = DEFAULT_SEED_TTS_RESOURCE_ID, appKey = DEFAULT_SEED_TTS_APP_KEY, baseUrl = BYTEPLUS_SEED_TTS_URL, speedRatio = 1, emotion, encoding = "ogg_opus", timeoutMs = 3e4 } = params;
|
|
55
|
-
const audioFormat =
|
|
46
|
+
const audioFormat = encoding === "wav" ? "pcm" : encoding;
|
|
56
47
|
const { canonicalizeBase64 } = await import("openclaw/plugin-sdk/media-runtime");
|
|
57
48
|
const { readResponseWithLimit } = await import("openclaw/plugin-sdk/response-limit-runtime");
|
|
58
49
|
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk/ssrf-runtime");
|
|
@@ -83,7 +74,7 @@ async function seedSpeechTTS(params) {
|
|
|
83
74
|
body: payload
|
|
84
75
|
},
|
|
85
76
|
timeoutMs,
|
|
86
|
-
policy: { hostnameAllowlist:
|
|
77
|
+
policy: { hostnameAllowlist: [new URL(baseUrl).hostname] },
|
|
87
78
|
auditContext: "volcengine.tts"
|
|
88
79
|
});
|
|
89
80
|
try {
|
|
@@ -145,11 +136,11 @@ async function legacyVolcengineTTS(params) {
|
|
|
145
136
|
body: payload
|
|
146
137
|
},
|
|
147
138
|
timeoutMs,
|
|
148
|
-
policy: { hostnameAllowlist:
|
|
139
|
+
policy: { hostnameAllowlist: [new URL(baseUrl).hostname] },
|
|
149
140
|
auditContext: "volcengine.tts"
|
|
150
141
|
});
|
|
151
142
|
try {
|
|
152
|
-
const body =
|
|
143
|
+
const body = toTtsResponse(parseJsonObject(new TextDecoder("utf-8", { fatal: true }).decode(await readResponseWithLimit(response, VOLCENGINE_TTS_RESPONSE_MAX_BYTES, { onOverflow: ({ maxBytes }) => /* @__PURE__ */ new Error(`Volcengine TTS response exceeds ${maxBytes} bytes`) })), "Volcengine"));
|
|
153
144
|
if (!response.ok || body.code !== 3e3 || !body.data) throw new Error(`Volcengine TTS error ${body.code ?? response.status}: ${body.message ?? "unknown"}`);
|
|
154
145
|
const canonicalAudio = canonicalizeBase64(body.data);
|
|
155
146
|
if (!canonicalAudio) throw new Error("Volcengine TTS returned malformed base64 audio data");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/volcengine-provider",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.7",
|
|
4
4
|
"description": "OpenClaw Volcengine provider plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.7.2"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.9.
|
|
21
|
+
"pluginApi": ">=2026.9.7"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.9.
|
|
24
|
+
"openclawVersion": "2026.9.7",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"assets/activity.svg"
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"openclaw": ">=2026.9.
|
|
43
|
+
"openclaw": ">=2026.9.7"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"openclaw": {
|