@openclaw/gradium-speech 2026.10.10-beta.5 → 2026.11.5-beta.1
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/.source-module-urls/4ae14bbfb3b816c7d3d9da544908fae9c329ef51ffe05bac64c317fb096020c5.json +1 -0
- package/dist/capability-catalog.js +1 -2
- package/dist/index.js +1 -2
- package/dist/speech-provider.js +94 -33
- package/package.json +4 -4
- package/dist/.source-module-urls/0c70ed748c2aee531b19850ba48566f7242b5ced1abc7366de3349d9e3b1fad1.json +0 -1
- package/dist/shared.js +0 -48
- package/dist/tts.js +0 -41
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"entries":[{"output":"capability-catalog.js","source":"extensions/gradium/capability-catalog.ts"},{"output":"index.js","source":"extensions/gradium/index.ts"},{"output":"speech-provider.js","source":"extensions/gradium/speech-provider.ts"}],"chunks":[{"output":"capability-catalog.js","sha256":"5ddc1747cdde80f557e1ce5d273c88c2668a141b290eb9a43d1d06c8e206eb88","facadeSource":"extensions/gradium/capability-catalog.ts","sources":["extensions/gradium/capability-catalog.ts"]},{"output":"index.js","sha256":"716ea84c7bf4116260078f849ef1d9b9a6bc3195143c7d546f1910269377fd83","facadeSource":"extensions/gradium/index.ts","sources":["extensions/gradium/index.ts"]},{"output":"speech-provider.js","sha256":"708d2a5aef416389b1c6351ae0b97a7226de7b1bf4c0e0cfc06adf576c3a6818","facadeSource":"extensions/gradium/speech-provider.ts","sources":["extensions/gradium/speech-provider.ts"]}],"unrenderedSources":[]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { buildGradiumSpeechProvider } from "./speech-provider.js";
|
|
2
|
-
|
|
2
|
+
// extensions/gradium/capability-catalog.ts
|
|
3
3
|
var capability_catalog_default = { speechProviders: [buildGradiumSpeechProvider()] };
|
|
4
|
-
//#endregion
|
|
5
4
|
export { capability_catalog_default as default };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildGradiumSpeechProvider } from "./speech-provider.js";
|
|
2
2
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
|
-
|
|
3
|
+
// extensions/gradium/index.ts
|
|
4
4
|
var gradium_default = definePluginEntry({
|
|
5
5
|
id: "gradium",
|
|
6
6
|
name: "Gradium Speech",
|
|
@@ -9,5 +9,4 @@ var gradium_default = definePluginEntry({
|
|
|
9
9
|
api.registerSpeechProvider(buildGradiumSpeechProvider());
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
//#endregion
|
|
13
12
|
export { gradium_default as default };
|
package/dist/speech-provider.js
CHANGED
|
@@ -1,26 +1,69 @@
|
|
|
1
|
-
import { GRADIUM_VOICES, normalizeGradiumBaseUrl } from "./shared.js";
|
|
2
|
-
import { gradiumTTS } from "./tts.js";
|
|
3
1
|
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
4
|
-
import { resolveSpeechProviderApiKey } from "openclaw/plugin-sdk/speech-provider";
|
|
2
|
+
import { createSpeechDirectiveParser, resolveSpeechProviderApiKey } from "openclaw/plugin-sdk/speech-provider";
|
|
5
3
|
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
-
|
|
4
|
+
// extensions/gradium/speech-provider.ts
|
|
5
|
+
const DEFAULT_GRADIUM_BASE_URL = "https://api.gradium.ai";
|
|
6
|
+
const GRADIUM_API_HOSTNAME = "api.gradium.ai";
|
|
7
|
+
const DEFAULT_GRADIUM_VOICE_ID = "YTpq7expH9539ERJ";
|
|
8
|
+
const GRADIUM_VOICES = [
|
|
9
|
+
{
|
|
10
|
+
id: "YTpq7expH9539ERJ",
|
|
11
|
+
name: "Emma"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: "LFZvm12tW_z0xfGo",
|
|
15
|
+
name: "Kent"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "Eu9iL_CYe8N-Gkx_",
|
|
19
|
+
name: "Tiffany"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "2H4HY2CBNyJHBCrP",
|
|
23
|
+
name: "Christina"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "jtEKaLYNn6iif5PR",
|
|
27
|
+
name: "Sydney"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "KWJiFWu2O9nMPYcR",
|
|
31
|
+
name: "John"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "3jUdJyOi9pgbxBTK",
|
|
35
|
+
name: "Arthur"
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
function normalizeGradiumBaseUrl(baseUrl) {
|
|
39
|
+
const raw = baseUrl?.trim() || DEFAULT_GRADIUM_BASE_URL;
|
|
40
|
+
const url = URL.parse(raw);
|
|
41
|
+
if (!url) throw new Error("Gradium baseUrl must be a valid https URL");
|
|
42
|
+
url.username = "";
|
|
43
|
+
url.password = "";
|
|
44
|
+
url.search = "";
|
|
45
|
+
url.hash = "";
|
|
46
|
+
if (url.protocol !== "https:") throw new Error("Gradium baseUrl must use https");
|
|
47
|
+
if (url.hostname.toLowerCase() !== GRADIUM_API_HOSTNAME) throw new Error("Gradium baseUrl must target api.gradium.ai");
|
|
48
|
+
return url.toString().replace(/\/+$/, "");
|
|
49
|
+
}
|
|
7
50
|
function normalizeGradiumProviderConfig(rawConfig) {
|
|
8
51
|
const providers = asOptionalRecord(rawConfig.providers);
|
|
9
|
-
const raw = asOptionalRecord(providers?.gradium)
|
|
52
|
+
const raw = asOptionalRecord(providers?.gradium);
|
|
10
53
|
return {
|
|
11
54
|
apiKey: normalizeResolvedSecretInputString({
|
|
12
55
|
value: raw?.apiKey,
|
|
13
56
|
path: "tts.providers.gradium.apiKey"
|
|
14
57
|
}),
|
|
15
58
|
baseUrl: normalizeGradiumBaseUrl(normalizeOptionalString(raw?.baseUrl)),
|
|
16
|
-
voiceId: normalizeOptionalString(raw?.voiceId) ??
|
|
59
|
+
voiceId: normalizeOptionalString(raw?.voiceId) ?? DEFAULT_GRADIUM_VOICE_ID
|
|
17
60
|
};
|
|
18
61
|
}
|
|
19
62
|
function readGradiumProviderConfig(config) {
|
|
20
|
-
return normalizeGradiumProviderConfig({ gradium: {
|
|
63
|
+
return normalizeGradiumProviderConfig({ providers: { gradium: {
|
|
21
64
|
...config,
|
|
22
65
|
apiKey: normalizeOptionalString(config.apiKey)
|
|
23
|
-
} });
|
|
66
|
+
} } });
|
|
24
67
|
}
|
|
25
68
|
function resolveGradiumApiKey(configApiKey) {
|
|
26
69
|
return resolveSpeechProviderApiKey(normalizeOptionalString(configApiKey), process.env.GRADIUM_API_KEY);
|
|
@@ -30,15 +73,43 @@ async function synthesizeGradium(req, outputFormat) {
|
|
|
30
73
|
const apiKey = resolveGradiumApiKey(config.apiKey);
|
|
31
74
|
if (!apiKey) throw new Error("Gradium API key missing");
|
|
32
75
|
const { resolveGeneratedMediaMaxBytes } = await import("openclaw/plugin-sdk/media-generation-runtime");
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
76
|
+
const text = req.text;
|
|
77
|
+
const voiceId = normalizeOptionalString(req.providerOverrides?.voiceId) ?? config.voiceId;
|
|
78
|
+
const timeoutMs = req.timeoutMs;
|
|
79
|
+
const maxBytes = resolveGeneratedMediaMaxBytes(req.cfg, "audio");
|
|
80
|
+
const url = `${config.baseUrl}/api/post/speech/tts`;
|
|
81
|
+
const { assertOkOrThrowProviderError, readProviderBinaryResponse } = await import("openclaw/plugin-sdk/provider-http");
|
|
82
|
+
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk/ssrf-runtime");
|
|
83
|
+
const { response, release } = await fetchWithSsrFGuard({
|
|
84
|
+
url,
|
|
85
|
+
init: {
|
|
86
|
+
method: "POST",
|
|
87
|
+
headers: {
|
|
88
|
+
"x-api-key": apiKey,
|
|
89
|
+
"Content-Type": "application/json"
|
|
90
|
+
},
|
|
91
|
+
body: JSON.stringify({
|
|
92
|
+
text,
|
|
93
|
+
voice_id: voiceId,
|
|
94
|
+
only_audio: true,
|
|
95
|
+
output_format: outputFormat,
|
|
96
|
+
json_config: JSON.stringify({ padding_bonus: 0 })
|
|
97
|
+
})
|
|
98
|
+
},
|
|
99
|
+
timeoutMs,
|
|
100
|
+
requireHttps: true,
|
|
101
|
+
policy: { hostnameAllowlist: [GRADIUM_API_HOSTNAME] },
|
|
102
|
+
auditContext: "gradium.tts"
|
|
41
103
|
});
|
|
104
|
+
try {
|
|
105
|
+
await assertOkOrThrowProviderError(response, "Gradium API error", { requestHeaders: { "x-api-key": apiKey } });
|
|
106
|
+
return await readProviderBinaryResponse(response, "Gradium API error", "audio", {
|
|
107
|
+
maxBytes,
|
|
108
|
+
onOverflow: ({ maxBytes: maxBytesLocal }) => /* @__PURE__ */ new Error(`Gradium TTS audio response exceeds ${maxBytesLocal} bytes`)
|
|
109
|
+
});
|
|
110
|
+
} finally {
|
|
111
|
+
await release();
|
|
112
|
+
}
|
|
42
113
|
}
|
|
43
114
|
function isGradiumProviderConfigured(config) {
|
|
44
115
|
if (!resolveGradiumApiKey(config.apiKey)) return false;
|
|
@@ -49,22 +120,13 @@ function isGradiumProviderConfigured(config) {
|
|
|
49
120
|
return false;
|
|
50
121
|
}
|
|
51
122
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
].includes(ctx.key)) return { handled: false };
|
|
60
|
-
return ctx.policy.allowVoice ? {
|
|
61
|
-
handled: true,
|
|
62
|
-
overrides: {
|
|
63
|
-
...ctx.currentOverrides,
|
|
64
|
-
voiceId: ctx.value
|
|
65
|
-
}
|
|
66
|
-
} : { handled: true };
|
|
67
|
-
}
|
|
123
|
+
const parseDirectiveToken = createSpeechDirectiveParser({ voiceId: ["allowVoice", [
|
|
124
|
+
"voice",
|
|
125
|
+
"voice_id",
|
|
126
|
+
"voiceid",
|
|
127
|
+
"gradium_voice",
|
|
128
|
+
"gradiumvoice"
|
|
129
|
+
]] });
|
|
68
130
|
function buildGradiumSpeechProvider() {
|
|
69
131
|
const isConfigured = ({ providerConfig }) => isGradiumProviderConfigured(providerConfig);
|
|
70
132
|
return {
|
|
@@ -97,5 +159,4 @@ function buildGradiumSpeechProvider() {
|
|
|
97
159
|
})
|
|
98
160
|
};
|
|
99
161
|
}
|
|
100
|
-
//#endregion
|
|
101
162
|
export { buildGradiumSpeechProvider };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/gradium-speech",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.11.5-beta.1",
|
|
4
4
|
"description": "OpenClaw Gradium 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.11.5-beta.1"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.
|
|
24
|
+
"openclawVersion": "2026.11.5-beta.1",
|
|
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.
|
|
43
|
+
"openclaw": ">=2026.11.5-beta.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"openclaw": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"entries":[{"output":"capability-catalog.js","source":"extensions/gradium/capability-catalog.ts"},{"output":"index.js","source":"extensions/gradium/index.ts"},{"output":"shared.js","source":"extensions/gradium/shared.ts"},{"output":"speech-provider.js","source":"extensions/gradium/speech-provider.ts"},{"output":"tts.js","source":"extensions/gradium/tts.ts"}],"chunks":[{"output":"capability-catalog.js","sha256":"1278a115b88deea97ccacd2fea928197628bf3d95a00d476bf5c38504f3d8ac1","facadeSource":"extensions/gradium/capability-catalog.ts","sources":["extensions/gradium/capability-catalog.ts"]},{"output":"index.js","sha256":"f8dccfc96a366e970f9a70e86931f70c56c2d3455cdbcbb1a560c373113f6f40","facadeSource":"extensions/gradium/index.ts","sources":["extensions/gradium/index.ts"]},{"output":"shared.js","sha256":"55a5d0727d6cc3e805db6747cd51ff3e4e460e6203a7172497d2e55ce8e734b5","facadeSource":"extensions/gradium/shared.ts","sources":["extensions/gradium/shared.ts"]},{"output":"speech-provider.js","sha256":"f1d221230f9bbc0bf40638315bb8919eea828b40d28d44c2aa372ff5b7638138","facadeSource":"extensions/gradium/speech-provider.ts","sources":["extensions/gradium/speech-provider.ts"]},{"output":"tts.js","sha256":"166bb135f8b7f5dc9845454a55c022afd18b6bbefb32f193c797dde0bd7c5167","facadeSource":"extensions/gradium/tts.ts","sources":["extensions/gradium/tts.ts"]}],"unrenderedSources":[]}
|
package/dist/shared.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
//#region extensions/gradium/shared.ts
|
|
2
|
-
const DEFAULT_GRADIUM_BASE_URL = "https://api.gradium.ai";
|
|
3
|
-
const GRADIUM_API_HOSTNAME = "api.gradium.ai";
|
|
4
|
-
const DEFAULT_GRADIUM_VOICE_ID = "YTpq7expH9539ERJ";
|
|
5
|
-
const GRADIUM_VOICES = [
|
|
6
|
-
{
|
|
7
|
-
id: "YTpq7expH9539ERJ",
|
|
8
|
-
name: "Emma"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
id: "LFZvm12tW_z0xfGo",
|
|
12
|
-
name: "Kent"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: "Eu9iL_CYe8N-Gkx_",
|
|
16
|
-
name: "Tiffany"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
id: "2H4HY2CBNyJHBCrP",
|
|
20
|
-
name: "Christina"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: "jtEKaLYNn6iif5PR",
|
|
24
|
-
name: "Sydney"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
id: "KWJiFWu2O9nMPYcR",
|
|
28
|
-
name: "John"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: "3jUdJyOi9pgbxBTK",
|
|
32
|
-
name: "Arthur"
|
|
33
|
-
}
|
|
34
|
-
];
|
|
35
|
-
function normalizeGradiumBaseUrl(baseUrl) {
|
|
36
|
-
const raw = baseUrl?.trim() || DEFAULT_GRADIUM_BASE_URL;
|
|
37
|
-
const url = URL.parse(raw);
|
|
38
|
-
if (!url) throw new Error("Gradium baseUrl must be a valid https URL");
|
|
39
|
-
url.username = "";
|
|
40
|
-
url.password = "";
|
|
41
|
-
url.search = "";
|
|
42
|
-
url.hash = "";
|
|
43
|
-
if (url.protocol !== "https:") throw new Error("Gradium baseUrl must use https");
|
|
44
|
-
if (url.hostname.toLowerCase() !== "api.gradium.ai") throw new Error("Gradium baseUrl must target api.gradium.ai");
|
|
45
|
-
return url.toString().replace(/\/+$/, "");
|
|
46
|
-
}
|
|
47
|
-
//#endregion
|
|
48
|
-
export { DEFAULT_GRADIUM_VOICE_ID, GRADIUM_API_HOSTNAME, GRADIUM_VOICES, normalizeGradiumBaseUrl };
|
package/dist/tts.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { GRADIUM_API_HOSTNAME, normalizeGradiumBaseUrl } from "./shared.js";
|
|
2
|
-
//#region extensions/gradium/tts.ts
|
|
3
|
-
const DEFAULT_TTS_MAX_BYTES = 16777216;
|
|
4
|
-
async function gradiumTTS(params) {
|
|
5
|
-
const { text, apiKey, baseUrl, voiceId, outputFormat, timeoutMs, maxBytes = DEFAULT_TTS_MAX_BYTES } = params;
|
|
6
|
-
const url = `${normalizeGradiumBaseUrl(baseUrl)}/api/post/speech/tts`;
|
|
7
|
-
const { assertOkOrThrowProviderError, readProviderBinaryResponse } = await import("openclaw/plugin-sdk/provider-http");
|
|
8
|
-
const { fetchWithSsrFGuard } = await import("openclaw/plugin-sdk/ssrf-runtime");
|
|
9
|
-
const { response, release } = await fetchWithSsrFGuard({
|
|
10
|
-
url,
|
|
11
|
-
init: {
|
|
12
|
-
method: "POST",
|
|
13
|
-
headers: {
|
|
14
|
-
"x-api-key": apiKey,
|
|
15
|
-
"Content-Type": "application/json"
|
|
16
|
-
},
|
|
17
|
-
body: JSON.stringify({
|
|
18
|
-
text,
|
|
19
|
-
voice_id: voiceId,
|
|
20
|
-
only_audio: true,
|
|
21
|
-
output_format: outputFormat,
|
|
22
|
-
json_config: JSON.stringify({ padding_bonus: 0 })
|
|
23
|
-
})
|
|
24
|
-
},
|
|
25
|
-
timeoutMs,
|
|
26
|
-
requireHttps: true,
|
|
27
|
-
policy: { hostnameAllowlist: [GRADIUM_API_HOSTNAME] },
|
|
28
|
-
auditContext: "gradium.tts"
|
|
29
|
-
});
|
|
30
|
-
try {
|
|
31
|
-
await assertOkOrThrowProviderError(response, "Gradium API error");
|
|
32
|
-
return await readProviderBinaryResponse(response, "Gradium API error", "audio", {
|
|
33
|
-
maxBytes,
|
|
34
|
-
onOverflow: ({ maxBytes: maxBytesLocal }) => /* @__PURE__ */ new Error(`Gradium TTS audio response exceeds ${maxBytesLocal} bytes`)
|
|
35
|
-
});
|
|
36
|
-
} finally {
|
|
37
|
-
await release();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
export { gradiumTTS };
|