@cliptude/cli 0.1.21 → 0.1.30
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/README.md +32 -2
- package/cliptude_mcp/apps.py +311 -0
- package/cliptude_mcp/cli.py +103 -21
- package/cliptude_mcp/client.py +288 -66
- package/cliptude_mcp/creation.py +207 -0
- package/cliptude_mcp/credentials.py +31 -5
- package/cliptude_mcp/server.py +284 -76
- package/cliptude_mcp/widgets/avatars.html +287 -0
- package/cliptude_mcp/widgets/base.css +123 -0
- package/cliptude_mcp/widgets/bridge.js +314 -0
- package/cliptude_mcp/widgets/characters.html +108 -0
- package/cliptude_mcp/widgets/choices.html +230 -0
- package/cliptude_mcp/widgets/player.html +126 -0
- package/cliptude_mcp/widgets/publish-kit.html +170 -0
- package/cliptude_mcp/widgets/voices.html +436 -0
- package/package.json +1 -1
- package/pyproject.toml +4 -4
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Choose a voice</title>
|
|
7
|
+
<style>
|
|
8
|
+
/*@BASE_CSS@*/
|
|
9
|
+
.avatar-dot { width: 34px; height: 34px; border-radius: 50%; flex: none; }
|
|
10
|
+
.row { cursor: pointer; }
|
|
11
|
+
.panel { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--border-radius-md);
|
|
12
|
+
background: var(--color-background-secondary); border: 1px solid var(--color-border-primary); }
|
|
13
|
+
.panel h2 { font-size: var(--font-text-md-size); margin: 0; }
|
|
14
|
+
.panel label { display: flex; flex-direction: column; gap: 4px; font-size: var(--font-text-sm-size); color: var(--color-text-secondary); }
|
|
15
|
+
.panel textarea, .panel input[type="text"] {
|
|
16
|
+
font: inherit; font-size: var(--font-text-sm-size); color: var(--color-text-primary);
|
|
17
|
+
background: var(--color-background-primary); border: 1px solid var(--color-border-primary);
|
|
18
|
+
border-radius: var(--border-radius-sm); padding: 8px 10px; }
|
|
19
|
+
.panel textarea { min-height: 70px; resize: vertical; }
|
|
20
|
+
.consent { flex-direction: row !important; align-items: flex-start; gap: 8px !important; }
|
|
21
|
+
.consent input { margin-top: 3px; }
|
|
22
|
+
.rec { color: var(--color-text-danger); font-variant-numeric: tabular-nums; }
|
|
23
|
+
.linkish { background: none; border: 0; padding: 0; color: var(--color-text-info); text-decoration: underline; cursor: pointer; font-size: inherit; }
|
|
24
|
+
</style>
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<main class="app" aria-labelledby="title">
|
|
28
|
+
<div class="head">
|
|
29
|
+
<h1 id="title">Choose a voice</h1>
|
|
30
|
+
<span class="sub" id="count"></span>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="toolbar">
|
|
33
|
+
<label class="sr-only" for="filter">Filter voices</label>
|
|
34
|
+
<input type="search" id="filter" placeholder="Filter by name, accent, style" autocomplete="off">
|
|
35
|
+
<label class="sr-only" for="gender">Gender</label>
|
|
36
|
+
<select id="gender"><option value="">Any gender</option><option value="male">Male</option><option value="female">Female</option></select>
|
|
37
|
+
<button type="button" id="open-design" aria-expanded="false">Design a voice</button>
|
|
38
|
+
<button type="button" id="open-clone" aria-expanded="false">Clone a voice</button>
|
|
39
|
+
</div>
|
|
40
|
+
<div id="design-panel" class="panel" hidden></div>
|
|
41
|
+
<div id="clone-panel" class="panel" hidden></div>
|
|
42
|
+
<div id="mine"></div>
|
|
43
|
+
<div id="content"><div class="status" role="status">Loading voices…</div></div>
|
|
44
|
+
<div id="more"></div>
|
|
45
|
+
<div class="selection" id="selection" hidden>
|
|
46
|
+
<span class="what" id="selected-text"></span>
|
|
47
|
+
<button class="primary" id="use" type="button">Use this voice</button>
|
|
48
|
+
</div>
|
|
49
|
+
</main>
|
|
50
|
+
<div id="toast" role="status" aria-live="polite"></div>
|
|
51
|
+
<script>
|
|
52
|
+
/*@BRIDGE_JS@*/
|
|
53
|
+
(function () {
|
|
54
|
+
"use strict";
|
|
55
|
+
var h = UI.h;
|
|
56
|
+
var PAGE = 60;
|
|
57
|
+
var PLAY = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg>';
|
|
58
|
+
var PAUSE = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 5h4v14H6zm8 0h4v14h-4z"/></svg>';
|
|
59
|
+
var DESIGN_PROVIDERS = { elevenlabs: "ElevenLabs", minimax: "MiniMax", inworld: "Inworld" };
|
|
60
|
+
var CLONE_PROVIDERS = { elevenlabs: "ElevenLabs", minimax: "MiniMax", cartesia: "Cartesia", inworld: "Inworld", voicetory: "Voicetory" };
|
|
61
|
+
// Word for word what the Clone a voice page asks the user to confirm.
|
|
62
|
+
var CONSENT = "I confirm this is my own voice, or I have the voice owner’s explicit consent and the rights to clone it. " +
|
|
63
|
+
"I will not use cloned voices to impersonate or deceive others, as required by our Terms of Service.";
|
|
64
|
+
var voices = [];
|
|
65
|
+
var mine = [];
|
|
66
|
+
var provider = "";
|
|
67
|
+
var language = "";
|
|
68
|
+
var selected = null;
|
|
69
|
+
var shown = PAGE;
|
|
70
|
+
var content = document.getElementById("content");
|
|
71
|
+
|
|
72
|
+
function shortName(v) { return String(v.name || "").split(/\s[-–—|]\s/)[0].trim() || v.voice_id; }
|
|
73
|
+
function gender(v) {
|
|
74
|
+
return String(v.filter_gender || (v.labels && v.labels.gender) || v.gender || v.gender_text || "").toLowerCase();
|
|
75
|
+
}
|
|
76
|
+
function facts(v) {
|
|
77
|
+
var out = [];
|
|
78
|
+
[v.gender_text || v.gender, v.age_text || v.age, v.accent_text || v.accent, v.use_case_text, v.language].forEach(function (x) {
|
|
79
|
+
x = String(x || "").trim();
|
|
80
|
+
if (x && x.toLowerCase() !== "standard" && out.indexOf(x) < 0) out.push(x);
|
|
81
|
+
});
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
function haystack(v) { return [v.name, v.description, v.voice_id].concat(facts(v)).join(" ").toLowerCase(); }
|
|
85
|
+
function visible() {
|
|
86
|
+
var q = document.getElementById("filter").value.trim().toLowerCase();
|
|
87
|
+
var g = document.getElementById("gender").value;
|
|
88
|
+
return voices.filter(function (v) {
|
|
89
|
+
if (g && gender(v) !== g) return false;
|
|
90
|
+
return !q || haystack(v).indexOf(q) >= 0;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function playButton(key, url, label) {
|
|
95
|
+
if (!url) {
|
|
96
|
+
return h("button", { type: "button", class: "icon", disabled: true, title: "No preview for this voice", "aria-label": "No preview for " + label }, []);
|
|
97
|
+
}
|
|
98
|
+
var playing = Media.playing() === key;
|
|
99
|
+
var b = h("button", {
|
|
100
|
+
type: "button", class: "icon", "aria-pressed": String(playing),
|
|
101
|
+
"aria-label": (playing ? "Pause " : "Play ") + label + " preview",
|
|
102
|
+
onclick: function (e) { e.stopPropagation(); Media.toggleAudio(key, url); }
|
|
103
|
+
}, []);
|
|
104
|
+
b.innerHTML = playing ? PAUSE : PLAY;
|
|
105
|
+
return b;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function dot(v) {
|
|
109
|
+
var hue = v.hue1 != null ? v.hue1 : (String(v.voice_id).length * 37) % 360;
|
|
110
|
+
return h("span", { class: "avatar-dot", "aria-hidden": "true", style: {
|
|
111
|
+
background: "linear-gradient(135deg, hsl(" + hue + " 70% 55%), hsl(" + (v.hue2 != null ? v.hue2 : hue + 120) + " 70% 45%))"
|
|
112
|
+
} });
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function selectable(el, v) {
|
|
116
|
+
el.setAttribute("aria-pressed", String(!!selected && selected.voice_id === v.voice_id));
|
|
117
|
+
el.addEventListener("click", function () { select(v); });
|
|
118
|
+
el.addEventListener("keydown", function (e) { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); select(v); } });
|
|
119
|
+
return el;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function row(v) {
|
|
123
|
+
return selectable(h("div", { class: "row", role: "listitem", tabindex: "0" }, [
|
|
124
|
+
playButton(v.voice_id, v.preview_url, shortName(v)), dot(v),
|
|
125
|
+
h("div", { class: "main" }, [
|
|
126
|
+
h("span", { class: "name" }, [v.name || v.voice_id]),
|
|
127
|
+
v.description ? h("span", { class: "desc" }, [v.description]) : null,
|
|
128
|
+
h("span", { class: "chips" }, facts(v).map(function (f) { return h("span", { class: "chip" }, [f]); })
|
|
129
|
+
.concat(v.preview_url ? [] : [h("span", { class: "chip" }, ["No preview"])]))
|
|
130
|
+
])
|
|
131
|
+
]), v);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function mineRow(v) {
|
|
135
|
+
var unusable = v.status && v.status !== "ready";
|
|
136
|
+
var el = h("div", { class: "row", role: "listitem", tabindex: "0" }, [
|
|
137
|
+
playButton(v.voice_id, v.preview_url, v.name), dot(v),
|
|
138
|
+
h("div", { class: "main" }, [
|
|
139
|
+
h("span", { class: "name" }, [v.name || v.voice_id]),
|
|
140
|
+
v.description ? h("span", { class: "desc" }, [v.description]) : null,
|
|
141
|
+
h("span", { class: "chips" }, [
|
|
142
|
+
h("span", { class: "chip info" }, [v.kind === "design" ? "Designed" : "Cloned"]),
|
|
143
|
+
unusable ? h("span", { class: "chip" }, [v.status === "expired" ? "Expired" : "Not ready"]) : null
|
|
144
|
+
])
|
|
145
|
+
])
|
|
146
|
+
]);
|
|
147
|
+
if (unusable) { el.setAttribute("aria-disabled", "true"); return el; }
|
|
148
|
+
return selectable(el, v);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function renderMine() {
|
|
152
|
+
var box = UI.clear(document.getElementById("mine"));
|
|
153
|
+
var rows = mine.filter(function (v) { return !v.provider || v.provider === provider; });
|
|
154
|
+
if (!rows.length) return;
|
|
155
|
+
var list = h("div", { class: "list", role: "list", "aria-label": "Your voices" });
|
|
156
|
+
rows.forEach(function (v) { list.appendChild(mineRow(v)); });
|
|
157
|
+
box.appendChild(h("section", { class: "list" }, [h("h2", { class: "section-title" }, ["Your voices"]), list]));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function select(v) {
|
|
161
|
+
selected = v;
|
|
162
|
+
render();
|
|
163
|
+
document.getElementById("selection").hidden = false;
|
|
164
|
+
document.getElementById("selected-text").textContent =
|
|
165
|
+
"“" + shortName(v) + "” · " + (v.provider || provider || "voice") + " · " + v.voice_id;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function render() {
|
|
169
|
+
renderMine();
|
|
170
|
+
var rows = visible();
|
|
171
|
+
document.getElementById("count").textContent =
|
|
172
|
+
(provider ? provider + " · " : "") + rows.length + " voice" + (rows.length === 1 ? "" : "s");
|
|
173
|
+
if (!voices.length) { UI.status(content, "No catalog voices came back for this provider and language."); return; }
|
|
174
|
+
if (!rows.length) { UI.status(content, "No voice matches that filter."); UI.clear(document.getElementById("more")); return; }
|
|
175
|
+
var list = h("div", { class: "list", role: "list", "aria-label": "Catalog voices" });
|
|
176
|
+
rows.slice(0, shown).forEach(function (v) { list.appendChild(row(v)); });
|
|
177
|
+
UI.clear(content).appendChild(h("section", { class: "list" }, [
|
|
178
|
+
mine.length ? h("h2", { class: "section-title" }, ["Catalog"]) : null, list]));
|
|
179
|
+
var more = UI.clear(document.getElementById("more"));
|
|
180
|
+
if (rows.length > shown) {
|
|
181
|
+
more.appendChild(h("button", { type: "button", onclick: function () { shown += PAGE; render(); } },
|
|
182
|
+
["Show " + Math.min(PAGE, rows.length - shown) + " more"]));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function providerSelect(id, map, preferred) {
|
|
187
|
+
var sel = h("select", { id: id });
|
|
188
|
+
Object.keys(map).forEach(function (k) { sel.appendChild(h("option", { value: k, selected: k === preferred }, [map[k]])); });
|
|
189
|
+
if (!map[preferred]) sel.value = "elevenlabs";
|
|
190
|
+
return sel;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function addMine(v) {
|
|
194
|
+
mine = [v].concat(mine.filter(function (m) { return m.voice_id !== v.voice_id; }));
|
|
195
|
+
if (v.provider && v.provider !== provider) UI.toast("Saved under " + v.provider + ". Ask for " + v.provider + " voices to see it here.");
|
|
196
|
+
select(v);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/* ---- Design a voice: description -> previews -> keep one ---- */
|
|
200
|
+
function openDesign() {
|
|
201
|
+
var panel = document.getElementById("design-panel");
|
|
202
|
+
if (!panel.hidden) { panel.hidden = true; document.getElementById("open-design").setAttribute("aria-expanded", "false"); return; }
|
|
203
|
+
document.getElementById("clone-panel").hidden = true;
|
|
204
|
+
document.getElementById("open-clone").setAttribute("aria-expanded", "false");
|
|
205
|
+
document.getElementById("open-design").setAttribute("aria-expanded", "true");
|
|
206
|
+
panel.hidden = false;
|
|
207
|
+
var prov = providerSelect("design-provider", DESIGN_PROVIDERS, provider);
|
|
208
|
+
var desc = h("textarea", { id: "design-desc", maxlength: "1000",
|
|
209
|
+
placeholder: "e.g. A calm, deep male documentary narrator in his 50s with a slight British accent, unhurried pace" });
|
|
210
|
+
var go = h("button", { type: "button", class: "primary" }, ["Generate previews"]);
|
|
211
|
+
var out = h("div", { class: "list" });
|
|
212
|
+
UI.clear(panel).appendChild(h("h2", {}, ["Design a voice"]));
|
|
213
|
+
panel.appendChild(h("span", { class: "sub" }, ["Describe the voice; you get a few previews to listen to and keep one. Paid plans; one designed voice per provider."]));
|
|
214
|
+
panel.appendChild(h("div", { class: "toolbar" }, [h("label", {}, ["Provider", prov])]));
|
|
215
|
+
panel.appendChild(h("label", { for: "design-desc" }, ["Description", desc]));
|
|
216
|
+
panel.appendChild(h("div", { class: "toolbar" }, [go]));
|
|
217
|
+
panel.appendChild(out);
|
|
218
|
+
go.addEventListener("click", function () {
|
|
219
|
+
var text = desc.value.trim();
|
|
220
|
+
if (text.length < 10) { UI.toast("Describe the voice in a sentence or two."); return; }
|
|
221
|
+
go.disabled = true; go.textContent = "Designing…";
|
|
222
|
+
UI.status(out, "Designing previews. This takes up to a minute.");
|
|
223
|
+
Cliptude.callTool("design_voice_previews", { provider: prov.value, description: text, language: language || undefined })
|
|
224
|
+
.then(function (res) {
|
|
225
|
+
go.disabled = false; go.textContent = "Generate new previews";
|
|
226
|
+
var err = UI.errorText(res);
|
|
227
|
+
if (err) { UI.status(out, err, "error"); return; }
|
|
228
|
+
showPreviews(out, prov.value, res.previews || []);
|
|
229
|
+
}).catch(function () { go.disabled = false; go.textContent = "Generate previews"; UI.status(out, "The previews could not be made.", "error"); });
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function showPreviews(out, prov, previews) {
|
|
234
|
+
UI.clear(out);
|
|
235
|
+
if (!previews.length) { UI.status(out, "No previews came back. Try another description."); return; }
|
|
236
|
+
var chosen = null;
|
|
237
|
+
var list = h("div", { class: "list", role: "radiogroup", "aria-label": "Previews" });
|
|
238
|
+
var name = h("input", { type: "text", id: "design-name", maxlength: "100", placeholder: "Voice name" });
|
|
239
|
+
var save = h("button", { type: "button", class: "primary", disabled: true }, ["Keep this voice"]);
|
|
240
|
+
function draw() {
|
|
241
|
+
UI.clear(list);
|
|
242
|
+
previews.forEach(function (p, i) {
|
|
243
|
+
var el = h("div", { class: "row", role: "radio", tabindex: "0", "aria-checked": String(chosen === p) }, [
|
|
244
|
+
playButton("design:" + p.preview_id, p.audio_url, "Preview " + (i + 1)),
|
|
245
|
+
h("div", { class: "main" }, [h("span", { class: "name" }, ["Preview " + (i + 1)])])
|
|
246
|
+
]);
|
|
247
|
+
el.setAttribute("aria-pressed", String(chosen === p));
|
|
248
|
+
el.addEventListener("click", function () { chosen = p; save.disabled = !name.value.trim(); draw(); });
|
|
249
|
+
list.appendChild(el);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
Media.onChange(function () { draw(); render(); });
|
|
253
|
+
name.addEventListener("input", function () { save.disabled = !(chosen && name.value.trim()); });
|
|
254
|
+
save.addEventListener("click", function () {
|
|
255
|
+
save.disabled = true; save.textContent = "Saving…";
|
|
256
|
+
Cliptude.callTool("save_designed_voice", { provider: prov, preview_id: chosen.preview_id, voice_name: name.value.trim() })
|
|
257
|
+
.then(function (res) {
|
|
258
|
+
var err = UI.errorText(res);
|
|
259
|
+
if (err) { save.disabled = false; save.textContent = "Keep this voice"; UI.toast(err); return; }
|
|
260
|
+
var v = res.voice || {};
|
|
261
|
+
addMine({ voice_id: v.voice_id, name: v.voice_name || name.value.trim(), provider: v.voice_provider || prov,
|
|
262
|
+
kind: "design", status: v.status || "ready", preview_url: v.preview_audio_url || chosen.audio_url, description: v.description || "" });
|
|
263
|
+
document.getElementById("design-panel").hidden = true;
|
|
264
|
+
UI.toast("Saved to your voices.");
|
|
265
|
+
}).catch(function () { save.disabled = false; save.textContent = "Keep this voice"; UI.toast("The voice could not be saved."); });
|
|
266
|
+
});
|
|
267
|
+
draw();
|
|
268
|
+
out.appendChild(list);
|
|
269
|
+
out.appendChild(h("div", { class: "toolbar" }, [h("label", { for: "design-name" }, ["Name", name]), save]));
|
|
270
|
+
Cliptude.reportSize();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/* ---- Clone a voice: recording (upload or record here) + consent ---- */
|
|
274
|
+
var recording = null;
|
|
275
|
+
function openClone() {
|
|
276
|
+
var panel = document.getElementById("clone-panel");
|
|
277
|
+
if (!panel.hidden) { panel.hidden = true; document.getElementById("open-clone").setAttribute("aria-expanded", "false"); return; }
|
|
278
|
+
document.getElementById("design-panel").hidden = true;
|
|
279
|
+
document.getElementById("open-design").setAttribute("aria-expanded", "false");
|
|
280
|
+
document.getElementById("open-clone").setAttribute("aria-expanded", "true");
|
|
281
|
+
panel.hidden = false;
|
|
282
|
+
var prov = providerSelect("clone-provider", CLONE_PROVIDERS, provider);
|
|
283
|
+
var name = h("input", { type: "text", id: "clone-name", maxlength: "100", placeholder: "My voice" });
|
|
284
|
+
var file = h("input", { type: "file", id: "clone-file", accept: "audio/mpeg,audio/mp4,audio/x-m4a,audio/wav,.mp3,.m4a,.wav" });
|
|
285
|
+
var consent = h("input", { type: "checkbox", id: "clone-consent" });
|
|
286
|
+
var create = h("button", { type: "button", class: "primary", disabled: true }, ["Create clone"]);
|
|
287
|
+
var recBtn = h("button", { type: "button" }, ["Record here"]);
|
|
288
|
+
var recState = h("span", { class: "rec", "aria-live": "polite" });
|
|
289
|
+
var status = h("span", { class: "sub", role: "status" });
|
|
290
|
+
var audio = null; // {name, base64}
|
|
291
|
+
function update() { create.disabled = !(name.value.trim() && (audio || file.files.length) && consent.checked); }
|
|
292
|
+
[name, file, consent].forEach(function (el) { el.addEventListener("input", update); el.addEventListener("change", update); });
|
|
293
|
+
file.addEventListener("change", function () { audio = null; recState.textContent = ""; update(); });
|
|
294
|
+
recBtn.addEventListener("click", function () {
|
|
295
|
+
if (recording) { recording.stop(); return; }
|
|
296
|
+
Recorder.start(function (seconds) { recState.textContent = "● " + seconds + " s"; }).then(function (rec) {
|
|
297
|
+
recording = rec; recBtn.textContent = "Stop";
|
|
298
|
+
rec.done.then(function (wav) {
|
|
299
|
+
recording = null; recBtn.textContent = "Record again";
|
|
300
|
+
audio = wav; file.value = "";
|
|
301
|
+
recState.textContent = "Recorded " + wav.seconds + " s" + (wav.seconds < 30 ? " (use at least 30 s)" : "");
|
|
302
|
+
update();
|
|
303
|
+
});
|
|
304
|
+
}).catch(function () {
|
|
305
|
+
recBtn.disabled = true;
|
|
306
|
+
recState.textContent = "Recording is not allowed here; upload a file instead.";
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
var termsLink = h("button", { type: "button", class: "linkish", onclick: function () { Cliptude.openLink("https://cliptude.com/terms/"); } }, ["Terms of Service"]);
|
|
310
|
+
UI.clear(panel).appendChild(h("h2", {}, ["Clone a voice"]));
|
|
311
|
+
panel.appendChild(h("span", { class: "sub" }, ["Use 30 seconds to 3 minutes of clear speech with no music or background noise (MP3, M4A or WAV, up to 10 MB). Clones are private to your account. Paid plans."]));
|
|
312
|
+
panel.appendChild(h("div", { class: "toolbar" }, [h("label", {}, ["Provider", prov]), h("label", { for: "clone-name" }, ["Clone name", name])]));
|
|
313
|
+
panel.appendChild(h("div", { class: "toolbar" }, [h("label", { for: "clone-file" }, ["Recording", file]),
|
|
314
|
+
window.MediaRecorder && navigator.mediaDevices ? recBtn : null, recState]));
|
|
315
|
+
panel.appendChild(h("label", { class: "consent", for: "clone-consent" }, [consent,
|
|
316
|
+
h("span", {}, [CONSENT.replace("Terms of Service.", ""), termsLink, "."])]));
|
|
317
|
+
panel.appendChild(h("div", { class: "toolbar" }, [create, status]));
|
|
318
|
+
create.addEventListener("click", function () {
|
|
319
|
+
create.disabled = true; create.textContent = "Creating…"; status.textContent = "Uploading and cloning. This can take a minute.";
|
|
320
|
+
var ready = audio ? Promise.resolve(audio) : readFile(file.files[0]);
|
|
321
|
+
ready.then(function (a) {
|
|
322
|
+
return Cliptude.callTool("clone_voice", { provider: prov.value, voice_name: name.value.trim(), consent: true,
|
|
323
|
+
audio_base64: a.base64, audio_file_name: a.name });
|
|
324
|
+
}).then(function (res) {
|
|
325
|
+
var err = UI.errorText(res);
|
|
326
|
+
create.textContent = "Create clone";
|
|
327
|
+
if (err) { status.textContent = err; update(); return; }
|
|
328
|
+
var c = res.clone || {};
|
|
329
|
+
addMine({ voice_id: c.voice_id, name: c.voice_name || name.value.trim(), provider: c.voice_provider || prov.value,
|
|
330
|
+
kind: "clone", status: c.status || "ready", preview_url: c.preview_audio_url || "" });
|
|
331
|
+
document.getElementById("clone-panel").hidden = true;
|
|
332
|
+
UI.toast("Clone saved to your voices.");
|
|
333
|
+
}).catch(function (e) { create.textContent = "Create clone"; status.textContent = (e && e.message) || "The clone could not be made."; update(); });
|
|
334
|
+
});
|
|
335
|
+
Cliptude.reportSize();
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function readFile(f) {
|
|
339
|
+
return new Promise(function (resolve, reject) {
|
|
340
|
+
if (!f) { reject(new Error("Pick a recording.")); return; }
|
|
341
|
+
if (f.size > 10 * 1024 * 1024) { reject(new Error("The recording is over 10 MB.")); return; }
|
|
342
|
+
var reader = new FileReader();
|
|
343
|
+
reader.onload = function () { resolve({ name: f.name, base64: String(reader.result).split(",")[1] }); };
|
|
344
|
+
reader.onerror = function () { reject(new Error("The file could not be read.")); };
|
|
345
|
+
reader.readAsDataURL(f);
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/* Records the microphone and hands back 16-bit mono WAV (every provider takes WAV). */
|
|
350
|
+
var Recorder = {
|
|
351
|
+
start: function (onTick) {
|
|
352
|
+
return navigator.mediaDevices.getUserMedia({ audio: true }).then(function (stream) {
|
|
353
|
+
var chunks = [];
|
|
354
|
+
var rec = new MediaRecorder(stream);
|
|
355
|
+
var started = Date.now();
|
|
356
|
+
var timer = setInterval(function () { onTick(Math.round((Date.now() - started) / 1000)); }, 500);
|
|
357
|
+
var done = new Promise(function (resolve) {
|
|
358
|
+
rec.ondataavailable = function (e) { if (e.data && e.data.size) chunks.push(e.data); };
|
|
359
|
+
rec.onstop = function () {
|
|
360
|
+
clearInterval(timer);
|
|
361
|
+
stream.getTracks().forEach(function (t) { t.stop(); });
|
|
362
|
+
new Blob(chunks).arrayBuffer().then(toWav).then(resolve);
|
|
363
|
+
};
|
|
364
|
+
});
|
|
365
|
+
rec.start();
|
|
366
|
+
return { stop: function () { rec.stop(); }, done: done };
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
function toWav(buffer) {
|
|
371
|
+
var Ctx = window.AudioContext || window.webkitAudioContext;
|
|
372
|
+
return new Ctx().decodeAudioData(buffer).then(function (decoded) {
|
|
373
|
+
var rate = 22050;
|
|
374
|
+
var length = Math.ceil(decoded.duration * rate);
|
|
375
|
+
var offline = new OfflineAudioContext(1, length, rate);
|
|
376
|
+
var src = offline.createBufferSource(); src.buffer = decoded; src.connect(offline.destination); src.start();
|
|
377
|
+
return offline.startRendering();
|
|
378
|
+
}).then(function (mono) {
|
|
379
|
+
var pcm = mono.getChannelData(0);
|
|
380
|
+
var bytes = new DataView(new ArrayBuffer(44 + pcm.length * 2));
|
|
381
|
+
function str(o, s) { for (var i = 0; i < s.length; i++) bytes.setUint8(o + i, s.charCodeAt(i)); }
|
|
382
|
+
str(0, "RIFF"); bytes.setUint32(4, 36 + pcm.length * 2, true); str(8, "WAVE"); str(12, "fmt ");
|
|
383
|
+
bytes.setUint32(16, 16, true); bytes.setUint16(20, 1, true); bytes.setUint16(22, 1, true);
|
|
384
|
+
bytes.setUint32(24, 22050, true); bytes.setUint32(28, 44100, true); bytes.setUint16(32, 2, true);
|
|
385
|
+
bytes.setUint16(34, 16, true); str(36, "data"); bytes.setUint32(40, pcm.length * 2, true);
|
|
386
|
+
for (var i = 0; i < pcm.length; i++) {
|
|
387
|
+
var s = Math.max(-1, Math.min(1, pcm[i]));
|
|
388
|
+
bytes.setInt16(44 + i * 2, s < 0 ? s * 0x8000 : s * 0x7fff, true);
|
|
389
|
+
}
|
|
390
|
+
var bin = ""; var u8 = new Uint8Array(bytes.buffer);
|
|
391
|
+
for (var j = 0; j < u8.length; j += 0x8000) bin += String.fromCharCode.apply(null, u8.subarray(j, j + 0x8000));
|
|
392
|
+
return { name: "recording.wav", base64: btoa(bin), seconds: Math.round(pcm.length / 22050) };
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
Media.onChange(function () { render(); });
|
|
397
|
+
document.getElementById("filter").addEventListener("input", function () { shown = PAGE; render(); });
|
|
398
|
+
document.getElementById("gender").addEventListener("change", function () { shown = PAGE; render(); });
|
|
399
|
+
// Hosts that cannot run Cliptude tools from the widget get the website's own pages instead.
|
|
400
|
+
function orWebsite(fn, url) {
|
|
401
|
+
return function () {
|
|
402
|
+
if (Cliptude.canCallTools()) { fn(); return; }
|
|
403
|
+
Cliptude.openLink(url).then(function () { UI.toast("Opened on cliptude.com. Ask Claude to list voices again after."); })
|
|
404
|
+
.catch(function () { UI.toast("Open " + url + " to do this."); });
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
document.getElementById("open-design").addEventListener("click", orWebsite(openDesign, "https://cliptude.com/videos/voices/design/"));
|
|
408
|
+
document.getElementById("open-clone").addEventListener("click", orWebsite(openClone, "https://cliptude.com/videos/voices/clone/"));
|
|
409
|
+
document.getElementById("use").addEventListener("click", function () {
|
|
410
|
+
if (!selected) return;
|
|
411
|
+
var prov = selected.provider || provider || "elevenlabs";
|
|
412
|
+
UI.choose(
|
|
413
|
+
"Use the voice “" + shortName(selected) + "” (voice_id " + selected.voice_id + ", provider " + prov +
|
|
414
|
+
", voice_name " + shortName(selected) + ").",
|
|
415
|
+
{ voice_id: selected.voice_id, voice_name: shortName(selected), voice_provider: prov }
|
|
416
|
+
);
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
var inputProvider = "";
|
|
420
|
+
Cliptude.connect({
|
|
421
|
+
name: "cliptude-voice-picker",
|
|
422
|
+
onInput: function (args) { inputProvider = (args && args.provider) || ""; language = (args && args.language) || ""; },
|
|
423
|
+
onResult: function (data) {
|
|
424
|
+
var err = UI.errorText(data);
|
|
425
|
+
if (err) { UI.status(content, err, "error"); return; }
|
|
426
|
+
provider = data.provider || inputProvider || "elevenlabs";
|
|
427
|
+
voices = (data.voices || []).filter(function (v) { return v && v.voice_id; });
|
|
428
|
+
mine = (data.my_voices || []).filter(function (v) { return v && v.voice_id; });
|
|
429
|
+
render();
|
|
430
|
+
},
|
|
431
|
+
onCancelled: function () { UI.status(content, "The voice list was cancelled."); }
|
|
432
|
+
}).catch(function () { UI.status(content, "This view could not connect to the chat.", "error"); });
|
|
433
|
+
})();
|
|
434
|
+
</script>
|
|
435
|
+
</body>
|
|
436
|
+
</html>
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
@@ -4,16 +4,16 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cliptude-mcp"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.30"
|
|
8
8
|
description = "Cliptude jobs CLI and MCP server (thin client of /api/v1)."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
license = "MIT"
|
|
12
12
|
authors = [{ name = "Cliptude" }]
|
|
13
13
|
dependencies = [
|
|
14
|
-
"httpx>=0.28.1",
|
|
15
|
-
"mcp>=2.
|
|
16
|
-
"pydantic>=2.
|
|
14
|
+
"httpx>=0.28.1,<0.29",
|
|
15
|
+
"mcp>=2.3.0,<3",
|
|
16
|
+
"pydantic>=2.13.4,<3",
|
|
17
17
|
]
|
|
18
18
|
[project.scripts]
|
|
19
19
|
cliptude = "cliptude_mcp.cli:main"
|