@cliptude/cli 0.1.21 → 0.1.32
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 +444 -0
- package/cliptude_mcp/cli.py +166 -23
- package/cliptude_mcp/client.py +297 -66
- package/cliptude_mcp/creation.py +207 -0
- package/cliptude_mcp/credentials.py +31 -5
- package/cliptude_mcp/picks.py +226 -0
- package/cliptude_mcp/server.py +323 -77
- package/cliptude_mcp/widgets/avatars.html +287 -0
- package/cliptude_mcp/widgets/base.css +173 -0
- package/cliptude_mcp/widgets/bridge.js +378 -0
- package/cliptude_mcp/widgets/characters.html +108 -0
- package/cliptude_mcp/widgets/choices.html +230 -0
- package/cliptude_mcp/widgets/job.html +32 -0
- package/cliptude_mcp/widgets/player.html +126 -0
- package/cliptude_mcp/widgets/publish-kit.html +41 -0
- package/cliptude_mcp/widgets/review.html +31 -0
- package/cliptude_mcp/widgets/template.html +152 -0
- package/cliptude_mcp/widgets/templates.html +93 -0
- package/cliptude_mcp/widgets/views.js +547 -0
- package/cliptude_mcp/widgets/voices.html +436 -0
- package/package.json +1 -1
- package/pyproject.toml +4 -4
|
@@ -0,0 +1,230 @@
|
|
|
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 setting</title>
|
|
7
|
+
<style>
|
|
8
|
+
/*@BASE_CSS@*/
|
|
9
|
+
.row { cursor: pointer; }
|
|
10
|
+
.desc-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--color-text-secondary); font-size: var(--font-text-xs-size); }
|
|
11
|
+
.caption-stage { aspect-ratio: 16 / 9; display: flex; align-items: flex-end; justify-content: center; padding: 12px;
|
|
12
|
+
background: linear-gradient(160deg, #3b4a5c, #10161f); }
|
|
13
|
+
.caption-stage span { font-size: 18px; text-align: center; line-height: 1.2; }
|
|
14
|
+
.theme-stage { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700;
|
|
15
|
+
background: var(--color-background-tertiary); color: var(--color-text-tertiary); }
|
|
16
|
+
.video-toggle { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; border: 0; }
|
|
17
|
+
.play-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
|
|
18
|
+
.play-overlay span { background: rgba(0,0,0,.55); color: #fff; border-radius: 99px; padding: 6px 12px; font-size: 12px; }
|
|
19
|
+
.current { border-style: dashed; }
|
|
20
|
+
</style>
|
|
21
|
+
</head>
|
|
22
|
+
<body>
|
|
23
|
+
<main class="app" aria-labelledby="title">
|
|
24
|
+
<div class="head">
|
|
25
|
+
<h1 id="title">Choose a setting</h1>
|
|
26
|
+
<span class="sub" id="count"></span>
|
|
27
|
+
</div>
|
|
28
|
+
<p class="sub" id="description" hidden></p>
|
|
29
|
+
<div class="toolbar" id="toolbar" hidden>
|
|
30
|
+
<label class="sr-only" for="filter">Filter</label>
|
|
31
|
+
<input type="search" id="filter" placeholder="Filter" autocomplete="off">
|
|
32
|
+
</div>
|
|
33
|
+
<div id="content"><div class="status" role="status">Loading choices…</div></div>
|
|
34
|
+
<div class="selection" id="selection" hidden>
|
|
35
|
+
<span class="what" id="selected-text"></span>
|
|
36
|
+
<button class="primary" id="use" type="button">Use this</button>
|
|
37
|
+
</div>
|
|
38
|
+
</main>
|
|
39
|
+
<div id="toast" role="status" aria-live="polite"></div>
|
|
40
|
+
<script>
|
|
41
|
+
/*@BRIDGE_JS@*/
|
|
42
|
+
(function () {
|
|
43
|
+
"use strict";
|
|
44
|
+
var h = UI.h;
|
|
45
|
+
var PLAY = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg>';
|
|
46
|
+
var PAUSE = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 5h4v14H6zm8 0h4v14h-4z"/></svg>';
|
|
47
|
+
var NOUN = { music: "music", image: "background", style: "style", caption: "caption style", theme: "theme", text: "option" };
|
|
48
|
+
var info = { field: "", kind: "text", choices: [] };
|
|
49
|
+
var selected = null;
|
|
50
|
+
var muted = true;
|
|
51
|
+
var content = document.getElementById("content");
|
|
52
|
+
|
|
53
|
+
function noun() { return NOUN[info.kind] || "option"; }
|
|
54
|
+
function isCurrent(c) { return info.current !== undefined && info.current !== null && String(info.current) === String(c.value); }
|
|
55
|
+
|
|
56
|
+
function visible() {
|
|
57
|
+
var q = document.getElementById("filter").value.trim().toLowerCase();
|
|
58
|
+
return (info.choices || []).filter(function (c) {
|
|
59
|
+
return !q || [c.value, c.label, c.hint, c.blurb, c.group].join(" ").toLowerCase().indexOf(q) >= 0;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function select(c) {
|
|
64
|
+
selected = c;
|
|
65
|
+
render();
|
|
66
|
+
document.getElementById("selection").hidden = false;
|
|
67
|
+
document.getElementById("use").textContent = c.none ? "Use no music" : "Use this " + noun();
|
|
68
|
+
document.getElementById("selected-text").textContent = c.none ? "No background music"
|
|
69
|
+
: "“" + (c.label || c.value) + "” · " + info.field + "=" + c.value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function messageFor(c) {
|
|
73
|
+
if (c.none) return "Use no background music (background_music_mode=none).";
|
|
74
|
+
var label = c.label && c.label !== c.value ? " (“" + c.label + "”)" : "";
|
|
75
|
+
var where = info.usage ? " " + info.usage : "";
|
|
76
|
+
return "Use " + info.field + "=" + c.value + label + "." + where;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function selectable(el, c) {
|
|
80
|
+
el.setAttribute("aria-pressed", String(!!selected && selected.value === c.value && !!selected.none === !!c.none));
|
|
81
|
+
el.addEventListener("click", function () { select(c); });
|
|
82
|
+
if (el.tagName !== "BUTTON") {
|
|
83
|
+
el.tabIndex = 0;
|
|
84
|
+
el.addEventListener("keydown", function (e) { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); select(c); } });
|
|
85
|
+
}
|
|
86
|
+
if (isCurrent(c)) el.classList.add("current");
|
|
87
|
+
return el;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* ---- music: list with play/pause ---- */
|
|
91
|
+
function musicRow(c) {
|
|
92
|
+
var key = "m:" + c.value;
|
|
93
|
+
var playing = Media.playing() === key;
|
|
94
|
+
var play = null;
|
|
95
|
+
if (c.preview_url) {
|
|
96
|
+
play = h("button", { type: "button", class: "icon", "aria-pressed": String(playing),
|
|
97
|
+
"aria-label": (playing ? "Pause " : "Play ") + (c.label || c.value),
|
|
98
|
+
onclick: function (e) { e.stopPropagation(); Media.toggleAudio(key, c.preview_url); } }, []);
|
|
99
|
+
play.innerHTML = playing ? PAUSE : PLAY;
|
|
100
|
+
}
|
|
101
|
+
var chips = [];
|
|
102
|
+
if (c.group) chips.push(h("span", { class: "chip" }, [c.group === "theme" ? "Documentary bed" : c.group === "library" ? "Library" : c.group]));
|
|
103
|
+
if (isCurrent(c)) chips.push(h("span", { class: "chip info" }, ["Default"]));
|
|
104
|
+
return selectable(h("div", { class: "row", role: "listitem" }, [
|
|
105
|
+
play,
|
|
106
|
+
h("div", { class: "main" }, [
|
|
107
|
+
h("span", { class: "name" }, [c.none ? "No music" : (c.label || c.value)]),
|
|
108
|
+
c.hint ? h("span", { class: "desc" }, [c.hint]) : null,
|
|
109
|
+
c.none ? h("span", { class: "desc" }, ["Narration only, no background track."]) :
|
|
110
|
+
(c.label && c.label !== c.value ? h("span", { class: "muted" }, [c.value]) : null),
|
|
111
|
+
chips.length ? h("span", { class: "chips" }, chips) : null
|
|
112
|
+
])
|
|
113
|
+
]), c);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* ---- style video previews: poster, click to play, one at a time ---- */
|
|
117
|
+
function videoThumb(c) {
|
|
118
|
+
var box = h("span", { class: "thumb r16x9" });
|
|
119
|
+
var key = "v:" + c.value;
|
|
120
|
+
var video = null;
|
|
121
|
+
if (c.poster_url) box.appendChild(h("img", { src: c.poster_url, alt: "", loading: "lazy" }));
|
|
122
|
+
var overlay = h("span", { class: "play-overlay" }, [h("span", {}, ["▶ Preview"])]);
|
|
123
|
+
box.appendChild(overlay);
|
|
124
|
+
var sound = h("button", { type: "button", class: "icon video-toggle", "aria-label": muted ? "Unmute preview" : "Mute preview",
|
|
125
|
+
hidden: true, onclick: function (e) {
|
|
126
|
+
e.stopPropagation();
|
|
127
|
+
muted = !muted;
|
|
128
|
+
if (video) video.muted = muted;
|
|
129
|
+
sound.textContent = muted ? "🔇" : "🔊";
|
|
130
|
+
sound.setAttribute("aria-label", muted ? "Unmute preview" : "Mute preview");
|
|
131
|
+
} }, [muted ? "🔇" : "🔊"]);
|
|
132
|
+
box.appendChild(sound);
|
|
133
|
+
function start() {
|
|
134
|
+
if (!video) {
|
|
135
|
+
video = h("video", { src: c.preview_video_url, poster: c.poster_url || null, playsinline: true, loop: true, preload: "none" });
|
|
136
|
+
video.muted = muted;
|
|
137
|
+
video.addEventListener("error", function () { overlay.hidden = false; UI.toast("That preview could not be played."); });
|
|
138
|
+
box.insertBefore(video, box.firstChild);
|
|
139
|
+
var still = box.querySelector("img"); if (still) still.remove();
|
|
140
|
+
}
|
|
141
|
+
Media.claimVideo(key, video);
|
|
142
|
+
overlay.hidden = true;
|
|
143
|
+
sound.hidden = false;
|
|
144
|
+
var p = video.play(); if (p && p.catch) p.catch(function () { overlay.hidden = false; });
|
|
145
|
+
}
|
|
146
|
+
function pause() { if (video) { video.pause(); Media.release(video); } overlay.hidden = false; }
|
|
147
|
+
box.addEventListener("mouseenter", function () { if (Cliptude.state.hostContext.deviceCapabilities && Cliptude.state.hostContext.deviceCapabilities.hover === false) return; start(); });
|
|
148
|
+
box.addEventListener("mouseleave", pause);
|
|
149
|
+
box.addEventListener("click", function () { if (video && !video.paused) pause(); else start(); });
|
|
150
|
+
return box;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function captionStage(c) {
|
|
154
|
+
var css = c.caption_css || {};
|
|
155
|
+
return h("span", { class: "caption-stage", "aria-hidden": "true" }, [h("span", { style: {
|
|
156
|
+
fontFamily: css.font_family || "inherit", color: css.color || "#fff", textShadow: css.text_shadow || "none",
|
|
157
|
+
background: css.background || "transparent", padding: css.padding || "0", fontWeight: css.font_weight || "bold",
|
|
158
|
+
fontStyle: css.font_style || "normal"
|
|
159
|
+
} }, [c.sample_text || "YOUR CAPTION"])]);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function card(c) {
|
|
163
|
+
var media = null;
|
|
164
|
+
if (c.preview_video_url) media = videoThumb(c);
|
|
165
|
+
else if (c.image_url) { media = UI.img(c.image_url, "", ""); media.classList.add("r16x9"); }
|
|
166
|
+
else if (c.caption_css) media = captionStage(c);
|
|
167
|
+
else if (c.swatches && c.swatches.length) {
|
|
168
|
+
media = h("span", { class: "theme-stage", "aria-hidden": "true", style: { background: c.swatches[2] || c.swatches[0] } },
|
|
169
|
+
[h("span", { style: { color: c.swatches[0], borderBottom: "4px solid " + (c.swatches[1] || c.swatches[0]) } }, [c.label || c.value])]);
|
|
170
|
+
}
|
|
171
|
+
var chips = [];
|
|
172
|
+
if (c.group === "upload") chips.push(h("span", { class: "chip info" }, ["Your upload"]));
|
|
173
|
+
if (isCurrent(c)) chips.push(h("span", { class: "chip info" }, ["Default"]));
|
|
174
|
+
if (c.hint) chips.push(h("span", { class: "chip" }, [c.hint]));
|
|
175
|
+
return selectable(h("div", { class: "card", role: "listitem", "aria-label": c.label || c.value }, [
|
|
176
|
+
media,
|
|
177
|
+
h("span", { class: "body" }, [
|
|
178
|
+
h("span", { class: "name" }, [c.label || c.value]),
|
|
179
|
+
c.swatches && c.swatches.length ? h("span", { class: "swatches", "aria-label": "Colours " + c.swatches.join(", ") },
|
|
180
|
+
c.swatches.map(function (col) { return h("span", { class: "swatch", title: col, style: { background: col } }); })) : null,
|
|
181
|
+
c.blurb ? h("span", { class: "desc-clamp" }, [c.blurb]) : null,
|
|
182
|
+
chips.length ? h("span", { class: "chips" }, chips) : null,
|
|
183
|
+
c.label && c.label !== c.value ? h("span", { class: "muted" }, [c.value]) : null
|
|
184
|
+
])
|
|
185
|
+
]), c);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function render() {
|
|
189
|
+
var rows = visible();
|
|
190
|
+
document.getElementById("count").textContent = (info.choices || []).length + " choices";
|
|
191
|
+
if (!(info.choices || []).length) { UI.status(content, "No choices for this setting."); return; }
|
|
192
|
+
if (!rows.length) { UI.status(content, "Nothing matches that filter."); return; }
|
|
193
|
+
var box;
|
|
194
|
+
if (info.kind === "music") {
|
|
195
|
+
box = h("div", { class: "list", role: "list" });
|
|
196
|
+
if (!document.getElementById("filter").value) box.appendChild(musicRow({ value: "", none: true }));
|
|
197
|
+
rows.forEach(function (c) { box.appendChild(musicRow(c)); });
|
|
198
|
+
} else {
|
|
199
|
+
box = h("div", { class: info.kind === "image" ? "grid" : "grid wide", role: "list" });
|
|
200
|
+
rows.forEach(function (c) { box.appendChild(card(c)); });
|
|
201
|
+
}
|
|
202
|
+
UI.clear(content).appendChild(box);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
Media.onChange(function (key) { if (String(key || "").indexOf("m:") === 0) render(); });
|
|
206
|
+
document.getElementById("filter").addEventListener("input", render);
|
|
207
|
+
document.getElementById("use").addEventListener("click", function () {
|
|
208
|
+
if (!selected) return;
|
|
209
|
+
var structured = {}; structured[info.field] = selected.none ? null : selected.value;
|
|
210
|
+
if (selected.none) structured = { background_music_mode: "none" };
|
|
211
|
+
UI.choose(messageFor(selected), structured);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
Cliptude.connect({
|
|
215
|
+
name: "cliptude-choice-picker",
|
|
216
|
+
onResult: function (data) {
|
|
217
|
+
var err = UI.errorText(data);
|
|
218
|
+
if (err) { UI.status(content, err, "error"); return; }
|
|
219
|
+
info = data;
|
|
220
|
+
document.getElementById("title").textContent = data.label || ("Choose " + data.field);
|
|
221
|
+
if (data.description) { var d = document.getElementById("description"); d.textContent = data.description; d.hidden = false; }
|
|
222
|
+
document.getElementById("toolbar").hidden = (data.choices || []).length < 8;
|
|
223
|
+
render();
|
|
224
|
+
},
|
|
225
|
+
onCancelled: function () { UI.status(content, "Cancelled."); }
|
|
226
|
+
}).catch(function () { UI.status(content, "This view could not connect to the chat.", "error"); });
|
|
227
|
+
})();
|
|
228
|
+
</script>
|
|
229
|
+
</body>
|
|
230
|
+
</html>
|
|
@@ -0,0 +1,32 @@
|
|
|
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>Job</title>
|
|
7
|
+
<style>
|
|
8
|
+
/*@BASE_CSS@*/
|
|
9
|
+
</style>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<main class="app" id="content" aria-live="polite"></main>
|
|
13
|
+
<div id="toast" role="status" aria-live="polite"></div>
|
|
14
|
+
<script>
|
|
15
|
+
/*@BRIDGE_JS@*/
|
|
16
|
+
/*@VIEWS_JS@*/
|
|
17
|
+
(function () {
|
|
18
|
+
"use strict";
|
|
19
|
+
// get_job, get_product_video_status and get_narration. The agent polls these often, so the card draws once,
|
|
20
|
+
// straight from the data, with no loading animation: a script to approve, a progress card, or (when the video
|
|
21
|
+
// is ready) the progress card with the publish kit under it.
|
|
22
|
+
var content = document.getElementById("content");
|
|
23
|
+
var ctx = { mode: "job", input: function () { return Cliptude.state.toolInput; } };
|
|
24
|
+
Cliptude.connect({
|
|
25
|
+
name: "cliptude-job",
|
|
26
|
+
onResult: function (data) { Views.mount(content, data || {}, ctx); },
|
|
27
|
+
onCancelled: function () { UI.status(content, "Cancelled."); }
|
|
28
|
+
}).catch(function () { UI.status(content, "This view could not connect to the chat.", "error"); });
|
|
29
|
+
})();
|
|
30
|
+
</script>
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
|
@@ -0,0 +1,126 @@
|
|
|
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>Cliptude video</title>
|
|
7
|
+
<style>
|
|
8
|
+
/*@BASE_CSS@*/
|
|
9
|
+
.player { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--border-radius-md); display: block; }
|
|
10
|
+
.meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
|
|
11
|
+
.progress { height: 6px; border-radius: 99px; background: var(--color-background-tertiary); overflow: hidden; }
|
|
12
|
+
.progress > span { display: block; height: 100%; background: var(--accent); }
|
|
13
|
+
.pending { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--border-radius-md); background: var(--color-background-secondary); }
|
|
14
|
+
</style>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<main class="app" aria-labelledby="title">
|
|
18
|
+
<div class="head">
|
|
19
|
+
<h1 id="title">Your video</h1>
|
|
20
|
+
<span class="sub" id="facts"></span>
|
|
21
|
+
</div>
|
|
22
|
+
<div id="content"><div class="status" role="status">Loading the video…</div></div>
|
|
23
|
+
</main>
|
|
24
|
+
<div id="toast" role="status" aria-live="polite"></div>
|
|
25
|
+
<script>
|
|
26
|
+
/*@BRIDGE_JS@*/
|
|
27
|
+
(function () {
|
|
28
|
+
"use strict";
|
|
29
|
+
var h = UI.h;
|
|
30
|
+
var content = document.getElementById("content");
|
|
31
|
+
|
|
32
|
+
/** One shape for get_render, get_product_video_status and show_video results. */
|
|
33
|
+
function normalize(data) {
|
|
34
|
+
if (!data) return null;
|
|
35
|
+
if (data.render && typeof data.render === "object") {
|
|
36
|
+
var r = data.render;
|
|
37
|
+
return { title: r.title || data.title || "Edited video", url: r.output_url || "", status: r.status || "",
|
|
38
|
+
progress: r.progress, step: r.current_step || "", error: r.error_message || "", expires: r.output_url_expires_in_s,
|
|
39
|
+
kind: "render", id: r.id };
|
|
40
|
+
}
|
|
41
|
+
if (data.stage !== undefined) {
|
|
42
|
+
var out = data.output || {};
|
|
43
|
+
return { title: (data.product && data.product.title) ? "Video for " + data.product.title : (data.title || "Product video"),
|
|
44
|
+
url: out.url || "", status: data.stage, progress: data.progress, step: data.current_step || "",
|
|
45
|
+
error: data.error || "", duration: data.duration, editorUrl: data.editor_url || "", kind: "product", id: data.job_id };
|
|
46
|
+
}
|
|
47
|
+
return { title: data.title || "Your video", url: data.url || (data.output && data.output.url) || "",
|
|
48
|
+
status: data.status || "", progress: data.progress, step: data.current_step || "", error: data.error || "",
|
|
49
|
+
duration: data.duration_s || data.duration, editorUrl: data.editor_url || "", kind: "job", id: data.job_id };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function fmtDuration(s) {
|
|
53
|
+
s = Number(s);
|
|
54
|
+
if (!s || !isFinite(s)) return "";
|
|
55
|
+
s = Math.round(s);
|
|
56
|
+
var m = Math.floor(s / 60), sec = s % 60;
|
|
57
|
+
return m + ":" + (sec < 10 ? "0" : "") + sec;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function setFacts(parts) {
|
|
61
|
+
document.getElementById("facts").textContent = parts.filter(Boolean).join(" · ");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function linkButton(label, url, primary) {
|
|
65
|
+
return h("button", { type: "button", class: primary ? "primary" : "", onclick: function () {
|
|
66
|
+
Cliptude.openLink(url).catch(function () { UI.toast("The link could not be opened here."); });
|
|
67
|
+
} }, [label]);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function renderPending(v) {
|
|
71
|
+
var pct = typeof v.progress === "number" ? Math.max(0, Math.min(100, Math.round(v.progress))) : null;
|
|
72
|
+
var failed = /fail|error|cancel/i.test(v.status || "") || (!!v.error && !v.url);
|
|
73
|
+
var box = h("div", { class: "pending", role: "status" }, [
|
|
74
|
+
h("strong", {}, [failed ? "This video did not render." : "Not rendered yet"]),
|
|
75
|
+
h("span", { class: "sub" }, [failed ? (v.error || "The render failed.")
|
|
76
|
+
: (v.step || (v.status ? "Status: " + v.status.replace(/_/g, " ") : "Still working on it.")) +
|
|
77
|
+
". Ask Claude to check again in a minute."]),
|
|
78
|
+
pct !== null && !failed ? h("div", { class: "progress", role: "progressbar", "aria-valuemin": "0", "aria-valuemax": "100",
|
|
79
|
+
"aria-valuenow": String(pct), "aria-label": "Render progress" }, [h("span", { style: { width: pct + "%" } })]) : null,
|
|
80
|
+
v.editorUrl ? h("div", { class: "toolbar" }, [linkButton("Open in the editor", v.editorUrl)]) : null
|
|
81
|
+
]);
|
|
82
|
+
UI.clear(content).appendChild(box);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function renderVideo(v) {
|
|
86
|
+
var video = h("video", { class: "player", controls: true, preload: "metadata", playsinline: true, src: v.url,
|
|
87
|
+
"aria-label": v.title });
|
|
88
|
+
var durationText = fmtDuration(v.duration);
|
|
89
|
+
video.addEventListener("loadedmetadata", function () {
|
|
90
|
+
if (!durationText && video.duration) setFacts([fmtDuration(video.duration), "MP4"]);
|
|
91
|
+
Cliptude.reportSize();
|
|
92
|
+
});
|
|
93
|
+
video.addEventListener("play", function () { Media.claimVideo("player", video); });
|
|
94
|
+
video.addEventListener("error", function () {
|
|
95
|
+
UI.toast("The video could not play here. Use Open MP4.");
|
|
96
|
+
});
|
|
97
|
+
var actions = h("div", { class: "toolbar" }, [
|
|
98
|
+
linkButton("Open MP4", v.url, true),
|
|
99
|
+
v.editorUrl ? linkButton("Open in the editor", v.editorUrl) : null
|
|
100
|
+
]);
|
|
101
|
+
UI.clear(content).appendChild(h("div", { class: "list" }, [
|
|
102
|
+
video,
|
|
103
|
+
h("div", { class: "meta" }, [
|
|
104
|
+
actions,
|
|
105
|
+
v.expires ? h("span", { class: "muted" }, ["The link expires in " + Math.round(v.expires / 86400) +
|
|
106
|
+
" days; ask Claude for a fresh one any time. The MP4 stays in your account."]) : null
|
|
107
|
+
])
|
|
108
|
+
]));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
Cliptude.connect({
|
|
112
|
+
name: "cliptude-video-player",
|
|
113
|
+
onResult: function (data) {
|
|
114
|
+
var err = UI.errorText(data);
|
|
115
|
+
if (err) { UI.status(content, err, "error"); return; }
|
|
116
|
+
var v = normalize(data);
|
|
117
|
+
document.getElementById("title").textContent = v.title;
|
|
118
|
+
setFacts([fmtDuration(v.duration), v.url ? "MP4" : (v.status || "").replace(/_/g, " ")]);
|
|
119
|
+
if (v.url) renderVideo(v); else renderPending(v);
|
|
120
|
+
},
|
|
121
|
+
onCancelled: function () { UI.status(content, "Cancelled."); }
|
|
122
|
+
}).catch(function () { UI.status(content, "This view could not connect to the chat.", "error"); });
|
|
123
|
+
})();
|
|
124
|
+
</script>
|
|
125
|
+
</body>
|
|
126
|
+
</html>
|
|
@@ -0,0 +1,41 @@
|
|
|
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>Publish kit</title>
|
|
7
|
+
<style>
|
|
8
|
+
/*@BASE_CSS@*/
|
|
9
|
+
</style>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<main class="app" aria-labelledby="title">
|
|
13
|
+
<div class="head">
|
|
14
|
+
<h1 id="title">Publish kit</h1>
|
|
15
|
+
<span class="sub" id="facts"></span>
|
|
16
|
+
</div>
|
|
17
|
+
<div id="content" class="list"><div class="status" role="status">Loading the publish kit…</div></div>
|
|
18
|
+
</main>
|
|
19
|
+
<div id="toast" role="status" aria-live="polite"></div>
|
|
20
|
+
<script>
|
|
21
|
+
/*@BRIDGE_JS@*/
|
|
22
|
+
/*@VIEWS_JS@*/
|
|
23
|
+
(function () {
|
|
24
|
+
"use strict";
|
|
25
|
+
var content = document.getElementById("content");
|
|
26
|
+
Cliptude.connect({
|
|
27
|
+
name: "cliptude-publish-kit",
|
|
28
|
+
onResult: function (data) {
|
|
29
|
+
var err = UI.errorText(data);
|
|
30
|
+
if (err) { UI.status(content, err, "error"); return; }
|
|
31
|
+
// The video stage opens first when there is one: current = kit.video && kit.video.url ? -1 : 0 (views.js).
|
|
32
|
+
var kit = data.project && !data.publish_metadata ? data.project : data;
|
|
33
|
+
document.getElementById("title").textContent = kit.title ? "Publish kit · " + kit.title : "Publish kit";
|
|
34
|
+
Views.publishKit(content, kit);
|
|
35
|
+
},
|
|
36
|
+
onCancelled: function () { UI.status(content, "Cancelled."); }
|
|
37
|
+
}).catch(function () { UI.status(content, "This view could not connect to the chat.", "error"); });
|
|
38
|
+
})();
|
|
39
|
+
</script>
|
|
40
|
+
</body>
|
|
41
|
+
</html>
|
|
@@ -0,0 +1,31 @@
|
|
|
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>Review and confirm</title>
|
|
7
|
+
<style>
|
|
8
|
+
/*@BASE_CSS@*/
|
|
9
|
+
</style>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<main class="app" id="content" aria-live="polite"><div class="status" role="status">Loading the review…</div></main>
|
|
13
|
+
<div id="toast" role="status" aria-live="polite"></div>
|
|
14
|
+
<script>
|
|
15
|
+
/*@BRIDGE_JS@*/
|
|
16
|
+
/*@VIEWS_JS@*/
|
|
17
|
+
(function () {
|
|
18
|
+
"use strict";
|
|
19
|
+
// A 428 review: every setting, warning, acknowledgement and the credits; Confirm resends the same call with
|
|
20
|
+
// its review_token only when the user clicks it. Any other result of these tools shows as a result card.
|
|
21
|
+
var content = document.getElementById("content");
|
|
22
|
+
var ctx = { mode: "review", input: function () { return Cliptude.state.toolInput; } };
|
|
23
|
+
Cliptude.connect({
|
|
24
|
+
name: "cliptude-review",
|
|
25
|
+
onResult: function (data) { Views.mount(content, data || {}, ctx); },
|
|
26
|
+
onCancelled: function () { UI.status(content, "Cancelled."); }
|
|
27
|
+
}).catch(function () { UI.status(content, "This view could not connect to the chat.", "error"); });
|
|
28
|
+
})();
|
|
29
|
+
</script>
|
|
30
|
+
</body>
|
|
31
|
+
</html>
|
|
@@ -0,0 +1,152 @@
|
|
|
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>Template</title>
|
|
7
|
+
<style>
|
|
8
|
+
/*@BASE_CSS@*/
|
|
9
|
+
.hero { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: start; }
|
|
10
|
+
.hero .thumb { aspect-ratio: 16 / 9; border-radius: var(--border-radius-md); }
|
|
11
|
+
.hero .thumb.portrait { aspect-ratio: 1 / 1; }
|
|
12
|
+
.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
|
|
13
|
+
.part { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--border-radius-md);
|
|
14
|
+
background: var(--color-background-secondary); border: 1px solid var(--color-border-secondary); min-width: 0; }
|
|
15
|
+
.part .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
16
|
+
.part .k { font-size: var(--font-text-xs-size); color: var(--color-text-tertiary); text-transform: uppercase; letter-spacing: .04em; }
|
|
17
|
+
.part .v { font-weight: 600; font-size: var(--font-text-sm-size); overflow-wrap: anywhere; }
|
|
18
|
+
.part .pic { width: 64px; flex: none; border-radius: var(--border-radius-sm); }
|
|
19
|
+
.part .pic.r16x9 { aspect-ratio: 16 / 9; }
|
|
20
|
+
@media (max-width: 420px) { .hero { grid-template-columns: 1fr; } }
|
|
21
|
+
</style>
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<main class="app" id="content" aria-live="polite"><div class="status" role="status">Loading the template…</div></main>
|
|
25
|
+
<div id="toast" role="status" aria-live="polite"></div>
|
|
26
|
+
<script>
|
|
27
|
+
/*@BRIDGE_JS@*/
|
|
28
|
+
(function () {
|
|
29
|
+
"use strict";
|
|
30
|
+
var h = UI.h;
|
|
31
|
+
var PLAY = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg>';
|
|
32
|
+
var PAUSE = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 5h4v14H6zm8 0h4v14h-4z"/></svg>';
|
|
33
|
+
var content = document.getElementById("content");
|
|
34
|
+
var tpl = null;
|
|
35
|
+
|
|
36
|
+
function playButton(key, url, name) {
|
|
37
|
+
if (!url) return null;
|
|
38
|
+
var playing = Media.playing() === key;
|
|
39
|
+
var b = h("button", { type: "button", class: "icon", "aria-pressed": String(playing),
|
|
40
|
+
"aria-label": (playing ? "Pause " : "Play ") + name, onclick: function () { Media.toggleAudio(key, url); } }, []);
|
|
41
|
+
b.innerHTML = playing ? PAUSE : PLAY;
|
|
42
|
+
return b;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// The product names of the model tiers (videos.models.Video.GenerationModel): the old high-family values
|
|
46
|
+
// (xhigh, v1_video, medium, low) all run as Cinder now.
|
|
47
|
+
var MODEL_NAMES = { pro: "Caldera", high: "Cinder", xhigh: "Cinder", v1_video: "Cinder", medium: "Cinder", low: "Cinder" };
|
|
48
|
+
function modelName(value) {
|
|
49
|
+
return MODEL_NAMES[String(value).toLowerCase()] || String(value);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function part(label, value, extra, pic) {
|
|
53
|
+
return h("div", { class: "part" }, [pic || null, h("span", { class: "main" }, [
|
|
54
|
+
h("span", { class: "k" }, [label]), h("span", { class: "v" }, [value || "—"])
|
|
55
|
+
]), extra || null]);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The look from the server (newer Cliptude), else what the summary itself says. */
|
|
59
|
+
function look(t) {
|
|
60
|
+
if (t.look) return t.look;
|
|
61
|
+
return {
|
|
62
|
+
voice: t.voice_name ? { name: t.voice_name, provider: t.voice_provider, preview_url: "" } : null,
|
|
63
|
+
avatar: t.avatar_name ? { name: t.avatar_name, image_url: t.avatar_preview_url || "" } : null,
|
|
64
|
+
switches: [
|
|
65
|
+
{ key: "animations", label: "Animations", on: !t.disable_animations },
|
|
66
|
+
{ key: "overlays", label: "Text overlays", on: !t.disable_overlays },
|
|
67
|
+
{ key: "sound_effects", label: "Sound effects", on: !t.disable_sound_effects },
|
|
68
|
+
{ key: "transitions", label: "Transitions", on: !t.disable_transitions }
|
|
69
|
+
]
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function render() {
|
|
74
|
+
var t = tpl, l = look(t);
|
|
75
|
+
var presenter = l.avatar || l.character || null;
|
|
76
|
+
var heroPic = presenter && presenter.image_url ? UI.img(presenter.image_url, presenter.name, UI.initials(presenter.name))
|
|
77
|
+
: l.background && l.background.image_url ? UI.img(l.background.image_url, "Background", "")
|
|
78
|
+
: UI.img("", "", UI.initials(t.name));
|
|
79
|
+
if (l.character) heroPic.classList.add("portrait");
|
|
80
|
+
var facts = [t.format_label || t.format, t.duration ? t.duration + " min" : "", t.aspect_ratio || "16:9", t.language || ""]
|
|
81
|
+
.filter(Boolean).map(function (x) { return h("span", { class: "chip" }, [x]); });
|
|
82
|
+
|
|
83
|
+
var parts = [];
|
|
84
|
+
if (l.voice) {
|
|
85
|
+
parts.push(part("Voice", l.voice.name + (l.voice.provider ? " · " + l.voice.provider : ""),
|
|
86
|
+
playButton("voice", l.voice.preview_url, "the voice " + l.voice.name)));
|
|
87
|
+
} else if (t.format !== "talking_head") {
|
|
88
|
+
parts.push(part("Voice", "None set"));
|
|
89
|
+
}
|
|
90
|
+
if (l.avatar) parts.push(part("Presenter", l.avatar.name, null, l.avatar.image_url ? UI.img(l.avatar.image_url, "", "") : null));
|
|
91
|
+
if (t.format === "avatar_video" && !l.avatar) parts.push(part("Presenter", "No avatar chosen"));
|
|
92
|
+
if (l.character) parts.push(part("Character", l.character.name, null, l.character.image_url ? UI.img(l.character.image_url, "", "") : null));
|
|
93
|
+
if (l.music) {
|
|
94
|
+
parts.push(part("Music", l.music.on ? (l.music.label || l.music.file) + (l.music.default ? " (default)" : "") : "No music",
|
|
95
|
+
l.music.on ? playButton("music", l.music.preview_url, "the music") : null));
|
|
96
|
+
}
|
|
97
|
+
if (l.background) {
|
|
98
|
+
var bg = UI.img(l.background.image_url, "", "");
|
|
99
|
+
bg.classList.add("r16x9");
|
|
100
|
+
parts.push(part("Background", l.background.value.indexOf("upload:") === 0 ? "Your upload" : l.background.value, null, bg));
|
|
101
|
+
}
|
|
102
|
+
parts.forEach(function (p) { var pic = p.querySelector(".thumb"); if (pic) pic.classList.add("pic"); });
|
|
103
|
+
|
|
104
|
+
var styleChips = [];
|
|
105
|
+
if (l.style_pack) styleChips.push(h("span", { class: "chip info" }, [
|
|
106
|
+
h("span", { class: "swatches", style: { display: "inline-flex", verticalAlign: "middle", marginRight: "4px" } },
|
|
107
|
+
(l.style_pack.swatches || []).map(function (c) { return h("span", { class: "swatch", style: { background: c, width: "10px", height: "10px" } }); })),
|
|
108
|
+
"Style: " + l.style_pack.label]));
|
|
109
|
+
if (l.visual_theme) styleChips.push(h("span", { class: "chip info" }, ["Theme: " + l.visual_theme.label]));
|
|
110
|
+
if (l.caption_style) styleChips.push(h("span", { class: "chip info" }, ["Captions: " + l.caption_style.label]));
|
|
111
|
+
if (t.generation_model) styleChips.push(h("span", { class: "chip" }, ["Model: " + modelName(t.generation_model)]));
|
|
112
|
+
|
|
113
|
+
var switches = (l.switches || []).map(function (s) {
|
|
114
|
+
return h("span", { class: "chip " + (s.on ? "ok" : "warn off"), "aria-label": s.label + (s.on ? " on" : " off") },
|
|
115
|
+
[(s.on ? "✓ " : "✕ ") + s.label]);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
UI.clear(content);
|
|
119
|
+
content.appendChild(h("div", { class: "hero" }, [heroPic, h("div", { class: "sec" }, [
|
|
120
|
+
h("h1", { style: { margin: 0, fontSize: "var(--font-heading-sm-size)" } }, [t.name || "Template"]),
|
|
121
|
+
h("span", { class: "chips" }, facts),
|
|
122
|
+
styleChips.length ? h("span", { class: "chips" }, styleChips) : null
|
|
123
|
+
])]));
|
|
124
|
+
(t.warnings || []).forEach(function (w) { content.appendChild(h("div", { class: "callout warn", role: "note" }, [String(w)])); });
|
|
125
|
+
if (parts.length) content.appendChild(h("div", { class: "parts" }, parts));
|
|
126
|
+
if (switches.length) content.appendChild(h("section", { class: "sec" }, [h("h2", {}, ["Switches"]), h("div", { class: "chips" }, switches)]));
|
|
127
|
+
content.appendChild(h("div", { class: "selection" }, [
|
|
128
|
+
h("button", { type: "button", onclick: function () {
|
|
129
|
+
UI.choose("I want to change something in the template “" + t.name + "” (template_id " + t.id + "). Ask me what to change.",
|
|
130
|
+
{ template_id: t.id, change: true });
|
|
131
|
+
} }, ["Change something"]),
|
|
132
|
+
h("button", { type: "button", class: "primary", onclick: function () {
|
|
133
|
+
UI.choose("Make a video with the template “" + t.name + "” (template_id " + t.id + ").", { template_id: t.id });
|
|
134
|
+
} }, ["Make a video with this template"])
|
|
135
|
+
]));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
Media.onChange(function () { if (tpl) render(); });
|
|
139
|
+
Cliptude.connect({
|
|
140
|
+
name: "cliptude-template",
|
|
141
|
+
onResult: function (data) {
|
|
142
|
+
var err = UI.errorText(data);
|
|
143
|
+
if (err) { UI.status(content, err, "error"); return; }
|
|
144
|
+
tpl = data.template && !data.id ? data.template : data;
|
|
145
|
+
render();
|
|
146
|
+
},
|
|
147
|
+
onCancelled: function () { UI.status(content, "Cancelled."); }
|
|
148
|
+
}).catch(function () { UI.status(content, "This view could not connect to the chat.", "error"); });
|
|
149
|
+
})();
|
|
150
|
+
</script>
|
|
151
|
+
</body>
|
|
152
|
+
</html>
|