editorbrain 0.45.2 → 0.45.3
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 +2 -2
- package/bin/editorbrain.mjs +36 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,13 +5,13 @@ Editorial references, brand context and portable video projects for Claude Code
|
|
|
5
5
|
Inspect the CLI without configuring your agent:
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npx editorbrain@0.45.
|
|
8
|
+
npx editorbrain@0.45.3 help
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
For a persistent installation:
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
npm install -g editorbrain@0.45.
|
|
14
|
+
npm install -g editorbrain@0.45.3
|
|
15
15
|
editorbrain login --url https://api.editorbrain.com
|
|
16
16
|
editorbrain status --url https://api.editorbrain.com
|
|
17
17
|
editorbrain projects list
|
package/bin/editorbrain.mjs
CHANGED
|
@@ -201979,7 +201979,7 @@ var renderManifestSchema = external_exports.object({
|
|
|
201979
201979
|
projectId: external_exports.string().regex(/^[a-zA-Z0-9_-]{1,80}$/),
|
|
201980
201980
|
engine: renderEngineSchema,
|
|
201981
201981
|
entry: renderPath,
|
|
201982
|
-
blender: external_exports.object({ version: external_exports.literal(RENDER_BLENDER_VERSION), frameStart: external_exports.number().int().min(
|
|
201982
|
+
blender: external_exports.object({ version: external_exports.literal(RENDER_BLENDER_VERSION), frameStart: external_exports.number().int().min(0).max(1e6) }).strict().optional(),
|
|
201983
201983
|
width: external_exports.number().int().min(64).max(3840),
|
|
201984
201984
|
height: external_exports.number().int().min(64).max(3840),
|
|
201985
201985
|
fps: external_exports.number().int().min(1).max(60),
|
|
@@ -201987,12 +201987,14 @@ var renderManifestSchema = external_exports.object({
|
|
|
201987
201987
|
audio: renderPath.optional(),
|
|
201988
201988
|
purpose: external_exports.enum(["preview", "final"]).optional(),
|
|
201989
201989
|
previewQuality: external_exports.union([external_exports.literal(480), external_exports.literal(720)]).optional(),
|
|
201990
|
+
output: external_exports.object({ encoding: external_exports.literal("master-h264-v1") }).strict().optional(),
|
|
201990
201991
|
delivery: external_exports.object({ maxOutputBytes: external_exports.number().int().positive().max(RENDER_MAX_OUTPUT_BYTES) }).strict().optional(),
|
|
201991
|
-
execution: external_exports.object({ workers: external_exports.number().int().min(2).max(
|
|
201992
|
+
execution: external_exports.object({ workers: external_exports.number().int().min(2).max(8), deterministicSeek: external_exports.literal(true), scheduling: external_exports.literal("dynamic-v1").optional() }).strict().optional(),
|
|
201992
201993
|
files: external_exports.array(external_exports.object({ path: renderPath, bytes: external_exports.number().int().positive().max(RENDER_LONG_MAX_BYTES), sha256: external_exports.string().regex(/^[a-f0-9]{64}$/), sourceAssetId: external_exports.string().regex(/^[a-f0-9]{64}$/).optional() }).strict()).min(1).max(256)
|
|
201993
201994
|
}).strict().superRefine((m, c) => {
|
|
201994
201995
|
if (m.width % 2 || m.height % 2) c.addIssue({ code: "custom", message: "H.264 dimensions must be even." });
|
|
201995
201996
|
if (m.previewQuality !== void 0 && m.purpose !== "preview") c.addIssue({ code: "custom", message: "previewQuality requires purpose preview; a final render uses the original composition dimensions." });
|
|
201997
|
+
if (m.output && (m.version !== 2 || m.engine !== "blender-cycles-v1" || m.purpose === "preview")) c.addIssue({ code: "custom", path: ["output", "encoding"], message: "master-h264-v1 requires a version 2 Blender final render. It is 8-bit H.264 at CRF 16, not lossless." });
|
|
201996
201998
|
if (m.purpose === "preview" && Math.min(renderOutput(m).width, renderOutput(m).height) < 64) c.addIssue({ code: "custom", message: "Preview output must be at least 64 pixels on each side; use 720p or an appropriate composition." });
|
|
201997
201999
|
const paths2 = m.files.map((f) => f.path);
|
|
201998
202000
|
if (new Set(paths2).size !== paths2.length) c.addIssue({ code: "custom", message: "Duplicate file paths." });
|
|
@@ -202020,7 +202022,7 @@ function renderSegmentPlan(m) {
|
|
|
202020
202022
|
function renderOutput(m) {
|
|
202021
202023
|
const edge = (m.previewQuality ?? 480) === 480 ? 854 : 1280;
|
|
202022
202024
|
const scale = m.purpose === "preview" ? Math.min(1, edge / Math.max(m.width, m.height)) : 1;
|
|
202023
|
-
return { width: Math.max(2, Math.floor(m.width * scale / 2) * 2), height: Math.max(2, Math.floor(m.height * scale / 2) * 2), scale, purpose: m.purpose ?? "final" };
|
|
202025
|
+
return { width: Math.max(2, Math.floor(m.width * scale / 2) * 2), height: Math.max(2, Math.floor(m.height * scale / 2) * 2), scale, purpose: m.purpose ?? "final", ...m.output ? { encoding: m.output.encoding } : {} };
|
|
202024
202026
|
}
|
|
202025
202027
|
|
|
202026
202028
|
// packages/core/src/index.ts
|
|
@@ -202667,6 +202669,7 @@ import { dirname as dirname2, isAbsolute, join as join2, relative as relative2,
|
|
|
202667
202669
|
// packages/cli/src/client.ts
|
|
202668
202670
|
import { setTimeout as delay } from "node:timers/promises";
|
|
202669
202671
|
var searchErrors = {
|
|
202672
|
+
brand_limit_reached: { status: 409, code: "BRAND_LIMIT_REACHED", hint: "Consulta el l\xEDmite de marcas de este espacio en https://editorbrain.com/app/billing. Puedes seguir editando las existentes. Comprar cr\xE9ditos no aumenta este l\xEDmite." },
|
|
202670
202673
|
invalid_project_intake: { status: 400, code: "INVALID_PROJECT_INTAKE", hint: "Use projects create ID --brand ID --style ID --output-profile ID with existing IDs. The workspace comes from your authenticated account; do not send a workspace ID." },
|
|
202671
202674
|
project_dependency_missing: { status: 404, code: "PROJECT_DEPENDENCY_MISSING", hint: "Read dependencyKind and documentPath. Discover the existing brand with brands list and styles/output profiles with documents list --prefix .editorbrain/styles/ or .editorbrain/output-profiles/. Preserve saved choices; do not invent replacement preferences or select another brand silently." },
|
|
202672
202675
|
project_exists: { status: 409, code: "PROJECT_EXISTS", hint: "This ID belongs to an existing or edited project. Use projects intake --project ID to resume it, or choose a new ID for a separate edit. Never overwrite or delete the existing project to retry creation." },
|
|
@@ -202788,6 +202791,7 @@ function safeDiagnosticDetails(body) {
|
|
|
202788
202791
|
if (e.billingUrl === "https://editorbrain.com/app/billing" || e.billingUrl === "https://editorbrain.com/app/billing#credits") details.billingUrl = e.billingUrl;
|
|
202789
202792
|
if (["render_credit_budget", "render_insufficient_credits"].includes(String(e.code)) && typeof e.requiredCredits === "number" && Number.isFinite(e.requiredCredits) && e.requiredCredits >= 0 && e.requiredCredits <= 1e6) details.requiredCredits = e.requiredCredits;
|
|
202790
202793
|
for (const key of ["limit", "retryAfter"]) if (Number.isSafeInteger(e[key]) && Number(e[key]) >= 0 && Number(e[key]) <= 86400) details[key] = Number(e[key]);
|
|
202794
|
+
if (e.code === "brand_limit_reached" && Number.isSafeInteger(e.used) && Number(e.used) >= 0 && Number(e.used) <= 2e3) details.used = Number(e.used);
|
|
202791
202795
|
if (e.code === "render_queue_full") {
|
|
202792
202796
|
for (const key of ["global", "perUser", "perWorkspace", "pendingGlobal", "pendingPerUser", "pendingPerWorkspace"]) if (Number.isSafeInteger(e[key]) && Number(e[key]) > 0 && Number(e[key]) <= 500) details[key] = Number(e[key]);
|
|
202793
202797
|
}
|
|
@@ -202824,7 +202828,8 @@ var ApiError = class extends CliError {
|
|
|
202824
202828
|
const recovery2 = diagnostic ? recoveryGuidance(diagnostic.serviceCode, status) : void 0;
|
|
202825
202829
|
const details = diagnostic ? safeDiagnosticDetails(body) : {};
|
|
202826
202830
|
const preferenceHint = diagnostic?.serviceCode === "studio_preference_conflict" && details.conflict === "narration" ? 'Read workflow and the returned projectPath/documentPath. Only after an explicit user request, save narrationOverride={value:"voiceover",reason:"user-requested reason"} in this project.json, then choose an authorized public voice with studio voices and studio voice VOICE_ID --project ID --expected-revision N. Preserve the brand. Quote again; a preference exception never authorizes spending.' : diagnostic?.serviceCode === "studio_preference_conflict" && details.conflict === "voice_selection" ? "Read workflow and studio voice --project ID. Reconcile the requested public alias with the authorized saved voice using studio voices; a deliberate change uses studio voice VOICE_ID --project ID --expected-revision N. Preserve original/no-narration restrictions and the brand. Quote again; a voice selection never authorizes spending." : void 0;
|
|
202827
|
-
|
|
202831
|
+
const message = diagnostic?.serviceCode === "brand_limit_reached" ? `Este espacio alcanz\xF3 su l\xEDmite de marcas${typeof details.used === "number" && typeof details.limit === "number" ? ` (${details.used}/${details.limit})` : ""}.` : `API request failed (HTTP ${status}).`;
|
|
202832
|
+
super(diagnostic?.code ?? code, message, recovery2 ? recoveryHint(recovery2) : preferenceHint ?? diagnostic?.hint ?? hint, !diagnostic && safeToRetry && (status === 429 || status >= 500), { status, ...recovery2 ? { recovery: recovery2 } : {}, ...diagnostic ? { serviceCode: diagnostic.serviceCode, ...details } : {}, ...retryAfterMs === void 0 ? {} : { retryAfterMs } });
|
|
202828
202833
|
this.status = status;
|
|
202829
202834
|
this.body = body;
|
|
202830
202835
|
}
|
|
@@ -203015,7 +203020,8 @@ var Client = class {
|
|
|
203015
203020
|
if ((/^\/v1\/(?:authored-motion|style-sources|sfx|team|studio|batches|render-cloud|resources)(?:\/|\?|$)/.test(path) || path.startsWith("/v1/documents/") || path === "/v1/search/brief" || path === "/v1/projects" || /^\/v1\/projects\/[^/]+\/(?:progress|intake|resolve|export)$/.test(path)) && [400, 402, 403, 404, 409, 422, 429, 503].includes(response.status)) {
|
|
203016
203021
|
try {
|
|
203017
203022
|
const parsed = await boundedJson(response, 16 * 1024);
|
|
203018
|
-
const
|
|
203023
|
+
const knownDiagnostic = searchDiagnostic(response.status, parsed);
|
|
203024
|
+
const diagnostic = path.startsWith("/v1/documents/") && !/^\/v1\/documents\/videos\/[^/]+\/project\.json$/.test(path) && knownDiagnostic?.serviceCode !== "brand_limit_reached" ? void 0 : knownDiagnostic;
|
|
203019
203025
|
const voiceRevisionConflict = /^\/v1\/studio\/voice-selection(?:\?|$)/.test(path) && response.status === 409 && parsed?.error?.code === "revision_conflict";
|
|
203020
203026
|
errorBody = diagnostic ? { error: { code: diagnostic.serviceCode, ...safeDiagnosticDetails(parsed) } } : voiceRevisionConflict ? { error: { code: "revision_conflict" } } : path.startsWith("/v1/documents/") ? documentDiagnostic(parsed, path, response.status) : void 0;
|
|
203021
203027
|
} catch {
|
|
@@ -203778,7 +203784,18 @@ async function cloudRenderCommand(client, root, command, id4, flags) {
|
|
|
203778
203784
|
const requireEngine = (engine) => {
|
|
203779
203785
|
if (!(capability.engines ?? ["html-seek-v1"]).includes(engine)) throw new CliError("RENDER_ENGINE_UNAVAILABLE", `Render engine ${engine} is not available for this account. Native Blender projects require an enabled compatible runtime. No media was read or uploaded.`, "Read editorbrain capabilities; continue rendering locally until the requested engine is available. Do not rename a .blend file to .html.");
|
|
203780
203786
|
};
|
|
203781
|
-
const
|
|
203787
|
+
const requireFeatures = (manifest2) => {
|
|
203788
|
+
const unavailable = (feature) => {
|
|
203789
|
+
throw new CliError("RENDER_FEATURE_UNAVAILABLE", `${feature} is not advertised by the active render runtime. No media was read or uploaded.`, "Read editorbrain capabilities. Continue locally or prepare a new manifest with explicitly approved supported settings; do not silently change frames, quality or scheduling.");
|
|
203790
|
+
};
|
|
203791
|
+
if (manifest2.blender?.frameStart === 0 && capability.blender?.minFrameStart !== 0) unavailable("Blender frame 0");
|
|
203792
|
+
if (manifest2.output && !capability.blender?.outputEncodings?.includes(manifest2.output.encoding)) unavailable(manifest2.output.encoding);
|
|
203793
|
+
if (manifest2.execution?.scheduling === "dynamic-v1") {
|
|
203794
|
+
const parallel = capability.parallelRender, maxWorkers = parallel?.dynamicMaxWorkers ?? parallel?.maxWorkers;
|
|
203795
|
+
if (!parallel?.scheduling?.includes("dynamic-v1") || !parallel.dynamicEngines?.includes(manifest2.engine) || !Number.isInteger(maxWorkers) || manifest2.execution.workers > maxWorkers) unavailable("Dynamic rendering for this engine with the requested worker count");
|
|
203796
|
+
} else if (manifest2.execution && manifest2.execution.workers > Math.min(3, capability.parallelRender?.staticMaxWorkers ?? 3)) unavailable("Static rendering with the requested worker count");
|
|
203797
|
+
};
|
|
203798
|
+
const allowed = /* @__PURE__ */ new Set(["dir", "url", ...command === "prepare" ? ["file", "out", "purpose", "quality", "encoding", "frame-start"] : command === "quote" ? ["file", "out", "max-cost-usd", "runtime-seconds"] : command === "submit" ? ["file", "quote-file", "max-credits", "max-cost-usd", "runtime-seconds", "user-confirmed", "grant"] : command === "delivery-delete" ? ["sha256", "bytes", "user-confirmed"] : command === "download" ? ["out"] : command === "preferences" ? ["file", "project"] : command === "plan" || command === "acknowledge" ? ["file"] : command === "upload" ? ["file", "project", "mime", "id"] : command === "grants" ? ["file", "id", "user-confirmed"] : []]);
|
|
203782
203799
|
for (const k of Object.keys(flags)) if (!allowed.has(k)) throw bad(`Unsupported --${k}.`);
|
|
203783
203800
|
if (["upload", "upload-status", "upload-cancel", "preferences", "packages", "plan", "delivery", "delivery-retry", "delivery-delete", "grants", "acknowledge"].includes(command) && !capability.storage) throw new CliError("NOT_AVAILABLE", "Cloud storage is unavailable for this account.", "Read capabilities and continue with available tools; no media was read or uploaded.");
|
|
203784
203801
|
if (command === "grants") {
|
|
@@ -203921,6 +203938,15 @@ async function cloudRenderCommand(client, root, command, id4, flags) {
|
|
|
203921
203938
|
input2.previewQuality = Number(flags.quality);
|
|
203922
203939
|
}
|
|
203923
203940
|
if (flags.purpose === "final") delete input2.previewQuality;
|
|
203941
|
+
if (flags.encoding !== void 0) {
|
|
203942
|
+
if (flags.encoding !== "master-h264-v1") throw bad("Use --encoding master-h264-v1 for a version 2 Blender final render. This is 8-bit H.264 at CRF 16, not lossless.");
|
|
203943
|
+
input2.output = { ...input2.output, encoding: flags.encoding };
|
|
203944
|
+
}
|
|
203945
|
+
if (flags["frame-start"] !== void 0) {
|
|
203946
|
+
const value = flags["frame-start"];
|
|
203947
|
+
if (typeof value !== "string" || !/^\d+$/.test(value) || Number(value) > 1e6 || input2.engine !== "blender-cycles-v1" || !input2.blender) throw bad("--frame-start requires a Blender manifest and an integer from 0 to 1000000. The requested range must fit the source scene.");
|
|
203948
|
+
input2.blender = { ...input2.blender, frameStart: Number(value) };
|
|
203949
|
+
}
|
|
203924
203950
|
if (Array.isArray(input2.files) && input2.files.some((f) => f && typeof f === "object" && Object.hasOwn(f, "sourceAssetId")) && !capability.storage) throw bad("This account does not support cloud asset inputs. Read capabilities; do not download media to bypass the selected cloud-only preference.");
|
|
203925
203951
|
const engine = renderEngineSchema.safeParse(input2.engine);
|
|
203926
203952
|
if (!engine.success) throw bad(engine.error.issues[0].message);
|
|
@@ -203933,7 +203959,7 @@ async function cloudRenderCommand(client, root, command, id4, flags) {
|
|
|
203933
203959
|
else entries.push(typeof f === "object" && f !== null && Object.hasOwn(f, "sourceAssetId") ? { path: result2.data, sourceAssetId: f.sourceAssetId, bytes: f.bytes, sha256: f.sha256 } : { path: result2.data });
|
|
203934
203960
|
}
|
|
203935
203961
|
if (issues.length) throw invalidManifest(flags.file, issues);
|
|
203936
|
-
parseManifest({ ...input2, files: entries.map((f) => Object.hasOwn(f, "sourceAssetId") ? f : { path: f.path, bytes: 1, sha256: "0".repeat(64) }) }, flags.file);
|
|
203962
|
+
requireFeatures(parseManifest({ ...input2, files: entries.map((f) => Object.hasOwn(f, "sourceAssetId") ? f : { path: f.path, bytes: 1, sha256: "0".repeat(64) }) }, flags.file));
|
|
203937
203963
|
const activityContext = await captureRemoteProjectActivity(client, root, String(input2.projectId));
|
|
203938
203964
|
if (capability.storage && input2.purpose === "preview" && input2.previewQuality === void 0) {
|
|
203939
203965
|
const settings = await client.request("/v1/render-cloud/preferences?" + new URLSearchParams({ projectId: String(input2.projectId) }));
|
|
@@ -203953,10 +203979,11 @@ async function cloudRenderCommand(client, root, command, id4, flags) {
|
|
|
203953
203979
|
const transfer = caps.capabilities.find((x) => x.id === "private-cloud-render")?.inputTransfer;
|
|
203954
203980
|
const inputTransport2 = transfer?.transport === "multipart-v1" && transfer.partBytes === 8 * 1024 * 1024 && files.some((f) => !("sourceAssetId" in f) && f.bytes >= transfer.partBytes) ? "multipart-v1" : "chunks-v1";
|
|
203955
203981
|
await atomicWrite(root, out, JSON.stringify({ id: randomUUID3(), manifest: manifest2, inputTransport: inputTransport2 }, null, 2), { document: false, overwrite: false, mode: 384 });
|
|
203956
|
-
return { path: out, files: files.length, localFiles: files.filter((f) => !("sourceAssetId" in f)).length, cloudFiles: files.filter((f) => "sourceAssetId" in f).length, bytes: files.reduce((n, f) => n + f.bytes, 0), uploaded: false, registration: await recordProjectActivity(activityContext, { kind: "render_prepared", files: [out] }), next: capability.storage ? "Run render-cloud plan with this prepared file to check saved storage preferences and cloud input access; then quote. Cloud asset metadata is rechecked by the server without downloading media locally. Review credits and expiry before approved submission." : "Request render-cloud quote with this prepared file; review credits and expiry, then obtain approval before submit." };
|
|
203982
|
+
return { path: out, files: files.length, localFiles: files.filter((f) => !("sourceAssetId" in f)).length, cloudFiles: files.filter((f) => "sourceAssetId" in f).length, bytes: files.reduce((n, f) => n + f.bytes, 0), uploaded: false, ...manifest2.output ? { outputEncoding: { name: manifest2.output.encoding, codec: "H.264", crf: 16, bitDepth: 8, lossless: false, sizeGuidance: "CRF does not guarantee a file size. Limits remain 64 MiB per checkpoint and 2 GiB total, subject to the approved delivery ceiling. Measure a representative sample; do not silently lower quality." } } : {}, registration: await recordProjectActivity(activityContext, { kind: "render_prepared", files: [out] }), next: capability.storage ? "Run render-cloud plan with this prepared file to check saved storage preferences and cloud input access; then quote. Cloud asset metadata is rechecked by the server without downloading media locally. Review credits and expiry before approved submission." : "Request render-cloud quote with this prepared file; review credits and expiry, then obtain approval before submit." };
|
|
203957
203983
|
}
|
|
203958
203984
|
const manifest = parseManifest(input2.manifest, flags.file);
|
|
203959
203985
|
requireEngine(manifest.engine);
|
|
203986
|
+
requireFeatures(manifest);
|
|
203960
203987
|
if (command === "plan") return client.request("/v1/render-cloud/plan", { method: "POST", body: { manifest } });
|
|
203961
203988
|
if (manifest.engine === "blender-cycles-v1" && flags["runtime-seconds"] === void 0) throw bad("Native Blender requires an explicit --runtime-seconds based on a representative render at the requested settings. Use the same runtime for quote and submit; animation duration does not estimate Cycles render time.");
|
|
203962
203989
|
const maxCostUsd = Number(flags["max-cost-usd"] ?? (manifest.version === 2 ? 5 : 0.5)), runtimeSeconds = Number(flags["runtime-seconds"] ?? (manifest.version === 2 ? Math.min(RENDER_MAX_RUNTIME_SECONDS, Math.ceil(manifest.durationSeconds * 2 + 600)) : 600));
|
|
@@ -215954,7 +215981,7 @@ function parseArgs(argv) {
|
|
|
215954
215981
|
known.add("expected-version");
|
|
215955
215982
|
known.add("lease-token");
|
|
215956
215983
|
known.add("batch-lease-token");
|
|
215957
|
-
if (argv[0] === "render-cloud") for (const flag2 of ["max-cost-usd", "runtime-seconds", "quote-file", "grant", "bytes"]) known.add(flag2);
|
|
215984
|
+
if (argv[0] === "render-cloud") for (const flag2 of ["max-cost-usd", "runtime-seconds", "quote-file", "grant", "bytes", "encoding", "frame-start"]) known.add(flag2);
|
|
215958
215985
|
if (argv[0] === "team") for (const flag2 of ["email", "user", "at-ms"]) known.add(flag2);
|
|
215959
215986
|
for (const flag2 of ["language", "accent", "gender"]) known.add(flag2);
|
|
215960
215987
|
for (let i = 0; i < argv.length; i++) {
|