@engenty/wizards-runtime 0.11.1 → 0.11.2
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 +25 -6
- package/apps/runtime/dist/app.js +5 -0
- package/apps/runtime/dist/authoring/guide.js +19 -19
- package/apps/runtime/dist/docs/dev/index.md +1 -0
- package/apps/runtime/dist/docs/dev/licensing.md +60 -0
- package/apps/runtime/dist/docs/dev/meta.json +2 -1
- package/apps/runtime/dist/docs/dev/plugins/runners.md +2 -2
- package/apps/runtime/dist/docs/dev/wizard-format/index.md +4 -4
- package/apps/runtime/dist/docs/dev/wizard-format/meta.json +1 -1
- package/apps/runtime/dist/docs/dev/wizard-format/motion-graphics-steps.md +47 -0
- package/apps/runtime/dist/docs/dev/wizard-format/review-and-result.md +2 -2
- package/apps/runtime/dist/docs/dev/wizard-format/views-and-widgets.md +2 -2
- package/apps/runtime/dist/docs/dev/wizard-format/wizard-file.md +4 -4
- package/apps/runtime/dist/docs/user-guide/steps.md +12 -12
- package/apps/runtime/dist/engine/requirements.js +7 -7
- package/apps/runtime/dist/engine/runner.js +8 -1
- package/apps/runtime/dist/engine/steps.js +3 -3
- package/apps/runtime/dist/files/storage.js +3 -3
- package/apps/runtime/dist/index.js +3 -0
- package/apps/runtime/dist/limits.js +16 -0
- package/apps/runtime/dist/manage.js +19 -0
- package/apps/runtime/dist/models.js +8 -8
- package/apps/runtime/dist/{film → motion-graphics}/project.js +54 -54
- package/apps/runtime/dist/{film → motion-graphics}/sounds.js +3 -3
- package/apps/runtime/dist/{film → motion-graphics}/step.js +37 -37
- package/apps/runtime/dist/{film → motion-graphics}/tools.js +1 -1
- package/apps/runtime/dist/render/downloads.js +2 -2
- package/apps/runtime/dist/render/guard.js +1 -1
- package/apps/runtime/dist/routes/delivery.js +1 -1
- package/apps/runtime/dist/routes/internal.js +1 -1
- package/apps/runtime/dist/routes/marketplace.js +4 -3
- package/apps/runtime/dist/routes/reports.js +80 -0
- package/apps/runtime/dist/routes/runs.js +25 -1
- package/apps/runtime/dist/services/brand.js +1 -1
- package/apps/runtime/dist/services/manage-reports.js +190 -0
- package/apps/runtime/dist/services/marketplace.js +33 -1
- package/apps/runtime/dist/services/pages.js +1 -1
- package/apps/runtime/dist/services/shipped-fonts.js +2 -1
- package/apps/runtime/dist/services/wizards.js +7 -0
- package/apps/runtime/dist/widgets/render.js +9 -9
- package/apps/runtime/dist/widgets/runtime.js +3 -3
- package/apps/runtime/dist/widgets/step.js +20 -20
- package/apps/web/dist/assets/{AboutDialog-D2r8kBfV.js → AboutDialog-Bx6j5lZO.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-j7Z1YhNv.js → ChangelogDialog-C620Sw_A.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-BTCMfVFJ.js → CodeEditor-DifBNaqQ.js} +1 -1
- package/apps/web/dist/assets/EditorPage-DWf9QG-U.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-BtVgtW7P.js → FlowPreview-ucwQ_dTr.js} +1 -1
- package/apps/web/dist/assets/{Harness-H4Ue1HOd.js → Harness-Br0Z_anI.js} +2 -2
- package/apps/web/dist/assets/Marketplace-CFDpVMWM.js +2 -0
- package/apps/web/dist/assets/{NewWizardChannels-K1HOzkXf.js → NewWizardChannels-Cau6XSbl.js} +1 -1
- package/apps/web/dist/assets/NewWizardPage-CrFqInHR.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-BZk42_R7.js +1 -0
- package/apps/web/dist/assets/PreviewPane-D9n6tylf.js +10 -0
- package/apps/web/dist/assets/ProjectPage-CteRfxpz.js +1 -0
- package/apps/web/dist/assets/PublicRunner-CNanj6-w.js +1 -0
- package/apps/web/dist/assets/{ReadOnly-Duk1YpNM.js → ReadOnly-DGBDtXFP.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-ClFQewEL.js +2 -0
- package/apps/web/dist/assets/SetupPage-k9gyFvow.js +1 -0
- package/apps/web/dist/assets/{SharePage-DvAUwrOl.js → SharePage-BhWeqF3w.js} +1 -1
- package/apps/web/dist/assets/changelog-BrhGlZT6.js +1 -0
- package/apps/web/dist/assets/{coins-DSvwvqtQ.js → coins-CwURUZyt.js} +1 -1
- package/apps/web/dist/assets/i18n-DEmaSTJV.js +55 -0
- package/apps/web/dist/assets/index-ClNm5JaU.js +34 -0
- package/apps/web/dist/assets/index-DImS12WR.css +1 -0
- package/apps/web/dist/assets/{oss-credits-BLVLXRzs.js → oss-credits-C6bPkfSE.js} +1 -1
- package/apps/web/dist/assets/{phone-xIUU1ZFn.js → phone-DTxGRwhK.js} +1 -1
- package/apps/web/dist/assets/runners-BMOIT6Ze.js +1 -0
- package/apps/web/dist/assets/{session-CbWzkHl0.js → session-xJpGiTU_.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-DoRItnPf.js → settings-menu-DcPFhgGA.js} +1 -1
- package/apps/web/dist/assets/theme-DTi1Zdw8.js +11 -0
- package/apps/web/dist/assets/{ui-6AgUKJhQ.js → ui-gsqxnFnT.js} +6 -6
- package/apps/web/dist/assets/{upload-C8WgcG1g.js → upload-BkwjFS-0.js} +1 -1
- package/apps/web/dist/assets/{useMutation-BdCg6qrc.js → useMutation-BS-U9g_a.js} +1 -1
- package/apps/web/dist/assets/{volume-2-jlgQapiz.js → volume-2-CYOgux-z.js} +1 -1
- package/apps/web/dist/assets/{wrench-Ca_TrBQk.js → wrench-DIfUvYPN.js} +1 -1
- package/apps/web/dist/index.html +9 -9
- package/apps/web/dist/mcp/flow.html +32 -32
- package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +11 -11
- package/node_modules/@engenty/wizards-shared/dist/definition.js +24 -23
- package/node_modules/@engenty/wizards-shared/dist/engenty/data-tables/columns-value.js +1 -0
- package/node_modules/@engenty/wizards-shared/dist/fit.d.ts +7 -2
- package/node_modules/@engenty/wizards-shared/dist/fit.js +23 -6
- package/node_modules/@engenty/wizards-shared/dist/marketplace-entry.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/marketplace-entry.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/marketplace.d.ts +9 -7
- package/node_modules/@engenty/wizards-shared/dist/marketplace.js +7 -23
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +15 -14
- package/node_modules/@engenty/wizards-shared/dist/run.js +30 -28
- package/node_modules/@engenty/wizards-shared/dist/runners.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/runners.js +5 -5
- package/node_modules/@engenty/wizards-shared/dist/store.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/store.js +1 -2
- package/node_modules/@engenty/wizards-shared/dist/theme-look.d.ts +39 -0
- package/node_modules/@engenty/wizards-shared/dist/theme-look.js +112 -0
- package/node_modules/@engenty/wizards-shared/dist/theme.d.ts +0 -38
- package/node_modules/@engenty/wizards-shared/dist/theme.js +1 -108
- package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +1 -0
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/runtime/dist/docs/dev/wizard-format/film-steps.md +0 -47
- package/apps/web/dist/assets/EditorPage-mx6XuEIw.js +0 -3
- package/apps/web/dist/assets/Marketplace-YEZDpGm9.js +0 -2
- package/apps/web/dist/assets/NewWizardPage-DSHVwwnU.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-CoBNtV_1.js +0 -1
- package/apps/web/dist/assets/PreviewPane-z0-Glj7p.js +0 -10
- package/apps/web/dist/assets/ProjectPage-DFaPSeda.js +0 -1
- package/apps/web/dist/assets/PublicRunner-DgT4CApp.js +0 -1
- package/apps/web/dist/assets/SettingsPage-FimvOhQq.js +0 -2
- package/apps/web/dist/assets/SetupPage-BxEMrMtA.js +0 -1
- package/apps/web/dist/assets/changelog-CS9GmnXd.js +0 -1
- package/apps/web/dist/assets/i18n-UTsgNY5M.js +0 -55
- package/apps/web/dist/assets/index-DHIXX69l.js +0 -20
- package/apps/web/dist/assets/index-Mt1sNdPx.css +0 -1
- package/apps/web/dist/assets/runners-CrSLA6HI.js +0 -1
- package/apps/web/dist/assets/theme-znovbShL.js +0 -11
- /package/apps/runtime/dist/{film → motion-graphics}/skills.js +0 -0
|
@@ -16,6 +16,7 @@ import { loadPlugins } from "./plugins/loader.js";
|
|
|
16
16
|
import { loadEntitlement, startProChecks } from "./plugins/pro.js";
|
|
17
17
|
import { closeBrowser } from "./render/chromium.js";
|
|
18
18
|
import { clearRunning, writeRunning } from "./running.js";
|
|
19
|
+
import { reportAllWizards } from "./services/manage-reports.js";
|
|
19
20
|
import { syncMarketplace } from "./services/marketplace.js";
|
|
20
21
|
import { purgeExpiredRuns } from "./services/shares.js";
|
|
21
22
|
import { purgeUnusedStores } from "./store/index.js";
|
|
@@ -39,6 +40,8 @@ if (managed) {
|
|
|
39
40
|
void migrateAllTenants()
|
|
40
41
|
.then(({ migrated, failed }) => {
|
|
41
42
|
console.log(`tenant databases: ${migrated} current${failed.length ? `, failed: ${failed}` : ""}`);
|
|
43
|
+
// The admin app's list of every team's wizards starts from what is here now.
|
|
44
|
+
return reportAllWizards();
|
|
42
45
|
})
|
|
43
46
|
.catch((err) => console.error("[migrate]", err));
|
|
44
47
|
// Which clients may start runs over the public API, and how often: the Manage-App's list.
|
|
@@ -3,6 +3,8 @@ import { and, count, eq, gte } from "drizzle-orm";
|
|
|
3
3
|
import { canSpend } from "./credits/credits.js";
|
|
4
4
|
import { db, schema } from "./db/client.js";
|
|
5
5
|
import { env } from "./env.js";
|
|
6
|
+
import { managed, tenantInfo } from "./manage.js";
|
|
7
|
+
import { currentTenant } from "./tenants/tenant.js";
|
|
6
8
|
export function hashIp(ip) {
|
|
7
9
|
if (!ip) {
|
|
8
10
|
return null;
|
|
@@ -22,6 +24,9 @@ export async function wizardUnavailable(w) {
|
|
|
22
24
|
if (!w.shareEnabled || w.publishedVersion === null) {
|
|
23
25
|
return { code: "wizardUnavailable" };
|
|
24
26
|
}
|
|
27
|
+
if (await held(w.id)) {
|
|
28
|
+
return { code: "wizardPaused" };
|
|
29
|
+
}
|
|
25
30
|
const [{ n }] = await db
|
|
26
31
|
.select({ n: count() })
|
|
27
32
|
.from(schema.run)
|
|
@@ -34,6 +39,17 @@ export async function wizardUnavailable(w) {
|
|
|
34
39
|
}
|
|
35
40
|
return null;
|
|
36
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* An admin held the wizard, or the team's whole page, at the Manage-App: no new run starts. Out
|
|
44
|
+
* of reach, the Manage-App holds nothing up.
|
|
45
|
+
*/
|
|
46
|
+
export async function held(wizardId) {
|
|
47
|
+
if (!managed) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const info = await tenantInfo(currentTenant()).catch(() => null);
|
|
51
|
+
return Boolean(info?.holds?.wizards.some((h) => h.id === wizardId));
|
|
52
|
+
}
|
|
37
53
|
export async function verifyTurnstile(token, ip) {
|
|
38
54
|
if (!env.turnstile.secret) {
|
|
39
55
|
return true;
|
|
@@ -236,6 +236,25 @@ export function bookChannelUsage(id, input) {
|
|
|
236
236
|
export function putPages(tenantId, data) {
|
|
237
237
|
return call("PUT", `/v1/pages/${encodeURIComponent(tenantId)}`, data);
|
|
238
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* The team's wizards, whole (services/manage-reports.ts): the admin app lists them, with the
|
|
241
|
+
* template each was made from, and checks them.
|
|
242
|
+
*/
|
|
243
|
+
export function putWizards(tenantId, data) {
|
|
244
|
+
return call("PUT", `/v1/wizards/${encodeURIComponent(tenantId)}`, data);
|
|
245
|
+
}
|
|
246
|
+
/** A run's turn – started, waiting, finished, failed, cancelled – for the admin app. */
|
|
247
|
+
export function postRunReport(tenantId, data) {
|
|
248
|
+
return call("POST", `/v1/runs/${encodeURIComponent(tenantId)}`, data);
|
|
249
|
+
}
|
|
250
|
+
/** What a person said at the end of a run. */
|
|
251
|
+
export function postFeedback(tenantId, data) {
|
|
252
|
+
return call("POST", `/v1/feedback/${encodeURIComponent(tenantId)}`, data);
|
|
253
|
+
}
|
|
254
|
+
/** "Report a problem", as the person sent it. */
|
|
255
|
+
export function postBugReport(data) {
|
|
256
|
+
return call("POST", "/v1/bug-reports", data);
|
|
257
|
+
}
|
|
239
258
|
/** A push to the mobile app on one device; the Manage-App holds the APNs and FCM keys. */
|
|
240
259
|
export function pushToDevice(input) {
|
|
241
260
|
return call("POST", "/v1/push", input);
|
|
@@ -941,18 +941,18 @@ export async function classProblem(cls) {
|
|
|
941
941
|
throw err;
|
|
942
942
|
}
|
|
943
943
|
}
|
|
944
|
-
/** Clients that can make a
|
|
945
|
-
const
|
|
944
|
+
/** Clients that can make a video: they work in a folder of their own with a shell and skills. */
|
|
945
|
+
const MOTION_CLIENTS = new Set(["claude"]);
|
|
946
946
|
/**
|
|
947
|
-
* The installed client a
|
|
948
|
-
*
|
|
947
|
+
* The installed client a motion-graphics step of this class runs on, and the model it names; or why a
|
|
948
|
+
* video cannot be made here. Videos never run on credits or keys: one takes a client many minutes.
|
|
949
949
|
*/
|
|
950
|
-
export async function
|
|
950
|
+
export async function motionClient(cls) {
|
|
951
951
|
const cfg = await config();
|
|
952
952
|
const client = managed ? null : harness(cfg.settings.source);
|
|
953
|
-
if (!client || !
|
|
953
|
+
if (!client || !MOTION_CLIENTS.has(client.id)) {
|
|
954
954
|
return {
|
|
955
|
-
problem: note("
|
|
955
|
+
problem: note("claudeCodeMakesMotion"),
|
|
956
956
|
};
|
|
957
957
|
}
|
|
958
958
|
const status = await detectHarness(client.id);
|
|
@@ -962,7 +962,7 @@ export async function filmClient(cls) {
|
|
|
962
962
|
if (status.auth === "none") {
|
|
963
963
|
return { problem: signedOut(client) };
|
|
964
964
|
}
|
|
965
|
-
// A class that thinks on Apple Intelligence makes its
|
|
965
|
+
// A class that thinks on Apple Intelligence makes its videos on the client's model of the class.
|
|
966
966
|
const ref = ownRef(cfg, cls);
|
|
967
967
|
return {
|
|
968
968
|
client,
|
|
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { cp, mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
4
4
|
import { dirname, join, normalize } from "node:path";
|
|
5
|
-
import { dataRef,
|
|
5
|
+
import { dataRef, MOTION_SIZES } from "@engenty/wizards-shared/definition";
|
|
6
6
|
import { gradientCss, ruleLines, textStyleLine } from "@engenty/wizards-shared/projects";
|
|
7
7
|
import { unzipSync } from "fflate";
|
|
8
8
|
import { logoSectionLine, renderTemplate, resolveRef } from "../engine/template.js";
|
|
@@ -14,7 +14,7 @@ import { placeSkills } from "./skills.js";
|
|
|
14
14
|
import { soundCatalog } from "./sounds.js";
|
|
15
15
|
import { runHyperframes } from "./tools.js";
|
|
16
16
|
/**
|
|
17
|
-
* The folder a
|
|
17
|
+
* The folder a video is made in: one per run and step, kept after the run so a later change edits
|
|
18
18
|
* the code instead of starting over. Laid out for the client:
|
|
19
19
|
*
|
|
20
20
|
* BRIEF.md what to make (the step's brief, the format, the length)
|
|
@@ -23,11 +23,11 @@ import { runHyperframes } from "./tools.js";
|
|
|
23
23
|
* showcase/ the wizard's style kit, the bar to reach
|
|
24
24
|
* brand/ the space's brand: brand.json, logos
|
|
25
25
|
* input/ what this run made before: voice lines, pictures, texts, uploads
|
|
26
|
-
* audio-catalog/ the only sounds the
|
|
27
|
-
*
|
|
26
|
+
* audio-catalog/ the only sounds the video may use
|
|
27
|
+
* video/ the HyperFrames project; renders/video.mp4 is the result
|
|
28
28
|
*/
|
|
29
|
-
export function
|
|
30
|
-
return join(env.dataDir, "
|
|
29
|
+
export function motionRoot(runId, stepId) {
|
|
30
|
+
return join(env.dataDir, "motion-graphics", runId, stepId);
|
|
31
31
|
}
|
|
32
32
|
const SESSION = join(".engenty", "session");
|
|
33
33
|
export async function savedSession(root) {
|
|
@@ -52,23 +52,23 @@ async function put(root, rel, data) {
|
|
|
52
52
|
await writeFile(path, data);
|
|
53
53
|
}
|
|
54
54
|
const safeName = (name) => name.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "file";
|
|
55
|
-
/** Where the client starts, by how
|
|
55
|
+
/** Where the client starts, by how video/ began. */
|
|
56
56
|
function startRules(start) {
|
|
57
57
|
if (start === "base") {
|
|
58
|
-
return `- **What to make:** BRIEF.md. **Start here:**
|
|
59
|
-
format — read
|
|
58
|
+
return `- **What to make:** BRIEF.md. **Start here:** video/ is already the wizard's base project in this
|
|
59
|
+
format — read video/PARTS.md first: its scene templates carry the look. Compose the video from them in
|
|
60
60
|
the one file PARTS.md names, timed to the voice; write a new scene only where no template fits, then
|
|
61
61
|
in the style of showcase/ (SHOWCASE.md says how each technique is made).
|
|
62
|
-
- **The brand:**
|
|
63
|
-
it first as
|
|
62
|
+
- **The brand:** video/brand/ holds brand.json and the logos. If video/brand/theme.json is missing, make
|
|
63
|
+
it first as video/BRAND.md says — it is kept for the next videos of this space, so get it right.
|
|
64
64
|
Colours, logo and fonts come from there only.
|
|
65
65
|
`;
|
|
66
66
|
}
|
|
67
67
|
if (start === "from") {
|
|
68
|
-
return `- **What to make:** BRIEF.md. **Start here:**
|
|
68
|
+
return `- **What to make:** BRIEF.md. **Start here:** video/ holds a finished video of this run in another
|
|
69
69
|
format. Lay it out for this one: scenes, timing, words and sound stay; only the layout changes
|
|
70
|
-
(
|
|
71
|
-
- **The brand:**
|
|
70
|
+
(video/PARTS.md says how when it exists). The look is showcase/'s.
|
|
71
|
+
- **The brand:** video/brand/ when it is there, else brand/brand.json and brand/logos/ — colours, logo
|
|
72
72
|
and fonts come from there only.
|
|
73
73
|
`;
|
|
74
74
|
}
|
|
@@ -78,31 +78,31 @@ function startRules(start) {
|
|
|
78
78
|
`;
|
|
79
79
|
}
|
|
80
80
|
function rules(step, skills, start) {
|
|
81
|
-
const size =
|
|
82
|
-
return `# The
|
|
81
|
+
const size = MOTION_SIZES[step.format];
|
|
82
|
+
return `# The video folder
|
|
83
83
|
|
|
84
|
-
You make one
|
|
84
|
+
You make one video here, autonomously, to the end. Nobody answers questions: where a skill asks the
|
|
85
85
|
person, decide yourself and note it in PROGRESS.md.
|
|
86
86
|
|
|
87
87
|
${startRules(start)}- **Material:** input/ (see input/README.md). Use nothing from the web; you have no network.
|
|
88
88
|
- **Skills:** ${skills.join(", ")} in .claude/skills/<name>/SKILL.md. Start with \`hyperframes\` and
|
|
89
89
|
read the skill files directly; do not update or install skills.
|
|
90
|
-
- **The HyperFrames project is
|
|
91
|
-
inside
|
|
92
|
-
- **Running HyperFrames:** only through the \`hyperframes\` tool (MCP server \`
|
|
93
|
-
\`["lint","
|
|
94
|
-
\`["render","
|
|
90
|
+
- **The HyperFrames project is video/** (${size.width}×${size.height}). Keep every file of the video
|
|
91
|
+
inside video/.
|
|
92
|
+
- **Running HyperFrames:** only through the \`hyperframes\` tool (MCP server \`video\`), e.g.
|
|
93
|
+
\`["lint","video"]\`, \`["check","video"]\`, \`["snapshot","video","--at","1,4,8"]\`,
|
|
94
|
+
\`["render","video","-q","draft"]\`, \`["transcribe","input/voice/l01.wav","--json","-d","input/voice"]\`.
|
|
95
95
|
\`npx\`, \`npm\` and network do not work in the shell.
|
|
96
96
|
- **Look at your work:** snapshot the frames and read the PNGs, fix what is wrong. Before you finish,
|
|
97
|
-
render a draft and look at a frame every second of the whole
|
|
97
|
+
render a draft and look at a frame every second of the whole video: empty areas, cut-off text,
|
|
98
98
|
overlaps, jumps.
|
|
99
|
-
- **Finish** only when \`["check","
|
|
100
|
-
End with a short summary: what the
|
|
99
|
+
- **Finish** only when \`["check","video"]\` passes and \`["render","video","-q","draft"]\` succeeds, with \`video/index.html\` complete. The runtime renders the final MP4 itself.
|
|
100
|
+
End with a short summary: what the video shows, what you decided.
|
|
101
101
|
|
|
102
102
|
## Sound (hard rules)
|
|
103
103
|
|
|
104
104
|
- Sounds come only from audio-catalog/ (catalog.json lists each file with tags, keywords, licence).
|
|
105
|
-
Copy the picked files into
|
|
105
|
+
Copy the picked files into video/assets/ and list them in video/AUDIO.md (file, source, licence, use).
|
|
106
106
|
- Never generate, synthesize or download audio: no ffmpeg tone or noise, no TTS, no music models. Voice
|
|
107
107
|
lines come only from input/. Mixing is HyperFrames' job (\`<audio>\` with start, duration, volume).
|
|
108
108
|
- Install nothing (no pip, brew, npm).
|
|
@@ -111,7 +111,7 @@ ${startRules(start)}- **Material:** input/ (see input/README.md). Use nothing fr
|
|
|
111
111
|
const BRAND_STAMP = join(".engenty", "brand");
|
|
112
112
|
/**
|
|
113
113
|
* Writes the space's brand into brand/ as it is now (brand.json, logos). True when it differs
|
|
114
|
-
* from what the folder had before — the
|
|
114
|
+
* from what the folder had before — the video's code then still carries the old one.
|
|
115
115
|
*/
|
|
116
116
|
async function writeBrand(root, ctx) {
|
|
117
117
|
const b = ctx.scope.brand;
|
|
@@ -158,7 +158,7 @@ async function writeBrand(root, ctx) {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
const json = JSON.stringify({
|
|
161
|
-
note: "The space's brand. Colours are named by what they are for; the first is the accent. A logo's section, a gradient's or a pattern's description says when to use it; colorRules, logoRules and typeRules, where there are any, say how colours, logos and type may be used; text is set in the fonts — a font with `uses` that leave out video is not used in a
|
|
161
|
+
note: "The space's brand. Colours are named by what they are for; the first is the accent. A logo's section, a gradient's or a pattern's description says when to use it; colorRules, logoRules and typeRules, where there are any, say how colours, logos and type may be used; text is set in the fonts — a font with `uses` that leave out video is not used in a video: its text gets a system font.",
|
|
162
162
|
name: b.name ?? "",
|
|
163
163
|
about: b.about ?? "",
|
|
164
164
|
colors: (b.colors ?? []).map((c) => {
|
|
@@ -222,7 +222,7 @@ async function writeBrand(root, ctx) {
|
|
|
222
222
|
const START = join(".engenty", "start");
|
|
223
223
|
const BASE = join(".engenty", "base");
|
|
224
224
|
/**
|
|
225
|
-
* The brand base: what a
|
|
225
|
+
* The brand base: what a video made once from the space's brand for the kit's base (the base's
|
|
226
226
|
* BRAND.md says what — theme.json at least), kept per space for the kit and the brand as they are.
|
|
227
227
|
* A changed brand or kit is another key, so it is made again.
|
|
228
228
|
*/
|
|
@@ -230,19 +230,19 @@ function brandBaseDir(ctx, kitHash, brandStamp) {
|
|
|
230
230
|
const key = createHash("sha256").update(`${kitHash}:${brandStamp}`).digest("hex").slice(0, 24);
|
|
231
231
|
return join(env.dataDir, "brand-bases", ctx.project.id, key);
|
|
232
232
|
}
|
|
233
|
-
/** What in
|
|
233
|
+
/** What in video/brand/ is the brand base: everything but the brand itself. */
|
|
234
234
|
const isBrandItself = (name) => name === "brand.json" || name === "logos" || name === "patterns";
|
|
235
235
|
/**
|
|
236
236
|
* Brings the brand into a project that started from a base: brand.json and the logos as they are
|
|
237
237
|
* now, and the brand base kept for them when there is one. A base that no longer fits the brand
|
|
238
|
-
* is removed — the
|
|
238
|
+
* is removed — the video makes it again, as BRAND.md says.
|
|
239
239
|
*/
|
|
240
|
-
async function
|
|
240
|
+
async function brandIntoMotion(root, brandChanged) {
|
|
241
241
|
const base = await readFile(join(root, BASE), "utf8").catch(() => "");
|
|
242
242
|
if (!base) {
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
|
-
const target = join(root, "
|
|
245
|
+
const target = join(root, "video", "brand");
|
|
246
246
|
await mkdir(target, { recursive: true });
|
|
247
247
|
for (const name of await readdir(target)) {
|
|
248
248
|
if (isBrandItself(name) || (brandChanged && !existsSync(base))) {
|
|
@@ -263,10 +263,10 @@ async function refreshBrandBase(root, ctx, step) {
|
|
|
263
263
|
const stamp = await readFile(join(root, BRAND_STAMP), "utf8");
|
|
264
264
|
await put(root, BASE, brandBaseDir(ctx, kitHash, stamp));
|
|
265
265
|
}
|
|
266
|
-
/** After a
|
|
266
|
+
/** After a video: keeps what it made from the brand for the next videos in this space. */
|
|
267
267
|
export async function keepBrandBase(root) {
|
|
268
268
|
const base = await readFile(join(root, BASE), "utf8").catch(() => "");
|
|
269
|
-
const source = join(root, "
|
|
269
|
+
const source = join(root, "video", "brand");
|
|
270
270
|
if (!base || !existsSync(join(source, "theme.json"))) {
|
|
271
271
|
return;
|
|
272
272
|
}
|
|
@@ -279,14 +279,14 @@ export async function keepBrandBase(root) {
|
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
/** Sets up the folder for a first attempt; a later attempt finds it as it was left. */
|
|
282
|
-
export async function
|
|
283
|
-
const root =
|
|
282
|
+
export async function prepareMotionFolder(step, ctx) {
|
|
283
|
+
const root = motionRoot(ctx.runId, step.id);
|
|
284
284
|
const brief = renderTemplate(step.brief, ctx.scope).trim();
|
|
285
|
-
// An earlier
|
|
285
|
+
// An earlier video to start from, when it ran.
|
|
286
286
|
const fromId = step.from ? dataRef(step.from).replace(/^steps\./, "") : null;
|
|
287
|
-
const fromDir = fromId ? join(
|
|
287
|
+
const fromDir = fromId ? join(motionRoot(ctx.runId, fromId), "video") : null;
|
|
288
288
|
const from = fromId && fromDir && existsSync(join(fromDir, "index.html")) ? fromId : null;
|
|
289
|
-
// The same brief and material as last time: the
|
|
289
|
+
// The same brief and material as last time: the video is there to go on with or to change.
|
|
290
290
|
const stamp = createHash("sha256")
|
|
291
291
|
.update(JSON.stringify([
|
|
292
292
|
brief,
|
|
@@ -300,7 +300,7 @@ export async function prepareFilmFolder(step, ctx) {
|
|
|
300
300
|
.digest("hex");
|
|
301
301
|
const stampFile = join(root, ".engenty", "inputs");
|
|
302
302
|
const same = existsSync(stampFile) && (await readFile(stampFile, "utf8")) === stamp;
|
|
303
|
-
if (same && existsSync(join(root, "
|
|
303
|
+
if (same && existsSync(join(root, "video", "index.html")) && (await savedSession(root))) {
|
|
304
304
|
// The brand is the space's as it is now, also for a change: colours or a logo may be new.
|
|
305
305
|
const { changed } = await writeBrand(root, ctx);
|
|
306
306
|
const start = ((await readFile(join(root, START), "utf8").catch(() => "")) ||
|
|
@@ -308,15 +308,15 @@ export async function prepareFilmFolder(step, ctx) {
|
|
|
308
308
|
if (changed) {
|
|
309
309
|
await refreshBrandBase(root, ctx, step);
|
|
310
310
|
}
|
|
311
|
-
await
|
|
311
|
+
await brandIntoMotion(root, changed);
|
|
312
312
|
return { root, brief, brandChanged: changed, start };
|
|
313
313
|
}
|
|
314
314
|
await rm(root, { recursive: true, force: true });
|
|
315
315
|
await mkdir(root, { recursive: true });
|
|
316
316
|
const skills = await placeSkills(step.skills, ctx.files, join(root, ".claude", "skills"));
|
|
317
|
-
const size =
|
|
317
|
+
const size = MOTION_SIZES[step.format];
|
|
318
318
|
await put(root, "BRIEF.md", `# Brief\n\nFormat ${step.format}, ${size.width}×${size.height}${step.seconds ? `, about ${step.seconds} s` : ""}. Language of all text on screen: the brief's language.\n\n${brief}\n`);
|
|
319
|
-
// The style kit: the showcase to look at, and the base a
|
|
319
|
+
// The style kit: the showcase to look at, and the base a video starts from when it has one.
|
|
320
320
|
const kitFile = step.kit ? ctx.files.find((f) => f.path === step.kit) : undefined;
|
|
321
321
|
const base = {};
|
|
322
322
|
if (kitFile) {
|
|
@@ -369,18 +369,18 @@ export async function prepareFilmFolder(step, ctx) {
|
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
await put(join(root, "input"), "README.md", `# Material for this
|
|
372
|
+
await put(join(root, "input"), "README.md", `# Material for this video\n\n${listed.join("\n") || "(none)"}\n\nVoice lines play one after another in their order; their lengths decide the timing.\n`);
|
|
373
373
|
await cp(await soundCatalog(), join(root, "audio-catalog"), { recursive: true });
|
|
374
|
-
// The HyperFrames project: the earlier
|
|
374
|
+
// The HyperFrames project: the earlier video, the kit's base in this format, or a new one.
|
|
375
375
|
const index = `index.${step.format.replace(":", "x")}.html`;
|
|
376
376
|
let start;
|
|
377
377
|
if (from && fromDir) {
|
|
378
378
|
start = "from";
|
|
379
|
-
await cp(fromDir, join(root, "
|
|
379
|
+
await cp(fromDir, join(root, "video"), {
|
|
380
380
|
recursive: true,
|
|
381
381
|
filter: (path) => !/\/(renders|snapshots)(\/|$)/.test(path.slice(fromDir.length)),
|
|
382
382
|
});
|
|
383
|
-
const fromBase = await readFile(join(
|
|
383
|
+
const fromBase = await readFile(join(motionRoot(ctx.runId, from), BASE), "utf8").catch(() => "");
|
|
384
384
|
if (fromBase) {
|
|
385
385
|
await put(root, BASE, fromBase);
|
|
386
386
|
}
|
|
@@ -389,21 +389,21 @@ export async function prepareFilmFolder(step, ctx) {
|
|
|
389
389
|
start = "base";
|
|
390
390
|
for (const [name, data] of Object.entries(base)) {
|
|
391
391
|
if (!/^index\.\d+x\d+\.html$/.test(name)) {
|
|
392
|
-
await put(join(root, "
|
|
392
|
+
await put(join(root, "video"), name, data);
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
await put(join(root, "
|
|
395
|
+
await put(join(root, "video"), "index.html", base[index]);
|
|
396
396
|
await put(root, BASE, brandBaseDir(ctx, kitFile?.hash ?? "", brandStamp));
|
|
397
397
|
}
|
|
398
398
|
else {
|
|
399
399
|
start = "init";
|
|
400
400
|
const preset = { "16:9": "landscape", "9:16": "portrait", "1:1": "square" }[step.format];
|
|
401
|
-
const init = await runHyperframes(["init", "
|
|
402
|
-
if (init.code !== 0 || !existsSync(join(root, "
|
|
403
|
-
throw new Error(`The
|
|
401
|
+
const init = await runHyperframes(["init", "video", "--non-interactive", "--skip-transcribe", `--resolution=${preset}`], { cwd: root, signal: ctx.signal, timeoutMs: 5 * 60_000 });
|
|
402
|
+
if (init.code !== 0 || !existsSync(join(root, "video"))) {
|
|
403
|
+
throw new Error(`The video project could not be set up: ${init.out.slice(-300)}`);
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
await
|
|
406
|
+
await brandIntoMotion(root, false);
|
|
407
407
|
const text = rules(step, skills, start);
|
|
408
408
|
await put(root, "CLAUDE.md", text);
|
|
409
409
|
await put(root, "AGENTS.md", text);
|
|
@@ -4,7 +4,7 @@ import { join } from "node:path";
|
|
|
4
4
|
import { env } from "../env.js";
|
|
5
5
|
import { platformSkills } from "./skills.js";
|
|
6
6
|
/**
|
|
7
|
-
* The sounds a
|
|
7
|
+
* The sounds a video may use: nothing is generated, synthesized or downloaded by the client.
|
|
8
8
|
* soundcn (soundcn.xyz, MIT; the sounds by Kenney, CC0) for clicks, pops, impacts, jingles,
|
|
9
9
|
* switches, pages and paper; the effects HyperFrames ships with (whooshes, typing, risers).
|
|
10
10
|
* Fetched once into the data folder; `catalog.json` lists every file with tags and licence.
|
|
@@ -108,11 +108,11 @@ async function build() {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
if (!sounds.length) {
|
|
111
|
-
throw new Error("The sounds for
|
|
111
|
+
throw new Error("The sounds for videos could not be loaded.");
|
|
112
112
|
}
|
|
113
113
|
sounds.sort((a, b) => a.file.localeCompare(b.file));
|
|
114
114
|
await writeFile(join(tmp, "catalog.json"), JSON.stringify({
|
|
115
|
-
note: "The only sounds this
|
|
115
|
+
note: "The only sounds this video may use. Never generate, synthesize or download audio.",
|
|
116
116
|
music: [],
|
|
117
117
|
sounds,
|
|
118
118
|
}, null, 1));
|
|
@@ -2,19 +2,19 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { readFile, rm, stat } from "node:fs/promises";
|
|
4
4
|
import { isAbsolute, join, normalize } from "node:path";
|
|
5
|
-
import {
|
|
5
|
+
import { MOTION_SIZES } from "@engenty/wizards-shared/definition";
|
|
6
6
|
import { note as runNote } from "@engenty/wizards-shared/run";
|
|
7
7
|
import { StepError } from "../engine/types.js";
|
|
8
8
|
import { CLAUDE_BIN, claudeEnv } from "../harness/claude.js";
|
|
9
9
|
import { failureOf } from "../harness/model.js";
|
|
10
10
|
import { openBridge } from "../mcp/bridge.js";
|
|
11
11
|
import { saidOf } from "../model-errors.js";
|
|
12
|
-
import {
|
|
13
|
-
import { keepBrandBase,
|
|
12
|
+
import { motionClient } from "../models.js";
|
|
13
|
+
import { keepBrandBase, prepareMotionFolder, savedSession, saveSession } from "./project.js";
|
|
14
14
|
import { runHyperframes } from "./tools.js";
|
|
15
15
|
/**
|
|
16
|
-
* A
|
|
17
|
-
* the style kit, the brand and the run's material, and writes the
|
|
16
|
+
* A motion-graphics step: the installed client (Claude Code) works in the video's folder with the skills,
|
|
17
|
+
* the style kit, the brand and the run's material, and writes the video as code. Its shell runs
|
|
18
18
|
* in the client's sandbox — writes only inside the folder, no network; HyperFrames (render,
|
|
19
19
|
* snapshots, checks) runs outside it, through the `hyperframes` tool of this step, limited to
|
|
20
20
|
* the folder. The final render is the runtime's, not the client's. A run that stops (a limit,
|
|
@@ -40,19 +40,19 @@ const ALLOWED = new Set([
|
|
|
40
40
|
"transcribe",
|
|
41
41
|
"docs",
|
|
42
42
|
]);
|
|
43
|
-
/** The longest a
|
|
43
|
+
/** The longest a video may take the client before the step gives up. */
|
|
44
44
|
const LIMIT_MS = 3 * 60 * 60_000;
|
|
45
45
|
function hyperframesTool(root, signal) {
|
|
46
46
|
return {
|
|
47
47
|
name: "hyperframes",
|
|
48
|
-
description: "Runs the HyperFrames CLI in the
|
|
48
|
+
description: "Runs the HyperFrames CLI in the video folder: lint, check, snapshot, render, inspect, timeline, transcribe, keyframes, compare, docs and the like. Paths are relative to the folder. Returns what it printed.",
|
|
49
49
|
inputSchema: {
|
|
50
50
|
type: "object",
|
|
51
51
|
properties: {
|
|
52
52
|
args: {
|
|
53
53
|
type: "array",
|
|
54
54
|
items: { type: "string" },
|
|
55
|
-
description: 'The arguments, e.g. ["snapshot", "
|
|
55
|
+
description: 'The arguments, e.g. ["snapshot", "video", "--at", "1,4,8"].',
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
required: ["args"],
|
|
@@ -70,7 +70,7 @@ function hyperframesTool(root, signal) {
|
|
|
70
70
|
for (const a of args) {
|
|
71
71
|
const value = a.includes("=") && a.startsWith("-") ? a.slice(a.indexOf("=") + 1) : a;
|
|
72
72
|
if (isAbsolute(value) || normalize(value).startsWith("..")) {
|
|
73
|
-
return `"${a}" leaves the
|
|
73
|
+
return `"${a}" leaves the video folder.`;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
const extra = cmd === "transcribe" ? ["--no-runtime-install"] : [];
|
|
@@ -93,16 +93,16 @@ function renderProblem(out) {
|
|
|
93
93
|
}
|
|
94
94
|
/** How many times a failed final render goes back to the client to be fixed. */
|
|
95
95
|
const RENDER_FIXES = 2;
|
|
96
|
-
export async function
|
|
97
|
-
const found = await
|
|
96
|
+
export async function runMotionGraphicsStep(step, ctx) {
|
|
97
|
+
const found = await motionClient(step.model ?? "low");
|
|
98
98
|
if ("problem" in found) {
|
|
99
99
|
throw new StepError(found.problem);
|
|
100
100
|
}
|
|
101
101
|
const { client, alias } = found;
|
|
102
|
-
await ctx.emit("info", { code: "
|
|
103
|
-
const { root, brief, brandChanged, start } = await
|
|
102
|
+
await ctx.emit("info", { code: "motionSetup" });
|
|
103
|
+
const { root, brief, brandChanged, start } = await prepareMotionFolder(step, ctx);
|
|
104
104
|
const resume = await savedSession(root);
|
|
105
|
-
await ctx.emit("info", resume ? { code: "
|
|
105
|
+
await ctx.emit("info", resume ? { code: "motionResume" } : { code: "motionClient", params: { client: client.name } });
|
|
106
106
|
const limit = AbortSignal.any([ctx.signal, AbortSignal.timeout(LIMIT_MS)]);
|
|
107
107
|
const bridge = openBridge([hyperframesTool(root, limit)]);
|
|
108
108
|
/** One turn of the client in the folder; returns its final event. */
|
|
@@ -118,7 +118,7 @@ export async function runFilmStep(step, ctx) {
|
|
|
118
118
|
"project",
|
|
119
119
|
"--strict-mcp-config",
|
|
120
120
|
"--mcp-config",
|
|
121
|
-
JSON.stringify({ mcpServers: {
|
|
121
|
+
JSON.stringify({ mcpServers: { video: { type: "http", url: bridge.url } } }),
|
|
122
122
|
// The shell writes only inside the folder and has no network.
|
|
123
123
|
"--settings",
|
|
124
124
|
JSON.stringify({
|
|
@@ -139,7 +139,7 @@ export async function runFilmStep(step, ctx) {
|
|
|
139
139
|
"TaskList",
|
|
140
140
|
"TaskGet",
|
|
141
141
|
"Skill",
|
|
142
|
-
"
|
|
142
|
+
"mcp__video",
|
|
143
143
|
].join(","),
|
|
144
144
|
"--disallowedTools",
|
|
145
145
|
"WebFetch,WebSearch",
|
|
@@ -167,7 +167,7 @@ export async function runFilmStep(step, ctx) {
|
|
|
167
167
|
const task = async (now) => {
|
|
168
168
|
if (now && now !== lastTask) {
|
|
169
169
|
lastTask = now;
|
|
170
|
-
await ctx.emit("tool", { code: "
|
|
170
|
+
await ctx.emit("tool", { code: "motionTask", params: { task: now.slice(0, 90) } });
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
173
|
const onEvent = async (event) => {
|
|
@@ -194,11 +194,11 @@ export async function runFilmStep(step, ctx) {
|
|
|
194
194
|
const id = Number(input.taskId);
|
|
195
195
|
await task(typeof input.subject === "string" ? input.subject : subjects[id - 1] || undefined);
|
|
196
196
|
}
|
|
197
|
-
else if (part.name === "
|
|
197
|
+
else if (part.name === "mcp__video__hyperframes" &&
|
|
198
198
|
input.args?.[0] === "snapshot" &&
|
|
199
199
|
Date.now() - lastLook > 60_000) {
|
|
200
200
|
lastLook = Date.now();
|
|
201
|
-
await ctx.emit("tool", { code: "
|
|
201
|
+
await ctx.emit("tool", { code: "motionLooks" });
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
};
|
|
@@ -230,55 +230,55 @@ export async function runFilmStep(step, ctx) {
|
|
|
230
230
|
if (ctx.signal.aborted) {
|
|
231
231
|
throw err;
|
|
232
232
|
}
|
|
233
|
-
throw new StepError(runNote("
|
|
233
|
+
throw new StepError(runNote("motionClientStopped", { name: client.name, detail: err.message }));
|
|
234
234
|
});
|
|
235
235
|
const result = last;
|
|
236
236
|
if (!result || result.is_error) {
|
|
237
237
|
const detail = String(result?.result ?? (stderr.trim() || "no result")).slice(0, 400);
|
|
238
238
|
const failure = failureOf(client, detail);
|
|
239
|
-
throw new StepError(runNote("
|
|
239
|
+
throw new StepError(runNote("motionWorkSaved", { problem: saidOf(failure) }));
|
|
240
240
|
}
|
|
241
241
|
return result;
|
|
242
242
|
};
|
|
243
|
-
const out = join(root, "
|
|
243
|
+
const out = join(root, "video", "renders", "video.mp4");
|
|
244
244
|
let summary = "";
|
|
245
245
|
try {
|
|
246
|
-
// A review's note asks for a change: the
|
|
246
|
+
// A review's note asks for a change: the video's code is there, so it is edited, not redone.
|
|
247
247
|
const note = ctx.state.notes[step.id]?.trim();
|
|
248
|
-
// A brand changed in the space since the
|
|
248
|
+
// A brand changed in the space since the video was made: the video's code carries the old one.
|
|
249
249
|
const brandNote = !brandChanged
|
|
250
250
|
? ""
|
|
251
251
|
: start === "init"
|
|
252
|
-
? "\n\nThe space's brand has changed since the
|
|
253
|
-
: "\n\nThe space's brand has changed since the
|
|
254
|
-
const size =
|
|
252
|
+
? "\n\nThe space's brand has changed since the video was made: brand/brand.json and brand/logos/ are new. Carry them into the video wherever it uses the brand (its own copies included), so every colour, logo and name is the new one, and check the frames for contrast."
|
|
253
|
+
: "\n\nThe space's brand has changed since the video was made: video/brand/brand.json and the logos are new. If video/brand/theme.json is missing, make it again as video/BRAND.md says. Make sure every colour, logo and name in the video is the new one, and check the frames for contrast.";
|
|
254
|
+
const size = MOTION_SIZES[step.format];
|
|
255
255
|
const prompt = resume && note
|
|
256
|
-
? `The person watched the
|
|
256
|
+
? `The person watched the video and asks for this change:\n\n${note}${brandNote}\n\nChange the video in video/ accordingly — keep what they did not mention — check the frames again, and end with a short summary of what you changed.`
|
|
257
257
|
: resume
|
|
258
|
-
? `Carry on with the
|
|
258
|
+
? `Carry on with the video where you stopped. Read PROGRESS.md and the folder to see where that was, then finish it.${brandNote}`
|
|
259
259
|
: start === "from"
|
|
260
|
-
? `
|
|
261
|
-
: `Make the
|
|
260
|
+
? `video/ holds this run's video in another format. Lay it out for ${step.format} (${size.width}×${size.height}), following CLAUDE.md: set the size of video/index.html, then make every scene fit — scenes, timing, words and sound stay. Check the frames, render a draft, and end with a short summary of what you changed.\n\nThe brief, for reference:\n\n${brief}`
|
|
261
|
+
: `Make the video BRIEF.md asks for, following CLAUDE.md.\n\n${brief}`;
|
|
262
262
|
const first = await turn(prompt, resume);
|
|
263
263
|
summary = typeof first.result === "string" ? first.result.trim() : "";
|
|
264
264
|
// The final render is ours: it does not depend on the client still running. What fails
|
|
265
265
|
// goes back to the client, which fixes its code.
|
|
266
266
|
for (let attempt = 0;; attempt++) {
|
|
267
|
-
if (!existsSync(join(root, "
|
|
268
|
-
throw new StepError(`${client.name} hat
|
|
267
|
+
if (!existsSync(join(root, "video", "index.html"))) {
|
|
268
|
+
throw new StepError(`${client.name} hat kein Video hinterlassen.`);
|
|
269
269
|
}
|
|
270
270
|
await ctx.emit("info", { code: "videoRendering" });
|
|
271
271
|
await rm(out, { force: true });
|
|
272
|
-
const render = await runHyperframes(["render", "
|
|
272
|
+
const render = await runHyperframes(["render", "video", "-o", "video/renders/video.mp4", "--crf", "23", "--quiet"], { cwd: root, signal: ctx.signal, timeoutMs: 30 * 60_000 });
|
|
273
273
|
if (render.code === 0 && existsSync(out) && (await stat(out)).size > 0) {
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
276
|
const problem = renderProblem(render.out);
|
|
277
277
|
if (attempt >= RENDER_FIXES) {
|
|
278
|
-
throw new StepError(runNote("
|
|
278
|
+
throw new StepError(runNote("motionRenderFailed", { detail: problem.slice(0, 400) }));
|
|
279
279
|
}
|
|
280
|
-
await ctx.emit("tool", { code: "
|
|
281
|
-
const fixed = await turn(`The final render of
|
|
280
|
+
await ctx.emit("tool", { code: "motionFix" });
|
|
281
|
+
const fixed = await turn(`The final render of video/ failed:\n\n${problem}\n\nFind the cause in the composition's code, fix it, run \`check\` and a draft render through the hyperframes tool until both pass, and end with one line on what you fixed.`, await savedSession(root));
|
|
282
282
|
if (typeof fixed.result === "string" && fixed.result.trim()) {
|
|
283
283
|
summary = `${summary}\n\n${fixed.result.trim()}`.trim();
|
|
284
284
|
}
|
|
@@ -6,7 +6,7 @@ import { env } from "../env.js";
|
|
|
6
6
|
/**
|
|
7
7
|
* The HyperFrames CLI (github.com/heygen-com/hyperframes, Apache 2.0): renders a composition of
|
|
8
8
|
* HTML, CSS and JS to MP4 frame by frame in headless Chrome. Installed once into the data folder
|
|
9
|
-
* on the first
|
|
9
|
+
* on the first video, pinned to a version; Chrome comes with it on its first render.
|
|
10
10
|
*/
|
|
11
11
|
export const HYPERFRAMES_VERSION = "0.8.137";
|
|
12
12
|
const home = join(env.dataDir, "tools", `hyperframes-${HYPERFRAMES_VERSION}`);
|
|
@@ -62,8 +62,8 @@ export async function renderDownload(step, output, format, baseName) {
|
|
|
62
62
|
}
|
|
63
63
|
const name = slug(baseName);
|
|
64
64
|
const file = (ext) => `${name}.${ext}`;
|
|
65
|
-
if ((step.type === "widget" && step.video) || step.type === "
|
|
66
|
-
// A
|
|
65
|
+
if ((step.type === "widget" && step.video) || step.type === "motion-graphics") {
|
|
66
|
+
// A video was rendered when its step ran: the video and its poster are the files.
|
|
67
67
|
const asset = output.assets?.find((a) => a.kind === (format === "mp4" ? "video" : "poster"));
|
|
68
68
|
const found = asset ? await loadAsset(asset.id) : null;
|
|
69
69
|
return found
|