-
- {t("editors.stage.ui.renderDone", {
- width: outputSize.width,
- height: outputSize.height,
- })}
-
+ const block = await onAppendStoryboard({
+ cameraId,
+ blockId: crypto.randomUUID(),
+ savedDraft: draftDirty,
+ });
+ if (!active.current) return;
+ // The user may have kept editing while the command was in flight: the block is
+ // merged onto the draft as it is now, never onto a copy from before.
+ installHistory(
+ commitStageHistory(
+ history.current,
+ mergeStageStoryboardBlock(stageRef.current, block, t),
+ ),
+ );
+ // The project now holds the committed stage plus the stored block.
+ committedStage.current = mergeStageStoryboardBlock(
+ committedStage.current ?? loadedStage.current,
+ block,
+ t,
+ );
+ // The new block is the selected one and its camera the selected camera; the
+ // playhead jumps to the block's start. None of this writes the document.
+ selectStoryboardBlock(block.id, block.cameraId);
+ setPlayhead(block.start);
+ } catch (reason) {
+ if (active.current)
+ setError(
+ reason instanceof Error
+ ? reason.message
+ : t("editors.stage.ui.editFailed"),
+ );
+ } finally {
+ storyboardAppendingRef.current = false;
+ if (active.current) setStoryboardAppending(false);
+ }
+ };
+ const commitStoryboardEdit = async (
+ operation: StageCutEdit,
+ block: StageShot | undefined,
+ before: readonly StageShot[],
+ ) => {
+ if (!onEditStoryboard || storyboardEditPendingRef.current ||
+ storyboardAppendingRef.current || !sameStageStoryboard(stageRef.current.shots, before)) {
+ previewStoryboard(null);
+ return;
+ }
+ storyboardEditPendingRef.current = true;
+ setStoryboardEditPending(true);
+ setError("");
+ // A drag to another place ends here. The blocks now lie in their new order, and
+ // the playhead goes with the block that was dragged, to where it starts now: once,
+ // in the same frame as that order. It is view state and reaches no command. The
+ // time is not snapped: what it would be snapped to is the stored boundaries, the
+ // very ones this order moves.
+ const landing = operation.type === "reorder" && block
+ ? packStageStoryboard(before, operation.blockIds)
+ .find((shot) => shot.id === block.id)?.start
+ : undefined;
+ /** Where the playhead stood before it followed the drag, for a save that fails. */
+ const playheadBefore = landing === undefined ? undefined : timeRef.current;
+ if (landing !== undefined) {
+ setPlaying(false);
+ setTime(landing);
+ }
+ try {
+ const saved = committedStage.current ?? loadedStage.current;
+ const starting = stageRef.current;
+ const deleting = operation.type === "deleteCamera" || operation.type === "delete";
+ const needsDraft = deleting || operation.type === "setDuration"
+ ? dirtyRef.current
+ : starting.duration !== saved.duration || !sameStageStoryboard(starting.shots, saved.shots);
+ const draftData = needsDraft
+ ? { localStage: parseLocalStageValue(starting, t), stills }
+ : undefined;
+ const receipt = await onEditStoryboard({ ...operation, before, draft: draftData });
+ if (!active.current) return;
+ const cameraId = operation.type === "deleteCamera" ? operation.cameraId : null;
+ const basis = needsDraft ? starting : saved;
+ const applyReceipt = (stage: LocalStageDocument): LocalStageDocument => ({
+ ...stage,
+ shots: receipt.shots,
+ duration: receipt.durationChange?.appliedDuration ?? stage.duration,
+ ...(cameraId ? { cameras: stage.cameras.filter((camera) => camera.id !== cameraId) } : {}),
+ activeCameraId: stage.activeCameraId === basis.activeCameraId || stage.activeCameraId === cameraId
+ ? receipt.activeCameraId : stage.activeCameraId,
+ cameraSource: stage.cameraSource === basis.cameraSource || !receipt.shots.length
+ ? receipt.cameraSource : stage.cameraSource,
+ });
+ committedStage.current = applyReceipt(basis);
+ if (needsDraft) committedStills.current = stills;
+ // Keep unrelated draft changes made while the command was in flight.
+ const draft = stageRef.current;
+ if (sameStageStoryboard(draft.shots, before)) {
+ installHistory(
+ commitStageHistory(history.current, applyReceipt(draft)),
+ deleting ? "delete" : undefined,
+ );
+ if (operation.type === "reorder" && block) {
+ selectStoryboardBlock(block.id, block.cameraId);
+ // The playhead went to where the drag would start the block from, read from
+ // the Storyboard as it was. The server says where it stored the block: where
+ // that is another time, and the user has not moved the playhead since, the
+ // playhead follows the block there. The user's own move always wins.
+ const stored = receipt.shots.find((shot) => shot.id === block.id);
+ if (stored && landing !== undefined && stored.start !== landing &&
+ timeRef.current === landing)
+ setTime(stored.start);
+ }
+ if (receipt.durationChange) {
+ const { requestedDuration, appliedDuration, clampReason } = receipt.durationChange;
+ setDurationNotice(clampReason === "storyboard_end"
+ ? t("editors.stage.ui.stageDurationClamped", { requested: requestedDuration, applied: appliedDuration })
+ : "");
+ }
+ } else if (playheadBefore !== undefined) {
+ // The draft's Storyboard was changed elsewhere while the command was in flight,
+ // so this order is not the one the draft holds now. As when nothing was saved,
+ // the playhead goes back to where it stood before the drag ended.
+ setTime(playheadBefore);
+ }
+ } catch (reason) {
+ if (active.current) {
+ setError(reason instanceof Error ? reason.message : t("editors.stage.ui.editFailed"));
+ // Nothing was saved. The blocks are back in their stored order, and the
+ // playhead goes back with them, to where it stood before the drag ended.
+ if (playheadBefore !== undefined) setTime(playheadBefore);
+ }
+ } finally {
+ storyboardEditPendingRef.current = false;
+ if (active.current) {
+ previewStoryboard(null);
+ setStoryboardEditPending(false);
+ }
+ }
+ };
+ const requestClose = () => {
+ if (storyboardAppendingRef.current || storyboardEditPendingRef.current) return;
+ if (dirty && !commit.saving) setConfirmingClose(true);
+ else commit.close();
+ };
+ const treeNeedle = treeQuery.trim().toLocaleLowerCase();
+ const matchesTreeQuery = (name: string) =>
+ !treeNeedle || name.toLocaleLowerCase().includes(treeNeedle);
+ const sceneTree = (
+
+
+ {t("editors.stage.ui.objectTreeTitle")}
+
+
+
+
+ {(
+ [
+ ["characters", isCharacter, stage.objects.filter(isCharacter)],
+ ["objects", isProp, stage.objects.filter(isProp)],
+ ] as const
+ ).map(([group, _match, items]) => (
+
+
setView({ type: "toggleTreeGroup", group })}
+ >
+
+ {t(
+ `editors.stage.ui.tab${group[0]!.toUpperCase()}${group.slice(1)}` as never,
+ )}
+ {` (${items.length})`}
+
+ {treeGroups[group] &&
+ items
+ .filter((item) => matchesTreeQuery(item.name))
+ .map((item) => (
+
+ setSelected(item.id)}
+ >
+
+ {item.name}
+
+ focusObject(item.id)}
+ >
+ ◎
+
+
+ ))}
+
+ ))}
+
+
setView({ type: "toggleTreeGroup", group: "cameras" })}
+ >
+
+ {t("editors.stage.ui.tabCameras")}
+ {` (${stage.cameras.length})`}
+
+ {treeGroups.cameras &&
+ stage.cameras
+ .filter((rig) => matchesTreeQuery(rig.name))
+ .map((rig) => (
+
+ {
+ setSelectedCamera(rig.id);
+ edit((current) => ({
+ ...current,
+ activeCameraId: rig.id,
+ }));
+ followCameraRow(rig.id);
+ }}
+ >
+ {rig.name}
+
+
+ ))}
+
+
+
+
+ );
+ return (
+
{
+ if (event.target === event.currentTarget) requestClose();
+ }}
+ >
+
{
+ if (!viewMenu) return;
+ const target = event.target;
+ if (!(target instanceof Node)) return;
+ if (
+ viewMenuRef.current?.contains(target) ||
+ viewSettingsButtonRef.current?.contains(target)
+ )
+ return;
+ setViewMenu(false);
+ }}
+ onKeyDown={(event) => {
+ event.stopPropagation();
+ if (event.key === "Escape") {
+ event.preventDefault();
+ if (storyboardChooserOpen) setStoryboardChooserOpen(false);
+ else if (pendingPlacementRef.current) setPendingKind(null);
+ else requestClose();
+ }
+ if (event.key === "Tab") {
+ const elements = [
+ ...(consoleRef.current?.querySelectorAll
(
+ 'button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]',
+ ) ?? []),
+ ];
+ const first = elements[0],
+ last = elements.at(-1);
+ if (!first || !last) {
+ event.preventDefault();
+ return;
+ }
+ if (
+ event.shiftKey &&
+ (document.activeElement === first ||
+ document.activeElement === consoleRef.current)
+ ) {
+ event.preventDefault();
+ last.focus();
+ }
+ if (
+ !event.shiftKey &&
+ (document.activeElement === last ||
+ document.activeElement === consoleRef.current)
+ ) {
+ event.preventDefault();
+ first.focus();
+ }
+ }
+ }}
+ >
+ {/* The 3D frame is the base layer; every panel floats above it. */}
+
+
+
setView({ type: "setGizmo", gizmo: "select" })}
+ >
+ {t("editors.stage.ui.gizmoSelect")}
+
+ {(["translate", "rotate", "scale"] as const).map((axis) => (
+
+ setView({ type: "setGizmo", gizmo: axis })
+ }
+ >
+ {t(
+ axis === "translate"
+ ? "editors.stage.ui.gizmoMove"
+ : axis === "rotate"
+ ? "editors.stage.ui.gizmoRotate"
+ : "editors.stage.ui.gizmoScale",
+ )}
+
+ ))}
+
+ {t("editors.stage.ui.gizmoDropGround")}
+
+
+
setView({ type: "toggleViewMenu" })}
+ >
+ {t("editors.stage.ui.viewSettings")}
+
+ {viewMenu && (
+
{
+ if (event.key === "Escape") {
+ event.stopPropagation();
+ event.preventDefault();
+ setViewMenu(false);
+ }
+ }}
+ >
+ {(
+ [
+ ["ground", "viewGround"],
+ ["grid", "viewGrid"],
+ ["motionPaths", "viewMotionPaths"],
+ ["objectNames", "viewObjectNames"],
+ ["heightGuides", "viewHeightGuides"],
+ ["aspectMask", "aspectMask"],
+ ["viewIndicator", "viewIndicator"],
+ ] as const
+ ).map(([flag, label]) => (
+
+
+ setView({
+ type: "setViewFlag",
+ flag,
+ enabled: event.target.checked,
+ })
+ }
+ />
+ {t(`editors.stage.ui.${label}` as never)}
+
+ ))}
+
+ )}
+
+ {object?.keyframes.length ? (
+
+ {t("editors.stage.ui.gizmoAnimatedHint")}
+
+ ) : null}
+
+ {viewfinder && (
+
+
+ {t("editors.stage.ui.viewfinderFov")}
+ {
+ liveFov.current = Number(
+ (event.target as HTMLInputElement).value,
+ );
+ }}
+ onPointerUp={commitLiveFov}
+ onKeyUp={commitLiveFov}
+ />
+
+
+ )}
+ {viewFlags.aspectMask && (
+
+ )}
+ {selected && (
+
+
+ {t("editors.stage.ui.duplicateObject")}
+
+ item.id === selected)?.locked}
+ onClick={removeObject}
+ >
+ {t("editors.stage.ui.deleteObject")}
+
+
+ )}
+ {pendingKind && (
+
+ {t("editors.stage.ui.placeHint", {
+ name: t(titles[pendingKind]),
+ })}
+
+ )}
+
+
+ {
+ const frame = pipFrameRef.current;
+ if (!frame || event.button !== 0 || pipDrag.current) return;
+ event.preventDefault();
+ event.currentTarget.setPointerCapture(event.pointerId);
+ pipDrag.current = {
+ pointerId: event.pointerId,
+ x: event.clientX - frame.offsetLeft,
+ y: event.clientY - frame.offsetTop,
+ };
+ }}
+ onPointerMove={(event) => {
+ const drag = pipDrag.current;
+ const frame = pipFrameRef.current;
+ if (!frame || drag?.pointerId !== event.pointerId) return;
+ frame.style.setProperty("--stage-pip-x", `${event.clientX - drag.x}px`);
+ frame.style.setProperty("--stage-pip-y", `${event.clientY - drag.y}px`);
+ }}
+ onLostPointerCapture={(event) => {
+ if (pipDrag.current?.pointerId === event.pointerId) pipDrag.current = null;
+ }}
+ onKeyDown={(event) => {
+ const frame = pipFrameRef.current;
+ if (!frame) return;
+ const x = event.key === "ArrowLeft" ? -8 : event.key === "ArrowRight" ? 8 : 0;
+ const y = event.key === "ArrowUp" ? -8 : event.key === "ArrowDown" ? 8 : 0;
+ if (!x && !y) return;
+ event.preventDefault();
+ event.stopPropagation();
+ frame.style.setProperty("--stage-pip-x", `${frame.offsetLeft + x}px`);
+ frame.style.setProperty("--stage-pip-y", `${frame.offsetTop + y}px`);
+ }}
+ >
+
+
+ {!cameraPreview && (
+ {t("editors.stage.ui.cameraPreview")}
+ )}
+ setView({ type: "toggleCameraPreview" })}
+ >
+
+
+
+
+ {splitView && (
+ <>
+ {/* The divider owns its pointer stream; the renderer below
+ * reads the ratio every frame. */}
+ {
+ event.currentTarget.setPointerCapture(event.pointerId);
+ }}
+ onPointerMove={(event) => {
+ if (!event.currentTarget.hasPointerCapture(event.pointerId))
+ return;
+ const bounds = mount.current?.getBoundingClientRect();
+ if (!bounds) return;
+ const next =
+ (event.clientX - bounds.left) / bounds.width;
+ setSplitRatio(next);
+ }}
+ onKeyDown={(event) => {
+ // Arrow keys nudge the split for keyboard users.
+ if (event.key === "ArrowLeft")
+ setSplitRatio(splitRatio - 0.05);
+ if (event.key === "ArrowRight")
+ setSplitRatio(splitRatio + 0.05);
+ }}
+ />
+
+ {stage.shots.length ? (
+ setSplitCameraId(null)}
+ >
+ {t("editors.stage.ui.exportSourceStoryboard")}
+
+ ) : null}
+ {stage.cameras.map((rig) => (
+ setSplitCameraId(rig.id)}
+ >
+ {rig.name}
+
+ ))}
+ setView({ type: "closeSplit" })}
+ >
+ {t("editors.stage.ui.splitExit")}
+
+
+ >
+ )}
+ {drawerOpen && (
+
+ )}
+ {renderProgress !== null && (
+
+
+
+ {t("editors.stage.ui.renderProgress", {
+ percent: Math.round(renderProgress * 100),
+ })}
+
+
exporting.current?.abort()}>
+ {t("editors.stage.ui.cancelRender")}
+
+
+ )}
+
+
+
+
+ {t("editors.stage.ui.brand")}
+
+
+
+ setView({ type: "toggleHelp" })}
+ >
+ {t("editors.stage.ui.shortcuts")}
+
+ navigate("undo")}
+ >
+ {t("editors.stage.ui.undo")}
+
+ navigate("redo")}
+ >
+ {t("editors.stage.ui.redo")}
+
+ importInput.current?.click()}
+ >
+ {t("editors.stage.ui.importJson")}
+
+ {
+ // Exports carry no model bytes: an import that exists only as a
+ // browser URL would become an unopenable object, so name it.
+ const unsaved = stageRef.current.objects.filter(
+ (object) => object.kind === "gltf" && !object.asset,
+ );
+ if (unsaved.length) {
+ setError(
+ t("editors.stage.ui.exportUnsavedImports", {
+ names: unsaved.map((object) => object.name).join(", "),
+ }),
+ );
+ return;
+ }
+ download(
+ JSON.stringify(
+ {
+ ...stageRef.current,
+ objects: stageRef.current.objects.map(
+ ({ source: _source, ...object }) => object,
+ ),
+ },
+ null,
+ 2,
+ ),
+ `${node.data.title || "director-stage"}.stage.json`,
+ "application/json",
+ );
+ }}
+ >
+ {t("editors.stage.ui.exportJson")}
+
+
+ {t(dirty ? "editors.stage.ui.unsavedChip" : "editors.stage.ui.savedChip")}
+
+
+
+ {
+ setView({ type: "setPreviewMode", mode: "static" });
+ setPlaying(false);
+ }}
+ >
+ {t("editors.stage.ui.previewModeStatic")}
+
+ {
+ setView({ type: "setPreviewMode", mode: "dynamic" });
+ setPlaying(false);
+ }}
+ >
+ {t("editors.stage.ui.previewModeDynamic")}
+
+
+
+ {t("editors.stage.ui.renderMp4")}
+
+ void captureStill()}
+ >
+
+
+ setView({ type: "toggleDrawer" })}
+ >
+
+
+
+
+
+
+ {
+ if (!viewfinder) liveFov.current = null;
+ setView({ type: "toggleViewfinder" });
+ }}
+ >
+ {t("editors.stage.ui.viewfinder")}
+
+
+ setView({ type: "toggleViewFlag", flag: "aspectMask" })
+ }
+ >
+ {t("editors.stage.ui.aspectMask")}
+
+
+
+ {t("common.cancel")}
+
+ commit.apply(applyEdits)}
+ >
+ {t("editors.modal.apply")}
+
+
+ ×
+
+
+
+ {(commit.error || error) && (
+
+ {commit.error || error}
+
+ )}
+ {rendered && (
+
+
+ {t("editors.stage.ui.renderDone", {
+ width: renderedAt?.width ?? outputSize.width,
+ height: renderedAt?.height ?? outputSize.height,
+ fps: renderedAt?.fps ?? 30,
+ })}
+
@@ -1013,453 +5722,528 @@ export function DirectorStage({
)}
-
-
-
-
-
-
+
+
+ {t("editors.stage.ui.assetLibrary")}
+
+
+ {(["characters", "objects", "cameras", "background"] as const).map(
+ (tab) => {
+ const label = t(
+ `editors.stage.ui.tab${tab[0]!.toUpperCase()}${tab.slice(1)}` as never,
+ );
+ return (
{
- if (time >= stage.duration) setTime(0);
- setPlaying((current) => !current);
+ setLeftTab(tab);
+ if (tab === "background") setSelected(null);
}}
>
- {playing
- ? t("editors.stage.ui.pause")
- : t("editors.stage.ui.playAction")}
+
+
+
+ {label}
-
- {t("editors.stage.ui.time", {
- time: time.toFixed(2),
- duration: stage.duration.toFixed(2),
+ );
+ },
+ )}
+
+
+ {(leftTab === "characters" || leftTab === "objects") && (
+ <>
+ {
+ setAssetRole(leftTab === "characters" ? "character" : "scene");
+ assetInput.current?.click();
+ }}
+ >
+ + {t("editors.stage.ui.importAsset")}
+
+ {assetNotice && (
+
+ {assetNotice}
+
+ )}
+
+ {placementCards
+ .filter((item) =>
+ item.name.toLocaleLowerCase().includes(
+ assetQuery.trim().toLocaleLowerCase(),
+ ),
+ )
+ .map((item) => {
+ const sourceObjectId = stage.objects.some(
+ (candidate) => candidate.id === item.id,
+ )
+ ? item.id
+ : null;
+ const armed =
+ pendingKind === item.kind &&
+ pendingPlacementSourceId === sourceObjectId;
+ return (
+
+ setPendingKind(
+ armed ? null : item.kind,
+ armed ? null : sourceObjectId,
+ )
+ }
+ >
+
+
+
+ {item.name}
+
+
+ );
})}
-
-
- {t("editors.stage.ui.totalDuration")}
-
- edit((current) => ({
- ...current,
- duration: Number(event.target.value),
- }))
- }
- />
-
-
- {t("editors.stage.ui.recordKeyframe")}
-
- {
- setPlaying(false);
- setTime(Number(event.target.value));
- }}
- />
-
- {frameTimes.map((frame) => (
-
+
+ {t("editors.stage.ui.assetPlacementHint")}
+
+ >
+ )}
+ {leftTab === "cameras" && (
+ <>
+
+ {t("editors.stage.ui.addCamera")}
+
+
+ {stage.cameras.map((rig) => (
+
{
- setPlaying(false);
- setTime(frame);
+ edit((current) => ({
+ ...current,
+ activeCameraId: rig.id,
+ }));
+ followCameraRow(rig.id);
}}
>
- {frame.toFixed(2)}s
+ {rig.name}
- edit((current) => removeStageFrame(current, frame))
- }
+ title={t("editors.stage.ui.splitPreview", {
+ name: rig.name,
+ })}
+ onClick={() => {
+ setView({ type: "openSplit", cameraId: rig.id });
+ }}
>
- ×
+ ↗
))}
- {!frameTimes.length && (
-
- {t("editors.stage.ui.keyframeHint")}
-
+
+
{t("editors.stage.ui.cameraPresets")}
+
+ {(Object.keys(CAMERA_PRESETS) as CameraPresetId[]).map(
+ (preset) => (
+ applyCameraPreset(preset)}>
+ {t(`editors.stage.ui.preset.${preset}` as never)}
+
+ ),
)}
-
- {t("editors.stage.ui.storyboard")}
-
- {t("editors.stage.ui.addShot")}
+ {t("editors.stage.ui.cameraMoves")}
+
+ {t("editors.stage.ui.cameraHint")}
+
+ >
+ )}
+ {leftTab === "background" && (
+
+
+ {(["all", "panoramic", "flat"] as const).map((filter) => (
+ setBackgroundFilter(filter)}
+ >
+ {t(`editors.stage.ui.backgroundFilter.${filter}` as never)}
+
+ ))}
+
+
+ {t("editors.stage.ui.backgroundMine")}
+ backgroundInput.current?.click()}
+ >
+ +
+ {backgroundImporting
+ ? t("editors.stage.ui.backgroundImporting")
+ : t("editors.stage.ui.backgroundAdd")}
-
- {t("editors.stage.ui.shotHint")}
-
- {stage.shots.map((shot, index) => (
-
-
- {t("editors.stage.ui.shot", { number: index + 1 })}
-
- updateShot(shot.id, { cameraId: event.target.value })
+ {backgroundNotice && (
+
+ {backgroundNotice}
+
+ )}
+
+
+ {t("editors.stage.ui.backgroundCanvasImages")}
+ {visibleBackgroundAssets.length ? (
+
+ {visibleBackgroundAssets.map((asset) => (
+
- {stage.cameras.map((camera) => (
-
- {camera.name}
-
- ))}
-
-
-
- {t("editors.stage.ui.startSeconds")}
-
- updateShot(shot.id, {
- start: Number(event.target.value),
- })
+ onClick={() =>
+ edit((current) => ({
+ ...current,
+ environment: {
+ ...current.environment,
+ backgroundAsset: assetReference(asset),
+ },
+ }))
}
- />
-
-
- {t("editors.stage.ui.durationSeconds")}
-
- updateShot(shot.id, {
- duration: Number(event.target.value),
- })
- }
- />
-
- {
- setPlaying(false);
- setTime(shot.start);
- edit((current) => ({
- ...current,
- cameraSource: "storyboard",
- }));
- }}
- >
- {t("editors.stage.ui.locate")}
-
-
- edit((current) => ({
- ...current,
- shots: current.shots.filter(
- (item) => item.id !== shot.id,
- ),
- }))
- }
- >
- {t("editors.stage.ui.deleteShot", {
- number: index + 1,
- })}
-
+ >
+
+ {asset.name}
+
+ ))}
- ))}
+ ) : (
+
+
+
+
+
+ {(backgroundAssets ?? []).length
+ ? t("editors.stage.ui.backgroundNoMatches")
+ : t("editors.stage.ui.backgroundEmpty")}
+
+
+ )}
-
-
-
- {object
- ? t("editors.stage.ui.transform")
- : t("editors.stage.ui.camera")}
-
+
+ )}
+
+ beginLayoutResize("left", event)}
+ onPointerMove={(event) => updateLayoutResize("left", event)}
+ onPointerUp={endLayoutResize}
+ onPointerCancel={endLayoutResize}
+ onKeyDown={(event) => nudgeLayoutResize("left", event)}
+ />
+
+ {sceneTree}
+
+
+ {t("editors.stage.ui.properties")}
+
+
{object && (
- <>
-
- {t("editors.stage.ui.name")}
-
- editObject({ name: event.target.value })
- }
- />
-
-
- {t("editors.stage.ui.material")}
-
- editObject({ color: event.target.value })
- }
- />
-
- {object.kind === "person" && (
-
- {t("editors.stage.ui.motionClips")}
-
- {t("editors.stage.ui.addMotion")}
-
-
- {t("editors.stage.ui.motionHint")}
-
- {object.motionClips.map((clip, index) => (
-
-
- {t("editors.stage.ui.motion", {
+
+
+
+
+
+ editObject({ name: event.target.value })
+ }
+ />
+
+ {object.kind !== "gltf" && (
+ editObject({ color })} />
+ )}
+
+ {object.kind === "gltf" && (
+
+ {object.role === "character"
+ ? t("editors.stage.ui.assetCharacter")
+ : t("editors.stage.ui.assetScene")}
+ {" · "}
+ {object.hasAnimation
+ ? t("editors.stage.ui.assetImported", {
+ name: object.name,
+ animationCount: object.animationNames?.length ?? 0,
+ })
+ : t("editors.stage.ui.assetImportedStatic", {
+ name: object.name,
+ })}
+
+ )}
+ {(object.kind === "person" ||
+ (object.kind === "gltf" &&
+ object.role === "character" &&
+ object.hasAnimation)) && (
+
+
+
+ {t("editors.stage.ui.addMotion")}
+
+
+ {t("editors.stage.ui.motionHint")}
+
+ {object.motionClips.map((clip, index) => (
+
- updateClip(clip.id, {
- motion: {
- ...clip.motion,
- preset: event.target
- .value as keyof typeof STAGE_MOTIONS,
- },
- })
- }
- >
- {Object.entries(STAGE_MOTIONS).map(
- ([id, label]) => (
-
- {t(label)}
-
- ),
- )}
-
-
-
- {t("editors.stage.ui.startSeconds")}
-
- updateClip(clip.id, {
- start: Number(event.target.value),
- })
- }
- />
-
-
- {t("editors.stage.ui.durationSeconds")}
-
- updateClip(clip.id, {
- duration: Number(event.target.value),
- })
- }
- />
-
-
- {t("editors.stage.ui.speed")}
-
- updateClip(clip.id, {
- motion: {
- ...clip.motion,
- speed: Number(event.target.value),
- },
- })
- }
- />
-
-
- {t("editors.stage.ui.amplitude")}
-
- updateClip(clip.id, {
- motion: {
- ...clip.motion,
- amount: Number(event.target.value),
- },
- })
- }
- />
-
- {
- setPlaying(false);
- setTime(clip.start);
- }}
- >
- {t("editors.stage.ui.locate")}
-
-
- editObject({
- motionClips: object.motionClips.filter(
- (item) => item.id !== clip.id,
- ),
- })
- }
>
- {t("editors.stage.ui.deleteMotion", {
- number: index + 1,
- })}
-
-
- ))}
-
+
+
+ {t("editors.stage.ui.motion", {
+ number: index + 1,
+ })}
+
+ updateClip(clip.id, {
+ motion: {
+ ...clip.motion,
+ preset: event.target
+ .value as keyof typeof STAGE_MOTIONS,
+ },
+ })
+ }
+ >
+ {Object.entries(STAGE_MOTIONS).map(
+ ([id, label]) => (
+
+ {t(label)}
+
+ ),
+ )}
+
+
+
+ previewClip(clip.id, { start })
+ }
+ onCommit={(start) =>
+ commitClip(clip.id, { start })
+ }
+ />
+
+ previewClip(clip.id, { duration })
+ }
+ onCommit={(duration) =>
+ commitClip(clip.id, { duration })
+ }
+ />
+
+ previewClip(clip.id, {
+ motion: { ...clip.motion, speed },
+ })
+ }
+ onCommit={(speed) =>
+ commitClip(clip.id, {
+ motion: { ...clip.motion, speed },
+ })
+ }
+ />
+
+ previewClip(clip.id, {
+ motion: { ...clip.motion, amount },
+ })
+ }
+ onCommit={(amount) =>
+ commitClip(clip.id, {
+ motion: { ...clip.motion, amount },
+ })
+ }
+ />
+ {
+ setPlaying(false);
+ setTime(clip.start);
+ }}
+ >
+ {t("editors.stage.ui.locate")}
+
+
+ editObject({
+ motionClips: object.motionClips.filter(
+ (item) => item.id !== clip.id,
+ ),
+ })
+ }
+ >
+ {t("editors.stage.ui.deleteMotion", {
+ number: index + 1,
+ })}
+
+
+
+ ))}
+
+
)}
editObject({ position })}
+ onPreviewChange={(position) => previewObject({ position })}
+ onDragStart={beginValueDrag}
+ onDragCancel={cancelValueDrag}
/>
editObject({ rotation })}
+ onPreviewChange={(rotation) => previewObject({ rotation })}
+ onDragStart={beginValueDrag}
+ onDragCancel={cancelValueDrag}
/>
editObject({ scale })}
+ onPreviewChange={(scale) => previewObject({ scale })}
+ onDragStart={beginValueDrag}
+ onDragCancel={cancelValueDrag}
/>
-
+
{t("editors.stage.ui.deleteObject")}
- >
+
+
)}
-
- {t("editors.stage.ui.cameraLabel")}{" "}
- {
- stage.cameras.find((camera) => camera.id === sampled.cameraId)
- ?.name
+ {/* The preview source is a view choice rather than a property of the
+ selected subject or camera, so it stays reachable either way. */}
+
+
+
+ {previewSourceSelect}
+
+
+
+ {selectedCamera && cameraValue && (
+
+
-
- {t("editors.stage.ui.editCamera")}
+ >
+
+
- edit((current) => ({
- ...current,
- activeCameraId: event.target.value,
- cameraSource: "camera",
- }))
- }
+ value={selectedCamera.id}
+ // Which camera the inspector edits is a selection and nothing else: it
+ // writes no document, and it does not choose what the preview shows.
+ onChange={(event) => setSelectedCamera(event.target.value)}
>
{stage.cameras.map((camera) => (
@@ -1467,44 +6251,42 @@ export function DirectorStage({
))}
-
-
- {t("editors.stage.ui.cameraNameAria")}
+
+
camera.id === sampled.cameraId,
- )?.name ?? ""
- }
+ value={selectedCamera.name}
onChange={(event) =>
edit((current) => ({
...current,
cameras: current.cameras.map((camera) =>
- camera.id === sampled.cameraId
+ camera.id === selectedCamera.id
? { ...camera, name: event.target.value }
: camera,
),
}))
}
/>
-
+
+
{t("editors.stage.ui.copyCamera")}
{t("editors.stage.ui.deleteCamera")}
-
- {t("editors.stage.ui.outputAspect")}
+
+
))}
-
-
- {t("editors.stage.ui.source")}
-
- edit((current) => ({
- ...current,
- cameraSource: event.target
- .value as LocalStageDocument["cameraSource"],
- }))
- }
- >
-
- {t("editors.stage.ui.currentCamera")}
-
-
- {t("editors.stage.ui.storyboardCut")}
-
-
-
+
+
editCamera({ position })}
+ onPreviewChange={(position) => previewCamera({ position })}
+ onDragStart={beginValueDrag}
+ onDragCancel={cancelValueDrag}
/>
editCamera({ target })}
+ onPreviewChange={(target) => previewCamera({ target })}
+ onDragStart={beginValueDrag}
+ onDragCancel={cancelValueDrag}
/>
-
- {t("editors.stage.ui.focal")}
- {
- const focal = Number(event.target.value);
- if (focal > 0) editCamera({ fov: fovFromFocal(focal) });
- }}
+
+
+ previewCamera({ fov: fovFromFocal(focal) })
+ }
+ onCommit={(focal) =>
+ commitCamera({ fov: fovFromFocal(focal) })
+ }
/>
-
-
- {t("editors.stage.ui.verticalFov", {
- value: cameraValue.fov.toFixed(1),
- })}
-
+
+
- editCamera({ fov: Number(event.target.value) })
- }
+ min={stageFovMin}
+ max={stageFovMax}
+ step={stageNumberStep}
+ formatValue={formatStageNumber}
+ onDragStart={beginValueDrag}
+ onDragCancel={cancelValueDrag}
+ onPreview={(fov) => previewCamera({ fov })}
+ onCommit={(fov) => commitCamera({ fov })}
/>
-
- {
- setSelected(null);
+
+ {
editCamera(defaultStageCamera());
}}
>
{t("editors.stage.ui.resetCamera")}
-
+
+
+ )}
+ {!object && !selectedCamera && (
+
+ )}
+
+
+
+
beginLayoutResize("right", event)}
+ onPointerMove={(event) => updateLayoutResize("right", event)}
+ onPointerUp={endLayoutResize}
+ onPointerCancel={endLayoutResize}
+ onKeyDown={(event) => nudgeLayoutResize("right", event)}
+ />
+ {previewMode === "dynamic" && (
+
+ beginLayoutResize("timeline", event)}
+ onPointerMove={(event) => updateLayoutResize("timeline", event)}
+ onPointerUp={endLayoutResize}
+ onPointerCancel={endLayoutResize}
+ onKeyDown={(event) => nudgeLayoutResize("timeline", event)}
+ />
+
+
+
+ ▦
+ {t("editors.stage.ui.timelineTitle")}
+
+ {
+ setView({ type: "setPreviewMode", mode: "dynamic" });
+ if (time >= stage.duration) setTime(0);
+ setPlaying((current) => !current);
+ }}
+ >
+ {playing ? "Ⅱ" : "▶"}
+
+
+ {t("editors.stage.ui.time", {
+ time: time.toFixed(2),
+ duration: stage.duration.toFixed(2),
+ })}
+
+
+
+ {t("timeline.player.fps")} {stage.fps}
+
+
+ {t("editors.stage.ui.totalDuration")}
+ setDurationInput(event.target.value)}
+ onBlur={(event) => {
+ const duration = event.currentTarget.valueAsNumber;
+ setDurationInput(null);
+ if (Number.isFinite(duration) && duration > 0 && duration !== stageRef.current.duration) {
+ void commitStoryboardEdit({ type: "setDuration", duration }, undefined, stageRef.current.shots);
+ }
+ }}
+ onKeyDown={(event) => {
+ if (event.key === "Enter") event.currentTarget.blur();
+ }}
+ />
+
+ {durationNotice && {durationNotice} }
+
+ ◆
+
-
- {t("editors.stage.ui.footerHint")}
-
+
{
+ setPlayhead(Number(event.target.value));
+ }}
+ />
+ {
+ if (event.target !== event.currentTarget) return;
+ const bounds = event.currentTarget.getBoundingClientRect();
+ setPlayhead(
+ ((event.clientX - bounds.left) / Math.max(bounds.width, 1)) *
+ timeline.duration,
+ );
+ }}
+ >
+
+
+ {t("editors.stage.ui.timelineCurrentTime")}
+
+
+ {timelineRuler.ticks.map((tick, index) => {
+ const isStart = index === 0;
+ const isEnd = index === timelineRuler.ticks.length - 1;
+ const precision =
+ timelineRuler.majorStep < 1 || tick.time % 1 !== 0 ? 1 : 0;
+ return (
+
+ {tick.kind === "major" && (
+
+ {t("editors.stage.ui.timelineTime", {
+ time: tick.time.toFixed(precision),
+ })}
+
+ )}
+
+ );
+ })}
+ {
+ event.preventDefault();
+ event.stopPropagation();
+ timelineRulerDrag.current = event.pointerId;
+ event.currentTarget.setPointerCapture(event.pointerId);
+ if (event.currentTarget.parentElement)
+ setPlayheadFromTimelineX(
+ event.clientX,
+ event.currentTarget.parentElement,
+ );
+ }}
+ onPointerMove={(event) => {
+ if (
+ timelineRulerDrag.current !== event.pointerId ||
+ !event.currentTarget.parentElement
+ ) return;
+ setPlayheadFromTimelineX(
+ event.clientX,
+ event.currentTarget.parentElement,
+ );
+ }}
+ onPointerUp={(event) => {
+ if (timelineRulerDrag.current === event.pointerId)
+ timelineRulerDrag.current = null;
+ event.currentTarget.releasePointerCapture(event.pointerId);
+ }}
+ onPointerCancel={(event) => {
+ if (timelineRulerDrag.current === event.pointerId)
+ timelineRulerDrag.current = null;
+ }}
+ />
+
+
+
+ {timelineRuler.ticks.map((tick) => (
+
+ ))}
+
+ {timelineGroups.map((group) => {
+ const expanded = isTimelineGroupExpanded(group.id);
+ const groupLabel = timelineTrackGroupLabel(group);
+ return (
+
+
+
toggleTimelineGroup(group.id)}
+ >
+
+
+ {group.kind === "camera" ? "◉" : group.kind === "object" ? "●" : "▤"}
+
+ {groupLabel}
+
+
+
+ {expanded && group.tracks.map((track) => {
+ const intervals = stageTimelineIntervals(track);
+ const hasKeyframeAtPlayhead = track.points.some(
+ (point) =>
+ point.kind === "keyframe" && point.time <= stage.duration &&
+ stageTimeToFrame(stage, point.time) ===
+ stageTimeToFrame(stage, time),
+ );
+ return (
+
+
+
+ {timelineTrackChildLabel(track)}
+
+ {track.kind === "shots" && (
+ <>
+ {
+ event.stopPropagation();
+ setStoryboardChooserOpen((open) => !open);
+ }}
+ >
+
+
+ {storyboardAddReason && (
+
+ {storyboardAddReason}
+
+ )}
+ >
+ )}
+ {track.kind !== "shots" && track.channel !== "motion" && (
+ {
+ event.stopPropagation();
+ addTimelineKeyframe(track);
+ }}
+ >
+
+
+ )}
+
+
{
+ const bounds = event.currentTarget.getBoundingClientRect();
+ setPlayhead(
+ ((event.clientX - bounds.left) /
+ Math.max(bounds.width, 1)) *
+ timeline.duration,
+ );
+ }}
+ >
+ {track.kind === "shots" && (
+
+ )}
+ {track.kind !== "shots" &&
+ intervals.filter((interval) => interval.start.time < stage.duration).map((interval) => (
+ {
+ event.stopPropagation();
+ const intervalBounds = event.currentTarget.getBoundingClientRect();
+ setSelectedTimelinePoint(null);
+ setSelectedTimelineInterval({
+ id: interval.id,
+ trackId: track.id,
+ startPointId: interval.start.id,
+ endPointId: interval.end.id,
+ anchorLeft: Math.max(
+ 164,
+ Math.min(window.innerWidth - 164, intervalBounds.left + intervalBounds.width / 2),
+ ),
+ anchorBottom: window.innerHeight - intervalBounds.top + 8,
+ });
+ }}
+ >
+ {selectedTimelineInterval?.id === interval.id && (
+ ⌁
+ )}
+
+ ))}
+ {/* A Storyboard block is one target across its whole box and
+ * the block on its own says where it ends. The track's boundary
+ * points are drawn on every other lane; here each would sit on
+ * a block's edge, over the playhead's ring, and take the clicks
+ * of the block it belongs to. */}
+ {track.kind !== "shots" &&
+ track.points.filter((point) => point.time <= stage.duration).map((point) => (
+
+ {
+ event.stopPropagation();
+ setSelectedTimelineInterval(null);
+ setSelectedTimelinePoint({ trackId: track.id, pointId: point.id });
+ setPlayhead(point.time);
+ }}
+ />
+ {selectedTimelinePoint?.trackId === track.id && selectedTimelinePoint?.pointId === point.id && (
+ {
+ event.stopPropagation();
+ removeTimelineKeyframe(track, point.id);
+ }}
+ >
+ ×
+
+ )}
+
+ ))}
+
+
+ );
+ })}
+
+ );
+ })}
+
+
+
+
+ {storyboardChooserOpen && (
+ setStoryboardChooserOpen(false)}
+ />
+ )}
+ {selectedTimelineInterval && selectedIntervalTarget && selectedIntervalTrack && selectedInterval && selectedTransition && (
+
+
+
+ {t("editors.stage.ui.transitionEditorTitle", {
+ label: timelineTrackLabel(selectedIntervalTrack),
+ start: stageTimeToFrame(stage, selectedInterval.start.time),
+ end: stageTimeToFrame(stage, selectedInterval.end.time),
+ })}
+ {t("editors.stage.ui.transitionFormula")}
+
+ setSelectedTimelineInterval(null)}
+ >
+ ×
+
+
+
+ {t("editors.stage.ui.transitionLabel")}
+ setSelectedTransition(
+ event.target.value === "bezier"
+ ? { kind: "bezier", controlPoints: [...DEFAULT_BEZIER_CONTROL_POINTS] }
+ : { kind: "linear" },
+ )}
+ >
+ {t("editors.stage.ui.transitionLinear")}
+ {t("editors.stage.ui.transitionBezier")}
+
+
+
+
+ {t("editors.stage.ui.transitionControlPoints")}
+ {(selectedTransition.kind === "bezier" ? selectedTransition.controlPoints : DEFAULT_BEZIER_CONTROL_POINTS)
+ .map((value, index) => (
+ {
+ if (selectedTransition.kind !== "bezier") return;
+ const controlPoints = [...selectedTransition.controlPoints] as [number, number, number, number];
+ controlPoints[index] = Math.max(0, Math.min(1, Number(event.target.value) || 0));
+ setSelectedTransition({ kind: "bezier", controlPoints });
+ }}
+ />
+ ))}
+
+
+ )}
+
+
+ )}
+
{
+ const file = event.target.files?.[0];
+ if (file) void importAsset(file);
+ event.target.value = "";
+ }}
+ />
+
{
+ const file = event.target.files?.[0];
+ if (file) void importBackground(file);
+ event.target.value = "";
+ }}
+ />
+ {helpOpen && (
+
+ trapNestedDialog(event, () => setHelpOpen(false))
+ }
+ >
+
+
+ {t("editors.stage.ui.helpTitle")}
+ setHelpOpen(false)}
+ >
+ ×
+
+
+ {t("editors.stage.ui.helpViewNav")}
+
+ {t("editors.stage.ui.helpOrbit")}
+ {t("editors.stage.ui.helpPan")}
+ {t("editors.stage.ui.helpZoom")}
+ {t("editors.stage.ui.helpMove")}
+
+ {t("editors.stage.ui.helpEditor")}
+
+ {t("editors.stage.ui.helpEscape")}
+ {t("editors.stage.ui.helpTab")}
+
+
+
+ )}
+ {exportOpen && (
+
+ trapNestedDialog(event, () => setView({ type: "closeExport" }))
+ }
+ >
+
+
+ )}
+ {previewStill && (
+
+ trapNestedDialog(event, () => setPreviewStillId(null))
+ }
+ >
+
+
+
+
+ {stillName(stills.indexOf(previewStill))} ·{" "}
+ {stage.aspectRatio}
+
+ setPreviewStillId(null)}
+ >
+ {t("editors.stage.ui.closePreview")}
+
+
+
+
+ )}
+ {confirmingClose && (
+
+ trapNestedDialog(event, () => setConfirmingClose(false))
+ }
+ >
+
+
{t("editors.stage.ui.unsavedTitle")}
+ setConfirmingClose(false)}
+ >
+ {t("editors.stage.ui.keepEditing")}
+
+
+ {t("editors.stage.ui.discardClose")}
+
+ {
+ setConfirmingClose(false);
+ commit.apply(applyEdits);
+ }}
+ >
+ {t("editors.stage.ui.saveClose")}
+
+
+
+ )}
-
+
);
}
export default DirectorStage;
diff --git a/src/canvas/DirectorStageChrome.tsx b/src/canvas/DirectorStageChrome.tsx
new file mode 100644
index 000000000..f18dd4438
--- /dev/null
+++ b/src/canvas/DirectorStageChrome.tsx
@@ -0,0 +1,45 @@
+import type { ReactNode } from "react";
+
+export function StagePanelHeading({
+ icon,
+ children,
+}: {
+ icon: ReactNode;
+ children: ReactNode;
+}) {
+ return (
+
+ );
+}
+
+export function StagePanelSearch({
+ className,
+ label,
+ placeholder,
+ value,
+ onChange,
+ type = "text",
+}: {
+ className: string;
+ type?: "text" | "search";
+ label: string;
+ placeholder: string;
+ value: string;
+ onChange: (value: string) => void;
+}) {
+ return (
+
+ {label}
+ onChange(event.target.value)}
+ />
+
+ );
+}
diff --git a/src/canvas/NodeFrame.tsx b/src/canvas/NodeFrame.tsx
index 7a219375f..4f39d9816 100644
--- a/src/canvas/NodeFrame.tsx
+++ b/src/canvas/NodeFrame.tsx
@@ -1,6 +1,7 @@
import { useContext, useLayoutEffect, useRef, type ReactNode } from "react";
import { Handle, Position } from "@xyflow/react";
import type { CanvasNodeKind } from "./model";
+import { UNANCHORED_KINDS } from "./connectionPolicy.ts";
import { CanvasActionsContext } from "./CanvasActionsContext";
import { CanvasIcon } from "./CanvasIcon";
import { useI18n } from "../i18n/I18nProvider.tsx";
@@ -155,7 +156,8 @@ export function NodeFrame({
)}
- {kind !== "group" && (
+ {/* Anchors only attach edges, so they follow UNANCHORED_KINDS, not nodePorts. */}
+ {!UNANCHORED_KINDS.includes(kind) && (
<>
> = {
tool: "canvas.selection.edit.tool",
external: "canvas.selection.edit.external",
};
+const NO_VIDEO_TOOL_EXCLUSIONS: ReadonlySet = new Set();
/** Selection actions stay distinct from generation controls. Empty media has no post-edit toolbar.
* Local editors and tool drafts keep their own capability constraints.
@@ -156,7 +161,7 @@ export function NodeSelectionToolbar({
options: MenuOption[],
glyph?: ToolGlyphName,
) => {
- if (options.some((option) => !option.disabled))
+ if (options.length && options.some((option) => !option.disabled))
editing.push({ id, label, icon, glyph, options, disabled: locked });
};
const addTool = (
@@ -269,47 +274,56 @@ export function NodeSelectionToolbar({
"tools",
);
} else if (node.type === "video") {
+ const captureFrameOptions = (): MenuOption[] => [
+ {
+ id: "capture-first",
+ label: t("canvas.selection.firstFrame"),
+ icon: "image",
+ run: () => onCaptureFrame?.("first"),
+ disabled: !onCaptureFrame,
+ },
+ {
+ id: "capture-last",
+ label: t("canvas.selection.lastFrame"),
+ icon: "image",
+ run: () => onCaptureFrame?.("last"),
+ disabled: !onCaptureFrame,
+ },
+ {
+ id: "capture-custom",
+ label: t("canvas.selection.customFrame"),
+ icon: "camera",
+ run: () => onEdit?.("frame"),
+ disabled: !onEdit,
+ },
+ ];
+ // Stage preview outputs drop generative and audio tools per the shared
+ // exclusion set; this component never re-decides which role loses what.
+ const excluded: ReadonlySet = isStagePreviewOutput(node)
+ ? STAGE_PREVIEW_EXCLUDED_VIDEO_TOOLS
+ : NO_VIDEO_TOOL_EXCLUSIONS;
+ const offered = (options: MenuOption[]) =>
+ options.filter((option) => !excluded.has(option.id));
for (const [tool, labelKey, icon] of videoTools)
- addTool(tool, t(labelKey), icon);
+ if (!excluded.has(tool)) addTool(tool, t(labelKey), icon);
addMenu(
"video-frame-capture",
t("canvas.selection.captureFrame"),
"image",
- [
- {
- id: "capture-first",
- label: t("canvas.selection.firstFrame"),
- icon: "image",
- run: () => onCaptureFrame?.("first"),
- disabled: !onCaptureFrame,
- },
- {
- id: "capture-last",
- label: t("canvas.selection.lastFrame"),
- icon: "image",
- run: () => onCaptureFrame?.("last"),
- disabled: !onCaptureFrame,
- },
- {
- id: "capture-custom",
- label: t("canvas.selection.customFrame"),
- icon: "camera",
- run: () => onEdit?.("frame"),
- disabled: !onEdit,
- },
- ],
- );
- addTool(
- "video-depth-capture",
- t("canvas.selection.depthCapture"),
- "subject",
+ captureFrameOptions(),
);
+ if (!excluded.has("video-depth-capture"))
+ addTool(
+ "video-depth-capture",
+ t("canvas.selection.depthCapture"),
+ "subject",
+ );
addEditor("video-trim", t("canvas.selection.trimVideo"), "trim", "trim");
addMenu(
"sound-separation",
t("canvas.selection.audioSeparation"),
"audio",
- [
+ offered([
{
id: "extract-audio",
label: t("canvas.selection.extractAudio"),
@@ -324,9 +338,9 @@ export function NodeSelectionToolbar({
"sliders",
t("canvas.selection.separateTrackHint"),
),
- ],
+ ]),
);
- addMenu("tools", t("canvas.selection.tools"), "tool", [
+ const utilities = offered([
toolOption(
"video-frame-interpolation",
t("canvas.selection.frameInterpolation"),
@@ -337,13 +351,21 @@ export function NodeSelectionToolbar({
t("canvas.selection.subtitleErase"),
"text",
),
- toolOption(
- "video-matting",
- t("canvas.selection.videoMatting"),
- "subject",
- ),
+ toolOption("video-matting", t("canvas.selection.videoMatting"), "subject"),
toolOption("video-crop", t("canvas.selection.videoCrop"), "crop"),
]);
+ if (utilities.length === 1) {
+ // A dropdown that lost every option but one is a plain button.
+ const only = utilities[0]!;
+ editing.push({
+ id: only.id,
+ label: only.label,
+ icon: only.icon,
+ run: only.run,
+ disabled: locked || only.disabled,
+ });
+ } else
+ addMenu("tools", t("canvas.selection.tools"), "tool", utilities);
} else if (node.type === "audio") {
addEditor("audio-trim", t("canvas.selection.trimAudio"), "trim", "trim");
addTool("audio-separation", t("canvas.selection.separateTrack"), "audio");
diff --git a/src/canvas/StagePreviewSourceSelect.tsx b/src/canvas/StagePreviewSourceSelect.tsx
new file mode 100644
index 000000000..01c3a0cb1
--- /dev/null
+++ b/src/canvas/StagePreviewSourceSelect.tsx
@@ -0,0 +1,68 @@
+import { useId } from "react";
+import { useI18n } from "../i18n/I18nProvider.tsx";
+import type { LocalStageDocument, StagePreviewSource } from "./stageDocument.ts";
+
+/** The option value of the Storyboard: a stable business value, never translated. */
+const STAGE_PREVIEW_STORYBOARD = "storyboard";
+const cameraOptionValue = (id: string) => `camera:${id}`;
+
+export interface StagePreviewSourceSelectProps {
+ /** What the selector shows: the source as it resolves for the stage as it is now, so
+ * a disabled option is never the selected one. */
+ value: StagePreviewSource;
+ /** Every existing camera in stored order. Each is one option, named as it is now. */
+ cameras: LocalStageDocument["cameras"];
+ /** Why the Storyboard cannot be previewed; null while it can. */
+ storyboardReason: string | null;
+ onSelect: (source: StagePreviewSource) => void;
+}
+
+/**
+ * The camera-preview source selector: the Storyboard first, then every camera.
+ *
+ * It is the preview source only; the export dialog owns export. A choice here is a
+ * view-state change and writes nothing. The Storyboard option is disabled while the
+ * Storyboard has no block, and the selector names the reason where a pointer and
+ * assistive technology read it.
+ */
+export function StagePreviewSourceSelect({
+ value,
+ cameras,
+ storyboardReason,
+ onSelect,
+}: StagePreviewSourceSelectProps) {
+ const { t } = useI18n();
+ const reasonId = useId();
+ // Keep camera option values in their own namespace because camera IDs are free text.
+ const sourceAt = (index: number): StagePreviewSource =>
+ index === 0
+ ? { kind: "storyboard" }
+ : { kind: "camera", cameraId: cameras[index - 1]!.id };
+ return (
+ <>
+ onSelect(sourceAt(event.target.selectedIndex))}
+ >
+
+ {t("editors.stage.ui.storyboardCut")}
+
+ {cameras.map((camera) => (
+
+ {camera.name}
+
+ ))}
+
+ {storyboardReason && (
+
+ {storyboardReason}
+
+ )}
+ >
+ );
+}
diff --git a/src/canvas/StageStoryboardChooser.tsx b/src/canvas/StageStoryboardChooser.tsx
new file mode 100644
index 000000000..64161b027
--- /dev/null
+++ b/src/canvas/StageStoryboardChooser.tsx
@@ -0,0 +1,162 @@
+import {
+ useEffect,
+ useLayoutEffect,
+ useRef,
+ useState,
+ type RefObject,
+} from "react";
+import { useI18n } from "../i18n/I18nProvider.tsx";
+import type { LocalStageDocument } from "./stageDocument.ts";
+
+/** Space between the chooser and the `+` it opens from. */
+const ANCHOR_GAP = 6;
+/** Longer camera lists scroll inside the chooser instead of covering the stage. */
+const MAX_HEIGHT = 260;
+/** The chooser never touches the viewport edge, however short the window is. */
+const VIEWPORT_MARGIN = 8;
+
+export interface StageStoryboardChooserProps {
+ /** The element id the `+` names through `aria-controls` while the chooser is open. */
+ id: string;
+ /** The `+` the chooser is anchored to. */
+ anchor: RefObject;
+ /** Every existing camera, in stored order. One selection reports one of them. */
+ cameras: LocalStageDocument["cameras"];
+ onSelect: (cameraId: string) => void;
+ onClose: () => void;
+}
+
+interface Placement {
+ left: number;
+ bottom: number;
+ maxHeight: number;
+}
+
+/**
+ * Single-selection list of the stage's cameras, opened above the timeline's `+`.
+ *
+ * It is view state only: choosing a camera reports it to the caller, which appends
+ * it through the shared command. The list closes after one choice, on Escape, on a
+ * pointer-down outside, or when the caller's `+` is pressed again. It sits in fixed
+ * viewport coordinates, so the scrolling track surface neither clips nor scrolls it.
+ */
+export function StageStoryboardChooser({
+ id,
+ anchor,
+ cameras,
+ onSelect,
+ onClose,
+}: StageStoryboardChooserProps) {
+ const { t } = useI18n();
+ const root = useRef(null);
+ const search = useRef(null);
+ const [query, setQuery] = useState("");
+ const [placement, setPlacement] = useState(null);
+ const close = useRef(onClose);
+ close.current = onClose;
+
+ // Above the anchor with the left edges aligned and a small gap. The timeline can
+ // be resized and scrolled while the chooser is open, so the anchor is measured again.
+ useLayoutEffect(() => {
+ const measure = () => {
+ const bounds = anchor.current?.getBoundingClientRect();
+ if (!bounds) return;
+ setPlacement({
+ left: bounds.left,
+ bottom: window.innerHeight - bounds.top + ANCHOR_GAP,
+ maxHeight: Math.min(
+ MAX_HEIGHT,
+ Math.max(ANCHOR_GAP, bounds.top - ANCHOR_GAP - VIEWPORT_MARGIN),
+ ),
+ });
+ };
+ measure();
+ window.addEventListener("resize", measure);
+ // Scroll events do not bubble; the capture phase still sees every scroll container.
+ window.addEventListener("scroll", measure, true);
+ return () => {
+ window.removeEventListener("resize", measure);
+ window.removeEventListener("scroll", measure, true);
+ };
+ }, [anchor]);
+
+ useEffect(() => {
+ const previous =
+ document.activeElement instanceof HTMLElement
+ ? document.activeElement
+ : null;
+ search.current?.focus();
+ const outside = (event: PointerEvent) => {
+ const target = event.target;
+ // A press on the anchor is the caller's toggle, not a dismissal.
+ if (
+ target instanceof Node &&
+ (root.current?.contains(target) || anchor.current?.contains(target))
+ )
+ return;
+ close.current();
+ };
+ document.addEventListener("pointerdown", outside);
+ return () => {
+ document.removeEventListener("pointerdown", outside);
+ if (previous?.isConnected) previous.focus();
+ };
+ }, [anchor]);
+
+ const needle = query.trim().toLocaleLowerCase();
+ const visible = cameras.filter(
+ (camera) => !needle || camera.name.toLocaleLowerCase().includes(needle),
+ );
+ return (
+ {
+ if (event.key !== "Escape") return;
+ event.preventDefault();
+ event.stopPropagation();
+ close.current();
+ }}
+ >
+
setQuery(event.target.value)}
+ />
+
+ {visible.map((camera) => (
+
onSelect(camera.id)}
+ >
+ {camera.name}
+
+ ))}
+ {!visible.length && (
+
+ {t("editors.stage.ui.storyboardSearchEmpty")}
+
+ )}
+
+
+ );
+}
diff --git a/src/canvas/StageStoryboardTrack.tsx b/src/canvas/StageStoryboardTrack.tsx
new file mode 100644
index 000000000..710705930
--- /dev/null
+++ b/src/canvas/StageStoryboardTrack.tsx
@@ -0,0 +1,519 @@
+import { useEffect, useMemo, useRef, useState, type PointerEvent as ReactPointerEvent } from "react";
+import { CanvasIcon } from "./CanvasIcon.tsx";
+import { useI18n } from "../i18n/I18nProvider.tsx";
+import type { LocalStageDocument, StageShot } from "./stageDocument.ts";
+import {
+ StageStoryboardThumbnailCache,
+ prepareStageStoryboardThumbnailKeys,
+ stageStoryboardThumbnailSize,
+} from "./stageStoryboardThumbnail.ts";
+import {
+ normalizeStoryboardTime,
+ packStageStoryboard,
+ stageStoryboardIssue,
+ type StageStoryboardEdit,
+} from "./stageStoryboard.ts";
+import type { StageTimelineStoryboardInterval } from "./stageTimeline.ts";
+
+/** What the viewport makes of one thumbnail: a picture; nothing possible for that
+ * frame, until what it pictures changes; or a request to come back later, while a
+ * gesture owns the scene. */
+export type StageStoryboardThumbnailShot =
+ | { kind: "image"; image: string }
+ | { kind: "failed" }
+ | { kind: "wait" };
+
+/** Idle time is asked for with a deadline, so a busy page still gets its thumbnails. */
+const IDLE_TIMEOUT_MS = 500;
+/** How soon to ask again while a gesture owns the scene. */
+const GESTURE_POLL_MS = 150;
+/** How far the line that says where a carried block would be let in is kept from the
+ * right edge of the track, in pixels: its chevrons reach 3.5px either side of it. */
+const MARKER_INSET = 4;
+
+export interface StageStoryboardTrackProps {
+ /** The stage as it is now. A block reads its camera's name from it on every
+ * render, and what its thumbnail must show is taken from it. */
+ stage: LocalStageDocument;
+ /** How many times the live scene gained something the document alone does not
+ * announce, such as a loaded model or an arrived background. Every picture made
+ * before a change is stale, and is made again. */
+ sceneRevision: number;
+ /** Every block of the Storyboard, in stored order. */
+ blocks: readonly StageTimelineStoryboardInterval[];
+ /** The main timeline's length: where a block starts and ends is a share of it. */
+ duration: number;
+ /** The block the user selected. It is view state, and the block shows it as a fill. */
+ selectedBlockId: string | null;
+ /** The block the playhead is on. The track derives it on every render and never
+ * stores it; the block shows it as a white outline. */
+ activeBlockId: string | null;
+ /** Pictures one block's camera at one time. It is asked in idle time, one block at
+ * a time, and never in a render or a pointer handler. */
+ thumbnail: (cameraId: string, start: number) => StageStoryboardThumbnailShot;
+ /** Whether the viewport that pictures thumbnails is up. Nothing is asked before it is. */
+ thumbnailReady: boolean;
+ onSelect: (blockId: string, cameraId: string) => void;
+ displayedShots: readonly StageShot[] | null;
+ editable: boolean;
+ /** Says when the press on a block has become a drag to another place, and again when
+ * that drag is over. While one is in progress nothing is written and nothing outside
+ * the track moves; the parent keeps what would change the Storyboard unusable. It is
+ * said once each way per drag, and never for a resize. */
+ onDraggingChange: (dragging: boolean) => void;
+ onPreview: (shots: StageShot[] | null) => void;
+ onCommit: (edit: StageStoryboardEdit, block: StageShot, before: readonly StageShot[]) => void;
+}
+
+/**
+ * The blocks of the Storyboard lane.
+ *
+ * The block body selects the block and its camera, moves no playhead
+ * and writes nothing. Moved past a small threshold, it carries the block to another
+ * place instead: the block alone follows the pointer, sideways and kept inside the
+ * track, while every other block, the playhead and what the viewport shows stay as they
+ * are. Wherever letting go would change the order, a line in the lane stands in the gap
+ * the block would be let into: before the block that would then follow it, or at the end
+ * of the Storyboard when it would be last. Flat against either edge of the track, the
+ * block is let in last or first, as far as the pointer could take it. Let go where the
+ * order would change, the track shows that order at once and one command saves it; let
+ * go anywhere else, or cancelled, the block is back in its place and nothing is written.
+ * Its name is read from the referenced camera on every render,
+ * so a rename reaches every block that shows that camera. The selected block shows
+ * it as a fill inside its own box; the block under the playhead as a white outline.
+ *
+ * A block also shows a picture of its camera at the block's start. The pictures live
+ * beside the document, never in it, and are made one at a time in idle time, so the
+ * timeline is drawn and the pointer is answered first. A block reports whether its
+ * picture is pending, ready or could not be made; while it waits it is a whole block.
+ */
+export function StageStoryboardTrack({
+ stage,
+ sceneRevision,
+ blocks,
+ duration,
+ selectedBlockId,
+ activeBlockId,
+ thumbnail,
+ thumbnailReady,
+ onSelect,
+ displayedShots,
+ editable,
+ onDraggingChange,
+ onPreview,
+ onCommit,
+}: StageStoryboardTrackProps) {
+ const { t } = useI18n();
+ const cache = useState(() => new StageStoryboardThumbnailCache())[0];
+ // A picture arriving is the one thing that changes a block while the stage stands still.
+ const [, setArrived] = useState(0);
+ const size = useMemo(
+ () => stageStoryboardThumbnailSize(stage.aspectRatio),
+ [stage.aspectRatio],
+ );
+ /** What each block's thumbnail must show now. */
+ const wanted = useMemo(() => {
+ if (!blocks.length) return [];
+ const keyFor = prepareStageStoryboardThumbnailKeys(stage, sceneRevision);
+ const shots = new Map(stage.shots.map((shot) => [shot.id, shot]));
+ return blocks.map((block) => {
+ const shot = shots.get(block.id);
+ return { block, key: shot ? keyFor(shot) : null };
+ });
+ }, [blocks, stage, sceneRevision]);
+ // The cache is told in the same render that reads it, so a block reports that it
+ // waits from the frame its picture goes stale, not from the frame after.
+ for (const { block, key } of wanted)
+ if (key !== null) cache.want(block.id, key);
+ const gesture = useRef<{
+ pointerId: number;
+ block: StageShot;
+ shots: readonly StageShot[];
+ mode: "body" | "reorder" | "resize";
+ x: number;
+ y: number;
+ secondsPerPixel: number;
+ /** How far the pressed block may be carried from its place, in pixels: up to the
+ * track's left edge and up to its right edge, and no further. */
+ limits: { min: number; max: number };
+ /** The track's width in pixels, for placing the line that says where the block would
+ * be let in. */
+ width: number;
+ } | null>(null);
+ /** What the track itself shows of the gesture in progress. It is the track's own view
+ * state, so a pointer move re-renders no parent, and nothing outside the track moves
+ * before the gesture ends: `mode` picks the cursor of the surface, which owns the
+ * pointer once it moves, and `carried` is the block that follows the pointer once the
+ * press has become a drag, how far it is from its own place in pixels, and, where a
+ * release would change the order, where in the track the block would be let in, in
+ * pixels from the track's left edge. */
+ const [shownGesture, setShownGesture] = useState<{
+ mode: "body" | "reorder" | "resize";
+ carried: { blockId: string; offset: number; insertAt: number | null } | null;
+ } | null>(null);
+ const shoot = useRef(thumbnail);
+ shoot.current = thumbnail;
+
+ useEffect(() => {
+ // Blocks that left the document are forgotten, with the pictures made for them.
+ cache.retain(
+ wanted.flatMap(({ block, key }) => (key === null ? [] : [block.id])),
+ );
+ if (!thumbnailReady) return;
+ let stopped = false;
+ let idle: number | null = null;
+ let timer: number | null = null;
+ const cancel = () => {
+ if (idle !== null) window.cancelIdleCallback(idle);
+ if (timer !== null) window.clearTimeout(timer);
+ idle = timer = null;
+ };
+ // One picture per task: the next asks for idle time of its own, so the pointer
+ // and the next frame come first.
+ const later = (task: () => void) => {
+ if (typeof window.requestIdleCallback === "function")
+ idle = window.requestIdleCallback(task, { timeout: IDLE_TIMEOUT_MS });
+ else timer = window.setTimeout(task, 0);
+ };
+ const run = () => {
+ idle = timer = null;
+ if (stopped) return;
+ const next = cache.pending()[0];
+ if (!next) return;
+ const block = wanted.find(({ block }) => block.id === next.blockId)?.block;
+ if (!block) return;
+ const shot: StageStoryboardThumbnailShot = gesture.current ? { kind: "wait" } : shoot.current(block.cameraId, block.start.time);
+ if (shot.kind === "wait") {
+ timer = window.setTimeout(run, GESTURE_POLL_MS);
+ return;
+ }
+ cache.store(
+ next.blockId,
+ next.key,
+ shot.kind === "failed" ? null : shot.image,
+ );
+ setArrived((count) => count + 1);
+ if (cache.pending().length) later(run);
+ };
+ if (cache.pending().length) later(run);
+ return () => {
+ stopped = true;
+ cancel();
+ };
+ }, [wanted, thumbnailReady]);
+
+ const track = useRef(null);
+ const pendingFrame = useRef(null);
+ const clearPreviewFrame = () => {
+ if (pendingFrame.current === null) return;
+ window.cancelAnimationFrame(pendingFrame.current);
+ pendingFrame.current = null;
+ };
+ const preview = useRef(onPreview);
+ preview.current = onPreview;
+ const draggingChange = useRef(onDraggingChange);
+ draggingChange.current = onDraggingChange;
+ /** Whether the parent now holds a drag as in progress, so it is told each way once. */
+ const reportedDrag = useRef(false);
+ const dragReportQueued = useRef(false);
+ const reportDrag = (dragging: boolean) => {
+ if (reportedDrag.current === dragging) return;
+ reportedDrag.current = dragging;
+ draggingChange.current(dragging);
+ };
+ const cancelGesture = () => {
+ const current = gesture.current;
+ if (!current) return;
+ gesture.current = null;
+ clearPreviewFrame();
+ setShownGesture(null);
+ reportDrag(false);
+ preview.current(null);
+ // The surface keeps the pointer it captured until the pointer is let go, and the
+ // browser lets go of it with that release. Released here instead, the release that
+ // follows would land on whatever lies under the pointer: over an empty stretch of
+ // the lane, a click on the lane, which moves the playhead although the drag was
+ // cancelled. Held, that release reaches this surface alone, and its click stops here.
+ };
+ useEffect(() => {
+ const cancelOnEscape = (event: KeyboardEvent) => {
+ if (event.key !== "Escape" || !gesture.current) return;
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ cancelGesture();
+ };
+ window.addEventListener("keydown", cancelOnEscape, true);
+ window.addEventListener("blur", cancelGesture);
+ return () => {
+ window.removeEventListener("keydown", cancelOnEscape, true);
+ window.removeEventListener("blur", cancelGesture);
+ cancelGesture();
+ };
+ }, []);
+ useEffect(() => {
+ if (!editable || (gesture.current && gesture.current.shots !== stage.shots))
+ cancelGesture();
+ }, [editable, stage.shots]);
+
+ const startGesture = (
+ event: ReactPointerEvent,
+ block: StageShot,
+ ownerId?: string,
+ ) => {
+ if (!editable || !event.isPrimary || event.button !== 0 || gesture.current)
+ return;
+ const surface = track.current;
+ if (!surface) return;
+ const owner = ownerId ? stage.shots.find((shot) => shot.id === ownerId) : block;
+ if (!owner) return;
+ const pressed = event.currentTarget.closest(".cw-stage-storyboard-block-shell");
+ const bounds = surface.getBoundingClientRect();
+ const box = pressed?.getBoundingClientRect();
+ gesture.current = {
+ pointerId: event.pointerId,
+ block: owner,
+ shots: stage.shots,
+ mode: ownerId ? "resize" : "body",
+ x: event.clientX,
+ y: event.clientY,
+ secondsPerPixel: duration / Math.max(1, bounds.width),
+ limits: !ownerId && box
+ ? { min: bounds.left - box.left, max: bounds.right - box.right }
+ : { min: 0, max: 0 },
+ width: bounds.width,
+ };
+ setShownGesture({ mode: gesture.current.mode, carried: null });
+ surface.setPointerCapture(event.pointerId);
+ event.stopPropagation();
+ };
+ const projectGesture = ({ pointerId, clientX, clientY }: Pick) => {
+ const current = gesture.current;
+ if (!current || current.pointerId !== pointerId) return;
+ const dx = clientX - current.x;
+ if (current.mode === "body") {
+ if (Math.hypot(dx, clientY - current.y) < 5) return;
+ current.mode = "reorder";
+ }
+ const { block, shots } = current;
+ // The offset is measured from pointerdown, so grabbing either side of a
+ // boundary starts at the original time.
+ const delta = dx * current.secondsPerPixel;
+ let edit: StageStoryboardEdit;
+ let ordered: readonly StageShot[];
+ /** Of a drag to another place: where in the track, as it lies now, the block would be
+ * let in, in seconds. */
+ let insertAt: number | undefined;
+ if (current.mode === "resize") {
+ const span = normalizeStoryboardTime(normalizeStoryboardTime(block.duration) + delta);
+ if (span === normalizeStoryboardTime(block.duration)) return;
+ edit = { type: "resize", blockId: block.id, duration: span };
+ ordered = shots.map((shot) => shot.id === block.id ? { ...shot, duration: span } : shot);
+ } else {
+ const remaining = shots.filter((shot) => shot.id !== block.id);
+ // Flat against an edge of the track the block can be carried no further, and the
+ // pointer may not go beyond the window either: there it is let in last, or first.
+ // Anywhere else it goes before the first block whose centre is to the right of its
+ // own, and last once its centre is past every centre.
+ const center = block.start + block.duration / 2 + delta;
+ const crossing = remaining.findIndex((shot) => center < shot.start + shot.duration / 2);
+ const index = dx >= current.limits.max
+ ? remaining.length
+ : dx <= current.limits.min
+ ? 0
+ : crossing === -1 ? remaining.length : crossing;
+ ordered = [...remaining.slice(0, index), block, ...remaining.slice(index)];
+ if (ordered.every((shot, position) => shot === shots[position])) return;
+ edit = { type: "reorder", blockIds: ordered.map((shot) => shot.id) };
+ // The gap the block would be let into, as the track lies now: before the block that
+ // would then follow it, or after the last one when it would be last.
+ const last = shots[shots.length - 1];
+ insertAt = index < ordered.length - 1
+ ? ordered[index + 1].start
+ : last.start + last.duration;
+ }
+ // The same laying-out the parent reads the playhead's landing from.
+ const packed = packStageStoryboard(ordered, ordered.map((shot) => shot.id));
+ if (stageStoryboardIssue({ ...stage, shots: packed })) return;
+ return { edit, packed, insertAt };
+ };
+ const finishGesture = (event: ReactPointerEvent) => {
+ const current = gesture.current;
+ if (!current || current.pointerId !== event.pointerId) return;
+ clearPreviewFrame();
+ const result = projectGesture(event);
+ gesture.current = null;
+ setShownGesture(null);
+ reportDrag(false);
+ if (result) {
+ onPreview(result.packed);
+ onCommit(result.edit, current.block, current.shots);
+ } else {
+ onPreview(null);
+ if (current.mode === "body") onSelect(current.block.id, current.block.cameraId);
+ }
+ };
+ const layout = displayedShots ?? stage.shots;
+ return (
+ {
+ const current = gesture.current;
+ if (!current || current.pointerId !== event.pointerId) return;
+ const result = projectGesture(event);
+ const { clientX } = event;
+ // One frame answers any number of pointer moves.
+ clearPreviewFrame();
+ pendingFrame.current = window.requestAnimationFrame(() => {
+ pendingFrame.current = null;
+ if (gesture.current !== current) return;
+ if (current.mode === "resize") {
+ // A resize shows the whole track as it would be saved, frame by frame.
+ preview.current(result?.packed ?? null);
+ return;
+ }
+ if (current.mode !== "reorder") return;
+ // A drag to another place carries the one block and nothing else: the order
+ // it would have is the gesture's own until the block is let go. A line stands
+ // in the gap the block would be let into, only where letting go would change
+ // the order.
+ setShownGesture({
+ mode: "reorder",
+ carried: {
+ blockId: current.block.id,
+ // The pointer's horizontal travel since the press, kept inside the
+ // track. The block shows that travel; where it would land is the
+ // gesture's own, and follows the pointer past either edge.
+ offset: Math.min(
+ Math.max(clientX - current.x, current.limits.min),
+ current.limits.max,
+ ),
+ // At the very end of the track the line is kept just inside it, so that
+ // neither of its chevrons is cut off.
+ insertAt: result?.insertAt === undefined
+ ? null
+ : Math.min(
+ (result.insertAt / duration) * current.width,
+ current.width - MARKER_INSET,
+ ),
+ },
+ });
+ // From here to the end of the gesture the parent keeps what would change the
+ // Storyboard unusable. Its answer is a render of its own, large enough to hold
+ // back the frame in which the block first moves, so it is told in the frame
+ // after that one, and not at all once the drag is over.
+ if (reportedDrag.current || dragReportQueued.current) return;
+ dragReportQueued.current = true;
+ window.requestAnimationFrame(() => {
+ dragReportQueued.current = false;
+ if (gesture.current === current) reportDrag(true);
+ });
+ });
+ }}
+ onPointerUp={finishGesture}
+ onPointerCancel={cancelGesture}
+ onLostPointerCapture={cancelGesture}
+ onClick={(event) => event.stopPropagation()}
+ >
+ {shownGesture?.carried?.insertAt != null && (
+
+ )}
+ {layout.map((block, index) => {
+ const name =
+ stage.cameras.find((camera) => camera.id === block.cameraId)?.name ??
+ block.cameraId;
+ const image = cache.image(block.id);
+ const carried = shownGesture?.carried;
+ const drag = carried && carried.blockId === block.id ? carried : null;
+ return (
+
+
{
+ const handle = (event.target as HTMLElement).closest("[data-boundary-owner]");
+ startGesture(event, block, handle?.dataset.boundaryOwner);
+ }}
+ onClick={(event) => {
+ event.stopPropagation();
+ // Pointer selection is handled by the gesture. Keyboard activation
+ // and activation from a disabled gesture still select the block.
+ if (event.detail === 0 || !editable) onSelect(block.id, block.cameraId);
+ }}
+ >
+
+ {/* The picture is part of the block. Left draggable, the browser
+ starts its own picture drag on the press and cancels the pointer
+ gesture that would have carried the block. */}
+ {image && }
+
+ {name}
+ {editable && (index === 0 ? ["right"] : ["left", "right"]).map((edge) => (
+
+ ))}
+
+ {editable && !displayedShots && shownGesture?.mode !== "reorder" && (
+
event.stopPropagation()}
+ onClick={(event) => {
+ event.stopPropagation();
+ if (!gesture.current) onCommit({ type: "delete", blockId: block.id }, block, stage.shots);
+ }}
+ >
+
+
+ )}
+
+ );
+ })}
+
+ );
+}
diff --git a/src/canvas/connectionPolicy.ts b/src/canvas/connectionPolicy.ts
index 4a2373b2b..d04c0bc77 100644
--- a/src/canvas/connectionPolicy.ts
+++ b/src/canvas/connectionPolicy.ts
@@ -15,10 +15,16 @@ import { assemblyIssue, isAssemblyTarget } from "./editorAssembly.ts";
/** Product port capabilities; model-specific input limits remain separate. */
export function nodePorts(kind: CanvasNodeKind) {
return {
- source: !["group", "stack", "timeline"].includes(kind),
+ source: !["group", "stack", "timeline", "external"].includes(kind),
target: !["group", "stack", "tool", "external"].includes(kind),
};
}
+
+/** Node kinds whose frame anchors no edge; every other kind renders both anchors.
+ * Deliberately not `nodePorts`: anchors only attach edges, and provenance edges start
+ * at a timeline while a folded stack carries its members' edges. A group frames, and
+ * the Director Stage node is no edge endpoint. */
+export const UNANCHORED_KINDS: readonly CanvasNodeKind[] = ["group", "external"];
/** Source → downstream matrix shared by menus, gestures and commands. */
export const downstreamKinds: Partial<
Record
@@ -217,8 +223,7 @@ export function referenceIssue(
return "target_type_unsupported";
return null;
}
- if (!nodePorts(a.type).source || a.type === "external")
- return "source_type_unsupported";
+ if (!nodePorts(a.type).source) return "source_type_unsupported";
if (!nodePorts(b.type).target) return "target_type_unsupported";
if (!referenceTypeAllowed(a, b.type)) return "source_type_unsupported";
if (!canSourceReference(a)) return "source_empty";
diff --git a/src/canvas/creationTools.ts b/src/canvas/creationTools.ts
index 8e46595cc..18a542417 100644
--- a/src/canvas/creationTools.ts
+++ b/src/canvas/creationTools.ts
@@ -24,6 +24,5 @@ export const CANVAS_CREATION_TOOLS: readonly {
kind: "external",
labelKey: "canvas.kind.external",
icon: "rail-stage",
- unavailable: true,
},
];
diff --git a/src/canvas/dataBoundary.ts b/src/canvas/dataBoundary.ts
index e679279c4..17047ac50 100644
--- a/src/canvas/dataBoundary.ts
+++ b/src/canvas/dataBoundary.ts
@@ -83,7 +83,9 @@ export function isGenerationProvenance(
optionalString(value.inputFingerprint) &&
optionalString(value.editorDocumentId) &&
(value.editorRevision === undefined ||
- Number.isSafeInteger(value.editorRevision))
+ Number.isSafeInteger(value.editorRevision)) &&
+ (value.stagePreview === undefined ||
+ typeof value.stagePreview === "boolean")
);
}
diff --git a/src/canvas/director-stage.css b/src/canvas/director-stage.css
index c7144c574..0ba4656d9 100644
--- a/src/canvas/director-stage.css
+++ b/src/canvas/director-stage.css
@@ -1,269 +1,3826 @@
-.cw-stage-dialog {
- width: min(1500px, 98vw);
+@font-face {
+ font-family: "Nunito Sans";
+ src: url("/fonts/NunitoSans-Latin.woff2") format("woff2");
+ font-style: normal;
+ font-weight: 400 700;
+ font-display: swap;
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
-.cw-stage-layout {
- display: grid;
- grid-template-columns: 190px minmax(300px, 1fr) 240px;
- gap: 18px;
- min-height: 480px;
+
+@font-face {
+ font-family: "Director Stage CJK";
+ src: url("/fonts/NotoSansCJKsc-Regular.otf") format("opentype");
+ font-weight: 400;
+ font-display: swap;
+ unicode-range: U+3000-303F, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FF00-FFEF;
}
-.cw-stage-objects,
-.cw-stage-inspector {
+
+/* The director console: a full-bleed 3D base layer with floating panels. */
+.cw-domain-overlay:has(> .cw-stage-console) {
+ padding: 0;
+ background: #050509;
+ backdrop-filter: none;
+}
+.cw-stage-console {
+ position: absolute;
+ inset: 0;
+ display: block;
+ overflow: hidden;
+ color: #e9dff1;
+ background: #0d0a14;
+ outline: none;
+}
+.cw-stage-console button,
+.cw-stage-console input,
+.cw-stage-console select {
+ font: inherit;
+}
+.cw-stage-scene {
+ position: absolute;
+ inset: 0;
+}
+.cw-stage-scene canvas {
+ display: block;
+ /* The buffer scales with the device pixel ratio; the CSS box must stay
+ * pinned to the container or a HiDPI display shows a zoomed, blurry crop. */
+ width: 100%;
+ height: 100%;
+}
+.cw-stage-panels {
+ position: absolute;
+ inset: 0;
+ margin: 0;
+ padding: 0;
+ border: none;
+ pointer-events: none;
min-width: 0;
}
-.cw-stage-layout h3 {
- font-size: 13px;
- margin: 8px 0 14px;
- color: #dedee6;
+.cw-stage-panels > * {
+ pointer-events: auto;
}
-.cw-stage-add {
+.cw-stage-topbar {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ z-index: 20;
display: flex;
+ align-items: center;
+ gap: 16px;
flex-wrap: wrap;
- gap: 6px;
+ padding: 8px 14px;
+ background: #120e19e6;
+ border-bottom: 1px solid #2c2440;
}
-.cw-stage-add button {
- padding: 7px;
- font-size: 11px;
+.cw-stage-identity h2 {
+ margin: 0;
+ font-size: 15px;
}
-.cw-stage-object-list {
+.cw-stage-toolbar {
display: flex;
- flex-direction: column;
+ flex-wrap: wrap;
gap: 6px;
- margin: 15px 0 24px;
-}
-.cw-stage-object-list button {
- justify-content: flex-start;
- text-align: left;
-}
-.cw-stage-object-list button[aria-pressed="true"] {
- background: #6554a83d;
- border-color: #8e76d1;
-}
-.cw-stage-object-list span {
- width: 10px;
- height: 10px;
- border-radius: 3px;
+ flex: 1;
+ justify-content: center;
}
-.cw-stage-center {
- min-width: 0;
+.cw-stage-topactions {
+ display: flex;
+ gap: 6px;
+ margin-left: auto;
}
-.cw-stage-viewport {
- width: 100%;
- aspect-ratio: 16/9;
- overflow: hidden;
- box-shadow: inset 0 0 0 1px #3b3d50;
- border-radius: 12px;
- background: #151923;
- touch-action: none;
+.cw-stage-topactions button,
+.cw-stage-toolbar button {
+ padding: 5px 10px;
+ font-size: 12px;
}
-.cw-stage-viewport canvas {
- display: block;
- width: 100%;
- height: 100%;
+.cw-stage-error {
+ position: absolute;
+ top: calc(var(--stage-topbar-height, 52px) + 6px);
+ left: 50%;
+ transform: translateX(-50%);
+ z-index: 30;
+ margin: 0;
+ padding: 8px 14px;
+ max-width: 70%;
+ --stage-feedback-border: #6d4949;
+ --stage-feedback-text: #f2cccc;
+ pointer-events: none;
}
-.cw-stage-transport {
+/* Render status sits outside the disabled panels fieldset so the cancel
+ * control stays live while a render is in flight. */
+.cw-stage-console .cw-render-status {
+ position: absolute;
+ top: calc(var(--stage-topbar-height, 52px) + 6px);
+ right: 14px;
+ z-index: 25;
display: flex;
gap: 10px;
align-items: center;
- flex-wrap: wrap;
- margin: 15px 0;
+ padding: 8px 12px;
}
-.cw-stage-transport output {
- font-size: 12px;
- font-variant-numeric: tabular-nums;
- color: #c5c5d5;
+.cw-stage-left,
+.cw-stage-right {
+ position: absolute;
+ top: 64px;
+ bottom: 200px;
+ z-index: 10;
+ overflow-y: auto;
+ padding: 12px;
+ border: 1px solid #2c2440;
+ border-radius: 10px;
+ background: #120e19e0;
}
-.cw-stage-transport label {
- font-size: 11px;
- display: flex;
- gap: 6px;
- align-items: center;
+.cw-stage-left {
+ left: 14px;
+ width: 230px;
}
-.cw-stage-transport input {
- width: 65px !important;
- padding: 5px !important;
+.cw-stage-right {
+ right: 14px;
+ width: 290px;
}
-.cw-stage-center > input[type="range"] {
- width: 100%;
- accent-color: #b493ec;
+.cw-stage-bottom {
+ position: absolute;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: 15;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ max-height: 190px;
+ overflow-y: auto;
+ padding: 10px 16px;
+ background: #120e19f0;
+ border-top: 1px solid #2c2440;
}
-.cw-stage-keyframes {
+.cw-stage-transport {
display: flex;
- gap: 7px;
flex-wrap: wrap;
- min-height: 58px;
- margin: 12px 0;
+ gap: 8px;
+ align-items: center;
}
-.cw-stage-keyframes > div {
+.cw-stage-track-surface {
+ position: relative;
display: flex;
- align-items: center;
+ flex: 0 0 auto;
+ flex-direction: column;
+ gap: 0;
+ min-height: 0;
+ max-height: none;
+ padding: 0 0 6px;
+ border-top: 1px solid #24232a;
+ background: #111114;
+ cursor: crosshair;
+ overflow-y: auto;
+ user-select: none;
}
-.cw-stage-keyframes button {
- border-radius: 6px 0 0 6px;
- padding: 7px;
- font-size: 11px;
+.cw-stage-track-ruler {
+ display: block;
+ position: sticky;
+ top: 0;
+ z-index: 2;
+ min-height: 24px;
+ padding: 0;
+ border-bottom: 1px solid #303036;
+ background: #1b1b1f;
+ color: #777486;
+ font-size: 10px;
}
-.cw-stage-keyframes button + button {
- border-radius: 0 6px 6px 0;
- border-left: 0;
+.cw-stage-track-ruler-scale {
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 132px;
}
-.cw-stage-keyframes p {
- font-size: 12px;
- color: #9795a7;
+.cw-stage-track-ruler-tick {
+ position: absolute;
+ bottom: 0;
+ width: 1px;
+ height: 5px;
+ background: #3b3943;
}
-.cw-stage-vector {
- border: 0;
- padding: 0;
- margin: 13px 0;
+.cw-stage-track-ruler-tick.is-major {
+ height: 10px;
+ background: #706b7b;
+}
+.cw-stage-track-ruler-label {
+ position: absolute;
+ top: 2px;
+ left: 50%;
+ color: #a6a1ae;
+ font-size: 10px;
+ line-height: 1;
+ white-space: nowrap;
+ transform: translateX(-50%);
+}
+.cw-stage-track-ruler-tick.is-start .cw-stage-track-ruler-label {
+ left: 0;
+ transform: none;
+}
+.cw-stage-track-ruler-tick.is-end .cw-stage-track-ruler-label {
+ left: 0;
+ transform: translateX(-100%);
+}
+.cw-stage-track-row {
display: grid;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: 6px;
+ grid-template-columns: 124px minmax(0, 1fr);
+ gap: 8px;
+ align-items: center;
+ min-height: 20px;
+ border-bottom: 1px solid #222127;
+ background: #151519;
}
-.cw-stage-vector legend {
+.cw-stage-track-group-row {
+ display: grid;
+ grid-template-columns: 124px minmax(0, 1fr);
+ gap: 8px;
+ align-items: center;
+ min-height: 23px;
+ border-top: 1px solid #3a3941;
+ border-bottom: 1px solid #303036;
+ background: #25252a;
+}
+.cw-stage-track-group-label {
+ overflow: hidden;
+ color: #eceaf0;
font-size: 11px;
- margin-bottom: 7px;
- color: #b9b7c7;
+ font-weight: 600;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
-.cw-stage-vector label {
+.cw-stage-track-group-toggle {
display: flex;
- flex-direction: column;
- gap: 4px;
- color: #9995ad;
+ width: 100%;
+ height: 22px;
+ min-width: 0;
+ align-items: center;
+ gap: 5px;
+ padding: 0 4px 0 1px;
+ border: 0;
+ background: transparent;
+ color: inherit;
+ font: inherit;
+ text-align: left;
+}
+.cw-stage-track-group-toggle:hover,
+.cw-stage-track-group-toggle:focus-visible {
+ color: #ffffff;
+}
+.cw-stage-track-group-chevron {
+ width: 10px;
+ color: #aaa5bb;
+ font-size: 12px;
+ line-height: 1;
+ text-align: center;
+}
+.cw-stage-track-group-icon {
+ width: 12px;
+ color: #bbb4d3;
font-size: 10px;
+ line-height: 1;
+ text-align: center;
}
-.cw-stage-vector input {
- width: 100% !important;
- padding: 7px !important;
- min-width: 0;
+.cw-stage-track-group-icon.is-object {
+ color: #c5b7ff;
}
-.cw-stage-inspector .cw-domain-field {
- margin: 11px 0;
+.cw-stage-track-group-icon.is-camera {
+ color: #a9d6ff;
}
-.cw-stage-inspector > h3:not(:first-child) {
- border-top: 1px solid #32303e;
- padding-top: 20px;
- margin-top: 20px;
+.cw-stage-track-group-lane {
+ height: 100%;
+ background: #202025;
}
-.cw-stage-dialog input[type="color"] {
- padding: 3px;
- height: 32px;
- width: 100%;
+.cw-stage-track-label {
+ position: relative;
+ overflow: hidden;
+ padding-left: 22px;
+ color: #aaa7b3;
+ font-size: 10px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
-.cw-stage-dialog .cw-domain-body {
- padding-bottom: 10px;
+.cw-stage-track-label::before {
+ position: absolute;
+ top: 50%;
+ left: 11px;
+ width: 6px;
+ height: 6px;
+ border: 1px solid #797582;
+ content: "";
+ transform: translateY(-50%);
}
-@media (max-width: 1100px) {
- .cw-stage-layout {
- grid-template-columns: 150px minmax(260px, 1fr);
- }
- .cw-stage-inspector {
- grid-column: 1/-1;
- max-height: none;
- display: grid;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: 12px;
- }
- .cw-stage-inspector h3 {
- grid-column: 1/-1;
- }
- .cw-stage-inspector > button {
- align-self: end;
- }
+.cw-stage-track-lane {
+ position: relative;
+ height: 18px;
+ border-left: 1px solid #28272e;
+ background: #121216;
}
-@media (max-width: 650px) {
- .cw-stage-layout {
- grid-template-columns: 1fr;
- gap: 12px;
- }
- .cw-stage-objects {
- max-height: none;
- }
- .cw-stage-object-list {
- flex-direction: row;
- overflow: auto;
- margin: 10px 0;
- }
- .cw-stage-object-list button {
- white-space: nowrap;
- }
- .cw-stage-objects > .cw-domain-field,
- .cw-stage-objects > .cw-domain-checkbox {
- display: none;
- }
- .cw-stage-inspector {
- grid-template-columns: repeat(2, minmax(0, 1fr));
- }
- .cw-stage-transport {
- gap: 6px;
- }
- .cw-stage-dialog .cw-domain-footer {
- gap: 10px;
- }
- .cw-stage-dialog .cw-domain-footer > div {
- flex-wrap: wrap;
- }
+.cw-stage-track-interval {
+ position: absolute;
+ top: 5px;
+ height: 8px;
+ min-width: 2px;
+ border-radius: 3px;
+ background: #51427c;
}
-
-/* The camera and encoder share this exact frame; no min-height may change its aspect. */
-.cw-stage-viewport {
- min-height: 0;
- height: auto;
+.cw-stage-track-point {
+ position: absolute;
+ z-index: 1;
+ top: 3px;
+ width: 8px;
+ height: 8px;
+ padding: 0;
+ border: 0;
+ border-radius: 50%;
+ background: #d6c7ff;
+ transform: translateX(-50%);
}
-.cw-stage-clips,
-.cw-stage-storyboard {
- margin: 16px 0;
+.cw-stage-track-point.is-boundary {
+ border-radius: 2px;
+ background: #a590e8;
+ transform: translateX(-50%) rotate(45deg);
}
-.cw-stage-clip,
-.cw-stage-shot {
+.cw-stage-track-point:hover,
+.cw-stage-track-point:focus-visible {
+ outline: 2px solid #fff;
+ outline-offset: 2px;
+}
+.cw-stage-track-playhead {
+ position: absolute;
+ top: 18px;
+ bottom: 4px;
+ width: 1px;
+ background: #f5b85b;
+ pointer-events: none;
+}
+/* Unsaved-changes guard covering the fullscreen stage. */
+.cw-stage-confirm {
+ position: fixed;
+ z-index: 1200;
+ inset: 0;
display: grid;
- grid-template-columns: repeat(2, minmax(0, 1fr));
- gap: 7px;
- border: 1px solid #39374b;
- border-radius: 8px;
- padding: 10px;
- margin-top: 9px;
+ place-items: center;
+ background: #050509cc;
}
-.cw-stage-clip label,
-.cw-stage-shot label {
+.cw-stage-confirm > div {
display: flex;
flex-direction: column;
- gap: 5px;
- font-size: 11px;
- color: #aaa5bb;
- min-width: 0;
+ gap: 10px;
+ min-width: 280px;
+ padding: 18px;
+ border: 1px solid #494151;
+ border-radius: 10px;
+ background: #19141f;
}
-.cw-stage-clip input,
-.cw-stage-clip select,
-.cw-stage-shot input,
-.cw-stage-shot select {
- width: 100%;
- min-width: 0;
- padding: 6px;
+.cw-stage-confirm h3 {
+ margin: 0;
+ font-size: 15px;
}
-.cw-stage-clip input[type="range"] {
- padding: 0;
- border: 0;
- background: none;
+.cw-stage-dialog .cw-domain-body {
+ display: flex;
+ flex-direction: column;
+ min-height: 0;
+ overflow: hidden;
}
-.cw-stage-clip button,
-.cw-stage-shot button {
- align-self: end;
- font-size: 11px;
- padding: 6px;
+.cw-stage-dialog .cw-domain-body > fieldset.cw-editor-work {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ min-height: 0;
+ border: none;
+ padding: 0 14px 10px;
}
-.cw-stage-shot {
- grid-template-columns:
- minmax(90px, 1fr) repeat(2, minmax(65px, 0.7fr))
- auto auto;
- align-items: end;
+.cw-stage-layout {
+ display: grid;
+ grid-template-columns: 210px minmax(0, 1fr) 270px;
+ gap: 14px;
+ flex: 1;
+ min-height: 0;
}
-.cw-stage-camera-actions {
+.cw-stage-objects,
+.cw-stage-inspector {
+ overflow-y: auto;
+ min-height: 0;
+}
+.cw-stage-center {
display: flex;
- gap: 8px;
- flex-wrap: wrap;
+ min-height: 0;
+ min-width: 0;
+ position: relative;
}
-@media (max-width: 650px) {
- .cw-stage-shot {
- grid-template-columns: repeat(2, minmax(0, 1fr));
- }
+.cw-stage-viewport {
+ position: absolute;
+ inset: 0;
+ border: 1px solid #2e2740;
+ border-radius: 8px;
+ overflow: hidden;
+ background: #0d0a14;
+}
+.cw-stage-viewport canvas {
+ display: block;
+}
+.cw-stage-objects,
+.cw-stage-inspector {
+ min-width: 0;
+}
+.cw-stage-layout h3 {
+ font-size: 13px;
+ margin: 8px 0 14px;
+ color: #dedee6;
+}
+.cw-stage-object-list {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ margin: 15px 0 24px;
+}
+.cw-stage-object-list button {
+ justify-content: flex-start;
+ text-align: left;
+}
+.cw-stage-object-list button[aria-pressed="true"] {
+ background: #6554a83d;
+ border-color: #8e76d1;
+}
+.cw-stage-center {
+ min-width: 0;
+ position: relative;
+}
+/* The shot-materials drawer floats over the viewport like the reference
+ * console's right-hand capture panel. */
+.cw-stage-drawer {
+ position: absolute;
+ top: 12px;
+ right: 12px;
+ z-index: 5;
+ width: min(280px, 70%);
+ max-height: calc(100% - 24px);
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 10px;
+ border-radius: 12px;
+ background: rgba(23, 24, 31, 0.92);
+ box-shadow:
+ inset 0 0 0 1px #3b3d50,
+ 0 8px 24px rgba(0, 0, 0, 0.45);
+}
+.cw-stage-drawer-head {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+.cw-stage-drawer-head h4 {
+ margin: 0;
+ font-size: 12px;
+}
+.cw-stage-drawer-count {
+ font-size: 11px;
+ padding: 1px 7px;
+ border-radius: 999px;
+ background: #2c2e40;
+ color: #c5c5d5;
+}
+.cw-stage-drawer-head button {
+ margin-left: auto;
+ padding: 2px 8px;
+ border: 0;
+ background: none;
+ color: #c5c5d5;
+ font-size: 14px;
+ cursor: pointer;
+}
+.cw-stage-drawer-toolbar {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px;
+ font-size: 11px;
+ color: #c5c5d5;
+}
+.cw-stage-drawer-toolbar label {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+}
+.cw-stage-drawer-list {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ overflow-y: auto;
+ min-height: 44px;
+}
+.cw-stage-drawer-item {
+ display: flex;
+ gap: 8px;
+ align-items: flex-start;
+}
+.cw-stage-drawer-preview {
+ flex: 1;
+ min-width: 0;
+ padding: 0;
+ border: 0;
+ border-radius: 8px;
+ overflow: hidden;
+ background: #101219;
+ text-align: left;
+ cursor: pointer;
+ display: block;
+}
+.cw-stage-drawer-preview img {
+ display: block;
+ width: 100%;
+ aspect-ratio: 16/9;
+ object-fit: cover;
+}
+.cw-stage-drawer-missing {
+ display: grid;
+ place-items: center;
+ width: 100%;
+ aspect-ratio: 16/9;
+ font-size: 11px;
+ color: #8f8fa3;
+}
+.cw-stage-drawer-caption {
+ display: flex;
+ justify-content: space-between;
+ gap: 8px;
+ padding: 5px 8px;
+ font-size: 11px;
+ color: #c5c5d5;
+}
+.cw-stage-drawer-empty {
+ font-size: 11px;
+ color: #8f8fa3;
+ padding: 8px 2px;
+}
+.cw-stage-drawer-actions {
+ display: flex;
+ gap: 6px;
+ flex-wrap: wrap;
+}
+.cw-stage-drawer-actions button {
+ font-size: 11px;
+ padding: 6px 8px;
+}
+.cw-stage-drawer-actions .cw-stage-drawer-primary {
+ margin-left: auto;
+ border-color: #8e76d1;
+}
+.cw-stage-lightbox {
+ position: fixed;
+ inset: 0;
+ z-index: 60;
+ display: grid;
+ place-items: center;
+ background: rgba(10, 11, 15, 0.72);
+}
+.cw-stage-lightbox figure {
+ margin: 0;
+ max-width: min(92vw, 1100px);
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+}
+.cw-stage-lightbox img {
+ max-width: 100%;
+ max-height: 78vh;
+ border-radius: 10px;
+ box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
+}
+.cw-stage-lightbox figcaption {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ font-size: 12px;
+ color: #e7e7f0;
+}
+/* Export dialog: camera source, linked duration, quality and frame rate. */
+.cw-stage-export {
+ width: min(460px, 92vw);
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ padding: 18px;
+ border-radius: 14px;
+ background: #17181f;
+ box-shadow:
+ inset 0 0 0 1px #3b3d50,
+ 0 12px 32px rgba(0, 0, 0, 0.5);
+}
+.cw-stage-export-head {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+.cw-stage-export-head h4 {
+ margin: 0;
+ font-size: 14px;
+}
+.cw-stage-export-head button {
+ margin-left: auto;
+ padding: 2px 8px;
+ border: 0;
+ background: none;
+ color: #c5c5d5;
+ font-size: 14px;
+ cursor: pointer;
+}
+.cw-stage-export-field {
+ display: flex;
+ flex-direction: column;
+ gap: 5px;
+ font-size: 12px;
+}
+.cw-stage-export-field select {
+ padding: 7px;
+}
+.cw-stage-export-grid {
+ display: flex;
+ justify-content: space-between;
+ gap: 10px;
+ flex-wrap: wrap;
+ font-size: 12px;
+ color: #c5c5d5;
+ font-variant-numeric: tabular-nums;
+}
+.cw-stage-export-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: 8px;
+}
+/* The timeline track, transport and storyboard align to the frame width. */
+.cw-stage-stack {
+ margin-inline: auto;
+ min-width: 0;
+}
+.cw-stage-gizmo {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ margin-bottom: 8px;
+}
+.cw-stage-gizmo .cw-domain-note {
+ margin: 0;
+}
+.cw-stage-viewport {
+ width: 100%;
+ aspect-ratio: 16/9;
+ overflow: hidden;
+ box-shadow: inset 0 0 0 1px #3b3d50;
+ border-radius: 12px;
+ background: #151923;
+ touch-action: none;
+}
+.cw-stage-viewport canvas {
+ display: block;
+ width: 100%;
+ height: 100%;
+}
+.cw-stage-transport {
+ display: flex;
+ gap: 10px;
+ align-items: center;
+ flex-wrap: wrap;
+ margin: 15px 0;
+}
+.cw-stage-transport output {
+ font-size: 12px;
+ font-variant-numeric: tabular-nums;
+ color: #c5c5d5;
+}
+.cw-stage-transport label {
+ font-size: 11px;
+ display: flex;
+ gap: 6px;
+ align-items: center;
+}
+.cw-stage-transport input {
+ width: 65px !important;
+ padding: 5px !important;
+}
+.cw-stage-center > input[type="range"] {
+ width: 100%;
+ accent-color: #b493ec;
+}
+.cw-stage-vector {
+ border: 0;
+ padding: 0;
+ margin: 13px 0;
+ display: grid;
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ gap: 6px;
+}
+.cw-stage-vector legend {
+ font-size: 11px;
+ margin-bottom: 7px;
+ color: #b9b7c7;
+}
+.cw-stage-axis {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ color: #9995ad;
+ font-size: 10px;
+}
+.cw-stage-axis input[type="number"] {
+ width: 100% !important;
+ padding: 5px !important;
+ min-width: 0;
+}
+.cw-stage-axis .cw-control-slider {
+ width: 100%;
+}
+.cw-stage-vector input {
+ width: 100% !important;
+ padding: 7px !important;
+ min-width: 0;
+}
+.cw-stage-inspector .cw-domain-field {
+ margin: 11px 0;
+}
+.cw-stage-inspector > h3:not(:first-child) {
+ border-top: 1px solid #32303e;
+ padding-top: 20px;
+ margin-top: 20px;
+}
+.cw-stage-dialog input[type="color"] {
+ padding: 3px;
+ height: 32px;
+ width: 100%;
+}
+.cw-stage-dialog .cw-domain-body {
+ padding-bottom: 10px;
+}
+@media (max-width: 1100px) {
+ .cw-stage-layout {
+ grid-template-columns: 150px minmax(260px, 1fr);
+ }
+ .cw-stage-inspector {
+ grid-column: 1/-1;
+ max-height: none;
+ display: grid;
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ gap: 12px;
+ }
+ .cw-stage-inspector h3 {
+ grid-column: 1/-1;
+ }
+ .cw-stage-inspector > button {
+ align-self: end;
+ }
+}
+@media (max-width: 650px) {
+ .cw-stage-layout {
+ grid-template-columns: 1fr;
+ gap: 12px;
+ }
+ .cw-stage-objects {
+ max-height: none;
+ }
+ .cw-stage-object-list {
+ flex-direction: row;
+ overflow: auto;
+ margin: 10px 0;
+ }
+ .cw-stage-object-list button {
+ white-space: nowrap;
+ }
+ .cw-stage-objects > .cw-domain-field,
+ .cw-stage-objects > .cw-domain-checkbox {
+ display: none;
+ }
+ .cw-stage-inspector {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+ .cw-stage-transport {
+ gap: 6px;
+ }
+ .cw-stage-dialog .cw-domain-footer {
+ gap: 10px;
+ }
+ .cw-stage-dialog .cw-domain-footer > div {
+ flex-wrap: wrap;
+ }
+}
+
+/* The camera and encoder share this exact frame; no min-height may change its aspect. */
+.cw-stage-viewport {
+ min-height: 0;
+ height: auto;
+}
+.cw-stage-clips {
+ margin: 16px 0;
+}
+.cw-stage-clip {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 7px;
+ border: 1px solid #39374b;
+ border-radius: 8px;
+ padding: 10px;
+ margin-top: 9px;
+}
+.cw-stage-clip label {
+ display: flex;
+ flex-direction: column;
+ gap: 5px;
+ font-size: 11px;
+ color: #aaa5bb;
+ min-width: 0;
+}
+.cw-stage-clip input,
+.cw-stage-clip select {
+ width: 100%;
+ min-width: 0;
+ padding: 6px;
+}
+.cw-stage-clip input[type="range"] {
+ padding: 0;
+ border: 0;
+ background: none;
+}
+.cw-stage-clip button {
+ align-self: end;
+ font-size: 11px;
+ padding: 6px;
+}
+.cw-stage-camera-actions {
+ display: flex;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+/* Left panel tabs. */
+.cw-stage-tabs {
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ gap: 4px;
+ margin-bottom: 10px;
+}
+.cw-stage-tabs button {
+ padding: 6px 4px;
+ border: 1px solid #352a4a;
+ border-radius: 6px;
+ font-size: 12px;
+ color: #b9a9c9;
+ background: #1b1526;
+}
+.cw-stage-tabs button[aria-selected="true"] {
+ color: #f0e8f8;
+ border-color: #6b4fa0;
+ background: #2a2040;
+}
+/* Save-state chip in the top bar. */
+.cw-stage-chip {
+ padding: 4px 10px;
+ border-radius: 999px;
+ font-size: 12px;
+ color: #9fd6a8;
+ background: #1d2a1f;
+ border: 1px solid #2f4a33;
+}
+.cw-stage-chip.is-unsaved {
+ color: #f0c2a0;
+ background: #33241a;
+ border-color: #5a3d28;
+}
+/* Aspect mask: letterbox the shot frame over the free-form preview. */
+.cw-stage-mask {
+ position: absolute;
+ inset: 0;
+ z-index: 5;
+ pointer-events: none;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+.cw-stage-mask::after {
+ content: "";
+ width: 100%;
+ height: 100%;
+ max-width: calc((100vh - 260px) * var(--stage-aspect, 1.7778));
+ max-height: calc(100vh - 260px);
+ aspect-ratio: var(--stage-aspect, 1.7778);
+ outline: 9999px solid #050509b8;
+ border: 1px solid #6b4fa0;
+}
+/* Frame drawn around the scissored camera-preview pass. */
+.cw-stage-pipframe {
+ position: absolute;
+ right: 12px;
+ top: 64px;
+ width: min(320px, 25%);
+ aspect-ratio: var(--stage-aspect, 1.7778);
+ z-index: 6;
+ pointer-events: none;
+ border: 1px solid #6b4fa0;
+ border-radius: 4px;
+}
+.cw-stage-pipcanvas {
+ position: absolute;
+ z-index: 6;
+ display: none;
+ box-sizing: border-box;
+ pointer-events: none;
+ border-radius: 8px;
+}
+/* Compact tool buttons: uniform height, quiet borders, clear pressed state. */
+.cw-stage-console .cw-stage-topbar button,
+.cw-stage-console .cw-stage-left button,
+.cw-stage-console .cw-stage-right button,
+.cw-stage-console .cw-stage-bottom button {
+ min-height: 28px;
+ padding: 4px 10px;
+ border: 1px solid #3a3346;
+ border-radius: 6px;
+ font-size: 12px;
+ line-height: 1.2;
+ color: #cbb9dc;
+ background: #221c2e;
+ transition:
+ border-color 120ms ease,
+ color 120ms ease,
+ background 120ms ease;
+}
+.cw-stage-console button:hover:not(:disabled) {
+ border-color: #6b4fa0;
+ color: #f0e8f8;
+}
+.cw-stage-console button:active:not(:disabled) {
+ background: #2e2540;
+}
+.cw-stage-console button[aria-pressed="true"] {
+ border-color: #6b4fa0;
+ color: #f0e8f8;
+ background: #322547;
+}
+.cw-stage-console button:disabled {
+ opacity: 0.45;
+}
+/* Camera preset and move grids in the Cameras tab. */
+.cw-stage-left h4 {
+ margin: 12px 0 6px;
+ font-size: 12px;
+ color: #9d8db2;
+}
+.cw-stage-preset-grid {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 4px;
+}
+.cw-stage-preset-grid button {
+ width: 100%;
+}
+/* Viewfinder FOV bar floating under the top bar. */
+.cw-stage-fovbar {
+ position: absolute;
+ top: calc(var(--stage-topbar-height, 52px) + 6px);
+ left: 50%;
+ transform: translateX(-50%);
+ z-index: 18;
+ padding: 6px 14px;
+ border: 1px solid #3a3346;
+ border-radius: 8px;
+ background: #120e19e6;
+ font-size: 12px;
+}
+.cw-stage-fovbar label {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+}
+.cw-stage-fovbar input[type="range"] {
+ width: 220px;
+}
+/* In the fullscreen console the drawer floats above the panels and sits
+ * left of the right inspector so nothing hides its list. */
+.cw-stage-console .cw-stage-drawer {
+ z-index: 16;
+ right: 318px;
+ top: 64px;
+}
+/* Console controls cheat-sheet, opened from the top bar or the first
+ * object add. */
+.cw-stage-help {
+ width: min(400px, 92vw);
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 18px;
+ border-radius: 14px;
+ background: #17181f;
+ box-shadow:
+ inset 0 0 0 1px #3b3d50,
+ 0 12px 32px rgba(0, 0, 0, 0.5);
+}
+.cw-stage-help h5 {
+ margin: 4px 0 0;
+ font-size: 12px;
+ color: #b9a9c9;
+}
+.cw-stage-help ul {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ font-size: 13px;
+}
+/* Split live preview: camera tabs over the right pane, a draggable
+ * divider at the split ratio. */
+.cw-stage-split-tabs {
+ position: absolute;
+ top: 104px;
+ right: 318px;
+ z-index: 7;
+ display: flex;
+ gap: 6px;
+ flex-wrap: wrap;
+ justify-content: flex-end;
+ pointer-events: none;
+}
+.cw-stage-split-tabs button {
+ pointer-events: auto;
+ min-height: 26px;
+ padding: 3px 9px;
+ border: 1px solid #3a3346;
+ border-radius: 6px;
+ font-size: 12px;
+ color: #cbb9dc;
+ background: #221c2ee6;
+}
+.cw-stage-split-tabs button[aria-selected="true"] {
+ border-color: #8e76d1;
+ color: #f0e9f8;
+}
+.cw-stage-split-divider {
+ position: absolute;
+ top: 100px;
+ bottom: 200px;
+ width: 10px;
+ margin-left: -5px;
+ z-index: 7;
+ cursor: col-resize;
+ background: linear-gradient(
+ to right,
+ transparent 4px,
+ #8e76d1 4px,
+ #8e76d1 6px,
+ transparent 6px
+ );
+ touch-action: none;
+}
+/* V1 visual alignment: match the native Director Stage workbench shell.
+ * Keep the viewport as the base layer, but make the workbench regions flush
+ * with the application bounds instead of looking like a nested dialog. */
+.cw-stage-console {
+ --stage-left-width: 196px;
+ --stage-right-width: 232px;
+ --stage-topbar-height: 38px;
+ --stage-bottom-height: 176px;
+ --stage-surface: #1a1a1a;
+ --stage-surface-raised: #202020;
+ --stage-surface-input: #292929;
+ --stage-border: #303030;
+ --stage-border-strong: #414141;
+ --stage-text: #f0f0f0;
+ --stage-text-muted: #9a9a9a;
+ --stage-accent: #ffffff;
+ --stage-focus: #8c8c8c;
+ --inspector-control: #1d1d1d;
+ --inspector-control-border: #3a3a3a;
+ --inspector-divider: var(--stage-border);
+ --inspector-focus: #6e6e6e;
+ --inspector-hover: #252525;
+ --inspector-muted: #a5a5a5;
+ --inspector-text: #eeeeee;
+ --inspector-toggle-active: #e5e5e5;
+ --stage-control-height: 26px;
+ --stage-icon-control-size: 24px;
+ --stage-heading-height: 30px;
+ --stage-type-title: 11.5px;
+ --stage-type-label: 10.5px;
+ --stage-type-control: 9.5px;
+ --stage-type-nesting-step: 0.5px;
+ --stage-control-focus: #a8adba;
+ --stage-control-active: #333439;
+ --inspector-toggle-thumb: #202020;
+ color: var(--stage-text);
+ background: #0b0b0b;
+ color-scheme: dark;
+ font-family:
+ "Nunito Sans",
+ "Director Stage CJK",
+ ui-sans-serif,
+ -apple-system,
+ BlinkMacSystemFont,
+ "Segoe UI",
+ "PingFang SC",
+ "Microsoft YaHei",
+ sans-serif;
+}
+.cw-stage-console,
+.cw-stage-console * {
+ box-sizing: border-box;
+}
+.cw-domain-overlay:has(> .cw-stage-console) {
+ padding: 0;
+ background: #0b0b0b;
+ backdrop-filter: none;
+}
+.cw-stage-topbar {
+ top: 0;
+ height: var(--stage-topbar-height);
+ min-height: var(--stage-topbar-height);
+ gap: 10px;
+ flex-wrap: nowrap;
+ overflow: hidden;
+ padding: 0 12px;
+ border-bottom: 1px solid var(--stage-border);
+ background: var(--stage-surface);
+}
+.cw-stage-identity {
+ min-width: 0;
+ flex: 0 1 auto;
+ overflow: hidden;
+}
+.cw-stage-identity h2 {
+ overflow: hidden;
+ margin: 0;
+ color: var(--stage-text);
+ font-size: 14px;
+ font-weight: 600;
+ line-height: 1.2;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.cw-stage-toolbar {
+ min-width: 0;
+ flex: 1 1 auto;
+ flex-wrap: nowrap;
+ justify-content: flex-start;
+ gap: 4px;
+ overflow-x: auto;
+}
+.cw-stage-topactions {
+ flex: 0 0 auto;
+ gap: 4px;
+}
+.cw-stage-left,
+.cw-stage-right {
+ top: var(--stage-topbar-height);
+ bottom: 0;
+ width: var(--stage-left-width);
+ padding: 0 12px 16px;
+ border: 0;
+ border-radius: 0;
+ border-color: var(--stage-border);
+ background: var(--stage-surface);
+ box-shadow: none;
+}
+.cw-stage-left {
+ left: 0;
+ border-right: 1px solid var(--stage-border);
+}
+.cw-stage-right {
+ right: 0;
+ width: var(--stage-right-width);
+ border-left: 1px solid var(--stage-border);
+}
+.cw-stage-bottom {
+ left: 0;
+ right: 0;
+ bottom: 0;
+ height: var(--stage-bottom-height);
+ max-height: var(--stage-bottom-height);
+ gap: 8px;
+ overflow-y: auto;
+ padding: 10px 16px;
+ border-top: 1px solid var(--stage-border);
+ background: var(--stage-surface);
+}
+.cw-stage-layout-resizer {
+ position: absolute;
+ top: var(--stage-topbar-height);
+ bottom: 0;
+ z-index: 16;
+ width: 12px;
+ cursor: col-resize;
+ touch-action: none;
+}
+.cw-stage-console[data-preview-mode="dynamic"] .cw-stage-layout-resizer {
+ bottom: var(--stage-bottom-height);
+}
+.cw-stage-console[data-preview-mode="dynamic"] .cw-stage-left,
+.cw-stage-console[data-preview-mode="dynamic"] .cw-stage-right {
+ bottom: var(--stage-bottom-height);
+}
+.cw-stage-layout-resizer.is-left {
+ left: var(--stage-left-width);
+ transform: translateX(-50%);
+}
+.cw-stage-layout-resizer.is-right {
+ right: var(--stage-right-width);
+ transform: translateX(50%);
+}
+.cw-stage-layout-resizer::after {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 5px;
+ width: 2px;
+ background: transparent;
+ content: "";
+}
+.cw-stage-layout-resizer:hover::after,
+.cw-stage-layout-resizer:focus-visible::after {
+ background: var(--stage-focus);
+}
+.cw-stage-timeline-resizer {
+ position: absolute;
+ top: -6px;
+ right: 0;
+ left: 0;
+ z-index: 16;
+ height: 12px;
+ cursor: row-resize;
+ touch-action: none;
+}
+.cw-stage-timeline-resizer::after {
+ position: absolute;
+ top: 5px;
+ right: 0;
+ left: 0;
+ height: 2px;
+ background: transparent;
+ content: "";
+}
+.cw-stage-timeline-resizer:hover::after,
+.cw-stage-timeline-resizer:focus-visible::after {
+ background: var(--stage-focus);
+}
+.cw-stage-console .cw-stage-topbar button,
+.cw-stage-console .cw-stage-left button,
+.cw-stage-console .cw-stage-right button,
+.cw-stage-console .cw-stage-bottom button {
+ min-height: 28px;
+ padding: 4px 9px;
+ border: 1px solid var(--stage-border-strong);
+ border-radius: 4px;
+ color: #d7d7d7;
+ background: var(--stage-surface-raised);
+ font-size: 11px;
+ line-height: 1.2;
+}
+.cw-stage-console button:hover:not(:disabled) {
+ border-color: #5b5b5b;
+ color: #ffffff;
+ background: #2b2b2b;
+}
+.cw-stage-console button:active:not(:disabled),
+.cw-stage-console button[aria-pressed="true"] {
+ border-color: #686868;
+ color: #ffffff;
+ background: #343434;
+}
+.cw-stage-console button:focus-visible,
+.cw-stage-console input:focus-visible,
+.cw-stage-console select:focus-visible,
+.cw-stage-console textarea:focus-visible {
+ outline: 2px solid var(--stage-focus);
+ outline-offset: 2px;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-group-toggle {
+ min-height: 22px;
+ padding: 0 4px 0 1px;
+ border: 0;
+ border-radius: 0;
+ background: transparent;
+}
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-track-group-toggle:hover:not(:disabled),
+.cw-stage-console .cw-stage-bottom .cw-stage-track-group-toggle:focus-visible {
+ border: 0;
+ background: transparent;
+}
+.cw-stage-console
+ :where(
+ input:not(
+ [type="range"],
+ [type="checkbox"],
+ [type="radio"],
+ [type="color"],
+ [type="file"]
+ ),
+ select,
+ textarea
+ ) {
+ min-height: 30px;
+ border: 1px solid var(--stage-border-strong);
+ border-radius: 4px;
+ color: var(--stage-text);
+ background: var(--stage-surface-input);
+}
+.cw-stage-console input[type="range"] {
+ accent-color: var(--stage-accent);
+}
+.cw-stage-console input[type="color"] {
+ min-height: 30px;
+ border: 1px solid var(--stage-border-strong);
+ border-radius: 4px;
+ background: var(--stage-surface-input);
+}
+.cw-stage-tabs {
+ grid-template-columns: repeat(4, minmax(0, 1fr));
+ gap: 0;
+ margin: 0 -12px 12px;
+ padding: 0 8px;
+ border-bottom: 1px solid var(--stage-border);
+}
+.cw-stage-tabs button {
+ display: flex;
+ min-height: 42px;
+ align-items: center;
+ justify-content: center;
+ padding: 0 4px;
+ border: 0;
+ border-bottom: 2px solid transparent;
+ border-radius: 0;
+ color: var(--stage-text-muted);
+ background: transparent;
+ font-size: 11px;
+}
+.cw-stage-tab-icon {
+ display: inline-flex;
+ width: 16px;
+ height: 16px;
+ align-items: center;
+ justify-content: center;
+}
+.cw-stage-tab-icon svg {
+ width: 16px;
+ height: 16px;
+ fill: none;
+ stroke: currentColor;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ stroke-width: 1.25;
+}
+.cw-stage-tabs button[aria-selected="true"] {
+ border-color: var(--stage-accent);
+ color: var(--stage-text);
+ background: transparent;
+}
+.cw-stage-left h4 {
+ color: var(--stage-text-muted);
+ font-weight: 500;
+}
+.cw-stage-object-list {
+ gap: 2px;
+ margin: 12px 0 20px;
+}
+.cw-stage-object-list button {
+ min-height: 30px;
+ border-color: transparent;
+ background: transparent;
+}
+.cw-stage-object-list button:hover:not(:disabled),
+.cw-stage-object-list button[aria-pressed="true"] {
+ border-color: var(--stage-border-strong);
+ background: #292929;
+}
+.cw-stage-right > h3 {
+ margin: 0 -12px;
+ padding: 16px 12px 12px;
+ border-bottom: 1px solid var(--stage-border);
+ color: var(--stage-text);
+ font-size: 13px;
+ font-weight: 600;
+}
+.cw-stage-right > h3:not(:first-child) {
+ margin-top: 18px;
+ border-top: 1px solid var(--stage-border);
+}
+.cw-stage-right .cw-domain-field {
+ gap: 4px;
+ margin: 5px 0;
+ color: var(--stage-text-muted);
+}
+.cw-stage-right .cw-domain-note,
+.cw-stage-left .cw-domain-note,
+.cw-stage-bottom .cw-domain-note {
+ color: var(--stage-text-muted);
+}
+.cw-stage-chip {
+ flex: 0 0 auto;
+ padding: 4px 8px;
+ border: 1px solid #4a4a4a;
+ border-radius: 4px;
+ color: #d3d3d3;
+ background: #292929;
+ font-size: 11px;
+}
+.cw-stage-chip.is-unsaved {
+ border-color: #6b5234;
+ color: #e5bf91;
+ background: #33291f;
+}
+.cw-stage-viewport {
+ border: 0;
+ border-radius: 0;
+ box-shadow: none;
+}
+.cw-stage-drawer {
+ border-radius: 4px;
+ background: #242424;
+ box-shadow:
+ inset 0 0 0 1px var(--stage-border),
+ 0 8px 24px #00000073;
+}
+.cw-stage-confirm > div,
+.cw-stage-help,
+.cw-stage-export {
+ border: 1px solid var(--stage-border-strong);
+ border-radius: 6px;
+ background: #202020;
+ box-shadow: 0 16px 48px #00000080;
+}
+/* V2 visual alignment: asset-library rhythm and compact workbench chrome. */
+.cw-stage-console .cw-stage-panel-search {
+ position: relative;
+ display: block;
+ flex: 0 0 auto;
+ margin: 8px 0 6px;
+}
+.cw-stage-console .cw-stage-panel-search::before {
+ position: absolute;
+ top: calc(50% - 5px);
+ left: 11px;
+ z-index: 1;
+ width: 8px;
+ height: 8px;
+ border: 1px solid #858585;
+ border-radius: 50%;
+ content: "";
+ pointer-events: none;
+}
+.cw-stage-console .cw-stage-panel-search::after {
+ position: absolute;
+ top: calc(50% + 3px);
+ left: 19px;
+ z-index: 1;
+ width: 5px;
+ height: 1px;
+ background: #858585;
+ content: "";
+ pointer-events: none;
+ transform: rotate(45deg);
+ transform-origin: left center;
+}
+.cw-stage-console .cw-stage-panel-search input {
+ width: 100%;
+ height: var(--stage-control-height);
+ padding: 0 10px 0 30px;
+ border-radius: 6px;
+ background: var(--stage-surface-raised);
+}
+.cw-stage-console .cw-stage-panel-search input::placeholder {
+ color: #888888;
+}
+.cw-stage-visually-hidden {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ overflow: hidden;
+ clip: rect(0 0 0 0);
+ white-space: nowrap;
+}
+.cw-stage-left > .cw-stage-tabs {
+ margin: 0 -12px;
+}
+.cw-stage-background-library {
+ display: flex;
+ min-height: calc(100% - 142px);
+ flex-direction: column;
+}
+.cw-stage-background-filters {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ overflow-x: auto;
+ padding: 3px 0 10px;
+}
+.cw-stage-console .cw-stage-left .cw-stage-background-filters button {
+ min-height: 28px;
+ flex: 0 0 auto;
+ padding: 4px 9px;
+ border: 0;
+ border-radius: 14px;
+ color: #858585;
+ background: transparent;
+ white-space: nowrap;
+}
+.cw-stage-console
+ .cw-stage-left
+ .cw-stage-background-filters
+ button:hover:not(:disabled) {
+ border: 0;
+ color: #d8d8d8;
+ background: #242424;
+}
+.cw-stage-console
+ .cw-stage-left
+ .cw-stage-background-filters
+ button[aria-pressed="true"] {
+ border: 0;
+ color: #f0f0f0;
+ background: #343434;
+}
+.cw-stage-background-section {
+ margin-top: 7px;
+}
+.cw-stage-background-section > h4 {
+ margin: 0 0 10px;
+ color: #828282;
+ font-size: 10px;
+ font-weight: 500;
+}
+.cw-stage-console .cw-stage-left .cw-stage-background-add {
+ display: flex;
+ width: 100%;
+ min-height: 34px;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ border: 0;
+ border-radius: 9px;
+ color: #dedede;
+ background: #242424;
+ font-weight: 600;
+}
+.cw-stage-console .cw-stage-left .cw-stage-background-add:hover:not(:disabled) {
+ border: 0;
+ background: #2d2d2d;
+}
+.cw-stage-background-add > span {
+ color: #bdbdbd;
+ font-size: 15px;
+ font-weight: 400;
+ line-height: 1;
+}
+.cw-stage-background-notice {
+ margin: 8px 0 0;
+ color: #8f8f8f;
+ font-size: 10px;
+ line-height: 1.45;
+}
+.cw-stage-background-section.is-canvas-images {
+ display: flex;
+ min-height: 210px;
+ flex: 1 1 auto;
+ flex-direction: column;
+ margin-top: 22px;
+}
+.cw-stage-background-grid {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 8px;
+}
+.cw-stage-console .cw-stage-left .cw-stage-background-card {
+ display: flex;
+ min-width: 0;
+ min-height: 86px;
+ flex-direction: column;
+ align-items: stretch;
+ gap: 6px;
+ padding: 5px;
+ border: 1px solid transparent;
+ border-radius: 7px;
+ color: #bdbdbd;
+ background: transparent;
+ text-align: left;
+}
+.cw-stage-console
+ .cw-stage-left
+ .cw-stage-background-card:hover:not(:disabled) {
+ border-color: #4a4a4a;
+ background: #242424;
+}
+.cw-stage-console
+ .cw-stage-left
+ .cw-stage-background-card[aria-pressed="true"] {
+ border-color: #d0d0d0;
+ background: #292929;
+}
+.cw-stage-background-card-preview {
+ display: grid;
+ width: 100%;
+ height: 58px;
+ overflow: hidden;
+ place-items: center;
+ border-radius: 5px;
+ background: #202020;
+}
+.cw-stage-background-card-preview img {
+ display: block;
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+.cw-stage-background-card-placeholder,
+.cw-stage-background-empty-icon {
+ display: grid;
+ color: #777777;
+ place-items: center;
+}
+.cw-stage-background-card-placeholder svg {
+ width: 20px;
+ height: 20px;
+}
+.cw-stage-background-card > span:last-child {
+ overflow: hidden;
+ font-size: 10px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.cw-stage-background-empty {
+ display: flex;
+ min-height: 190px;
+ flex: 1 1 auto;
+ align-items: center;
+ flex-direction: column;
+ justify-content: flex-start;
+ padding-top: 42px;
+ color: #777777;
+ text-align: center;
+}
+.cw-stage-background-empty-icon {
+ width: 42px;
+ height: 42px;
+ border: 1px solid #353535;
+ border-radius: 13px;
+}
+.cw-stage-background-empty-icon svg {
+ width: 20px;
+ height: 20px;
+}
+.cw-stage-background-card-placeholder svg,
+.cw-stage-background-empty-icon svg {
+ fill: none;
+ stroke: currentColor;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ stroke-width: 1.15;
+}
+.cw-stage-background-empty p {
+ max-width: 174px;
+ margin: 14px 0 0;
+ font-size: 11px;
+ line-height: 1.75;
+}
+.cw-stage-object-grid {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 8px;
+ margin-top: 12px;
+}
+.cw-stage-object-grid button {
+ display: flex;
+ min-height: 108px;
+ align-items: stretch;
+ flex-direction: column;
+ gap: 7px;
+ justify-content: flex-start;
+ padding: 7px;
+ border: 1px solid var(--stage-border);
+ border-radius: 8px;
+ background: #171717;
+ font-size: 11px;
+}
+.cw-stage-object-grid button > .cw-stage-object-preview {
+ display: block;
+ width: 100%;
+ height: 58px;
+ flex: 0 0 58px;
+ border-radius: 5px;
+ overflow: hidden;
+ background: radial-gradient(
+ circle at 50% 34%,
+ #3b3b3b 0,
+ #222222 48%,
+ #151515 100%
+ );
+ box-shadow: inset 0 0 0 1px #ffffff22;
+ position: relative;
+}
+.cw-stage-object-preview img {
+ display: block;
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+.cw-stage-object-preview[data-stage-object-kind="person"] img {
+ object-fit: contain;
+}
+.cw-stage-object-preview-empty {
+ position: absolute;
+ inset: 0;
+ background:
+ linear-gradient(
+ 135deg,
+ transparent 48%,
+ #ffffff1a 49%,
+ #ffffff1a 51%,
+ transparent 52%
+ ),
+ #202020;
+}
+.cw-stage-object-card-name {
+ display: flex;
+ width: 100%;
+ min-width: 0;
+ align-items: center;
+ gap: 6px;
+ overflow: hidden;
+ color: var(--stage-text);
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.cw-stage-object-color {
+ display: block;
+ width: 8px;
+ height: 8px;
+ flex: 0 0 8px;
+ border-radius: 50%;
+ box-shadow: inset 0 0 0 1px #ffffff33;
+}
+.cw-stage-object-grid button[aria-pressed="true"] {
+ border-color: #707070;
+ background: #292929;
+}
+.cw-stage-camera-list {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+}
+.cw-stage-camera-list .cw-stage-camera-row {
+ display: flex;
+ gap: 4px;
+}
+.cw-stage-camera-list .cw-stage-camera-row > button:first-child {
+ flex: 1;
+}
+.cw-stage-import-button {
+ width: 100%;
+ margin-top: 2px;
+}
+.cw-stage-preview-mode {
+ position: absolute;
+ left: 50%;
+ display: flex;
+ flex: 0 0 auto;
+ gap: 2px;
+ padding: 2px;
+ border: 1px solid var(--stage-border);
+ border-radius: 7px;
+ background: #161616;
+ transform: translateX(-50%);
+}
+.cw-stage-preview-mode button {
+ min-width: 64px;
+ min-height: 28px;
+ padding: 3px 10px;
+ border: 0;
+ border-radius: 5px;
+ color: #929292;
+ background: transparent;
+ font-size: 11px;
+}
+.cw-stage-preview-mode button[aria-pressed="true"] {
+ color: #ffffff;
+ background: #2b2b2b;
+}
+/* In the console the gizmo mode bar floats over the scene, clear of the
+ * left library and the right inspector. */
+.cw-stage-console .cw-stage-gizmo {
+ position: absolute;
+ left: 16px;
+ top: 64px;
+ z-index: 6;
+ margin-bottom: 0;
+ padding: 4px 6px;
+ border-radius: 8px;
+ background: #120e19d9;
+ box-shadow: inset 0 0 0 1px #3a3346;
+}
+/* Live pitch/yaw/FOV readout over the viewport, with a reset button. */
+.cw-stage-viewinfo {
+ position: absolute;
+ left: 10px;
+ bottom: 8px;
+ z-index: 5;
+ display: flex;
+ gap: 8px;
+ align-items: center;
+ padding: 4px 8px;
+ border: 1px solid #494151;
+ border-radius: 6px;
+ color: #b9a9c9;
+ background: #19141fcc;
+ font-size: 12px;
+ pointer-events: none;
+}
+.cw-stage-viewinfo span {
+ font-variant-numeric: tabular-nums;
+}
+.cw-stage-viewinfo button {
+ pointer-events: auto;
+ padding: 2px 8px;
+ font-size: 12px;
+}
+/* View-settings popover anchored under the top bar. */
+.cw-stage-viewmenu {
+ position: absolute;
+ top: 56px;
+ right: 14px;
+ z-index: 12;
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ padding: 12px;
+ border-radius: 10px;
+ background: #17181ff2;
+ box-shadow:
+ inset 0 0 0 1px #3b3d50,
+ 0 10px 26px rgba(0, 0, 0, 0.45);
+ font-size: 12px;
+ color: #cbb9dc;
+}
+.cw-stage-viewmenu label {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+/* Object name labels float over the scene at projected positions. */
+.cw-stage-names {
+ position: absolute;
+ inset: 0;
+ z-index: 4;
+ pointer-events: none;
+ overflow: hidden;
+}
+.cw-stage-name {
+ position: absolute;
+ transform: translate(-50%, -100%);
+ padding: 1px 6px;
+ border-radius: 5px;
+ background: #120e19cc;
+ color: #d8cce8;
+ font-size: 11px;
+ white-space: nowrap;
+}
+/* How far a lifted subject stands above the ground: a line down to where it
+ * would land, a ring there and the value between. Like the names it is DOM
+ * over the orbit view, never a render. */
+.cw-stage-elevation {
+ position: absolute;
+ inset: 0;
+ z-index: 4;
+ overflow: hidden;
+ pointer-events: none;
+}
+.cw-stage-elevation svg {
+ display: block;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+}
+.cw-stage-elevation-line,
+.cw-stage-elevation-ring {
+ fill: none;
+ stroke: var(--stage-text);
+ stroke-linecap: round;
+}
+.cw-stage-elevation-line {
+ stroke-width: 1.25;
+}
+.cw-stage-elevation-ring {
+ stroke-width: 1.5;
+}
+.cw-stage-elevation-value {
+ position: absolute;
+ padding: 0 3px;
+ color: var(--stage-text);
+ font-size: 11px;
+ font-variant-numeric: tabular-nums;
+ line-height: 14px;
+ white-space: nowrap;
+ text-shadow:
+ 0 0 2px #000,
+ 0 1px 3px #000;
+}
+/* Scene tree: grouped heads collapse, rows select and act. */
+.cw-stage-tree {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ margin-top: 10px;
+}
+.cw-stage-right-tree {
+ margin: 0 -12px 14px;
+ padding: 0 12px 10px;
+ border-bottom: 1px solid var(--stage-border);
+}
+.cw-stage-tree-title {
+ margin: 0 -12px 8px;
+ padding: 12px;
+ border-bottom: 1px solid var(--stage-border);
+ color: var(--stage-text);
+ font-size: 13px;
+ font-weight: 600;
+}
+.cw-stage-tree-head {
+ text-align: left;
+ font-size: 12px;
+ color: #b9a9c9;
+ background: none;
+ border: 0;
+ padding: 4px 2px;
+}
+.cw-stage-tree-row {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+}
+.cw-stage-tree-row > button:first-child {
+ flex: 1;
+ min-width: 0;
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ text-align: left;
+ font-size: 12px;
+}
+.cw-stage-tree-row > button:first-child span {
+ width: 10px;
+ height: 10px;
+ border-radius: 3px;
+ flex: none;
+}
+.cw-stage-tree-row > button:first-child[aria-selected="true"] {
+ border-color: #8e76d1;
+}
+/* Armed-placement hint bar over the scene. */
+.cw-stage-placehint {
+ position: absolute;
+ left: 50%;
+ top: calc(var(--stage-topbar-height, 52px) + 20px);
+ transform: translateX(-50%);
+ z-index: 8;
+ width: max-content;
+ max-width: min(32rem, calc(100% - 24px));
+ padding: 6px 12px;
+ text-align: center;
+ pointer-events: none;
+}
+/* Anchored per-object action bar, projected above the selection. */
+.cw-stage-actionbar {
+ position: absolute;
+ transform: translate(-50%, -100%);
+ z-index: 6;
+ display: flex;
+ gap: 4px;
+ padding: 3px;
+ border-radius: 8px;
+ background: var(--stage-feedback-surface);
+ box-shadow: inset 0 0 0 1px var(--stage-border-strong);
+}
+.cw-stage-actionbar button {
+ padding: 3px 8px;
+ font-size: 11px;
+}
+
+/* Console-scoped form chrome keeps the neutral grey system even though
+ * the shared domain styles carry a violet tint elsewhere. */
+.cw-stage-console input,
+.cw-stage-console select,
+.cw-stage-console textarea {
+ background: #1e1e1e;
+ border-color: #333333;
+ color: #e5e5e5;
+}
+.cw-stage-console input:focus,
+.cw-stage-console select:focus,
+.cw-stage-console textarea:focus {
+ border-color: #6e6e6e;
+}
+.cw-stage-console .cw-control-slider {
+ accent-color: #8a8a8a;
+}
+/* Higher-specificity neutral overrides for the shared domain form
+ * chrome inside the console. */
+.cw-stage-console .cw-domain-field input:not([type="range"]),
+.cw-stage-console .cw-domain-field select,
+.cw-stage-console .cw-domain-field textarea {
+ border: 1px solid #3a3a3a;
+ color: #e5e5e5;
+ background: #1e1e1e;
+}
+.cw-stage-console .cw-domain-field input:focus-visible,
+.cw-stage-console .cw-domain-field select:focus-visible {
+ border-color: #6e6e6e;
+}
+.cw-stage-console .cw-control-slider {
+ --cw-control-accent: #8a8a8a;
+ --cw-control-track: #3a3a3a;
+ --cw-control-thumb: #e5e5e5;
+}
+
+/* Shared note text stays neutral inside the console. */
+.cw-stage-console .cw-domain-note {
+ color: #8a8a8a;
+}
+.cw-stage-console .cw-stage-row-action {
+ color: #9e9e9e;
+}
+
+/* V5 viewport overlays follow the native anchors: the tool rail begins just
+ * inside the viewport, the settings popover opens beside it, and camera PiP
+ * stays clear of the right inspector. */
+.cw-stage-console .cw-stage-gizmo {
+ position: absolute;
+ top: calc(var(--stage-topbar-height) + 12px);
+ left: calc(var(--stage-left-width) + 12px);
+ z-index: 6;
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ width: calc(var(--stage-icon-control-size) + 10px);
+ margin: 0;
+ padding: 4px;
+ border: 1px solid #333333;
+ border-radius: 8px;
+ background: #141414e8;
+ box-shadow: 0 8px 18px #00000055;
+}
+.cw-stage-console .cw-stage-view-settings-anchor {
+ position: relative;
+ flex: 0 0 var(--stage-icon-control-size);
+ width: var(--stage-icon-control-size);
+ height: var(--stage-icon-control-size);
+}
+/* Keep icon-only controls the same size in the top bar and viewport. */
+.cw-stage-console :is(.cw-stage-toolbar button, .cw-stage-topbar > button, .cw-stage-gizmo button)[data-icon] {
+ width: var(--stage-icon-control-size);
+ min-width: var(--stage-icon-control-size);
+ min-height: var(--stage-icon-control-size);
+ padding: 4px;
+ font-size: 0;
+ text-align: center;
+}
+.cw-stage-console :is(.cw-stage-toolbar button, .cw-stage-topbar > button, .cw-stage-gizmo button)[data-icon]::before {
+ content: attr(data-icon);
+ color: currentColor;
+ font-size: 14px;
+ line-height: 1;
+}
+.cw-stage-console .cw-stage-gizmo .cw-domain-note {
+ display: none;
+}
+.cw-stage-console .cw-stage-viewmenu {
+ top: 50%;
+ right: auto;
+ left: calc(100% + 8px);
+ transform: translateY(-50%);
+ width: 208px;
+ gap: 0;
+ padding: 8px;
+ border: 1px solid var(--stage-border-strong);
+ border-radius: 8px;
+ background: #202020f5;
+ box-shadow: 0 12px 28px #00000080;
+}
+.cw-stage-console .cw-stage-viewmenu label {
+ min-height: 40px;
+ flex-direction: row-reverse;
+ justify-content: space-between;
+ padding: 0 8px;
+ border-radius: 4px;
+ color: var(--stage-text);
+}
+.cw-stage-console .cw-stage-viewmenu label:hover {
+ background: #2a2a2a;
+}
+.cw-stage-console .cw-stage-viewmenu input[type="checkbox"] {
+ appearance: none;
+ width: 18px;
+ height: 18px;
+ margin: 0;
+ border: 0;
+ background: transparent;
+}
+.cw-stage-console .cw-stage-viewmenu input[type="checkbox"]::after {
+ display: block;
+ color: transparent;
+ content: "✓";
+ font-size: 16px;
+ line-height: 18px;
+ text-align: center;
+}
+.cw-stage-console .cw-stage-viewmenu input[type="checkbox"]:checked::after {
+ color: var(--stage-text);
+}
+.cw-stage-console[data-preview-mode="dynamic"] {
+ --stage-pip-bottom: var(--stage-bottom-height);
+}
+.cw-stage-console .cw-stage-pipframe {
+ --stage-pip-min-x: calc(var(--stage-left-width) + 12px);
+ --stage-pip-min-y: calc(var(--stage-topbar-height) + 12px);
+ --stage-pip-width: min(
+ 264px,
+ calc(100vw - var(--stage-left-width) - var(--stage-right-width) - 28px),
+ calc((100dvh - var(--stage-pip-min-y) - var(--stage-pip-bottom, 0px) - 12px) * var(--stage-aspect))
+ );
+ --stage-pip-max-x: calc(100% - var(--stage-right-width) - 16px - var(--stage-pip-width));
+ --stage-pip-max-y: calc(100% - var(--stage-pip-bottom, 0px) - 12px - var(--stage-pip-width) / var(--stage-aspect));
+ left: clamp(var(--stage-pip-min-x), var(--stage-pip-x, var(--stage-pip-max-x)), var(--stage-pip-max-x));
+ right: auto;
+ top: clamp(var(--stage-pip-min-y), var(--stage-pip-y, calc(var(--stage-topbar-height) + 16px)), var(--stage-pip-max-y));
+ width: var(--stage-pip-width);
+ border-color: #4a4a4a;
+ border-radius: 8px;
+ box-shadow: 0 8px 20px #00000066;
+ z-index: 7;
+}
+.cw-stage-console .cw-stage-pipframe.is-collapsed {
+ height: 28px;
+ border-color: transparent;
+ box-shadow: none;
+ aspect-ratio: auto;
+}
+.cw-stage-pip-controls {
+ position: absolute;
+ inset: 2px 2px auto;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+.cw-stage-pipframe.is-collapsed .cw-stage-pip-controls {
+ left: auto;
+ max-width: calc(100% - 4px);
+ gap: 5px;
+ border-radius: 6px;
+ background: var(--stage-feedback-surface);
+ box-shadow: inset 0 0 0 1px var(--stage-border), 0 4px 14px #0005;
+}
+.cw-stage-pip-label {
+ min-width: 0;
+ overflow: hidden;
+ color: var(--stage-text);
+ font-size: var(--stage-type-control);
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.cw-stage-console :is(.cw-stage-pip-toggle, .cw-stage-pip-drag) {
+ display: grid;
+ width: 22px;
+ height: 22px;
+ flex: 0 0 22px;
+ place-items: center;
+ padding: 0;
+ border: 1px solid var(--stage-border);
+ border-radius: 5px;
+ background: var(--stage-feedback-surface);
+ color: var(--stage-text);
+ pointer-events: auto;
+}
+.cw-stage-pipframe.is-collapsed :is(.cw-stage-pip-drag, .cw-stage-pip-toggle) {
+ border-color: transparent;
+}
+.cw-stage-pip-drag {
+ cursor: grab;
+ touch-action: none;
+}
+.cw-stage-pip-drag:active {
+ cursor: grabbing;
+}
+.cw-stage-pip-drag span {
+ width: 12px;
+ height: 8px;
+ background: radial-gradient(circle, currentColor 0.75px, transparent 1px) 0 0 / 4px 4px;
+}
+.cw-stage-pip-toggle span {
+ width: 6px;
+ height: 6px;
+ border-top: 1px solid currentColor;
+ border-left: 1px solid currentColor;
+ transform: translateY(1px) rotate(45deg);
+}
+.cw-stage-pip-toggle[aria-expanded="false"] span {
+ transform: translateY(-1px) rotate(225deg);
+}
+.cw-stage-console .cw-stage-viewinfo {
+ right: calc(var(--stage-right-width) + 12px);
+ bottom: 12px;
+ left: auto;
+ border-color: #3a3a3a;
+ background: #1a1a1acc;
+}
+.cw-stage-console[data-preview-mode="dynamic"] .cw-stage-viewinfo {
+ bottom: calc(var(--stage-bottom-height) + 12px);
+}
+
+/* Shoot/viewfinder mode clears the workbench panels and leaves a camera
+ * frame below the persistent top bar, matching the native capture state. */
+.cw-stage-console.is-viewfinder .cw-stage-left,
+.cw-stage-console.is-viewfinder .cw-stage-right,
+.cw-stage-console.is-viewfinder .cw-stage-bottom,
+.cw-stage-console.is-viewfinder .cw-stage-layout-resizer,
+.cw-stage-console.is-viewfinder .cw-stage-timeline-resizer,
+.cw-stage-console.is-viewfinder .cw-stage-gizmo,
+.cw-stage-console.is-viewfinder .cw-stage-actionbar,
+.cw-stage-console.is-viewfinder .cw-stage-pipcanvas,
+.cw-stage-console.is-viewfinder .cw-stage-pipframe,
+.cw-stage-console.is-viewfinder .cw-stage-viewinfo,
+.cw-stage-console.is-viewfinder .cw-stage-names,
+.cw-stage-console.is-viewfinder .cw-stage-elevation,
+.cw-stage-console.is-viewfinder .cw-stage-mask {
+ display: none;
+}
+.cw-stage-console.is-viewfinder .cw-stage-scene::after {
+ position: absolute;
+ top: 104px;
+ left: 50%;
+ width: calc(100% - 276px);
+ max-height: calc(100% - 156px);
+ aspect-ratio: var(--stage-aspect, 1.7778);
+ border: 1px solid #8a8a8a;
+ content: "";
+ transform: translateX(-50%);
+ pointer-events: none;
+ z-index: 5;
+}
+.cw-stage-console.is-viewfinder .cw-stage-fovbar {
+ top: 80px;
+ left: calc(var(--stage-left-width) - 110px);
+ transform: none;
+ padding: 0;
+ border: 0;
+ background: transparent;
+ box-shadow: none;
+ color: var(--stage-text-muted);
+ font-size: 10px;
+}
+.cw-stage-console.is-viewfinder .cw-stage-fovbar input[type="range"] {
+ width: 90px;
+ height: 12px;
+}
+
+/* F3 right rail: keep the object tree visible while properties get their own
+ * scroll context, matching the two-level inspector in the reference stage. */
+.cw-stage-console .cw-stage-right {
+ display: flex;
+ flex-direction: column;
+ min-height: 0;
+ overflow: hidden;
+ padding: 0;
+}
+.cw-stage-console .cw-stage-right-tree-panel {
+ display: flex;
+ flex: 0 1 auto;
+ max-height: 42%;
+ min-height: 0;
+ flex-direction: column;
+ margin: 0;
+ padding: 0 12px 10px;
+ overflow: hidden;
+ border: 0;
+ border-bottom: 1px solid var(--stage-border);
+}
+.cw-stage-console .cw-stage-panel-heading {
+ display: flex;
+ flex: 0 0 var(--stage-heading-height);
+ min-height: var(--stage-heading-height);
+ align-items: center;
+ gap: 8px;
+ margin: 0 -12px;
+ padding: 0 12px;
+ border-bottom: 1px solid var(--stage-border);
+}
+.cw-stage-console .cw-stage-panel-heading h3 {
+ margin: 0;
+ color: var(--stage-text);
+ font-size: 12px;
+ font-weight: 600;
+}
+.cw-stage-console .cw-stage-panel-icon {
+ display: inline-flex;
+ width: 16px;
+ height: 16px;
+ align-items: center;
+ justify-content: center;
+ color: var(--stage-text-muted);
+ font-size: 15px;
+ line-height: 1;
+}
+.cw-stage-console .cw-stage-inspector > .cw-stage-panel-heading {
+ margin: 0;
+ padding: 0 12px;
+}
+.cw-stage-console .cw-stage-tree-scroll {
+ flex: 1 1 auto;
+ min-height: 0;
+ overflow-y: auto;
+ margin-right: -12px;
+ padding-right: 12px;
+ scrollbar-gutter: stable;
+}
+.cw-stage-console .cw-stage-tree {
+ gap: 2px;
+ margin: 0;
+}
+.cw-stage-console .cw-stage-tree-head {
+ display: flex;
+ width: 100%;
+ min-height: 26px;
+ align-items: center;
+ gap: 6px;
+ padding: 2px 8px;
+ border: 0;
+ color: var(--stage-text-muted);
+ background: transparent;
+ font-size: 11px;
+ font-weight: 600;
+}
+.cw-stage-console .cw-stage-tree-head:hover:not(:disabled) {
+ border: 0;
+ color: var(--stage-text);
+ background: #242424;
+}
+.cw-stage-tree-chevron {
+ display: inline-flex;
+ width: 12px;
+ height: 12px;
+ justify-content: center;
+ align-items: center;
+ flex: none;
+ color: #a8a8a8;
+}
+.cw-stage-tree-chevron::before,
+.cw-stage-track-group-chevron::before {
+ width: 6px;
+ height: 6px;
+ border-right: 1.5px solid currentColor;
+ border-bottom: 1.5px solid currentColor;
+ content: "";
+ transform: rotate(-45deg);
+}
+.cw-stage-tree-chevron[data-expanded="true"]::before,
+.cw-stage-track-group-chevron[data-expanded="true"]::before {
+ transform: rotate(45deg);
+}
+.cw-stage-console .cw-stage-tree-row {
+ min-height: 28px;
+ padding-left: 18px;
+}
+.cw-stage-console .cw-stage-tree-row > button:first-child {
+ min-height: 26px;
+ padding: 2px 8px;
+ border: 1px solid transparent;
+ border-radius: 4px;
+ color: var(--stage-text);
+ background: transparent;
+}
+.cw-stage-console .cw-stage-tree-row > button:first-child:hover:not(:disabled),
+.cw-stage-console
+ .cw-stage-tree-row
+ > button:first-child[aria-selected="true"] {
+ border-color: #3d3d3d;
+ background: #292929;
+}
+.cw-stage-console .cw-stage-tree-row > button:first-child span {
+ width: 8px;
+ height: 8px;
+ border-radius: 2px;
+}
+.cw-stage-console .cw-stage-row-action {
+ width: 26px;
+ min-width: 26px;
+ min-height: 26px;
+ padding: 3px;
+ border-color: transparent;
+ color: var(--stage-text-muted);
+ background: transparent;
+}
+.cw-stage-console .cw-stage-row-action:hover:not(:disabled) {
+ border-color: #3d3d3d;
+ background: #292929;
+}
+.cw-stage-console .cw-stage-inspector {
+ display: flex;
+ flex: 1 1 auto;
+ min-height: 0;
+ flex-direction: column;
+ overflow: hidden;
+ padding: 0;
+}
+.cw-stage-console .cw-stage-inspector-scroll {
+ flex: 1 1 auto;
+ min-height: 0;
+ overflow-y: auto;
+ padding: 4px 12px 12px;
+ scrollbar-gutter: stable;
+}
+.cw-stage-console .cw-stage-inspector-section {
+ min-width: 0;
+}
+.cw-stage-console .cw-stage-inspector-section + .cw-stage-inspector-section {
+ margin-top: 8px;
+ padding-top: 6px;
+ border-top: 1px solid var(--stage-border);
+}
+.cw-stage-console .cw-stage-inspector-section > h4,
+.cw-stage-console .cw-stage-clips > h3 {
+ margin: 0 0 12px;
+ color: var(--stage-text);
+ font-size: 12px;
+ font-weight: 600;
+}
+.cw-stage-console .cw-stage-inspector-section .cw-domain-field {
+ gap: 4px;
+ margin: 5px 0;
+}
+.cw-stage-console .cw-stage-vector {
+ gap: 4px;
+ margin: 2px 0 4px;
+}
+.cw-stage-drag-value {
+ position: relative;
+ display: flex;
+ width: 100%;
+ min-width: 0;
+ height: 26px;
+ min-height: 26px;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px;
+ box-sizing: border-box;
+ padding: 0 5px;
+ border: 1px solid #303030;
+ border-radius: 5px;
+ color: #bdbdbd;
+ background: #1d1d1d;
+ cursor: ew-resize;
+ touch-action: none;
+ user-select: none;
+}
+.cw-stage-drag-value:hover,
+.cw-stage-drag-value:focus-visible,
+.cw-stage-drag-value:focus-within {
+ border-color: #575757;
+ color: #eeeeee;
+ background: #252525;
+ outline: none;
+}
+.cw-stage-drag-value-label {
+ position: relative;
+ z-index: 1;
+ flex: 0 0 auto;
+ min-width: max-content;
+ overflow: visible;
+ color: #a5a5a5;
+ font-size: 10px;
+ pointer-events: none;
+ white-space: nowrap;
+}
+.cw-stage-drag-value-number {
+ position: absolute;
+ inset: 0;
+ z-index: 2;
+ display: block;
+ width: auto;
+ min-width: 0;
+ min-height: 0;
+ pointer-events: none;
+}
+.cw-stage-console .cw-stage-drag-value input[type="number"] {
+ position: absolute;
+ inset: -1px;
+ width: 100% !important;
+ min-width: 0;
+ /* The drag row owns the height; the shared text-input minimum is taller. */
+ min-height: 0;
+ height: 100%;
+ box-sizing: border-box;
+ margin: 0;
+ padding: 0 5px !important;
+ border: 0 !important;
+ outline: none !important;
+ outline-offset: 0;
+ box-shadow: none !important;
+ color: #e2e2e2;
+ background: transparent !important;
+ font-size: 11px;
+ font-variant-numeric: tabular-nums;
+ text-align: right;
+ cursor: ew-resize;
+ pointer-events: auto;
+}
+.cw-stage-console .cw-stage-drag-value input[type="number"]:focus,
+.cw-stage-console .cw-stage-drag-value input[type="number"]:focus-visible {
+ border: 0 !important;
+ outline: none !important;
+ outline-offset: 0;
+ box-shadow: none !important;
+}
+.cw-stage-drag-value input[type="number"]::-webkit-inner-spin-button,
+.cw-stage-drag-value input[type="number"]::-webkit-outer-spin-button {
+ margin: 0;
+ appearance: none;
+}
+.cw-stage-drag-value input[type="number"] {
+ appearance: textfield;
+}
+
+/* Director Stage timeline: compact neutral hierarchy shared by the ruler,
+ * tree rows and grid. Geometry here mirrors the row constants in
+ * DirectorStage.tsx; the ruler/grid/playhead all use the same 144px lane. */
+.cw-stage-console .cw-stage-bottom {
+ gap: 0;
+ padding: 0;
+ background: #151515;
+}
+.cw-stage-timeline-shell {
+ position: relative;
+ flex: 0 0 auto;
+ min-width: 0;
+ border-bottom: 1px solid #303030;
+ background: #171717;
+}
+.cw-stage-console .cw-stage-transport {
+ min-height: 26px;
+ flex-wrap: nowrap;
+ gap: 4px;
+ margin: 0;
+ padding: 0 8px;
+ border-bottom: 1px solid #292929;
+ background: #191919;
+ color: #a9a9a9;
+}
+.cw-stage-timeline-title {
+ display: inline-flex;
+ min-width: 76px;
+ align-items: center;
+ gap: 5px;
+ color: #e2e2e2;
+ font-size: 11px;
+ font-weight: 600;
+ white-space: nowrap;
+}
+.cw-stage-timeline-title > span {
+ color: #bdbdbd;
+ font-size: 12px;
+}
+.cw-stage-console .cw-stage-transport .cw-stage-transport-play,
+.cw-stage-console .cw-stage-transport .cw-stage-record-keyframe {
+ display: inline-grid;
+ width: 26px;
+ min-width: 26px;
+ min-height: 26px;
+ place-items: center;
+ padding: 0;
+ border: 0;
+ border-radius: 2px;
+ color: #a9a9a9;
+ background: transparent;
+ font-size: 12px;
+}
+.cw-stage-console
+ .cw-stage-transport
+ .cw-stage-transport-play:hover:not(:disabled),
+.cw-stage-console
+ .cw-stage-transport
+ .cw-stage-record-keyframe:hover:not(:disabled) {
+ border: 0;
+ color: #ffffff;
+ background: #2a2a2a;
+}
+.cw-stage-console .cw-stage-transport output {
+ min-width: 98px;
+ color: #a7a7a7;
+ font-size: 10px;
+ font-variant-numeric: tabular-nums;
+ white-space: nowrap;
+}
+.cw-stage-transport-spacer {
+ flex: 1 1 auto;
+}
+.cw-stage-transport-meta,
+.cw-stage-console .cw-stage-transport .cw-stage-duration-control {
+ display: inline-flex;
+ align-items: center;
+ gap: 5px;
+ color: #909090;
+ font-size: 10px;
+ white-space: nowrap;
+}
+.cw-stage-transport-meta b {
+ color: #dedede;
+ font-weight: 600;
+}
+.cw-stage-console .cw-stage-transport .cw-stage-duration-control input {
+ width: 46px !important;
+ min-height: 22px;
+ padding: 2px 4px !important;
+ border-color: transparent;
+ border-radius: 2px;
+ color: #dedede;
+ background: #202020;
+ font-size: 10px;
+ font-variant-numeric: tabular-nums;
+}
+.cw-stage-console .cw-stage-transport .cw-stage-record-keyframe {
+ color: #8d8d8d;
+ font-size: 8px;
+}
+.cw-stage-console .cw-stage-playhead-slider {
+ position: absolute;
+ top: 32px;
+ right: 0;
+ left: 144px;
+ z-index: 10;
+ width: calc(100% - 144px);
+ height: 27px;
+ margin: 0;
+ opacity: 0;
+ cursor: ew-resize;
+}
+.cw-stage-console .cw-stage-playhead-slider:focus-visible {
+ opacity: 0.14;
+ outline: 1px solid #bdbdbd;
+ outline-offset: -1px;
+}
+.cw-stage-console .cw-stage-track-surface {
+ padding: 0;
+ border: 0;
+ background: #161616;
+ cursor: default;
+ overflow-x: hidden;
+}
+.cw-stage-console .cw-stage-track-ruler {
+ z-index: 6;
+ min-height: 27px;
+ border-bottom: 1px solid #303030;
+ background: #1b1b1b;
+ color: #777777;
+}
+.cw-stage-console .cw-stage-track-ruler::before {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ width: 143px;
+ border-right: 1px solid #3b3b3b;
+ background: #191919;
+ content: "";
+}
+.cw-stage-track-ruler-caption {
+ position: absolute;
+ top: 7px;
+ left: 8px;
+ z-index: 1;
+ color: #777777;
+ font-size: 9px;
+ line-height: 1;
+}
+.cw-stage-console .cw-stage-track-ruler-scale {
+ cursor: default;
+ left: 144px;
+}
+.cw-stage-console .cw-stage-track-ruler-tick {
+ height: 6px;
+ background: #393939;
+}
+.cw-stage-console .cw-stage-track-ruler-tick.is-major {
+ height: 11px;
+ background: #555555;
+}
+.cw-stage-console .cw-stage-track-ruler-label {
+ top: -8px;
+ color: #8f8f8f;
+ font-size: 9px;
+ font-variant-numeric: tabular-nums;
+}
+.cw-stage-track-grid {
+ position: absolute;
+ top: 27px;
+ right: 0;
+ bottom: 0;
+ left: 144px;
+ z-index: 2;
+ overflow: hidden;
+ pointer-events: none;
+}
+.cw-stage-track-grid-line {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ width: 1px;
+ background: #242424;
+}
+.cw-stage-track-grid-line.is-major {
+ background: #303030;
+}
+.cw-stage-console .cw-stage-track-group-row,
+.cw-stage-console .cw-stage-track-row {
+ position: relative;
+ z-index: 1;
+ grid-template-columns: 144px minmax(0, 1fr);
+ gap: 0;
+ align-items: stretch;
+ background: transparent;
+}
+.cw-stage-console .cw-stage-track-group-row {
+ min-height: 22px;
+ border-top: 0;
+ border-bottom: 1px solid #303030;
+}
+.cw-stage-console .cw-stage-track-row {
+ min-height: 20px;
+ border-bottom: 1px solid #292929;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-group-toggle {
+ z-index: 3;
+ height: 21px;
+ min-height: 21px;
+ gap: 4px;
+ padding: 0 8px;
+ border-right: 1px solid #3b3b3b;
+ color: #d2d2d2;
+ background: #242424;
+}
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-track-group-toggle:hover:not(:disabled),
+.cw-stage-console .cw-stage-bottom .cw-stage-track-group-toggle:focus-visible {
+ color: #ffffff;
+ background: #2b2b2b;
+}
+.cw-stage-console .cw-stage-track-group-label {
+ color: inherit;
+ font-size: 10px;
+ font-weight: 600;
+}
+.cw-stage-console .cw-stage-track-group-chevron {
+ display: inline-flex;
+ height: 12px;
+ align-items: center;
+ justify-content: center;
+ width: 9px;
+ color: #929292;
+ flex: none;
+}
+.cw-stage-console .cw-stage-track-group-icon,
+.cw-stage-console .cw-stage-track-group-icon.is-camera,
+.cw-stage-console .cw-stage-track-group-icon.is-object {
+ width: 11px;
+ color: #9a9a9a;
+ font-size: 8px;
+}
+.cw-stage-console .cw-stage-track-group-lane {
+ background: #232323d9;
+}
+.cw-stage-console .cw-stage-track-label {
+ z-index: 3;
+ display: flex;
+ height: 19px;
+ align-items: center;
+ padding: 0 8px 0 14px;
+ border-right: 1px solid #353535;
+ color: #a5a5a5;
+ background: #181818;
+ font-size: 10px;
+}
+.cw-stage-console .cw-stage-track-label::before {
+ display: none;
+}
+.cw-stage-track-label-text {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-add {
+ box-sizing: border-box;
+ display: inline-grid;
+ flex: 0 0 auto;
+ width: 18px;
+ min-width: 18px;
+ max-width: 18px;
+ height: 18px;
+ min-height: 18px;
+ max-height: 18px;
+ place-items: center;
+ align-self: center;
+ justify-self: end;
+ margin-left: auto;
+ padding: 0;
+ border: 0;
+ border-radius: 0;
+ outline: 0;
+ box-shadow: none;
+ color: transparent;
+ background: transparent;
+ appearance: none;
+ line-height: 0;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-add-glyph {
+ display: block;
+ width: 7px;
+ height: 7px;
+ margin: 0;
+ border: 1px solid #777777;
+ background: #181818;
+ transform-origin: center;
+ transform: rotate(45deg);
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-add-glyph.is-set {
+ border-color: #d9d9d9;
+ background: #d9d9d9;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-add:hover:not(:disabled),
+.cw-stage-console .cw-stage-bottom .cw-stage-track-add:focus-visible {
+ border: 0;
+ color: #ededed;
+ background: #303030;
+}
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-track-add:hover:not(:disabled)
+ .cw-stage-track-add-glyph,
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-track-add:focus-visible
+ .cw-stage-track-add-glyph {
+ border-color: #ffffff;
+}
+.cw-stage-console .cw-stage-track-lane {
+ z-index: 3;
+ height: 19px;
+ border-left: 0;
+ background: transparent;
+ cursor: crosshair;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-interval {
+ position: absolute;
+ top: 8px;
+ height: 3px;
+ min-width: 2px;
+ min-height: 0;
+ margin: 0;
+ padding: 0;
+ border: 0;
+ border-radius: 1px;
+ background: #4a4a4a;
+ appearance: none;
+ cursor: pointer;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-interval:hover,
+.cw-stage-console .cw-stage-bottom .cw-stage-track-interval:focus-visible {
+ background: #777777;
+ outline: 1px solid #cfcfcf;
+ outline-offset: 1px;
+}
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-track-interval[aria-pressed="true"] {
+ background: #d9d9d9;
+}
+.cw-stage-track-interval-curve {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ display: grid;
+ width: 17px;
+ height: 15px;
+ place-items: center;
+ border: 1px solid #6c6c6c;
+ border-radius: 4px;
+ color: #d8d8d8;
+ background: #202020;
+ font-size: 11px;
+ line-height: 1;
+ transform: translate(-50%, -50%);
+}
+.cw-stage-transition-editor {
+ position: fixed;
+ z-index: 80;
+ box-sizing: border-box;
+ width: 304px;
+ padding: 12px;
+ border: 1px solid #474747;
+ border-radius: 12px;
+ color: #d9d9d9;
+ background: #292929;
+ box-shadow: 0 14px 38px #00000080;
+ transform: translateX(-50%);
+}
+.cw-stage-transition-editor::after {
+ position: absolute;
+ bottom: -7px;
+ left: 50%;
+ width: 12px;
+ height: 12px;
+ border-right: 1px solid #474747;
+ border-bottom: 1px solid #474747;
+ background: #292929;
+ content: "";
+ transform: translateX(-50%) rotate(45deg);
+}
+.cw-stage-transition-editor > header {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 8px;
+ margin-bottom: 10px;
+}
+.cw-stage-transition-editor > header > div {
+ display: grid;
+ min-width: 0;
+ gap: 4px;
+}
+.cw-stage-transition-editor > header strong {
+ overflow: hidden;
+ color: #f0f0f0;
+ font-size: 11px;
+ font-weight: 650;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.cw-stage-transition-editor > header small {
+ color: #858585;
+ font-size: 9px;
+}
+.cw-stage-console .cw-stage-transition-editor > header button {
+ width: 22px;
+ min-width: 22px;
+ height: 22px;
+ min-height: 22px;
+ padding: 0;
+ border: 0;
+ color: #909090;
+ background: transparent;
+ font-size: 16px;
+}
+.cw-stage-console .cw-stage-transition-editor > header button:hover,
+.cw-stage-console .cw-stage-transition-editor > header button:focus-visible {
+ color: #ffffff;
+ background: #373737;
+}
+.cw-stage-transition-select {
+ display: grid;
+ grid-template-columns: 42px minmax(0, 1fr);
+ align-items: center;
+ min-height: 32px;
+ margin-bottom: 8px;
+ padding: 0 8px;
+ border: 1px solid #343434;
+ border-radius: 7px;
+ color: #8e8e8e;
+ background: #181818;
+ font-size: 10px;
+}
+.cw-stage-transition-select select {
+ min-height: 30px;
+ padding: 0 6px;
+ border: 0;
+ color: #dedede;
+ background: transparent;
+ font-size: 10px;
+}
+.cw-stage-transition-graph {
+ display: block;
+ width: 100%;
+ height: 248px;
+ border: 1px solid #353535;
+ border-radius: 7px;
+ background: #191919;
+}
+.cw-stage-transition-graph > line {
+ stroke: #252525;
+ stroke-width: 1;
+}
+.cw-stage-transition-curve {
+ fill: none;
+ stroke: #dedede;
+ stroke-width: 1.5;
+}
+.cw-stage-transition-handles line {
+ stroke: #686868;
+ stroke-width: 1;
+}
+.cw-stage-transition-handles circle {
+ fill: #191919;
+ stroke: #bdbdbd;
+ stroke-width: 1;
+}
+.cw-stage-transition-endpoint {
+ fill: #f0f0f0;
+}
+.cw-stage-transition-graph text {
+ fill: #777777;
+ font-size: 7px;
+}
+.cw-stage-transition-controls {
+ display: grid;
+ grid-template-columns: repeat(4, minmax(0, 1fr));
+ gap: 4px;
+ margin: 9px 0 0;
+ padding: 0;
+ border: 0;
+}
+.cw-stage-transition-controls legend {
+ grid-column: 1 / -1;
+ margin-bottom: 5px;
+ padding: 0;
+ color: #8c8c8c;
+ font-size: 9px;
+}
+.cw-stage-transition-controls input {
+ box-sizing: border-box;
+ width: 100%;
+ min-width: 0;
+ min-height: 28px;
+ padding: 4px 5px;
+ border: 1px solid #353535;
+ border-radius: 6px;
+ color: #d8d8d8;
+ background: #181818;
+ font-size: 10px;
+ font-variant-numeric: tabular-nums;
+}
+.cw-stage-transition-controls:disabled input {
+ color: #747474;
+ opacity: 1;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-point {
+ position: absolute;
+ z-index: 5;
+ top: 6px;
+ width: 7px;
+ min-width: 7px;
+ height: 7px;
+ min-height: 7px;
+ padding: 0;
+ border: 0;
+ border-radius: 1px;
+ background: #747474;
+ transform: translateX(-50%) rotate(45deg);
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-point.is-boundary {
+ border-radius: 1px;
+ background: #858585;
+ transform: translateX(-50%) rotate(45deg);
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-point[aria-pressed="true"] {
+ background: #e5e5e5;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-point:hover,
+.cw-stage-console .cw-stage-bottom .cw-stage-track-point:focus-visible {
+ outline: 1px solid #ffffff;
+ outline-offset: 2px;
+}
+.cw-stage-track-playhead-lane {
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 144px;
+ z-index: 7;
+ overflow: hidden;
+ pointer-events: none;
+}
+.cw-stage-console .cw-stage-track-playhead {
+ top: 0;
+ bottom: 0;
+ width: 2px;
+ background: #d9d9d9;
+ transform: translateX(-1px);
+}
+.cw-stage-console .cw-stage-track-ruler-hit {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ z-index: 8;
+ width: 12px;
+ background: transparent;
+ cursor: ew-resize;
+ transform: translateX(-50%);
+}
+.cw-stage-console .cw-stage-track-playhead::before {
+ position: absolute;
+ top: 19px;
+ left: -2px;
+ width: 6px;
+ height: 5px;
+ background: #d9d9d9;
+ clip-path: polygon(0 0, 100% 0, 50% 100%);
+ content: "";
+}
+.cw-stage-track-point-delete {
+ position: absolute;
+ top: 50%;
+ z-index: 3;
+ transform: translateY(-50%);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 14px;
+ height: 14px;
+ padding: 0;
+ border: 1px solid #6b5b8a;
+ border-radius: 50%;
+ background: #1c1626;
+ color: #d9cdf0;
+ font-size: 10px;
+ line-height: 1;
+ cursor: pointer;
+}
+.cw-stage-track-point-delete:hover,
+.cw-stage-track-point-delete:focus-visible {
+ background: #3a2440;
+ color: #ffffff;
+}
+
+/* Storyboard track: the `+` in its label, the camera chooser above it, and the
+ * blocks. The chooser is fixed to the viewport like the transition editor, so the
+ * scrolling track surface can neither clip nor scroll it. A block shows its
+ * camera's name and stays selectable. */
+.cw-stage-console .cw-stage-bottom .cw-stage-storyboard-add {
+ box-sizing: border-box;
+ display: inline-grid;
+ flex: 0 0 auto;
+ width: 18px;
+ min-width: 18px;
+ max-width: 18px;
+ height: 18px;
+ min-height: 18px;
+ max-height: 18px;
+ place-items: center;
+ margin-left: auto;
+ padding: 0;
+ border: 0;
+ border-radius: 0;
+ box-shadow: none;
+ color: #a5a5a5;
+ background: transparent;
+ appearance: none;
+ line-height: 0;
+}
+.cw-stage-storyboard-add-glyph {
+ position: relative;
+ display: block;
+ width: 9px;
+ height: 9px;
+}
+.cw-stage-storyboard-add-glyph::before,
+.cw-stage-storyboard-add-glyph::after {
+ position: absolute;
+ top: 50%;
+ left: 0;
+ width: 9px;
+ height: 1px;
+ background: currentColor;
+ content: "";
+ transform: translateY(-50%);
+}
+.cw-stage-storyboard-add-glyph::after {
+ transform: translateY(-50%) rotate(90deg);
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-storyboard-add:hover:not(:disabled),
+.cw-stage-console .cw-stage-bottom .cw-stage-storyboard-add:focus-visible,
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-storyboard-add[aria-expanded="true"] {
+ border: 0;
+ color: #ffffff;
+ background: #303030;
+}
+.cw-stage-storyboard-block-shell {
+ position: absolute;
+ /* Leave four pixels of the lane above and below the block. */
+ top: 4px;
+ height: calc(var(--stage-storyboard-row-height) - 9px);
+ min-width: 2px;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-storyboard-block {
+ position: absolute;
+ display: flex;
+ gap: 6px;
+ align-items: center;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ min-width: 0;
+ min-height: 0;
+ margin: 0;
+ padding: 0 5px 0 4px;
+ /* One pixel of the lane between neighbours, so two blocks of one camera stay two blocks. */
+ border: 0;
+ border-right: 1px solid #161616;
+ border-radius: 2px;
+ color: #e2e2e2;
+ background: #3f3f3f;
+ font-size: 10px;
+ line-height: 12px;
+ text-align: left;
+ appearance: none;
+ cursor: pointer;
+ /* What a block shows depends on how wide the block itself is, so its own width is
+ * queried as a container and never follows what it holds. */
+ container-type: inline-size;
+}
+/* The picture of the block's camera, in the output frame. The box is there before the
+ * picture is and when none could be made, so the block never moves when it arrives. */
+.cw-stage-storyboard-block-thumbnail {
+ box-sizing: border-box;
+ flex: 0 1 auto;
+ height: 24px;
+ min-width: 0;
+ max-width: 100%;
+ aspect-ratio: var(--stage-thumbnail-ratio);
+ border-radius: 2px;
+ overflow: hidden;
+ background: #242424;
+}
+.cw-stage-storyboard-block-thumbnail img {
+ display: block;
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-storyboard-block:hover,
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-storyboard-block:focus-visible:where(:not([data-dragging="true"] *)) {
+ border-color: #161616;
+ color: #ffffff;
+ background: #565656;
+}
+/* The selected block: a fill inside its own box. It is shown without a hover and
+ * takes no space, so the block's edges stay where the track put them. */
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-storyboard-block[aria-pressed="true"] {
+ background: #5b4b9b;
+}
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-storyboard-block[aria-pressed="true"]:hover,
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-storyboard-block[aria-pressed="true"]:focus-visible:where(:not([data-dragging="true"] *)) {
+ background: #6b5bb0;
+}
+/* The block under the playhead: a white ring outside its box. An outline takes no
+ * space, and the block is lifted above its neighbours, so the ring is painted over
+ * them instead of being covered by the block on its right. */
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-storyboard-block[aria-current="time"] {
+ z-index: 1;
+ outline: 2px solid #ffffff;
+ outline-offset: 0;
+}
+/* Keyboard focus keeps a ring of its own. The ring above covers the focus outline
+ * every stage button has, so focus shows as a shadow under it, one ring further out. */
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-storyboard-block[aria-current="time"]:focus-visible:where(:not([data-dragging="true"] *)) {
+ box-shadow: 0 0 0 4px var(--stage-focus);
+}
+/* Above the grid layer, so a grid line does not run through a block's name; the
+ * transparent lane still shows the grid where no block is, and the playhead stays on top.
+ * Taller than an ordinary row by the one constant the track surface carries: the
+ * label, the lane and the surface's computed height agree on it. */
+.cw-stage-console .cw-stage-track-row[data-track-kind="shots"] {
+ z-index: 3;
+ min-height: var(--stage-storyboard-row-height);
+}
+.cw-stage-console
+ .cw-stage-track-row[data-track-kind="shots"]
+ .cw-stage-track-label {
+ height: var(--stage-storyboard-row-height);
+}
+.cw-stage-console
+ .cw-stage-track-row[data-track-kind="shots"]
+ .cw-stage-track-lane {
+ height: calc(var(--stage-storyboard-row-height) - 1px);
+}
+.cw-stage-storyboard-block-name {
+ display: block;
+ flex: 1 1 auto;
+ min-width: 0;
+ /* Room for the full glyph box of Latin and Chinese names alike. */
+ line-height: 12px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+/* A block gives up its name before its picture, by the width of the block itself, and
+ * keeps its box to the last: a narrow block stays one whole target and names its
+ * camera in `title`. The widths are those of the block's content box. The rules
+ * follow the name's own, which they otherwise tie with and lose to. */
+@container (max-width: 119px) {
+ .cw-stage-storyboard-block-name {
+ display: none;
+ }
+}
+@container (max-width: 65px) {
+ .cw-stage-storyboard-block-thumbnail {
+ display: none;
+ }
+}
+.cw-stage-storyboard-chooser {
+ position: fixed;
+ z-index: 80;
+ display: flex;
+ flex-direction: column;
+ box-sizing: border-box;
+ width: 220px;
+ padding: 6px;
+ border: 1px solid var(--stage-border-strong);
+ border-radius: 8px;
+ color: var(--stage-text);
+ background: #292929;
+ box-shadow: 0 14px 38px #00000080;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-storyboard-search {
+ flex: 0 0 auto;
+ width: 100%;
+ min-height: 26px;
+ margin: 0 0 4px;
+ padding: 3px 8px;
+ border: 1px solid #343434;
+ border-radius: 5px;
+ color: var(--stage-text);
+ background: #181818;
+ font-size: 11px;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-storyboard-search::placeholder {
+ color: #777777;
+}
+.cw-stage-storyboard-options {
+ display: flex;
+ min-height: 0;
+ flex-direction: column;
+ gap: 2px;
+ overflow-y: auto;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-storyboard-option {
+ min-height: 26px;
+ padding: 4px 8px;
+ border: 0;
+ border-radius: 4px;
+ color: #d9d9d9;
+ background: transparent;
+ font-size: 11px;
+ line-height: 1.2;
+ text-align: left;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-storyboard-option:hover,
+.cw-stage-console .cw-stage-bottom .cw-stage-storyboard-option:focus-visible {
+ border: 0;
+ color: #ffffff;
+ background: #373737;
+}
+.cw-stage-storyboard-empty {
+ margin: 0;
+ padding: 6px 8px;
+ color: #858585;
+ font-size: 10px;
+}
+
+.cw-stage-storyboard-blocks {
+ position: absolute;
+ inset: 0;
+ pointer-events: none;
+}
+.cw-stage-storyboard-blocks .cw-stage-storyboard-block {
+ pointer-events: auto;
+ touch-action: none;
+}
+/* The body of a block the user may edit is where a drag to another place begins, and
+ offers an open hand. A block that may not be edited still selects, so it keeps the
+ pointer it has. */
+.cw-stage-storyboard-blocks[data-editable="true"] .cw-stage-storyboard-block {
+ cursor: grab;
+}
+/* From the press on, the hand is closed: in the pressed block, and in the surface,
+ which owns the pointer once it moves, wherever the pointer goes. A boundary being
+ resized keeps its own cursor from the surface as well. */
+.cw-stage-storyboard-blocks[data-editable="true"] .cw-stage-storyboard-block:active {
+ cursor: grabbing;
+}
+.cw-stage-storyboard-blocks:is([data-gesture="body"], [data-gesture="reorder"]) {
+ cursor: grabbing;
+}
+.cw-stage-storyboard-blocks[data-gesture="resize"] {
+ cursor: ew-resize;
+}
+/* A block carried to another place is lifted: over every other block, with a shadow
+ under it and a little see-through. The lift is the shell's, around the block, so it
+ neither scales the block nor competes with the ring keyboard focus gives the block
+ under the playhead. The block is moved by a transform: nothing is laid out again
+ while it follows the pointer. */
+.cw-stage-storyboard-block-shell[data-dragging="true"] {
+ z-index: 2;
+ border-radius: 2px;
+ opacity: 0.9;
+ box-shadow: 0 4px 12px #00000080;
+}
+.cw-stage-storyboard-block-shell[data-dragging="true"] .cw-stage-storyboard-block {
+ cursor: grabbing;
+}
+/* While it is carried, a block shows how it is carried and nothing of keyboard
+ focus: not the fill focus gives a block, which the rules above leave out under a
+ dragged shell, and not the outline every stage button has. The block under the
+ playhead keeps its own white ring, and the selected block its fill. A keyboard user
+ is never in a drag, so no focus is hidden from anyone; once the block is let go,
+ the ring of keyboard focus is shown again as before. */
+.cw-stage-console
+ .cw-stage-bottom
+ .cw-stage-storyboard-block-shell[data-dragging="true"]
+ .cw-stage-storyboard-block:not([aria-current="time"]) {
+ outline: none;
+}
+/* Where a carried block would be let in: a line in that gap, where the blocks lay the
+ * time out. Its centre is the place, so half of it is on either side.
+ * Over every block, the carried one included, and drawn in the Storyboard row: the row
+ * stacks below the playhead lane, so the playhead stays over it. It is a hint: it takes
+ * no pointer. */
+.cw-stage-storyboard-insert-marker {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ z-index: 3;
+ width: 3px;
+ margin-left: -1.5px;
+ background: var(--stage-accent);
+ pointer-events: none;
+}
+.cw-stage-storyboard-insert-marker::before,
+.cw-stage-storyboard-insert-marker::after {
+ position: absolute;
+ left: 50%;
+ width: 7px;
+ height: 7px;
+ /* Two sides of a square: a corner, which once turned is a small chevron. */
+ border: 0 solid var(--stage-accent);
+ border-width: 0 2px 2px 0;
+ content: "";
+}
+/* A chevron at either end of the line, each centred on it and turned to point at the
+ * line's centre: down from the top end, up from the bottom one. */
+.cw-stage-storyboard-insert-marker::before {
+ top: 0;
+ transform: translateX(-50%) rotate(45deg);
+}
+.cw-stage-storyboard-insert-marker::after {
+ bottom: 0;
+ transform: translateX(-50%) rotate(-135deg);
+}
+.cw-stage-storyboard-resize-handle {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ width: min(5px, 25%);
+ cursor: ew-resize;
+}
+.cw-stage-storyboard-resize-handle.is-left {
+ left: 0;
+}
+.cw-stage-storyboard-resize-handle.is-right {
+ right: 0;
+}
+
+.cw-stage-console .cw-stage-bottom .cw-stage-storyboard-delete {
+ position: absolute;
+ z-index: 2;
+ top: 1px;
+ right: min(6px, 25%);
+ display: grid;
+ place-items: center;
+ width: min(16px, 50%);
+ height: 14px;
+ min-width: 0;
+ min-height: 0;
+ padding: 0;
+ border: 0;
+ border-radius: 2px;
+ overflow: hidden;
+ color: #ffffff;
+ background: #303030;
+ opacity: 0;
+ pointer-events: none;
+}
+.cw-stage-storyboard-block-shell:hover .cw-stage-storyboard-delete,
+.cw-stage-storyboard-block-shell:has(.cw-stage-storyboard-block:focus-visible) .cw-stage-storyboard-delete,
+.cw-stage-storyboard-block-shell .cw-stage-storyboard-delete:focus-visible {
+ opacity: 1;
+ pointer-events: auto;
+}
+@media (hover: none) {
+ .cw-stage-storyboard-block-shell:has([aria-pressed="true"]) .cw-stage-storyboard-delete {
+ opacity: 1;
+ pointer-events: auto;
+ }
+}
+
+/* Shared control states across the Director Stage work area. */
+.cw-stage-console :is(.cw-stage-topbar, .cw-stage-left, .cw-stage-right, .cw-stage-gizmo, .cw-stage-transport) :is(button, input, select):focus-visible {
+ outline: 2px solid var(--stage-control-focus);
+ outline-offset: -2px;
+}
+.cw-stage-console :is(.cw-stage-preview-mode, .cw-stage-gizmo) button[aria-pressed="true"] {
+ background: var(--stage-control-active);
+ color: var(--stage-text);
+}
+.cw-stage-console :is(.cw-stage-topbar, .cw-stage-transport) {
+ background: var(--stage-surface);
+ border-bottom-color: var(--stage-border);
+}
+.cw-stage-console .cw-stage-gizmo {
+ border-color: var(--stage-border);
+}
+.cw-stage-console .cw-stage-transport output {
+ font-variant-numeric: tabular-nums;
+}
+
+@media (max-width: 1000px) {
+ .cw-stage-console .cw-stage-preview-mode {
+ position: static;
+ transform: none;
+ }
+}
+
+.cw-stage-console .cw-stage-topbar .cw-stage-render-action {
+ flex: 0 0 auto;
+ min-height: var(--stage-control-height);
+ padding-inline: 12px;
+ border-color: #52545b;
+ background: #373940;
+ color: #fff;
+ font-weight: 600;
+ white-space: nowrap;
+}
+.cw-stage-console .cw-stage-topbar .cw-stage-render-action:hover:not(:disabled) {
+ background: #464952;
+}
+.cw-stage-console .cw-stage-panel-heading h3 {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.cw-stage-console .cw-stage-panel-icon {
+ flex: none;
+}
+
+/* Workbench chrome is quiet until a control becomes active. */
+.cw-stage-console {
+ --stage-scroll-thumb: #a0a0a0;
+ --stage-feedback-surface: #202020f5;
+ --stage-chrome-line: #282828;
+ --stage-chrome-hover: #272727;
+ --stage-chrome-selected: #303030;
+ --inspector-control-border: transparent;
+}
+.cw-stage-console :is(.cw-stage-topbar, .cw-stage-panel-heading, .cw-stage-transport) {
+ border-bottom-color: var(--stage-chrome-line);
+}
+.cw-stage-console .cw-stage-topbar {
+ gap: 8px;
+}
+.cw-stage-console .cw-stage-topbar button {
+ min-height: 26px;
+ padding-block: 3px;
+}
+.cw-stage-console .cw-stage-topbar button:is([data-icon], .cw-stage-topbar-icon) {
+ width: 26px;
+ min-width: 26px;
+ min-height: 26px;
+ padding-inline: 3px;
+}
+.cw-stage-console .cw-stage-topbar .cw-stage-preview-mode button {
+ min-width: 56px;
+ padding-inline: 8px;
+}
+.cw-stage-console .cw-stage-left .cw-stage-object-grid {
+ gap: 6px;
+ margin-top: 8px;
+}
+.cw-stage-console .cw-stage-right .cw-inspector-property-list {
+ gap: 4px;
+}
+.cw-stage-console .cw-stage-right :is(
+ .cw-inspector-property-row,
+ .cw-inspector-color-control,
+ .cw-inspector-property-control > :is(input:not([type="checkbox"], [type="color"]), select, textarea)
+) {
+ min-height: 28px;
+}
+.cw-stage-console .cw-stage-right .cw-inspector-section {
+ margin-block: 4px;
+}
+.cw-stage-console .cw-stage-topbar button:is([data-icon], .cw-stage-topbar-icon),
+.cw-stage-console .cw-stage-topbar .cw-stage-preview-mode button {
+ border-color: transparent;
+ background: transparent;
+}
+.cw-stage-console .cw-stage-topbar .cw-stage-preview-mode {
+ background: #171717;
+ border-color: var(--stage-chrome-line);
+}
+.cw-stage-console .cw-stage-topbar .cw-stage-chip:not(.is-unsaved) {
+ border-color: transparent;
+ background: transparent;
+}
+.cw-stage-console .cw-stage-left .cw-stage-tabs button {
+ min-height: 32px;
+ border: 0;
+ border-bottom: 2px solid transparent;
+ border-radius: 0;
+ color: var(--stage-text-muted);
+ background: transparent;
+}
+.cw-stage-console .cw-stage-left .cw-stage-tabs button[aria-selected="true"] {
+ border-bottom-color: var(--stage-text);
+ color: var(--stage-text);
+}
+.cw-stage-console .cw-stage-panel-search input {
+ border-color: transparent;
+ border-radius: 8px;
+ background: var(--stage-surface-input);
+}
+.cw-stage-console .cw-stage-left .cw-stage-object-grid button {
+ border-color: transparent;
+ border-radius: 10px;
+ background: #141414;
+}
+.cw-stage-console .cw-stage-left .cw-stage-object-grid button[aria-pressed="true"] {
+ border-color: #666;
+ background: var(--stage-chrome-selected);
+}
+.cw-stage-console .cw-stage-right .cw-stage-tree-head,
+.cw-stage-console .cw-stage-right .cw-inspector-section-toggle {
+ border-color: transparent;
+ background: transparent;
+}
+.cw-stage-console .cw-stage-right .cw-inspector-section-toggle {
+ border-radius: 0;
+ border-bottom-color: var(--stage-chrome-line);
+}
+.cw-stage-console .cw-stage-gizmo button[data-icon] {
+ border-color: transparent;
+ border-radius: 6px;
+ background: transparent;
+}
+.cw-stage-console .cw-stage-topbar button:is([data-icon], .cw-stage-topbar-icon):hover:not(:disabled),
+.cw-stage-console .cw-stage-topbar .cw-stage-preview-mode button:hover:not(:disabled),
+.cw-stage-console .cw-stage-left .cw-stage-tabs button:hover:not(:disabled),
+.cw-stage-console .cw-stage-left .cw-stage-object-grid button:hover:not(:disabled),
+.cw-stage-console .cw-stage-right .cw-stage-tree-head:hover:not(:disabled),
+.cw-stage-console .cw-stage-right .cw-inspector-section-toggle:hover:not(:disabled),
+.cw-stage-console .cw-stage-gizmo button[data-icon]:hover:not(:disabled) {
+ background: var(--stage-chrome-hover);
+}
+.cw-stage-console .cw-stage-topbar button[aria-pressed="true"],
+.cw-stage-console .cw-stage-topbar button[aria-expanded="true"],
+.cw-stage-console .cw-stage-gizmo button[data-icon][aria-pressed="true"],
+.cw-stage-console .cw-stage-gizmo button[data-icon][aria-expanded="true"] {
+ color: var(--stage-text);
+ background: var(--stage-chrome-selected);
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-group-toggle {
+ background: var(--stage-surface);
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-group-toggle:hover:not(:disabled) {
+ background: var(--stage-chrome-hover);
+}
+.cw-stage-console .cw-stage-transport output {
+ color: var(--stage-text);
+ font-family: ui-monospace, monospace;
+}
+
+.cw-stage-console,
+.cw-stage-console * {
+ scrollbar-width: thin;
+ scrollbar-color: var(--stage-scroll-thumb) transparent;
+}
+
+.cw-stage-console :is(.cw-stage-placehint, .cw-stage-error, .cw-render-status) {
+ border: 1px solid var(--stage-feedback-border, var(--stage-border-strong));
+ border-radius: 8px;
+ background: var(--stage-feedback-surface);
+ box-shadow: 0 4px 14px #0005;
+ color: var(--stage-feedback-text, var(--stage-text));
+ font-size: 12px;
+ line-height: 1.45;
+ overflow-wrap: anywhere;
+}
+
+
+/* Keep workbench type proportional to the compact control geometry. */
+.cw-stage-console .cw-stage-identity h2 {
+ font-size: var(--stage-type-title);
+}
+.cw-stage-console :is(.cw-stage-panel-heading h3, .cw-stage-timeline-title) {
+ font-size: var(--stage-type-label);
+}
+.cw-stage-console .cw-stage-panel-icon {
+ font-size: 13px;
+}
+.cw-stage-console .cw-stage-topbar button,
+.cw-stage-console .cw-stage-panel-search input,
+.cw-stage-console .cw-stage-left :is(.cw-stage-import-button, .cw-stage-object-grid button),
+.cw-stage-console .cw-stage-right :is(.cw-stage-tree-head, .cw-stage-tree-row > button),
+.cw-stage-console .cw-stage-right :is(.cw-inspector-property-label, .cw-inspector-section-toggle, .cw-inspector-property-control > select),
+.cw-stage-console .cw-stage-viewmenu label,
+.cw-stage-console .cw-stage-transport,
+.cw-stage-console .cw-stage-transport output,
+.cw-stage-console .cw-stage-drag-value input[type="number"] {
+ font-size: var(--stage-type-control);
+}
+.cw-stage-console .cw-stage-topbar button[data-icon]::before,
+.cw-stage-console .cw-stage-gizmo button[data-icon]::before {
+ font-size: 12px;
+}
+.cw-stage-console .cw-stage-left .cw-stage-tabs button {
+ min-height: 28px;
+}
+.cw-stage-console .cw-stage-tab-icon svg {
+ width: 14px;
+ height: 14px;
+}
+.cw-stage-console .cw-stage-left .cw-stage-object-grid button {
+ min-height: 68px;
+ gap: 3px;
+ padding: 4px;
+}
+.cw-stage-console .cw-stage-left .cw-stage-object-grid .cw-stage-object-preview {
+ height: 42px;
+ flex-basis: 42px;
+}
+
+
+.cw-stage-console .cw-stage-right .cw-inspector-section-toggle {
+ min-height: 22px;
+ gap: 6px;
+}
+
+
+.cw-stage-topbar-icon {
+ display: inline-grid;
+ place-items: center;
+}
+.cw-stage-topbar-icon svg {
+ width: 14px;
+ height: 14px;
+ fill: none;
+ stroke: currentColor;
+ stroke-width: 1.25;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+}
+
+
+/* Preserve a visible type hierarchy at each expanded stage control. */
+.cw-stage-console :is(.cw-stage-track-group-label, .cw-stage-export-field) {
+ font-size: var(--stage-type-label);
+}
+.cw-stage-console .cw-stage-right :is(.cw-stage-tree-head, .cw-inspector-section-toggle) {
+ font-size: var(--stage-type-label);
+}
+.cw-stage-console .cw-stage-bottom .cw-stage-track-label,
+.cw-stage-console .cw-stage-export-field select,
+.cw-stage-console .cw-stage-right .cw-inspector-property-control > :is(input, select, textarea),
+.cw-stage-console .cw-stage-right .cw-inspector-color-value {
+ font-size: var(--stage-type-control);
+}
+.cw-stage-console select :is(option, optgroup) {
+ font-size: calc(1em - var(--stage-type-nesting-step));
+}
+.cw-stage-console select optgroup > option {
+ font-size: 1em;
}
diff --git a/src/canvas/directorStageViewState.ts b/src/canvas/directorStageViewState.ts
new file mode 100644
index 000000000..cf93799ad
--- /dev/null
+++ b/src/canvas/directorStageViewState.ts
@@ -0,0 +1,464 @@
+import type {
+ StageAssetRole,
+ StageObject,
+ StagePreviewSource,
+} from "./stageDocument.ts";
+
+export type DirectorStageLeftTab =
+ | "characters"
+ | "objects"
+ | "cameras"
+ | "background";
+
+export type DirectorStageTreeGroup = "characters" | "objects" | "cameras";
+
+export type DirectorStageViewFlag =
+ | "ground"
+ | "grid"
+ | "motionPaths"
+ | "objectNames"
+ | "heightGuides"
+ | "aspectMask"
+ | "viewIndicator";
+
+export type DirectorStageGizmo = "select" | "translate" | "rotate" | "scale";
+
+export type DirectorStageSelection =
+ | { kind: "object"; objectId: string }
+ | { kind: "camera"; cameraId: string }
+ | null;
+
+export type DirectorStagePreviewMode = "static" | "dynamic";
+
+export type DirectorStageResizeTarget = "left" | "right" | "timeline";
+
+export interface DirectorStageLayout {
+ leftWidth: number;
+ rightWidth: number;
+ timelineHeight: number;
+}
+
+export type DirectorStageFocusedSurface =
+ | "console"
+ | "viewport"
+ | "library"
+ | "tree"
+ | "inspector"
+ | "timeline"
+ | "drawer"
+ | "dialog";
+
+/** Mutually exclusive interaction modes. Display options live separately so
+ * camera preview and split view can retain their current independent behavior. */
+export type DirectorStageInteractionMode =
+ | { kind: "edit" }
+ | { kind: "viewfinder" }
+ | {
+ kind: "placement";
+ objectKind: StageObject["kind"];
+ sourceObjectId: string | null;
+ }
+
+export interface DirectorStageViewFlags {
+ ground: boolean;
+ grid: boolean;
+ motionPaths: boolean;
+ objectNames: boolean;
+ heightGuides: boolean;
+ aspectMask: boolean;
+ viewIndicator: boolean;
+}
+
+export type DirectorStageSplitView =
+ | { kind: "closed"; ratio: number }
+ | { kind: "open"; ratio: number; cameraId: string | null };
+
+export type DirectorStageExportDialog =
+ | {
+ kind: "closed";
+ source: string;
+ clarity: number;
+ fps: number;
+ }
+ | {
+ kind: "open";
+ source: string;
+ clarity: number;
+ fps: number;
+ };
+
+export interface DirectorStageViewState {
+ selection: DirectorStageSelection;
+ /** The explicitly selected Storyboard block. View state only: it is never saved with the
+ * stage, and it is neither the block under the playhead nor the camera preview source. */
+ selectedStoryboardBlockId: string | null;
+ /** What the camera surfaces show. View state only: switching it is not an edit, and it
+ * names a camera by identity without holding anything of the camera or the stage. */
+ previewSource: StagePreviewSource;
+ focusedSurface: DirectorStageFocusedSurface;
+ interactionMode: DirectorStageInteractionMode;
+ cameraPreview: boolean;
+ /** Ephemeral sampling preference; never part of LocalStageDocument. */
+ previewMode: DirectorStagePreviewMode;
+ splitView: DirectorStageSplitView;
+ viewFlags: DirectorStageViewFlags;
+ viewMenuOpen: boolean;
+ leftTab: DirectorStageLeftTab;
+ assetRole: StageAssetRole;
+ treeGroups: Record;
+ helpOpen: boolean;
+ drawerOpen: boolean;
+ selectedStillIds: ReadonlySet;
+ previewStillId: string | null;
+ exportDialog: DirectorStageExportDialog;
+ activeGizmo: DirectorStageGizmo;
+ layout: DirectorStageLayout;
+}
+
+export type DirectorStageViewAction =
+ | { type: "selectObject"; objectId: string | null }
+ | { type: "selectCamera"; cameraId: string | null }
+ | { type: "selectStoryboardBlock"; blockId: string | null }
+ | { type: "setPreviewSource"; source: StagePreviewSource }
+ | { type: "focusSurface"; surface: DirectorStageFocusedSurface }
+ | { type: "toggleCameraPreview" }
+ | { type: "setCameraPreview"; enabled: boolean }
+ | { type: "setPreviewMode"; mode: DirectorStagePreviewMode }
+ | { type: "toggleViewfinder" }
+ | {
+ type: "armPlacement";
+ objectKind: StageObject["kind"];
+ sourceObjectId: string | null;
+ }
+ | { type: "cancelPlacement" }
+ | { type: "openSplit"; cameraId: string | null; ratio?: number }
+ | { type: "closeSplit" }
+ | { type: "setSplitRatio"; ratio: number }
+ | { type: "setSplitCamera"; cameraId: string | null }
+ | { type: "toggleViewFlag"; flag: DirectorStageViewFlag }
+ | {
+ type: "setViewFlag";
+ flag: DirectorStageViewFlag;
+ enabled: boolean;
+ }
+ | { type: "toggleViewMenu" }
+ | { type: "setViewMenu"; open: boolean }
+ | { type: "setLeftTab"; tab: DirectorStageLeftTab }
+ | { type: "setAssetRole"; role: StageAssetRole }
+ | { type: "toggleTreeGroup"; group: DirectorStageTreeGroup }
+ | {
+ type: "setTreeGroup";
+ group: DirectorStageTreeGroup;
+ expanded: boolean;
+ }
+ | { type: "toggleHelp" }
+ | { type: "setHelp"; open: boolean }
+ | { type: "toggleDrawer" }
+ | { type: "setDrawer"; open: boolean }
+ | { type: "toggleStillSelection"; stillId: string }
+ | { type: "setStillSelection"; stillIds: readonly string[] }
+ | { type: "clearStillSelection" }
+ | { type: "setPreviewStill"; stillId: string | null }
+ | {
+ type: "openExport";
+ source: string;
+ clarity: number;
+ fps: number;
+ }
+ | { type: "closeExport" }
+ | { type: "setExportSource"; source: string }
+ | { type: "setExportClarity"; clarity: number }
+ | { type: "setExportFps"; fps: number }
+ | { type: "setGizmo"; gizmo: DirectorStageGizmo }
+ | {
+ type: "setLayoutSize";
+ target: DirectorStageResizeTarget;
+ value: number;
+ };
+
+const DEFAULT_VIEW_FLAGS: DirectorStageViewFlags = {
+ ground: true,
+ grid: true,
+ motionPaths: false,
+ objectNames: true,
+ heightGuides: false,
+ aspectMask: false,
+ viewIndicator: true,
+};
+
+const DEFAULT_TREE_GROUPS: Record = {
+ characters: true,
+ objects: true,
+ cameras: true,
+};
+
+export const LAYOUT_LIMITS: Record<
+ DirectorStageResizeTarget,
+ { readonly min: number; readonly max: number; readonly fallback: number }
+> = {
+ left: { min: 180, max: 420, fallback: 196 },
+ right: { min: 220, max: 460, fallback: 232 },
+ timeline: { min: 140, max: 460, fallback: 176 },
+};
+
+const LAYOUT_KEYS: Record<
+ DirectorStageResizeTarget,
+ keyof DirectorStageLayout
+> = {
+ left: "leftWidth",
+ right: "rightWidth",
+ timeline: "timelineHeight",
+};
+
+function clampLayoutSize(
+ target: DirectorStageResizeTarget,
+ value: number,
+ fallback = LAYOUT_LIMITS[target].fallback,
+): number {
+ const limits = LAYOUT_LIMITS[target];
+ if (!Number.isFinite(value)) return fallback;
+ return Math.min(limits.max, Math.max(limits.min, value));
+}
+
+/** The second parameter is the preview source the stage opens with, which the caller
+ * reads from the stored document once. It is required on purpose: view state has no
+ * sensible default for what a preview shows. */
+export function createDirectorStageViewState(
+ selectedObjectId: string | null,
+ previewSource: StagePreviewSource,
+): DirectorStageViewState {
+ return {
+ selection: selectedObjectId
+ ? { kind: "object", objectId: selectedObjectId }
+ : null,
+ selectedStoryboardBlockId: null,
+ previewSource,
+ focusedSurface: "console",
+ interactionMode: { kind: "edit" },
+ cameraPreview: true,
+ previewMode: "static",
+ splitView: { kind: "closed", ratio: 0.5 },
+ viewFlags: { ...DEFAULT_VIEW_FLAGS },
+ viewMenuOpen: false,
+ leftTab: "characters",
+ assetRole: "character",
+ treeGroups: { ...DEFAULT_TREE_GROUPS },
+ helpOpen: false,
+ drawerOpen: false,
+ selectedStillIds: new Set(),
+ previewStillId: null,
+ exportDialog: { kind: "closed", source: "", clarity: 1280, fps: 30 },
+ activeGizmo: "translate",
+ layout: {
+ leftWidth: LAYOUT_LIMITS.left.fallback,
+ rightWidth: LAYOUT_LIMITS.right.fallback,
+ timelineHeight: LAYOUT_LIMITS.timeline.fallback,
+ },
+ };
+}
+
+function clampSplitRatio(ratio: number, fallback: number): number {
+ if (!Number.isFinite(ratio)) return fallback;
+ return Math.min(0.8, Math.max(0.2, ratio));
+}
+
+export function directorStageViewReducer(
+ state: DirectorStageViewState,
+ action: DirectorStageViewAction,
+): DirectorStageViewState {
+ switch (action.type) {
+ case "selectObject":
+ return {
+ ...state,
+ selection: action.objectId
+ ? { kind: "object", objectId: action.objectId }
+ : null,
+ };
+ case "selectCamera":
+ return {
+ ...state,
+ selection: action.cameraId
+ ? { kind: "camera", cameraId: action.cameraId }
+ : null,
+ };
+ case "selectStoryboardBlock":
+ return { ...state, selectedStoryboardBlockId: action.blockId };
+ case "setPreviewSource":
+ return { ...state, previewSource: action.source };
+ case "focusSurface":
+ return { ...state, focusedSurface: action.surface };
+ case "toggleCameraPreview":
+ return { ...state, cameraPreview: !state.cameraPreview };
+ case "setCameraPreview":
+ return { ...state, cameraPreview: action.enabled };
+ case "setPreviewMode":
+ return { ...state, previewMode: action.mode };
+ case "toggleViewfinder":
+ if (state.interactionMode.kind === "viewfinder") {
+ return {
+ ...state,
+ interactionMode: { kind: "edit" },
+ };
+ }
+ return {
+ ...state,
+ interactionMode: { kind: "viewfinder" },
+ viewFlags: { ...state.viewFlags, aspectMask: true },
+ };
+ case "armPlacement":
+ return {
+ ...state,
+ interactionMode: {
+ kind: "placement",
+ objectKind: action.objectKind,
+ sourceObjectId: action.sourceObjectId,
+ },
+ };
+ case "cancelPlacement":
+ if (state.interactionMode.kind !== "placement") return state;
+ return { ...state, interactionMode: { kind: "edit" } };
+ case "openSplit":
+ return {
+ ...state,
+ splitView: {
+ kind: "open",
+ cameraId: action.cameraId,
+ ratio: clampSplitRatio(
+ action.ratio ?? state.splitView.ratio,
+ state.splitView.ratio,
+ ),
+ },
+ };
+ case "closeSplit":
+ return {
+ ...state,
+ splitView: { kind: "closed", ratio: state.splitView.ratio },
+ };
+ case "setSplitRatio":
+ return {
+ ...state,
+ splitView: {
+ ...state.splitView,
+ ratio: clampSplitRatio(action.ratio, state.splitView.ratio),
+ },
+ };
+ case "setSplitCamera":
+ if (state.splitView.kind === "closed") return state;
+ return {
+ ...state,
+ splitView: { ...state.splitView, cameraId: action.cameraId },
+ };
+ case "toggleViewFlag":
+ return {
+ ...state,
+ viewFlags: {
+ ...state.viewFlags,
+ [action.flag]: !state.viewFlags[action.flag],
+ },
+ };
+ case "setViewFlag":
+ return {
+ ...state,
+ viewFlags: { ...state.viewFlags, [action.flag]: action.enabled },
+ };
+ case "toggleViewMenu":
+ return { ...state, viewMenuOpen: !state.viewMenuOpen };
+ case "setViewMenu":
+ return { ...state, viewMenuOpen: action.open };
+ case "setLeftTab":
+ return { ...state, leftTab: action.tab };
+ case "setAssetRole":
+ return { ...state, assetRole: action.role };
+ case "toggleTreeGroup":
+ return {
+ ...state,
+ treeGroups: {
+ ...state.treeGroups,
+ [action.group]: !state.treeGroups[action.group],
+ },
+ };
+ case "setTreeGroup":
+ return {
+ ...state,
+ treeGroups: { ...state.treeGroups, [action.group]: action.expanded },
+ };
+ case "toggleHelp":
+ return { ...state, helpOpen: !state.helpOpen };
+ case "setHelp":
+ return { ...state, helpOpen: action.open };
+ case "toggleDrawer":
+ return { ...state, drawerOpen: !state.drawerOpen };
+ case "setDrawer":
+ return { ...state, drawerOpen: action.open };
+ case "toggleStillSelection": {
+ const selectedStillIds = new Set(state.selectedStillIds);
+ if (selectedStillIds.has(action.stillId))
+ selectedStillIds.delete(action.stillId);
+ else selectedStillIds.add(action.stillId);
+ return { ...state, selectedStillIds };
+ }
+ case "setStillSelection":
+ return { ...state, selectedStillIds: new Set(action.stillIds) };
+ case "clearStillSelection":
+ return {
+ ...state,
+ selectedStillIds: new Set(),
+ previewStillId:
+ state.previewStillId && state.selectedStillIds.has(state.previewStillId)
+ ? null
+ : state.previewStillId,
+ };
+ case "setPreviewStill":
+ return { ...state, previewStillId: action.stillId };
+ case "openExport":
+ return {
+ ...state,
+ exportDialog: {
+ kind: "open",
+ source: action.source,
+ clarity: action.clarity,
+ fps: action.fps,
+ },
+ };
+ case "closeExport":
+ if (state.exportDialog.kind === "closed") return state;
+ return {
+ ...state,
+ exportDialog: { ...state.exportDialog, kind: "closed" },
+ };
+ case "setExportSource":
+ if (state.exportDialog.kind === "closed") return state;
+ return {
+ ...state,
+ exportDialog: { ...state.exportDialog, source: action.source },
+ };
+ case "setExportClarity":
+ if (state.exportDialog.kind === "closed") return state;
+ return {
+ ...state,
+ exportDialog: { ...state.exportDialog, clarity: action.clarity },
+ };
+ case "setExportFps":
+ if (state.exportDialog.kind === "closed") return state;
+ return {
+ ...state,
+ exportDialog: { ...state.exportDialog, fps: action.fps },
+ };
+ case "setGizmo":
+ return { ...state, activeGizmo: action.gizmo };
+ case "setLayoutSize": {
+ const key = LAYOUT_KEYS[action.target];
+ return {
+ ...state,
+ layout: {
+ ...state.layout,
+ [key]: clampLayoutSize(action.target, action.value),
+ },
+ };
+ }
+ default: {
+ const exhaustive: never = action;
+ return exhaustive;
+ }
+ }
+}
diff --git a/src/canvas/inspector/InspectorPrimitives.tsx b/src/canvas/inspector/InspectorPrimitives.tsx
new file mode 100644
index 000000000..d3795ded2
--- /dev/null
+++ b/src/canvas/inspector/InspectorPrimitives.tsx
@@ -0,0 +1,144 @@
+import { useId, useState, type ChangeEvent, type ReactNode } from "react";
+import "./inspector-primitives.css";
+
+export function InspectorSection({
+ title,
+ children,
+ defaultExpanded = true,
+}: {
+ title: string;
+ children: ReactNode;
+ defaultExpanded?: boolean;
+}) {
+ const [expanded, setExpanded] = useState(defaultExpanded);
+ const contentId = useId();
+
+ return (
+
+ setExpanded((current) => !current)}
+ >
+
+ {title}
+
+ {expanded && (
+
+ {children}
+
+ )}
+
+ );
+}
+
+export function InspectorPropertyList({
+ children,
+ className = "",
+}: {
+ children: ReactNode;
+ className?: string;
+}) {
+ return (
+
+ {children}
+
+ );
+}
+
+export function InspectorPropertyRow({
+ label,
+ children,
+ className = "",
+}: {
+ label: string;
+ children: ReactNode;
+ className?: string;
+}) {
+ return (
+
+
+ {label}
+
+ {children}
+
+ );
+}
+
+export function InspectorColorProperty({
+ label,
+ value,
+ onChange,
+ disabled = false,
+}: {
+ label: string;
+ value: string;
+ onChange: (value: string) => void;
+ disabled?: boolean;
+}) {
+ const handleChange = (event: ChangeEvent) =>
+ onChange(event.target.value);
+
+ return (
+
+
+
+
+ {value.toUpperCase()}
+
+
+
+ );
+}
+
+export function InspectorToggleProperty({
+ label,
+ checked,
+ onChange,
+ disabled = false,
+}: {
+ label: string;
+ checked: boolean;
+ onChange: (checked: boolean) => void;
+ disabled?: boolean;
+}) {
+ return (
+
+ onChange(event.target.checked)}
+ />
+
+ );
+}
+
+export function InspectorCompoundProperty({
+ label,
+ children,
+}: {
+ label: string;
+ children: ReactNode;
+}) {
+ return (
+
+ {label}
+ {children}
+
+ );
+}
diff --git a/src/canvas/inspector/inspector-primitives.css b/src/canvas/inspector/inspector-primitives.css
new file mode 100644
index 000000000..d426715d3
--- /dev/null
+++ b/src/canvas/inspector/inspector-primitives.css
@@ -0,0 +1,196 @@
+.cw-inspector-section {
+ min-width: 0;
+ margin: 12px 0;
+}
+.cw-inspector-section .cw-inspector-section-toggle {
+ display: flex;
+ width: 100%;
+ min-height: 28px;
+ align-items: center;
+ gap: 8px;
+ padding: 0 2px;
+ border: 0;
+ border-radius: 3px;
+ color: var(--inspector-text, #eeeeee);
+ background: transparent;
+ font-size: 11px;
+ font-weight: 600;
+ text-align: left;
+ cursor: pointer;
+}
+.cw-inspector-section .cw-inspector-section-toggle:hover,
+.cw-inspector-section .cw-inspector-section-toggle:focus-visible {
+ background: var(--inspector-hover, #252525);
+}
+.cw-inspector-section-chevron {
+ width: 7px;
+ height: 7px;
+ flex: none;
+ border-right: 1px solid var(--inspector-muted, #a9a9a9);
+ border-bottom: 1px solid var(--inspector-muted, #a9a9a9);
+ transform: rotate(-45deg) translate(-1px, 1px);
+ transition: transform 120ms ease;
+}
+.cw-inspector-section-chevron[data-expanded="true"] {
+ transform: rotate(45deg) translate(-1px, -1px);
+}
+.cw-inspector-section-content {
+ min-width: 0;
+}
+.cw-inspector-property-list {
+ display: grid;
+ min-width: 0;
+ gap: 6px;
+ container-type: inline-size;
+}
+.cw-inspector-property-row {
+ display: grid;
+ min-width: 0;
+ min-height: 32px;
+ grid-template-columns: minmax(0, 1fr) minmax(112px, 46%);
+ align-items: center;
+ gap: 10px;
+ margin: 0;
+ color: var(--inspector-muted, #a5a5a5);
+ font-size: 11px;
+}
+.cw-inspector-property-label {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.cw-inspector-property-control {
+ display: flex;
+ min-width: 0;
+ align-items: center;
+ justify-content: flex-end;
+}
+.cw-inspector-property-control
+ > :is(input:not([type="checkbox"], [type="color"]), select, textarea) {
+ width: 100%;
+ min-width: 0;
+ min-height: 30px;
+ padding: 0 8px;
+ border: 1px solid var(--inspector-control-border, #3a3a3a);
+ border-radius: 5px;
+ color: var(--inspector-text, #e5e5e5);
+ background: var(--inspector-control, #1d1d1d);
+ font-size: 11px;
+}
+.cw-inspector-color-control {
+ display: grid;
+ width: 100%;
+ min-width: 0;
+ min-height: 30px;
+ grid-template-columns: 22px minmax(0, 1fr);
+ align-items: center;
+ gap: 7px;
+ padding: 3px 7px;
+ border: 1px solid var(--inspector-control-border, #3a3a3a);
+ border-radius: 5px;
+ color: var(--inspector-text, #e5e5e5);
+ background: var(--inspector-control, #1d1d1d);
+}
+.cw-inspector-color-control:focus-within,
+.cw-inspector-property-control > :is(input, select, textarea):focus-visible {
+ border-color: var(--inspector-focus, #6e6e6e);
+ outline: 2px solid var(--inspector-focus, #6e6e6e);
+ outline-offset: 1px;
+}
+.cw-inspector-property-row .cw-inspector-color-control input[type="color"] {
+ width: 22px;
+ min-width: 22px;
+ height: 22px;
+ min-height: 22px;
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+ border: 0;
+ border-radius: 4px;
+ background: transparent;
+ cursor: pointer;
+}
+.cw-inspector-property-row
+ .cw-inspector-color-control
+ input[type="color"]:focus-visible {
+ outline: none;
+}
+.cw-inspector-color-value {
+ min-width: 0;
+ overflow: hidden;
+ font-size: 10px;
+ font-variant-numeric: tabular-nums;
+ text-align: right;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.cw-inspector-property-row .cw-inspector-toggle {
+ appearance: none;
+ position: relative;
+ width: 28px;
+ min-width: 28px;
+ height: 16px;
+ margin: 0;
+ border: 1px solid var(--inspector-control-border, #4a4a4a);
+ border-radius: 999px;
+ background: var(--inspector-control, #292929);
+ cursor: pointer;
+ transition:
+ border-color 120ms ease,
+ background 120ms ease;
+}
+.cw-inspector-property-row .cw-inspector-toggle::after {
+ position: absolute;
+ top: 2px;
+ left: 2px;
+ width: 10px;
+ height: 10px;
+ border-radius: 50%;
+ background: var(--inspector-muted, #a9a9a9);
+ content: "";
+ transition:
+ background 120ms ease,
+ transform 120ms ease;
+}
+.cw-inspector-property-row .cw-inspector-toggle:checked {
+ border-color: var(--inspector-toggle-active, #d8d8d8);
+ background: var(--inspector-toggle-active, #d8d8d8);
+}
+.cw-inspector-property-row .cw-inspector-toggle:checked::after {
+ background: var(--inspector-toggle-thumb, #202020);
+ transform: translateX(12px);
+}
+.cw-inspector-property-row .cw-inspector-toggle:focus-visible {
+ outline: 2px solid var(--inspector-focus, #8c8c8c);
+ outline-offset: 2px;
+}
+.cw-inspector-property-row .cw-inspector-toggle:disabled,
+.cw-inspector-property-row:has(:disabled) {
+ opacity: 0.5;
+ cursor: not-allowed;
+}
+.cw-inspector-compound-property {
+ display: grid;
+ min-width: 0;
+ gap: 6px;
+ margin-top: 4px;
+}
+.cw-inspector-compound-label {
+ color: var(--inspector-muted, #a5a5a5);
+ font-size: 10px;
+}
+
+@container (max-width: 190px) {
+ .cw-inspector-property-row {
+ grid-template-columns: minmax(0, 1fr);
+ gap: 4px;
+ padding: 2px 0;
+ }
+ .cw-inspector-property-control {
+ justify-content: stretch;
+ }
+ .cw-inspector-property-control > .cw-inspector-toggle {
+ margin-left: auto;
+ }
+}
diff --git a/src/canvas/model.ts b/src/canvas/model.ts
index e5a0594c5..fe7429e4d 100644
--- a/src/canvas/model.ts
+++ b/src/canvas/model.ts
@@ -192,6 +192,17 @@ export interface ExternalData {
current?: { versionId: string };
}
+/** One captured stage still. A saved item pins the registered project asset
+ * and reconstructs its preview from a view-only media URL; an unsaved item
+ * carries capture bytes the next save imports. */
+export interface StageStillItem {
+ /** Drawer-local identity used to select, preview, and publish one capture. */
+ id: string;
+ asset?: AssetRef;
+ src?: string;
+ capture?: string;
+}
+
export interface AgentNodeSettings {
modelConfigId?: string;
thinking: "auto" | "low" | "medium" | "high";
@@ -230,6 +241,8 @@ export interface CanvasNodeData extends Record {
inputFingerprint?: string;
editorDocumentId?: string;
editorRevision?: number;
+ /** Derived at projection from the director execution document; drives presentation filtering. */
+ stagePreview?: boolean;
};
settings?: GenerationSettings;
agentSettings?: AgentNodeSettings;
@@ -242,6 +255,10 @@ export interface CanvasNodeData extends Record {
layers?: LayerDocument;
imageCrop?: import("./imageCrop.ts").ImageCropState;
localStage?: LocalStageDocument;
+ /** Captured stage stills, oldest first. Pinned items carry the registered
+ * project asset and a view-only media URL; fresh captures carry dataURL
+ * bytes that the next save imports and registers as project assets. */
+ stills?: StageStillItem[];
taskDraft?: CanvasToolTask;
media?: { width?: number; height?: number; durationSeconds?: number };
}
diff --git a/src/canvas/mp4Export.ts b/src/canvas/mp4Export.ts
index 927a3b64d..5c73ea34d 100644
--- a/src/canvas/mp4Export.ts
+++ b/src/canvas/mp4Export.ts
@@ -5,13 +5,14 @@ export interface Mp4Options {
canvas: HTMLCanvasElement;
duration: number;
fps: number;
+ millisecondEndpoint?: boolean;
signal: AbortSignal;
draw: (time: number, frame: number) => Promise | void;
audio?: (start: number, end: number) => Promise;
progress: (fraction: number) => void;
}
export async function encodeMp4(options: Mp4Options): Promise {
- const { canvas, duration, fps, signal, draw, audio, progress } = options;
+ const { canvas, duration, fps, signal, draw, audio, progress, millisecondEndpoint } = options;
signal.throwIfAborted();
if (!(duration > 0) || !Number.isFinite(duration) || !(fps > 0))
throw new Error(tNow("errors.render.mp4Invalid"));
@@ -62,7 +63,9 @@ export async function encodeMp4(options: Mp4Options): Promise {
quality: new Quality({ bitrate: 128000 }),
})
: null;
- output.addVideoTrack(video, { frameRate: fps });
+ // Explicit frame-rate metadata makes the MP4 muxer round packet lengths to
+ // whole frames. Use its finer timebase when the final frame can be partial.
+ output.addVideoTrack(video, millisecondEndpoint ? undefined : { frameRate: fps });
if (sound) output.addAudioTrack(sound);
let cancellation: Promise | undefined;
const cancel = () => {
@@ -72,7 +75,9 @@ export async function encodeMp4(options: Mp4Options): Promise {
signal.addEventListener("abort", cancel, { once: true });
try {
await output.start();
- const frames = Math.ceil(duration * fps);
+ const frames = millisecondEndpoint
+ ? Math.ceil(Math.round(duration * 1000) * fps / 1000)
+ : Math.ceil(duration * fps);
let audioEnd = 0;
for (let frame = 0; frame < frames; frame++) {
signal.throwIfAborted();
diff --git a/src/canvas/stageDocument.ts b/src/canvas/stageDocument.ts
index b8aefa29e..cec1e843c 100644
--- a/src/canvas/stageDocument.ts
+++ b/src/canvas/stageDocument.ts
@@ -1,6 +1,14 @@
+import {
+ normalizeStoryboardTime, storyboardBlockEnd, stageStoryboardIssue,
+ stageStoryboardIssueMessageKey, STORYBOARD_TIME_TOLERANCE,
+} from "./stageStoryboardRules.ts";
+
+export { normalizeStoryboardTime } from "./stageStoryboardRules.ts";
+
import type { Translate } from "../i18n/I18nProvider.tsx";
import { defaultTranslate } from "./assistantTranslate.ts";
import { parseStageMotion, type StageMotion } from "./stageMotion.ts";
+import type { AssetRef } from "../contracts/generated.ts";
/** Local previsualization format. V1 is migrated here, never in consumers. */
export interface Vector3Value {
@@ -13,10 +21,21 @@ export interface StageTransform {
rotation: Vector3Value;
scale: Vector3Value;
}
+export interface StageBezierTransition {
+ kind: "bezier";
+ controlPoints: [number, number, number, number];
+}
+export type StageTransition = { kind: "linear" } | StageBezierTransition;
+export type StageTransformTransitions = Partial<
+ Record<"position" | "rotation" | "scale", StageBezierTransition>
+>;
+export type StageTransformChannel = "position" | "rotation" | "scale";
export interface StageTransformFrame {
id: string;
time: number;
value: StageTransform;
+ keyedChannels?: StageTransformChannel[];
+ transitions?: StageTransformTransitions;
}
export interface StageMotionClip {
id: string;
@@ -24,23 +43,78 @@ export interface StageMotionClip {
duration: number;
motion: StageMotion;
}
+export type StageAssetRole = "character" | "scene";
+export type StageAssetFormat = "glb" | "gltf";
export interface StageObject extends StageTransform {
id: string;
- kind: "person" | "box" | "sphere";
+ kind:
+ | "person"
+ | "box"
+ | "sphere"
+ | "gltf"
+ | "cylinder"
+ | "cone"
+ | "pyramid"
+ | "torus"
+ | "plane"
+ | "capsule"
+ | "disk"
+ | "arc"
+ | "halfCylinder";
name: string;
color: string;
+ visible: boolean;
+ locked: boolean;
+ opacity: number;
keyframes: StageTransformFrame[];
motionClips: StageMotionClip[];
+ /** Registered asset identity. Omitted only while a local import is unsaved. */
+ asset?: AssetRef;
+ /** Browser URL used to reconstruct a preview; never sent to the backend. */
+ source?: string;
+ /** Registered PNG asset for the object-card thumbnail. */
+ thumbnailAsset?: AssetRef;
+ /** Unsaved PNG bytes; the backend turns these into thumbnailAsset on apply. */
+ thumbnailCapture?: string;
+ /** Browser URL projected from thumbnailAsset; never sent to the backend. */
+ thumbnailSource?: string;
+ role?: StageAssetRole;
+ format?: StageAssetFormat;
+ animationNames?: string[];
+ hasAnimation?: boolean;
}
export interface StageCamera {
position: Vector3Value;
target: Vector3Value;
fov: number;
+ /** Roll around the view axis in radians; 0 is level. */
+ roll?: number;
+}
+export interface StageCameraVectorFrame {
+ id: string;
+ time: number;
+ value: Vector3Value;
+ transition?: StageBezierTransition;
+}
+export interface StageCameraNumberFrame {
+ id: string;
+ time: number;
+ value: number;
+ transition?: StageBezierTransition;
+}
+export interface StageCameraChannels {
+ position: StageCameraVectorFrame[];
+ target: StageCameraVectorFrame[];
+ up: StageCameraVectorFrame[];
+ focalLength: StageCameraNumberFrame[];
}
export interface StageCameraRig {
id: string;
name: string;
+ aspectRatio?: (typeof STAGE_RATIOS)[number];
pose: StageCamera;
+ /** Independent authoritative channels; keyframes remains a compatibility projection. */
+ channels?: StageCameraChannels;
keyframes: { id: string; time: number; value: StageCamera }[];
}
export interface StageShot {
@@ -49,19 +123,143 @@ export interface StageShot {
start: number;
duration: number;
}
-export const STAGE_RATIOS = ["16:9", "9:16", "1:1", "4:3", "3:4"] as const;
+export type StageEnvironmentPreset = "studio" | "warm-sunset" | "moonlit";
+export interface StageEnvironment {
+ preset: StageEnvironmentPreset;
+ groundColor: string;
+ groundVisible: boolean;
+ exposure: number;
+ backgroundAsset: AssetRef | null;
+}
+export type StageLightId = "hemisphere" | "key" | "fill";
+export interface StageLight {
+ id: StageLightId;
+ color: string;
+ intensity: number;
+ position: Vector3Value;
+ castShadow: boolean;
+}
+export const STAGE_RATIOS = [
+ "16:9",
+ "2.39:1",
+ "9:16",
+ "1:1",
+ "4:3",
+ "3:4",
+] as const;
+export const STAGE_FPS = [24, 25, 30, 50, 60] as const;
+const isStageFps = (value: unknown): value is LocalStageDocument["fps"] =>
+ STAGE_FPS.some((fps) => fps === value);
+function hasExternalGltfResources(value: unknown) {
+ if (!value || typeof value !== "object") return true;
+ const document = value as {
+ buffers?: unknown;
+ images?: unknown;
+ };
+ return [document.buffers, document.images].some(
+ (resources) =>
+ Array.isArray(resources) &&
+ resources.some(
+ (resource) =>
+ resource &&
+ typeof resource === "object" &&
+ "uri" in resource &&
+ typeof resource.uri === "string" &&
+ !resource.uri.startsWith("data:"),
+ ),
+ );
+}
+const isGltfDocument = (value: unknown) => {
+ const asset = (value as { asset?: unknown })?.asset;
+ return (
+ !!value &&
+ typeof value === "object" &&
+ !!asset &&
+ typeof asset === "object" &&
+ "version" in asset
+ );
+};
+export interface StageAssetProbe {
+ format: StageAssetFormat;
+ /** Whether the parsed document references external buffers or images. */
+ external: boolean;
+}
+/**
+ * Container and self-containment come from the actual bytes, matching the
+ * backend probe. Returns "corrupt" when a GLB header is valid but its
+ * embedded JSON chunk is missing, unparsable, or not a glTF document, and
+ * undefined when the bytes are no stage model at all.
+ */
+export function probeStageAsset(
+ buffer: ArrayBuffer,
+): StageAssetProbe | "corrupt" | undefined {
+ const bytes = new Uint8Array(buffer);
+ const view = new DataView(buffer);
+ const glbVersion = () => view.getUint32(4, true);
+ const declaredLength = () => view.getUint32(8, true);
+ const isGlbMagic =
+ bytes.length >= 4 &&
+ bytes[0] === 0x67 &&
+ bytes[1] === 0x6c &&
+ bytes[2] === 0x54 &&
+ bytes[3] === 0x46;
+ const isGlb =
+ bytes.length >= 12 &&
+ isGlbMagic &&
+ glbVersion() === 2 &&
+ declaredLength() >= 12 &&
+ declaredLength() <= bytes.length;
+ if (isGlbMagic && !isGlb) return undefined;
+ if (isGlb) {
+ let offset = 12;
+ while (offset + 8 <= bytes.length) {
+ const length = view.getUint32(offset, true);
+ if (view.getUint32(offset + 4, true) === 0x4e4f534a) {
+ try {
+ const document: unknown = JSON.parse(
+ new TextDecoder().decode(
+ bytes.subarray(offset + 8, offset + 8 + length),
+ ),
+ );
+ if (!isGltfDocument(document)) return "corrupt";
+ return {
+ format: "glb",
+ external: hasExternalGltfResources(document),
+ };
+ } catch {
+ return "corrupt";
+ }
+ }
+ offset += 8 + length;
+ }
+ return "corrupt";
+ }
+ try {
+ const document: unknown = JSON.parse(new TextDecoder().decode(bytes));
+ if (!isGltfDocument(document)) return undefined;
+ return {
+ format: "gltf",
+ external: hasExternalGltfResources(document),
+ };
+ } catch {
+ return undefined;
+ }
+}
export interface LocalStageDocument {
format: "opendirector-local-stage";
version: 2;
background: string;
grid: boolean;
duration: number;
+ fps: (typeof STAGE_FPS)[number];
aspectRatio: (typeof STAGE_RATIOS)[number];
cameras: StageCameraRig[];
activeCameraId: string;
cameraSource: "camera" | "storyboard";
shots: StageShot[];
objects: StageObject[];
+ environment: StageEnvironment;
+ lights: StageLight[];
}
export interface StageSampleObject extends StageObject {
motion?: StageMotion;
@@ -72,6 +270,7 @@ export interface StageSample {
cameraId: string;
objects: StageSampleObject[];
}
+export const STAGE_ASSET_MAX_BYTES = 100 * 1024 * 1024;
const record = (v: unknown): v is Record =>
typeof v === "object" && v !== null && !Array.isArray(v);
const finite = (v: unknown): v is number =>
@@ -82,8 +281,78 @@ const nonempty = (v: unknown): v is string =>
typeof v === "string" && !!v.trim();
const color = (v: unknown): v is string =>
typeof v === "string" && /^#[0-9a-f]{6}$/i.test(v);
+const stageLightIds = ["hemisphere", "key", "fill"] as const;
+const defaultStageEnvironment = (): StageEnvironment => ({
+ preset: "studio",
+ groundColor: "#181818",
+ groundVisible: true,
+ exposure: 1,
+ backgroundAsset: null,
+});
+const defaultStageLights = (): StageLight[] => [
+ { id: "hemisphere", color: "#ffffff", intensity: 2.4, position: { x: 0, y: 1, z: 0 }, castShadow: false },
+ { id: "key", color: "#ffffff", intensity: 3.5, position: { x: 5, y: 10, z: 6 }, castShadow: true },
+ { id: "fill", color: "#ffffff", intensity: 1.6, position: { x: -6, y: 5, z: -5 }, castShadow: false },
+];
+const assetRef = (v: unknown): v is AssetRef =>
+ record(v) &&
+ nonempty(v.assetId) &&
+ typeof v.revision === "number" &&
+ Number.isInteger(v.revision) &&
+ v.revision >= 1 &&
+ typeof v.fingerprint === "string" &&
+ /^sha256:[0-9a-f]{64}$/.test(v.fingerprint) &&
+ v.kind === "file";
+const imageAssetRef = (v: unknown): v is AssetRef =>
+ record(v) &&
+ nonempty(v.assetId) &&
+ typeof v.revision === "number" &&
+ Number.isInteger(v.revision) &&
+ v.revision >= 1 &&
+ typeof v.fingerprint === "string" &&
+ /^sha256:[0-9a-f]{64}$/.test(v.fingerprint) &&
+ v.kind === "image";
+const imageDataUrl = (v: unknown): v is string =>
+ typeof v === "string" && /^data:image\/png;base64,[A-Za-z0-9+/]+=*$/.test(v);
const sameVector = (a: Vector3Value, b: Vector3Value) =>
a.x === b.x && a.y === b.y && a.z === b.z;
+const LINEAR_TRANSITION: StageTransition = { kind: "linear" };
+const transition = (v: unknown): StageBezierTransition | undefined => {
+ if (v == null) return undefined;
+ if (
+ !record(v) ||
+ v.kind !== "bezier" ||
+ !Array.isArray(v.controlPoints) ||
+ v.controlPoints.length !== 4 ||
+ !v.controlPoints.every((point) => finite(point) && point >= 0 && point <= 1)
+ )
+ throw new Error(defaultTranslate("editors.stage.error.invalidKeyframes"));
+ return {
+ kind: "bezier",
+ controlPoints: [...v.controlPoints] as [number, number, number, number],
+ };
+};
+const transformTransitions = (v: unknown): StageTransformTransitions | undefined => {
+ if (v == null) return undefined;
+ if (!record(v))
+ throw new Error(defaultTranslate("editors.stage.error.invalidKeyframes"));
+ const parsed = Object.fromEntries(
+ (["position", "rotation", "scale"] as const).flatMap((channel) => {
+ const value = transition(v[channel]);
+ return value ? [[channel, value]] : [];
+ }),
+ ) as StageTransformTransitions;
+ return Object.keys(parsed).length ? parsed : undefined;
+};
+const keyedChannels = (v: unknown): StageTransformChannel[] | undefined => {
+ if (v == null) return undefined;
+ if (
+ !Array.isArray(v) ||
+ !v.every((channel) => channel === "position" || channel === "rotation" || channel === "scale")
+ )
+ throw new Error(defaultTranslate("editors.stage.error.invalidKeyframes"));
+ return [...new Set(v)];
+};
function parseTransform(
v: unknown,
t: Translate = defaultTranslate,
@@ -115,10 +384,96 @@ function parseCamera(
!finite(v.fov) ||
v.fov <= 0 ||
v.fov >= 180 ||
- sameVector(v.position, v.target)
+ sameVector(v.position, v.target) ||
+ (v.roll !== undefined &&
+ (!finite(v.roll) || Math.abs(v.roll) > Math.PI))
)
throw new Error(t("editors.stage.error.invalidCamera"));
- return { position: { ...v.position }, target: { ...v.target }, fov: v.fov };
+ return {
+ position: { ...v.position },
+ target: { ...v.target },
+ fov: v.fov,
+ ...(v.roll !== undefined && v.roll !== 0 ? { roll: v.roll } : {}),
+ };
+}
+const defaultCameraUp = (): Vector3Value => ({ x: 0, y: 1, z: 0 });
+const cameraFocalLength = (camera: StageCamera) => camera.fov;
+function cameraChannelsFromKeyframes(
+ keyframes: { id: string; time: number; value: StageCamera }[],
+): StageCameraChannels {
+ return {
+ position: keyframes.map(({ id, time, value }) => ({ id, time, value: { ...value.position } })),
+ target: keyframes.map(({ id, time, value }) => ({ id, time, value: { ...value.target } })),
+ up: keyframes.map(({ id, time }) => ({ id, time, value: defaultCameraUp() })),
+ focalLength: keyframes.map(({ id, time, value }) => ({ id, time, value: cameraFocalLength(value) })),
+ };
+}
+function cameraChannelsOf(camera: StageCameraRig): StageCameraChannels {
+ return camera.channels ?? cameraChannelsFromKeyframes(camera.keyframes);
+}
+function parseCameraChannels(
+ raw: unknown,
+ legacy: { id: string; time: number; value: StageCamera }[],
+ t: Translate,
+): StageCameraChannels {
+ if (raw === undefined) return cameraChannelsFromKeyframes(legacy);
+ if (!record(raw)) throw new Error(t("editors.stage.error.invalidCamera"));
+ const position = frames(raw.position, undefined, (v) => {
+ if (!vector(v)) throw new Error(t("editors.stage.error.invalidCamera"));
+ return { ...v };
+ }, t, (frame) => {
+ const value = transition(frame.transition);
+ return value ? { transition: value } : {};
+ });
+ const target = frames(raw.target, undefined, (v) => {
+ if (!vector(v)) throw new Error(t("editors.stage.error.invalidCamera"));
+ return { ...v };
+ }, t, (frame) => {
+ const value = transition(frame.transition);
+ return value ? { transition: value } : {};
+ });
+ const up = frames(raw.up, undefined, (v) => {
+ if (!vector(v)) throw new Error(t("editors.stage.error.invalidCamera"));
+ return { ...v };
+ }, t, (frame) => {
+ const value = transition(frame.transition);
+ return value ? { transition: value } : {};
+ });
+ const focalLength = frames(raw.focalLength, undefined, (v) => {
+ if (!finite(v) || v <= 0) throw new Error(t("editors.stage.error.invalidCamera"));
+ return v;
+ }, t, (frame) => {
+ const value = transition(frame.transition);
+ return value ? { transition: value } : {};
+ });
+ return { position, target, up, focalLength };
+}
+function channelAt(base: T, frames: { time: number; value: T; transition?: StageBezierTransition }[], time: number, mix: (a: T, b: T, amount: number) => T): T {
+ if (!frames.length) return base;
+ const left = [...frames].reverse().find((f) => f.time <= time) ?? frames[0]!;
+ const right = frames.find((f) => f.time >= time) ?? frames.at(-1)!;
+ return mix(left.value, right.value, left.time === right.time ? 0 : transitionProgress(left.transition ?? LINEAR_TRANSITION, (time - left.time) / (right.time - left.time)));
+}
+function cameraKeyframesFromChannels(
+ pose: StageCamera,
+ channels: StageCameraChannels,
+): { id: string; time: number; value: StageCamera }[] {
+ const times = [...new Set([
+ ...channels.position.map((f) => f.time),
+ ...channels.target.map((f) => f.time),
+ ...channels.up.map((f) => f.time),
+ ...channels.focalLength.map((f) => f.time),
+ ])].sort((a, b) => a - b);
+ return times.map((time, index) => ({
+ id: channels.position.find((f) => f.time === time)?.id ?? `camera-channel-${index}`,
+ time,
+ value: {
+ position: channelAt(pose.position, channels.position, time, mixVector),
+ target: channelAt(pose.target, channels.target, time, mixVector),
+ fov: channelAt(pose.fov, channels.focalLength, time, lerp),
+ ...(pose.roll ? { roll: pose.roll } : {}),
+ },
+ }));
}
export function defaultStageCamera(): StageCamera {
return {
@@ -127,6 +482,46 @@ export function defaultStageCamera(): StageCamera {
fov: 45,
};
}
+
+const LEGACY_DEFAULT_PERSON_NAMES = new Set([
+ "\u4eba\u7269 1",
+ "\u4eba\u72691",
+ "Person 1",
+]);
+
+/** The built-in default person's color before stages started empty; a person
+ * freshly placed from the generic template carries the template color
+ * instead, so the label migration can leave new placements alone. */
+const LEGACY_DEFAULT_PERSON_COLOR = "#a09af9";
+
+/**
+ * Keep stages created before the default-person label change readable in the
+ * editor without rewriting arbitrary user-renamed characters. Only the first
+ * person with one of the generated legacy names and the legacy default color
+ * is eligible for normalization; a subject the user placed and named
+ * themselves keeps its name across reopens.
+ */
+export function normalizeLegacyDefaultPersonName(
+ stage: LocalStageDocument,
+ defaultName: string,
+): LocalStageDocument {
+ const index = stage.objects.findIndex((object) => object.kind === "person");
+ const person = index >= 0 ? stage.objects[index] : undefined;
+ if (
+ !person ||
+ person.name === defaultName ||
+ person.color !== LEGACY_DEFAULT_PERSON_COLOR ||
+ !LEGACY_DEFAULT_PERSON_NAMES.has(person.name)
+ )
+ return stage;
+ return {
+ ...stage,
+ objects: stage.objects.map((object, objectIndex) =>
+ objectIndex === index ? { ...object, name: defaultName } : object,
+ ),
+ };
+}
+
export function createLocalStage(
t: Translate = defaultTranslate,
): LocalStageDocument {
@@ -136,39 +531,34 @@ export function createLocalStage(
background: "#151923",
grid: true,
duration: 6,
+ fps: 30,
aspectRatio: "16:9",
cameras: [
{
id: "camera-1",
name: t("editors.stage.defaultCameraName"),
+ aspectRatio: "16:9",
pose: defaultStageCamera(),
+ channels: cameraChannelsFromKeyframes([]),
keyframes: [],
},
],
activeCameraId: "camera-1",
cameraSource: "camera",
shots: [],
- objects: [
- {
- id: crypto.randomUUID(),
- kind: "person",
- name: t("editors.stage.defaultPersonName"),
- color: "#a09af9",
- position: { x: 0, y: 0, z: 0 },
- rotation: { x: 0, y: 0, z: 0 },
- scale: { x: 1, y: 1, z: 1 },
- keyframes: [],
- motionClips: [],
- },
- ],
+ // Stages start empty; subjects appear through explicit placement.
+ objects: [],
+ environment: defaultStageEnvironment(),
+ lights: defaultStageLights(),
};
}
-function frames(
+function frames>(
raw: unknown,
- duration: number,
+ duration: number | undefined,
parse: (v: unknown) => T,
t: Translate = defaultTranslate,
-): { id: string; time: number; value: T }[] {
+ extras: (frame: Record) => E = (() => ({} as E)),
+): ({ id: string; time: number; value: T } & E)[] {
if (!Array.isArray(raw))
throw new Error(t("editors.stage.error.invalidKeyframes"));
const ids = new Set(),
@@ -181,19 +571,19 @@ function frames(
ids.has(v.id) ||
!finite(v.time) ||
v.time < 0 ||
- v.time > duration ||
+ (duration !== undefined && v.time > duration) ||
times.has(v.time)
)
throw new Error(t("editors.stage.error.invalidKeyframeTime"));
ids.add(v.id);
times.add(v.time);
- return { id: v.id, time: v.time, value: parse(v.value) };
+ return { id: v.id, time: v.time, value: parse(v.value), ...extras(v) };
})
.sort((a, b) => a.time - b.time);
}
function intervals(
items: T[],
- duration: number,
+ duration: number | undefined,
label: string,
t: Translate = defaultTranslate,
): T[] {
@@ -207,7 +597,7 @@ function intervals(
!finite(v.duration) ||
v.start < 0 ||
v.duration <= 0 ||
- v.start + v.duration > duration + 1e-8
+ (duration !== undefined && v.start + v.duration > duration + 1e-8)
)
throw new Error(t("editors.stage.error.intervalInvalid", { label }));
if (i && sorted[i - 1]!.start + sorted[i - 1]!.duration > v.start + 1e-8)
@@ -252,9 +642,12 @@ function migrateV1(
...v,
version: 2,
aspectRatio: "16:9",
+ fps: 30,
activeCameraId: "camera-1",
cameraSource: "camera",
shots: [],
+ environment: defaultStageEnvironment(),
+ lights: defaultStageLights(),
cameras: [
{
id: "camera-1",
@@ -296,13 +689,40 @@ function migrateV1(
}),
};
}
+export function parseImportedStageValue(
+ input: unknown,
+ t: Translate = defaultTranslate,
+): LocalStageDocument {
+ return parseStageValue(input, t, "import");
+}
+
export function parseLocalStageValue(
input: unknown,
t: Translate = defaultTranslate,
): LocalStageDocument {
+ return parseStageValue(input, t, "stored");
+}
+
+function parseStageValue(input: unknown, t: Translate, source: "stored" | "import"): LocalStageDocument {
let v = input;
if (record(v) && v.format === "opendirector-local-stage" && v.version === 1)
v = migrateV1(v, t);
+ if (
+ record(v) &&
+ v.format === "opendirector-local-stage" &&
+ v.version === 2 &&
+ v.fps === undefined
+ )
+ v = { ...v, fps: 30 };
+ if (record(v) && v.format === "opendirector-local-stage" && v.version === 2) {
+ v = {
+ ...v,
+ environment: record(v.environment)
+ ? { ...defaultStageEnvironment(), ...v.environment }
+ : defaultStageEnvironment(),
+ lights: v.lights ?? defaultStageLights(),
+ };
+ }
if (
!record(v) ||
v.format !== "opendirector-local-stage" ||
@@ -311,6 +731,7 @@ export function parseLocalStageValue(
typeof v.grid !== "boolean" ||
!finite(v.duration) ||
v.duration <= 0 ||
+ !isStageFps(v.fps) ||
!Array.isArray(v.objects) ||
!Array.isArray(v.cameras) ||
!Array.isArray(v.shots) ||
@@ -320,30 +741,134 @@ export function parseLocalStageValue(
!["camera", "storyboard"].includes(String(v.cameraSource))
)
throw new Error(t("editors.stage.error.invalidDocument"));
+ const environment = record(v.environment) &&
+ ["studio", "warm-sunset", "moonlit"].includes(String(v.environment.preset)) &&
+ color(v.environment.groundColor) &&
+ typeof v.environment.groundVisible === "boolean" &&
+ finite(v.environment.exposure) &&
+ v.environment.exposure >= 0 && v.environment.exposure <= 4 &&
+ (v.environment.backgroundAsset === null || imageAssetRef(v.environment.backgroundAsset))
+ ? {
+ preset: v.environment.preset as StageEnvironmentPreset,
+ groundColor: v.environment.groundColor,
+ groundVisible: v.environment.groundVisible,
+ exposure: v.environment.exposure,
+ backgroundAsset: v.environment.backgroundAsset as AssetRef | null,
+ }
+ : (() => { throw new Error(t("editors.stage.error.invalidDocument")); })();
+ if (!Array.isArray(v.lights) || v.lights.length !== 3)
+ throw new Error(t("editors.stage.error.invalidDocument"));
+ const lightIds = new Set();
+ const lights: StageLight[] = v.lights.map((raw) => {
+ if (!record(raw) || !stageLightIds.includes(raw.id as StageLightId) || lightIds.has(String(raw.id)) ||
+ !color(raw.color) || !finite(raw.intensity) || raw.intensity < 0 || raw.intensity > 10 ||
+ !vector(raw.position) || typeof raw.castShadow !== "boolean" ||
+ (raw.id === "hemisphere" && raw.castShadow))
+ throw new Error(t("editors.stage.error.invalidDocument"));
+ lightIds.add(String(raw.id));
+ return {
+ id: raw.id as StageLightId,
+ color: raw.color,
+ intensity: raw.intensity,
+ position: { ...raw.position },
+ castShadow: raw.castShadow,
+ };
+ });
+ if (lightIds.size !== 3) throw new Error(t("editors.stage.error.invalidDocument"));
const duration = v.duration,
ids = new Set(),
cameraIds = new Set();
const objects: StageObject[] = v.objects.map((o) => {
+ const rawObject = record(o) ? o : undefined;
+ const imported = rawObject?.kind === "gltf";
+ const importedAsset =
+ imported && assetRef(rawObject?.asset) ? rawObject.asset : undefined;
+ const importedSource =
+ imported && typeof rawObject?.source === "string" && rawObject.source.trim()
+ ? rawObject.source
+ : undefined;
+ const thumbnailAsset =
+ rawObject && imageAssetRef(rawObject.thumbnailAsset)
+ ? rawObject.thumbnailAsset
+ : undefined;
+ const thumbnailCapture = imageDataUrl(rawObject?.thumbnailCapture)
+ ? rawObject.thumbnailCapture
+ : undefined;
+ const thumbnailSource = nonempty(rawObject?.thumbnailSource)
+ ? rawObject.thumbnailSource
+ : undefined;
+ const animationNames =
+ imported && Array.isArray(rawObject?.animationNames)
+ ? rawObject.animationNames.filter((name): name is string => nonempty(name))
+ : [];
if (
!record(o) ||
!nonempty(o.id) ||
ids.has(o.id) ||
- !["person", "box", "sphere"].includes(String(o.kind)) ||
+ ![
+ "person",
+ "box",
+ "sphere",
+ "gltf",
+ "cylinder",
+ "cone",
+ "pyramid",
+ "torus",
+ "plane",
+ "capsule",
+ "disk",
+ "arc",
+ "halfCylinder",
+ ].includes(String(o.kind)) ||
typeof o.name !== "string" ||
!color(o.color) ||
- !Array.isArray(o.motionClips)
+ (o.visible !== undefined && typeof o.visible !== "boolean") ||
+ (o.locked !== undefined && typeof o.locked !== "boolean") ||
+ (o.opacity !== undefined && (!finite(o.opacity) || o.opacity < 0 || o.opacity > 1)) ||
+ !Array.isArray(o.motionClips) ||
+ (rawObject?.thumbnailAsset != null && !thumbnailAsset) ||
+ (rawObject?.thumbnailCapture != null && !thumbnailCapture) ||
+ (rawObject?.thumbnailSource != null && !thumbnailSource) ||
+ (imported &&
+ ((!importedAsset && !importedSource) ||
+ !["character", "scene"].includes(String(rawObject?.role)) ||
+ !["glb", "gltf"].includes(String(rawObject?.format)) ||
+ !Array.isArray(rawObject?.animationNames) ||
+ animationNames.length !== rawObject?.animationNames.length ||
+ typeof rawObject?.hasAnimation !== "boolean" ||
+ rawObject.hasAnimation !== Boolean(animationNames.length)))
)
throw new Error(t("editors.stage.error.invalidObject"));
ids.add(o.id);
- if (o.kind !== "person" && o.motionClips.length)
+ if (o.kind !== "person" && o.kind !== "gltf" && o.motionClips.length)
throw new Error(t("editors.stage.error.jointMotionPerson"));
+ if (imported && o.role === "scene" && o.motionClips.length)
+ throw new Error(t("editors.stage.error.importedSceneMotion"));
+ if (imported && !o.hasAnimation && o.motionClips.length)
+ throw new Error(t("editors.stage.error.importedMotionUnavailable"));
return {
id: o.id,
kind: o.kind as StageObject["kind"],
name: o.name,
color: o.color,
+ visible: o.visible ?? true,
+ locked: o.locked ?? false,
+ opacity: o.opacity ?? 1,
...parseTransform(o, t),
- keyframes: frames(o.keyframes, duration, (v) => parseTransform(v, t), t),
+ keyframes: frames(
+ o.keyframes,
+ undefined,
+ (v) => parseTransform(v, t),
+ t,
+ (frame) => {
+ const channels = keyedChannels(frame.keyedChannels);
+ const transitions = transformTransitions(frame.transitions);
+ return {
+ ...(channels ? { keyedChannels: channels } : {}),
+ ...(transitions ? { transitions } : {}),
+ };
+ },
+ ),
motionClips: intervals(
o.motionClips.map((c) => {
if (!record(c))
@@ -355,10 +880,23 @@ export function parseLocalStageValue(
motion: parseStageMotion(c.motion),
};
}),
- duration,
+ undefined,
t("editors.stage.label.motionClip"),
t,
),
+ ...(importedAsset ? { asset: { ...importedAsset } } : {}),
+ ...(importedSource ? { source: importedSource } : {}),
+ ...(thumbnailAsset ? { thumbnailAsset: { ...thumbnailAsset } } : {}),
+ ...(thumbnailCapture ? { thumbnailCapture } : {}),
+ ...(thumbnailSource ? { thumbnailSource } : {}),
+ ...(imported
+ ? {
+ role: o.role as StageAssetRole,
+ format: o.format as StageAssetFormat,
+ animationNames: [...animationNames],
+ hasAnimation: o.hasAnimation as boolean,
+ }
+ : {}),
};
});
const cameras: StageCameraRig[] = v.cameras.map((c) => {
@@ -370,61 +908,97 @@ export function parseLocalStageValue(
)
throw new Error(t("editors.stage.error.invalidCameraId"));
cameraIds.add(c.id);
+ const pose = parseCamera(c.pose, t);
+ const keyframes = frames(c.keyframes, undefined, (v) => parseCamera(v, t), t);
+ const channels = parseCameraChannels(c.channels, keyframes, t);
+ const aspectRatio = c.aspectRatio ?? v.aspectRatio;
+ if (!STAGE_RATIOS.includes(aspectRatio as LocalStageDocument["aspectRatio"]))
+ throw new Error(t("editors.stage.error.invalidCamera"));
return {
id: c.id,
name: c.name,
- pose: parseCamera(c.pose, t),
- keyframes: frames(c.keyframes, duration, (v) => parseCamera(v, t), t),
+ aspectRatio: aspectRatio as LocalStageDocument["aspectRatio"],
+ pose,
+ channels,
+ keyframes: c.channels === undefined ? keyframes : cameraKeyframesFromChannels(pose, channels),
};
});
if (!cameras.length || !cameraIds.has(v.activeCameraId as string))
throw new Error(t("editors.stage.error.cameraRequired"));
- const shots = intervals(
- v.shots.map((s) => {
- if (!record(s) || !cameraIds.has(s.cameraId as string))
- throw new Error(t("editors.stage.error.shotCamera"));
- return {
- id: s.id as string,
- cameraId: s.cameraId as string,
- start: s.start as number,
- duration: s.duration as number,
- };
- }),
- duration,
- t("editors.stage.label.shot"),
- t,
- );
+ const shots: StageShot[] = v.shots.map((shot) => {
+ if (!record(shot) || !nonempty(shot.id) || !finite(shot.start) || shot.start < 0)
+ throw new Error(t(stageStoryboardIssueMessageKey("storyboard_block_invalid")));
+ if (!finite(shot.duration) || shot.duration <= 0)
+ throw new Error(t(stageStoryboardIssueMessageKey("storyboard_duration_invalid")));
+ if (typeof shot.cameraId !== "string" || !cameraIds.has(shot.cameraId))
+ throw new Error(t(stageStoryboardIssueMessageKey("storyboard_camera_unknown")));
+ return { id: shot.id, cameraId: shot.cameraId, start: shot.start, duration: shot.duration };
+ });
+ const issue = stageStoryboardIssue({ shots, duration, cameras });
+ if (issue && source === "import")
+ throw new Error(t(stageStoryboardIssueMessageKey(issue)));
+ if (issue)
+ intervals([...shots], duration, t("editors.stage.label.shot"), t);
+ if (shots.some((shot) => shot.start + shot.duration > duration + STORYBOARD_TIME_TOLERANCE))
+ throw new Error(t(stageStoryboardIssueMessageKey("storyboard_exceeds_duration")));
return {
format: "opendirector-local-stage",
version: 2,
background: v.background,
grid: v.grid,
duration,
+ fps: v.fps,
aspectRatio: v.aspectRatio as LocalStageDocument["aspectRatio"],
activeCameraId: v.activeCameraId as string,
cameraSource: v.cameraSource as LocalStageDocument["cameraSource"],
objects,
cameras,
shots,
+ environment,
+ lights,
};
}
+/** Gesture values round-trip through the renderer's spherical camera math,
+ * so an unchanged pose can still differ by float noise; an edit comparison
+ * must treat that as unchanged while parseCamera keeps exact validation. */
+const closeVector = (a: Vector3Value, b: Vector3Value) =>
+ Math.abs(a.x - b.x) < 1e-9 &&
+ Math.abs(a.y - b.y) < 1e-9 &&
+ Math.abs(a.z - b.z) < 1e-9;
const sameTransform = (a: StageTransform, b: StageTransform) =>
- sameVector(a.position, b.position) &&
- sameVector(a.rotation, b.rotation) &&
- sameVector(a.scale, b.scale);
+ closeVector(a.position, b.position) &&
+ closeVector(a.rotation, b.rotation) &&
+ closeVector(a.scale, b.scale);
const sameCamera = (a: StageCamera, b: StageCamera) =>
- sameVector(a.position, b.position) &&
- sameVector(a.target, b.target) &&
- a.fov === b.fov;
+ closeVector(a.position, b.position) &&
+ closeVector(a.target, b.target) &&
+ Math.abs(a.fov - b.fov) < 1e-9 &&
+ (a.roll ?? 0) === (b.roll ?? 0);
+const sameCameraChannels = (a: StageCameraChannels, b: StageCameraChannels) =>
+ sameFrames(a.position, b.position, sameVector) &&
+ sameFrames(a.target, b.target, sameVector) &&
+ sameFrames(a.up, b.up, sameVector) &&
+ sameFrames(a.focalLength, b.focalLength, (x, y) => Math.abs(x - y) < 1e-9);
+const sameAsset = (a: AssetRef | undefined, b: AssetRef | undefined) =>
+ a === b ||
+ (!!a &&
+ !!b &&
+ a.assetId === b.assetId &&
+ a.revision === b.revision &&
+ a.fingerprint === b.fingerprint &&
+ a.kind === b.kind);
const sameFrames = (
- a: { id: string; time: number; value: T }[],
- b: { id: string; time: number; value: T }[],
+ a: ({ id: string; time: number; value: T; keyedChannels?: StageTransformChannel[]; transition?: StageBezierTransition; transitions?: StageTransformTransitions })[],
+ b: ({ id: string; time: number; value: T; keyedChannels?: StageTransformChannel[]; transition?: StageBezierTransition; transitions?: StageTransformTransitions })[],
same: (a: T, b: T) => boolean,
) =>
a.length === b.length &&
a.every(
(f, i) =>
- f.id === b[i]!.id && f.time === b[i]!.time && same(f.value, b[i]!.value),
+ f.id === b[i]!.id && f.time === b[i]!.time && same(f.value, b[i]!.value) &&
+ (f.keyedChannels ?? []).join("\u0000") === (b[i]!.keyedChannels ?? []).join("\u0000") &&
+ sameTransition(f.transition, b[i]!.transition) &&
+ sameTransformTransitions(f.transitions, b[i]!.transitions),
);
export function sameLocalStage(
a: LocalStageDocument | undefined,
@@ -437,9 +1011,22 @@ export function sameLocalStage(
a.background === b.background &&
a.grid === b.grid &&
a.duration === b.duration &&
+ a.fps === b.fps &&
a.aspectRatio === b.aspectRatio &&
a.activeCameraId === b.activeCameraId &&
a.cameraSource === b.cameraSource &&
+ a.environment.preset === b.environment.preset &&
+ a.environment.groundColor === b.environment.groundColor &&
+ a.environment.groundVisible === b.environment.groundVisible &&
+ a.environment.exposure === b.environment.exposure &&
+ sameAsset(a.environment.backgroundAsset ?? undefined, b.environment.backgroundAsset ?? undefined) &&
+ a.lights.length === b.lights.length &&
+ a.lights.every((light, i) => {
+ const other = b.lights[i]!;
+ return light.id === other.id && light.color === other.color &&
+ light.intensity === other.intensity && light.castShadow === other.castShadow &&
+ sameVector(light.position, other.position);
+ }) &&
a.objects.length === b.objects.length &&
a.objects.every((o, i) => {
const p = b.objects[i]!;
@@ -448,6 +1035,15 @@ export function sameLocalStage(
o.name === p.name &&
o.kind === p.kind &&
o.color === p.color &&
+ o.visible === p.visible &&
+ o.locked === p.locked &&
+ o.opacity === p.opacity &&
+ sameAsset(o.asset, p.asset) &&
+ o.role === p.role &&
+ o.format === p.format &&
+ o.hasAnimation === p.hasAnimation &&
+ (o.animationNames ?? []).join("\u0000") ===
+ (p.animationNames ?? []).join("\u0000") &&
sameTransform(o, p) &&
sameFrames(o.keyframes, p.keyframes, sameTransform) &&
o.motionClips.length === p.motionClips.length &&
@@ -470,7 +1066,9 @@ export function sameLocalStage(
return (
c.id === d.id &&
c.name === d.name &&
+ (c.aspectRatio ?? a.aspectRatio) === (d.aspectRatio ?? b.aspectRatio) &&
sameCamera(c.pose, d.pose) &&
+ sameCameraChannels(cameraChannelsOf(c), cameraChannelsOf(d)) &&
sameFrames(c.keyframes, d.keyframes, sameCamera)
);
}) &&
@@ -487,6 +1085,27 @@ export function sameLocalStage(
);
}
const lerp = (a: number, b: number, t: number) => a + (b - a) * t;
+const sameTransition = (a: StageBezierTransition | undefined, b: StageBezierTransition | undefined) =>
+ a === b || (!!a && !!b && a.controlPoints.every((value, index) => value === b.controlPoints[index]));
+const sameTransformTransitions = (a: StageTransformTransitions | undefined, b: StageTransformTransitions | undefined) =>
+ (["position", "rotation", "scale"] as const).every((channel) => sameTransition(a?.[channel], b?.[channel]));
+const cubic = (a: number, b: number, t: number) => {
+ const inverse = 1 - t;
+ return 3 * inverse * inverse * t * a + 3 * inverse * t * t * b + t * t * t;
+};
+export function transitionProgress(transition: StageTransition, progress: number): number {
+ const target = Math.max(0, Math.min(1, progress));
+ if (transition.kind === "linear") return target;
+ const [x1, y1, x2, y2] = transition.controlPoints;
+ let low = 0;
+ let high = 1;
+ for (let index = 0; index < 20; index += 1) {
+ const midpoint = (low + high) / 2;
+ if (cubic(x1, x2, midpoint) < target) low = midpoint;
+ else high = midpoint;
+ }
+ return cubic(y1, y2, (low + high) / 2);
+}
const mixVector = (
a: Vector3Value,
b: Vector3Value,
@@ -498,7 +1117,7 @@ const mixVector = (
});
function sample(
base: T,
- frames: { time: number; value: T }[],
+ frames: { time: number; value: T; transition?: StageBezierTransition }[],
time: number,
mix: (a: T, b: T, t: number) => T,
): T {
@@ -510,7 +1129,7 @@ function sample(
right.value,
left.time === right.time
? 0
- : (time - left.time) / (right.time - left.time),
+ : transitionProgress(left.transition ?? LINEAR_TRANSITION, (time - left.time) / (right.time - left.time)),
);
}
export function sampleStageCamera(
@@ -521,69 +1140,227 @@ export function sampleStageCamera(
): StageCamera {
const c = stage.cameras.find((c) => c.id === id);
if (!c) throw new Error(t("editors.stage.error.cameraMissing"));
- return sample(c.pose, c.keyframes, time, (a, b, t) => ({
- position: mixVector(a.position, b.position, t),
- target: mixVector(a.target, b.target, t),
- fov: lerp(a.fov, b.fov, t),
- }));
+ const channels = cameraChannelsOf(c);
+ return {
+ position: channelAt(c.pose.position, channels.position, time, mixVector),
+ target: channelAt(c.pose.target, channels.target, time, mixVector),
+ fov: channelAt(c.pose.fov, channels.focalLength, time, lerp),
+ ...(c.pose.roll ? { roll: c.pose.roll } : {}),
+ };
+}
+/**
+ * Sample the authored up channel for a camera at a time. The up channel is
+ * the editable camera orientation input alongside roll; renderers apply it
+ * as the camera up vector before lookAt.
+ */
+export function sampleStageCameraUp(
+ stage: LocalStageDocument,
+ id: string,
+ time: number,
+): Vector3Value {
+ const c = stage.cameras.find((c) => c.id === id);
+ if (!c) return defaultCameraUp();
+ return channelAt(
+ defaultCameraUp(),
+ cameraChannelsOf(c).up,
+ time,
+ mixVector,
+ );
+}
+/**
+ * The Storyboard block that owns `time`, or null when none does.
+ *
+ * A block owns the half-open interval from its start to its end, so a time that is
+ * exactly a shared boundary belongs to the block on its right. The exact final endpoint
+ * belongs to the last block. Saved boundaries are millisecond-normalized.
+ */
+export function stageStoryboardBlockAt(
+ stage: LocalStageDocument,
+ time: number,
+): StageShot | null {
+ const owning = stage.shots.find((shot) => {
+ const [start, end] = blockRange(shot);
+ return time >= start && time < end;
+ });
+ if (owning) return owning;
+ const last = stage.shots.at(-1);
+ return last && time === blockRange(last)[1] ? last : null;
+}
+/** A stored block's start and end in millisecond-normalized seconds. */
+const blockRange = (shot: StageShot): readonly [number, number] => {
+ const start = normalizeStoryboardTime(shot.start);
+ return [start, storyboardBlockEnd(shot)];
+};
+/**
+ * What a preview shows: the Storyboard, whose camera is the one of the block under the
+ * playhead, or one camera held for the whole timeline. It is view state and is never
+ * saved with the stage.
+ */
+export type StagePreviewSource =
+ | { kind: "storyboard" }
+ | { kind: "camera"; cameraId: string };
+/**
+ * The camera a preview source shows at `time`, or null when it names none.
+ *
+ * The Storyboard names the camera of the block that owns the time, and after its end it
+ * stays on the last block's camera: no further cut and no other camera, exactly like the
+ * terminal time of the main timeline. A concrete camera names itself while it exists.
+ * The chosen source uses the same fallback as the selector.
+ */
+export function stagePreviewCameraId(
+ stage: LocalStageDocument,
+ source: StagePreviewSource,
+ time: number,
+): string | null {
+ const resolved = resolveStagePreviewSource(stage, source);
+ const exists = (cameraId: string) =>
+ stage.cameras.some((camera) => camera.id === cameraId);
+ if (resolved.kind === "camera") return exists(resolved.cameraId) ? resolved.cameraId : null;
+ const last = stage.shots.at(-1);
+ const held =
+ last && time > blockRange(last)[1] ? last : null;
+ const block = stageStoryboardBlockAt(stage, time) ?? held;
+ return block && exists(block.cameraId) ? block.cameraId : null;
+}
+/**
+ * The one fallback rule for a preview source. A Storyboard with no blocks and a camera
+ * that no longer exists resolve to the first existing camera; a source that names
+ * something is returned as it was chosen.
+ *
+ * It only derives. The chosen source is kept as it is, so it applies again by itself
+ * once it names something again, for example after an undo.
+ */
+export function resolveStagePreviewSource(
+ stage: LocalStageDocument,
+ source: StagePreviewSource,
+): StagePreviewSource {
+ const usable =
+ source.kind === "storyboard"
+ ? stage.shots.length > 0
+ : stage.cameras.some((camera) => camera.id === source.cameraId);
+ if (usable) return source;
+ // Nothing can be shown without a camera; a stage that holds none has none to offer.
+ const first = stage.cameras[0];
+ return first ? { kind: "camera", cameraId: first.id } : source;
}
+/**
+ * The preview source a stored document opens with: its Storyboard when the document
+ * stores that as its source, otherwise the camera it stores as the active one.
+ *
+ * A document becomes the draft when the editor opens and when one is imported, and these
+ * are the only moments the preview reads what it stores. The result is kept as chosen;
+ * `resolveStagePreviewSource` settles whatever it fails to name.
+ */
+export function storedStagePreviewSource(
+ stage: LocalStageDocument,
+): StagePreviewSource {
+ return stage.cameraSource === "storyboard"
+ ? { kind: "storyboard" }
+ : { kind: "camera", cameraId: stage.activeCameraId };
+}
+/** The scene at a time: every object as its keyframes and motion clips have it there. */
+const sampleStageObjects = (
+ stage: LocalStageDocument,
+ at: number,
+): StageSampleObject[] =>
+ stage.objects.map((o) => {
+ const channel = (name: StageTransformChannel) =>
+ sample(
+ o[name],
+ o.keyframes
+ .filter((frame) =>
+ !o.keyframes.some((candidate) => candidate.keyedChannels) || frame.keyedChannels?.includes(name),
+ )
+ .map((frame) => ({
+ time: frame.time,
+ value: frame.value[name],
+ transition: frame.transitions?.[name],
+ })),
+ at,
+ mixVector,
+ );
+ const transform: StageTransform = {
+ position: channel("position"),
+ rotation: channel("rotation"),
+ scale: channel("scale"),
+ };
+ const clip = o.motionClips.find(
+ (c) =>
+ at >= c.start &&
+ (at < c.start + c.duration ||
+ (at === stage.duration && at === c.start + c.duration)),
+ );
+ return {
+ ...o,
+ ...transform,
+ motion: clip?.motion,
+ motionTime: clip ? at - clip.start : 0,
+ };
+ });
/** Same global timeline and half-open cut boundaries for editor, screenshots and MP4. */
export function sampleStage(
stage: LocalStageDocument,
time: number,
): StageSample {
const at = Math.max(0, Math.min(stage.duration, time));
- const shot =
- stage.cameraSource === "storyboard"
- ? stage.shots.find(
- (s) =>
- at >= s.start &&
- (at < s.start + s.duration ||
- (at === stage.duration && at === s.start + s.duration)),
- )
- : undefined;
+ const shot = stage.cameraSource === "storyboard" ? stageStoryboardBlockAt(stage, at) : null;
const cameraId = shot?.cameraId ?? stage.activeCameraId;
return {
cameraId,
camera: sampleStageCamera(stage, cameraId, at),
- objects: stage.objects.map((o) => {
- const transform = sample(
- o,
- o.keyframes,
- at,
- (a, b, t) => ({
- position: mixVector(a.position, b.position, t),
- rotation: mixVector(a.rotation, b.rotation, t),
- scale: mixVector(a.scale, b.scale, t),
- }),
- );
- const clip = o.motionClips.find(
- (c) =>
- at >= c.start &&
- (at < c.start + c.duration ||
- (at === stage.duration && at === c.start + c.duration)),
- );
- return {
- ...o,
- ...transform,
- motion: clip?.motion,
- motionTime: clip ? at - clip.start : 0,
- };
- }),
+ objects: sampleStageObjects(stage, at),
};
}
-const putFrame = (
- frames: { id: string; time: number; value: T }[],
+/** The transport time a picture uses, with a Storyboard's final frame held. */
+export function stagePreviewFrameTime(
+ stage: LocalStageDocument,
+ source: StagePreviewSource,
time: number,
- value: T,
-) =>
+): number {
+ const at = Math.max(0, Math.min(stage.duration, time));
+ const last = source.kind === "storyboard" ? stage.shots.at(-1) : undefined;
+ return last ? Math.min(at, blockRange(last)[1]) : at;
+}
+
+/** The frame shown in a preview pane or captured as a still. */
+export function sampleStagePreview(
+ stage: LocalStageDocument,
+ source: StagePreviewSource,
+ time: number,
+ t: Translate = defaultTranslate,
+): StageSample {
+ return sampleStageEditingViewport(stage, source, stagePreviewFrameTime(stage, source, time), t);
+}
+
+/** Keep the viewport editable at the playhead through the preview's chosen camera. */
+export function sampleStageEditingViewport(
+ stage: LocalStageDocument,
+ source: StagePreviewSource,
+ time: number,
+ t: Translate = defaultTranslate,
+): StageSample {
+ const at = Math.max(0, Math.min(stage.duration, time));
+ const cameraId = stagePreviewCameraId(stage, source, at);
+ if (cameraId === null) throw new Error(t("editors.stage.error.cameraMissing"));
+ return {
+ cameraId,
+ camera: sampleStageCamera(stage, cameraId, at, t),
+ objects: sampleStageObjects(stage, at),
+ };
+}
+const putFrame = (
+ frames: F[],
+ time: number,
+ value: F["value"],
+): F[] =>
[
...frames.filter((f) => f.time !== time),
{
+ ...frames.find((f) => f.time === time),
id: frames.find((f) => f.time === time)?.id ?? crypto.randomUUID(),
time,
value,
- },
+ } as F,
].sort((a, b) => a.time - b.time);
function authorFrame(
frames: { id: string; time: number; value: T }[],
@@ -593,11 +1370,34 @@ function authorFrame(
) {
// The first edit later in time must not retroactively replace the opening pose.
return putFrame(
- !frames.length && time > 0 ? putFrame([], 0, base) : frames,
+ !frames.length && time > 0
+ ? putFrame<{ id: string; time: number; value: T }>([], 0, base)
+ : frames,
time,
value,
);
}
+function authorTransformFrame(
+ frames: StageTransformFrame[],
+ time: number,
+ value: StageTransform,
+ base: StageTransform,
+ channels: StageTransformChannel[],
+): StageTransformFrame[] {
+ const normalized = frames.some((frame) => frame.keyedChannels)
+ ? frames
+ : frames.map((frame) => ({
+ ...frame,
+ keyedChannels: ["position", "rotation", "scale"] as StageTransformChannel[],
+ }));
+ const opening = !normalized.length && time > 0
+ ? putFrame([], 0, base).map((frame) => ({ ...frame, keyedChannels: [...channels] }))
+ : normalized;
+ const next = putFrame(opening, time, value);
+ return next.map((frame) => frame.time === time
+ ? { ...frame, keyedChannels: [...new Set([...(frame.keyedChannels ?? []), ...channels])] }
+ : frame);
+}
export function editStageObjectAt(
stage: LocalStageDocument,
id: string,
@@ -606,7 +1406,7 @@ export function editStageObjectAt(
t: Translate = defaultTranslate,
): LocalStageDocument {
const pose = sampleStage(stage, time).objects.find((o) => o.id === id);
- if (!pose) return stage;
+ if (!pose || pose.locked) return stage;
const transform = parseTransform({ ...pose, ...patch }, t);
const {
position: _position,
@@ -617,6 +1417,9 @@ export function editStageObjectAt(
const changesTransform =
!!(patch.position || patch.rotation || patch.scale) &&
!sameTransform(pose, transform);
+ const changedChannels = (["position", "rotation", "scale"] as const).filter(
+ (channel) => patch[channel] && !sameVector(pose[channel], transform[channel]),
+ );
return parseLocalStageValue(
{
...stage,
@@ -628,7 +1431,7 @@ export function editStageObjectAt(
...metadata,
...(changesTransform ? transform : {}),
keyframes: changesTransform
- ? authorFrame(o.keyframes, time, transform, parseTransform(o, t))
+ ? authorTransformFrame(o.keyframes, time, transform, parseTransform(o, t), changedChannels)
: o.keyframes,
},
),
@@ -636,6 +1439,24 @@ export function editStageObjectAt(
t,
);
}
+/** Placement writes the base transform only and never authors keyframes:
+ * dragging repositions a static subject instead of animating it. */
+export function editStageObjectPlacement(
+ stage: LocalStageDocument,
+ id: string,
+ transform: StageTransform,
+ t: Translate = defaultTranslate,
+): LocalStageDocument {
+ const value = parseTransform(transform, t);
+ if (!stage.objects.some((o) => o.id === id && !o.locked)) return stage;
+ return parseLocalStageValue(
+ {
+ ...stage,
+ objects: stage.objects.map((o) => (o.id === id ? { ...o, ...value } : o)),
+ },
+ t,
+ );
+}
export function editStageCameraAt(
stage: LocalStageDocument,
id: string,
@@ -655,47 +1476,87 @@ export function editStageCameraAt(
: {
...c,
pose,
- keyframes: authorFrame(c.keyframes, time, pose, c.pose),
+ channels: {
+ position: sameVector(current.position, pose.position)
+ ? cameraChannelsOf(c).position
+ : authorFrame(cameraChannelsOf(c).position, time, pose.position, c.pose.position),
+ target: sameVector(current.target, pose.target)
+ ? cameraChannelsOf(c).target
+ : authorFrame(cameraChannelsOf(c).target, time, pose.target, c.pose.target),
+ up: cameraChannelsOf(c).up,
+ focalLength: current.fov === pose.fov
+ ? cameraChannelsOf(c).focalLength
+ : authorFrame(cameraChannelsOf(c).focalLength, time, pose.fov, c.pose.fov),
+ },
},
),
},
t,
);
}
-export function captureStageFrame(
+/** Key the editable scene and the selected preview camera at the transport time. */
+export function captureStagePreviewFrame(
stage: LocalStageDocument,
+ source: StagePreviewSource,
time: number,
t: Translate = defaultTranslate,
): LocalStageDocument {
- const pose = sampleStage(stage, time);
+ return captureFrameFor(
+ stage,
+ stagePreviewCameraId(stage, source, time),
+ time,
+ t,
+ );
+}
+/** Key every unlocked object, and one named camera, where they are at `time`. */
+function captureFrameFor(
+ stage: LocalStageDocument,
+ cameraId: string | null,
+ time: number,
+ t: Translate,
+): LocalStageDocument {
+ const at = Math.max(0, Math.min(stage.duration, time));
+ const pose = sampleStageObjects(stage, at);
+ const camera =
+ cameraId === null ? undefined : sampleStageCamera(stage, cameraId, at, t);
return parseLocalStageValue(
{
...stage,
objects: stage.objects.map((o) => ({
...o,
- keyframes: putFrame(
- o.keyframes,
- time,
- parseTransform(pose.objects.find((p) => p.id === o.id)!, t),
- ),
+ keyframes: o.locked
+ ? o.keyframes
+ : putFrame(
+ o.keyframes,
+ time,
+ parseTransform(pose.find((p) => p.id === o.id)!, t),
+ ).map((frame) =>
+ // The captured frame keys every channel; pre-channel frames
+ // also keyed every channel, so once per-channel keying enters
+ // the list they must carry the full set or the sampler drops
+ // them as unkeyed.
+ frame.time === time || !frame.keyedChannels
+ ? { ...frame, keyedChannels: ["position", "rotation", "scale"] }
+ : frame,
+ ),
})),
cameras: stage.cameras.map((c) =>
- c.id === pose.cameraId
- ? { ...c, keyframes: putFrame(c.keyframes, time, pose.camera) }
+ c.id === cameraId && camera
+ ? {
+ ...c,
+ channels: {
+ position: putFrame(cameraChannelsOf(c).position, time, camera.position),
+ target: putFrame(cameraChannelsOf(c).target, time, camera.target),
+ up: putFrame(cameraChannelsOf(c).up, time, defaultCameraUp()),
+ focalLength: putFrame(cameraChannelsOf(c).focalLength, time, camera.fov),
+ },
+ }
: c,
),
},
t,
);
}
-export function stageFrameTimes(stage: LocalStageDocument): number[] {
- return [
- ...new Set([
- ...stage.objects.flatMap((o) => o.keyframes.map((f) => f.time)),
- ...stage.cameras.flatMap((c) => c.keyframes.map((f) => f.time)),
- ]),
- ].sort((a, b) => a - b);
-}
export function removeStageFrame(
stage: LocalStageDocument,
time: number,
@@ -708,17 +1569,43 @@ export function removeStageFrame(
})),
cameras: stage.cameras.map((c) => ({
...c,
- keyframes: c.keyframes.filter((f) => f.time !== time),
+ channels: {
+ position: cameraChannelsOf(c).position.filter((f) => f.time !== time),
+ target: cameraChannelsOf(c).target.filter((f) => f.time !== time),
+ up: cameraChannelsOf(c).up.filter((f) => f.time !== time),
+ focalLength: cameraChannelsOf(c).focalLength.filter((f) => f.time !== time),
+ },
})),
};
}
-export function stageOutputSize(ratio: LocalStageDocument["aspectRatio"]): {
+/** Encoder resolution for a stage ratio. The default long edge matches the
+ * standard export quality; high quality doubles nothing but the long edge. */
+export function stageOutputSize(
+ ratio: LocalStageDocument["aspectRatio"],
+ longEdge = 1280,
+): {
width: number;
height: number;
} {
const [w, h] = ratio.split(":").map(Number);
return {
- width: Math.round((1280 * w!) / Math.max(w!, h!) / 2) * 2,
- height: Math.round((1280 * h!) / Math.max(w!, h!) / 2) * 2,
+ width: Math.round((longEdge * w!) / Math.max(w!, h!) / 2) * 2,
+ height: Math.round((longEdge * h!) / Math.max(w!, h!) / 2) * 2,
};
}
+/** Imported objects pinning assets the current project has not registered.
+ * Stage JSON exports carry no model bytes, so such objects can neither
+ * preview nor apply; importers reject them explicitly instead of failing
+ * at save time. */
+export function unregisteredStageAssets(
+ stage: LocalStageDocument,
+ isRegistered: (asset: AssetRef) => boolean,
+): StageObject[] {
+ return stage.objects.filter((object) => {
+ const modelMissing =
+ object.kind === "gltf" && object.asset && !isRegistered(object.asset);
+ const thumbnailMissing =
+ object.thumbnailAsset && !isRegistered(object.thumbnailAsset);
+ return Boolean(modelMissing || thumbnailMissing);
+ });
+}
diff --git a/src/canvas/stageElevation.ts b/src/canvas/stageElevation.ts
new file mode 100644
index 000000000..34827aab7
--- /dev/null
+++ b/src/canvas/stageElevation.ts
@@ -0,0 +1,169 @@
+import * as THREE from "three";
+import { STAGE_GROUND_LEVEL } from "./stageGrounding.ts";
+
+/** The smallest height the readout shows. A subject placed or dropped by its
+ * rendered bottom lands within floating-point noise of the ground, and below
+ * this the value would round to zero. */
+export const STAGE_ELEVATION_MIN = 0.005;
+/** Diameter of the ring at the landing point, in CSS pixels however far the
+ * camera stands from it. */
+export const STAGE_ELEVATION_RING_DIAMETER = 12;
+
+const RING_SEGMENTS = 40;
+/** Room the line leaves above and below a value it frames. */
+const LABEL_PADDING = 3;
+/** The least line left beyond a framed value. A shorter one stands the value
+ * beside it instead. */
+const LABEL_MIN_LINE = 12;
+/** Space between the line and a value that stands beside it. */
+const LABEL_SIDE_GAP = 6;
+
+export interface StageElevationPoint {
+ x: number;
+ y: number;
+}
+export interface StageElevationSize {
+ width: number;
+ height: number;
+}
+export interface StageElevationLayout {
+ /** The line from the subject to the ground, whole or in two pieces around
+ * the value. */
+ segments: readonly (readonly [StageElevationPoint, StageElevationPoint])[];
+ /** The value's top-left corner. */
+ label: StageElevationPoint;
+}
+
+/**
+ * How far a subject's lowest rendered point stands above the business ground,
+ * or null when the subject stands on the ground or reaches below it. It is
+ * the distance drop-to-ground moves the subject, so the two agree on what
+ * counts as lifted.
+ */
+export function stageElevationHeight(
+ bottomY: number,
+ groundY = STAGE_GROUND_LEVEL,
+): number | null {
+ const height = bottomY - groundY;
+ return Number.isFinite(height) && height >= STAGE_ELEVATION_MIN
+ ? height
+ : null;
+}
+
+/** The value in metres, to the two decimals the position fields keep. */
+export const formatStageElevation = (height: number) => height.toFixed(2);
+
+/**
+ * Where the line and its value go, from the landing point and the subject's
+ * lowest point as already projected into the viewport. A line long enough
+ * frames its value in a gap. A short one, or one whose value would cross the
+ * viewport's edge, stands the value beside it on the side that has room.
+ */
+export function layoutStageElevation(
+ foot: StageElevationPoint,
+ bottom: StageElevationPoint,
+ label: StageElevationSize,
+ viewport: StageElevationSize,
+): StageElevationLayout {
+ const dx = bottom.x - foot.x;
+ const dy = bottom.y - foot.y;
+ const length = Math.hypot(dx, dy);
+ const ux = length > 1e-6 ? dx / length : 0;
+ const uy = length > 1e-6 ? dy / length : -1;
+ const middle = { x: (foot.x + bottom.x) / 2, y: (foot.y + bottom.y) / 2 };
+ const framed = label.height + LABEL_PADDING * 2;
+ const fitsAcross =
+ middle.x - label.width / 2 >= 0 &&
+ middle.x + label.width / 2 <= viewport.width;
+ if (length >= framed + LABEL_MIN_LINE * 2 && fitsAcross) {
+ const half = framed / 2;
+ return {
+ segments: [
+ [foot, { x: middle.x - ux * half, y: middle.y - uy * half }],
+ [{ x: middle.x + ux * half, y: middle.y + uy * half }, bottom],
+ ],
+ label: {
+ x: middle.x - label.width / 2,
+ y: middle.y - label.height / 2,
+ },
+ };
+ }
+ const right = middle.x + LABEL_SIDE_GAP;
+ const left = middle.x - LABEL_SIDE_GAP - label.width;
+ // The right side unless it has no room and the left has.
+ const labelX =
+ right + label.width <= viewport.width || left < 0 ? right : left;
+ return {
+ segments: [[foot, bottom]],
+ label: { x: labelX, y: middle.y - label.height / 2 },
+ };
+}
+
+/** The world radius that keeps the ring at its screen diameter at a view depth. */
+export function stageElevationRingRadius(
+ depth: number,
+ fovDegrees: number,
+ viewportHeight: number,
+): number {
+ if (!(depth > 0) || !(viewportHeight > 0)) return 0;
+ const visibleHeight =
+ 2 * depth * Math.tan(THREE.MathUtils.degToRad(fovDegrees) / 2);
+ return (STAGE_ELEVATION_RING_DIAMETER / 2) * (visibleHeight / viewportHeight);
+}
+
+const ringScratch = new THREE.Vector3();
+/**
+ * The ring where the ground meets the camera: a circle on the ground plane,
+ * projected point by point, so it lies flat on that plane from any angle.
+ * `project` is the same projection the line's endpoints go through. An empty
+ * path means part of the circle is behind the camera.
+ */
+export function stageElevationRingPath(
+ center: THREE.Vector3,
+ radius: number,
+ project: (point: THREE.Vector3) => StageElevationPoint | null,
+): string {
+ let path = "";
+ for (let step = 0; step < RING_SEGMENTS; step += 1) {
+ const angle = (Math.PI * 2 * step) / RING_SEGMENTS;
+ const screen = project(
+ ringScratch.set(
+ center.x + Math.cos(angle) * radius,
+ center.y,
+ center.z + Math.sin(angle) * radius,
+ ),
+ );
+ // A circle the camera stands inside has no honest shape on screen.
+ if (!screen) return "";
+ path += `${step === 0 ? "M" : "L"}${screen.x.toFixed(1)} ${screen.y.toFixed(1)}`;
+ }
+ return path + "Z";
+}
+
+export interface StageElevationScreenPoint extends StageElevationPoint {
+ /** Distance along the camera's view axis. */
+ depth: number;
+}
+
+const viewScratch = new THREE.Vector3();
+/**
+ * Where a world point lands in the viewport for a camera, or null when the
+ * point is behind it: a projection of such a point mirrors across the frame
+ * instead of falling outside it. `toViewport` receives the point in normalised
+ * device coordinates. The camera's world matrix must be current;
+ * `camera.updateMatrixWorld()` makes it so. Neither argument is changed.
+ */
+export function stageElevationScreenPoint(
+ world: THREE.Vector3,
+ camera: THREE.PerspectiveCamera,
+ toViewport: (ndc: StageElevationPoint) => StageElevationPoint,
+): StageElevationScreenPoint | null {
+ // The camera looks down its negative Z, so a point at or behind the near
+ // plane has no place on screen.
+ viewScratch.copy(world).applyMatrix4(camera.matrixWorldInverse);
+ if (!(viewScratch.z < -camera.near)) return null;
+ const depth = -viewScratch.z;
+ viewScratch.applyMatrix4(camera.projectionMatrix);
+ const screen = toViewport({ x: viewScratch.x, y: viewScratch.y });
+ return { x: screen.x, y: screen.y, depth };
+}
diff --git a/src/canvas/stageEnvironment.ts b/src/canvas/stageEnvironment.ts
new file mode 100644
index 000000000..91fc18485
--- /dev/null
+++ b/src/canvas/stageEnvironment.ts
@@ -0,0 +1,108 @@
+import type {
+ LocalStageDocument,
+ StageLight,
+ StageLightId,
+ StageEnvironmentPreset,
+ Vector3Value,
+} from "./stageDocument.ts";
+import type { AssetRef } from "../contracts/generated.ts";
+
+export const STAGE_GROUND_NAME = "stage-ground";
+export const STAGE_GRID_NAME = "stage-grid";
+export const STAGE_LIGHT_NAMES: Readonly> = {
+ hemisphere: "stage-light-hemisphere",
+ key: "stage-light-key",
+ fill: "stage-light-fill",
+};
+
+export interface StageEnvironmentPresetValues {
+ readonly preset: StageEnvironmentPreset;
+ readonly background: string;
+ readonly groundColor: string;
+ readonly groundVisible: boolean;
+ readonly exposure: number;
+ readonly lights: Readonly>>;
+}
+
+/** Stable values materialized by the background-tab selector through the normal edit path. */
+export const STAGE_ENVIRONMENT_PRESETS: readonly StageEnvironmentPresetValues[] = [
+ {
+ preset: "studio", background: "#0d0d0d", groundColor: "#181818", groundVisible: true, exposure: 1,
+ lights: {
+ hemisphere: { color: "#ffffff", intensity: 2.4, position: { x: 0, y: 1, z: 0 }, castShadow: false },
+ key: { color: "#ffffff", intensity: 3.5, position: { x: 5, y: 10, z: 6 }, castShadow: true },
+ fill: { color: "#ffffff", intensity: 1.6, position: { x: -6, y: 5, z: -5 }, castShadow: false },
+ },
+ },
+ {
+ preset: "warm-sunset", background: "#2a1b24", groundColor: "#33231f", groundVisible: true, exposure: 1.15,
+ lights: {
+ hemisphere: { color: "#ffd6b0", intensity: 2.8, position: { x: 0, y: 1, z: 0 }, castShadow: false },
+ key: { color: "#ffb36b", intensity: 4, position: { x: 5, y: 10, z: 6 }, castShadow: true },
+ fill: { color: "#8ab4ff", intensity: 1.2, position: { x: -6, y: 5, z: -5 }, castShadow: false },
+ },
+ },
+ {
+ preset: "moonlit", background: "#0b1426", groundColor: "#111827", groundVisible: true, exposure: 0.8,
+ lights: {
+ hemisphere: { color: "#9fb8ff", intensity: 1.8, position: { x: 0, y: 1, z: 0 }, castShadow: false },
+ key: { color: "#b7d0ff", intensity: 2.4, position: { x: -4, y: 8, z: 4 }, castShadow: true },
+ fill: { color: "#5570b8", intensity: 1, position: { x: 5, y: 4, z: -5 }, castShadow: false },
+ },
+ },
+];
+
+export interface StageEnvironmentLightDescriptor {
+ readonly id: StageLightId;
+ readonly color: string;
+ readonly intensity: number;
+ readonly position: Vector3Value;
+ readonly castShadow: boolean;
+}
+
+export interface StageEnvironmentDescriptor {
+ readonly backgroundColor: string;
+ readonly backgroundAsset: AssetRef | null;
+ readonly exposure: number;
+ readonly ground: {
+ readonly color: string;
+ readonly visible: boolean;
+ };
+ readonly lights: Readonly>;
+}
+
+/** Projects persisted environment facts into the one scene description used by all render adapters. */
+export function projectStageEnvironment(
+ stage: Pick,
+): StageEnvironmentDescriptor {
+ return {
+ backgroundColor: stage.background,
+ backgroundAsset: stage.environment.backgroundAsset,
+ exposure: stage.environment.exposure,
+ ground: {
+ color: stage.environment.groundColor,
+ visible: stage.environment.groundVisible,
+ },
+ lights: {
+ hemisphere: projectLight(findLight(stage.lights, "hemisphere")),
+ key: projectLight(findLight(stage.lights, "key")),
+ fill: projectLight(findLight(stage.lights, "fill")),
+ },
+ };
+}
+
+function findLight(lights: readonly StageLight[], id: StageLightId): StageLight {
+ const light = lights.find((candidate) => candidate.id === id);
+ if (!light) throw new Error(`Missing stage light role: ${id}`);
+ return light;
+}
+
+function projectLight(light: StageLight): StageEnvironmentLightDescriptor {
+ return {
+ id: light.id,
+ color: light.color,
+ intensity: light.intensity,
+ position: { ...light.position },
+ castShadow: light.castShadow,
+ };
+}
diff --git a/src/canvas/stageGroundFade.ts b/src/canvas/stageGroundFade.ts
new file mode 100644
index 000000000..a02bc9637
--- /dev/null
+++ b/src/canvas/stageGroundFade.ts
@@ -0,0 +1,90 @@
+import * as THREE from "three";
+
+export const STAGE_GROUND_FADE_START = 18;
+export const STAGE_GROUND_FADE_END = 72;
+
+const STAGE_GROUND_FADE_SHADER_KEY = "stage-ground-background-fade-v1";
+const TONEMAPPING_CHUNK = "#include ";
+
+interface StageGroundFadeState {
+ readonly background: THREE.Color;
+ readonly enabled: { value: number };
+ readonly range: { value: THREE.Vector2 };
+}
+
+const fadeStates = new WeakMap();
+
+/**
+ * Blends only the distant ground into the solid scene background. The color
+ * mix happens before tone mapping so the ground and background follow the
+ * same output transform and the horizon does not leave a visible seam.
+ */
+export function patchStageGroundFragmentShader(source: string): string {
+ if (!source.includes(TONEMAPPING_CHUNK))
+ throw new Error(
+ "Three.js ground shader no longer exposes the tone-mapping chunk",
+ );
+ return source.replace(
+ TONEMAPPING_CHUNK,
+ `
+ float stageGroundDistance = length( vViewPosition );
+ float stageGroundFade = smoothstep(
+ stageGroundFadeRange.x,
+ stageGroundFadeRange.y,
+ stageGroundDistance
+ ) * stageGroundFadeEnabled;
+ gl_FragColor.rgb = mix(
+ gl_FragColor.rgb,
+ stageGroundFadeBackground,
+ stageGroundFade
+ );
+ ${TONEMAPPING_CHUNK}
+ `,
+ );
+}
+
+function installStageGroundFade(material: THREE.MeshStandardMaterial) {
+ const existing = fadeStates.get(material);
+ if (existing) return existing;
+
+ const state: StageGroundFadeState = {
+ background: new THREE.Color(),
+ enabled: { value: 1 },
+ range: {
+ value: new THREE.Vector2(
+ STAGE_GROUND_FADE_START,
+ STAGE_GROUND_FADE_END,
+ ),
+ },
+ };
+ const previousCompile = material.onBeforeCompile;
+ const previousProgramKey = material.customProgramCacheKey.bind(material);
+ material.onBeforeCompile = (shader, renderer) => {
+ previousCompile(shader, renderer);
+ shader.uniforms.stageGroundFadeBackground = { value: state.background };
+ shader.uniforms.stageGroundFadeEnabled = state.enabled;
+ shader.uniforms.stageGroundFadeRange = state.range;
+ shader.fragmentShader = `
+ uniform vec3 stageGroundFadeBackground;
+ uniform float stageGroundFadeEnabled;
+ uniform vec2 stageGroundFadeRange;
+ ${patchStageGroundFragmentShader(shader.fragmentShader)}
+ `;
+ };
+ material.customProgramCacheKey = () =>
+ `${previousProgramKey()}:${STAGE_GROUND_FADE_SHADER_KEY}`;
+ material.needsUpdate = true;
+ fadeStates.set(material, state);
+ return state;
+}
+
+/** Updates the shared preview/export ground material without recompiling it. */
+export function updateStageGroundFade(
+ material: THREE.MeshStandardMaterial,
+ backgroundColor: string,
+ enabled: boolean,
+) {
+ const state = installStageGroundFade(material);
+ state.background.set(backgroundColor);
+ state.enabled.value = enabled ? 1 : 0;
+}
diff --git a/src/canvas/stageGrounding.ts b/src/canvas/stageGrounding.ts
new file mode 100644
index 000000000..9dfe1aacf
--- /dev/null
+++ b/src/canvas/stageGrounding.ts
@@ -0,0 +1,39 @@
+import * as THREE from "three";
+
+/** Business ground height. The visible ground mesh sits a small amount below
+ * this plane to avoid depth fighting with objects that are exactly grounded. */
+export const STAGE_GROUND_LEVEL = 0;
+
+/**
+ * Return the root Y that puts an object with its current local shape on the
+ * requested ground plane. The object is measured at its current transform so
+ * rotation and scale are included, while the returned value can use a new X/Z
+ * placement without mutating the measured object.
+ */
+export function groundedPositionY(
+ object: THREE.Object3D,
+ desiredPositionY: number,
+ groundY = STAGE_GROUND_LEVEL,
+): number {
+ object.updateMatrixWorld(true);
+ const bounds = new THREE.Box3().setFromObject(object);
+ if (bounds.isEmpty() || !Number.isFinite(bounds.min.y))
+ return desiredPositionY;
+ const localBottom = bounds.min.y - object.position.y;
+ return desiredPositionY + groundY - localBottom;
+}
+
+/** Snap the object in place and return the applied local Y delta. */
+export function groundObject(
+ object: THREE.Object3D,
+ groundY = STAGE_GROUND_LEVEL,
+): number {
+ object.updateMatrixWorld(true);
+ const bounds = new THREE.Box3().setFromObject(object);
+ if (bounds.isEmpty() || !Number.isFinite(bounds.min.y)) return 0;
+ const previousY = object.position.y;
+ const nextY = previousY + groundY - bounds.min.y;
+ object.position.y = nextY;
+ object.updateMatrixWorld(true);
+ return nextY - previousY;
+}
diff --git a/src/canvas/stageInfiniteGrid.ts b/src/canvas/stageInfiniteGrid.ts
new file mode 100644
index 000000000..e3f6f1d3b
--- /dev/null
+++ b/src/canvas/stageInfiniteGrid.ts
@@ -0,0 +1,273 @@
+import * as THREE from "three";
+
+export const STAGE_GRID_MINOR_SPACING = 1;
+export const STAGE_GRID_MAJOR_SPACING = 5;
+export const STAGE_GRID_FADE_START = 24;
+export const STAGE_GRID_FADE_END = 72;
+export const STAGE_GRID_FOCUS_MIN_RADIUS = 8;
+export const STAGE_GRID_FOCUS_MAX_RADIUS = 48;
+export const STAGE_GRID_FOCUS_FEATHER = 20;
+
+const STAGE_GRID_EXTENT = 180;
+const STAGE_GROUND_LEVEL = 0;
+const STAGE_GRID_FOCUS_FALLBACK_DISTANCE = 18;
+const STAGE_GRID_FOCUS_MAX_DISTANCE = 40;
+
+interface StageInfiniteGridState {
+ readonly cameraPosition: { value: THREE.Vector3 };
+ readonly focusCenter: { value: THREE.Vector2 };
+ readonly focusRange: { value: THREE.Vector2 };
+ readonly viewProjection: THREE.Matrix4;
+ readonly frustum: THREE.Frustum;
+ readonly objectBounds: THREE.Box3[];
+ objectBoundsCount: number;
+ objectBoundsReady: boolean;
+ readonly focusBounds: THREE.Box3;
+ readonly viewDirection: THREE.Vector3;
+ readonly viewFocus: THREE.Vector3;
+ readonly focusSize: THREE.Vector3;
+}
+
+export type StageInfiniteGrid = THREE.Mesh<
+ THREE.PlaneGeometry,
+ THREE.ShaderMaterial
+>;
+
+const gridStates = new WeakMap();
+
+const vertexShader = /* glsl */ `
+ varying vec3 stageGridWorldPosition;
+
+ void main() {
+ vec4 worldPosition = modelMatrix * vec4(position, 1.0);
+ stageGridWorldPosition = worldPosition.xyz;
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
+ }
+`;
+
+const fragmentShader = /* glsl */ `
+ uniform vec3 stageGridCameraPosition;
+ uniform vec3 stageGridMinorColor;
+ uniform vec3 stageGridMajorColor;
+ uniform vec3 stageGridAxisColor;
+ uniform vec2 stageGridFocusCenter;
+ uniform vec2 stageGridFocusRange;
+ varying vec3 stageGridWorldPosition;
+
+ float stageGridLine(vec2 worldCoordinate, float spacing, float width) {
+ vec2 coordinate = worldCoordinate / spacing;
+ vec2 derivative = max(fwidth(coordinate), vec2(0.0001));
+ vec2 distanceToLine =
+ abs(fract(coordinate - 0.5) - 0.5) / derivative;
+ float nearestLine = min(distanceToLine.x, distanceToLine.y);
+ return 1.0 - smoothstep(width, width + 1.0, nearestLine);
+ }
+
+ float stageGridAxis(float coordinate) {
+ float derivative = max(fwidth(coordinate), 0.0001);
+ return 1.0 - smoothstep(derivative, derivative * 2.5, abs(coordinate));
+ }
+
+ void main() {
+ vec2 worldCoordinate = stageGridWorldPosition.xz;
+ float minorLine = stageGridLine(
+ worldCoordinate,
+ ${STAGE_GRID_MINOR_SPACING.toFixed(1)},
+ 0.35
+ );
+ float majorLine = stageGridLine(
+ worldCoordinate,
+ ${STAGE_GRID_MAJOR_SPACING.toFixed(1)},
+ 0.65
+ );
+
+ // Suppress sub-pixel minor cells before they shimmer or form moire.
+ vec2 minorDerivative = fwidth(
+ worldCoordinate / ${STAGE_GRID_MINOR_SPACING.toFixed(1)}
+ );
+ float minorVisibility = 1.0 - smoothstep(
+ 0.35,
+ 0.8,
+ max(minorDerivative.x, minorDerivative.y)
+ );
+ minorLine *= minorVisibility;
+
+ float xAxis = stageGridAxis(stageGridWorldPosition.z);
+ float zAxis = stageGridAxis(stageGridWorldPosition.x);
+ float axisLine = max(xAxis, zAxis);
+ float distanceFromCamera = distance(
+ worldCoordinate,
+ stageGridCameraPosition.xz
+ );
+ float distanceFade = 1.0 - smoothstep(
+ ${STAGE_GRID_FADE_START.toFixed(1)},
+ ${STAGE_GRID_FADE_END.toFixed(1)},
+ distanceFromCamera
+ );
+ float distanceFromFocus = distance(
+ worldCoordinate,
+ stageGridFocusCenter
+ );
+ float focusFade = 1.0 - smoothstep(
+ stageGridFocusRange.x,
+ stageGridFocusRange.y,
+ distanceFromFocus
+ );
+ float clarityFade = max(focusFade, distanceFade * 0.28);
+
+ float minorAlpha = minorLine * 0.24;
+ float majorAlpha = majorLine * 0.48;
+ float axisAlpha = axisLine * 0.68;
+ float alpha = max(max(minorAlpha, majorAlpha), axisAlpha) * clarityFade;
+ if (alpha < 0.002) discard;
+
+ vec3 color = mix(stageGridMinorColor, stageGridMajorColor, majorLine);
+ color = mix(color, stageGridAxisColor, axisLine);
+ gl_FragColor = vec4(color, alpha);
+ }
+`;
+
+/**
+ * Creates a viewport-only world-space grid. The plane is moved with each
+ * rendering camera while the shader samples world coordinates, so cells and
+ * axes remain fixed in the scene and the finite carrier plane is never seen.
+ */
+export function createStageInfiniteGrid(): StageInfiniteGrid {
+ const state: StageInfiniteGridState = {
+ cameraPosition: { value: new THREE.Vector3() },
+ focusCenter: { value: new THREE.Vector2() },
+ focusRange: {
+ value: new THREE.Vector2(
+ STAGE_GRID_FOCUS_MIN_RADIUS,
+ STAGE_GRID_FOCUS_MIN_RADIUS + STAGE_GRID_FOCUS_FEATHER,
+ ),
+ },
+ viewProjection: new THREE.Matrix4(),
+ frustum: new THREE.Frustum(),
+ objectBounds: [],
+ objectBoundsCount: 0,
+ objectBoundsReady: false,
+ focusBounds: new THREE.Box3(),
+ viewDirection: new THREE.Vector3(),
+ viewFocus: new THREE.Vector3(),
+ focusSize: new THREE.Vector3(),
+ };
+ const material = new THREE.ShaderMaterial({
+ uniforms: {
+ stageGridCameraPosition: state.cameraPosition,
+ stageGridMinorColor: { value: new THREE.Color(0x3a3a3a) },
+ stageGridMajorColor: { value: new THREE.Color(0x5a5a5a) },
+ stageGridAxisColor: { value: new THREE.Color(0x7a7a7a) },
+ stageGridFocusCenter: state.focusCenter,
+ stageGridFocusRange: state.focusRange,
+ },
+ vertexShader,
+ fragmentShader,
+ transparent: true,
+ depthTest: true,
+ depthWrite: false,
+ side: THREE.DoubleSide,
+ });
+ material.toneMapped = false;
+ const grid: StageInfiniteGrid = new THREE.Mesh(
+ new THREE.PlaneGeometry(STAGE_GRID_EXTENT, STAGE_GRID_EXTENT),
+ material,
+ );
+ grid.rotation.x = -Math.PI / 2;
+ // Draw before other transparent scene content so transparent subjects can
+ // still blend over the helper grid after the opaque depth pass.
+ grid.renderOrder = -10;
+ gridStates.set(grid, state);
+ return grid;
+}
+
+/** Collects animated object bounds once for all camera passes in this frame. */
+export function updateStageInfiniteGridObjects(
+ grid: StageInfiniteGrid,
+ objects: THREE.Object3D,
+) {
+ const state = gridStates.get(grid);
+ if (!state) throw new Error("Unknown Director Stage infinite grid");
+ let count = 0;
+ for (const child of objects.children) {
+ if (!child.visible) continue;
+ const bounds = state.objectBounds[count] ?? new THREE.Box3();
+ bounds.setFromObject(child);
+ if (bounds.isEmpty()) continue;
+ state.objectBounds[count] = bounds;
+ count += 1;
+ }
+ state.objectBoundsCount = count;
+ state.objectBoundsReady = true;
+}
+
+/** Updates live uniforms and recenters the carrier plane without React work. */
+export function updateStageInfiniteGrid(
+ grid: StageInfiniteGrid,
+ camera: THREE.Camera,
+) {
+ const state = gridStates.get(grid);
+ if (!state) throw new Error("Unknown Director Stage infinite grid");
+ camera.getWorldPosition(state.cameraPosition.value);
+ state.focusCenter.value.set(
+ state.cameraPosition.value.x,
+ state.cameraPosition.value.z,
+ );
+ state.focusRange.value.set(
+ STAGE_GRID_FOCUS_MIN_RADIUS,
+ STAGE_GRID_FOCUS_MIN_RADIUS + STAGE_GRID_FOCUS_FEATHER,
+ );
+
+ if (state.objectBoundsReady) {
+ camera.updateWorldMatrix(true, false);
+ state.viewProjection.multiplyMatrices(
+ camera.projectionMatrix,
+ camera.matrixWorldInverse,
+ );
+ state.frustum.setFromProjectionMatrix(state.viewProjection);
+ camera.getWorldDirection(state.viewDirection);
+ const groundDistance =
+ Math.abs(state.viewDirection.y) > 0.0001
+ ? -state.cameraPosition.value.y / state.viewDirection.y
+ : STAGE_GRID_FOCUS_FALLBACK_DISTANCE;
+ const focusDistance = THREE.MathUtils.clamp(
+ Number.isFinite(groundDistance) && groundDistance > 0
+ ? groundDistance
+ : STAGE_GRID_FOCUS_FALLBACK_DISTANCE,
+ 0,
+ STAGE_GRID_FOCUS_MAX_DISTANCE,
+ );
+ state.viewFocus
+ .copy(state.cameraPosition.value)
+ .addScaledVector(state.viewDirection, focusDistance);
+ state.viewFocus.y = STAGE_GROUND_LEVEL;
+ state.focusBounds.makeEmpty();
+ state.focusBounds.expandByPoint(state.viewFocus);
+ for (let index = 0; index < state.objectBoundsCount; index += 1) {
+ const bounds = state.objectBounds[index]!;
+ if (state.frustum.intersectsBox(bounds)) state.focusBounds.union(bounds);
+ }
+ state.focusBounds.getCenter(state.viewFocus);
+ state.focusBounds.getSize(state.focusSize);
+ state.focusCenter.value.set(state.viewFocus.x, state.viewFocus.z);
+ const focusRadius = THREE.MathUtils.clamp(
+ Math.hypot(state.focusSize.x, state.focusSize.z) * 0.5 + 3,
+ STAGE_GRID_FOCUS_MIN_RADIUS,
+ STAGE_GRID_FOCUS_MAX_RADIUS,
+ );
+ state.focusRange.value.set(
+ focusRadius,
+ focusRadius + STAGE_GRID_FOCUS_FEATHER,
+ );
+ }
+
+ const carrierX =
+ (state.cameraPosition.value.x + state.focusCenter.value.x) * 0.5;
+ const carrierZ =
+ (state.cameraPosition.value.z + state.focusCenter.value.y) * 0.5;
+ grid.position.set(
+ Math.round(carrierX / STAGE_GRID_MAJOR_SPACING) * STAGE_GRID_MAJOR_SPACING,
+ 0,
+ Math.round(carrierZ / STAGE_GRID_MAJOR_SPACING) * STAGE_GRID_MAJOR_SPACING,
+ );
+}
diff --git a/src/canvas/stageMotion.ts b/src/canvas/stageMotion.ts
index 1e29e28a7..e175bc7c9 100644
--- a/src/canvas/stageMotion.ts
+++ b/src/canvas/stageMotion.ts
@@ -13,6 +13,28 @@ export interface StageMotion {
speed: number;
amount: number;
}
+/** Name hints that map a procedural motion preset onto imported animation clips. */
+export const STAGE_ANIMATION_HINTS: Record<
+ StageMotion["preset"],
+ readonly string[]
+> = {
+ idle: ["idle", "rest", "stand", "default"],
+ walk: ["walk", "walking"],
+ run: ["run", "running"],
+ wave: ["wave", "waving"],
+};
+/** Clip choice for a preset: first clip whose name contains a hint, else the first clip. */
+export function selectStageAnimation(
+ clips: readonly T[],
+ preset: StageMotion["preset"],
+): T | undefined {
+ const hints = STAGE_ANIMATION_HINTS[preset];
+ return (
+ clips.find((clip) =>
+ hints.some((hint) => clip.name.toLowerCase().includes(hint)),
+ ) ?? clips[0]
+ );
+}
export interface JointPose {
hipsY: number;
leftHip: number;
diff --git a/src/canvas/stageStoryboard.ts b/src/canvas/stageStoryboard.ts
new file mode 100644
index 000000000..1bc44a0ad
--- /dev/null
+++ b/src/canvas/stageStoryboard.ts
@@ -0,0 +1,197 @@
+/**
+ * The continuous Director Stage Storyboard: a read model and one explicit validator.
+ *
+ * The append rule lives in the backend application service. The UI sends
+ * `director.storyboard.append` and merges the block the server acknowledged; nothing here
+ * builds a block to persist. This module only projects what a stage already stores, for
+ * presentation and for prechecks the backend validates again.
+ *
+ * Every time is judged after millisecond normalization with the rule the Python service
+ * uses, so both sides reach the same verdict on the same input. The stored parser
+ * (`parseLocalStageValue`) deliberately stays lenient: a stage saved before the continuity
+ * rule still loads, and only a frontend write boundary calls {@link assertStageStoryboard}.
+ */
+import type { Translate } from "../i18n/I18nProvider.tsx";
+import type { DirectorDurationResult } from "../contracts/generated.ts";
+import { defaultTranslate } from "./assistantTranslate.ts";
+import {
+ parseLocalStageValue,
+ sampleStagePreview,
+ type LocalStageDocument,
+ type StageShot,
+} from "./stageDocument.ts";
+
+import {
+ assertStageStoryboard,
+ normalizeStoryboardTime,
+ stageStoryboardIssue,
+ storyboardBlockEnd,
+ STORYBOARD_TIME_TOLERANCE,
+ type StageStoryboardIssue,
+ type StageStoryboardSource,
+} from "./stageStoryboardRules.ts";
+
+export type StageStoryboardEdit =
+ | { type: "reorder"; blockIds: string[] }
+ | { type: "resize"; blockId: string; duration: number }
+ | { type: "delete"; blockId: string };
+
+export type StageCutEdit = StageStoryboardEdit
+ | { type: "deleteCamera"; cameraId: string }
+ | { type: "setDuration"; duration: number };
+
+export type StageCutReceipt = Pick & {
+ durationChange?: DirectorDurationResult;
+};
+
+/**
+ * The Storyboard laid out in a given order: its blocks in the order their ids are
+ * listed, the first from zero and each later one where the one before it ends. A
+ * block keeps everything it is handed but its start, its camera and its length.
+ *
+ * A drag to another place reads it for the line that says where the block would
+ * start from, the track for the order it shows once the block is let go, and the
+ * parent for where the playhead then goes: all three come from here, so none can
+ * stand for a start the others do not. The server computes the times it stores
+ * its own way when it accepts the command.
+ */
+export function packStageStoryboard(
+ shots: readonly StageShot[],
+ blockIds: readonly string[],
+): StageShot[] {
+ const stored = new Map(shots.map((shot) => [shot.id, shot]));
+ let start = 0;
+ return blockIds.flatMap((blockId) => {
+ const shot = stored.get(blockId);
+ if (!shot) return [];
+ const placed = { ...shot, start };
+ start = normalizeStoryboardTime(start + normalizeStoryboardTime(shot.duration));
+ return [placed];
+ });
+}
+
+export function sameStageStoryboard(
+ left: readonly StageShot[],
+ right: readonly StageShot[],
+): boolean {
+ return left.length === right.length && left.every((shot, index) => {
+ const other = right[index];
+ return shot.id === other.id && shot.cameraId === other.cameraId &&
+ shot.start === other.start && shot.duration === other.duration;
+ });
+}
+
+/** Mirrors the backend default. Only the precheck reads it; the server computes the block. */
+const DEFAULT_BLOCK_SECONDS = 2;
+
+export {
+ normalizeStoryboardTime, stageStoryboardIssue, stageStoryboardIssueMessageKey,
+ assertStageStoryboard, STAGE_STORYBOARD_ISSUES,
+} from "./stageStoryboardRules.ts";
+export type { StageStoryboardIssue } from "./stageStoryboardRules.ts";
+
+export interface StageStoryboardBlock {
+ readonly id: string;
+ readonly cameraId: string;
+ /** Position in the stored Storyboard, starting at zero. */
+ readonly order: number;
+ /** As stored, in seconds. */
+ readonly start: number;
+ /** As stored, in seconds. */
+ readonly duration: number;
+}
+
+export interface StageStoryboardView {
+ /** The stored blocks in stored order, reported as stored. */
+ readonly blocks: readonly StageStoryboardBlock[];
+ /** End of the last block in millisecond-normalized seconds; zero when there is none. */
+ readonly end: number;
+ readonly canAppend: boolean;
+ /** Why no block can be appended; null when one can. */
+ readonly cannotAppendReason: StageStoryboardIssue | null;
+}
+
+/**
+ * Whether positive main-timeline time remains after `start` for another block.
+ *
+ * The remainder is normalized first because the block is stored in milliseconds. When
+ * rounding it up would run past a main duration that itself has sub-millisecond precision,
+ * a millisecond is given back; if nothing positive remains there is no usable time.
+ */
+function hasUsableTime(stage: StageStoryboardSource, start: number): boolean {
+ const remaining = stage.duration - start;
+ const span = normalizeStoryboardTime(remaining);
+ if (remaining <= 0 || span <= 0) return false;
+ const capped = Math.min(DEFAULT_BLOCK_SECONDS, span);
+ if (capped - remaining <= STORYBOARD_TIME_TOLERANCE) return true;
+ return normalizeStoryboardTime(capped - 0.001) > 0;
+}
+
+/**
+ * The Storyboard of a stage for presentation and prechecks. Nothing is sorted, compacted,
+ * repaired or normalized in what it reports: the blocks are the stored blocks.
+ */
+export function readStageStoryboard(
+ stage: StageStoryboardSource,
+): StageStoryboardView {
+ const issue = stageStoryboardIssue(stage);
+ const last = stage.shots.at(-1);
+ const end = last ? storyboardBlockEnd(last) : 0;
+ const cannotAppendReason =
+ issue ?? (hasUsableTime(stage, end) ? null : "storyboard_exhausted");
+ return {
+ blocks: stage.shots.map((shot, order) => ({
+ id: shot.id,
+ cameraId: shot.cameraId,
+ order,
+ start: shot.start,
+ duration: shot.duration,
+ })),
+ end,
+ canAppend: cannotAppendReason === null,
+ cannotAppendReason,
+ };
+}
+
+/**
+ * Put a block the server already stored at the end of the latest draft.
+ *
+ * Nothing about the block is computed here: its identity, camera, start and duration
+ * are the server's, read from its immutable command receipt. The draft is judged
+ * as it is now, because the user may have kept editing while the command was in
+ * flight. When the result would not be a continuous Storyboard, nothing is merged and
+ * the error carries the localized reason.
+ */
+export function mergeStageStoryboardBlock(
+ stage: LocalStageDocument,
+ block: StageShot,
+ t: Translate = defaultTranslate,
+): LocalStageDocument {
+ const shots = [...stage.shots, { ...block }];
+ // The stable reason first: the stored parser would only say the interval is invalid.
+ assertStageStoryboard({ ...stage, shots }, t);
+ return parseLocalStageValue({ ...stage, shots }, t);
+}
+
+
+/** Freeze the scene and camera source for one export at absolute stage time. */
+export function stageExportPlan(
+ stage: LocalStageDocument,
+ source: string,
+ t: Translate = defaultTranslate,
+) {
+ const frozen = parseLocalStageValue(stage, t);
+ const storyboard = source === "storyboard";
+ if (storyboard) {
+ if (!frozen.shots.length)
+ throw new Error(t("editors.stage.error.exportStoryboardEmpty"));
+ assertStageStoryboard(frozen, t);
+ } else if (!frozen.cameras.some((camera) => camera.id === source)) {
+ throw new Error(t("editors.stage.error.cameraMissing"));
+ }
+ return {
+ duration: storyboard ? readStageStoryboard(frozen).end : frozen.duration,
+ sampleAt: (at: number) => sampleStagePreview(frozen,
+ storyboard ? { kind: "storyboard" } : { kind: "camera", cameraId: source }, at, t),
+ };
+}
diff --git a/src/canvas/stageStoryboardRules.ts b/src/canvas/stageStoryboardRules.ts
new file mode 100644
index 000000000..93f7d8248
--- /dev/null
+++ b/src/canvas/stageStoryboardRules.ts
@@ -0,0 +1,140 @@
+import type { ContractIssue } from "../contracts/generated.ts";
+import type { Translate } from "../i18n/I18nProvider.tsx";
+import type { MessageKey } from "../i18n/types.ts";
+import { defaultTranslate } from "./assistantTranslate.ts";
+import type { StageShot } from "./stageDocument.ts";
+
+export const STORYBOARD_TIME_TOLERANCE = 1e-8;
+
+/**
+ * Seconds rounded to milliseconds: half toward positive infinity, which is what
+ * `Math.round` does. The Python service reproduces this exact rule on the same double
+ * `value * 1000`, because its own `round` would send 1000.5 down where this sends it up.
+ */
+export function normalizeStoryboardTime(value: number): number {
+ const scaled = value * 1000;
+ return Number.isFinite(scaled) ? Math.round(scaled) / 1000 : value;
+}
+
+export function storyboardBlockEnd(shot: Pick): number {
+ return normalizeStoryboardTime(
+ normalizeStoryboardTime(shot.start) + normalizeStoryboardTime(shot.duration),
+ );
+}
+
+/**
+ * Stable reasons a Storyboard is not continuous or cannot take another block. They are
+ * business values shared with the backend catalog and are never translated; only the text
+ * {@link stageStoryboardIssueMessageKey} selects changes with the interface language.
+ */
+export const STAGE_STORYBOARD_ISSUES = [
+ "storyboard_leading_gap",
+ "storyboard_internal_gap",
+ "storyboard_overlap",
+ "storyboard_exceeds_duration",
+ "storyboard_duration_invalid",
+ "storyboard_camera_unknown",
+ "storyboard_block_invalid",
+ "storyboard_block_exists",
+ "storyboard_exhausted",
+ "storyboard_order_invalid",
+ "storyboard_block_unknown",
+] as const;
+
+export type StageStoryboardIssue = (typeof STAGE_STORYBOARD_ISSUES)[number];
+
+/**
+ * What the Storyboard rules read. A local stage satisfies it, and so does the Director
+ * Stage document a command carries, so one validator serves both write boundaries.
+ */
+export interface StageStoryboardSource {
+ readonly duration: number;
+ readonly shots: readonly StageShot[];
+ readonly cameras: readonly { readonly id: string }[];
+}
+
+/**
+ * The generated contract is the source of truth. A backend code without an entry here, or
+ * an entry the backend does not know, makes this type `never`.
+ */
+type BackendStoryboardIssue = Extract;
+export type StoryboardIssuesMatchTheBackend = [
+ Exclude,
+ Exclude,
+] extends [never, never]
+ ? true
+ : never;
+
+/**
+ * Keeps the promise above: the build fails on this line when the two lists disagree.
+ * `never` accepts no value, so one code that either side has alone is a compile error.
+ */
+export const STORYBOARD_ISSUES_MATCH_BACKEND: StoryboardIssuesMatchTheBackend = true;
+
+/**
+ * The first continuity violation of a stage's Storyboard, or null when it is continuous.
+ *
+ * Blocks are read in stored order and never changed: the first starts at zero, each later
+ * one starts where the previous one ends, every duration is positive, every camera exists
+ * and every identity is used once. Times are judged after normalization, so float noise is
+ * neither a gap nor an overlap and a duration that rounds to nothing is not positive.
+ */
+export function stageStoryboardIssue(
+ stage: StageStoryboardSource,
+): StageStoryboardIssue | null {
+ const cameras = new Set(stage.cameras.map((camera) => camera.id));
+ const identities = new Set();
+ let previousEnd = 0;
+ for (const [index, shot] of stage.shots.entries()) {
+ if (identities.has(shot.id)) return "storyboard_block_exists";
+ identities.add(shot.id);
+ if (!cameras.has(shot.cameraId)) return "storyboard_camera_unknown";
+ const start = normalizeStoryboardTime(shot.start);
+ const duration = normalizeStoryboardTime(shot.duration);
+ if (duration <= 0) return "storyboard_duration_invalid";
+ if (index === 0 && start !== 0) return "storyboard_leading_gap";
+ if (start > previousEnd) return "storyboard_internal_gap";
+ if (start < previousEnd) return "storyboard_overlap";
+ const end = storyboardBlockEnd(shot);
+ if (end - stage.duration > STORYBOARD_TIME_TOLERANCE) {
+ return "storyboard_exceeds_duration";
+ }
+ previousEnd = end;
+ }
+ return null;
+}
+
+const ISSUE_MESSAGE_KEYS = {
+ storyboard_leading_gap: "editors.stage.storyboard.reason.leadingGap",
+ storyboard_internal_gap: "editors.stage.storyboard.reason.internalGap",
+ storyboard_overlap: "editors.stage.storyboard.reason.overlap",
+ storyboard_exceeds_duration: "editors.stage.storyboard.reason.exceedsDuration",
+ storyboard_duration_invalid: "editors.stage.storyboard.reason.durationInvalid",
+ storyboard_camera_unknown: "editors.stage.storyboard.reason.cameraUnknown",
+ storyboard_block_invalid: "editors.stage.storyboard.reason.blockInvalid",
+ storyboard_block_exists: "editors.stage.storyboard.reason.blockExists",
+ storyboard_order_invalid: "editors.stage.storyboard.reason.orderInvalid",
+ storyboard_block_unknown: "editors.stage.storyboard.reason.blockUnknown",
+ storyboard_exhausted: "editors.stage.storyboard.reason.exhausted",
+} as const satisfies Record;
+
+/** The catalog entry that explains one stable reason. */
+export function stageStoryboardIssueMessageKey(
+ issue: StageStoryboardIssue,
+): MessageKey {
+ return ISSUE_MESSAGE_KEYS[issue];
+}
+
+/**
+ * Reject a discontinuous Storyboard at a frontend write boundary, with the localized
+ * reason. The backend validates the same rule again when the document is saved.
+ */
+export function assertStageStoryboard(
+ stage: StageStoryboardSource,
+ t: Translate = defaultTranslate,
+): void {
+ const issue = stageStoryboardIssue(stage);
+ if (issue !== null) {
+ throw new Error(t(stageStoryboardIssueMessageKey(issue)));
+ }
+}
diff --git a/src/canvas/stageStoryboardThumbnail.ts b/src/canvas/stageStoryboardThumbnail.ts
new file mode 100644
index 000000000..7b84bf043
--- /dev/null
+++ b/src/canvas/stageStoryboardThumbnail.ts
@@ -0,0 +1,116 @@
+import {
+ normalizeStoryboardTime,
+ type LocalStageDocument,
+ type StageObject,
+ type StageShot,
+} from "./stageDocument.ts";
+
+/**
+ * A subject as the cameras see it. Its name, its lock, the card thumbnail the
+ * editor shows for it and the browser URL its model is served from are editor
+ * business: the model is pinned by its asset, and the picture follows that.
+ */
+const picturedSubject = ({
+ name: _name,
+ locked: _locked,
+ thumbnailCapture: _capture,
+ thumbnailSource: _thumbnailSource,
+ thumbnailAsset: _thumbnailAsset,
+ source: _source,
+ ...pictured
+}: StageObject) => pictured;
+
+/**
+ * What one Storyboard block's thumbnail pictures, as a comparable value.
+ *
+ * `sceneRevision` counts what the live scene gained that the document alone does not
+ * announce, such as a model that finished loading or a background that arrived. A
+ * picture made before such a change would otherwise stand until the document changed.
+ * It is view state and never a field of the stage.
+ */
+export function prepareStageStoryboardThumbnailKeys(
+ stage: LocalStageDocument,
+ sceneRevision: number,
+): (block: StageShot) => string {
+ const scene = JSON.stringify({
+ aspectRatio: stage.aspectRatio,
+ background: stage.background,
+ environment: stage.environment,
+ lights: stage.lights,
+ objects: stage.objects.map(picturedSubject),
+ sceneRevision,
+ });
+ const cameras = new Map(stage.cameras.map(({ name: _name, ...camera }) => [
+ camera.id,
+ JSON.stringify(camera),
+ ]));
+ return (block) => {
+ const interval = JSON.stringify([block.id, block.cameraId, normalizeStoryboardTime(block.start)]);
+ // JSON escapes newlines in values, so the three segments remain unambiguous.
+ return `${interval}\n${cameras.get(block.cameraId) ?? "null"}\n${scene}`;
+ };
+}
+
+/** Whether a block's thumbnail is a picture, nothing yet, or nothing possible. */
+export type StageStoryboardThumbnailState = "pending" | "ready" | "failed";
+
+/** How tall a thumbnail's picture is, in pixels. It is shown at a third of this or
+ * smaller, so it stays sharp on a high-density screen and still costs little to make. */
+const THUMBNAIL_HEIGHT = 72;
+
+/** A thumbnail's picture in the stage's output frame: the output aspect ratio, small. */
+export function stageStoryboardThumbnailSize(
+ aspectRatio: LocalStageDocument["aspectRatio"],
+): { width: number; height: number } {
+ const [wide, tall] = aspectRatio.split(":").map(Number) as [number, number];
+ return {
+ width: Math.round((THUMBNAIL_HEIGHT * wide) / tall),
+ height: THUMBNAIL_HEIGHT,
+ };
+}
+
+/** The thumbnails of one open editor. It lives beside the document, never in it. */
+export class StageStoryboardThumbnailCache {
+ private wanted = new Map();
+ private entries = new Map();
+
+ /** The key a block's thumbnail must show now. */
+ want(blockId: string, key: string): void {
+ this.wanted.set(blockId, key);
+ }
+
+ /** Forget every block that is not named, and with it what was made for it. */
+ retain(blockIds: readonly string[]): void {
+ for (const blockId of [...this.wanted.keys()])
+ if (!blockIds.includes(blockId)) {
+ this.wanted.delete(blockId);
+ this.entries.delete(blockId);
+ }
+ }
+
+ /** Keep what was made for one key. A result whose key the block has already
+ * left is dropped, so a late picture never stands in for a newer one. */
+ store(blockId: string, key: string, image: string | null): boolean {
+ if (this.wanted.get(blockId) !== key) return false;
+ this.entries.set(blockId, { key, image });
+ return true;
+ }
+
+ state(blockId: string): StageStoryboardThumbnailState {
+ const entry = this.entries.get(blockId);
+ if (!entry || entry.key !== this.wanted.get(blockId)) return "pending";
+ return entry.image === null ? "failed" : "ready";
+ }
+
+ image(blockId: string): string | null {
+ const entry = this.entries.get(blockId);
+ return entry && entry.key === this.wanted.get(blockId) ? entry.image : null;
+ }
+
+ /** The blocks still waiting for the key they show. */
+ pending(): { blockId: string; key: string }[] {
+ return [...this.wanted]
+ .filter(([blockId, key]) => this.entries.get(blockId)?.key !== key)
+ .map(([blockId, key]) => ({ blockId, key }));
+ }
+}
diff --git a/src/canvas/stageStoryboardThumbnailRender.ts b/src/canvas/stageStoryboardThumbnailRender.ts
new file mode 100644
index 000000000..1ea980ca6
--- /dev/null
+++ b/src/canvas/stageStoryboardThumbnailRender.ts
@@ -0,0 +1,103 @@
+import * as THREE from "three";
+import type { StageCamera, StageSample, Vector3Value } from "./stageDocument.ts";
+
+/** The live viewport a thumbnail is pictured from. The pass borrows its canvas for
+ * one frame and leaves everything as it found it. */
+export interface StageStoryboardThumbnailViewport {
+ renderer: THREE.WebGLRenderer;
+ scene: THREE.Scene;
+ /** Hide what only the viewport shows, and return how to put it back. */
+ hideViewport: () => () => void;
+ /** Pose the scene's objects as a sample has them at its time. */
+ pose: (sample: StageSample) => void;
+ /** Put the scene back as the viewport shows it now, and draw that frame. */
+ show: () => void;
+}
+
+/** As far as the viewport's cameras see. */
+const NEAR = 0.05;
+const FAR = 1000;
+
+/** Pose a camera as a sample has it, the way the viewport's preview cameras are
+ * posed: the authored up vector first, then the look at its target, the roll on top. */
+export function poseStagePreviewCamera(
+ camera: THREE.PerspectiveCamera,
+ pose: StageCamera,
+ up: Vector3Value,
+ aspect: number,
+ fov = pose.fov,
+) {
+ camera.aspect = aspect;
+ camera.fov = fov;
+ camera.position.set(pose.position.x, pose.position.y, pose.position.z);
+ camera.up.set(up.x, up.y, up.z);
+ camera.lookAt(pose.target.x, pose.target.y, pose.target.z);
+ camera.rotateZ(pose.roll ?? 0);
+ camera.updateProjectionMatrix();
+ camera.updateMatrixWorld(true);
+}
+
+/** Copy a WebGL viewport rectangle in device pixels into a 2D canvas. */
+export function copyStageViewportPixels(
+ source: HTMLCanvasElement,
+ context: CanvasRenderingContext2D,
+ rect: { x: number; y: number; width: number; height: number },
+) {
+ const { x, y, width, height } = rect;
+ context.drawImage(source, x, source.height - y - height, width, height, 0, 0, width, height);
+}
+
+/**
+ * Picture one frame of the live scene, through a camera of its own.
+ *
+ * The frame is drawn into a corner of the canvas the viewport owns, at exactly the
+ * size it is read back at, and copied out from there. Drawing to that canvas is what
+ * the viewport itself does, so the picture has the viewport's tone mapping and
+ * colour; a render target would give it neither. The canvas is not resized, and
+ * nothing of this frame stays on it: whatever happens, the viewport's own frame is
+ * drawn again before this returns, in the same task, so no other frame is ever seen.
+ */
+export function captureStageStoryboardThumbnail(
+ viewport: StageStoryboardThumbnailViewport,
+ sample: StageSample,
+ up: Vector3Value,
+ size: { width: number; height: number },
+): string {
+ const { renderer, scene } = viewport;
+ const camera = new THREE.PerspectiveCamera(
+ sample.camera.fov,
+ size.width / size.height,
+ NEAR,
+ FAR,
+ );
+ poseStagePreviewCamera(camera, sample.camera, up, size.width / size.height);
+ const previous = {
+ viewport: renderer.getViewport(new THREE.Vector4()),
+ scissor: renderer.getScissor(new THREE.Vector4()),
+ scissorTest: renderer.getScissorTest(),
+ };
+ const restoreViewport = viewport.hideViewport();
+ try {
+ viewport.pose(sample);
+ // The corner in the canvas's own units. The drawing buffer is that times the
+ // pixel ratio, so the picture comes out at `size` device pixels exactly.
+ const ratio = renderer.getPixelRatio();
+ renderer.setScissorTest(true);
+ renderer.setViewport(0, 0, size.width / ratio, size.height / ratio);
+ renderer.setScissor(0, 0, size.width / ratio, size.height / ratio);
+ renderer.render(scene, camera);
+ const picture = document.createElement("canvas");
+ picture.width = size.width;
+ picture.height = size.height;
+ const context = picture.getContext("2d");
+ if (!context) throw new Error("Stage thumbnail canvas is unavailable");
+ copyStageViewportPixels(renderer.domElement, context, { x: 0, y: 0, ...size });
+ return picture.toDataURL("image/png");
+ } finally {
+ renderer.setViewport(previous.viewport);
+ renderer.setScissor(previous.scissor);
+ renderer.setScissorTest(previous.scissorTest);
+ restoreViewport();
+ viewport.show();
+ }
+}
diff --git a/src/canvas/stageTimeline.ts b/src/canvas/stageTimeline.ts
new file mode 100644
index 000000000..75abecfcb
--- /dev/null
+++ b/src/canvas/stageTimeline.ts
@@ -0,0 +1,724 @@
+import {
+ editStageCameraAt,
+ editStageObjectAt,
+ parseLocalStageValue,
+ sampleStage,
+ sampleStageCamera,
+ type LocalStageDocument,
+ type StageBezierTransition,
+ type StageCameraChannels,
+ type StageMotionClip,
+ type StageTransform,
+ type StageTransition,
+ type Vector3Value,
+} from "./stageDocument.ts";
+import type { StageMotion } from "./stageMotion.ts";
+
+export type StageTimelineTrackKind =
+ | "shots"
+ | "camera-channel"
+ | "object-channel";
+export type StageTimelineChannel =
+ | keyof StageCameraChannels
+ | "position"
+ | "rotation"
+ | "scale"
+ | "motion";
+export type StageTimelinePointKind = "boundary" | "keyframe";
+
+/** Structural label data; the Director Stage UI resolves it through i18n. */
+export type StageTimelineTrackLabel =
+ | { readonly kind: "shots" }
+ | {
+ readonly kind: "source";
+ readonly name: string;
+ readonly channel: StageTimelineChannel;
+ };
+
+export interface StageTimelinePoint {
+ readonly id: string;
+ readonly time: number;
+ readonly kind: StageTimelinePointKind;
+ readonly value?: unknown;
+}
+
+export interface StageTimelineTrack {
+ readonly id: string;
+ readonly kind: StageTimelineTrackKind;
+ readonly label: StageTimelineTrackLabel;
+ readonly sourceId?: string;
+ readonly channel?: StageTimelineChannel;
+ readonly points: readonly StageTimelinePoint[];
+ readonly intervals?: readonly StageTimelineStoryboardInterval[];
+}
+
+export interface StageTimelineInterval {
+ readonly id: string;
+ readonly start: StageTimelinePoint;
+ readonly end: StageTimelinePoint;
+ readonly cameraId?: string;
+ readonly duration?: number;
+}
+
+export interface StageTimelineStoryboardInterval extends StageTimelineInterval {
+ /** The interval id is the persisted Storyboard block id. */
+ readonly cameraId: string;
+ readonly duration: number;
+}
+
+export interface StageTimelineProjection {
+ readonly duration: number;
+ readonly fps: LocalStageDocument["fps"];
+ readonly tracks: readonly StageTimelineTrack[];
+}
+
+export type StageTimelineRulerTickKind = "major" | "minor";
+
+export interface StageTimelineRulerTick {
+ readonly time: number;
+ readonly kind: StageTimelineRulerTickKind;
+}
+
+export interface StageTimelineRuler {
+ readonly majorStep: number;
+ readonly minorStep: number;
+ readonly ticks: readonly StageTimelineRulerTick[];
+}
+
+export type StageTimelineTrackGroup =
+ | {
+ readonly id: "shots";
+ readonly kind: "shots";
+ readonly label: { readonly kind: "shots" };
+ readonly tracks: readonly StageTimelineTrack[];
+ }
+ | {
+ readonly id: string;
+ readonly kind: "camera" | "object";
+ readonly label: {
+ readonly kind: "source";
+ readonly sourceId: string;
+ readonly name: string;
+ };
+ readonly sourceId: string;
+ readonly tracks: readonly StageTimelineTrack[];
+ };
+
+export interface StageTimelineSnapOptions {
+ readonly tolerance?: number;
+ readonly includeFrames?: boolean;
+ readonly includeKeyframes?: boolean;
+ readonly includeShotBoundaries?: boolean;
+}
+
+export type StageTimelineKeyframeTarget =
+ | {
+ readonly kind: "camera";
+ readonly sourceId: string;
+ readonly channel: keyof StageCameraChannels;
+ readonly pointId: string;
+ }
+ | {
+ readonly kind: "object";
+ readonly sourceId: string;
+ readonly channel: "position" | "rotation" | "scale";
+ readonly pointId: string;
+ };
+
+export type StageTimelineIntervalTarget =
+ | {
+ readonly kind: "camera";
+ readonly sourceId: string;
+ readonly channel: keyof StageCameraChannels;
+ readonly startPointId: string;
+ readonly endPointId: string;
+ }
+ | {
+ readonly kind: "object";
+ readonly sourceId: string;
+ readonly channel: "position" | "rotation" | "scale";
+ readonly startPointId: string;
+ readonly endPointId: string;
+ };
+
+const clone = (value: T): T => structuredClone(value);
+const sameVector = (left: Vector3Value, right: Vector3Value) =>
+ left.x === right.x && left.y === right.y && left.z === right.z;
+const clampTime = (stage: LocalStageDocument, time: number) =>
+ Math.max(0, Math.min(stage.duration, Number.isFinite(time) ? time : 0));
+
+const point = (
+ id: string,
+ time: number,
+ kind: StageTimelinePointKind,
+ value?: unknown,
+): StageTimelinePoint => ({
+ id,
+ time,
+ kind,
+ ...(value === undefined ? {} : { value: clone(value) }),
+});
+
+function ordered(points: StageTimelinePoint[]): readonly StageTimelinePoint[] {
+ return points.sort((a, b) => a.time - b.time || a.id.localeCompare(b.id));
+}
+
+function cameraChannels(camera: LocalStageDocument["cameras"][number]): StageCameraChannels {
+ if (camera.channels) return camera.channels;
+ return {
+ position: camera.keyframes.map((frame) => ({ id: frame.id, time: frame.time, value: clone(frame.value.position) })),
+ target: camera.keyframes.map((frame) => ({ id: frame.id, time: frame.time, value: clone(frame.value.target) })),
+ up: [],
+ focalLength: camera.keyframes.map((frame) => ({ id: frame.id, time: frame.time, value: frame.value.fov })),
+ };
+}
+
+export type StageTimelineKeyframeAddTarget =
+ | {
+ readonly kind: "camera";
+ readonly sourceId: string;
+ readonly channel: keyof StageCameraChannels;
+ }
+ | {
+ readonly kind: "object";
+ readonly sourceId: string;
+ readonly channel: "position" | "rotation" | "scale";
+ };
+
+function framePoints(
+ frames: readonly { id: string; time: number; value: unknown }[],
+): StageTimelinePoint[] {
+ return frames.map((frame) => point(frame.id, frame.time, "keyframe", frame.value));
+}
+
+function cameraTracks(stage: LocalStageDocument): StageTimelineTrack[] {
+ return stage.cameras.flatMap((camera) => {
+ const channels = cameraChannels(camera);
+ return (Object.keys(channels) as (keyof StageCameraChannels)[]).map((channel) => ({
+ id: `camera:${camera.id}:${channel}`,
+ kind: "camera-channel" as const,
+ label: { kind: "source" as const, name: camera.name, channel },
+ sourceId: camera.id,
+ channel,
+ points: ordered(framePoints(channels[channel] as readonly { id: string; time: number; value: unknown }[])),
+ }));
+ });
+}
+
+function objectTracks(stage: LocalStageDocument): StageTimelineTrack[] {
+ return stage.objects.flatMap((object) => {
+ const transformChannels = (["position", "rotation", "scale"] as const).map((channel) => {
+ const explicitChannels = object.keyframes.some((frame) => frame.keyedChannels);
+ const frames = object.keyframes
+ .filter((frame) => explicitChannels ? frame.keyedChannels?.includes(channel) : true)
+ .map((frame) => ({ id: frame.id, time: frame.time, value: frame.value[channel] }));
+ return {
+ id: `object:${object.id}:${channel}`,
+ kind: "object-channel" as const,
+ label: { kind: "source" as const, name: object.name, channel },
+ sourceId: object.id,
+ channel,
+ points: ordered(framePoints(
+ explicitChannels || frames.some((frame) => !sameVector(frame.value, object[channel]))
+ ? frames
+ : [],
+ )),
+ };
+ });
+ const motionPoints = object.motionClips.flatMap((clip) => [
+ point(`${clip.id}:start`, clip.start, "boundary", clip.motion),
+ point(`${clip.id}:end`, clip.start + clip.duration, "boundary"),
+ ]);
+ return [...transformChannels, {
+ id: `object:${object.id}:motion`,
+ kind: "object-channel" as const,
+ label: { kind: "source" as const, name: object.name, channel: "motion" as const },
+ sourceId: object.id,
+ channel: "motion" as const,
+ points: ordered(motionPoints),
+ }];
+ });
+}
+
+export function groupStageTimelineTracks(
+ projection: StageTimelineProjection,
+): readonly StageTimelineTrackGroup[] {
+ const groups: StageTimelineTrackGroup[] = [];
+ const sourceTracks = new Map();
+ const sourceMeta = new Map<
+ string,
+ { kind: "camera" | "object"; sourceId: string; name: string }
+ >();
+
+ for (const track of projection.tracks) {
+ if (track.kind === "shots") {
+ if (!groups.some((group) => group.kind === "shots")) {
+ groups.push({
+ id: "shots",
+ kind: "shots",
+ label: { kind: "shots" },
+ tracks: [track],
+ });
+ }
+ continue;
+ }
+ if (!track.sourceId || track.label.kind === "shots") continue;
+ const sourceId = track.sourceId;
+ const key = `${track.kind}:${sourceId}`;
+ const tracks = sourceTracks.get(key) ?? [];
+ tracks.push(track);
+ sourceTracks.set(key, tracks);
+ sourceMeta.set(key, {
+ kind: track.kind === "camera-channel" ? "camera" : "object",
+ sourceId,
+ name: track.label.name,
+ });
+ }
+
+ for (const [key, tracks] of sourceTracks) {
+ const meta = sourceMeta.get(key);
+ if (!meta) continue;
+ groups.push({
+ id: `${meta.kind}:${meta.sourceId}`,
+ kind: meta.kind,
+ label: {
+ kind: "source",
+ sourceId: meta.sourceId,
+ name: meta.name,
+ },
+ sourceId: meta.sourceId,
+ tracks,
+ });
+ }
+ return groups;
+}
+
+/**
+ * Projects the directly interpolated spans in a track. Keyframe tracks use
+ * adjacent keyframes, motion tracks use boundary pairs, and Storyboard tracks
+ * expose the identity-bearing intervals projected from their persisted blocks.
+ */
+export function stageTimelineIntervals(
+ track: StageTimelineTrack,
+): readonly StageTimelineInterval[] {
+ if (track.kind === "shots") return track.intervals ?? [];
+ const keyframes = track.points.filter((point) => point.kind === "keyframe");
+ if (keyframes.length >= 2) {
+ return keyframes.flatMap((start, index) => {
+ const end = keyframes[index + 1];
+ return end
+ ? [{
+ id: `${track.id}:interval:${start.id}:${end.id}`,
+ start,
+ end,
+ }]
+ : [];
+ });
+ }
+ const boundaries = track.points.filter((point) => point.kind === "boundary");
+ return boundaries.flatMap((start, index) => {
+ if (index % 2 !== 0) return [];
+ const end = boundaries[index + 1];
+ return end
+ ? [{
+ id: `${track.id}:interval:${start.id}:${end.id}`,
+ start,
+ end,
+ }]
+ : [];
+ });
+}
+
+const RULER_MAJOR_STEPS = [0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 30, 60] as const;
+
+export function stageTimelineRuler(duration: number): StageTimelineRuler {
+ const boundedDuration = Math.max(
+ 0,
+ Number.isFinite(duration) ? duration : 0,
+ );
+ const targetMajorStep = boundedDuration / 24;
+ const majorStep =
+ RULER_MAJOR_STEPS.find((step) => step >= targetMajorStep) ??
+ RULER_MAJOR_STEPS.at(-1)!;
+ const minorStep = majorStep / 5;
+ const tickCount = Math.ceil(boundedDuration / minorStep);
+ const ticks: StageTimelineRulerTick[] = [];
+
+ for (let index = 0; index <= tickCount; index += 1) {
+ const time = Number(
+ Math.min(index * minorStep, boundedDuration).toFixed(6),
+ );
+ if (ticks.at(-1)?.time === time) continue;
+ const isMajor =
+ Math.abs(time / majorStep - Math.round(time / majorStep)) < 0.000001;
+ ticks.push({
+ time,
+ kind: isMajor || time === boundedDuration ? "major" : "minor",
+ });
+ }
+
+ return { majorStep, minorStep, ticks };
+}
+
+export function projectStageTimeline(stage: LocalStageDocument): StageTimelineProjection {
+ const shotIntervals = [...stage.shots]
+ .sort((left, right) => left.start - right.start || left.id.localeCompare(right.id))
+ .map((shot) => ({
+ id: shot.id,
+ cameraId: shot.cameraId,
+ duration: shot.duration,
+ start: point(`${shot.id}:start`, shot.start, "boundary", shot.id),
+ end: point(
+ `${shot.id}:end`,
+ shot.start + shot.duration,
+ "boundary",
+ shot.id,
+ ),
+ }));
+ const shotPoints = shotIntervals.flatMap((interval) => [
+ interval.start,
+ interval.end,
+ ]);
+ return {
+ duration: stage.duration,
+ fps: stage.fps,
+ tracks: [
+ {
+ id: "shots",
+ kind: "shots",
+ label: { kind: "shots" },
+ points: ordered(shotPoints),
+ intervals: shotIntervals,
+ },
+ ...cameraTracks(stage),
+ ...objectTracks(stage),
+ ],
+ };
+}
+
+export function stageFrameToTime(stage: LocalStageDocument, frame: number): number {
+ const lastFrame = Math.max(0, Math.round(stage.duration * stage.fps));
+ const requested = Number.isFinite(frame) ? Math.round(frame) : 0;
+ const bounded = Math.max(0, Math.min(lastFrame, requested));
+ return Math.min(stage.duration, bounded / stage.fps);
+}
+
+export function stageTimeToFrame(stage: LocalStageDocument, time: number): number {
+ return Math.round(clampTime(stage, time) * stage.fps);
+}
+
+export function snapStageTimelineTime(
+ stage: LocalStageDocument,
+ time: number,
+ options: StageTimelineSnapOptions = {},
+): number {
+ const at = clampTime(stage, time);
+ const candidates: number[] = [];
+ if (options.includeFrames !== false) candidates.push(stageFrameToTime(stage, stageTimeToFrame(stage, at)));
+ if (options.includeKeyframes !== false || options.includeShotBoundaries !== false) {
+ if (options.includeShotBoundaries !== false) {
+ candidates.push(...stage.shots.flatMap((shot) => [shot.start, shot.start + shot.duration]));
+ }
+ if (options.includeKeyframes !== false) {
+ for (const camera of stage.cameras) {
+ const channels = cameraChannels(camera);
+ const channelFrames = [
+ channels.position,
+ channels.target,
+ channels.up,
+ channels.focalLength,
+ ];
+ candidates.push(...channelFrames.flatMap((frames) => frames.map((frame) => frame.time)));
+ }
+ for (const object of stage.objects) {
+ candidates.push(...object.keyframes.map((frame) => frame.time));
+ candidates.push(...object.motionClips.flatMap((clip) => [clip.start, clip.start + clip.duration]));
+ }
+ }
+ }
+ const tolerance = options.tolerance ?? 0.5 / stage.fps;
+ const nearest = candidates
+ .map((candidate) => ({ candidate, distance: Math.abs(candidate - at) }))
+ .filter((item) => item.distance <= tolerance)
+ .sort((a, b) => a.distance - b.distance || a.candidate - b.candidate)[0];
+ return nearest?.candidate ?? at;
+}
+
+function putFrame(
+ frames: readonly T[],
+ time: number,
+ value: T["value"],
+): T[] {
+ const existing = frames.find((frame) => frame.time === time);
+ return [...frames.filter((frame) => frame.time !== time), {
+ ...existing,
+ id: existing?.id ?? crypto.randomUUID(),
+ time,
+ value: clone(value),
+ } as T].sort((a, b) => a.time - b.time);
+}
+
+const linearTransition = (): StageTransition => ({ kind: "linear" });
+
+function intervalTrack(stage: LocalStageDocument, target: StageTimelineIntervalTarget): StageTimelineTrack | undefined {
+ const trackId = `${target.kind}:${target.sourceId}:${target.channel}`;
+ const track = projectStageTimeline(stage).tracks.find((item) => item.id === trackId);
+ const interval = track && stageTimelineIntervals(track).find(
+ (item) => item.start.id === target.startPointId && item.end.id === target.endPointId,
+ );
+ return interval ? track : undefined;
+}
+
+export function stageTimelineIntervalTransition(
+ stage: LocalStageDocument,
+ target: StageTimelineIntervalTarget,
+): StageTransition {
+ if (!intervalTrack(stage, target)) return linearTransition();
+ if (target.kind === "camera") {
+ const camera = stage.cameras.find((item) => item.id === target.sourceId);
+ const frame = camera && cameraChannels(camera)[target.channel].find(
+ (item) => item.id === target.startPointId,
+ );
+ return frame?.transition ? clone(frame.transition) : linearTransition();
+ }
+ const object = stage.objects.find((item) => item.id === target.sourceId);
+ const frame = object?.keyframes.find((item) => item.id === target.startPointId);
+ const transition = frame?.transitions?.[target.channel];
+ return transition ? clone(transition) : linearTransition();
+}
+
+export function setStageTimelineIntervalTransition(
+ stage: LocalStageDocument,
+ target: StageTimelineIntervalTarget,
+ value: StageTransition,
+): LocalStageDocument {
+ if (!intervalTrack(stage, target)) return stage;
+ const transition: StageBezierTransition | undefined = value.kind === "bezier" ? clone(value) : undefined;
+ if (target.kind === "camera") {
+ return parseLocalStageValue({
+ ...stage,
+ cameras: stage.cameras.map((camera) => {
+ if (camera.id !== target.sourceId) return camera;
+ const channels = cameraChannels(camera);
+ return {
+ ...camera,
+ channels: {
+ ...channels,
+ [target.channel]: channels[target.channel].map((frame) =>
+ frame.id === target.startPointId ? { ...frame, transition } : frame,
+ ),
+ },
+ };
+ }),
+ });
+ }
+ return parseLocalStageValue({
+ ...stage,
+ objects: stage.objects.map((object) => {
+ if (object.id !== target.sourceId) return object;
+ return {
+ ...object,
+ keyframes: object.keyframes.map((frame) => {
+ if (frame.id !== target.startPointId) return frame;
+ const transitions = { ...frame.transitions, [target.channel]: transition };
+ if (!transition) delete transitions[target.channel];
+ return { ...frame, transitions: Object.keys(transitions).length ? transitions : undefined };
+ }),
+ };
+ }),
+ });
+}
+
+function authorChannel(
+ frames: readonly T[],
+ time: number,
+ value: T["value"],
+ base: T["value"],
+): T[] {
+ return putFrame(frames.length || time === 0 ? frames : putFrame([], 0, base), time, value);
+}
+
+export function editStageCameraChannelAt(
+ stage: LocalStageDocument,
+ cameraId: string,
+ channel: keyof StageCameraChannels,
+ time: number,
+ value: Vector3Value | number,
+): LocalStageDocument {
+ const at = clampTime(stage, time);
+ if (channel !== "up") {
+ return editStageCameraAt(stage, cameraId, at, {
+ ...(channel === "position" ? { position: value as Vector3Value } : {}),
+ ...(channel === "target" ? { target: value as Vector3Value } : {}),
+ ...(channel === "focalLength" ? { fov: value as number } : {}),
+ });
+ }
+ const camera = stage.cameras.find((item) => item.id === cameraId);
+ if (!camera) return stage;
+ const channels = cameraChannels(camera);
+ const nextChannels = {
+ ...channels,
+ up: authorChannel(channels.up, at, value as Vector3Value, { x: 0, y: 1, z: 0 }),
+ };
+ return parseLocalStageValue({
+ ...stage,
+ cameras: stage.cameras.map((item) => item.id === cameraId ? { ...item, channels: nextChannels } : item),
+ });
+}
+
+/** Add one explicit channel keyframe without changing sibling channels. */
+export function addStageTimelineKeyframeAt(
+ stage: LocalStageDocument,
+ target: StageTimelineKeyframeAddTarget,
+ time: number,
+): LocalStageDocument {
+ const at = clampTime(stage, time);
+ if (target.kind === "camera") {
+ const camera = stage.cameras.find((item) => item.id === target.sourceId);
+ if (!camera) return stage;
+ const channels = cameraChannels(camera);
+ const sampled = sampleStageCamera(stage, target.sourceId, at);
+ const nextChannels =
+ target.channel === "position"
+ ? { ...channels, position: putFrame(channels.position, at, sampled.position) }
+ : target.channel === "target"
+ ? { ...channels, target: putFrame(channels.target, at, sampled.target) }
+ : target.channel === "up"
+ ? { ...channels, up: putFrame(channels.up, at, { x: 0, y: 1, z: 0 }) }
+ : { ...channels, focalLength: putFrame(channels.focalLength, at, sampled.fov) };
+ return parseLocalStageValue({
+ ...stage,
+ cameras: stage.cameras.map((item) =>
+ item.id === target.sourceId ? { ...item, channels: nextChannels } : item,
+ ),
+ });
+ }
+
+ const object = stage.objects.find((item) => item.id === target.sourceId);
+ if (!object || object.locked) return stage;
+ const sampled = sampleStage(stage, at).objects.find((item) => item.id === target.sourceId);
+ if (!sampled) return stage;
+ const keyedFrames = object.keyframes.some((frame) => frame.keyedChannels)
+ ? object.keyframes
+ : object.keyframes.map((frame) => ({
+ ...frame,
+ keyedChannels: ["position", "rotation", "scale"] as ("position" | "rotation" | "scale")[],
+ }));
+ return parseLocalStageValue({
+ ...stage,
+ objects: stage.objects.map((item) =>
+ item.id === target.sourceId
+ ? { ...item, keyframes: putFrame(keyedFrames, at, {
+ position: clone(sampled.position),
+ rotation: clone(sampled.rotation),
+ scale: clone(sampled.scale),
+ }).map((frame) => frame.time === at
+ ? { ...frame, keyedChannels: [...new Set([...(frame.keyedChannels ?? []), target.channel])] }
+ : frame) }
+ : item,
+ ),
+ });
+}
+
+export function editStageObjectTransformChannelAt(
+ stage: LocalStageDocument,
+ objectId: string,
+ channel: "position" | "rotation" | "scale",
+ time: number,
+ value: Vector3Value,
+): LocalStageDocument {
+ return editStageObjectAt(stage, objectId, clampTime(stage, time), { [channel]: value } as Partial);
+}
+
+export function editStageObjectMotionAt(
+ stage: LocalStageDocument,
+ objectId: string,
+ time: number,
+ motion: StageMotion,
+): LocalStageDocument {
+ const object = stage.objects.find((item) => item.id === objectId);
+ if (
+ !object ||
+ object.locked ||
+ !(object.kind === "person" ||
+ (object.kind === "gltf" && object.role === "character" && object.hasAnimation))
+ )
+ return stage;
+ const at = clampTime(stage, time);
+ if (at >= stage.duration) return stage;
+ const existing = object.motionClips.find((clip) => at >= clip.start && at < clip.start + clip.duration);
+ const nextStart = object.motionClips
+ .filter((clip) => clip.start > at)
+ .map((clip) => clip.start)
+ .sort((a, b) => a - b)[0] ?? stage.duration;
+ const duration = Math.min(2, nextStart - at);
+ if (!existing && duration <= 0) return stage;
+ const next: StageMotionClip = existing
+ ? { ...existing, motion: clone(motion) }
+ : { id: crypto.randomUUID(), start: at, duration, motion: clone(motion) };
+ return parseLocalStageValue({
+ ...stage,
+ objects: stage.objects.map((item) => item.id !== objectId ? item : {
+ ...item,
+ motionClips: existing
+ ? item.motionClips.map((clip) => clip.id === existing.id ? next : clip)
+ : [...item.motionClips, next],
+ }),
+ });
+}
+
+/** Remove one projected channel point while retaining sibling channels. */
+export function removeStageTimelineKeyframe(
+ stage: LocalStageDocument,
+ target: StageTimelineKeyframeTarget,
+): LocalStageDocument {
+ if (target.kind === "camera") {
+ return parseLocalStageValue({
+ ...stage,
+ cameras: stage.cameras.map((camera) => {
+ if (camera.id !== target.sourceId) return camera;
+ const channels = cameraChannels(camera);
+ return {
+ ...camera,
+ channels: {
+ ...channels,
+ [target.channel]: channels[target.channel].filter(
+ (frame) => frame.id !== target.pointId,
+ ),
+ },
+ };
+ }),
+ });
+ }
+ return parseLocalStageValue({
+ ...stage,
+ objects: stage.objects.map((object) => {
+ if (object.id !== target.sourceId) return object;
+ // Locked subjects refuse keyframe edits on every other authoring path;
+ // removing a channel keyframe is the same class of mutation.
+ if (object.locked) return object;
+ const base = object[target.channel];
+ const keyedFrames = object.keyframes.some((frame) => frame.keyedChannels)
+ ? object.keyframes
+ : object.keyframes.map((frame) => ({
+ ...frame,
+ keyedChannels: ["position", "rotation", "scale"] as ("position" | "rotation" | "scale")[],
+ }));
+ return {
+ ...object,
+ keyframes: keyedFrames.map((frame) =>
+ frame.id !== target.pointId
+ ? frame
+ : {
+ ...frame,
+ value: { ...frame.value, [target.channel]: clone(base) },
+ keyedChannels: frame.keyedChannels?.filter((channel) => channel !== target.channel),
+ transitions: frame.transitions
+ ? Object.fromEntries(Object.entries(frame.transitions).filter(([channel]) => channel !== target.channel))
+ : undefined,
+ },
+ ),
+ };
+ }),
+ });
+}
diff --git a/src/canvas/toolCatalog.ts b/src/canvas/toolCatalog.ts
index 7d66769f2..1391d46d1 100644
--- a/src/canvas/toolCatalog.ts
+++ b/src/canvas/toolCatalog.ts
@@ -560,6 +560,31 @@ export const CANVAS_TOOLS: readonly CanvasToolDefinition[] = [
},
),
];
+/** Stage preview outputs are projections of an editable director stage;
+ * generative and audio transforms target the stage, not the render, and the
+ * render has no audio track. */
+export const STAGE_PREVIEW_EXCLUDED_VIDEO_TOOLS: ReadonlySet =
+ new Set([
+ "video-partial-reshoot",
+ "video-upscale",
+ "video-edit",
+ "video-extend",
+ "video-depth-capture",
+ "extract-audio",
+ "audio-separation",
+ "video-frame-interpolation",
+ "video-subtitle-erasure",
+ "video-matting",
+ ]);
+export function isStagePreviewOutput(node: {
+ type: string;
+ data: { generationProvenance?: { stagePreview?: boolean } };
+}): boolean {
+ return (
+ node.type === "video" &&
+ node.data.generationProvenance?.stagePreview === true
+ );
+}
export function toolFields(
tool: CanvasToolDefinition,
capability?: ToolCapability,
diff --git a/src/canvas/workspace/WorkspaceView.tsx b/src/canvas/workspace/WorkspaceView.tsx
index 73ca99a34..1a77589a2 100644
--- a/src/canvas/workspace/WorkspaceView.tsx
+++ b/src/canvas/workspace/WorkspaceView.tsx
@@ -123,6 +123,8 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) {
closeEditor,
command,
commitEditorData,
+ appendStageStoryboard,
+ editStageStoryboard,
composerElement,
composerExpanded,
composerIncoming,
@@ -2597,31 +2599,50 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) {
}
>
{
- await commitEditorData({ localStage });
+ backgroundAssets={creationClient(doc.id).snapshot.assets.filter((asset) => asset.kind === "image")}
+ resolveAssetUrl={(ref) => creationClient(doc.id).mediaUrl(ref.assetId)}
+ onImportBackground={(file) =>
+ creationClient(doc.id).importBlob(file, file.name, "image")
+ }
+ isRegisteredAsset={(ref) => {
+ // Same consistency the backend snapshot check demands.
+ const assets = creationClient(doc.id).snapshot.assets;
+ return assets.some(
+ (asset) =>
+ asset.id === ref.assetId &&
+ asset.fingerprint === ref.fingerprint &&
+ asset.kind === ref.kind &&
+ ref.revision <= asset.revision,
+ );
+ }}
+ onPrepareRender={async (localStage, stills, directorPlan) => {
+ await commitEditorData({
+ localStage,
+ // The stills draft commits with the stage so publications
+ // pin the very stills the drawer sends.
+ ...(stills ? { stills } : {}),
+ });
const origin = editorOrigin.current!;
const client = creationClient(doc.id);
mediaPublications.current.set(
origin,
new MediaPublication(client, client.snapshot, origin.nodeId),
);
- return async (result) => addLinkedOutputs(origin, [result]);
+ return async (result) =>
+ addLinkedOutputs(origin, [result], undefined, directorPlan);
}}
onRender={(result) => editorOutputs([result])}
node={editing}
- onApply={(localStage, screenshot) =>
+ onApply={(localStage, stills) =>
commitEditorData({
localStage,
- ...(screenshot
- ? {
- src: screenshot,
- mimeType: "image/png",
- assetState: "ready",
- media: undefined,
- }
- : {}),
+ // The save projection imports capture bytes and pins the
+ // resulting project assets on the director document.
+ ...(stills ? { stills } : {}),
})
}
+ onAppendStoryboard={appendStageStoryboard}
+ onEditStoryboard={editStageStoryboard}
onClose={closeEditor}
/>
diff --git a/src/canvas/workspace/useWorkspaceEditor.ts b/src/canvas/workspace/useWorkspaceEditor.ts
index 53b9f1281..402b815f5 100644
--- a/src/canvas/workspace/useWorkspaceEditor.ts
+++ b/src/canvas/workspace/useWorkspaceEditor.ts
@@ -1,7 +1,8 @@
import { useEffect, useMemo } from "react";
-import { currentAsset } from "../../backend/creationClient";
+import { currentAsset, objectVersion } from "../../backend/creationClient";
import { creationClient } from "../../backend/creationClient.ts";
+import { errorMessage } from "../../backend/api.ts";
import { CreationEditorSession } from "../../backend/creationEditorSession";
import { MediaPublication } from "../../backend/mediaPublication";
@@ -9,8 +10,11 @@ import { backendModel } from "../../backend/rules.ts";
import { workspaceProjection } from "../../backend/workspace";
import { lockedNodeIds } from "../hierarchy";
+import { assertStageStoryboard, sameStageStoryboard, type StageCutEdit, type StageCutReceipt } from "../stageStoryboard";
+import type { StageShot } from "../stageDocument";
import { captureEditorSource, validateNodeActionSource, type LinkedMediaResult, type ResultSource } from "../linkedResults";
import { type CanvasDocument, type CanvasNode, type CanvasNodeData } from "../model";
+import type { DirectorOutputPlanInput } from "../../contracts/generated.ts";
import { createVideoExtensionDraft } from "../nodeActionWorkflow";
import { getNodeGenerationSettings } from "../NodeComposer";
import { resourceFromNode } from "../operations";
@@ -98,6 +102,18 @@ export function useWorkspaceEditor(rt: WorkspaceRuntime) {
if (current.id !== projectId) return;
node = current.nodes.find((item) => item.id === node.id)!;
if (!node || lockedNodeIds(current.nodes).has(node.id)) return;
+ // A Director Stage whose stored Storyboard is not continuous cannot be edited.
+ // It is refused here, with the reason, before the editor mounts: the editor
+ // builds its draft while rendering, and the canvas and the rest of the project
+ // stay usable.
+ if (node.type === "external" && node.data.localStage) {
+ try {
+ assertStageStoryboard(node.data.localStage, t);
+ } catch (reason) {
+ notify(errorMessage(reason));
+ return;
+ }
+ }
editorSession.current = new CreationEditorSession(
creationClient(projectId),
current,
@@ -161,10 +177,151 @@ export function useWorkspaceEditor(rt: WorkspaceRuntime) {
session.projection.client.install(session.projection.client.snapshot);
}
};
+ /** Run one shared Storyboard command within the open editor's transaction.
+ * A just-saved draft already flushed the canvas. Flushing again before React
+ * installs that save would compare the previous draft against the new basis. */
+ const applyStageStoryboard = async (input: (
+ | { type: "append"; cameraId: string; blockId: string }
+ | (StageCutEdit & {
+ before: readonly StageShot[];
+ draft?: Pick;
+ })
+ ) & { savedDraft?: boolean }): Promise => {
+ const session: CreationEditorSession | null = editorSession.current;
+ if (!session || editorSaving.current)
+ throw new Error(t("canvas.workspace.error.editorUnavailable"));
+ const client = session.projection.client,
+ projection = session.projection;
+ const projectId = client.id;
+ if (historyRef.current.present.id !== projectId)
+ throw new Error(t("canvas.workspace.error.editNotCommitted"));
+ /** The Director Stage document bound to the edited item, at the session's basis. */
+ const boundDocument = () => {
+ const binding = projection.basis.canvasItems.find(
+ (item) => item.id === session.itemId,
+ )?.binding;
+ const boundId =
+ binding?.role === "editor" ? binding.objectRef.id : undefined;
+ return projection.basis.editorDocuments.find((doc) => doc.id === boundId);
+ };
+ const initial = boundDocument();
+ if (initial?.kind !== "director")
+ throw new Error(t("canvas.workspace.error.editorUnavailable"));
+ invalidateScheduledAutosave();
+ editorSaving.current = true;
+ try {
+ if (!input.savedDraft) {
+ await saveQueue.current!.wait();
+ if (historyRef.current.present.id !== projectId)
+ throw new Error(t("canvas.workspace.error.editNotCommitted"));
+ if (!(await persist(historyRef.current.present)))
+ throw new Error(t("canvas.workspace.error.editorDraftSaveFailed"));
+ }
+ const document = boundDocument();
+ if (document?.kind !== "director" || document.revision !== initial.revision ||
+ (input.type !== "append" && !input.draft &&
+ !sameStageStoryboard(document.data.shots ?? [], input.before)))
+ throw new Error(t("canvas.workspace.error.editNotCommitted"));
+ const documentId = document.id;
+ const versions = [objectVersion("editor_document", document)];
+ let durationChange: StageCutReceipt["durationChange"];
+ let appendedBlock: StageShot | undefined;
+ if (input.type === "append") {
+ const receipt = await client.command("director.storyboard.append",
+ { documentId, cameraId: input.cameraId, blockId: input.blockId }, versions);
+ const operation = receipt.directorStoryboard?.find((result) =>
+ result.operation === "director.storyboard.append" && result.documentId === documentId &&
+ result.blockId === input.blockId);
+ const accepted = operation?.blocks.find((block) => block.id === input.blockId);
+ if (!accepted) throw new Error(t("canvas.workspace.error.editorRefreshFailed"));
+ const { id, cameraId, start, duration } = accepted;
+ appendedBlock = { id, cameraId, start, duration };
+ } else {
+ const operation = input.type === "reorder" ? {
+ type: "director.storyboard.reorder",
+ payload: { documentId, blockIds: input.blockIds },
+ } as const : input.type === "resize" ? {
+ type: "director.storyboard.resize",
+ payload: { documentId, blockId: input.blockId, duration: input.duration },
+ } as const : input.type === "delete" ? {
+ type: "director.storyboard.delete",
+ payload: { documentId, blockId: input.blockId },
+ } as const : input.type === "setDuration" ? {
+ type: "director.duration.set",
+ payload: { documentId, duration: input.duration },
+ } as const : {
+ type: "director.camera.delete",
+ payload: { documentId, cameraId: input.cameraId },
+ } as const;
+ const receipt = input.draft
+ // The gesture was based on locally edited times. Apply that draft and
+ // its Storyboard edit together or leave both uncommitted.
+ ? await session.apply(input.draft, operation)
+ : await client.command(operation.type, operation.payload, versions);
+ if (input.type === "setDuration") {
+ durationChange = receipt.directorDurations?.find((result) => result.documentId === documentId);
+ if (!durationChange)
+ throw new Error(t("canvas.workspace.error.editorRefreshFailed"));
+ }
+ }
+ const snapshot = client.snapshot;
+ // Follow the acknowledged version before any subsequent editor save.
+ projection.basis = snapshot;
+ const stored = snapshot.editorDocuments.find((doc) => doc.id === documentId);
+ if (stored?.kind !== "director")
+ throw new Error(t("canvas.workspace.error.editorRefreshFailed"));
+ // The canvas is re-read from the refreshed snapshot, as after any editor save.
+ const workspace = workspaceProjection(projectId);
+ let next: CanvasDocument;
+ try {
+ next = await workspace.read(snapshot);
+ } catch {
+ throw new Error(t("canvas.workspace.error.editorRefreshFailed"));
+ }
+ if (historyRef.current.present.id === projectId) {
+ const current = historyRef.current.present;
+ const merged = {
+ ...next,
+ viewport: current.viewport,
+ settings: current.settings,
+ };
+ workspace.baseline = merged;
+ workspace.basis = snapshot;
+ projection.baseline = merged;
+ setHistory((history) => ({ ...history, present: merged }));
+ const node = merged.nodes.find((item) => item.id === session.itemId);
+ if (node) editorOrigin.current = captureEditorSource(projectId, node);
+ }
+ return {
+ shots: [...(stored.data.shots ?? [])],
+ activeCameraId: stored.data.activeCameraId,
+ cameraSource: stored.data.cameraSource ?? "camera",
+ durationChange,
+ appendedBlock,
+ };
+ } finally {
+ editorSaving.current = false;
+ client.install(client.snapshot);
+ }
+ };
+ const appendStageStoryboard = async (input: {
+ cameraId: string;
+ blockId: string;
+ savedDraft?: boolean;
+ }): Promise => {
+ const { appendedBlock } = await applyStageStoryboard({ ...input, type: "append" });
+ if (!appendedBlock) throw new Error(t("canvas.workspace.error.editorRefreshFailed"));
+ return appendedBlock;
+ };
+ const editStageStoryboard = (input: StageCutEdit & {
+ before: readonly StageShot[];
+ draft?: Pick;
+ }) => applyStageStoryboard(input);
const addLinkedOutputs = async (
source: ResultSource,
outputs: readonly LinkedMediaResult[],
sourceTask?: CanvasToolTask,
+ directorPlan?: DirectorOutputPlanInput,
) => {
if (editorSaving.current) throw Error(t("canvas.workspace.error.editorSaving"));
if (historyRef.current.present.id !== source.documentId)
@@ -200,7 +357,7 @@ export function useWorkspaceEditor(rt: WorkspaceRuntime) {
mediaPublications.current.set(source, publication);
}
const task = sourceTask;
- const ids = await publication.publish(outputs, task);
+ const ids = await publication.publish(outputs, task, directorPlan);
const projection = workspaceProjection(current.id);
const snapshot = client.snapshot;
const next = await projection.read(snapshot);
@@ -369,6 +526,8 @@ export function useWorkspaceEditor(rt: WorkspaceRuntime) {
rt.openEditor = openEditor;
rt.closeEditor = closeEditor;
rt.commitEditorData = commitEditorData;
+ rt.appendStageStoryboard = appendStageStoryboard;
+ rt.editStageStoryboard = editStageStoryboard;
rt.addLinkedOutputs = addLinkedOutputs;
rt.editorOutputs = editorOutputs;
rt.sourceFor = sourceFor;
diff --git a/src/canvas/workspace/useWorkspaceInteraction.tsx b/src/canvas/workspace/useWorkspaceInteraction.tsx
index 01662b618..a4fa5aac8 100644
--- a/src/canvas/workspace/useWorkspaceInteraction.tsx
+++ b/src/canvas/workspace/useWorkspaceInteraction.tsx
@@ -12,6 +12,7 @@ import { absolutePosition, boundsOfNodes } from "../geometry";
import { executeCommand } from "../history";
import { createNode, nextNodeTitle, type CanvasCommand, type CanvasNode, type CanvasNodeData, type CanvasNodeKind, type Point } from "../model";
import { orderNodesForCanvas, stackSelection, updateStack } from "../operations";
+import { createLocalStage } from "../stageDocument";
import { persistCurrentDocument } from "../projectManagement";
import { referencePresentation } from "../referenceEvidence";
@@ -222,6 +223,7 @@ export function useWorkspaceInteraction(rt: WorkspaceRuntime) {
const where = position ?? center();
const node = createNode(kind, where, {
...snapshotModel(kind),
+ ...(kind === "external" ? { localStage: createLocalStage(t) } : {}),
title: nextNodeTitle(current, kind, t(nodeKindKeys[kind])),
...(sourceIds.length > 1 && kind === "video"
? { settings: { videoMode: "reference" as const } }
@@ -287,6 +289,15 @@ export function useWorkspaceInteraction(rt: WorkspaceRuntime) {
referenceTarget.current = null;
setMenu(null);
setPanel(null);
+ if (kind === "external") {
+ requestAnimationFrame(() => {
+ if (historyRef.current.present.id !== current.id) return;
+ const created = historyRef.current.present.nodes.find(
+ (candidate) => candidate.id === node.id,
+ );
+ if (created) void openEditor(created);
+ });
+ }
return node;
};
const fit = (selection = false) => {
@@ -785,7 +796,7 @@ export function useWorkspaceInteraction(rt: WorkspaceRuntime) {
// These components own their keyboard shortcuts and cancellation lifecycle.
if (
el.closest(
- ".cw-composer-dock,.cw-composer-popover,.cw-text-window-backdrop,.cw-node-toolbar-anchor,.cw-domain-dialog,.cw-selection-menu,.cw-action-media-host,.cw-project-selector,.cw-project-dialog,.cw-settings-dialog,.cw-assistant-panel,.cw-context-menu,.cw-node-title-input,.cw-subject-description",
+ ".cw-composer-dock,.cw-composer-popover,.cw-text-window-backdrop,.cw-node-toolbar-anchor,.cw-domain-dialog,.cw-stage-console,.cw-selection-menu,.cw-action-media-host,.cw-project-selector,.cw-project-dialog,.cw-settings-dialog,.cw-assistant-panel,.cw-context-menu,.cw-node-title-input,.cw-subject-description",
)
)
return;
diff --git a/src/contracts/creation.schema.json b/src/contracts/creation.schema.json
index aa9856710..c6ebafbee 100644
--- a/src/contracts/creation.schema.json
+++ b/src/contracts/creation.schema.json
@@ -588,6 +588,18 @@
"description": "Expected editable document revision.",
"title": "Editorrevision"
},
+ "directorRender": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/DirectorRenderEvidence"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Frozen Director video output evidence and source version."
+ },
"sources": {
"default": [],
"description": "Ordered source asset versions.",
@@ -1506,6 +1518,12 @@
"canvas.move": "#/$defs/CanvasMoveCommandOperation",
"canvas.show": "#/$defs/CanvasShowCommandOperation",
"canvas.update": "#/$defs/CanvasUpdateCommandOperation",
+ "director.apply": "#/$defs/DirectorApplyCommandOperation",
+ "director.camera.delete": "#/$defs/DirectorCameraDeleteCommandOperation",
+ "director.duration.set": "#/$defs/DirectorSetDurationCommandOperation",
+ "director.storyboard.delete": "#/$defs/DirectorStoryboardDeleteCommandOperation",
+ "director.storyboard.reorder": "#/$defs/DirectorStoryboardReorderCommandOperation",
+ "director.storyboard.resize": "#/$defs/DirectorStoryboardResizeCommandOperation",
"editor.create": "#/$defs/EditorCreateCommandOperation",
"editor.save": "#/$defs/EditorSaveCommandOperation",
"generationSpec.create": "#/$defs/SpecCreateCommandOperation",
@@ -1576,6 +1594,24 @@
},
{
"$ref": "#/$defs/EditorSaveCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/DirectorApplyCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardReorderCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardResizeCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardDeleteCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/DirectorSetDurationCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/DirectorCameraDeleteCommandOperation"
}
]
},
@@ -1591,6 +1627,49 @@
"title": "BatchPayload",
"type": "object"
},
+ "CameraChannels": {
+ "additionalProperties": false,
+ "properties": {
+ "position": {
+ "default": [],
+ "description": "Independent camera position channel.",
+ "items": {
+ "$ref": "#/$defs/CameraVectorFrame"
+ },
+ "title": "Position",
+ "type": "array"
+ },
+ "target": {
+ "default": [],
+ "description": "Independent camera target channel.",
+ "items": {
+ "$ref": "#/$defs/CameraVectorFrame"
+ },
+ "title": "Target",
+ "type": "array"
+ },
+ "up": {
+ "default": [],
+ "description": "Independent camera up-vector channel.",
+ "items": {
+ "$ref": "#/$defs/CameraVectorFrame"
+ },
+ "title": "Up",
+ "type": "array"
+ },
+ "focalLength": {
+ "default": [],
+ "description": "Independent camera focal-length channel.",
+ "items": {
+ "$ref": "#/$defs/CameraNumberFrame"
+ },
+ "title": "Focallength",
+ "type": "array"
+ }
+ },
+ "title": "CameraChannels",
+ "type": "object"
+ },
"CameraFrame": {
"additionalProperties": false,
"properties": {
@@ -1621,6 +1700,50 @@
"title": "CameraFrame",
"type": "object"
},
+ "CameraNumberFrame": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable channel keyframe ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
+ "type": "string"
+ },
+ "time": {
+ "description": "Keyframe time in seconds.",
+ "minimum": 0,
+ "title": "Time",
+ "type": "number"
+ },
+ "value": {
+ "description": "Keyframed camera focal length.",
+ "exclusiveMinimum": 0,
+ "title": "Value",
+ "type": "number"
+ },
+ "transition": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/StageBezierTransition"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Interpolation for the outgoing segment."
+ }
+ },
+ "required": [
+ "id",
+ "time",
+ "value"
+ ],
+ "title": "CameraNumberFrame",
+ "type": "object"
+ },
"CameraRig": {
"additionalProperties": false,
"properties": {
@@ -1638,6 +1761,20 @@
"title": "Name",
"type": "string"
},
+ "aspectRatio": {
+ "default": "16:9",
+ "description": "Camera output aspect ratio.",
+ "enum": [
+ "16:9",
+ "2.39:1",
+ "9:16",
+ "1:1",
+ "4:3",
+ "3:4"
+ ],
+ "title": "Aspectratio",
+ "type": "string"
+ },
"pose": {
"$ref": "#/$defs/StageCamera",
"description": "Camera position and look-at target."
@@ -1650,6 +1787,10 @@
},
"title": "Keyframes",
"type": "array"
+ },
+ "channels": {
+ "$ref": "#/$defs/CameraChannels",
+ "description": "Independent authoritative camera channels."
}
},
"required": [
@@ -1660,6 +1801,48 @@
"title": "CameraRig",
"type": "object"
},
+ "CameraVectorFrame": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable channel keyframe ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
+ "type": "string"
+ },
+ "time": {
+ "description": "Keyframe time in seconds.",
+ "minimum": 0,
+ "title": "Time",
+ "type": "number"
+ },
+ "value": {
+ "$ref": "#/$defs/Vector3",
+ "description": "Keyframed camera vector."
+ },
+ "transition": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/StageBezierTransition"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Interpolation for the outgoing segment."
+ }
+ },
+ "required": [
+ "id",
+ "time",
+ "value"
+ ],
+ "title": "CameraVectorFrame",
+ "type": "object"
+ },
"CanvasApplyEdit": {
"additionalProperties": false,
"properties": {
@@ -2896,6 +3079,32 @@
],
"title": "Document"
},
+ "directorPlan": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/DirectorOutputPlan"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Frozen Director video output plan, when publishing a stage video."
+ },
+ "directorAcceptedAt": {
+ "anyOf": [
+ {
+ "minimum": 1,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Project event cursor fixed when the browser accepted a Director video render.",
+ "title": "Directoracceptedat"
+ },
"outputs": {
"description": "Ordered published media outputs.",
"items": {
@@ -3403,6 +3612,24 @@
"title": "Issues",
"type": "array"
},
+ "directorDurations": {
+ "default": [],
+ "description": "Director main timeline results in operation order.",
+ "items": {
+ "$ref": "#/$defs/DirectorDurationResult"
+ },
+ "title": "Directordurations",
+ "type": "array"
+ },
+ "directorStoryboard": {
+ "default": [],
+ "description": "Storyboard outcomes in command operation order.",
+ "items": {
+ "$ref": "#/$defs/DirectorStoryboardResult"
+ },
+ "title": "Directorstoryboard",
+ "type": "array"
+ },
"eventCursor": {
"anyOf": [
{
@@ -3472,6 +3699,19 @@
"timeline_font_mime",
"timeline_bundled_font_fingerprint",
"timeline_bundled_font_unavailable",
+ "storyboard_leading_gap",
+ "storyboard_internal_gap",
+ "storyboard_overlap",
+ "storyboard_exceeds_duration",
+ "storyboard_duration_invalid",
+ "storyboard_camera_unknown",
+ "storyboard_block_invalid",
+ "storyboard_block_exists",
+ "storyboard_exhausted",
+ "storyboard_order_invalid",
+ "storyboard_block_unknown",
+ "director_camera_unknown",
+ "director_camera_required",
"invalid_input",
"revision_conflict",
"role_restricted",
@@ -3757,6 +3997,13 @@
"canvas.show": "#/$defs/CanvasShowCommand",
"canvas.update": "#/$defs/CanvasUpdateCommand",
"creation.batch": "#/$defs/BatchCommand",
+ "director.apply": "#/$defs/DirectorApplyCommand",
+ "director.camera.delete": "#/$defs/DirectorCameraDeleteCommand",
+ "director.duration.set": "#/$defs/DirectorSetDurationCommand",
+ "director.storyboard.append": "#/$defs/DirectorStoryboardAppendCommand",
+ "director.storyboard.delete": "#/$defs/DirectorStoryboardDeleteCommand",
+ "director.storyboard.reorder": "#/$defs/DirectorStoryboardReorderCommand",
+ "director.storyboard.resize": "#/$defs/DirectorStoryboardResizeCommand",
"editor.create": "#/$defs/EditorCreateCommand",
"editor.save": "#/$defs/EditorSaveCommand",
"generation.submit": "#/$defs/GenerationSubmitCommand",
@@ -3894,6 +4141,27 @@
{
"$ref": "#/$defs/EditorSaveCommand"
},
+ {
+ "$ref": "#/$defs/DirectorApplyCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardAppendCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardReorderCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardResizeCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardDeleteCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorSetDurationCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorCameraDeleteCommand"
+ },
{
"$ref": "#/$defs/HistoryUndoCommand"
},
@@ -3919,6 +4187,7 @@
"asset.usage": "#/$defs/AssetUsageQuery",
"canvas.status": "#/$defs/CanvasStatusQuery",
"canvas.versions": "#/$defs/VersionsQuery",
+ "director.storyboard.get": "#/$defs/DirectorStoryboardQuery",
"generationSpec.versions": "#/$defs/VersionsQuery",
"job.get": "#/$defs/ObjectQuery",
"object.get": "#/$defs/ObjectQuery",
@@ -3947,6 +4216,9 @@
},
{
"$ref": "#/$defs/AssetPreviewQuery"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardQuery"
}
],
"title": "Query"
@@ -4073,13 +4345,28 @@
"title": "CreationContracts",
"type": "object"
},
- "DirectorCanvasItem": {
+ "DirectorApply": {
"additionalProperties": false,
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
+ "document": {
+ "$ref": "#/$defs/DirectorDocumentWrite",
+ "description": "Authoritative Director Stage document applied atomically."
+ }
+ },
+ "required": [
+ "document"
+ ],
+ "title": "DirectorApply",
+ "type": "object"
+ },
+ "DirectorApplyCommand": {
+ "additionalProperties": false,
+ "description": "Apply an authoritative Director Stage document atomically.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
"format": "uuid",
- "title": "Id",
+ "title": "Commandid",
"type": "string"
},
"projectId": {
@@ -4088,198 +4375,104 @@
"title": "Projectid",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "kind": {
- "const": "external",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
- },
- "title": {
- "default": "",
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
+ "type": {
+ "const": "director.apply",
+ "description": "Command discriminator.",
+ "title": "Type",
"type": "string"
},
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
- },
- "width": {
- "default": 352,
- "description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "title": "Width",
- "type": "number"
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
},
- "height": {
- "default": 198,
- "description": "Height in pixels.",
- "exclusiveMinimum": 0,
- "title": "Height",
- "type": "number"
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "zIndex": {
- "default": 0,
- "description": "Canvas stacking order.",
- "title": "Zindex",
- "type": "integer"
- },
- "locked": {
- "default": false,
- "description": "Whether edits to this object are blocked.",
- "title": "Locked",
- "type": "boolean"
- },
- "visible": {
- "default": true,
- "description": "Whether this object is displayed.",
- "title": "Visible",
- "type": "boolean"
- },
- "parentId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Parent canvas group ID, or null for the root.",
- "title": "Parentid"
- },
- "tags": {
- "default": [],
- "description": "User-defined search tags.",
- "items": {
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "type": "string"
- },
- "title": "Tags",
- "type": "array"
- },
- "binding": {
- "$ref": "#/$defs/EditorBinding",
- "description": "Business object displayed by this canvas item."
+ "payload": {
+ "$ref": "#/$defs/DirectorApply",
+ "description": "Apply an authoritative Director Stage document atomically."
}
},
"required": [
- "id",
+ "commandId",
"projectId",
- "kind",
- "binding"
+ "type",
+ "payload"
],
- "title": "DirectorCanvasItem",
+ "title": "DirectorApplyCommand",
"type": "object"
},
- "DirectorData": {
+ "DirectorApplyCommandOperation": {
"additionalProperties": false,
+ "description": "Apply an authoritative Director Stage document atomically.",
"properties": {
- "background": {
- "description": "Composition background color.",
- "pattern": "^#[0-9a-fA-F]{6}$",
- "title": "Background",
+ "type": {
+ "const": "director.apply",
+ "description": "Operation discriminator.",
+ "title": "Type",
"type": "string"
},
- "grid": {
- "default": true,
- "description": "Whether to display the stage grid.",
- "title": "Grid",
- "type": "boolean"
- },
- "duration": {
- "description": "Interval duration in seconds.",
- "exclusiveMinimum": 0,
- "title": "Duration",
- "type": "number"
- },
- "aspectRatio": {
- "default": "16:9",
- "description": "Output width-to-height ratio.",
- "enum": [
- "16:9",
- "9:16",
- "1:1",
- "4:3",
- "3:4"
- ],
- "title": "Aspectratio",
+ "payload": {
+ "$ref": "#/$defs/DirectorApply",
+ "description": "Apply an authoritative Director Stage document atomically."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "DirectorApplyCommandOperation",
+ "type": "object"
+ },
+ "DirectorCameraDelete": {
+ "additionalProperties": false,
+ "properties": {
+ "documentId": {
+ "description": "Director Stage document that owns the camera.",
+ "format": "uuid",
+ "title": "Documentid",
"type": "string"
},
- "cameras": {
- "description": "Editable stage cameras.",
- "items": {
- "$ref": "#/$defs/CameraRig"
- },
- "minItems": 1,
- "title": "Cameras",
- "type": "array"
- },
- "activeCameraId": {
- "description": "Active stage camera ID.",
+ "cameraId": {
+ "description": "Camera to delete with its Storyboard blocks.",
"maxLength": 100,
"minLength": 1,
"pattern": "\\S",
- "title": "Activecameraid",
- "type": "string"
- },
- "cameraSource": {
- "default": "camera",
- "description": "Camera selection strategy.",
- "enum": [
- "camera",
- "storyboard"
- ],
- "title": "Camerasource",
+ "title": "Cameraid",
"type": "string"
- },
- "shots": {
- "default": [],
- "description": "Ordered camera shot intervals.",
- "items": {
- "$ref": "#/$defs/StageShot"
- },
- "title": "Shots",
- "type": "array"
- },
- "objects": {
- "default": [],
- "description": "Editable stage objects.",
- "items": {
- "$ref": "#/$defs/StageObject"
- },
- "title": "Objects",
- "type": "array"
}
},
"required": [
- "background",
- "duration",
- "cameras",
- "activeCameraId"
+ "documentId",
+ "cameraId"
],
- "title": "DirectorData",
+ "title": "DirectorCameraDelete",
"type": "object"
},
- "DirectorDocument": {
+ "DirectorCameraDeleteCommand": {
"additionalProperties": false,
+ "description": "Delete a non-final Director Stage camera and its Storyboard blocks atomically.",
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
"format": "uuid",
- "title": "Id",
+ "title": "Commandid",
"type": "string"
},
"projectId": {
@@ -4288,71 +4481,72 @@
"title": "Projectid",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "schemaVersion": {
- "const": 1,
- "default": 1,
- "description": "Record schema version.",
- "title": "Schemaversion",
- "type": "integer"
+ "type": {
+ "const": "director.camera.delete",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
},
- "inputConnections": {
+ "expectedVersions": {
"default": [],
- "description": "Persisted connections to source assets.",
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
"items": {
- "$ref": "#/$defs/EditorInputConnection"
+ "$ref": "#/$defs/ObjectVersion"
},
- "title": "Inputconnections",
+ "title": "Expectedversions",
"type": "array"
},
- "kind": {
- "const": "director",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "data": {
- "$ref": "#/$defs/DirectorData",
- "description": "Typed editable document contents."
+ "payload": {
+ "$ref": "#/$defs/DirectorCameraDelete",
+ "description": "Delete a non-final Director Stage camera and its Storyboard blocks atomically."
}
},
"required": [
- "id",
+ "commandId",
"projectId",
- "kind",
- "data"
+ "type",
+ "payload"
],
- "title": "DirectorDocument",
+ "title": "DirectorCameraDeleteCommand",
"type": "object"
},
- "EditorBinding": {
+ "DirectorCameraDeleteCommandOperation": {
"additionalProperties": false,
+ "description": "Delete a non-final Director Stage camera and its Storyboard blocks atomically.",
"properties": {
- "role": {
- "const": "editor",
- "description": "Business role of this binding or reference.",
- "title": "Role",
+ "type": {
+ "const": "director.camera.delete",
+ "description": "Operation discriminator.",
+ "title": "Type",
"type": "string"
},
- "objectRef": {
- "$ref": "#/$defs/EditorRef",
- "description": "Stable reference to the bound business object."
+ "payload": {
+ "$ref": "#/$defs/DirectorCameraDelete",
+ "description": "Delete a non-final Director Stage camera and its Storyboard blocks atomically."
}
},
"required": [
- "role",
- "objectRef"
+ "type",
+ "payload"
],
- "title": "EditorBinding",
+ "title": "DirectorCameraDeleteCommandOperation",
"type": "object"
},
- "EditorCanvasItem": {
+ "DirectorCanvasItem": {
"additionalProperties": false,
"properties": {
"id": {
@@ -4375,20 +4569,8 @@
"type": "integer"
},
"kind": {
+ "const": "external",
"description": "Business object or media type.",
- "enum": [
- "text",
- "image",
- "video",
- "audio",
- "file",
- "group",
- "timeline",
- "subject",
- "stack",
- "tool",
- "external"
- ],
"title": "Kind",
"type": "string"
},
@@ -4472,91 +4654,269 @@
"kind",
"binding"
],
- "title": "EditorCanvasItem",
+ "title": "DirectorCanvasItem",
"type": "object"
},
- "EditorCreateCommand": {
+ "DirectorData": {
"additionalProperties": false,
- "description": "Create an editable document.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
+ "background": {
+ "description": "Composition background color.",
+ "examples": [
+ "#000000"
+ ],
+ "pattern": "^#[0-9a-fA-F]{6}$",
+ "title": "Background",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "grid": {
+ "default": true,
+ "description": "Whether to display the stage grid.",
+ "title": "Grid",
+ "type": "boolean"
},
- "type": {
- "const": "editor.create",
- "description": "Command discriminator.",
- "title": "Type",
+ "duration": {
+ "description": "Interval duration in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Duration",
+ "type": "number"
+ },
+ "fps": {
+ "default": 30,
+ "description": "Frames per second. 帧率。",
+ "enum": [
+ 24,
+ 25,
+ 30,
+ 50,
+ 60
+ ],
+ "title": "Fps",
+ "type": "integer"
+ },
+ "aspectRatio": {
+ "default": "16:9",
+ "description": "Output width-to-height ratio.",
+ "enum": [
+ "16:9",
+ "2.39:1",
+ "9:16",
+ "1:1",
+ "4:3",
+ "3:4"
+ ],
+ "title": "Aspectratio",
"type": "string"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "cameras": {
+ "description": "Editable stage cameras.",
"items": {
- "$ref": "#/$defs/ObjectVersion"
+ "$ref": "#/$defs/CameraRig"
},
- "title": "Expectedversions",
+ "minItems": 1,
+ "title": "Cameras",
"type": "array"
},
- "expectedPreview": {
- "anyOf": [
- {
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
- },
- {
- "type": "null"
- }
+ "activeCameraId": {
+ "description": "Active stage camera ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Activecameraid",
+ "type": "string"
+ },
+ "cameraSource": {
+ "default": "camera",
+ "description": "Camera selection strategy.",
+ "enum": [
+ "camera",
+ "storyboard"
],
- "default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "title": "Camerasource",
+ "type": "string"
},
- "payload": {
- "$ref": "#/$defs/EditorWrite",
- "description": "Create an editable document."
+ "shots": {
+ "default": [],
+ "description": "Ordered camera shot intervals.",
+ "items": {
+ "$ref": "#/$defs/StageShot"
+ },
+ "title": "Shots",
+ "type": "array"
+ },
+ "objects": {
+ "default": [],
+ "description": "Editable stage objects.",
+ "items": {
+ "$ref": "#/$defs/StageObject"
+ },
+ "title": "Objects",
+ "type": "array"
+ },
+ "environment": {
+ "$ref": "#/$defs/StageEnvironment",
+ "description": "Authoritative environment reference and ground configuration. 权威环境引用和地面配置。"
+ },
+ "lights": {
+ "description": "The three retained stage lights. 舞台保留的三盏灯光。",
+ "items": {
+ "$ref": "#/$defs/StageLight"
+ },
+ "maxItems": 3,
+ "minItems": 3,
+ "title": "Lights",
+ "type": "array"
+ },
+ "stills": {
+ "default": [],
+ "description": "Captured still frames pinned as project image assets, oldest first.",
+ "items": {
+ "$ref": "#/$defs/AssetRef"
+ },
+ "title": "Stills",
+ "type": "array"
}
},
"required": [
- "commandId",
- "projectId",
- "type",
- "payload"
+ "background",
+ "duration",
+ "cameras",
+ "activeCameraId"
],
- "title": "EditorCreateCommand",
+ "title": "DirectorData",
"type": "object"
},
- "EditorCreateCommandOperation": {
+ "DirectorDataWrite": {
"additionalProperties": false,
- "description": "Create an editable document.",
+ "description": "A Director Stage document entering the project through a command.\n\nIt has the same fields and dump as the stored ``DirectorData``. Shot relations are\nnot checked while the command is parsed: both HTTP and Agent entry points parse the\npayload before the application service runs, so checking here would reject the write\nwith a generic code before the write boundary could report the specific one. The\nstored model still validates the committed snapshot as the last line of defence.",
"properties": {
- "type": {
- "const": "editor.create",
- "description": "Operation discriminator.",
- "title": "Type",
+ "background": {
+ "description": "Composition background color.",
+ "examples": [
+ "#000000"
+ ],
+ "pattern": "^#[0-9a-fA-F]{6}$",
+ "title": "Background",
"type": "string"
},
- "payload": {
- "$ref": "#/$defs/EditorWrite",
- "description": "Create an editable document."
+ "grid": {
+ "default": true,
+ "description": "Whether to display the stage grid.",
+ "title": "Grid",
+ "type": "boolean"
+ },
+ "duration": {
+ "description": "Interval duration in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Duration",
+ "type": "number"
+ },
+ "fps": {
+ "default": 30,
+ "description": "Frames per second. 帧率。",
+ "enum": [
+ 24,
+ 25,
+ 30,
+ 50,
+ 60
+ ],
+ "title": "Fps",
+ "type": "integer"
+ },
+ "aspectRatio": {
+ "default": "16:9",
+ "description": "Output width-to-height ratio.",
+ "enum": [
+ "16:9",
+ "2.39:1",
+ "9:16",
+ "1:1",
+ "4:3",
+ "3:4"
+ ],
+ "title": "Aspectratio",
+ "type": "string"
+ },
+ "cameras": {
+ "description": "Editable stage cameras.",
+ "items": {
+ "$ref": "#/$defs/CameraRig"
+ },
+ "minItems": 1,
+ "title": "Cameras",
+ "type": "array"
+ },
+ "activeCameraId": {
+ "description": "Active stage camera ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Activecameraid",
+ "type": "string"
+ },
+ "cameraSource": {
+ "default": "camera",
+ "description": "Camera selection strategy.",
+ "enum": [
+ "camera",
+ "storyboard"
+ ],
+ "title": "Camerasource",
+ "type": "string"
+ },
+ "shots": {
+ "default": [],
+ "description": "Ordered camera shot intervals.",
+ "items": {
+ "$ref": "#/$defs/StageShot"
+ },
+ "title": "Shots",
+ "type": "array"
+ },
+ "objects": {
+ "default": [],
+ "description": "Editable stage objects.",
+ "items": {
+ "$ref": "#/$defs/StageObject"
+ },
+ "title": "Objects",
+ "type": "array"
+ },
+ "environment": {
+ "$ref": "#/$defs/StageEnvironment",
+ "description": "Authoritative environment reference and ground configuration. 权威环境引用和地面配置。"
+ },
+ "lights": {
+ "description": "The three retained stage lights. 舞台保留的三盏灯光。",
+ "items": {
+ "$ref": "#/$defs/StageLight"
+ },
+ "maxItems": 3,
+ "minItems": 3,
+ "title": "Lights",
+ "type": "array"
+ },
+ "stills": {
+ "default": [],
+ "description": "Captured still frames pinned as project image assets, oldest first.",
+ "items": {
+ "$ref": "#/$defs/AssetRef"
+ },
+ "title": "Stills",
+ "type": "array"
}
},
"required": [
- "type",
- "payload"
+ "background",
+ "duration",
+ "cameras",
+ "activeCameraId"
],
- "title": "EditorCreateCommandOperation",
+ "title": "DirectorDataWrite",
"type": "object"
},
- "EditorDocumentBase": {
+ "DirectorDocument": {
"additionalProperties": false,
"properties": {
"id": {
@@ -4593,95 +4953,253 @@
},
"title": "Inputconnections",
"type": "array"
+ },
+ "kind": {
+ "const": "director",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "data": {
+ "$ref": "#/$defs/DirectorData",
+ "description": "Typed editable document contents."
}
},
"required": [
"id",
- "projectId"
+ "projectId",
+ "kind",
+ "data"
],
- "title": "EditorDocumentBase",
+ "title": "DirectorDocument",
"type": "object"
},
- "EditorInputConnection": {
+ "DirectorDocumentWrite": {
"additionalProperties": false,
- "description": "Assembly provenance binds a retained slot, never a generation spec.",
"properties": {
"id": {
- "description": "Stable object ID.",
+ "description": "Stable identity of this project-owned object.",
"format": "uuid",
"title": "Id",
"type": "string"
},
- "sourceId": {
- "description": "Source canvas item ID.",
+ "projectId": {
+ "description": "Owning project ID.",
"format": "uuid",
- "title": "Sourceid",
- "type": "string"
- },
- "slotId": {
- "description": "Destination editor input slot.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Slotid",
+ "title": "Projectid",
"type": "string"
},
- "asset": {
- "$ref": "#/$defs/AssetRef",
- "description": "Immutable asset version."
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "schemaVersion": {
+ "const": 1,
+ "default": 1,
+ "description": "Record schema version.",
+ "title": "Schemaversion",
+ "type": "integer"
+ },
+ "inputConnections": {
+ "default": [],
+ "description": "Persisted connections to source assets.",
+ "items": {
+ "$ref": "#/$defs/EditorInputConnection"
+ },
+ "title": "Inputconnections",
+ "type": "array"
+ },
+ "kind": {
+ "const": "director",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "data": {
+ "$ref": "#/$defs/DirectorDataWrite",
+ "description": "Typed editable document contents."
}
},
"required": [
"id",
- "sourceId",
- "slotId",
- "asset"
+ "projectId",
+ "kind",
+ "data"
],
- "title": "EditorInputConnection",
+ "title": "DirectorDocumentWrite",
"type": "object"
},
- "EditorRef": {
+ "DirectorDurationResult": {
"additionalProperties": false,
"properties": {
- "objectType": {
- "const": "editor_document",
- "default": "editor_document",
- "description": "Referenced business object type.",
- "title": "Objecttype",
- "type": "string"
- },
- "id": {
- "description": "Referenced editable document ID.",
+ "documentId": {
+ "description": "Director Stage document whose main timeline was evaluated.",
"format": "uuid",
- "title": "Id",
+ "title": "Documentid",
"type": "string"
},
- "kind": {
- "description": "Business object or media type.",
+ "requestedDuration": {
+ "description": "Main timeline duration requested in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Requestedduration",
+ "type": "number"
+ },
+ "appliedDuration": {
+ "description": "Main timeline duration applied in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Appliedduration",
+ "type": "number"
+ },
+ "clampReason": {
+ "anyOf": [
+ {
+ "const": "storyboard_end",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Stable reason for a limited duration, or null.",
+ "title": "Clampreason"
+ }
+ },
+ "required": [
+ "documentId",
+ "requestedDuration",
+ "appliedDuration",
+ "clampReason"
+ ],
+ "title": "DirectorDurationResult",
+ "type": "object"
+ },
+ "DirectorOutputPlan": {
+ "additionalProperties": false,
+ "properties": {
+ "cameraSource": {
+ "description": "Camera selection strategy fixed for this render.",
"enum": [
- "timeline",
- "subject",
- "stack",
- "tool",
- "director",
- "layers",
- "image_crop",
- "media_edit"
+ "camera",
+ "storyboard"
],
- "title": "Kind",
+ "title": "Camerasource",
"type": "string"
+ },
+ "cameraId": {
+ "anyOf": [
+ {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Camera rig fixed for a camera render; omitted for storyboard renders.",
+ "title": "Cameraid"
+ },
+ "width": {
+ "description": "Expected output width in pixels.",
+ "minimum": 1,
+ "title": "Width",
+ "type": "integer"
+ },
+ "height": {
+ "description": "Expected output height in pixels.",
+ "minimum": 1,
+ "title": "Height",
+ "type": "integer"
+ },
+ "durationSeconds": {
+ "description": "Expected output duration in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Durationseconds",
+ "type": "number"
+ },
+ "frameRate": {
+ "description": "Expected output frames per second.",
+ "exclusiveMinimum": 0,
+ "title": "Framerate",
+ "type": "number"
}
},
"required": [
- "id",
- "kind"
+ "cameraSource",
+ "width",
+ "height",
+ "durationSeconds",
+ "frameRate"
],
- "title": "EditorRef",
+ "title": "DirectorOutputPlan",
"type": "object"
},
- "EditorSaveCommand": {
+ "DirectorRenderEvidence": {
"additionalProperties": false,
- "description": "Save an editable document.",
+ "properties": {
+ "acceptedProjectCursor": {
+ "description": "Event cursor of the accepted project snapshot.",
+ "minimum": 1,
+ "title": "Acceptedprojectcursor",
+ "type": "integer"
+ },
+ "sourceEditorId": {
+ "description": "Editable Director Stage document fixed at acceptance.",
+ "format": "uuid",
+ "title": "Sourceeditorid",
+ "type": "string"
+ },
+ "sourceEditorRevision": {
+ "description": "Source stage revision fixed at acceptance.",
+ "minimum": 1,
+ "title": "Sourceeditorrevision",
+ "type": "integer"
+ },
+ "plan": {
+ "$ref": "#/$defs/DirectorOutputPlan",
+ "description": "The accepted camera strategy, output size, duration and frame rate."
+ }
+ },
+ "required": [
+ "acceptedProjectCursor",
+ "sourceEditorId",
+ "sourceEditorRevision",
+ "plan"
+ ],
+ "title": "DirectorRenderEvidence",
+ "type": "object"
+ },
+ "DirectorSetDuration": {
+ "additionalProperties": false,
+ "properties": {
+ "documentId": {
+ "description": "Director Stage document whose main timeline will change.",
+ "format": "uuid",
+ "title": "Documentid",
+ "type": "string"
+ },
+ "duration": {
+ "description": "Requested main timeline duration in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Duration",
+ "type": "number"
+ }
+ },
+ "required": [
+ "documentId",
+ "duration"
+ ],
+ "title": "DirectorSetDuration",
+ "type": "object"
+ },
+ "DirectorSetDurationCommand": {
+ "additionalProperties": false,
+ "description": "Set the Director Stage main timeline duration, preserving the Storyboard and animation.",
"properties": {
"commandId": {
"description": "Stable command ID for idempotent replay.",
@@ -4696,7 +5214,7 @@
"type": "string"
},
"type": {
- "const": "editor.save",
+ "const": "director.duration.set",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -4725,8 +5243,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/EditorWrite",
- "description": "Save an editable document."
+ "$ref": "#/$defs/DirectorSetDuration",
+ "description": "Set the Director Stage main timeline duration, preserving the Storyboard and animation."
}
},
"required": [
@@ -4735,110 +5253,100 @@
"type",
"payload"
],
- "title": "EditorSaveCommand",
+ "title": "DirectorSetDurationCommand",
"type": "object"
},
- "EditorSaveCommandOperation": {
+ "DirectorSetDurationCommandOperation": {
"additionalProperties": false,
- "description": "Save an editable document.",
+ "description": "Set the Director Stage main timeline duration, preserving the Storyboard and animation.",
"properties": {
"type": {
- "const": "editor.save",
+ "const": "director.duration.set",
"description": "Operation discriminator.",
"title": "Type",
"type": "string"
},
"payload": {
- "$ref": "#/$defs/EditorWrite",
- "description": "Save an editable document."
+ "$ref": "#/$defs/DirectorSetDuration",
+ "description": "Set the Director Stage main timeline duration, preserving the Storyboard and animation."
}
},
"required": [
"type",
"payload"
],
- "title": "EditorSaveCommandOperation",
+ "title": "DirectorSetDurationCommandOperation",
"type": "object"
},
- "EditorWrite": {
+ "DirectorStoryboardAppend": {
"additionalProperties": false,
"properties": {
- "document": {
- "description": "Editable document owned by this operation.",
- "discriminator": {
- "mapping": {
- "director": "#/$defs/DirectorDocument",
- "image_crop": "#/$defs/ImageCropDocument",
- "layers": "#/$defs/LayerDocument",
- "media_edit": "#/$defs/MediaEditDocument",
- "stack": "#/$defs/StackDocument",
- "subject": "#/$defs/SubjectDocument",
- "timeline": "#/$defs/TimelineDocument",
- "tool": "#/$defs/ToolDocument"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TimelineDocument"
- },
- {
- "$ref": "#/$defs/SubjectDocument"
- },
- {
- "$ref": "#/$defs/LayerDocument"
- },
- {
- "$ref": "#/$defs/ImageCropDocument"
- },
- {
- "$ref": "#/$defs/StackDocument"
- },
- {
- "$ref": "#/$defs/ToolDocument"
- },
- {
- "$ref": "#/$defs/DirectorDocument"
- },
- {
- "$ref": "#/$defs/MediaEditDocument"
- }
- ],
- "title": "Document"
+ "documentId": {
+ "description": "Director Stage document that receives the Storyboard block.",
+ "format": "uuid",
+ "title": "Documentid",
+ "type": "string"
+ },
+ "cameraId": {
+ "description": "Existing stage camera the new block references.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Cameraid",
+ "type": "string"
+ },
+ "blockId": {
+ "description": "Stable identity of the new Storyboard block; it must not be in use.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Blockid",
+ "type": "string"
}
},
"required": [
- "document"
+ "documentId",
+ "cameraId",
+ "blockId"
],
- "title": "EditorWrite",
+ "title": "DirectorStoryboardAppend",
"type": "object"
},
- "EmptyBinding": {
+ "DirectorStoryboardAppendCommand": {
"additionalProperties": false,
- "description": "An empty canvas item with optional editable draft or manual text.",
+ "description": "Append an existing camera to the end of the continuous Director Stage Storyboard.",
"properties": {
- "role": {
- "const": "empty",
- "description": "Business role of this binding or reference.",
- "title": "Role",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
"type": "string"
},
- "draftSpec": {
- "anyOf": [
- {
- "$ref": "#/$defs/GenerationSpecRef"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Editable generation draft associated with an empty item."
- },
- "manualText": {
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "director.storyboard.append",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
"anyOf": [
{
- "maxLength": 1048576,
+ "pattern": "^[0-9a-f]{64}$",
"type": "string"
},
{
@@ -4846,168 +5354,184 @@
}
],
"default": null,
- "description": "Manually entered text for an empty text item.",
- "title": "Manualtext"
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardAppend",
+ "description": "Append an existing camera to the end of the continuous Director Stage Storyboard."
}
},
"required": [
- "role"
+ "commandId",
+ "projectId",
+ "type",
+ "payload"
],
- "title": "EmptyBinding",
- "type": "object"
- },
- "EmptyPayload": {
- "additionalProperties": false,
- "properties": {},
- "title": "EmptyPayload",
+ "title": "DirectorStoryboardAppendCommand",
"type": "object"
},
- "FileCanvasItem": {
+ "DirectorStoryboardBlock": {
"additionalProperties": false,
"properties": {
"id": {
- "description": "Stable identity of this project-owned object.",
- "format": "uuid",
+ "description": "Stable block identity.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
"title": "Id",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ "cameraId": {
+ "description": "Stage camera the block references.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Cameraid",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
+ "order": {
+ "description": "Position in the stored Storyboard, starting at zero.",
+ "minimum": 0,
+ "title": "Order",
"type": "integer"
},
- "kind": {
- "const": "file",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
- },
- "title": {
- "default": "",
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
- "type": "string"
- },
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
- },
- "width": {
- "default": 352,
- "description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "title": "Width",
+ "start": {
+ "description": "Block start in seconds, as stored.",
+ "minimum": 0,
+ "title": "Start",
"type": "number"
},
- "height": {
- "default": 198,
- "description": "Height in pixels.",
+ "duration": {
+ "description": "Block duration in seconds, as stored.",
"exclusiveMinimum": 0,
- "title": "Height",
+ "title": "Duration",
"type": "number"
+ }
+ },
+ "required": [
+ "id",
+ "cameraId",
+ "order",
+ "start",
+ "duration"
+ ],
+ "title": "DirectorStoryboardBlock",
+ "type": "object"
+ },
+ "DirectorStoryboardDelete": {
+ "additionalProperties": false,
+ "properties": {
+ "documentId": {
+ "description": "Director Stage document that owns the Storyboard.",
+ "format": "uuid",
+ "title": "Documentid",
+ "type": "string"
},
- "zIndex": {
- "default": 0,
- "description": "Canvas stacking order.",
- "title": "Zindex",
- "type": "integer"
- },
- "locked": {
- "default": false,
- "description": "Whether edits to this object are blocked.",
- "title": "Locked",
- "type": "boolean"
+ "blockId": {
+ "description": "Storyboard block to delete.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Blockid",
+ "type": "string"
+ }
+ },
+ "required": [
+ "documentId",
+ "blockId"
+ ],
+ "title": "DirectorStoryboardDelete",
+ "type": "object"
+ },
+ "DirectorStoryboardDeleteCommand": {
+ "additionalProperties": false,
+ "description": "Delete a Storyboard block and shift later blocks without changing their durations.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
},
- "visible": {
- "default": true,
- "description": "Whether this object is displayed.",
- "title": "Visible",
- "type": "boolean"
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
},
- "parentId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Parent canvas group ID, or null for the root.",
- "title": "Parentid"
+ "type": {
+ "const": "director.storyboard.delete",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
},
- "tags": {
+ "expectedVersions": {
"default": [],
- "description": "User-defined search tags.",
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
"items": {
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "type": "string"
+ "$ref": "#/$defs/ObjectVersion"
},
- "title": "Tags",
+ "title": "Expectedversions",
"type": "array"
},
- "binding": {
- "description": "Business object displayed by this canvas item.",
- "discriminator": {
- "mapping": {
- "empty": "#/$defs/EmptyBinding",
- "generation": "#/$defs/GenerationBinding",
- "material": "#/$defs/MaterialBinding"
- },
- "propertyName": "role"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/EmptyBinding"
- },
+ "expectedPreview": {
+ "anyOf": [
{
- "$ref": "#/$defs/MaterialBinding"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
- "$ref": "#/$defs/GenerationBinding"
+ "type": "null"
}
],
- "title": "Binding"
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "editors": {
- "default": [],
- "description": "Attached editable documents.",
- "items": {
- "$ref": "#/$defs/EditorRef"
- },
- "title": "Editors",
- "type": "array"
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardDelete",
+ "description": "Delete a Storyboard block and shift later blocks without changing their durations."
}
},
"required": [
- "id",
+ "commandId",
"projectId",
- "kind",
- "binding"
+ "type",
+ "payload"
],
- "title": "FileCanvasItem",
+ "title": "DirectorStoryboardDeleteCommand",
"type": "object"
},
- "FollowingReference": {
+ "DirectorStoryboardDeleteCommandOperation": {
"additionalProperties": false,
+ "description": "Delete a Storyboard block and shift later blocks without changing their durations.",
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
+ "type": {
+ "const": "director.storyboard.delete",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardDelete",
+ "description": "Delete a Storyboard block and shift later blocks without changing their durations."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "DirectorStoryboardDeleteCommandOperation",
+ "type": "object"
+ },
+ "DirectorStoryboardQuery": {
+ "additionalProperties": false,
+ "properties": {
+ "queryId": {
+ "description": "Caller-supplied query ID.",
"format": "uuid",
- "title": "Id",
+ "title": "Queryid",
"type": "string"
},
"projectId": {
@@ -5016,209 +5540,335 @@
"title": "Projectid",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
+ "type": {
+ "const": "director.storyboard.get",
+ "description": "Read the stored Director Stage Storyboard and whether a block can be appended.",
+ "title": "Type",
+ "type": "string"
},
- "targetSpecId": {
- "description": "Target generation configuration ID.",
+ "objectId": {
+ "description": "Director Stage document ID.",
"format": "uuid",
- "title": "Targetspecid",
+ "title": "Objectid",
"type": "string"
- },
- "role": {
- "default": "reference",
- "description": "Business role of this binding or reference.",
- "enum": [
- "reference",
- "first_frame",
- "last_frame",
- "continuation"
- ],
- "title": "Role",
+ }
+ },
+ "required": [
+ "queryId",
+ "projectId",
+ "type",
+ "objectId"
+ ],
+ "title": "DirectorStoryboardQuery",
+ "type": "object"
+ },
+ "DirectorStoryboardReorder": {
+ "additionalProperties": false,
+ "properties": {
+ "documentId": {
+ "description": "Director Stage document that owns the Storyboard.",
+ "format": "uuid",
+ "title": "Documentid",
"type": "string"
},
- "order": {
- "default": 0,
- "description": "Reference ordering within the target configuration.",
- "minimum": 0,
- "title": "Order",
- "type": "integer"
+ "blockIds": {
+ "description": "Every Storyboard block ID exactly once, in the desired order.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Blockids",
+ "type": "array"
+ }
+ },
+ "required": [
+ "documentId",
+ "blockIds"
+ ],
+ "title": "DirectorStoryboardReorder",
+ "type": "object"
+ },
+ "DirectorStoryboardReorderCommand": {
+ "additionalProperties": false,
+ "description": "Reorder the continuous Storyboard by block ID, preserving durations and camera references.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
},
- "active": {
- "default": true,
- "description": "Whether this reference participates in generation.",
- "title": "Active",
- "type": "boolean"
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
},
- "binding": {
- "const": "follow_current",
- "description": "Follow the source canvas item's current asset.",
- "title": "Binding",
+ "type": {
+ "const": "director.storyboard.reorder",
+ "description": "Command discriminator.",
+ "title": "Type",
"type": "string"
},
- "source": {
- "$ref": "#/$defs/FollowingSource",
- "description": "Source canvas_item identity."
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardReorder",
+ "description": "Reorder the continuous Storyboard by block ID, preserving durations and camera references."
}
},
"required": [
- "id",
+ "commandId",
"projectId",
- "targetSpecId",
- "binding",
- "source"
+ "type",
+ "payload"
],
- "title": "FollowingReference",
+ "title": "DirectorStoryboardReorderCommand",
"type": "object"
},
- "FollowingReferenceSource": {
+ "DirectorStoryboardReorderCommandOperation": {
"additionalProperties": false,
+ "description": "Reorder the continuous Storyboard by block ID, preserving durations and camera references.",
"properties": {
- "binding": {
- "const": "follow_current",
- "default": "follow_current",
- "description": "Follow the canvas source current asset.",
- "title": "Binding",
+ "type": {
+ "const": "director.storyboard.reorder",
+ "description": "Operation discriminator.",
+ "title": "Type",
"type": "string"
},
- "source": {
- "$ref": "#/$defs/FollowingSource",
- "description": "Source canvas_item identity."
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardReorder",
+ "description": "Reorder the continuous Storyboard by block ID, preserving durations and camera references."
}
},
"required": [
- "source"
+ "type",
+ "payload"
],
- "title": "FollowingReferenceSource",
+ "title": "DirectorStoryboardReorderCommandOperation",
"type": "object"
},
- "FollowingSource": {
+ "DirectorStoryboardResize": {
"additionalProperties": false,
"properties": {
- "objectType": {
- "const": "canvas_item",
- "default": "canvas_item",
- "description": "Referenced business object type.",
- "title": "Objecttype",
+ "documentId": {
+ "description": "Director Stage document that owns the Storyboard.",
+ "format": "uuid",
+ "title": "Documentid",
"type": "string"
},
- "id": {
- "description": "Source canvas item ID.",
- "format": "uuid",
- "title": "Id",
+ "blockId": {
+ "description": "Block that owns the boundary on its right.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Blockid",
"type": "string"
+ },
+ "duration": {
+ "description": "New duration of that block in seconds; must leave the Storyboard continuous and within the timeline.",
+ "title": "Duration",
+ "type": "number"
}
},
"required": [
- "id"
+ "documentId",
+ "blockId",
+ "duration"
],
- "title": "FollowingSource",
+ "title": "DirectorStoryboardResize",
"type": "object"
},
- "GenerationBinding": {
+ "DirectorStoryboardResizeCommand": {
"additionalProperties": false,
- "description": "Displays a generation configuration and its adopted result.",
+ "description": "Resize the given block and shift all subsequent blocks, preserving their durations.",
"properties": {
- "role": {
- "const": "generation",
- "description": "Business role of this binding or reference.",
- "title": "Role",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
"type": "string"
},
- "objectRef": {
- "$ref": "#/$defs/GenerationSpecRef",
- "description": "Stable reference to the bound business object."
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
},
- "materialOverride": {
+ "type": {
+ "const": "director.storyboard.resize",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
"anyOf": [
{
- "$ref": "#/$defs/AssetRef"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Adopted material that overrides the current generated result."
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardResize",
+ "description": "Resize the given block and shift all subsequent blocks, preserving their durations."
}
},
"required": [
- "role",
- "objectRef"
+ "commandId",
+ "projectId",
+ "type",
+ "payload"
],
- "title": "GenerationBinding",
+ "title": "DirectorStoryboardResizeCommand",
"type": "object"
},
- "GenerationFailure": {
+ "DirectorStoryboardResizeCommandOperation": {
"additionalProperties": false,
+ "description": "Resize the given block and shift all subsequent blocks, preserving their durations.",
"properties": {
- "category": {
- "description": "Stable failure category.",
- "enum": [
- "input",
- "reference",
- "authentication",
- "permission",
- "quota",
- "rate_limit",
- "temporary",
- "submission_unknown",
- "local",
- "protocol",
- "provider"
- ],
- "title": "Category",
+ "type": {
+ "const": "director.storyboard.resize",
+ "description": "Operation discriminator.",
+ "title": "Type",
"type": "string"
},
- "stage": {
- "description": "Execution stage where the failure occurred.",
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardResize",
+ "description": "Resize the given block and shift all subsequent blocks, preserving their durations."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "DirectorStoryboardResizeCommandOperation",
+ "type": "object"
+ },
+ "DirectorStoryboardResult": {
+ "additionalProperties": false,
+ "properties": {
+ "operationIndex": {
+ "description": "Zero-based position in the command or batch.",
+ "minimum": 0,
+ "title": "Operationindex",
+ "type": "integer"
+ },
+ "operation": {
+ "description": "Storyboard or related operation evaluated.",
"enum": [
- "prepare",
- "submit",
- "poll",
- "download",
- "check",
- "save",
- "adopt",
- "cancel"
+ "director.storyboard.append",
+ "director.storyboard.reorder",
+ "director.storyboard.resize",
+ "director.storyboard.delete",
+ "director.camera.delete",
+ "director.duration.set"
],
- "title": "Stage",
+ "title": "Operation",
"type": "string"
},
- "message": {
- "description": "Human-readable issue description.",
- "maxLength": 500,
- "title": "Message",
+ "documentId": {
+ "description": "Director Stage document that owns the Storyboard.",
+ "format": "uuid",
+ "title": "Documentid",
"type": "string"
},
- "suggestion": {
- "description": "Suggested action to resolve the failure.",
- "maxLength": 500,
- "title": "Suggestion",
- "type": "string"
+ "version": {
+ "description": "Committed document revision for the enclosing transaction.",
+ "minimum": 1,
+ "title": "Version",
+ "type": "integer"
},
- "providerCode": {
- "anyOf": [
- {
- "maxLength": 160,
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
+ "blocks": {
+ "description": "Block identities, order and stored times after this operation, before subsequent batch operations.",
+ "items": {
+ "$ref": "#/$defs/DirectorStoryboardBlock"
+ },
+ "title": "Blocks",
+ "type": "array"
+ },
+ "affectedBlockIds": {
+ "description": "New or changed surviving block IDs, in resulting order.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Affectedblockids",
+ "type": "array"
+ },
+ "removedBlockIds": {
+ "description": "Removed block IDs, in their previous order.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Removedblockids",
+ "type": "array"
+ },
+ "blockId": {
+ "anyOf": [
+ {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
"default": null,
- "description": "Provider error code.",
- "title": "Providercode"
+ "description": "Block explicitly targeted by the operation, when applicable.",
+ "title": "Blockid"
},
- "requestId": {
+ "cameraId": {
"anyOf": [
{
- "maxLength": 200,
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
"type": "string"
},
{
@@ -5226,31 +5876,79 @@
}
],
"default": null,
- "description": "Provider request ID.",
- "title": "Requestid"
+ "description": "Camera explicitly targeted by the operation, when applicable.",
+ "title": "Cameraid"
},
- "httpStatus": {
+ "appendLimitReason": {
"anyOf": [
{
- "maximum": 599,
- "minimum": 100,
- "type": "integer"
+ "const": "storyboard_tail",
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Provider HTTP response status.",
- "title": "Httpstatus"
+ "description": "Stable reason a new block is shorter than the default duration, or null.",
+ "title": "Appendlimitreason"
+ }
+ },
+ "required": [
+ "operationIndex",
+ "operation",
+ "documentId",
+ "version",
+ "blocks",
+ "affectedBlockIds",
+ "removedBlockIds"
+ ],
+ "title": "DirectorStoryboardResult",
+ "type": "object"
+ },
+ "DirectorStoryboardState": {
+ "additionalProperties": false,
+ "properties": {
+ "documentId": {
+ "description": "Director Stage document that owns the Storyboard.",
+ "format": "uuid",
+ "title": "Documentid",
+ "type": "string"
},
- "providerStatus": {
+ "version": {
+ "description": "Current revision of the Director Stage document.",
+ "minimum": 1,
+ "title": "Version",
+ "type": "integer"
+ },
+ "storyboardEnd": {
+ "description": "End of the last block in seconds; zero when the Storyboard is empty.",
+ "minimum": 0,
+ "title": "Storyboardend",
+ "type": "number"
+ },
+ "canAppend": {
+ "description": "Whether a block can be appended in the main-timeline time that remains.",
+ "title": "Canappend",
+ "type": "boolean"
+ },
+ "cannotAppendReason": {
"anyOf": [
{
"enum": [
- "failed",
- "cancelled",
- "expired"
+ "storyboard_leading_gap",
+ "storyboard_internal_gap",
+ "storyboard_overlap",
+ "storyboard_exceeds_duration",
+ "storyboard_duration_invalid",
+ "storyboard_camera_unknown",
+ "storyboard_block_invalid",
+ "storyboard_block_exists",
+ "storyboard_exhausted",
+ "storyboard_order_invalid",
+ "storyboard_block_unknown",
+ "director_camera_unknown",
+ "director_camera_required"
],
"type": "string"
},
@@ -5259,20 +5957,50 @@
}
],
"default": null,
- "description": "Provider terminal task status.",
- "title": "Providerstatus"
+ "description": "Stable reason no block can be appended; null when one can.",
+ "title": "Cannotappendreason"
+ },
+ "blocks": {
+ "description": "Storyboard blocks in stored order, reported as stored.",
+ "items": {
+ "$ref": "#/$defs/DirectorStoryboardBlock"
+ },
+ "title": "Blocks",
+ "type": "array"
}
},
"required": [
- "category",
- "stage",
- "message",
- "suggestion"
+ "documentId",
+ "version",
+ "storyboardEnd",
+ "canAppend",
+ "blocks"
],
- "title": "GenerationFailure",
+ "title": "DirectorStoryboardState",
"type": "object"
},
- "GenerationSpecBase": {
+ "EditorBinding": {
+ "additionalProperties": false,
+ "properties": {
+ "role": {
+ "const": "editor",
+ "description": "Business role of this binding or reference.",
+ "title": "Role",
+ "type": "string"
+ },
+ "objectRef": {
+ "$ref": "#/$defs/EditorRef",
+ "description": "Stable reference to the bound business object."
+ }
+ },
+ "required": [
+ "role",
+ "objectRef"
+ ],
+ "title": "EditorBinding",
+ "type": "object"
+ },
+ "EditorCanvasItem": {
"additionalProperties": false,
"properties": {
"id": {
@@ -5294,68 +6022,68 @@
"title": "Revision",
"type": "integer"
},
- "purpose": {
- "default": "draft",
- "description": "Draft settings or executable generation configuration.",
+ "kind": {
+ "description": "Business object or media type.",
"enum": [
- "draft",
- "generation"
+ "text",
+ "image",
+ "video",
+ "audio",
+ "file",
+ "group",
+ "timeline",
+ "subject",
+ "stack",
+ "tool",
+ "external"
],
- "title": "Purpose",
+ "title": "Kind",
"type": "string"
},
- "modelConfigId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Model configuration ID from the model catalog or user model selections.",
- "title": "Modelconfigid"
- },
- "prompt": {
+ "title": {
"default": "",
- "description": "Generation prompt text.",
- "maxLength": 20000,
- "title": "Prompt",
+ "description": "User-visible title.",
+ "maxLength": 255,
+ "title": "Title",
"type": "string"
},
- "promptContent": {
- "anyOf": [
- {
- "items": {
- "discriminator": {
- "mapping": {
- "reference": "#/$defs/PromptReference",
- "text": "#/$defs/PromptText"
- },
- "propertyName": "type"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/PromptText"
- },
- {
- "$ref": "#/$defs/PromptReference"
- }
- ]
- },
- "type": "array"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Structured prompt text and reference tokens.",
- "title": "Promptcontent"
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
},
- "currentResultId": {
+ "width": {
+ "default": 352,
+ "description": "Width in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Width",
+ "type": "number"
+ },
+ "height": {
+ "default": 198,
+ "description": "Height in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Height",
+ "type": "number"
+ },
+ "zIndex": {
+ "default": 0,
+ "description": "Canvas stacking order.",
+ "title": "Zindex",
+ "type": "integer"
+ },
+ "locked": {
+ "default": false,
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
+ "type": "boolean"
+ },
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
+ },
+ "parentId": {
"anyOf": [
{
"format": "uuid",
@@ -5366,141 +6094,53 @@
}
],
"default": null,
- "description": "Currently adopted result ID.",
- "title": "Currentresultid"
+ "description": "Parent canvas group ID, or null for the root.",
+ "title": "Parentid"
+ },
+ "tags": {
+ "default": [],
+ "description": "User-defined search tags.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Tags",
+ "type": "array"
+ },
+ "binding": {
+ "$ref": "#/$defs/EditorBinding",
+ "description": "Business object displayed by this canvas item."
}
},
"required": [
"id",
- "projectId"
+ "projectId",
+ "kind",
+ "binding"
],
- "title": "GenerationSpecBase",
+ "title": "EditorCanvasItem",
"type": "object"
},
- "GenerationSpecRef": {
+ "EditorCreateCommand": {
"additionalProperties": false,
+ "description": "Create an editable document.",
"properties": {
- "objectType": {
- "const": "generation_spec",
- "default": "generation_spec",
- "description": "Referenced business object type.",
- "title": "Objecttype",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
"type": "string"
},
- "id": {
- "description": "Referenced generation configuration ID.",
+ "projectId": {
+ "description": "Owning project ID.",
"format": "uuid",
- "title": "Id",
- "type": "string"
- }
- },
- "required": [
- "id"
- ],
- "title": "GenerationSpecRef",
- "type": "object"
- },
- "GenerationSubmit": {
- "additionalProperties": false,
- "properties": {
- "specId": {
- "description": "Include its current generation_spec revision in expectedVersions.",
- "format": "uuid",
- "title": "Specid",
- "type": "string",
- "x-version-object-type": "generation_spec"
- },
- "expectedSpecRevision": {
- "description": "Must match the specId revision in expectedVersions.",
- "minimum": 1,
- "title": "Expectedspecrevision",
- "type": "integer"
- },
- "originItemId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "When set, include its current canvas_item revision in expectedVersions.",
- "title": "Originitemid",
- "x-version-object-type": "canvas_item"
- },
- "previousJobId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Previous generation attempt ID.",
- "title": "Previousjobid"
- },
- "adoptionPolicy": {
- "default": "if_current",
- "description": "Policy for adopting the completed result.",
- "enum": [
- "if_current",
- "candidate_only"
- ],
- "title": "Adoptionpolicy",
- "type": "string"
- },
- "batchId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Generation batch ID.",
- "title": "Batchid"
- },
- "showAdditionalResult": {
- "default": false,
- "description": "Whether to display an additional result item.",
- "title": "Showadditionalresult",
- "type": "boolean"
- }
- },
- "required": [
- "specId",
- "expectedSpecRevision"
- ],
- "title": "GenerationSubmit",
- "type": "object"
- },
- "GenerationSubmitCommand": {
- "additionalProperties": false,
- "description": "Submit a generation job with fixed inputs and an adoption policy.",
- "properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ "title": "Projectid",
"type": "string"
},
"type": {
- "const": "generation.submit",
+ "const": "editor.create",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -5529,8 +6169,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/GenerationSubmit",
- "description": "Submit a generation job with fixed inputs and an adoption policy."
+ "$ref": "#/$defs/EditorWrite",
+ "description": "Create an editable document."
}
},
"required": [
@@ -5539,10 +6179,32 @@
"type",
"payload"
],
- "title": "GenerationSubmitCommand",
+ "title": "EditorCreateCommand",
"type": "object"
},
- "GroupCanvasItem": {
+ "EditorCreateCommandOperation": {
+ "additionalProperties": false,
+ "description": "Create an editable document.",
+ "properties": {
+ "type": {
+ "const": "editor.create",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/EditorWrite",
+ "description": "Create an editable document."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "EditorCreateCommandOperation",
+ "type": "object"
+ },
+ "EditorDocumentBase": {
"additionalProperties": false,
"properties": {
"id": {
@@ -5564,172 +6226,110 @@
"title": "Revision",
"type": "integer"
},
- "kind": {
- "const": "group",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
- },
- "title": {
- "default": "",
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
- "type": "string"
- },
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
- },
- "width": {
- "default": 352,
- "description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "title": "Width",
- "type": "number"
- },
- "height": {
- "default": 198,
- "description": "Height in pixels.",
- "exclusiveMinimum": 0,
- "title": "Height",
- "type": "number"
- },
- "zIndex": {
- "default": 0,
- "description": "Canvas stacking order.",
- "title": "Zindex",
+ "schemaVersion": {
+ "const": 1,
+ "default": 1,
+ "description": "Record schema version.",
+ "title": "Schemaversion",
"type": "integer"
},
- "locked": {
- "default": false,
- "description": "Whether edits to this object are blocked.",
- "title": "Locked",
- "type": "boolean"
- },
- "visible": {
- "default": true,
- "description": "Whether this object is displayed.",
- "title": "Visible",
- "type": "boolean"
- },
- "parentId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Parent canvas group ID, or null for the root.",
- "title": "Parentid"
- },
- "tags": {
+ "inputConnections": {
"default": [],
- "description": "User-defined search tags.",
+ "description": "Persisted connections to source assets.",
"items": {
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "type": "string"
+ "$ref": "#/$defs/EditorInputConnection"
},
- "title": "Tags",
+ "title": "Inputconnections",
"type": "array"
- },
- "binding": {
- "$ref": "#/$defs/ContainerBinding",
- "description": "Business object displayed by this canvas item."
}
},
"required": [
"id",
- "projectId",
- "kind"
+ "projectId"
],
- "title": "GroupCanvasItem",
+ "title": "EditorDocumentBase",
"type": "object"
},
- "HistoryRedoCommand": {
+ "EditorInputConnection": {
"additionalProperties": false,
- "description": "Reapply an undone command.",
+ "description": "Assembly provenance binds a retained slot, never a generation spec.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
+ "id": {
+ "description": "Stable object ID.",
"format": "uuid",
- "title": "Commandid",
+ "title": "Id",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
+ "sourceId": {
+ "description": "Source canvas item ID.",
"format": "uuid",
- "title": "Projectid",
+ "title": "Sourceid",
"type": "string"
},
- "type": {
- "const": "history.redo",
- "description": "Command discriminator.",
- "title": "Type",
+ "slotId": {
+ "description": "Destination editor input slot.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Slotid",
"type": "string"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
- },
- "expectedPreview": {
- "anyOf": [
- {
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
- },
- "payload": {
- "$ref": "#/$defs/HistoryReplay",
- "description": "Reapply an undone command."
+ "asset": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Immutable asset version."
}
},
"required": [
- "commandId",
- "projectId",
- "type",
- "payload"
+ "id",
+ "sourceId",
+ "slotId",
+ "asset"
],
- "title": "HistoryRedoCommand",
+ "title": "EditorInputConnection",
"type": "object"
},
- "HistoryReplay": {
+ "EditorRef": {
"additionalProperties": false,
"properties": {
- "targetCommandId": {
- "description": "Historical command to undo or redo.",
+ "objectType": {
+ "const": "editor_document",
+ "default": "editor_document",
+ "description": "Referenced business object type.",
+ "title": "Objecttype",
+ "type": "string"
+ },
+ "id": {
+ "description": "Referenced editable document ID.",
"format": "uuid",
- "title": "Targetcommandid",
+ "title": "Id",
+ "type": "string"
+ },
+ "kind": {
+ "description": "Business object or media type.",
+ "enum": [
+ "timeline",
+ "subject",
+ "stack",
+ "tool",
+ "director",
+ "layers",
+ "image_crop",
+ "media_edit"
+ ],
+ "title": "Kind",
"type": "string"
}
},
"required": [
- "targetCommandId"
+ "id",
+ "kind"
],
- "title": "HistoryReplay",
+ "title": "EditorRef",
"type": "object"
},
- "HistoryUndoCommand": {
+ "EditorSaveCommand": {
"additionalProperties": false,
- "description": "Undo a recorded reversible command.",
+ "description": "Save an editable document.",
"properties": {
"commandId": {
"description": "Stable command ID for idempotent replay.",
@@ -5744,7 +6344,7 @@
"type": "string"
},
"type": {
- "const": "history.undo",
+ "const": "editor.save",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -5773,8 +6373,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/HistoryReplay",
- "description": "Undo a recorded reversible command."
+ "$ref": "#/$defs/EditorWrite",
+ "description": "Save an editable document."
}
},
"required": [
@@ -5783,10 +6383,134 @@
"type",
"payload"
],
- "title": "HistoryUndoCommand",
+ "title": "EditorSaveCommand",
"type": "object"
},
- "ImageCanvasItem": {
+ "EditorSaveCommandOperation": {
+ "additionalProperties": false,
+ "description": "Save an editable document.",
+ "properties": {
+ "type": {
+ "const": "editor.save",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/EditorWrite",
+ "description": "Save an editable document."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "EditorSaveCommandOperation",
+ "type": "object"
+ },
+ "EditorWrite": {
+ "additionalProperties": false,
+ "properties": {
+ "document": {
+ "description": "Editable document owned by this operation.",
+ "discriminator": {
+ "mapping": {
+ "director": "#/$defs/DirectorDocumentWrite",
+ "image_crop": "#/$defs/ImageCropDocument",
+ "layers": "#/$defs/LayerDocument",
+ "media_edit": "#/$defs/MediaEditDocument",
+ "stack": "#/$defs/StackDocument",
+ "subject": "#/$defs/SubjectDocument",
+ "timeline": "#/$defs/TimelineDocument",
+ "tool": "#/$defs/ToolDocument"
+ },
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TimelineDocument"
+ },
+ {
+ "$ref": "#/$defs/SubjectDocument"
+ },
+ {
+ "$ref": "#/$defs/LayerDocument"
+ },
+ {
+ "$ref": "#/$defs/ImageCropDocument"
+ },
+ {
+ "$ref": "#/$defs/StackDocument"
+ },
+ {
+ "$ref": "#/$defs/ToolDocument"
+ },
+ {
+ "$ref": "#/$defs/DirectorDocumentWrite"
+ },
+ {
+ "$ref": "#/$defs/MediaEditDocument"
+ }
+ ],
+ "title": "Document"
+ }
+ },
+ "required": [
+ "document"
+ ],
+ "title": "EditorWrite",
+ "type": "object"
+ },
+ "EmptyBinding": {
+ "additionalProperties": false,
+ "description": "An empty canvas item with optional editable draft or manual text.",
+ "properties": {
+ "role": {
+ "const": "empty",
+ "description": "Business role of this binding or reference.",
+ "title": "Role",
+ "type": "string"
+ },
+ "draftSpec": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/GenerationSpecRef"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Editable generation draft associated with an empty item."
+ },
+ "manualText": {
+ "anyOf": [
+ {
+ "maxLength": 1048576,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Manually entered text for an empty text item.",
+ "title": "Manualtext"
+ }
+ },
+ "required": [
+ "role"
+ ],
+ "title": "EmptyBinding",
+ "type": "object"
+ },
+ "EmptyPayload": {
+ "additionalProperties": false,
+ "properties": {},
+ "title": "EmptyPayload",
+ "type": "object"
+ },
+ "FileCanvasItem": {
"additionalProperties": false,
"properties": {
"id": {
@@ -5809,7 +6533,7 @@
"type": "integer"
},
"kind": {
- "const": "image",
+ "const": "file",
"description": "Business object or media type.",
"title": "Kind",
"type": "string"
@@ -5922,43 +6646,10 @@
"kind",
"binding"
],
- "title": "ImageCanvasItem",
- "type": "object"
- },
- "ImageCropData": {
- "additionalProperties": false,
- "properties": {
- "source": {
- "$ref": "#/$defs/AssetRef",
- "description": "Input source or recorded provenance."
- },
- "options": {
- "$ref": "#/$defs/ImageCropOptions",
- "description": "Non-destructive image crop and color settings."
- },
- "width": {
- "description": "Width in pixels.",
- "minimum": 1,
- "title": "Width",
- "type": "integer"
- },
- "height": {
- "description": "Height in pixels.",
- "minimum": 1,
- "title": "Height",
- "type": "integer"
- }
- },
- "required": [
- "source",
- "options",
- "width",
- "height"
- ],
- "title": "ImageCropData",
+ "title": "FileCanvasItem",
"type": "object"
},
- "ImageCropDocument": {
+ "FollowingReference": {
"additionalProperties": false,
"properties": {
"id": {
@@ -5980,252 +6671,256 @@
"title": "Revision",
"type": "integer"
},
- "schemaVersion": {
- "const": 1,
- "default": 1,
- "description": "Record schema version.",
- "title": "Schemaversion",
- "type": "integer"
+ "targetSpecId": {
+ "description": "Target generation configuration ID.",
+ "format": "uuid",
+ "title": "Targetspecid",
+ "type": "string"
},
- "inputConnections": {
- "default": [],
- "description": "Persisted connections to source assets.",
- "items": {
- "$ref": "#/$defs/EditorInputConnection"
- },
- "title": "Inputconnections",
- "type": "array"
+ "role": {
+ "default": "reference",
+ "description": "Business role of this binding or reference.",
+ "enum": [
+ "reference",
+ "first_frame",
+ "last_frame",
+ "continuation"
+ ],
+ "title": "Role",
+ "type": "string"
},
- "kind": {
- "const": "image_crop",
- "description": "Business object or media type.",
- "title": "Kind",
+ "order": {
+ "default": 0,
+ "description": "Reference ordering within the target configuration.",
+ "minimum": 0,
+ "title": "Order",
+ "type": "integer"
+ },
+ "active": {
+ "default": true,
+ "description": "Whether this reference participates in generation.",
+ "title": "Active",
+ "type": "boolean"
+ },
+ "binding": {
+ "const": "follow_current",
+ "description": "Follow the source canvas item's current asset.",
+ "title": "Binding",
"type": "string"
},
- "data": {
- "$ref": "#/$defs/ImageCropData",
- "description": "Typed editable document contents."
+ "source": {
+ "$ref": "#/$defs/FollowingSource",
+ "description": "Source canvas_item identity."
}
},
"required": [
"id",
"projectId",
- "kind",
- "data"
+ "targetSpecId",
+ "binding",
+ "source"
],
- "title": "ImageCropDocument",
+ "title": "FollowingReference",
"type": "object"
},
- "ImageCropOptions": {
+ "FollowingReferenceSource": {
"additionalProperties": false,
"properties": {
- "rotation": {
- "default": 0,
- "description": "Crop rotation in degrees.",
- "enum": [
- 0,
- 90,
- 180,
- 270
- ],
- "title": "Rotation",
- "type": "integer"
- },
- "flipX": {
- "default": false,
- "description": "Whether the image is mirrored horizontally.",
- "title": "Flipx",
- "type": "boolean"
- },
- "flipY": {
- "default": false,
- "description": "Whether the image is mirrored vertically.",
- "title": "Flipy",
- "type": "boolean"
- },
- "aspect": {
- "default": "original",
- "description": "Crop aspect ratio or free crop mode.",
- "enum": [
- "free",
- "original",
- "1:1",
- "4:3",
- "3:4",
- "16:9",
- "9:16"
- ],
- "title": "Aspect",
+ "binding": {
+ "const": "follow_current",
+ "default": "follow_current",
+ "description": "Follow the canvas source current asset.",
+ "title": "Binding",
"type": "string"
},
- "zoom": {
- "default": 100,
- "description": "Crop zoom percentage.",
- "maximum": 400,
- "minimum": 100,
- "title": "Zoom",
- "type": "number"
- },
- "freeWidth": {
- "default": 100,
- "description": "Free crop width as a percentage.",
- "maximum": 100,
- "minimum": 1,
- "title": "Freewidth",
- "type": "number"
- },
- "freeHeight": {
- "default": 100,
- "description": "Free crop height as a percentage.",
- "maximum": 100,
- "minimum": 1,
- "title": "Freeheight",
- "type": "number"
- },
- "x": {
- "default": 50,
- "description": "Horizontal crop position percentage.",
- "maximum": 100,
- "minimum": 0,
- "title": "X",
- "type": "number"
- },
- "y": {
- "default": 50,
- "description": "Vertical crop position percentage.",
- "maximum": 100,
- "minimum": 0,
- "title": "Y",
- "type": "number"
- },
- "brightness": {
- "default": 100,
- "description": "Brightness percentage.",
- "maximum": 200,
- "minimum": 0,
- "title": "Brightness",
- "type": "number"
- },
- "contrast": {
- "default": 100,
- "description": "Contrast percentage.",
- "maximum": 200,
- "minimum": 0,
- "title": "Contrast",
- "type": "number"
- },
- "saturation": {
- "default": 100,
- "description": "Saturation percentage.",
- "maximum": 200,
- "minimum": 0,
- "title": "Saturation",
- "type": "number"
+ "source": {
+ "$ref": "#/$defs/FollowingSource",
+ "description": "Source canvas_item identity."
}
},
- "title": "ImageCropOptions",
+ "required": [
+ "source"
+ ],
+ "title": "FollowingReferenceSource",
"type": "object"
},
- "ImageExecution": {
+ "FollowingSource": {
"additionalProperties": false,
"properties": {
- "kind": {
- "const": "image",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
- },
- "quality": {
- "default": "auto",
- "description": "Image rendering quality fixed for this execution; auto omits the provider field.",
- "enum": [
- "auto",
- "low",
- "medium",
- "high"
- ],
- "title": "Quality",
+ "objectType": {
+ "const": "canvas_item",
+ "default": "canvas_item",
+ "description": "Referenced business object type.",
+ "title": "Objecttype",
"type": "string"
},
- "size": {
- "description": "Effective image dimensions sent to the provider.",
- "title": "Size",
+ "id": {
+ "description": "Source canvas item ID.",
+ "format": "uuid",
+ "title": "Id",
"type": "string"
- },
- "responseFormat": {
- "anyOf": [
- {
- "enum": [
- "url",
- "b64_json"
- ],
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Provider response representation.",
- "title": "Responseformat"
- },
- "outputFormat": {
- "const": "png",
- "default": "png",
- "description": "Generated image encoding.",
- "title": "Outputformat",
+ }
+ },
+ "required": [
+ "id"
+ ],
+ "title": "FollowingSource",
+ "type": "object"
+ },
+ "GenerationBinding": {
+ "additionalProperties": false,
+ "description": "Displays a generation configuration and its adopted result.",
+ "properties": {
+ "role": {
+ "const": "generation",
+ "description": "Business role of this binding or reference.",
+ "title": "Role",
"type": "string"
},
- "watermark": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Whether provider watermarking is enabled.",
- "title": "Watermark"
+ "objectRef": {
+ "$ref": "#/$defs/GenerationSpecRef",
+ "description": "Stable reference to the bound business object."
},
- "numInferenceSteps": {
+ "materialOverride": {
"anyOf": [
{
- "minimum": 1,
- "type": "integer"
+ "$ref": "#/$defs/AssetRef"
},
{
"type": "null"
}
],
"default": null,
- "description": "Diffusion sampling step count.",
- "title": "Numinferencesteps"
+ "description": "Adopted material that overrides the current generated result."
+ }
+ },
+ "required": [
+ "role",
+ "objectRef"
+ ],
+ "title": "GenerationBinding",
+ "type": "object"
+ },
+ "GenerationFailure": {
+ "additionalProperties": false,
+ "properties": {
+ "category": {
+ "description": "Stable failure category.",
+ "enum": [
+ "input",
+ "reference",
+ "authentication",
+ "permission",
+ "quota",
+ "rate_limit",
+ "temporary",
+ "submission_unknown",
+ "local",
+ "protocol",
+ "provider"
+ ],
+ "title": "Category",
+ "type": "string"
},
- "guidanceScale": {
+ "stage": {
+ "description": "Execution stage where the failure occurred.",
+ "enum": [
+ "prepare",
+ "submit",
+ "poll",
+ "download",
+ "check",
+ "save",
+ "adopt",
+ "cancel"
+ ],
+ "title": "Stage",
+ "type": "string"
+ },
+ "message": {
+ "description": "Human-readable issue description.",
+ "maxLength": 500,
+ "title": "Message",
+ "type": "string"
+ },
+ "suggestion": {
+ "description": "Suggested action to resolve the failure.",
+ "maxLength": 500,
+ "title": "Suggestion",
+ "type": "string"
+ },
+ "providerCode": {
"anyOf": [
{
- "minimum": 0,
- "type": "number"
+ "maxLength": 160,
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Diffusion guidance scale.",
- "title": "Guidancescale"
+ "description": "Provider error code.",
+ "title": "Providercode"
+ },
+ "requestId": {
+ "anyOf": [
+ {
+ "maxLength": 200,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Provider request ID.",
+ "title": "Requestid"
+ },
+ "httpStatus": {
+ "anyOf": [
+ {
+ "maximum": 599,
+ "minimum": 100,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Provider HTTP response status.",
+ "title": "Httpstatus"
+ },
+ "providerStatus": {
+ "anyOf": [
+ {
+ "enum": [
+ "failed",
+ "cancelled",
+ "expired"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Provider terminal task status.",
+ "title": "Providerstatus"
}
},
"required": [
- "kind",
- "size"
+ "category",
+ "stage",
+ "message",
+ "suggestion"
],
- "title": "ImageExecution",
+ "title": "GenerationFailure",
"type": "object"
},
- "ImageGenerationSpec": {
+ "GenerationSpecBase": {
"additionalProperties": false,
"properties": {
"id": {
@@ -6321,237 +7016,400 @@
"default": null,
"description": "Currently adopted result ID.",
"title": "Currentresultid"
- },
- "kind": {
- "const": "image",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
- },
- "parameters": {
- "$ref": "#/$defs/ImageParameters",
- "description": "Typed generation or editing parameters."
}
},
"required": [
"id",
- "projectId",
- "kind"
+ "projectId"
],
- "title": "ImageGenerationSpec",
+ "title": "GenerationSpecBase",
"type": "object"
},
- "ImageLayer": {
+ "GenerationSpecRef": {
"additionalProperties": false,
"properties": {
+ "objectType": {
+ "const": "generation_spec",
+ "default": "generation_spec",
+ "description": "Referenced business object type.",
+ "title": "Objecttype",
+ "type": "string"
+ },
"id": {
- "description": "Stable object ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
+ "description": "Referenced generation configuration ID.",
+ "format": "uuid",
"title": "Id",
"type": "string"
+ }
+ },
+ "required": [
+ "id"
+ ],
+ "title": "GenerationSpecRef",
+ "type": "object"
+ },
+ "GenerationSubmit": {
+ "additionalProperties": false,
+ "properties": {
+ "specId": {
+ "description": "Include its current generation_spec revision in expectedVersions.",
+ "format": "uuid",
+ "title": "Specid",
+ "type": "string",
+ "x-version-object-type": "generation_spec"
},
- "name": {
- "description": "User-visible name.",
- "maxLength": 200,
- "title": "Name",
- "type": "string"
+ "expectedSpecRevision": {
+ "description": "Must match the specId revision in expectedVersions.",
+ "minimum": 1,
+ "title": "Expectedspecrevision",
+ "type": "integer"
},
- "visible": {
- "default": true,
- "description": "Whether this object is displayed.",
- "title": "Visible",
- "type": "boolean"
+ "originItemId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "When set, include its current canvas_item revision in expectedVersions.",
+ "title": "Originitemid",
+ "x-version-object-type": "canvas_item"
},
- "locked": {
- "default": false,
- "description": "Whether edits to this object are blocked.",
- "title": "Locked",
- "type": "boolean"
+ "previousJobId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Previous generation attempt ID.",
+ "title": "Previousjobid"
},
- "opacity": {
- "default": 1,
- "description": "Layer opacity from zero to one.",
- "maximum": 1,
- "minimum": 0,
- "title": "Opacity",
- "type": "number"
+ "adoptionPolicy": {
+ "default": "if_current",
+ "description": "Policy for adopting the completed result.",
+ "enum": [
+ "if_current",
+ "candidate_only"
+ ],
+ "title": "Adoptionpolicy",
+ "type": "string"
},
- "x": {
- "default": 0,
- "description": "Horizontal coordinate.",
- "title": "X",
- "type": "number"
+ "batchId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Generation batch ID.",
+ "title": "Batchid"
},
- "y": {
- "default": 0,
- "description": "Vertical coordinate.",
- "title": "Y",
- "type": "number"
+ "showAdditionalResult": {
+ "default": false,
+ "description": "Whether to display an additional result item.",
+ "title": "Showadditionalresult",
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "specId",
+ "expectedSpecRevision"
+ ],
+ "title": "GenerationSubmit",
+ "type": "object"
+ },
+ "GenerationSubmitCommand": {
+ "additionalProperties": false,
+ "description": "Submit a generation job with fixed inputs and an adoption policy.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "generation.submit",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/GenerationSubmit",
+ "description": "Submit a generation job with fixed inputs and an adoption policy."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "payload"
+ ],
+ "title": "GenerationSubmitCommand",
+ "type": "object"
+ },
+ "GroupCanvasItem": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "kind": {
+ "const": "group",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "title": {
+ "default": "",
+ "description": "User-visible title.",
+ "maxLength": 255,
+ "title": "Title",
+ "type": "string"
+ },
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
},
"width": {
+ "default": 352,
"description": "Width in pixels.",
"exclusiveMinimum": 0,
- "maximum": 8192,
"title": "Width",
"type": "number"
},
"height": {
+ "default": 198,
"description": "Height in pixels.",
"exclusiveMinimum": 0,
- "maximum": 8192,
"title": "Height",
"type": "number"
},
- "rotation": {
+ "zIndex": {
"default": 0,
- "description": "Layer rotation in degrees.",
- "title": "Rotation",
- "type": "number"
+ "description": "Canvas stacking order.",
+ "title": "Zindex",
+ "type": "integer"
},
- "flipX": {
+ "locked": {
"default": false,
- "description": "Whether the image is mirrored horizontally.",
- "title": "Flipx",
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
"type": "boolean"
},
- "flipY": {
- "default": false,
- "description": "Whether the image is mirrored vertically.",
- "title": "Flipy",
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
"type": "boolean"
},
- "content": {
- "description": "Editable layer content.",
- "discriminator": {
- "mapping": {
- "image": "#/$defs/ImageLayerContent",
- "rectangle": "#/$defs/RectangleLayerContent",
- "text": "#/$defs/TextLayerContent"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/ImageLayerContent"
- },
+ "parentId": {
+ "anyOf": [
{
- "$ref": "#/$defs/TextLayerContent"
+ "format": "uuid",
+ "type": "string"
},
{
- "$ref": "#/$defs/RectangleLayerContent"
+ "type": "null"
}
],
- "title": "Content"
+ "default": null,
+ "description": "Parent canvas group ID, or null for the root.",
+ "title": "Parentid"
},
- "mask": {
+ "tags": {
"default": [],
- "description": "Ordered strokes or encoded selection mask.",
+ "description": "User-defined search tags.",
"items": {
- "$ref": "#/$defs/MaskStroke"
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
},
- "maxItems": 2000,
- "title": "Mask",
+ "title": "Tags",
"type": "array"
+ },
+ "binding": {
+ "$ref": "#/$defs/ContainerBinding",
+ "description": "Business object displayed by this canvas item."
}
},
"required": [
"id",
- "name",
- "width",
- "height",
- "content"
+ "projectId",
+ "kind"
],
- "title": "ImageLayer",
+ "title": "GroupCanvasItem",
"type": "object"
},
- "ImageLayerContent": {
+ "HistoryRedoCommand": {
"additionalProperties": false,
+ "description": "Reapply an undone command.",
"properties": {
- "width": {
- "description": "Width in pixels.",
- "maximum": 8192,
- "minimum": 1,
- "title": "Width",
- "type": "integer"
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
},
- "height": {
- "description": "Height in pixels.",
- "maximum": 8192,
- "minimum": 1,
- "title": "Height",
- "type": "integer"
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
},
- "kind": {
- "const": "image",
- "description": "Business object or media type.",
- "title": "Kind",
+ "type": {
+ "const": "history.redo",
+ "description": "Command discriminator.",
+ "title": "Type",
"type": "string"
},
- "asset": {
- "$ref": "#/$defs/AssetRef",
- "description": "Immutable asset version."
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/HistoryReplay",
+ "description": "Reapply an undone command."
}
},
"required": [
- "width",
- "height",
- "kind",
- "asset"
- ],
- "title": "ImageLayerContent",
+ "commandId",
+ "projectId",
+ "type",
+ "payload"
+ ],
+ "title": "HistoryRedoCommand",
"type": "object"
},
- "ImageOutput": {
+ "HistoryReplay": {
"additionalProperties": false,
"properties": {
- "aspectRatio": {
- "description": "Output width-to-height ratio.",
- "pattern": "^(?:auto|[1-9]\\d?:[1-9]\\d?)$",
- "title": "Aspectratio",
- "type": "string"
- },
- "size": {
- "description": "Supported image dimensions or size preset.",
- "pattern": "^(?:2K|[1-9]\\d{2,3}x[1-9]\\d{2,3})$",
- "title": "Size",
+ "targetCommandId": {
+ "description": "Historical command to undo or redo.",
+ "format": "uuid",
+ "title": "Targetcommandid",
"type": "string"
}
},
"required": [
- "aspectRatio",
- "size"
+ "targetCommandId"
],
- "title": "ImageOutput",
+ "title": "HistoryReplay",
"type": "object"
},
- "ImageParameters": {
+ "HistoryUndoCommand": {
"additionalProperties": false,
+ "description": "Undo a recorded reversible command.",
"properties": {
- "quality": {
- "default": "auto",
- "description": "Image rendering quality; auto leaves the provider request unchanged.",
- "enum": [
- "auto",
- "low",
- "medium",
- "high"
- ],
- "title": "Quality",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
"type": "string"
},
- "size": {
- "default": "auto",
- "description": "Requested image dimensions or size preset.",
- "pattern": "^(?:auto|2K|[1-9]\\d{2,3}x[1-9]\\d{2,3})$",
- "title": "Size",
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
"type": "string"
},
- "aspectRatio": {
+ "type": {
+ "const": "history.undo",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
"anyOf": [
{
- "pattern": "^[1-9]\\d?:[1-9]\\d?$",
+ "pattern": "^[0-9a-f]{64}$",
"type": "string"
},
{
@@ -6559,287 +7417,414 @@
}
],
"default": null,
- "description": "Output width-to-height ratio.",
- "title": "Aspectratio"
- },
- "preset": {
- "default": "none",
- "description": "Selected generation or motion preset.",
- "enum": [
- "none",
- "product-views"
- ],
- "title": "Preset",
- "type": "string"
- },
- "responseFormat": {
- "const": "url",
- "default": "url",
- "description": "Provider response representation.",
- "title": "Responseformat",
- "type": "string"
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "outputFormat": {
- "const": "png",
- "default": "png",
- "description": "Generated image encoding.",
- "title": "Outputformat",
- "type": "string"
+ "payload": {
+ "$ref": "#/$defs/HistoryReplay",
+ "description": "Undo a recorded reversible command."
}
},
- "title": "ImageParameters",
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "payload"
+ ],
+ "title": "HistoryUndoCommand",
"type": "object"
},
- "InputRules": {
+ "ImageCanvasItem": {
"additionalProperties": false,
"properties": {
- "fractionalDuration": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "kind": {
+ "const": "image",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "title": {
+ "default": "",
+ "description": "User-visible title.",
+ "maxLength": 255,
+ "title": "Title",
+ "type": "string"
+ },
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
+ },
+ "width": {
+ "default": 352,
+ "description": "Width in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Width",
+ "type": "number"
+ },
+ "height": {
+ "default": 198,
+ "description": "Height in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Height",
+ "type": "number"
+ },
+ "zIndex": {
+ "default": 0,
+ "description": "Canvas stacking order.",
+ "title": "Zindex",
+ "type": "integer"
+ },
+ "locked": {
"default": false,
- "description": "Accept fractional video seconds within each output duration range.",
- "title": "Fractionalduration",
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
"type": "boolean"
},
- "profile": {
- "description": "Model capability profile.",
- "maxLength": 100,
- "minLength": 1,
- "title": "Profile",
- "type": "string"
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
},
- "voiceLibrary": {
+ "parentId": {
"anyOf": [
{
- "$ref": "#/$defs/VoiceLibraryCapabilities"
+ "format": "uuid",
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Supported voice registry and adapter requirements; omitted for unsupported models."
+ "description": "Parent canvas group ID, or null for the root.",
+ "title": "Parentid"
},
- "maxPromptCharacters": {
- "anyOf": [
- {
- "minimum": 1,
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Maximum characters in the final prompt including text references.",
- "title": "Maxpromptcharacters"
+ "tags": {
+ "default": [],
+ "description": "User-defined search tags.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Tags",
+ "type": "array"
},
- "voiceRequired": {
- "anyOf": [
- {
- "type": "boolean"
+ "binding": {
+ "description": "Business object displayed by this canvas item.",
+ "discriminator": {
+ "mapping": {
+ "empty": "#/$defs/EmptyBinding",
+ "generation": "#/$defs/GenerationBinding",
+ "material": "#/$defs/MaterialBinding"
},
+ "propertyName": "role"
+ },
+ "oneOf": [
{
- "type": "null"
- }
- ],
- "default": null,
- "description": "Whether speech generation requires an explicit service voice ID.",
- "title": "Voicerequired"
- },
- "defaultVoice": {
- "anyOf": [
+ "$ref": "#/$defs/EmptyBinding"
+ },
{
- "pattern": "^[A-Za-z0-9_.-]{1,64}$",
- "type": "string"
+ "$ref": "#/$defs/MaterialBinding"
},
{
- "type": "null"
+ "$ref": "#/$defs/GenerationBinding"
}
],
- "default": null,
- "description": "Service voice ID applied when a required selection is still empty.",
- "title": "Defaultvoice"
+ "title": "Binding"
},
- "referencesAllowed": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Whether references may be attached, including context-only references.",
- "title": "Referencesallowed"
- },
- "allowedKinds": {
- "description": "Accepted reference media kinds.",
+ "editors": {
+ "default": [],
+ "description": "Attached editable documents.",
"items": {
- "enum": [
- "text",
- "image",
- "video",
- "audio"
- ],
- "type": "string"
+ "$ref": "#/$defs/EditorRef"
},
- "title": "Allowedkinds",
+ "title": "Editors",
"type": "array"
+ }
+ },
+ "required": [
+ "id",
+ "projectId",
+ "kind",
+ "binding"
+ ],
+ "title": "ImageCanvasItem",
+ "type": "object"
+ },
+ "ImageCropData": {
+ "additionalProperties": false,
+ "properties": {
+ "source": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Input source or recorded provenance."
},
- "maxImages": {
- "description": "Maximum reference image count.",
- "minimum": 0,
- "title": "Maximages",
- "type": "integer"
+ "options": {
+ "$ref": "#/$defs/ImageCropOptions",
+ "description": "Non-destructive image crop and color settings."
},
- "maxVideos": {
- "description": "Maximum reference video count.",
- "minimum": 0,
- "title": "Maxvideos",
+ "width": {
+ "description": "Width in pixels.",
+ "minimum": 1,
+ "title": "Width",
"type": "integer"
},
- "maxAudios": {
- "description": "Maximum reference audio count.",
- "minimum": 0,
- "title": "Maxaudios",
+ "height": {
+ "description": "Height in pixels.",
+ "minimum": 1,
+ "title": "Height",
"type": "integer"
+ }
+ },
+ "required": [
+ "source",
+ "options",
+ "width",
+ "height"
+ ],
+ "title": "ImageCropData",
+ "type": "object"
+ },
+ "ImageCropDocument": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
},
- "imageBytes": {
- "description": "Maximum bytes per reference image.",
- "minimum": 0,
- "title": "Imagebytes",
- "type": "integer"
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
},
- "videoBytes": {
- "description": "Maximum bytes per reference video.",
- "minimum": 0,
- "title": "Videobytes",
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
"type": "integer"
},
- "requestBytes": {
- "description": "Maximum aggregate reference bytes per request.",
- "minimum": 0,
- "title": "Requestbytes",
+ "schemaVersion": {
+ "const": 1,
+ "default": 1,
+ "description": "Record schema version.",
+ "title": "Schemaversion",
"type": "integer"
},
- "videoModes": {
- "description": "Supported video generation modes.",
- "items": {
- "enum": [
- "first_frame",
- "reference",
- "continuation"
- ],
- "type": "string"
- },
- "title": "Videomodes",
- "type": "array"
- },
- "imageOutputs": {
+ "inputConnections": {
"default": [],
- "description": "Supported image aspect ratios and sizes.",
+ "description": "Persisted connections to source assets.",
"items": {
- "$ref": "#/$defs/ImageOutput"
+ "$ref": "#/$defs/EditorInputConnection"
},
- "title": "Imageoutputs",
+ "title": "Inputconnections",
"type": "array"
},
- "imageQualities": {
- "anyOf": [
- {
- "items": {
- "enum": [
- "auto",
- "low",
- "medium",
- "high"
- ],
- "type": "string"
- },
- "type": "array"
- },
- {
- "type": "null"
- }
+ "kind": {
+ "const": "image_crop",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "data": {
+ "$ref": "#/$defs/ImageCropData",
+ "description": "Typed editable document contents."
+ }
+ },
+ "required": [
+ "id",
+ "projectId",
+ "kind",
+ "data"
+ ],
+ "title": "ImageCropDocument",
+ "type": "object"
+ },
+ "ImageCropOptions": {
+ "additionalProperties": false,
+ "properties": {
+ "rotation": {
+ "default": 0,
+ "description": "Crop rotation in degrees.",
+ "enum": [
+ 0,
+ 90,
+ 180,
+ 270
],
- "default": null,
- "description": "Supported image rendering qualities; omitted for models without quality control.",
- "title": "Imagequalities"
+ "title": "Rotation",
+ "type": "integer"
},
- "outputResolutions": {
- "default": [],
- "description": "Supported output resolution values.",
- "items": {
- "type": "string"
- },
- "title": "Outputresolutions",
- "type": "array"
+ "flipX": {
+ "default": false,
+ "description": "Whether the image is mirrored horizontally.",
+ "title": "Flipx",
+ "type": "boolean"
},
- "referenceImageResolutions": {
- "anyOf": [
- {
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Supported reference image resolution values.",
- "title": "Referenceimageresolutions"
+ "flipY": {
+ "default": false,
+ "description": "Whether the image is mirrored vertically.",
+ "title": "Flipy",
+ "type": "boolean"
},
- "videoCapabilities": {
- "anyOf": [
- {
- "$ref": "#/$defs/VideoCapabilities"
- },
- {
- "type": "null"
- }
+ "aspect": {
+ "default": "original",
+ "description": "Crop aspect ratio or free crop mode.",
+ "enum": [
+ "free",
+ "original",
+ "1:1",
+ "4:3",
+ "3:4",
+ "16:9",
+ "9:16"
],
- "default": null,
- "description": "Supported video generation capabilities."
+ "title": "Aspect",
+ "type": "string"
},
- "aspectRatios": {
- "anyOf": [
- {
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Supported explicit video output aspect ratios; unset uses existing protocol rules.",
- "title": "Aspectratios"
+ "zoom": {
+ "default": 100,
+ "description": "Crop zoom percentage.",
+ "maximum": 400,
+ "minimum": 100,
+ "title": "Zoom",
+ "type": "number"
},
- "frameRoles": {
+ "freeWidth": {
+ "default": 100,
+ "description": "Free crop width as a percentage.",
+ "maximum": 100,
+ "minimum": 1,
+ "title": "Freewidth",
+ "type": "number"
+ },
+ "freeHeight": {
+ "default": 100,
+ "description": "Free crop height as a percentage.",
+ "maximum": 100,
+ "minimum": 1,
+ "title": "Freeheight",
+ "type": "number"
+ },
+ "x": {
+ "default": 50,
+ "description": "Horizontal crop position percentage.",
+ "maximum": 100,
+ "minimum": 0,
+ "title": "X",
+ "type": "number"
+ },
+ "y": {
+ "default": 50,
+ "description": "Vertical crop position percentage.",
+ "maximum": 100,
+ "minimum": 0,
+ "title": "Y",
+ "type": "number"
+ },
+ "brightness": {
+ "default": 100,
+ "description": "Brightness percentage.",
+ "maximum": 200,
+ "minimum": 0,
+ "title": "Brightness",
+ "type": "number"
+ },
+ "contrast": {
+ "default": 100,
+ "description": "Contrast percentage.",
+ "maximum": 200,
+ "minimum": 0,
+ "title": "Contrast",
+ "type": "number"
+ },
+ "saturation": {
+ "default": 100,
+ "description": "Saturation percentage.",
+ "maximum": 200,
+ "minimum": 0,
+ "title": "Saturation",
+ "type": "number"
+ }
+ },
+ "title": "ImageCropOptions",
+ "type": "object"
+ },
+ "ImageExecution": {
+ "additionalProperties": false,
+ "properties": {
+ "kind": {
+ "const": "image",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "quality": {
+ "default": "auto",
+ "description": "Image rendering quality fixed for this execution; auto omits the provider field.",
+ "enum": [
+ "auto",
+ "low",
+ "medium",
+ "high"
+ ],
+ "title": "Quality",
+ "type": "string"
+ },
+ "size": {
+ "description": "Effective image dimensions sent to the provider.",
+ "title": "Size",
+ "type": "string"
+ },
+ "responseFormat": {
"anyOf": [
{
- "items": {
- "enum": [
- "first_frame",
- "last_frame"
- ],
- "type": "string"
- },
- "type": "array"
+ "enum": [
+ "url",
+ "b64_json"
+ ],
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Supported explicit image frame slots.",
- "title": "Frameroles"
+ "description": "Provider response representation.",
+ "title": "Responseformat"
},
- "audioReferenceStandalone": {
+ "outputFormat": {
+ "const": "png",
+ "default": "png",
+ "description": "Generated image encoding.",
+ "title": "Outputformat",
+ "type": "string"
+ },
+ "watermark": {
"anyOf": [
{
"type": "boolean"
@@ -6849,95 +7834,46 @@
}
],
"default": null,
- "description": "Whether audio-only references are supported.",
- "title": "Audioreferencestandalone"
+ "description": "Whether provider watermarking is enabled.",
+ "title": "Watermark"
},
- "generateAudioOptions": {
+ "numInferenceSteps": {
"anyOf": [
{
- "items": {
- "type": "boolean"
- },
- "maxItems": 2,
- "minItems": 1,
- "type": "array"
+ "minimum": 1,
+ "type": "integer"
},
{
"type": "null"
}
],
"default": null,
- "description": "Allowed generateAudio values; omitted in legacy execution snapshots.",
- "title": "Generateaudiooptions"
- }
- },
- "required": [
- "profile",
- "allowedKinds",
- "maxImages",
- "maxVideos",
- "maxAudios",
- "imageBytes",
- "videoBytes",
- "requestBytes",
- "videoModes"
- ],
- "title": "InputRules",
- "type": "object"
- },
- "InputSnapshot": {
- "additionalProperties": false,
- "description": "Only creative inputs; layout, selection and credentials are excluded.",
- "properties": {
- "spec": {
- "description": "Generation configuration for this operation.",
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioGenerationSpec",
- "image": "#/$defs/ImageGenerationSpec",
- "text": "#/$defs/TextGenerationSpec",
- "video": "#/$defs/VideoGenerationSpec"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TextGenerationSpec"
- },
- {
- "$ref": "#/$defs/ImageGenerationSpec"
- },
+ "description": "Diffusion sampling step count.",
+ "title": "Numinferencesteps"
+ },
+ "guidanceScale": {
+ "anyOf": [
{
- "$ref": "#/$defs/VideoGenerationSpec"
+ "minimum": 0,
+ "type": "number"
},
{
- "$ref": "#/$defs/AudioGenerationSpec"
+ "type": "null"
}
],
- "title": "Spec"
- },
- "model": {
- "$ref": "#/$defs/ModelSnapshot",
- "description": "Fixed model configuration for this execution."
- },
- "references": {
- "default": [],
- "description": "Ordered generation reference bindings.",
- "items": {
- "$ref": "#/$defs/ResolvedReference"
- },
- "title": "References",
- "type": "array"
+ "default": null,
+ "description": "Diffusion guidance scale.",
+ "title": "Guidancescale"
}
},
"required": [
- "spec",
- "model"
+ "kind",
+ "size"
],
- "title": "InputSnapshot",
+ "title": "ImageExecution",
"type": "object"
},
- "Job": {
+ "ImageGenerationSpec": {
"additionalProperties": false,
"properties": {
"id": {
@@ -6959,17 +7895,20 @@
"title": "Revision",
"type": "integer"
},
- "schemaVersion": {
- "const": 1,
- "default": 1,
- "description": "Record schema version.",
- "title": "Schemaversion",
- "type": "integer"
+ "purpose": {
+ "default": "draft",
+ "description": "Draft settings or executable generation configuration.",
+ "enum": [
+ "draft",
+ "generation"
+ ],
+ "title": "Purpose",
+ "type": "string"
},
- "createdAt": {
+ "modelConfigId": {
"anyOf": [
{
- "format": "date-time",
+ "format": "uuid",
"type": "string"
},
{
@@ -6977,209 +7916,290 @@
}
],
"default": null,
- "description": "Execution acceptance timestamp.",
- "title": "Createdat"
- },
- "inputSnapshot": {
- "$ref": "#/$defs/InputSnapshot",
- "description": "Fixed generation inputs accepted for this execution."
+ "description": "Model configuration ID from the model catalog or user model selections.",
+ "title": "Modelconfigid"
},
- "inputFingerprint": {
- "description": "Fingerprint of the fixed execution input.",
- "pattern": "^[0-9a-f]{64}$",
- "title": "Inputfingerprint",
+ "prompt": {
+ "default": "",
+ "description": "Generation prompt text.",
+ "maxLength": 20000,
+ "title": "Prompt",
"type": "string"
},
- "execution": {
- "description": "Fixed effective parameters submitted to the provider.",
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioExecution",
- "image": "#/$defs/ImageExecution",
- "text": "#/$defs/TextExecution",
- "video": "#/$defs/VideoExecution"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TextExecution"
- },
- {
- "$ref": "#/$defs/ImageExecution"
- },
- {
- "$ref": "#/$defs/VideoExecution"
- },
- {
- "$ref": "#/$defs/AudioExecution"
- }
- ],
- "title": "Execution"
- },
- "status": {
- "default": "queued",
- "description": "Current operation lifecycle state.",
- "enum": [
- "queued",
- "running",
- "succeeded",
- "failed",
- "cancelled",
- "interrupted"
- ],
- "title": "Status",
- "type": "string"
- },
- "phase": {
- "default": "queued",
- "description": "Current execution phase.",
- "enum": [
- "queued",
- "prepare",
- "submit",
- "poll",
- "download",
- "check",
- "save",
- "adopt",
- "complete"
- ],
- "title": "Phase",
- "type": "string"
- },
- "externalTaskId": {
+ "promptContent": {
"anyOf": [
{
- "maxLength": 200,
- "minLength": 1,
- "type": "string"
+ "items": {
+ "discriminator": {
+ "mapping": {
+ "reference": "#/$defs/PromptReference",
+ "text": "#/$defs/PromptText"
+ },
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/PromptText"
+ },
+ {
+ "$ref": "#/$defs/PromptReference"
+ }
+ ]
+ },
+ "type": "array"
},
{
"type": "null"
}
],
"default": null,
- "description": "Provider task ID for polling or recovery.",
- "title": "Externaltaskid"
+ "description": "Structured prompt text and reference tokens.",
+ "title": "Promptcontent"
},
- "asset": {
+ "currentResultId": {
"anyOf": [
{
- "$ref": "#/$defs/AssetRef"
+ "format": "uuid",
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Immutable asset version."
+ "description": "Currently adopted result ID.",
+ "title": "Currentresultid"
},
- "errorDetails": {
- "anyOf": [
- {
- "$ref": "#/$defs/GenerationFailure"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Structured execution failure, if any."
+ "kind": {
+ "const": "image",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
},
- "recovery": {
- "default": "submit",
- "description": "Available recovery strategy for this execution.",
- "enum": [
- "submit",
- "remote",
- "download",
- "local",
- "review",
- "retry",
- "done"
- ],
- "title": "Recovery",
+ "parameters": {
+ "$ref": "#/$defs/ImageParameters",
+ "description": "Typed generation or editing parameters."
+ }
+ },
+ "required": [
+ "id",
+ "projectId",
+ "kind"
+ ],
+ "title": "ImageGenerationSpec",
+ "type": "object"
+ },
+ "ImageLayer": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable object ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
"type": "string"
},
- "resumeAllowed": {
+ "name": {
+ "description": "User-visible name.",
+ "maxLength": 200,
+ "title": "Name",
+ "type": "string"
+ },
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
+ },
+ "locked": {
"default": false,
- "description": "Whether the existing execution can be resumed.",
- "title": "Resumeallowed",
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
"type": "boolean"
},
- "cancelRequested": {
+ "opacity": {
+ "default": 1,
+ "description": "Layer opacity from zero to one.",
+ "maximum": 1,
+ "minimum": 0,
+ "title": "Opacity",
+ "type": "number"
+ },
+ "x": {
+ "default": 0,
+ "description": "Horizontal coordinate.",
+ "title": "X",
+ "type": "number"
+ },
+ "y": {
+ "default": 0,
+ "description": "Vertical coordinate.",
+ "title": "Y",
+ "type": "number"
+ },
+ "width": {
+ "description": "Width in pixels.",
+ "exclusiveMinimum": 0,
+ "maximum": 8192,
+ "title": "Width",
+ "type": "number"
+ },
+ "height": {
+ "description": "Height in pixels.",
+ "exclusiveMinimum": 0,
+ "maximum": 8192,
+ "title": "Height",
+ "type": "number"
+ },
+ "rotation": {
+ "default": 0,
+ "description": "Layer rotation in degrees.",
+ "title": "Rotation",
+ "type": "number"
+ },
+ "flipX": {
"default": false,
- "description": "Whether cancellation was requested locally.",
- "title": "Cancelrequested",
+ "description": "Whether the image is mirrored horizontally.",
+ "title": "Flipx",
"type": "boolean"
},
- "remoteCancellation": {
- "default": "not_requested",
- "description": "Provider cancellation confirmation state.",
- "enum": [
- "not_requested",
- "requested",
- "confirmed",
- "unknown"
- ],
- "title": "Remotecancellation",
- "type": "string"
+ "flipY": {
+ "default": false,
+ "description": "Whether the image is mirrored vertically.",
+ "title": "Flipy",
+ "type": "boolean"
},
- "originItemId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
+ "content": {
+ "description": "Editable layer content.",
+ "discriminator": {
+ "mapping": {
+ "image": "#/$defs/ImageLayerContent",
+ "rectangle": "#/$defs/RectangleLayerContent",
+ "text": "#/$defs/TextLayerContent"
},
+ "propertyName": "kind"
+ },
+ "oneOf": [
{
- "type": "null"
- }
- ],
- "default": null,
- "description": "Originating canvas item ID.",
- "title": "Originitemid"
- },
- "previousJobId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
+ "$ref": "#/$defs/ImageLayerContent"
},
{
- "type": "null"
- }
- ],
- "default": null,
- "description": "Previous generation attempt ID.",
- "title": "Previousjobid"
- },
- "technicalCheck": {
- "anyOf": [
- {
- "$ref": "#/$defs/ResultCheck"
+ "$ref": "#/$defs/TextLayerContent"
},
{
- "type": "null"
+ "$ref": "#/$defs/RectangleLayerContent"
}
],
- "default": null,
- "description": "Technical validation outcome for the generated asset."
+ "title": "Content"
},
- "adoptionPolicy": {
- "default": "if_current",
- "description": "Policy for adopting the completed result.",
+ "mask": {
+ "default": [],
+ "description": "Ordered strokes or encoded selection mask.",
+ "items": {
+ "$ref": "#/$defs/MaskStroke"
+ },
+ "maxItems": 2000,
+ "title": "Mask",
+ "type": "array"
+ }
+ },
+ "required": [
+ "id",
+ "name",
+ "width",
+ "height",
+ "content"
+ ],
+ "title": "ImageLayer",
+ "type": "object"
+ },
+ "ImageLayerContent": {
+ "additionalProperties": false,
+ "properties": {
+ "width": {
+ "description": "Width in pixels.",
+ "maximum": 8192,
+ "minimum": 1,
+ "title": "Width",
+ "type": "integer"
+ },
+ "height": {
+ "description": "Height in pixels.",
+ "maximum": 8192,
+ "minimum": 1,
+ "title": "Height",
+ "type": "integer"
+ },
+ "kind": {
+ "const": "image",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "asset": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Immutable asset version."
+ }
+ },
+ "required": [
+ "width",
+ "height",
+ "kind",
+ "asset"
+ ],
+ "title": "ImageLayerContent",
+ "type": "object"
+ },
+ "ImageOutput": {
+ "additionalProperties": false,
+ "properties": {
+ "aspectRatio": {
+ "description": "Output width-to-height ratio.",
+ "pattern": "^(?:auto|[1-9]\\d?:[1-9]\\d?)$",
+ "title": "Aspectratio",
+ "type": "string"
+ },
+ "size": {
+ "description": "Supported image dimensions or size preset.",
+ "pattern": "^(?:2K|[1-9]\\d{2,3}x[1-9]\\d{2,3})$",
+ "title": "Size",
+ "type": "string"
+ }
+ },
+ "required": [
+ "aspectRatio",
+ "size"
+ ],
+ "title": "ImageOutput",
+ "type": "object"
+ },
+ "ImageParameters": {
+ "additionalProperties": false,
+ "properties": {
+ "quality": {
+ "default": "auto",
+ "description": "Image rendering quality; auto leaves the provider request unchanged.",
"enum": [
- "if_current",
- "candidate_only"
+ "auto",
+ "low",
+ "medium",
+ "high"
],
- "title": "Adoptionpolicy",
+ "title": "Quality",
"type": "string"
},
- "batchId": {
+ "size": {
+ "default": "auto",
+ "description": "Requested image dimensions or size preset.",
+ "pattern": "^(?:auto|2K|[1-9]\\d{2,3}x[1-9]\\d{2,3})$",
+ "title": "Size",
+ "type": "string"
+ },
+ "aspectRatio": {
"anyOf": [
{
- "format": "uuid",
+ "pattern": "^[1-9]\\d?:[1-9]\\d?$",
"type": "string"
},
{
@@ -7187,101 +8207,96 @@
}
],
"default": null,
- "description": "Generation batch ID.",
- "title": "Batchid"
+ "description": "Output width-to-height ratio.",
+ "title": "Aspectratio"
},
- "showAdditionalResult": {
+ "preset": {
+ "default": "none",
+ "description": "Selected generation or motion preset.",
+ "enum": [
+ "none",
+ "product-views"
+ ],
+ "title": "Preset",
+ "type": "string"
+ },
+ "responseFormat": {
+ "const": "url",
+ "default": "url",
+ "description": "Provider response representation.",
+ "title": "Responseformat",
+ "type": "string"
+ },
+ "outputFormat": {
+ "const": "png",
+ "default": "png",
+ "description": "Generated image encoding.",
+ "title": "Outputformat",
+ "type": "string"
+ }
+ },
+ "title": "ImageParameters",
+ "type": "object"
+ },
+ "InputRules": {
+ "additionalProperties": false,
+ "properties": {
+ "fractionalDuration": {
"default": false,
- "description": "Whether to display an additional result item.",
- "title": "Showadditionalresult",
+ "description": "Accept fractional video seconds within each output duration range.",
+ "title": "Fractionalduration",
"type": "boolean"
},
- "adoptionResultId": {
+ "profile": {
+ "description": "Model capability profile.",
+ "maxLength": 100,
+ "minLength": 1,
+ "title": "Profile",
+ "type": "string"
+ },
+ "voiceLibrary": {
"anyOf": [
{
- "format": "uuid",
- "type": "string"
+ "$ref": "#/$defs/VoiceLibraryCapabilities"
},
{
"type": "null"
}
],
"default": null,
- "description": "Result ID reserved for adoption.",
- "title": "Adoptionresultid"
+ "description": "Supported voice registry and adapter requirements; omitted for unsupported models."
},
- "adoptionMaterial": {
+ "maxPromptCharacters": {
"anyOf": [
{
- "$ref": "#/$defs/AssetRef"
+ "minimum": 1,
+ "type": "integer"
},
{
"type": "null"
}
],
"default": null,
- "description": "Material version reserved for adoption."
- },
- "adopted": {
- "default": false,
- "description": "Whether the generated result was adopted.",
- "title": "Adopted",
- "type": "boolean"
- },
- "adapterParameters": {
- "additionalProperties": {
- "$ref": "#/$defs/JsonValue"
- },
- "description": "Fixed provider-specific execution parameters.",
- "title": "Adapterparameters",
- "type": "object"
- }
- },
- "required": [
- "id",
- "projectId",
- "inputSnapshot",
- "inputFingerprint",
- "execution"
- ],
- "title": "Job",
- "type": "object"
- },
- "JobCancelCommand": {
- "additionalProperties": false,
- "description": "Request cancellation of an existing job.",
- "properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
- },
- "type": {
- "const": "job.cancel",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
+ "description": "Maximum characters in the final prompt including text references.",
+ "title": "Maxpromptcharacters"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
+ "voiceRequired": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether speech generation requires an explicit service voice ID.",
+ "title": "Voicerequired"
},
- "expectedPreview": {
+ "defaultVoice": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
+ "pattern": "^[A-Za-z0-9_.-]{1,64}$",
"type": "string"
},
{
@@ -7289,240 +8304,288 @@
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "description": "Service voice ID applied when a required selection is still empty.",
+ "title": "Defaultvoice"
},
- "payload": {
- "$ref": "#/$defs/JobControl",
- "description": "Request cancellation of an existing job."
- }
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "payload"
- ],
- "title": "JobCancelCommand",
- "type": "object"
- },
- "JobCheckpoint": {
- "additionalProperties": false,
- "properties": {
- "job": {
- "$ref": "#/$defs/Job",
- "description": "Generation execution record."
- }
- },
- "required": [
- "job"
- ],
- "title": "JobCheckpoint",
- "type": "object"
- },
- "JobCheckpointCommand": {
- "additionalProperties": false,
- "description": "Persist a job execution checkpoint.",
- "properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
+ "referencesAllowed": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether references may be attached, including context-only references.",
+ "title": "Referencesallowed"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "allowedKinds": {
+ "description": "Accepted reference media kinds.",
+ "items": {
+ "enum": [
+ "text",
+ "image",
+ "video",
+ "audio"
+ ],
+ "type": "string"
+ },
+ "title": "Allowedkinds",
+ "type": "array"
},
- "type": {
- "const": "job.checkpoint",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
+ "maxImages": {
+ "description": "Maximum reference image count.",
+ "minimum": 0,
+ "title": "Maximages",
+ "type": "integer"
},
- "expectedVersions": {
+ "maxVideos": {
+ "description": "Maximum reference video count.",
+ "minimum": 0,
+ "title": "Maxvideos",
+ "type": "integer"
+ },
+ "maxAudios": {
+ "description": "Maximum reference audio count.",
+ "minimum": 0,
+ "title": "Maxaudios",
+ "type": "integer"
+ },
+ "imageBytes": {
+ "description": "Maximum bytes per reference image.",
+ "minimum": 0,
+ "title": "Imagebytes",
+ "type": "integer"
+ },
+ "videoBytes": {
+ "description": "Maximum bytes per reference video.",
+ "minimum": 0,
+ "title": "Videobytes",
+ "type": "integer"
+ },
+ "requestBytes": {
+ "description": "Maximum aggregate reference bytes per request.",
+ "minimum": 0,
+ "title": "Requestbytes",
+ "type": "integer"
+ },
+ "videoModes": {
+ "description": "Supported video generation modes.",
+ "items": {
+ "enum": [
+ "first_frame",
+ "reference",
+ "continuation"
+ ],
+ "type": "string"
+ },
+ "title": "Videomodes",
+ "type": "array"
+ },
+ "imageOutputs": {
"default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "description": "Supported image aspect ratios and sizes.",
"items": {
- "$ref": "#/$defs/ObjectVersion"
+ "$ref": "#/$defs/ImageOutput"
},
- "title": "Expectedversions",
+ "title": "Imageoutputs",
"type": "array"
},
- "expectedPreview": {
+ "imageQualities": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
+ "items": {
+ "enum": [
+ "auto",
+ "low",
+ "medium",
+ "high"
+ ],
+ "type": "string"
+ },
+ "type": "array"
},
{
"type": "null"
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
- },
- "payload": {
- "$ref": "#/$defs/JobCheckpoint",
- "description": "Persist a job execution checkpoint."
- }
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "payload"
- ],
- "title": "JobCheckpointCommand",
- "type": "object"
- },
- "JobControl": {
- "additionalProperties": false,
- "properties": {
- "jobId": {
- "description": "Generation job ID.",
- "format": "uuid",
- "title": "Jobid",
- "type": "string"
- }
- },
- "required": [
- "jobId"
- ],
- "title": "JobControl",
- "type": "object"
- },
- "JobRecoverCommand": {
- "additionalProperties": false,
- "description": "Recover an existing job without creating a new attempt.",
- "properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
- },
- "type": {
- "const": "job.recover",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
+ "description": "Supported image rendering qualities; omitted for models without quality control.",
+ "title": "Imagequalities"
},
- "expectedVersions": {
+ "outputResolutions": {
"default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "description": "Supported output resolution values.",
"items": {
- "$ref": "#/$defs/ObjectVersion"
+ "type": "string"
},
- "title": "Expectedversions",
+ "title": "Outputresolutions",
"type": "array"
},
- "expectedPreview": {
+ "referenceImageResolutions": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
},
{
"type": "null"
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "description": "Supported reference image resolution values.",
+ "title": "Referenceimageresolutions"
},
- "payload": {
- "$ref": "#/$defs/JobControl",
- "description": "Recover an existing job without creating a new attempt."
- }
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "payload"
- ],
- "title": "JobRecoverCommand",
- "type": "object"
- },
- "JsonValue": {},
- "LayerContentBase": {
- "additionalProperties": false,
- "properties": {
- "width": {
- "description": "Width in pixels.",
- "maximum": 8192,
- "minimum": 1,
- "title": "Width",
- "type": "integer"
+ "videoCapabilities": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/VideoCapabilities"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Supported video generation capabilities."
},
- "height": {
- "description": "Height in pixels.",
- "maximum": 8192,
- "minimum": 1,
- "title": "Height",
- "type": "integer"
- }
- },
+ "aspectRatios": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Supported explicit video output aspect ratios; unset uses existing protocol rules.",
+ "title": "Aspectratios"
+ },
+ "frameRoles": {
+ "anyOf": [
+ {
+ "items": {
+ "enum": [
+ "first_frame",
+ "last_frame"
+ ],
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Supported explicit image frame slots.",
+ "title": "Frameroles"
+ },
+ "audioReferenceStandalone": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether audio-only references are supported.",
+ "title": "Audioreferencestandalone"
+ },
+ "generateAudioOptions": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "boolean"
+ },
+ "maxItems": 2,
+ "minItems": 1,
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Allowed generateAudio values; omitted in legacy execution snapshots.",
+ "title": "Generateaudiooptions"
+ }
+ },
"required": [
- "width",
- "height"
+ "profile",
+ "allowedKinds",
+ "maxImages",
+ "maxVideos",
+ "maxAudios",
+ "imageBytes",
+ "videoBytes",
+ "requestBytes",
+ "videoModes"
],
- "title": "LayerContentBase",
+ "title": "InputRules",
"type": "object"
},
- "LayerData": {
+ "InputSnapshot": {
"additionalProperties": false,
+ "description": "Only creative inputs; layout, selection and credentials are excluded.",
"properties": {
- "width": {
- "description": "Width in pixels.",
- "maximum": 8192,
- "minimum": 1,
- "title": "Width",
- "type": "integer"
- },
- "height": {
- "description": "Height in pixels.",
- "maximum": 8192,
- "minimum": 1,
- "title": "Height",
- "type": "integer"
+ "spec": {
+ "description": "Generation configuration for this operation.",
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioGenerationSpec",
+ "image": "#/$defs/ImageGenerationSpec",
+ "text": "#/$defs/TextGenerationSpec",
+ "video": "#/$defs/VideoGenerationSpec"
+ },
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TextGenerationSpec"
+ },
+ {
+ "$ref": "#/$defs/ImageGenerationSpec"
+ },
+ {
+ "$ref": "#/$defs/VideoGenerationSpec"
+ },
+ {
+ "$ref": "#/$defs/AudioGenerationSpec"
+ }
+ ],
+ "title": "Spec"
},
- "background": {
- "default": "transparent",
- "description": "Composition background color.",
- "pattern": "^(transparent|#[0-9a-fA-F]{6})$",
- "title": "Background",
- "type": "string"
+ "model": {
+ "$ref": "#/$defs/ModelSnapshot",
+ "description": "Fixed model configuration for this execution."
},
- "layers": {
+ "references": {
"default": [],
- "description": "Ordered editable image layers.",
+ "description": "Ordered generation reference bindings.",
"items": {
- "$ref": "#/$defs/ImageLayer"
+ "$ref": "#/$defs/ResolvedReference"
},
- "maxItems": 40,
- "title": "Layers",
+ "title": "References",
"type": "array"
}
},
"required": [
- "width",
- "height"
+ "spec",
+ "model"
],
- "title": "LayerData",
+ "title": "InputSnapshot",
"type": "object"
},
- "LayerDocument": {
+ "Job": {
"additionalProperties": false,
"properties": {
"id": {
@@ -7551,179 +8614,167 @@
"title": "Schemaversion",
"type": "integer"
},
- "inputConnections": {
- "default": [],
- "description": "Persisted connections to source assets.",
- "items": {
- "$ref": "#/$defs/EditorInputConnection"
+ "createdAt": {
+ "anyOf": [
+ {
+ "format": "date-time",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Execution acceptance timestamp.",
+ "title": "Createdat"
+ },
+ "inputSnapshot": {
+ "$ref": "#/$defs/InputSnapshot",
+ "description": "Fixed generation inputs accepted for this execution."
+ },
+ "inputFingerprint": {
+ "description": "Fingerprint of the fixed execution input.",
+ "pattern": "^[0-9a-f]{64}$",
+ "title": "Inputfingerprint",
+ "type": "string"
+ },
+ "execution": {
+ "description": "Fixed effective parameters submitted to the provider.",
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioExecution",
+ "image": "#/$defs/ImageExecution",
+ "text": "#/$defs/TextExecution",
+ "video": "#/$defs/VideoExecution"
+ },
+ "propertyName": "kind"
},
- "title": "Inputconnections",
- "type": "array"
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TextExecution"
+ },
+ {
+ "$ref": "#/$defs/ImageExecution"
+ },
+ {
+ "$ref": "#/$defs/VideoExecution"
+ },
+ {
+ "$ref": "#/$defs/AudioExecution"
+ }
+ ],
+ "title": "Execution"
},
- "kind": {
- "const": "layers",
- "description": "Business object or media type.",
- "title": "Kind",
+ "status": {
+ "default": "queued",
+ "description": "Current operation lifecycle state.",
+ "enum": [
+ "queued",
+ "running",
+ "succeeded",
+ "failed",
+ "cancelled",
+ "interrupted"
+ ],
+ "title": "Status",
"type": "string"
},
- "data": {
- "$ref": "#/$defs/LayerData",
- "description": "Typed editable document contents."
- }
- },
- "required": [
- "id",
- "projectId",
- "kind",
- "data"
- ],
- "title": "LayerDocument",
- "type": "object"
- },
- "MaskStroke": {
- "additionalProperties": false,
- "properties": {
- "mode": {
- "description": "Operation mode within this contract variant.",
+ "phase": {
+ "default": "queued",
+ "description": "Current execution phase.",
"enum": [
- "erase",
- "restore"
+ "queued",
+ "prepare",
+ "submit",
+ "poll",
+ "download",
+ "check",
+ "save",
+ "adopt",
+ "complete"
],
- "title": "Mode",
+ "title": "Phase",
"type": "string"
},
- "size": {
- "description": "Mask brush diameter in pixels.",
- "maximum": 4096,
- "minimum": 1,
- "title": "Size",
- "type": "number"
- },
- "points": {
- "description": "Ordered mask stroke coordinates.",
- "items": {
- "$ref": "#/$defs/Point"
- },
- "maxItems": 200000,
- "minItems": 1,
- "title": "Points",
- "type": "array"
- }
- },
- "required": [
- "mode",
- "size",
- "points"
- ],
- "title": "MaskStroke",
- "type": "object"
- },
- "MaterialBinding": {
- "additionalProperties": false,
- "description": "Displays a registered project asset through objectRef.",
- "properties": {
- "role": {
- "const": "material",
- "description": "Business role of this binding or reference.",
- "title": "Role",
- "type": "string"
- },
- "objectRef": {
- "$ref": "#/$defs/AssetRef",
- "description": "Stable reference to the bound business object."
- }
- },
- "required": [
- "role",
- "objectRef"
- ],
- "title": "MaterialBinding",
- "type": "object"
- },
- "MediaCanvasItem": {
- "additionalProperties": false,
- "properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
- "format": "uuid",
- "title": "Id",
- "type": "string"
+ "externalTaskId": {
+ "anyOf": [
+ {
+ "maxLength": 200,
+ "minLength": 1,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Provider task ID for polling or recovery.",
+ "title": "Externaltaskid"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "asset": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AssetRef"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Immutable asset version."
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
+ "errorDetails": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/GenerationFailure"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Structured execution failure, if any."
},
- "kind": {
- "description": "Business object or media type.",
+ "recovery": {
+ "default": "submit",
+ "description": "Available recovery strategy for this execution.",
"enum": [
- "text",
- "image",
- "video",
- "audio",
- "file",
- "group",
- "timeline",
- "subject",
- "stack",
- "tool",
- "external"
+ "submit",
+ "remote",
+ "download",
+ "local",
+ "review",
+ "retry",
+ "done"
],
- "title": "Kind",
- "type": "string"
- },
- "title": {
- "default": "",
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
+ "title": "Recovery",
"type": "string"
},
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
- },
- "width": {
- "default": 352,
- "description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "title": "Width",
- "type": "number"
- },
- "height": {
- "default": 198,
- "description": "Height in pixels.",
- "exclusiveMinimum": 0,
- "title": "Height",
- "type": "number"
- },
- "zIndex": {
- "default": 0,
- "description": "Canvas stacking order.",
- "title": "Zindex",
- "type": "integer"
- },
- "locked": {
+ "resumeAllowed": {
"default": false,
- "description": "Whether edits to this object are blocked.",
- "title": "Locked",
+ "description": "Whether the existing execution can be resumed.",
+ "title": "Resumeallowed",
"type": "boolean"
},
- "visible": {
- "default": true,
- "description": "Whether this object is displayed.",
- "title": "Visible",
+ "cancelRequested": {
+ "default": false,
+ "description": "Whether cancellation was requested locally.",
+ "title": "Cancelrequested",
"type": "boolean"
},
- "parentId": {
+ "remoteCancellation": {
+ "default": "not_requested",
+ "description": "Provider cancellation confirmation state.",
+ "enum": [
+ "not_requested",
+ "requested",
+ "confirmed",
+ "unknown"
+ ],
+ "title": "Remotecancellation",
+ "type": "string"
+ },
+ "originItemId": {
"anyOf": [
{
"format": "uuid",
@@ -7734,180 +8785,124 @@
}
],
"default": null,
- "description": "Parent canvas group ID, or null for the root.",
- "title": "Parentid"
- },
- "tags": {
- "default": [],
- "description": "User-defined search tags.",
- "items": {
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "type": "string"
- },
- "title": "Tags",
- "type": "array"
+ "description": "Originating canvas item ID.",
+ "title": "Originitemid"
},
- "binding": {
- "description": "Business object displayed by this canvas item.",
- "discriminator": {
- "mapping": {
- "empty": "#/$defs/EmptyBinding",
- "generation": "#/$defs/GenerationBinding",
- "material": "#/$defs/MaterialBinding"
- },
- "propertyName": "role"
- },
- "oneOf": [
+ "previousJobId": {
+ "anyOf": [
{
- "$ref": "#/$defs/EmptyBinding"
+ "format": "uuid",
+ "type": "string"
},
{
- "$ref": "#/$defs/MaterialBinding"
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Previous generation attempt ID.",
+ "title": "Previousjobid"
+ },
+ "technicalCheck": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/ResultCheck"
},
{
- "$ref": "#/$defs/GenerationBinding"
+ "type": "null"
}
],
- "title": "Binding"
+ "default": null,
+ "description": "Technical validation outcome for the generated asset."
},
- "editors": {
- "default": [],
- "description": "Attached editable documents.",
- "items": {
- "$ref": "#/$defs/EditorRef"
- },
- "title": "Editors",
- "type": "array"
- }
- },
- "required": [
- "id",
- "projectId",
- "kind",
- "binding"
- ],
- "title": "MediaCanvasItem",
- "type": "object"
- },
- "MediaEditData": {
- "additionalProperties": false,
- "properties": {
- "tool": {
- "description": "Registered editing tool name.",
+ "adoptionPolicy": {
+ "default": "if_current",
+ "description": "Policy for adopting the completed result.",
"enum": [
- "layers",
- "crop",
- "smart-edit",
- "outpaint",
- "cutout",
- "inpainting-remove",
- "image-hd",
- "view-control",
- "lighting",
- "layer-decompose",
- "panorama",
- "product-replacement",
- "multi-size",
- "dynamic-poster",
- "ecommerce-main",
- "image-presets",
- "grid-split",
- "composition",
- "annotation",
- "video-edit",
- "video-extend",
- "video-partial-reshoot",
- "video-upscale",
- "video-frame-interpolation",
- "video-depth-capture",
- "video-subtitle-erasure",
- "video-matting",
- "video-crop",
- "video-translation",
- "extract-audio",
- "audio-separation",
- "video-trim",
- "audio-trim",
- "video-frame-capture",
- "director-stage"
+ "if_current",
+ "candidate_only"
],
- "title": "Tool",
+ "title": "Adoptionpolicy",
"type": "string"
},
- "sources": {
- "default": [],
- "description": "Ordered source asset versions.",
- "items": {
- "$ref": "#/$defs/AssetRef"
- },
- "title": "Sources",
- "type": "array"
+ "batchId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Generation batch ID.",
+ "title": "Batchid"
},
- "sourceItems": {
- "default": [],
- "description": "Source canvas item IDs.",
- "items": {
- "format": "uuid",
- "type": "string"
- },
- "title": "Sourceitems",
- "type": "array"
+ "showAdditionalResult": {
+ "default": false,
+ "description": "Whether to display an additional result item.",
+ "title": "Showadditionalresult",
+ "type": "boolean"
},
- "parameters": {
- "additionalProperties": {
- "anyOf": [
- {
- "maxLength": 100000,
- "type": "string"
- },
- {
- "type": "boolean"
- },
- {
- "type": "integer"
- },
- {
- "type": "number"
- }
- ]
- },
- "description": "Typed generation or editing parameters.",
- "maxProperties": 100,
- "propertyNames": {
- "maxLength": 100,
- "minLength": 1
- },
- "title": "Parameters",
- "type": "object"
+ "adoptionResultId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Result ID reserved for adoption.",
+ "title": "Adoptionresultid"
},
- "selection": {
+ "adoptionMaterial": {
"anyOf": [
{
- "$ref": "#/$defs/ToolSelection"
+ "$ref": "#/$defs/AssetRef"
},
{
"type": "null"
}
],
"default": null,
- "description": "Saved source selection for this edit."
+ "description": "Material version reserved for adoption."
+ },
+ "adopted": {
+ "default": false,
+ "description": "Whether the generated result was adopted.",
+ "title": "Adopted",
+ "type": "boolean"
+ },
+ "adapterParameters": {
+ "additionalProperties": {
+ "$ref": "#/$defs/JsonValue"
+ },
+ "description": "Fixed provider-specific execution parameters.",
+ "title": "Adapterparameters",
+ "type": "object"
}
},
"required": [
- "tool"
+ "id",
+ "projectId",
+ "inputSnapshot",
+ "inputFingerprint",
+ "execution"
],
- "title": "MediaEditData",
+ "title": "Job",
"type": "object"
},
- "MediaEditDocument": {
+ "JobCancelCommand": {
"additionalProperties": false,
+ "description": "Request cancellation of an existing job.",
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
"format": "uuid",
- "title": "Id",
+ "title": "Commandid",
"type": "string"
},
"projectId": {
@@ -7916,879 +8911,867 @@
"title": "Projectid",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "schemaVersion": {
- "const": 1,
- "default": 1,
- "description": "Record schema version.",
- "title": "Schemaversion",
- "type": "integer"
+ "type": {
+ "const": "job.cancel",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
},
- "inputConnections": {
+ "expectedVersions": {
"default": [],
- "description": "Persisted connections to source assets.",
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
"items": {
- "$ref": "#/$defs/EditorInputConnection"
+ "$ref": "#/$defs/ObjectVersion"
},
- "title": "Inputconnections",
+ "title": "Expectedversions",
"type": "array"
},
- "kind": {
- "const": "media_edit",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "data": {
- "$ref": "#/$defs/MediaEditData",
- "description": "Typed editable document contents."
+ "payload": {
+ "$ref": "#/$defs/JobControl",
+ "description": "Request cancellation of an existing job."
}
},
"required": [
- "id",
+ "commandId",
"projectId",
- "kind",
- "data"
+ "type",
+ "payload"
],
- "title": "MediaEditDocument",
+ "title": "JobCancelCommand",
"type": "object"
},
- "MediaMetadata": {
+ "JobCheckpoint": {
"additionalProperties": false,
"properties": {
- "mimeType": {
- "description": "Verified media MIME type.",
- "maxLength": 255,
- "minLength": 1,
- "title": "Mimetype",
+ "job": {
+ "$ref": "#/$defs/Job",
+ "description": "Generation execution record."
+ }
+ },
+ "required": [
+ "job"
+ ],
+ "title": "JobCheckpoint",
+ "type": "object"
+ },
+ "JobCheckpointCommand": {
+ "additionalProperties": false,
+ "description": "Persist a job execution checkpoint.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
"type": "string"
},
- "size": {
- "description": "Content size in bytes.",
- "minimum": 0,
- "title": "Size",
- "type": "integer"
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
},
- "width": {
- "anyOf": [
- {
- "minimum": 1,
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Width in pixels.",
- "title": "Width"
+ "type": {
+ "const": "job.checkpoint",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
},
- "height": {
- "anyOf": [
- {
- "minimum": 1,
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Height in pixels.",
- "title": "Height"
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
},
- "durationSeconds": {
+ "expectedPreview": {
"anyOf": [
{
- "exclusiveMinimum": 0,
- "type": "number"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Duration in seconds.",
- "title": "Durationseconds"
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "frameRate": {
- "anyOf": [
- {
- "exclusiveMinimum": 0,
- "type": "number"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Video frames per second.",
- "title": "Framerate"
+ "payload": {
+ "$ref": "#/$defs/JobCheckpoint",
+ "description": "Persist a job execution checkpoint."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "payload"
+ ],
+ "title": "JobCheckpointCommand",
+ "type": "object"
+ },
+ "JobControl": {
+ "additionalProperties": false,
+ "properties": {
+ "jobId": {
+ "description": "Generation job ID.",
+ "format": "uuid",
+ "title": "Jobid",
+ "type": "string"
+ }
+ },
+ "required": [
+ "jobId"
+ ],
+ "title": "JobControl",
+ "type": "object"
+ },
+ "JobRecoverCommand": {
+ "additionalProperties": false,
+ "description": "Recover an existing job without creating a new attempt.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
},
- "hasAudio": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Whether the media contains an audio stream.",
- "title": "Hasaudio"
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
},
- "sampleRate": {
- "anyOf": [
- {
- "minimum": 1,
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Audio samples per second.",
- "title": "Samplerate"
+ "type": {
+ "const": "job.recover",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
},
- "channels": {
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
"anyOf": [
{
- "minimum": 1,
- "type": "integer"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Audio channel count.",
- "title": "Channels"
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/JobControl",
+ "description": "Recover an existing job without creating a new attempt."
}
},
"required": [
- "mimeType",
- "size"
+ "commandId",
+ "projectId",
+ "type",
+ "payload"
],
- "title": "MediaMetadata",
+ "title": "JobRecoverCommand",
"type": "object"
},
- "MediaPublicationOutput": {
+ "JsonValue": {},
+ "LayerContentBase": {
"additionalProperties": false,
"properties": {
- "itemId": {
- "description": "Canvas item ID.",
- "format": "uuid",
- "title": "Itemid",
- "type": "string"
- },
- "asset": {
- "$ref": "#/$defs/AssetRef",
- "description": "Immutable asset version."
- },
- "title": {
- "description": "User-visible title.",
- "maxLength": 255,
- "minLength": 1,
- "title": "Title",
- "type": "string"
- },
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
- },
"width": {
- "default": 352,
"description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "maximum": 10000,
+ "maximum": 8192,
+ "minimum": 1,
"title": "Width",
- "type": "number"
+ "type": "integer"
},
"height": {
- "default": 198,
"description": "Height in pixels.",
- "exclusiveMinimum": 0,
- "maximum": 10000,
+ "maximum": 8192,
+ "minimum": 1,
"title": "Height",
- "type": "number"
+ "type": "integer"
}
},
"required": [
- "itemId",
- "asset",
- "title"
+ "width",
+ "height"
],
- "title": "MediaPublicationOutput",
+ "title": "LayerContentBase",
"type": "object"
},
- "ModelConfigPublic": {
+ "LayerData": {
"additionalProperties": false,
- "description": "Application-level, never embedded in an editable project's credential data.",
"properties": {
- "kind": {
- "description": "Business object or media type.",
- "enum": [
- "agent",
- "image",
- "video",
- "audio",
- "vision"
- ],
- "title": "Kind",
- "type": "string"
+ "width": {
+ "description": "Width in pixels.",
+ "maximum": 8192,
+ "minimum": 1,
+ "title": "Width",
+ "type": "integer"
},
- "url": {
- "description": "Provider API base URL.",
- "maxLength": 2048,
- "minLength": 1,
- "title": "Url",
- "type": "string"
+ "height": {
+ "description": "Height in pixels.",
+ "maximum": 8192,
+ "minimum": 1,
+ "title": "Height",
+ "type": "integer"
},
- "modelId": {
- "description": "Provider-native model identifier.",
- "maxLength": 200,
- "minLength": 1,
- "title": "Modelid",
+ "background": {
+ "default": "transparent",
+ "description": "Composition background color.",
+ "pattern": "^(transparent|#[0-9a-fA-F]{6})$",
+ "title": "Background",
"type": "string"
},
- "connectionType": {
- "description": "Hosted or local model connection type.",
- "enum": [
- "api",
- "self_hosted"
- ],
- "title": "Connectiontype",
+ "layers": {
+ "default": [],
+ "description": "Ordered editable image layers.",
+ "items": {
+ "$ref": "#/$defs/ImageLayer"
+ },
+ "maxItems": 40,
+ "title": "Layers",
+ "type": "array"
+ }
+ },
+ "required": [
+ "width",
+ "height"
+ ],
+ "title": "LayerData",
+ "type": "object"
+ },
+ "LayerDocument": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
"type": "string"
},
- "protocol": {
- "description": "Provider wire protocol.",
- "enum": [
- "openai",
- "volcengine",
- "bigmodel_video",
- "kling_video",
- "minimax_video_v2",
- "vllm_omni",
- "vllm_omni_segmentation",
- "vllm_omni_music",
- "vllm_omni_depth",
- "vllm_omni_score"
- ],
- "title": "Protocol",
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
"type": "string"
},
- "authMode": {
- "description": "Authentication mode for the provider connection.",
- "enum": [
- "none",
- "bearer"
- ],
- "title": "Authmode",
- "type": "string"
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
},
- "proxyMode": {
- "default": "system",
- "description": "Use the system proxy or connect directly to the model service.",
- "enum": [
- "system",
- "direct"
- ],
- "title": "Proxymode",
- "type": "string"
+ "schemaVersion": {
+ "const": 1,
+ "default": 1,
+ "description": "Record schema version.",
+ "title": "Schemaversion",
+ "type": "integer"
},
- "inputModalities": {
- "anyOf": [
- {
- "items": {
- "enum": [
- "text",
- "image"
- ],
- "type": "string"
- },
- "type": "array"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Supported model input media kinds.",
- "title": "Inputmodalities"
+ "inputConnections": {
+ "default": [],
+ "description": "Persisted connections to source assets.",
+ "items": {
+ "$ref": "#/$defs/EditorInputConnection"
+ },
+ "title": "Inputconnections",
+ "type": "array"
},
- "videoAdapter": {
- "default": "auto",
- "description": "Provider-specific video adapter.",
+ "kind": {
+ "const": "layers",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "data": {
+ "$ref": "#/$defs/LayerData",
+ "description": "Typed editable document contents."
+ }
+ },
+ "required": [
+ "id",
+ "projectId",
+ "kind",
+ "data"
+ ],
+ "title": "LayerDocument",
+ "type": "object"
+ },
+ "MaskStroke": {
+ "additionalProperties": false,
+ "properties": {
+ "mode": {
+ "description": "Operation mode within this contract variant.",
"enum": [
- "auto",
- "fasth3",
- "fasth3_dual",
- "minimax_h3",
- "standard"
+ "erase",
+ "restore"
],
- "title": "Videoadapter",
+ "title": "Mode",
"type": "string"
},
- "videoCapabilities": {
- "anyOf": [
- {
- "$ref": "#/$defs/VideoCapabilities"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Supported video generation capabilities."
+ "size": {
+ "description": "Mask brush diameter in pixels.",
+ "maximum": 4096,
+ "minimum": 1,
+ "title": "Size",
+ "type": "number"
},
- "id": {
- "description": "Stable object ID.",
- "format": "uuid",
- "title": "Id",
+ "points": {
+ "description": "Ordered mask stroke coordinates.",
+ "items": {
+ "$ref": "#/$defs/Point"
+ },
+ "maxItems": 200000,
+ "minItems": 1,
+ "title": "Points",
+ "type": "array"
+ }
+ },
+ "required": [
+ "mode",
+ "size",
+ "points"
+ ],
+ "title": "MaskStroke",
+ "type": "object"
+ },
+ "MaterialBinding": {
+ "additionalProperties": false,
+ "description": "Displays a registered project asset through objectRef.",
+ "properties": {
+ "role": {
+ "const": "material",
+ "description": "Business role of this binding or reference.",
+ "title": "Role",
"type": "string"
},
- "providerId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Shared provider connection ID.",
- "title": "Providerid"
- },
- "inputRules": {
- "$ref": "#/$defs/InputRules",
- "description": "Verified model input limits and output choices."
+ "objectRef": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Stable reference to the bound business object."
}
},
"required": [
- "kind",
- "url",
- "modelId",
- "connectionType",
- "protocol",
- "authMode",
- "id",
- "inputRules"
+ "role",
+ "objectRef"
],
- "title": "ModelConfigPublic",
+ "title": "MaterialBinding",
"type": "object"
},
- "ModelConfigWrite": {
+ "MediaCanvasItem": {
"additionalProperties": false,
- "description": "Only the model-settings write boundary accepts a credential.",
"properties": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
"kind": {
"description": "Business object or media type.",
"enum": [
- "agent",
+ "text",
"image",
"video",
"audio",
- "vision"
+ "file",
+ "group",
+ "timeline",
+ "subject",
+ "stack",
+ "tool",
+ "external"
],
"title": "Kind",
"type": "string"
},
- "url": {
- "description": "Provider API base URL.",
- "maxLength": 2048,
- "minLength": 1,
- "title": "Url",
- "type": "string"
- },
- "modelId": {
- "description": "Provider-native model identifier.",
- "maxLength": 200,
- "minLength": 1,
- "title": "Modelid",
+ "title": {
+ "default": "",
+ "description": "User-visible title.",
+ "maxLength": 255,
+ "title": "Title",
"type": "string"
},
- "connectionType": {
- "description": "Hosted or local model connection type.",
- "enum": [
- "api",
- "self_hosted"
- ],
- "title": "Connectiontype",
- "type": "string"
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
},
- "protocol": {
- "description": "Provider wire protocol.",
- "enum": [
- "openai",
- "volcengine",
- "bigmodel_video",
- "kling_video",
- "minimax_video_v2",
- "vllm_omni",
- "vllm_omni_segmentation",
- "vllm_omni_music",
- "vllm_omni_depth",
- "vllm_omni_score"
- ],
- "title": "Protocol",
- "type": "string"
+ "width": {
+ "default": 352,
+ "description": "Width in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Width",
+ "type": "number"
},
- "authMode": {
- "description": "Authentication mode for the provider connection.",
- "enum": [
- "none",
- "bearer"
- ],
- "title": "Authmode",
- "type": "string"
+ "height": {
+ "default": 198,
+ "description": "Height in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Height",
+ "type": "number"
},
- "proxyMode": {
- "default": "system",
- "description": "Use the system proxy or connect directly to the model service.",
- "enum": [
- "system",
- "direct"
- ],
- "title": "Proxymode",
- "type": "string"
+ "zIndex": {
+ "default": 0,
+ "description": "Canvas stacking order.",
+ "title": "Zindex",
+ "type": "integer"
},
- "inputModalities": {
+ "locked": {
+ "default": false,
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
+ "type": "boolean"
+ },
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
+ },
+ "parentId": {
"anyOf": [
{
- "items": {
- "enum": [
- "text",
- "image"
- ],
- "type": "string"
- },
- "type": "array"
+ "format": "uuid",
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Supported model input media kinds.",
- "title": "Inputmodalities"
+ "description": "Parent canvas group ID, or null for the root.",
+ "title": "Parentid"
},
- "videoAdapter": {
- "default": "auto",
- "description": "Provider-specific video adapter.",
- "enum": [
- "auto",
- "fasth3",
- "fasth3_dual",
- "minimax_h3",
- "standard"
- ],
- "title": "Videoadapter",
- "type": "string"
+ "tags": {
+ "default": [],
+ "description": "User-defined search tags.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Tags",
+ "type": "array"
},
- "videoCapabilities": {
- "anyOf": [
- {
- "$ref": "#/$defs/VideoCapabilities"
+ "binding": {
+ "description": "Business object displayed by this canvas item.",
+ "discriminator": {
+ "mapping": {
+ "empty": "#/$defs/EmptyBinding",
+ "generation": "#/$defs/GenerationBinding",
+ "material": "#/$defs/MaterialBinding"
},
+ "propertyName": "role"
+ },
+ "oneOf": [
{
- "type": "null"
- }
- ],
- "default": null,
- "description": "Supported video generation capabilities."
- },
- "apiKey": {
- "anyOf": [
+ "$ref": "#/$defs/EmptyBinding"
+ },
{
- "format": "password",
- "maxLength": 8192,
- "type": "string",
- "writeOnly": true
+ "$ref": "#/$defs/MaterialBinding"
},
{
- "type": "null"
+ "$ref": "#/$defs/GenerationBinding"
}
],
- "default": null,
- "description": "Provider credential; omitted from public model records.",
- "title": "Apikey"
+ "title": "Binding"
+ },
+ "editors": {
+ "default": [],
+ "description": "Attached editable documents.",
+ "items": {
+ "$ref": "#/$defs/EditorRef"
+ },
+ "title": "Editors",
+ "type": "array"
}
},
"required": [
+ "id",
+ "projectId",
"kind",
- "url",
- "modelId",
- "connectionType",
- "protocol",
- "authMode"
+ "binding"
],
- "title": "ModelConfigWrite",
+ "title": "MediaCanvasItem",
"type": "object"
},
- "ModelConnection": {
+ "MediaEditData": {
"additionalProperties": false,
"properties": {
- "kind": {
- "description": "Business object or media type.",
+ "tool": {
+ "description": "Registered editing tool name.",
"enum": [
- "agent",
- "image",
- "video",
- "audio",
- "vision"
+ "layers",
+ "crop",
+ "smart-edit",
+ "outpaint",
+ "cutout",
+ "inpainting-remove",
+ "image-hd",
+ "view-control",
+ "lighting",
+ "layer-decompose",
+ "panorama",
+ "product-replacement",
+ "multi-size",
+ "dynamic-poster",
+ "ecommerce-main",
+ "image-presets",
+ "grid-split",
+ "composition",
+ "annotation",
+ "video-edit",
+ "video-extend",
+ "video-partial-reshoot",
+ "video-upscale",
+ "video-frame-interpolation",
+ "video-depth-capture",
+ "video-subtitle-erasure",
+ "video-matting",
+ "video-crop",
+ "video-translation",
+ "extract-audio",
+ "audio-separation",
+ "video-trim",
+ "audio-trim",
+ "video-frame-capture",
+ "director-stage"
],
- "title": "Kind",
+ "title": "Tool",
"type": "string"
},
- "url": {
- "description": "Provider API base URL.",
- "maxLength": 2048,
- "minLength": 1,
- "title": "Url",
- "type": "string"
+ "sources": {
+ "default": [],
+ "description": "Ordered source asset versions.",
+ "items": {
+ "$ref": "#/$defs/AssetRef"
+ },
+ "title": "Sources",
+ "type": "array"
},
- "modelId": {
- "description": "Provider-native model identifier.",
- "maxLength": 200,
- "minLength": 1,
- "title": "Modelid",
- "type": "string"
+ "sourceItems": {
+ "default": [],
+ "description": "Source canvas item IDs.",
+ "items": {
+ "format": "uuid",
+ "type": "string"
+ },
+ "title": "Sourceitems",
+ "type": "array"
},
- "connectionType": {
- "description": "Hosted or local model connection type.",
- "enum": [
- "api",
- "self_hosted"
- ],
- "title": "Connectiontype",
- "type": "string"
- },
- "protocol": {
- "description": "Provider wire protocol.",
- "enum": [
- "openai",
- "volcengine",
- "bigmodel_video",
- "kling_video",
- "minimax_video_v2",
- "vllm_omni",
- "vllm_omni_segmentation",
- "vllm_omni_music",
- "vllm_omni_depth",
- "vllm_omni_score"
- ],
- "title": "Protocol",
- "type": "string"
- },
- "authMode": {
- "description": "Authentication mode for the provider connection.",
- "enum": [
- "none",
- "bearer"
- ],
- "title": "Authmode",
- "type": "string"
- },
- "proxyMode": {
- "default": "system",
- "description": "Use the system proxy or connect directly to the model service.",
- "enum": [
- "system",
- "direct"
- ],
- "title": "Proxymode",
- "type": "string"
- },
- "inputModalities": {
- "anyOf": [
- {
- "items": {
- "enum": [
- "text",
- "image"
- ],
+ "parameters": {
+ "additionalProperties": {
+ "anyOf": [
+ {
+ "maxLength": 100000,
"type": "string"
},
- "type": "array"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Supported model input media kinds.",
- "title": "Inputmodalities"
- },
- "videoAdapter": {
- "default": "auto",
- "description": "Provider-specific video adapter.",
- "enum": [
- "auto",
- "fasth3",
- "fasth3_dual",
- "minimax_h3",
- "standard"
- ],
- "title": "Videoadapter",
- "type": "string"
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "integer"
+ },
+ {
+ "type": "number"
+ }
+ ]
+ },
+ "description": "Typed generation or editing parameters.",
+ "maxProperties": 100,
+ "propertyNames": {
+ "maxLength": 100,
+ "minLength": 1
+ },
+ "title": "Parameters",
+ "type": "object"
},
- "videoCapabilities": {
+ "selection": {
"anyOf": [
{
- "$ref": "#/$defs/VideoCapabilities"
+ "$ref": "#/$defs/ToolSelection"
},
{
"type": "null"
}
],
"default": null,
- "description": "Supported video generation capabilities."
+ "description": "Saved source selection for this edit."
}
},
"required": [
- "kind",
- "url",
- "modelId",
- "connectionType",
- "protocol",
- "authMode"
+ "tool"
],
- "title": "ModelConnection",
+ "title": "MediaEditData",
"type": "object"
},
- "ModelSnapshot": {
+ "MediaEditDocument": {
"additionalProperties": false,
"properties": {
- "modelConfigId": {
- "description": "Model configuration ID from the model catalog or user model selections.",
+ "id": {
+ "description": "Stable identity of this project-owned object.",
"format": "uuid",
- "title": "Modelconfigid",
+ "title": "Id",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
"type": "string"
},
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "schemaVersion": {
+ "const": 1,
+ "default": 1,
+ "description": "Record schema version.",
+ "title": "Schemaversion",
+ "type": "integer"
+ },
+ "inputConnections": {
+ "default": [],
+ "description": "Persisted connections to source assets.",
+ "items": {
+ "$ref": "#/$defs/EditorInputConnection"
+ },
+ "title": "Inputconnections",
+ "type": "array"
+ },
"kind": {
+ "const": "media_edit",
"description": "Business object or media type.",
- "enum": [
- "agent",
- "image",
- "video",
- "audio",
- "vision"
- ],
"title": "Kind",
"type": "string"
},
- "modelId": {
- "description": "Provider-native model identifier.",
- "maxLength": 200,
- "minLength": 1,
- "title": "Modelid",
- "type": "string"
- },
- "url": {
- "description": "Provider API base URL.",
- "maxLength": 2048,
+ "data": {
+ "$ref": "#/$defs/MediaEditData",
+ "description": "Typed editable document contents."
+ }
+ },
+ "required": [
+ "id",
+ "projectId",
+ "kind",
+ "data"
+ ],
+ "title": "MediaEditDocument",
+ "type": "object"
+ },
+ "MediaMetadata": {
+ "additionalProperties": false,
+ "properties": {
+ "mimeType": {
+ "description": "Verified media MIME type.",
+ "maxLength": 255,
"minLength": 1,
- "title": "Url",
- "type": "string"
- },
- "protocol": {
- "description": "Provider wire protocol.",
- "enum": [
- "openai",
- "volcengine",
- "bigmodel_video",
- "kling_video",
- "minimax_video_v2",
- "vllm_omni",
- "vllm_omni_segmentation",
- "vllm_omni_music",
- "vllm_omni_depth",
- "vllm_omni_score"
- ],
- "title": "Protocol",
+ "title": "Mimetype",
"type": "string"
},
- "connectionType": {
- "description": "Hosted or local model connection type.",
- "enum": [
- "api",
- "self_hosted"
- ],
- "title": "Connectiontype",
- "type": "string"
+ "size": {
+ "description": "Content size in bytes.",
+ "minimum": 0,
+ "title": "Size",
+ "type": "integer"
},
- "proxyMode": {
- "default": "system",
- "description": "Network routing selected when the job was accepted.",
- "enum": [
- "system",
- "direct"
+ "width": {
+ "anyOf": [
+ {
+ "minimum": 1,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
],
- "title": "Proxymode",
- "type": "string"
+ "default": null,
+ "description": "Width in pixels.",
+ "title": "Width"
},
- "inputModalities": {
+ "height": {
"anyOf": [
{
- "items": {
- "enum": [
- "text",
- "image"
- ],
- "type": "string"
- },
- "type": "array"
+ "minimum": 1,
+ "type": "integer"
},
{
"type": "null"
}
],
"default": null,
- "description": "Supported model input media kinds.",
- "title": "Inputmodalities"
+ "description": "Height in pixels.",
+ "title": "Height"
},
- "videoAdapter": {
- "default": "auto",
- "description": "Provider-specific video adapter.",
- "enum": [
- "auto",
- "fasth3",
- "fasth3_dual",
- "minimax_h3",
- "standard"
+ "durationSeconds": {
+ "anyOf": [
+ {
+ "exclusiveMinimum": 0,
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
],
- "title": "Videoadapter",
- "type": "string"
+ "default": null,
+ "description": "Duration in seconds.",
+ "title": "Durationseconds"
},
- "inputRules": {
+ "frameRate": {
"anyOf": [
{
- "$ref": "#/$defs/InputRules"
+ "exclusiveMinimum": 0,
+ "type": "number"
},
{
"type": "null"
}
],
"default": null,
- "description": "Verified model input limits and output choices."
- }
- },
- "required": [
- "modelConfigId",
- "kind",
- "modelId",
- "url",
- "protocol",
- "connectionType"
- ],
- "title": "ModelSnapshot",
- "type": "object"
- },
- "MotionClip": {
- "additionalProperties": false,
- "properties": {
- "id": {
- "description": "Stable object ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Id",
- "type": "string"
- },
- "start": {
- "description": "Start time in seconds.",
- "minimum": 0,
- "title": "Start",
- "type": "number"
- },
- "duration": {
- "description": "Interval duration in seconds.",
- "exclusiveMinimum": 0,
- "title": "Duration",
- "type": "number"
- },
- "motion": {
- "$ref": "#/$defs/StageMotion",
- "description": "Procedural motion settings."
- }
- },
- "required": [
- "id",
- "start",
- "duration",
- "motion"
- ],
- "title": "MotionClip",
- "type": "object"
- },
- "NodeCapabilities": {
- "additionalProperties": false,
- "properties": {
- "canEdit": {
- "description": "Whether the current content can be edited.",
- "title": "Canedit",
- "type": "boolean"
- },
- "canConfigureGeneration": {
- "description": "Whether generation settings can be configured.",
- "title": "Canconfiguregeneration",
- "type": "boolean"
+ "description": "Video frames per second.",
+ "title": "Framerate"
},
- "canGenerate": {
- "description": "Whether generation can be submitted.",
- "title": "Cangenerate",
- "type": "boolean"
+ "frameCount": {
+ "anyOf": [
+ {
+ "minimum": 1,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Number of video frames reported by the media container.",
+ "title": "Framecount"
},
- "canAcceptReferences": {
- "description": "Whether the item accepts generation references.",
- "title": "Canacceptreferences",
- "type": "boolean"
+ "hasAudio": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether the media contains an audio stream.",
+ "title": "Hasaudio"
},
- "canUseAsReference": {
- "description": "Whether the item can supply a generation reference.",
- "title": "Canuseasreference",
- "type": "boolean"
+ "sampleRate": {
+ "anyOf": [
+ {
+ "minimum": 1,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Audio samples per second.",
+ "title": "Samplerate"
},
- "canPlay": {
- "description": "Whether the current media can be played.",
- "title": "Canplay",
- "type": "boolean"
+ "channels": {
+ "anyOf": [
+ {
+ "minimum": 1,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Audio channel count.",
+ "title": "Channels"
},
- "canExport": {
- "description": "Whether the current content can be exported.",
- "title": "Canexport",
- "type": "boolean"
+ "selfContained": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether a model container embeds all its buffers and images.",
+ "title": "Selfcontained"
},
- "canReplaceMaterial": {
- "description": "Whether the bound material can be replaced.",
- "title": "Canreplacematerial",
- "type": "boolean"
+ "animationNames": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Animation clip names declared by a parsed model container, in document order.",
+ "title": "Animationnames"
}
},
"required": [
- "canEdit",
- "canConfigureGeneration",
- "canGenerate",
- "canAcceptReferences",
- "canUseAsReference",
- "canPlay",
- "canExport",
- "canReplaceMaterial"
+ "mimeType",
+ "size"
],
- "title": "NodeCapabilities",
+ "title": "MediaMetadata",
"type": "object"
},
- "NodeVersionApply": {
+ "MediaPublicationOutput": {
"additionalProperties": false,
"properties": {
"itemId": {
@@ -8801,671 +9784,735 @@
"$ref": "#/$defs/AssetRef",
"description": "Immutable asset version."
},
- "referencePolicy": {
- "default": "follow_current",
- "description": "Policy for restoring associated reference bindings.",
- "enum": [
- "follow_current",
- "pinned"
- ],
- "title": "Referencepolicy",
+ "title": {
+ "description": "User-visible title.",
+ "maxLength": 255,
+ "minLength": 1,
+ "title": "Title",
"type": "string"
+ },
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
+ },
+ "width": {
+ "default": 352,
+ "description": "Width in pixels.",
+ "exclusiveMinimum": 0,
+ "maximum": 10000,
+ "title": "Width",
+ "type": "number"
+ },
+ "height": {
+ "default": 198,
+ "description": "Height in pixels.",
+ "exclusiveMinimum": 0,
+ "maximum": 10000,
+ "title": "Height",
+ "type": "number"
}
},
"required": [
"itemId",
- "asset"
+ "asset",
+ "title"
],
- "title": "NodeVersionApply",
+ "title": "MediaPublicationOutput",
"type": "object"
},
- "NodeVersionApplyCommand": {
+ "ModelConfigPublic": {
"additionalProperties": false,
- "description": "Apply a historical asset version and its reference policy to a canvas item.",
+ "description": "Application-level, never embedded in an editable project's credential data.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
+ "kind": {
+ "description": "Business object or media type.",
+ "enum": [
+ "agent",
+ "image",
+ "video",
+ "audio",
+ "vision"
+ ],
+ "title": "Kind",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ "url": {
+ "description": "Provider API base URL.",
+ "maxLength": 2048,
+ "minLength": 1,
+ "title": "Url",
"type": "string"
},
- "type": {
- "const": "canvas.applyVersion",
- "description": "Command discriminator.",
- "title": "Type",
+ "modelId": {
+ "description": "Provider-native model identifier.",
+ "maxLength": 200,
+ "minLength": 1,
+ "title": "Modelid",
"type": "string"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
- },
- "expectedPreview": {
- "anyOf": [
- {
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
- },
- {
- "type": "null"
- }
+ "connectionType": {
+ "description": "Hosted or local model connection type.",
+ "enum": [
+ "api",
+ "self_hosted"
],
- "default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
- },
- "payload": {
- "$ref": "#/$defs/NodeVersionApply",
- "description": "Apply a historical asset version and its reference policy to a canvas item."
- }
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "payload"
- ],
- "title": "NodeVersionApplyCommand",
- "type": "object"
- },
- "ObjectQuery": {
- "additionalProperties": false,
- "properties": {
- "queryId": {
- "description": "Caller-supplied query ID.",
- "format": "uuid",
- "title": "Queryid",
+ "title": "Connectiontype",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ "protocol": {
+ "description": "Provider wire protocol.",
+ "enum": [
+ "openai",
+ "volcengine",
+ "bigmodel_video",
+ "kling_video",
+ "minimax_video_v2",
+ "vllm_omni",
+ "vllm_omni_segmentation",
+ "vllm_omni_music",
+ "vllm_omni_depth",
+ "vllm_omni_score"
+ ],
+ "title": "Protocol",
"type": "string"
},
- "type": {
- "description": "Read an object or generation job.",
+ "authMode": {
+ "description": "Authentication mode for the provider connection.",
"enum": [
- "object.get",
- "job.get"
+ "none",
+ "bearer"
],
- "title": "Type",
+ "title": "Authmode",
"type": "string"
},
- "objectId": {
- "description": "Target business object ID.",
- "format": "uuid",
- "title": "Objectid",
+ "proxyMode": {
+ "default": "system",
+ "description": "Use the system proxy or connect directly to the model service.",
+ "enum": [
+ "system",
+ "direct"
+ ],
+ "title": "Proxymode",
"type": "string"
},
- "revision": {
+ "inputModalities": {
"anyOf": [
{
- "minimum": 1,
- "type": "integer"
+ "items": {
+ "enum": [
+ "text",
+ "image"
+ ],
+ "type": "string"
+ },
+ "type": "array"
},
{
"type": "null"
}
],
"default": null,
- "description": "Historical object revision, or current when omitted.",
- "title": "Revision"
- }
- },
- "required": [
- "queryId",
- "projectId",
- "type",
- "objectId"
- ],
- "title": "ObjectQuery",
- "type": "object"
- },
- "ObjectVersion": {
- "additionalProperties": false,
- "properties": {
- "objectType": {
- "description": "Referenced business object type.",
+ "description": "Supported model input media kinds.",
+ "title": "Inputmodalities"
+ },
+ "videoAdapter": {
+ "default": "auto",
+ "description": "Provider-specific video adapter.",
"enum": [
- "project",
- "asset",
- "generation_spec",
- "reference",
- "canvas_item",
- "editor_document",
- "job",
- "result"
+ "auto",
+ "fasth3",
+ "fasth3_dual",
+ "minimax_h3",
+ "standard"
],
- "title": "Objecttype",
- "type": "string"
- },
- "id": {
- "description": "Stable object ID.",
- "format": "uuid",
- "title": "Id",
+ "title": "Videoadapter",
"type": "string"
},
- "revision": {
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- }
- },
- "required": [
- "objectType",
- "id",
- "revision"
- ],
- "title": "ObjectVersion",
- "type": "object"
- },
- "PaletteData": {
- "additionalProperties": false,
- "properties": {
- "name": {
+ "videoCapabilities": {
"anyOf": [
{
- "maxLength": 255,
- "type": "string"
+ "$ref": "#/$defs/VideoCapabilities"
},
{
"type": "null"
}
],
"default": null,
- "description": "User-visible name.",
- "title": "Name"
+ "description": "Supported video generation capabilities."
},
- "sourceImage": {
+ "id": {
+ "description": "Stable object ID.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
+ },
+ "providerId": {
"anyOf": [
{
- "$ref": "#/$defs/AssetRef"
+ "format": "uuid",
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Source image used to extract palette colors."
- }
- },
- "title": "PaletteData",
- "type": "object"
- },
- "PaletteProvenance": {
- "additionalProperties": false,
- "properties": {
- "paletteId": {
- "description": "Palette ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Paletteid",
- "type": "string"
+ "description": "Shared provider connection ID.",
+ "title": "Providerid"
},
- "version": {
- "description": "Version of the referenced record.",
- "minimum": 1,
- "title": "Version",
- "type": "integer"
+ "inputRules": {
+ "$ref": "#/$defs/InputRules",
+ "description": "Verified model input limits and output choices."
}
},
"required": [
- "paletteId",
- "version"
+ "kind",
+ "url",
+ "modelId",
+ "connectionType",
+ "protocol",
+ "authMode",
+ "id",
+ "inputRules"
],
- "title": "PaletteProvenance",
+ "title": "ModelConfigPublic",
"type": "object"
},
- "PinnedReference": {
+ "ModelConfigWrite": {
"additionalProperties": false,
+ "description": "Only the model-settings write boundary accepts a credential.",
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
- "format": "uuid",
- "title": "Id",
+ "kind": {
+ "description": "Business object or media type.",
+ "enum": [
+ "agent",
+ "image",
+ "video",
+ "audio",
+ "vision"
+ ],
+ "title": "Kind",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ "url": {
+ "description": "Provider API base URL.",
+ "maxLength": 2048,
+ "minLength": 1,
+ "title": "Url",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "targetSpecId": {
- "description": "Target generation configuration ID.",
- "format": "uuid",
- "title": "Targetspecid",
+ "modelId": {
+ "description": "Provider-native model identifier.",
+ "maxLength": 200,
+ "minLength": 1,
+ "title": "Modelid",
"type": "string"
},
- "role": {
- "default": "reference",
- "description": "Business role of this binding or reference.",
+ "connectionType": {
+ "description": "Hosted or local model connection type.",
"enum": [
- "reference",
- "first_frame",
- "last_frame",
- "continuation"
+ "api",
+ "self_hosted"
],
- "title": "Role",
+ "title": "Connectiontype",
"type": "string"
},
- "order": {
- "default": 0,
- "description": "Reference ordering within the target configuration.",
- "minimum": 0,
- "title": "Order",
- "type": "integer"
+ "protocol": {
+ "description": "Provider wire protocol.",
+ "enum": [
+ "openai",
+ "volcengine",
+ "bigmodel_video",
+ "kling_video",
+ "minimax_video_v2",
+ "vllm_omni",
+ "vllm_omni_segmentation",
+ "vllm_omni_music",
+ "vllm_omni_depth",
+ "vllm_omni_score"
+ ],
+ "title": "Protocol",
+ "type": "string"
},
- "active": {
- "default": true,
- "description": "Whether this reference participates in generation.",
- "title": "Active",
- "type": "boolean"
+ "authMode": {
+ "description": "Authentication mode for the provider connection.",
+ "enum": [
+ "none",
+ "bearer"
+ ],
+ "title": "Authmode",
+ "type": "string"
},
- "binding": {
- "const": "pinned",
- "description": "Use a fixed asset version, retaining canvas provenance when supplied.",
- "title": "Binding",
+ "proxyMode": {
+ "default": "system",
+ "description": "Use the system proxy or connect directly to the model service.",
+ "enum": [
+ "system",
+ "direct"
+ ],
+ "title": "Proxymode",
"type": "string"
},
- "source": {
- "$ref": "#/$defs/AssetRef",
- "description": "Fixed asset version used by generation."
+ "inputModalities": {
+ "anyOf": [
+ {
+ "items": {
+ "enum": [
+ "text",
+ "image"
+ ],
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Supported model input media kinds.",
+ "title": "Inputmodalities"
},
- "sourceVersion": {
+ "videoAdapter": {
+ "default": "auto",
+ "description": "Provider-specific video adapter.",
+ "enum": [
+ "auto",
+ "fasth3",
+ "fasth3_dual",
+ "minimax_h3",
+ "standard"
+ ],
+ "title": "Videoadapter",
+ "type": "string"
+ },
+ "videoCapabilities": {
"anyOf": [
{
- "$ref": "#/$defs/CanvasItemVersion"
+ "$ref": "#/$defs/VideoCapabilities"
},
{
"type": "null"
}
],
"default": null,
- "description": "Source canvas item identity and revision. Required for canvas-derived references to retain their connection."
+ "description": "Supported video generation capabilities."
},
- "subjectRole": {
+ "apiKey": {
"anyOf": [
{
- "enum": [
- "main",
- "auxiliary",
- "voice"
- ],
- "type": "string"
+ "format": "password",
+ "maxLength": 8192,
+ "type": "string",
+ "writeOnly": true
},
{
"type": "null"
}
],
"default": null,
- "description": "Subject media slot provenance only; omit for ordinary image references and explicit first_frame/last_frame assets. main does not mean first frame.",
- "title": "Subjectrole"
+ "description": "Provider credential; omitted from public model records.",
+ "title": "Apikey"
}
},
"required": [
- "id",
- "projectId",
- "targetSpecId",
- "binding",
- "source"
+ "kind",
+ "url",
+ "modelId",
+ "connectionType",
+ "protocol",
+ "authMode"
],
- "title": "PinnedReference",
+ "title": "ModelConfigWrite",
"type": "object"
},
- "PinnedReferenceSource": {
+ "ModelConnection": {
"additionalProperties": false,
"properties": {
- "binding": {
- "const": "pinned",
- "default": "pinned",
- "description": "Use the fixed asset version.",
- "title": "Binding",
+ "kind": {
+ "description": "Business object or media type.",
+ "enum": [
+ "agent",
+ "image",
+ "video",
+ "audio",
+ "vision"
+ ],
+ "title": "Kind",
"type": "string"
},
- "source": {
- "$ref": "#/$defs/AssetRef",
- "description": "Fixed current asset version."
- },
- "sourceVersion": {
- "$ref": "#/$defs/CanvasItemVersion",
- "description": "Canvas source version retaining the connection."
- }
- },
- "required": [
- "source",
- "sourceVersion"
- ],
- "title": "PinnedReferenceSource",
- "type": "object"
- },
- "Playhead": {
- "additionalProperties": false,
- "properties": {
- "editorDocumentId": {
- "description": "Editable document ID.",
- "format": "uuid",
- "title": "Editordocumentid",
+ "url": {
+ "description": "Provider API base URL.",
+ "maxLength": 2048,
+ "minLength": 1,
+ "title": "Url",
"type": "string"
},
- "seconds": {
- "default": 0,
- "description": "Playhead position in seconds.",
- "minimum": 0,
- "title": "Seconds",
- "type": "number"
- }
- },
- "required": [
- "editorDocumentId"
- ],
- "title": "Playhead",
- "type": "object"
- },
- "Point": {
- "additionalProperties": false,
- "properties": {
- "x": {
- "default": 0,
- "description": "Horizontal coordinate.",
- "title": "X",
- "type": "number"
+ "modelId": {
+ "description": "Provider-native model identifier.",
+ "maxLength": 200,
+ "minLength": 1,
+ "title": "Modelid",
+ "type": "string"
},
- "y": {
- "default": 0,
- "description": "Vertical coordinate.",
- "title": "Y",
- "type": "number"
- }
- },
- "title": "Point",
- "type": "object"
- },
- "Project": {
- "additionalProperties": false,
- "properties": {
- "id": {
- "description": "Stable object ID.",
- "format": "uuid",
- "title": "Id",
+ "connectionType": {
+ "description": "Hosted or local model connection type.",
+ "enum": [
+ "api",
+ "self_hosted"
+ ],
+ "title": "Connectiontype",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
+ "protocol": {
+ "description": "Provider wire protocol.",
+ "enum": [
+ "openai",
+ "volcengine",
+ "bigmodel_video",
+ "kling_video",
+ "minimax_video_v2",
+ "vllm_omni",
+ "vllm_omni_segmentation",
+ "vllm_omni_music",
+ "vllm_omni_depth",
+ "vllm_omni_score"
+ ],
+ "title": "Protocol",
+ "type": "string"
},
- "name": {
- "description": "User-visible name.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Name",
+ "authMode": {
+ "description": "Authentication mode for the provider connection.",
+ "enum": [
+ "none",
+ "bearer"
+ ],
+ "title": "Authmode",
"type": "string"
- }
- },
- "required": [
- "id",
- "name"
- ],
- "title": "Project",
- "type": "object"
- },
- "ProjectCreate": {
- "additionalProperties": false,
- "properties": {
- "name": {
- "description": "User-visible name.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Name",
+ },
+ "proxyMode": {
+ "default": "system",
+ "description": "Use the system proxy or connect directly to the model service.",
+ "enum": [
+ "system",
+ "direct"
+ ],
+ "title": "Proxymode",
+ "type": "string"
+ },
+ "inputModalities": {
+ "anyOf": [
+ {
+ "items": {
+ "enum": [
+ "text",
+ "image"
+ ],
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Supported model input media kinds.",
+ "title": "Inputmodalities"
+ },
+ "videoAdapter": {
+ "default": "auto",
+ "description": "Provider-specific video adapter.",
+ "enum": [
+ "auto",
+ "fasth3",
+ "fasth3_dual",
+ "minimax_h3",
+ "standard"
+ ],
+ "title": "Videoadapter",
"type": "string"
+ },
+ "videoCapabilities": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/VideoCapabilities"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Supported video generation capabilities."
}
},
"required": [
- "name"
+ "kind",
+ "url",
+ "modelId",
+ "connectionType",
+ "protocol",
+ "authMode"
],
- "title": "ProjectCreate",
+ "title": "ModelConnection",
"type": "object"
},
- "ProjectCreateCommand": {
+ "ModelSnapshot": {
"additionalProperties": false,
- "description": "Create a project.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
+ "modelConfigId": {
+ "description": "Model configuration ID from the model catalog or user model selections.",
"format": "uuid",
- "title": "Commandid",
+ "title": "Modelconfigid",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ "kind": {
+ "description": "Business object or media type.",
+ "enum": [
+ "agent",
+ "image",
+ "video",
+ "audio",
+ "vision"
+ ],
+ "title": "Kind",
"type": "string"
},
- "type": {
- "const": "project.create",
- "description": "Command discriminator.",
- "title": "Type",
+ "modelId": {
+ "description": "Provider-native model identifier.",
+ "maxLength": 200,
+ "minLength": 1,
+ "title": "Modelid",
"type": "string"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
+ "url": {
+ "description": "Provider API base URL.",
+ "maxLength": 2048,
+ "minLength": 1,
+ "title": "Url",
+ "type": "string"
},
- "expectedPreview": {
+ "protocol": {
+ "description": "Provider wire protocol.",
+ "enum": [
+ "openai",
+ "volcengine",
+ "bigmodel_video",
+ "kling_video",
+ "minimax_video_v2",
+ "vllm_omni",
+ "vllm_omni_segmentation",
+ "vllm_omni_music",
+ "vllm_omni_depth",
+ "vllm_omni_score"
+ ],
+ "title": "Protocol",
+ "type": "string"
+ },
+ "connectionType": {
+ "description": "Hosted or local model connection type.",
+ "enum": [
+ "api",
+ "self_hosted"
+ ],
+ "title": "Connectiontype",
+ "type": "string"
+ },
+ "proxyMode": {
+ "default": "system",
+ "description": "Network routing selected when the job was accepted.",
+ "enum": [
+ "system",
+ "direct"
+ ],
+ "title": "Proxymode",
+ "type": "string"
+ },
+ "inputModalities": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
+ "items": {
+ "enum": [
+ "text",
+ "image"
+ ],
+ "type": "string"
+ },
+ "type": "array"
},
{
"type": "null"
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "description": "Supported model input media kinds.",
+ "title": "Inputmodalities"
},
- "payload": {
- "$ref": "#/$defs/ProjectCreate",
- "description": "Create a project."
+ "videoAdapter": {
+ "default": "auto",
+ "description": "Provider-specific video adapter.",
+ "enum": [
+ "auto",
+ "fasth3",
+ "fasth3_dual",
+ "minimax_h3",
+ "standard"
+ ],
+ "title": "Videoadapter",
+ "type": "string"
+ },
+ "inputRules": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/InputRules"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Verified model input limits and output choices."
}
},
"required": [
- "commandId",
- "projectId",
- "type",
- "payload"
+ "modelConfigId",
+ "kind",
+ "modelId",
+ "url",
+ "protocol",
+ "connectionType"
],
- "title": "ProjectCreateCommand",
+ "title": "ModelSnapshot",
"type": "object"
},
- "ProjectEntity": {
+ "MotionClip": {
"additionalProperties": false,
"properties": {
"id": {
- "description": "Stable identity of this project-owned object.",
- "format": "uuid",
+ "description": "Stable object ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
"title": "Id",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "start": {
+ "description": "Start time in seconds.",
+ "minimum": 0,
+ "title": "Start",
+ "type": "number"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
+ "duration": {
+ "description": "Interval duration in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Duration",
+ "type": "number"
+ },
+ "motion": {
+ "$ref": "#/$defs/StageMotion",
+ "description": "Procedural motion settings."
}
},
"required": [
"id",
- "projectId"
+ "start",
+ "duration",
+ "motion"
],
- "title": "ProjectEntity",
+ "title": "MotionClip",
"type": "object"
},
- "ProjectEvent": {
+ "NodeCapabilities": {
"additionalProperties": false,
"properties": {
- "schemaVersion": {
- "const": 1,
- "default": 1,
- "description": "Record schema version.",
- "title": "Schemaversion",
- "type": "integer"
+ "canEdit": {
+ "description": "Whether the current content can be edited.",
+ "title": "Canedit",
+ "type": "boolean"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "canConfigureGeneration": {
+ "description": "Whether generation settings can be configured.",
+ "title": "Canconfiguregeneration",
+ "type": "boolean"
},
- "cursor": {
- "description": "Monotonically increasing project event cursor.",
- "minimum": 1,
- "title": "Cursor",
- "type": "integer"
+ "canGenerate": {
+ "description": "Whether generation can be submitted.",
+ "title": "Cangenerate",
+ "type": "boolean"
},
- "commandId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Stable command ID for idempotent replay.",
- "title": "Commandid"
+ "canAcceptReferences": {
+ "description": "Whether the item accepts generation references.",
+ "title": "Canacceptreferences",
+ "type": "boolean"
},
- "source": {
- "description": "Input source or recorded provenance.",
- "enum": [
- "ui",
- "agent",
- "background",
- "external"
- ],
- "title": "Source",
- "type": "string"
+ "canUseAsReference": {
+ "description": "Whether the item can supply a generation reference.",
+ "title": "Canuseasreference",
+ "type": "boolean"
},
- "changed": {
- "default": [],
- "description": "Business objects changed by the operation.",
- "items": {
- "$ref": "#/$defs/ChangedObject"
- },
- "title": "Changed",
- "type": "array"
+ "canPlay": {
+ "description": "Whether the current media can be played.",
+ "title": "Canplay",
+ "type": "boolean"
},
- "jobIds": {
- "default": [],
- "description": "Generation jobs associated with this operation.",
- "items": {
- "format": "uuid",
- "type": "string"
- },
- "title": "Jobids",
- "type": "array"
+ "canExport": {
+ "description": "Whether the current content can be exported.",
+ "title": "Canexport",
+ "type": "boolean"
+ },
+ "canReplaceMaterial": {
+ "description": "Whether the bound material can be replaced.",
+ "title": "Canreplacematerial",
+ "type": "boolean"
}
},
"required": [
- "projectId",
- "cursor",
- "source"
+ "canEdit",
+ "canConfigureGeneration",
+ "canGenerate",
+ "canAcceptReferences",
+ "canUseAsReference",
+ "canPlay",
+ "canExport",
+ "canReplaceMaterial"
],
- "title": "ProjectEvent",
+ "title": "NodeCapabilities",
"type": "object"
},
- "ProjectQuery": {
+ "NodeVersionApply": {
"additionalProperties": false,
"properties": {
- "queryId": {
- "description": "Caller-supplied query ID.",
+ "itemId": {
+ "description": "Canvas item ID.",
"format": "uuid",
- "title": "Queryid",
+ "title": "Itemid",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "asset": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Immutable asset version."
},
- "type": {
- "const": "project.get",
- "description": "Read the current project.",
- "title": "Type",
- "type": "string"
- }
- },
- "required": [
- "queryId",
- "projectId",
- "type"
- ],
- "title": "ProjectQuery",
- "type": "object"
- },
- "ProjectRename": {
- "additionalProperties": false,
- "properties": {
- "name": {
- "description": "User-visible name.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Name",
+ "referencePolicy": {
+ "default": "follow_current",
+ "description": "Policy for restoring associated reference bindings.",
+ "enum": [
+ "follow_current",
+ "pinned"
+ ],
+ "title": "Referencepolicy",
"type": "string"
}
},
"required": [
- "name"
+ "itemId",
+ "asset"
],
- "title": "ProjectRename",
+ "title": "NodeVersionApply",
"type": "object"
},
- "ProjectRenameCommand": {
+ "NodeVersionApplyCommand": {
"additionalProperties": false,
- "description": "Rename the project.",
+ "description": "Apply a historical asset version and its reference policy to a canvas item.",
"properties": {
"commandId": {
"description": "Stable command ID for idempotent replay.",
@@ -9480,7 +10527,7 @@
"type": "string"
},
"type": {
- "const": "project.rename",
+ "const": "canvas.applyVersion",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -9509,8 +10556,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/ProjectRename",
- "description": "Rename the project."
+ "$ref": "#/$defs/NodeVersionApply",
+ "description": "Apply a historical asset version and its reference policy to a canvas item."
}
},
"required": [
@@ -9519,17 +10566,16 @@
"type",
"payload"
],
- "title": "ProjectRenameCommand",
+ "title": "NodeVersionApplyCommand",
"type": "object"
},
- "ProjectRestoreCommand": {
+ "ObjectQuery": {
"additionalProperties": false,
- "description": "Restore a trashed project.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
+ "queryId": {
+ "description": "Caller-supplied query ID.",
"format": "uuid",
- "title": "Commandid",
+ "title": "Queryid",
"type": "string"
},
"projectId": {
@@ -9539,313 +10585,90 @@
"type": "string"
},
"type": {
- "const": "project.restore",
- "description": "Command discriminator.",
+ "description": "Read an object or generation job.",
+ "enum": [
+ "object.get",
+ "job.get"
+ ],
"title": "Type",
"type": "string"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
+ "objectId": {
+ "description": "Target business object ID.",
+ "format": "uuid",
+ "title": "Objectid",
+ "type": "string"
},
- "expectedPreview": {
+ "revision": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
+ "minimum": 1,
+ "type": "integer"
},
{
"type": "null"
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
- },
- "payload": {
- "$ref": "#/$defs/EmptyPayload",
- "description": "Restore a trashed project."
+ "description": "Historical object revision, or current when omitted.",
+ "title": "Revision"
}
},
"required": [
- "commandId",
+ "queryId",
"projectId",
"type",
- "payload"
+ "objectId"
],
- "title": "ProjectRestoreCommand",
+ "title": "ObjectQuery",
"type": "object"
},
- "ProjectSnapshot": {
+ "ObjectVersion": {
"additionalProperties": false,
"properties": {
- "format": {
- "const": "opendirector-project",
- "default": "opendirector-project",
- "description": "Serialized format identifier.",
- "title": "Format",
+ "objectType": {
+ "description": "Referenced business object type.",
+ "enum": [
+ "project",
+ "asset",
+ "generation_spec",
+ "reference",
+ "canvas_item",
+ "editor_document",
+ "job",
+ "result"
+ ],
+ "title": "Objecttype",
"type": "string"
},
- "formatVersion": {
- "const": 2,
- "default": 2,
- "description": "Project format version.",
- "title": "Formatversion",
- "type": "integer"
- },
- "project": {
- "$ref": "#/$defs/Project",
- "description": "Project identity and current revision."
- },
- "assets": {
- "default": [],
- "description": "Registered immutable assets.",
- "items": {
- "$ref": "#/$defs/Asset"
- },
- "title": "Assets",
- "type": "array"
- },
- "generationSpecs": {
- "default": [],
- "description": "Editable generation configurations.",
- "items": {
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioGenerationSpec",
- "image": "#/$defs/ImageGenerationSpec",
- "text": "#/$defs/TextGenerationSpec",
- "video": "#/$defs/VideoGenerationSpec"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TextGenerationSpec"
- },
- {
- "$ref": "#/$defs/ImageGenerationSpec"
- },
- {
- "$ref": "#/$defs/VideoGenerationSpec"
- },
- {
- "$ref": "#/$defs/AudioGenerationSpec"
- }
- ]
- },
- "title": "Generationspecs",
- "type": "array"
- },
- "references": {
- "default": [],
- "description": "Ordered generation reference bindings.",
- "items": {
- "description": "Generation input reference. Preserve source canvas identity for canvas-derived references, whether following or pinned.",
- "discriminator": {
- "mapping": {
- "follow_current": "#/$defs/FollowingReference",
- "pinned": "#/$defs/PinnedReference"
- },
- "propertyName": "binding"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/PinnedReference"
- },
- {
- "$ref": "#/$defs/FollowingReference"
- }
- ]
- },
- "title": "References",
- "type": "array"
- },
- "canvasItems": {
- "default": [],
- "description": "Canvas display items, including hidden items.",
- "items": {
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioCanvasItem",
- "external": "#/$defs/DirectorCanvasItem",
- "file": "#/$defs/FileCanvasItem",
- "group": "#/$defs/GroupCanvasItem",
- "image": "#/$defs/ImageCanvasItem",
- "stack": "#/$defs/StackCanvasItem",
- "subject": "#/$defs/SubjectCanvasItem",
- "text": "#/$defs/TextCanvasItem",
- "timeline": "#/$defs/TimelineCanvasItem",
- "tool": "#/$defs/ToolCanvasItem",
- "video": "#/$defs/VideoCanvasItem"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TextCanvasItem"
- },
- {
- "$ref": "#/$defs/ImageCanvasItem"
- },
- {
- "$ref": "#/$defs/VideoCanvasItem"
- },
- {
- "$ref": "#/$defs/AudioCanvasItem"
- },
- {
- "$ref": "#/$defs/FileCanvasItem"
- },
- {
- "$ref": "#/$defs/SubjectCanvasItem"
- },
- {
- "$ref": "#/$defs/TimelineCanvasItem"
- },
- {
- "$ref": "#/$defs/StackCanvasItem"
- },
- {
- "$ref": "#/$defs/ToolCanvasItem"
- },
- {
- "$ref": "#/$defs/DirectorCanvasItem"
- },
- {
- "$ref": "#/$defs/GroupCanvasItem"
- }
- ]
- },
- "title": "Canvasitems",
- "type": "array"
- },
- "editorDocuments": {
- "default": [],
- "description": "Persisted editable documents.",
- "items": {
- "discriminator": {
- "mapping": {
- "director": "#/$defs/DirectorDocument",
- "image_crop": "#/$defs/ImageCropDocument",
- "layers": "#/$defs/LayerDocument",
- "media_edit": "#/$defs/MediaEditDocument",
- "stack": "#/$defs/StackDocument",
- "subject": "#/$defs/SubjectDocument",
- "timeline": "#/$defs/TimelineDocument",
- "tool": "#/$defs/ToolDocument"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TimelineDocument"
- },
- {
- "$ref": "#/$defs/SubjectDocument"
- },
- {
- "$ref": "#/$defs/LayerDocument"
- },
- {
- "$ref": "#/$defs/ImageCropDocument"
- },
- {
- "$ref": "#/$defs/StackDocument"
- },
- {
- "$ref": "#/$defs/ToolDocument"
- },
- {
- "$ref": "#/$defs/DirectorDocument"
- },
- {
- "$ref": "#/$defs/MediaEditDocument"
- }
- ]
- },
- "title": "Editordocuments",
- "type": "array"
- },
- "jobs": {
- "default": [],
- "description": "Immutable generation execution records.",
- "items": {
- "$ref": "#/$defs/Job"
- },
- "title": "Jobs",
- "type": "array"
- },
- "results": {
- "default": [],
- "description": "Generated result candidates and adoption history.",
- "items": {
- "$ref": "#/$defs/ResultVersion"
- },
- "title": "Results",
- "type": "array"
- },
- "eventCursor": {
- "default": 0,
- "description": "Latest committed project event cursor.",
- "minimum": 0,
- "title": "Eventcursor",
- "type": "integer"
+ "id": {
+ "description": "Stable object ID.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
},
- "undoClearedThrough": {
- "default": 0,
- "description": "Event cursor through which undo history was cleared.",
- "minimum": 0,
- "title": "Undoclearedthrough",
+ "revision": {
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
"type": "integer"
}
},
"required": [
- "project"
+ "objectType",
+ "id",
+ "revision"
],
- "title": "ProjectSnapshot",
+ "title": "ObjectVersion",
"type": "object"
},
- "ProjectTrashCommand": {
+ "PaletteData": {
"additionalProperties": false,
- "description": "Move the project to trash.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
- },
- "type": {
- "const": "project.trash",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
- },
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
- },
- "expectedPreview": {
+ "name": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
+ "maxLength": 255,
"type": "string"
},
{
@@ -9853,213 +10676,51 @@
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
- },
- "payload": {
- "$ref": "#/$defs/EmptyPayload",
- "description": "Move the project to trash."
- }
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "payload"
- ],
- "title": "ProjectTrashCommand",
- "type": "object"
- },
- "PromptReference": {
- "additionalProperties": false,
- "properties": {
- "type": {
- "const": "reference",
- "description": "Operation or variant discriminator.",
- "title": "Type",
- "type": "string"
- },
- "referenceId": {
- "description": "Generation reference ID.",
- "format": "uuid",
- "title": "Referenceid",
- "type": "string"
- }
- },
- "required": [
- "type",
- "referenceId"
- ],
- "title": "PromptReference",
- "type": "object"
- },
- "PromptText": {
- "additionalProperties": false,
- "properties": {
- "type": {
- "const": "text",
- "description": "Operation or variant discriminator.",
- "title": "Type",
- "type": "string"
- },
- "text": {
- "description": "UTF-8 text content or search query.",
- "maxLength": 20000,
- "title": "Text",
- "type": "string"
- }
- },
- "required": [
- "type",
- "text"
- ],
- "title": "PromptText",
- "type": "object"
- },
- "QueryBase": {
- "additionalProperties": false,
- "properties": {
- "queryId": {
- "description": "Caller-supplied query ID.",
- "format": "uuid",
- "title": "Queryid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
- }
- },
- "required": [
- "queryId",
- "projectId"
- ],
- "title": "QueryBase",
- "type": "object"
- },
- "RectangleLayerContent": {
- "additionalProperties": false,
- "properties": {
- "width": {
- "description": "Width in pixels.",
- "maximum": 8192,
- "minimum": 1,
- "title": "Width",
- "type": "integer"
- },
- "height": {
- "description": "Height in pixels.",
- "maximum": 8192,
- "minimum": 1,
- "title": "Height",
- "type": "integer"
- },
- "kind": {
- "const": "rectangle",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
- },
- "color": {
- "description": "Serialized display color.",
- "pattern": "^#[0-9a-fA-F]{6}$",
- "title": "Color",
- "type": "string"
- }
- },
- "required": [
- "width",
- "height",
- "kind",
- "color"
- ],
- "title": "RectangleLayerContent",
- "type": "object"
- },
- "ReferenceAddCommand": {
- "additionalProperties": false,
- "description": "Add a generation reference; expectedVersions must include its target generation_spec.",
- "properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
- },
- "type": {
- "const": "reference.add",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
- },
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
+ "description": "User-visible name.",
+ "title": "Name"
},
- "expectedPreview": {
+ "sourceImage": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
+ "$ref": "#/$defs/AssetRef"
},
{
"type": "null"
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
- },
- "payload": {
- "$ref": "#/$defs/ReferenceWrite",
- "description": "Add a generation reference; expectedVersions must include its target generation_spec."
+ "description": "Source image used to extract palette colors."
}
},
- "required": [
- "commandId",
- "projectId",
- "type",
- "payload"
- ],
- "title": "ReferenceAddCommand",
+ "title": "PaletteData",
"type": "object"
},
- "ReferenceAddCommandOperation": {
+ "PaletteProvenance": {
"additionalProperties": false,
- "description": "Add a generation reference; expectedVersions must include its target generation_spec.",
"properties": {
- "type": {
- "const": "reference.add",
- "description": "Operation discriminator.",
- "title": "Type",
+ "paletteId": {
+ "description": "Palette ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Paletteid",
"type": "string"
},
- "payload": {
- "$ref": "#/$defs/ReferenceWrite",
- "description": "Add a generation reference; expectedVersions must include its target generation_spec."
+ "version": {
+ "description": "Version of the referenced record.",
+ "minimum": 1,
+ "title": "Version",
+ "type": "integer"
}
},
"required": [
- "type",
- "payload"
+ "paletteId",
+ "version"
],
- "title": "ReferenceAddCommandOperation",
+ "title": "PaletteProvenance",
"type": "object"
},
- "ReferenceBase": {
+ "PinnedReference": {
"additionalProperties": false,
"properties": {
"id": {
@@ -10111,67 +10772,37 @@
"description": "Whether this reference participates in generation.",
"title": "Active",
"type": "boolean"
- }
- },
- "required": [
- "id",
- "projectId",
- "targetSpecId"
- ],
- "title": "ReferenceBase",
- "type": "object"
- },
- "ReferenceRemove": {
- "additionalProperties": false,
- "properties": {
- "referenceId": {
- "description": "Generation reference ID.",
- "format": "uuid",
- "title": "Referenceid",
- "type": "string"
- }
- },
- "required": [
- "referenceId"
- ],
- "title": "ReferenceRemove",
- "type": "object"
- },
- "ReferenceRemoveCommand": {
- "additionalProperties": false,
- "description": "Deactivate a generation reference.",
- "properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ },
+ "binding": {
+ "const": "pinned",
+ "description": "Use a fixed asset version, retaining canvas provenance when supplied.",
+ "title": "Binding",
"type": "string"
},
- "type": {
- "const": "reference.remove",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
+ "source": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Fixed asset version used by generation."
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
+ "sourceVersion": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/CanvasItemVersion"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Source canvas item identity and revision. Required for canvas-derived references to retain their connection."
},
- "expectedPreview": {
+ "subjectRole": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
+ "enum": [
+ "main",
+ "auxiliary",
+ "voice"
+ ],
"type": "string"
},
{
@@ -10179,129 +10810,141 @@
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
- },
- "payload": {
- "$ref": "#/$defs/ReferenceRemove",
- "description": "Deactivate a generation reference."
+ "description": "Subject media slot provenance only; omit for ordinary image references and explicit first_frame/last_frame assets. main does not mean first frame.",
+ "title": "Subjectrole"
}
},
"required": [
- "commandId",
+ "id",
"projectId",
- "type",
- "payload"
+ "targetSpecId",
+ "binding",
+ "source"
],
- "title": "ReferenceRemoveCommand",
+ "title": "PinnedReference",
"type": "object"
},
- "ReferenceRemoveCommandOperation": {
+ "PinnedReferenceSource": {
"additionalProperties": false,
- "description": "Deactivate a generation reference.",
"properties": {
- "type": {
- "const": "reference.remove",
- "description": "Operation discriminator.",
- "title": "Type",
+ "binding": {
+ "const": "pinned",
+ "default": "pinned",
+ "description": "Use the fixed asset version.",
+ "title": "Binding",
"type": "string"
},
- "payload": {
- "$ref": "#/$defs/ReferenceRemove",
- "description": "Deactivate a generation reference."
+ "source": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Fixed current asset version."
+ },
+ "sourceVersion": {
+ "$ref": "#/$defs/CanvasItemVersion",
+ "description": "Canvas source version retaining the connection."
}
},
"required": [
- "type",
- "payload"
+ "source",
+ "sourceVersion"
],
- "title": "ReferenceRemoveCommandOperation",
+ "title": "PinnedReferenceSource",
"type": "object"
},
- "ReferenceRestoreCommand": {
+ "Playhead": {
"additionalProperties": false,
- "description": "Restore a generation reference.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
+ "editorDocumentId": {
+ "description": "Editable document ID.",
"format": "uuid",
- "title": "Commandid",
+ "title": "Editordocumentid",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "seconds": {
+ "default": 0,
+ "description": "Playhead position in seconds.",
+ "minimum": 0,
+ "title": "Seconds",
+ "type": "number"
+ }
+ },
+ "required": [
+ "editorDocumentId"
+ ],
+ "title": "Playhead",
+ "type": "object"
+ },
+ "Point": {
+ "additionalProperties": false,
+ "properties": {
+ "x": {
+ "default": 0,
+ "description": "Horizontal coordinate.",
+ "title": "X",
+ "type": "number"
},
- "type": {
- "const": "reference.restore",
- "description": "Command discriminator.",
- "title": "Type",
+ "y": {
+ "default": 0,
+ "description": "Vertical coordinate.",
+ "title": "Y",
+ "type": "number"
+ }
+ },
+ "title": "Point",
+ "type": "object"
+ },
+ "Project": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable object ID.",
+ "format": "uuid",
+ "title": "Id",
"type": "string"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
- },
- "expectedPreview": {
- "anyOf": [
- {
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
},
- "payload": {
- "$ref": "#/$defs/ReferenceWrite",
- "description": "Restore a generation reference."
+ "name": {
+ "description": "User-visible name.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Name",
+ "type": "string"
}
},
"required": [
- "commandId",
- "projectId",
- "type",
- "payload"
+ "id",
+ "name"
],
- "title": "ReferenceRestoreCommand",
+ "title": "Project",
"type": "object"
},
- "ReferenceRestoreCommandOperation": {
+ "ProjectCreate": {
"additionalProperties": false,
- "description": "Restore a generation reference.",
"properties": {
- "type": {
- "const": "reference.restore",
- "description": "Operation discriminator.",
- "title": "Type",
+ "name": {
+ "description": "User-visible name.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Name",
"type": "string"
- },
- "payload": {
- "$ref": "#/$defs/ReferenceWrite",
- "description": "Restore a generation reference."
}
},
"required": [
- "type",
- "payload"
+ "name"
],
- "title": "ReferenceRestoreCommandOperation",
+ "title": "ProjectCreate",
"type": "object"
},
- "ReferenceUpdateCommand": {
+ "ProjectCreateCommand": {
"additionalProperties": false,
- "description": "Update a generation reference.",
+ "description": "Create a project.",
"properties": {
"commandId": {
"description": "Stable command ID for idempotent replay.",
@@ -10316,7 +10959,7 @@
"type": "string"
},
"type": {
- "const": "reference.update",
+ "const": "project.create",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -10345,8 +10988,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/ReferenceWrite",
- "description": "Update a generation reference."
+ "$ref": "#/$defs/ProjectCreate",
+ "description": "Create a project."
}
},
"required": [
@@ -10355,120 +10998,65 @@
"type",
"payload"
],
- "title": "ReferenceUpdateCommand",
+ "title": "ProjectCreateCommand",
"type": "object"
},
- "ReferenceUpdateCommandOperation": {
+ "ProjectEntity": {
"additionalProperties": false,
- "description": "Update a generation reference.",
"properties": {
- "type": {
- "const": "reference.update",
- "description": "Operation discriminator.",
- "title": "Type",
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
"type": "string"
},
- "payload": {
- "$ref": "#/$defs/ReferenceWrite",
- "description": "Update a generation reference."
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
}
},
"required": [
- "type",
- "payload"
- ],
- "title": "ReferenceUpdateCommandOperation",
- "type": "object"
- },
- "ReferenceWrite": {
- "additionalProperties": false,
- "properties": {
- "reference": {
- "description": "Generation input reference. Preserve source canvas identity for canvas-derived references, whether following or pinned.",
- "discriminator": {
- "mapping": {
- "follow_current": "#/$defs/FollowingReference",
- "pinned": "#/$defs/PinnedReference"
- },
- "propertyName": "binding"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/PinnedReference"
- },
- {
- "$ref": "#/$defs/FollowingReference"
- }
- ],
- "title": "Reference"
- }
- },
- "required": [
- "reference"
+ "id",
+ "projectId"
],
- "title": "ReferenceWrite",
+ "title": "ProjectEntity",
"type": "object"
},
- "ResolvedReference": {
+ "ProjectEvent": {
"additionalProperties": false,
"properties": {
- "referenceId": {
- "description": "Generation reference ID.",
- "format": "uuid",
- "title": "Referenceid",
- "type": "string"
+ "schemaVersion": {
+ "const": 1,
+ "default": 1,
+ "description": "Record schema version.",
+ "title": "Schemaversion",
+ "type": "integer"
},
- "role": {
- "description": "Business role of this binding or reference.",
- "enum": [
- "reference",
- "first_frame",
- "last_frame",
- "continuation"
- ],
- "title": "Role",
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
"type": "string"
},
- "asset": {
- "$ref": "#/$defs/AssetRef",
- "description": "Immutable asset version."
- },
- "metadata": {
- "$ref": "#/$defs/MediaMetadata",
- "description": "Verified media properties."
- },
- "sourceVersion": {
- "anyOf": [
- {
- "$ref": "#/$defs/ObjectVersion"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Captured source object version."
- },
- "documentVersion": {
- "anyOf": [
- {
- "$ref": "#/$defs/ObjectVersion"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Version of the source editable document."
+ "cursor": {
+ "description": "Monotonically increasing project event cursor.",
+ "minimum": 1,
+ "title": "Cursor",
+ "type": "integer"
},
- "subjectRole": {
+ "commandId": {
"anyOf": [
{
- "enum": [
- "main",
- "auxiliary",
- "voice"
- ],
+ "format": "uuid",
"type": "string"
},
{
@@ -10476,108 +11064,99 @@
}
],
"default": null,
- "description": "Subject media slot used by this reference.",
- "title": "Subjectrole"
- },
- "name": {
- "default": "",
- "description": "User-visible name.",
- "maxLength": 255,
- "title": "Name",
- "type": "string"
- },
- "sourceTitle": {
- "default": "",
- "description": "Source canvas title captured for this reference.",
- "maxLength": 255,
- "title": "Sourcetitle",
- "type": "string"
+ "description": "Stable command ID for idempotent replay.",
+ "title": "Commandid"
},
- "transmission": {
- "default": "content",
- "description": "How reference content is sent to the provider.",
+ "source": {
+ "description": "Input source or recorded provenance.",
"enum": [
- "content",
- "metadata",
- "context_only",
- "latent"
+ "ui",
+ "agent",
+ "background",
+ "external"
],
- "title": "Transmission",
+ "title": "Source",
"type": "string"
+ },
+ "changed": {
+ "default": [],
+ "description": "Business objects changed by the operation.",
+ "items": {
+ "$ref": "#/$defs/ChangedObject"
+ },
+ "title": "Changed",
+ "type": "array"
+ },
+ "jobIds": {
+ "default": [],
+ "description": "Generation jobs associated with this operation.",
+ "items": {
+ "format": "uuid",
+ "type": "string"
+ },
+ "title": "Jobids",
+ "type": "array"
}
},
"required": [
- "referenceId",
- "role",
- "asset",
- "metadata"
+ "projectId",
+ "cursor",
+ "source"
],
- "title": "ResolvedReference",
+ "title": "ProjectEvent",
"type": "object"
},
- "ResultCheck": {
+ "ProjectQuery": {
"additionalProperties": false,
"properties": {
- "status": {
- "description": "Current operation lifecycle state.",
- "enum": [
- "passed",
- "failed"
- ],
- "title": "Status",
+ "queryId": {
+ "description": "Caller-supplied query ID.",
+ "format": "uuid",
+ "title": "Queryid",
"type": "string"
},
- "facts": {
- "additionalProperties": true,
- "description": "Observed technical validation facts.",
- "title": "Facts",
- "type": "object"
- },
- "message": {
- "description": "Human-readable issue description.",
- "title": "Message",
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
"type": "string"
},
- "humanReviewRequired": {
- "default": true,
- "description": "Whether creative quality still requires human review.",
- "title": "Humanreviewrequired",
- "type": "boolean"
+ "type": {
+ "const": "project.get",
+ "description": "Read the current project.",
+ "title": "Type",
+ "type": "string"
}
},
"required": [
- "status",
- "message"
+ "queryId",
+ "projectId",
+ "type"
],
- "title": "ResultCheck",
+ "title": "ProjectQuery",
"type": "object"
},
- "ResultSelect": {
+ "ProjectRename": {
"additionalProperties": false,
"properties": {
- "specId": {
- "description": "Generation configuration ID.",
- "format": "uuid",
- "title": "Specid",
- "type": "string"
- },
- "resultId": {
- "description": "Generation result ID.",
- "format": "uuid",
- "title": "Resultid",
+ "name": {
+ "description": "User-visible name.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Name",
"type": "string"
}
},
"required": [
- "specId",
- "resultId"
+ "name"
],
- "title": "ResultSelect",
+ "title": "ProjectRename",
"type": "object"
},
- "ResultSelectCommand": {
+ "ProjectRenameCommand": {
"additionalProperties": false,
- "description": "Adopt an existing generation result.",
+ "description": "Rename the project.",
"properties": {
"commandId": {
"description": "Stable command ID for idempotent replay.",
@@ -10592,7 +11171,7 @@
"type": "string"
},
"type": {
- "const": "result.select",
+ "const": "project.rename",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -10621,8 +11200,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/ResultSelect",
- "description": "Adopt an existing generation result."
+ "$ref": "#/$defs/ProjectRename",
+ "description": "Rename the project."
}
},
"required": [
@@ -10631,130 +11210,17 @@
"type",
"payload"
],
- "title": "ResultSelectCommand",
+ "title": "ProjectRenameCommand",
"type": "object"
},
- "ResultSelectCommandOperation": {
+ "ProjectRestoreCommand": {
"additionalProperties": false,
- "description": "Adopt an existing generation result.",
+ "description": "Restore a trashed project.",
"properties": {
- "type": {
- "const": "result.select",
- "description": "Operation discriminator.",
- "title": "Type",
- "type": "string"
- },
- "payload": {
- "$ref": "#/$defs/ResultSelect",
- "description": "Adopt an existing generation result."
- }
- },
- "required": [
- "type",
- "payload"
- ],
- "title": "ResultSelectCommandOperation",
- "type": "object"
- },
- "ResultVersion": {
- "additionalProperties": false,
- "properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
- "format": "uuid",
- "title": "Id",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
- },
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "specId": {
- "description": "Generation configuration ID.",
- "format": "uuid",
- "title": "Specid",
- "type": "string"
- },
- "jobId": {
- "description": "Generation job ID.",
- "format": "uuid",
- "title": "Jobid",
- "type": "string"
- },
- "asset": {
- "$ref": "#/$defs/AssetRef",
- "description": "Immutable asset version."
- },
- "inputFingerprint": {
- "description": "Fingerprint of the fixed execution input.",
- "pattern": "^[0-9a-f]{64}$",
- "title": "Inputfingerprint",
- "type": "string"
- }
- },
- "required": [
- "id",
- "projectId",
- "specId",
- "jobId",
- "asset",
- "inputFingerprint"
- ],
- "title": "ResultVersion",
- "type": "object"
- },
- "SelectionBox": {
- "additionalProperties": false,
- "properties": {
- "x": {
- "description": "Horizontal coordinate.",
- "title": "X",
- "type": "number"
- },
- "y": {
- "description": "Vertical coordinate.",
- "title": "Y",
- "type": "number"
- },
- "width": {
- "description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "title": "Width",
- "type": "number"
- },
- "height": {
- "description": "Height in pixels.",
- "exclusiveMinimum": 0,
- "title": "Height",
- "type": "number"
- }
- },
- "required": [
- "x",
- "y",
- "width",
- "height"
- ],
- "title": "SelectionBox",
- "type": "object"
- },
- "SpecCreateCommand": {
- "additionalProperties": false,
- "description": "Create a generation configuration without submitting a job.",
- "properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
"type": "string"
},
"projectId": {
@@ -10764,7 +11230,7 @@
"type": "string"
},
"type": {
- "const": "generationSpec.create",
+ "const": "project.restore",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -10793,8 +11259,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/SpecWrite",
- "description": "Create a generation configuration without submitting a job."
+ "$ref": "#/$defs/EmptyPayload",
+ "description": "Restore a trashed project."
}
},
"required": [
@@ -10803,201 +11269,242 @@
"type",
"payload"
],
- "title": "SpecCreateCommand",
+ "title": "ProjectRestoreCommand",
"type": "object"
},
- "SpecCreateCommandOperation": {
+ "ProjectSnapshot": {
"additionalProperties": false,
- "description": "Create a generation configuration without submitting a job.",
"properties": {
- "type": {
- "const": "generationSpec.create",
- "description": "Operation discriminator.",
- "title": "Type",
+ "format": {
+ "const": "opendirector-project",
+ "default": "opendirector-project",
+ "description": "Serialized format identifier.",
+ "title": "Format",
"type": "string"
},
- "payload": {
- "$ref": "#/$defs/SpecWrite",
- "description": "Create a generation configuration without submitting a job."
- }
- },
- "required": [
- "type",
- "payload"
- ],
- "title": "SpecCreateCommandOperation",
- "type": "object"
- },
- "SpecPromptCommand": {
- "additionalProperties": false,
- "description": "Update prompt text and structured references.",
- "properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
+ "formatVersion": {
+ "const": 2,
+ "default": 2,
+ "description": "Project format version.",
+ "title": "Formatversion",
+ "type": "integer"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "project": {
+ "$ref": "#/$defs/Project",
+ "description": "Project identity and current revision."
},
- "type": {
- "const": "generationSpec.setPrompt",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
+ "assets": {
+ "default": [],
+ "description": "Registered immutable assets.",
+ "items": {
+ "$ref": "#/$defs/Asset"
+ },
+ "title": "Assets",
+ "type": "array"
},
- "expectedVersions": {
+ "generationSpecs": {
"default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "description": "Editable generation configurations.",
"items": {
- "$ref": "#/$defs/ObjectVersion"
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioGenerationSpec",
+ "image": "#/$defs/ImageGenerationSpec",
+ "text": "#/$defs/TextGenerationSpec",
+ "video": "#/$defs/VideoGenerationSpec"
+ },
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TextGenerationSpec"
+ },
+ {
+ "$ref": "#/$defs/ImageGenerationSpec"
+ },
+ {
+ "$ref": "#/$defs/VideoGenerationSpec"
+ },
+ {
+ "$ref": "#/$defs/AudioGenerationSpec"
+ }
+ ]
},
- "title": "Expectedversions",
+ "title": "Generationspecs",
"type": "array"
},
- "expectedPreview": {
- "anyOf": [
- {
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
+ "references": {
+ "default": [],
+ "description": "Ordered generation reference bindings.",
+ "items": {
+ "description": "Generation input reference. Preserve source canvas identity for canvas-derived references, whether following or pinned.",
+ "discriminator": {
+ "mapping": {
+ "follow_current": "#/$defs/FollowingReference",
+ "pinned": "#/$defs/PinnedReference"
+ },
+ "propertyName": "binding"
},
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "oneOf": [
+ {
+ "$ref": "#/$defs/PinnedReference"
+ },
+ {
+ "$ref": "#/$defs/FollowingReference"
+ }
+ ]
+ },
+ "title": "References",
+ "type": "array"
},
- "payload": {
- "$ref": "#/$defs/SpecPromptWrite",
- "description": "Update prompt text and structured references."
- }
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "payload"
- ],
- "title": "SpecPromptCommand",
- "type": "object"
- },
- "SpecPromptCommandOperation": {
- "additionalProperties": false,
- "description": "Update prompt text and structured references.",
- "properties": {
- "type": {
- "const": "generationSpec.setPrompt",
- "description": "Operation discriminator.",
- "title": "Type",
- "type": "string"
- },
- "payload": {
- "$ref": "#/$defs/SpecPromptWrite",
- "description": "Update prompt text and structured references."
- }
- },
- "required": [
- "type",
- "payload"
- ],
- "title": "SpecPromptCommandOperation",
- "type": "object"
- },
- "SpecPromptWrite": {
- "additionalProperties": false,
- "properties": {
- "specId": {
- "description": "Generation configuration ID.",
- "format": "uuid",
- "title": "Specid",
- "type": "string"
- },
- "prompt": {
- "description": "Generation prompt text.",
- "maxLength": 20000,
- "title": "Prompt",
- "type": "string"
+ "canvasItems": {
+ "default": [],
+ "description": "Canvas display items, including hidden items.",
+ "items": {
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioCanvasItem",
+ "external": "#/$defs/DirectorCanvasItem",
+ "file": "#/$defs/FileCanvasItem",
+ "group": "#/$defs/GroupCanvasItem",
+ "image": "#/$defs/ImageCanvasItem",
+ "stack": "#/$defs/StackCanvasItem",
+ "subject": "#/$defs/SubjectCanvasItem",
+ "text": "#/$defs/TextCanvasItem",
+ "timeline": "#/$defs/TimelineCanvasItem",
+ "tool": "#/$defs/ToolCanvasItem",
+ "video": "#/$defs/VideoCanvasItem"
+ },
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TextCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/ImageCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/VideoCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/AudioCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/FileCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/SubjectCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/TimelineCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/StackCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/ToolCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/DirectorCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/GroupCanvasItem"
+ }
+ ]
+ },
+ "title": "Canvasitems",
+ "type": "array"
},
- "promptContent": {
- "anyOf": [
- {
- "items": {
- "discriminator": {
- "mapping": {
- "reference": "#/$defs/PromptReference",
- "text": "#/$defs/PromptText"
- },
- "propertyName": "type"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/PromptText"
- },
- {
- "$ref": "#/$defs/PromptReference"
- }
- ]
+ "editorDocuments": {
+ "default": [],
+ "description": "Persisted editable documents.",
+ "items": {
+ "discriminator": {
+ "mapping": {
+ "director": "#/$defs/DirectorDocument",
+ "image_crop": "#/$defs/ImageCropDocument",
+ "layers": "#/$defs/LayerDocument",
+ "media_edit": "#/$defs/MediaEditDocument",
+ "stack": "#/$defs/StackDocument",
+ "subject": "#/$defs/SubjectDocument",
+ "timeline": "#/$defs/TimelineDocument",
+ "tool": "#/$defs/ToolDocument"
},
- "type": "array"
+ "propertyName": "kind"
},
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Structured prompt text and reference tokens.",
- "title": "Promptcontent"
- }
- },
- "required": [
- "specId",
- "prompt"
- ],
- "title": "SpecPromptWrite",
- "type": "object"
- },
- "SpecRestore": {
- "additionalProperties": false,
- "properties": {
- "specId": {
- "description": "Generation configuration ID.",
- "format": "uuid",
- "title": "Specid",
- "type": "string"
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TimelineDocument"
+ },
+ {
+ "$ref": "#/$defs/SubjectDocument"
+ },
+ {
+ "$ref": "#/$defs/LayerDocument"
+ },
+ {
+ "$ref": "#/$defs/ImageCropDocument"
+ },
+ {
+ "$ref": "#/$defs/StackDocument"
+ },
+ {
+ "$ref": "#/$defs/ToolDocument"
+ },
+ {
+ "$ref": "#/$defs/DirectorDocument"
+ },
+ {
+ "$ref": "#/$defs/MediaEditDocument"
+ }
+ ]
+ },
+ "title": "Editordocuments",
+ "type": "array"
},
- "commandId": {
- "description": "Historical command providing the settings to restore.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
+ "jobs": {
+ "default": [],
+ "description": "Immutable generation execution records.",
+ "items": {
+ "$ref": "#/$defs/Job"
+ },
+ "title": "Jobs",
+ "type": "array"
},
- "referencePolicy": {
- "default": "follow_current",
- "description": "Policy for restoring associated reference bindings.",
- "enum": [
- "follow_current",
- "pinned"
- ],
- "title": "Referencepolicy",
- "type": "string"
+ "results": {
+ "default": [],
+ "description": "Generated result candidates and adoption history.",
+ "items": {
+ "$ref": "#/$defs/ResultVersion"
+ },
+ "title": "Results",
+ "type": "array"
+ },
+ "eventCursor": {
+ "default": 0,
+ "description": "Latest committed project event cursor.",
+ "minimum": 0,
+ "title": "Eventcursor",
+ "type": "integer"
+ },
+ "undoClearedThrough": {
+ "default": 0,
+ "description": "Event cursor through which undo history was cleared.",
+ "minimum": 0,
+ "title": "Undoclearedthrough",
+ "type": "integer"
}
},
"required": [
- "specId",
- "commandId"
+ "project"
],
- "title": "SpecRestore",
+ "title": "ProjectSnapshot",
"type": "object"
},
- "SpecRestoreCommand": {
+ "ProjectTrashCommand": {
"additionalProperties": false,
- "description": "Restore generation settings from a historical command.",
+ "description": "Move the project to trash.",
"properties": {
"commandId": {
"description": "Stable command ID for idempotent replay.",
@@ -11012,7 +11519,7 @@
"type": "string"
},
"type": {
- "const": "generationSpec.restore",
+ "const": "project.trash",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -11041,8 +11548,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/SpecRestore",
- "description": "Restore generation settings from a historical command."
+ "$ref": "#/$defs/EmptyPayload",
+ "description": "Move the project to trash."
}
},
"required": [
@@ -11051,27 +11558,138 @@
"type",
"payload"
],
- "title": "SpecRestoreCommand",
+ "title": "ProjectTrashCommand",
"type": "object"
},
- "SpecUpdateCommand": {
+ "PromptReference": {
"additionalProperties": false,
- "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
+ "type": {
+ "const": "reference",
+ "description": "Operation or variant discriminator.",
+ "title": "Type",
"type": "string"
},
- "projectId": {
+ "referenceId": {
+ "description": "Generation reference ID.",
+ "format": "uuid",
+ "title": "Referenceid",
+ "type": "string"
+ }
+ },
+ "required": [
+ "type",
+ "referenceId"
+ ],
+ "title": "PromptReference",
+ "type": "object"
+ },
+ "PromptText": {
+ "additionalProperties": false,
+ "properties": {
+ "type": {
+ "const": "text",
+ "description": "Operation or variant discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "text": {
+ "description": "UTF-8 text content or search query.",
+ "maxLength": 20000,
+ "title": "Text",
+ "type": "string"
+ }
+ },
+ "required": [
+ "type",
+ "text"
+ ],
+ "title": "PromptText",
+ "type": "object"
+ },
+ "QueryBase": {
+ "additionalProperties": false,
+ "properties": {
+ "queryId": {
+ "description": "Caller-supplied query ID.",
+ "format": "uuid",
+ "title": "Queryid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ }
+ },
+ "required": [
+ "queryId",
+ "projectId"
+ ],
+ "title": "QueryBase",
+ "type": "object"
+ },
+ "RectangleLayerContent": {
+ "additionalProperties": false,
+ "properties": {
+ "width": {
+ "description": "Width in pixels.",
+ "maximum": 8192,
+ "minimum": 1,
+ "title": "Width",
+ "type": "integer"
+ },
+ "height": {
+ "description": "Height in pixels.",
+ "maximum": 8192,
+ "minimum": 1,
+ "title": "Height",
+ "type": "integer"
+ },
+ "kind": {
+ "const": "rectangle",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "color": {
+ "description": "Serialized display color.",
+ "examples": [
+ "#000000"
+ ],
+ "pattern": "^#[0-9a-fA-F]{6}$",
+ "title": "Color",
+ "type": "string"
+ }
+ },
+ "required": [
+ "width",
+ "height",
+ "kind",
+ "color"
+ ],
+ "title": "RectangleLayerContent",
+ "type": "object"
+ },
+ "ReferenceAddCommand": {
+ "additionalProperties": false,
+ "description": "Add a generation reference; expectedVersions must include its target generation_spec.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
"description": "Owning project ID.",
"format": "uuid",
"title": "Projectid",
"type": "string"
},
"type": {
- "const": "generationSpec.update",
+ "const": "reference.add",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -11100,8 +11718,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/SpecWrite",
- "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged."
+ "$ref": "#/$defs/ReferenceWrite",
+ "description": "Add a generation reference; expectedVersions must include its target generation_spec."
}
},
"required": [
@@ -11110,69 +11728,32 @@
"type",
"payload"
],
- "title": "SpecUpdateCommand",
+ "title": "ReferenceAddCommand",
"type": "object"
},
- "SpecUpdateCommandOperation": {
+ "ReferenceAddCommandOperation": {
"additionalProperties": false,
- "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged.",
+ "description": "Add a generation reference; expectedVersions must include its target generation_spec.",
"properties": {
"type": {
- "const": "generationSpec.update",
+ "const": "reference.add",
"description": "Operation discriminator.",
"title": "Type",
"type": "string"
},
"payload": {
- "$ref": "#/$defs/SpecWrite",
- "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged."
+ "$ref": "#/$defs/ReferenceWrite",
+ "description": "Add a generation reference; expectedVersions must include its target generation_spec."
}
},
"required": [
"type",
"payload"
],
- "title": "SpecUpdateCommandOperation",
- "type": "object"
- },
- "SpecWrite": {
- "additionalProperties": false,
- "properties": {
- "spec": {
- "description": "Complete configuration with its current revision; the server increments it on commit. For updates, read the current spec, preserve unedited fields and submit its current expected version. Accepted job snapshots never change.",
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioGenerationSpec",
- "image": "#/$defs/ImageGenerationSpec",
- "text": "#/$defs/TextGenerationSpec",
- "video": "#/$defs/VideoGenerationSpec"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TextGenerationSpec"
- },
- {
- "$ref": "#/$defs/ImageGenerationSpec"
- },
- {
- "$ref": "#/$defs/VideoGenerationSpec"
- },
- {
- "$ref": "#/$defs/AudioGenerationSpec"
- }
- ],
- "title": "Spec"
- }
- },
- "required": [
- "spec"
- ],
- "title": "SpecWrite",
+ "title": "ReferenceAddCommandOperation",
"type": "object"
},
- "StackCanvasItem": {
+ "ReferenceBase": {
"additionalProperties": false,
"properties": {
"id": {
@@ -11194,126 +11775,70 @@
"title": "Revision",
"type": "integer"
},
- "kind": {
- "const": "stack",
- "description": "Business object or media type.",
- "title": "Kind",
+ "targetSpecId": {
+ "description": "Target generation configuration ID.",
+ "format": "uuid",
+ "title": "Targetspecid",
"type": "string"
},
- "title": {
- "default": "",
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
+ "role": {
+ "default": "reference",
+ "description": "Business role of this binding or reference.",
+ "enum": [
+ "reference",
+ "first_frame",
+ "last_frame",
+ "continuation"
+ ],
+ "title": "Role",
"type": "string"
},
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
- },
- "width": {
- "default": 352,
- "description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "title": "Width",
- "type": "number"
- },
- "height": {
- "default": 198,
- "description": "Height in pixels.",
- "exclusiveMinimum": 0,
- "title": "Height",
- "type": "number"
- },
- "zIndex": {
+ "order": {
"default": 0,
- "description": "Canvas stacking order.",
- "title": "Zindex",
+ "description": "Reference ordering within the target configuration.",
+ "minimum": 0,
+ "title": "Order",
"type": "integer"
},
- "locked": {
- "default": false,
- "description": "Whether edits to this object are blocked.",
- "title": "Locked",
- "type": "boolean"
- },
- "visible": {
+ "active": {
"default": true,
- "description": "Whether this object is displayed.",
- "title": "Visible",
+ "description": "Whether this reference participates in generation.",
+ "title": "Active",
"type": "boolean"
- },
- "parentId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Parent canvas group ID, or null for the root.",
- "title": "Parentid"
- },
- "tags": {
- "default": [],
- "description": "User-defined search tags.",
- "items": {
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "type": "string"
- },
- "title": "Tags",
- "type": "array"
- },
- "binding": {
- "$ref": "#/$defs/EditorBinding",
- "description": "Business object displayed by this canvas item."
}
},
"required": [
"id",
"projectId",
- "kind",
- "binding"
+ "targetSpecId"
],
- "title": "StackCanvasItem",
+ "title": "ReferenceBase",
"type": "object"
},
- "StackData": {
+ "ReferenceRemove": {
"additionalProperties": false,
"properties": {
- "nodeIds": {
- "default": [],
- "description": "Ordered member canvas item IDs.",
- "items": {
- "format": "uuid",
- "type": "string"
- },
- "title": "Nodeids",
- "type": "array"
- },
- "activeIndex": {
- "default": 0,
- "description": "Index of the active member.",
- "minimum": 0,
- "title": "Activeindex",
- "type": "integer"
+ "referenceId": {
+ "description": "Generation reference ID.",
+ "format": "uuid",
+ "title": "Referenceid",
+ "type": "string"
}
},
- "title": "StackData",
+ "required": [
+ "referenceId"
+ ],
+ "title": "ReferenceRemove",
"type": "object"
},
- "StackDocument": {
+ "ReferenceRemoveCommand": {
"additionalProperties": false,
+ "description": "Deactivate a generation reference.",
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
"format": "uuid",
- "title": "Id",
+ "title": "Commandid",
"type": "string"
},
"projectId": {
@@ -11322,260 +11847,160 @@
"title": "Projectid",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "schemaVersion": {
- "const": 1,
- "default": 1,
- "description": "Record schema version.",
- "title": "Schemaversion",
- "type": "integer"
+ "type": {
+ "const": "reference.remove",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
},
- "inputConnections": {
+ "expectedVersions": {
"default": [],
- "description": "Persisted connections to source assets.",
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
"items": {
- "$ref": "#/$defs/EditorInputConnection"
+ "$ref": "#/$defs/ObjectVersion"
},
- "title": "Inputconnections",
+ "title": "Expectedversions",
"type": "array"
},
- "kind": {
- "const": "stack",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "data": {
- "$ref": "#/$defs/StackData",
- "description": "Typed editable document contents."
+ "payload": {
+ "$ref": "#/$defs/ReferenceRemove",
+ "description": "Deactivate a generation reference."
}
},
"required": [
- "id",
+ "commandId",
"projectId",
- "kind",
- "data"
- ],
- "title": "StackDocument",
- "type": "object"
- },
- "StageCamera": {
- "additionalProperties": false,
- "properties": {
- "position": {
- "$ref": "#/$defs/Vector3",
- "description": "Position in the owning canvas or stage."
- },
- "target": {
- "$ref": "#/$defs/Vector3",
- "description": "Camera look-at position."
- },
- "fov": {
- "description": "Camera vertical field of view in degrees.",
- "exclusiveMaximum": 180,
- "exclusiveMinimum": 0,
- "title": "Fov",
- "type": "number"
- }
- },
- "required": [
- "position",
- "target",
- "fov"
+ "type",
+ "payload"
],
- "title": "StageCamera",
+ "title": "ReferenceRemoveCommand",
"type": "object"
},
- "StageMotion": {
+ "ReferenceRemoveCommandOperation": {
"additionalProperties": false,
+ "description": "Deactivate a generation reference.",
"properties": {
- "preset": {
- "description": "Selected generation or motion preset.",
- "enum": [
- "idle",
- "walk",
- "run",
- "wave"
- ],
- "title": "Preset",
+ "type": {
+ "const": "reference.remove",
+ "description": "Operation discriminator.",
+ "title": "Type",
"type": "string"
},
- "speed": {
- "description": "Playback or motion speed multiplier.",
- "exclusiveMinimum": 0,
- "title": "Speed",
- "type": "number"
- },
- "amount": {
- "description": "Magnitude of the procedural motion.",
- "maximum": 1,
- "minimum": 0,
- "title": "Amount",
- "type": "number"
+ "payload": {
+ "$ref": "#/$defs/ReferenceRemove",
+ "description": "Deactivate a generation reference."
}
},
"required": [
- "preset",
- "speed",
- "amount"
+ "type",
+ "payload"
],
- "title": "StageMotion",
+ "title": "ReferenceRemoveCommandOperation",
"type": "object"
},
- "StageObject": {
+ "ReferenceRestoreCommand": {
"additionalProperties": false,
+ "description": "Restore a generation reference.",
"properties": {
- "position": {
- "$ref": "#/$defs/Vector3",
- "description": "Position in the owning canvas or stage."
- },
- "rotation": {
- "$ref": "#/$defs/Vector3",
- "description": "Rotation in radians around each stage axis."
- },
- "scale": {
- "$ref": "#/$defs/Vector3",
- "description": "Positive scale along each stage axis."
- },
- "id": {
- "description": "Stable object ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Id",
- "type": "string"
- },
- "kind": {
- "description": "Business object or media type.",
- "enum": [
- "person",
- "box",
- "sphere"
- ],
- "title": "Kind",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
"type": "string"
},
- "name": {
- "description": "User-visible name.",
- "maxLength": 255,
- "title": "Name",
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
"type": "string"
},
- "color": {
- "description": "Serialized display color.",
- "pattern": "^#[0-9a-fA-F]{6}$",
- "title": "Color",
+ "type": {
+ "const": "reference.restore",
+ "description": "Command discriminator.",
+ "title": "Type",
"type": "string"
},
- "keyframes": {
+ "expectedVersions": {
"default": [],
- "description": "Ordered animation keyframes.",
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
"items": {
- "$ref": "#/$defs/TransformFrame"
+ "$ref": "#/$defs/ObjectVersion"
},
- "title": "Keyframes",
+ "title": "Expectedversions",
"type": "array"
},
- "motionClips": {
- "default": [],
- "description": "Ordered procedural motion intervals.",
- "items": {
- "$ref": "#/$defs/MotionClip"
- },
- "title": "Motionclips",
- "type": "array"
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/ReferenceWrite",
+ "description": "Restore a generation reference."
}
},
"required": [
- "position",
- "rotation",
- "scale",
- "id",
- "kind",
- "name",
- "color"
+ "commandId",
+ "projectId",
+ "type",
+ "payload"
],
- "title": "StageObject",
+ "title": "ReferenceRestoreCommand",
"type": "object"
},
- "StageShot": {
+ "ReferenceRestoreCommandOperation": {
"additionalProperties": false,
+ "description": "Restore a generation reference.",
"properties": {
- "id": {
- "description": "Stable object ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Id",
- "type": "string"
- },
- "cameraId": {
- "description": "Stage camera ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Cameraid",
+ "type": {
+ "const": "reference.restore",
+ "description": "Operation discriminator.",
+ "title": "Type",
"type": "string"
},
- "start": {
- "description": "Start time in seconds.",
- "minimum": 0,
- "title": "Start",
- "type": "number"
- },
- "duration": {
- "description": "Interval duration in seconds.",
- "exclusiveMinimum": 0,
- "title": "Duration",
- "type": "number"
- }
- },
- "required": [
- "id",
- "cameraId",
- "start",
- "duration"
- ],
- "title": "StageShot",
- "type": "object"
- },
- "StageTransform": {
- "additionalProperties": false,
- "properties": {
- "position": {
- "$ref": "#/$defs/Vector3",
- "description": "Position in the owning canvas or stage."
- },
- "rotation": {
- "$ref": "#/$defs/Vector3",
- "description": "Rotation in radians around each stage axis."
- },
- "scale": {
- "$ref": "#/$defs/Vector3",
- "description": "Positive scale along each stage axis."
+ "payload": {
+ "$ref": "#/$defs/ReferenceWrite",
+ "description": "Restore a generation reference."
}
},
"required": [
- "position",
- "rotation",
- "scale"
+ "type",
+ "payload"
],
- "title": "StageTransform",
+ "title": "ReferenceRestoreCommandOperation",
"type": "object"
},
- "SubjectCanvasItem": {
+ "ReferenceUpdateCommand": {
"additionalProperties": false,
+ "description": "Update a generation reference.",
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
"format": "uuid",
- "title": "Id",
+ "title": "Commandid",
"type": "string"
},
"projectId": {
@@ -11584,66 +12009,25 @@
"title": "Projectid",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "kind": {
- "const": "subject",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
- },
- "title": {
- "default": "",
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
+ "type": {
+ "const": "reference.update",
+ "description": "Command discriminator.",
+ "title": "Type",
"type": "string"
},
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
- },
- "width": {
- "default": 352,
- "description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "title": "Width",
- "type": "number"
- },
- "height": {
- "default": 198,
- "description": "Height in pixels.",
- "exclusiveMinimum": 0,
- "title": "Height",
- "type": "number"
- },
- "zIndex": {
- "default": 0,
- "description": "Canvas stacking order.",
- "title": "Zindex",
- "type": "integer"
- },
- "locked": {
- "default": false,
- "description": "Whether edits to this object are blocked.",
- "title": "Locked",
- "type": "boolean"
- },
- "visible": {
- "default": true,
- "description": "Whether this object is displayed.",
- "title": "Visible",
- "type": "boolean"
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
},
- "parentId": {
+ "expectedPreview": {
"anyOf": [
{
- "format": "uuid",
+ "pattern": "^[0-9a-f]{64}$",
"type": "string"
},
{
@@ -11651,198 +12035,248 @@
}
],
"default": null,
- "description": "Parent canvas group ID, or null for the root.",
- "title": "Parentid"
- },
- "tags": {
- "default": [],
- "description": "User-defined search tags.",
- "items": {
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "type": "string"
- },
- "title": "Tags",
- "type": "array"
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "binding": {
- "$ref": "#/$defs/EditorBinding",
- "description": "Business object displayed by this canvas item."
+ "payload": {
+ "$ref": "#/$defs/ReferenceWrite",
+ "description": "Update a generation reference."
}
},
"required": [
- "id",
+ "commandId",
"projectId",
- "kind",
- "binding"
+ "type",
+ "payload"
],
- "title": "SubjectCanvasItem",
+ "title": "ReferenceUpdateCommand",
"type": "object"
},
- "SubjectData": {
+ "ReferenceUpdateCommandOperation": {
"additionalProperties": false,
+ "description": "Update a generation reference.",
"properties": {
- "description": {
- "default": "",
- "description": "User-facing annotation only; not subject media or a generation reference",
- "maxLength": 20000,
- "title": "Description",
- "type": "string"
- },
- "category": {
- "default": "",
- "description": "Subject category.",
- "maxLength": 100,
- "title": "Category",
+ "type": {
+ "const": "reference.update",
+ "description": "Operation discriminator.",
+ "title": "Type",
"type": "string"
},
- "main": {
- "anyOf": [
- {
- "$ref": "#/$defs/AssetRef"
+ "payload": {
+ "$ref": "#/$defs/ReferenceWrite",
+ "description": "Update a generation reference."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "ReferenceUpdateCommandOperation",
+ "type": "object"
+ },
+ "ReferenceWrite": {
+ "additionalProperties": false,
+ "properties": {
+ "reference": {
+ "description": "Generation input reference. Preserve source canvas identity for canvas-derived references, whether following or pinned.",
+ "discriminator": {
+ "mapping": {
+ "follow_current": "#/$defs/FollowingReference",
+ "pinned": "#/$defs/PinnedReference"
},
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Primary subject media."
- },
- "auxiliaries": {
- "default": [],
- "description": "Ordered auxiliary subject media.",
- "items": {
- "$ref": "#/$defs/AssetRef"
+ "propertyName": "binding"
},
- "maxItems": 3,
- "title": "Auxiliaries",
- "type": "array"
- },
- "voice": {
- "anyOf": [
+ "oneOf": [
{
- "$ref": "#/$defs/AssetRef"
+ "$ref": "#/$defs/PinnedReference"
},
{
- "type": "null"
+ "$ref": "#/$defs/FollowingReference"
}
],
- "default": null,
- "description": "Subject voice asset version."
- },
- "librarySource": {
+ "title": "Reference"
+ }
+ },
+ "required": [
+ "reference"
+ ],
+ "title": "ReferenceWrite",
+ "type": "object"
+ },
+ "ResolvedReference": {
+ "additionalProperties": false,
+ "properties": {
+ "referenceId": {
+ "description": "Generation reference ID.",
+ "format": "uuid",
+ "title": "Referenceid",
+ "type": "string"
+ },
+ "role": {
+ "description": "Business role of this binding or reference.",
+ "enum": [
+ "reference",
+ "first_frame",
+ "last_frame",
+ "continuation"
+ ],
+ "title": "Role",
+ "type": "string"
+ },
+ "asset": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Immutable asset version."
+ },
+ "metadata": {
+ "$ref": "#/$defs/MediaMetadata",
+ "description": "Verified media properties."
+ },
+ "sourceVersion": {
"anyOf": [
{
- "$ref": "#/$defs/SubjectLibrarySource"
+ "$ref": "#/$defs/ObjectVersion"
},
{
"type": "null"
}
],
"default": null,
- "description": "Immutable source library version."
+ "description": "Captured source object version."
+ },
+ "documentVersion": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Version of the source editable document."
+ },
+ "subjectRole": {
+ "anyOf": [
+ {
+ "enum": [
+ "main",
+ "auxiliary",
+ "voice"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Subject media slot used by this reference.",
+ "title": "Subjectrole"
+ },
+ "name": {
+ "default": "",
+ "description": "User-visible name.",
+ "maxLength": 255,
+ "title": "Name",
+ "type": "string"
+ },
+ "sourceTitle": {
+ "default": "",
+ "description": "Source canvas title captured for this reference.",
+ "maxLength": 255,
+ "title": "Sourcetitle",
+ "type": "string"
+ },
+ "transmission": {
+ "default": "content",
+ "description": "How reference content is sent to the provider.",
+ "enum": [
+ "content",
+ "metadata",
+ "context_only",
+ "latent"
+ ],
+ "title": "Transmission",
+ "type": "string"
}
},
- "title": "SubjectData",
+ "required": [
+ "referenceId",
+ "role",
+ "asset",
+ "metadata"
+ ],
+ "title": "ResolvedReference",
"type": "object"
},
- "SubjectDocument": {
+ "ResultCheck": {
"additionalProperties": false,
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
- "format": "uuid",
- "title": "Id",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ "status": {
+ "description": "Current operation lifecycle state.",
+ "enum": [
+ "passed",
+ "failed"
+ ],
+ "title": "Status",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "schemaVersion": {
- "const": 1,
- "default": 1,
- "description": "Record schema version.",
- "title": "Schemaversion",
- "type": "integer"
- },
- "inputConnections": {
- "default": [],
- "description": "Persisted connections to source assets.",
- "items": {
- "$ref": "#/$defs/EditorInputConnection"
- },
- "title": "Inputconnections",
- "type": "array"
+ "facts": {
+ "additionalProperties": true,
+ "description": "Observed technical validation facts.",
+ "title": "Facts",
+ "type": "object"
},
- "kind": {
- "const": "subject",
- "description": "Business object or media type.",
- "title": "Kind",
+ "message": {
+ "description": "Human-readable issue description.",
+ "title": "Message",
"type": "string"
},
- "data": {
- "$ref": "#/$defs/SubjectData",
- "description": "Typed editable document contents."
+ "humanReviewRequired": {
+ "default": true,
+ "description": "Whether creative quality still requires human review.",
+ "title": "Humanreviewrequired",
+ "type": "boolean"
}
},
"required": [
- "id",
- "projectId",
- "kind",
- "data"
+ "status",
+ "message"
],
- "title": "SubjectDocument",
+ "title": "ResultCheck",
"type": "object"
},
- "SubjectLibrarySource": {
+ "ResultSelect": {
"additionalProperties": false,
- "description": "Frozen import provenance; subsequent editing never follows the library.",
"properties": {
- "itemId": {
- "description": "Canvas item ID.",
+ "specId": {
+ "description": "Generation configuration ID.",
"format": "uuid",
- "title": "Itemid",
+ "title": "Specid",
"type": "string"
},
- "revision": {
- "description": "Captured library item revision.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "importId": {
- "description": "Library import ID.",
+ "resultId": {
+ "description": "Generation result ID.",
"format": "uuid",
- "title": "Importid",
+ "title": "Resultid",
"type": "string"
}
},
"required": [
- "itemId",
- "revision",
- "importId"
+ "specId",
+ "resultId"
],
- "title": "SubjectLibrarySource",
+ "title": "ResultSelect",
"type": "object"
},
- "TextCanvasItem": {
+ "ResultSelectCommand": {
"additionalProperties": false,
+ "description": "Adopt an existing generation result.",
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
"format": "uuid",
- "title": "Id",
+ "title": "Commandid",
"type": "string"
},
"projectId": {
@@ -11851,66 +12285,25 @@
"title": "Projectid",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "kind": {
- "const": "text",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
- },
- "title": {
- "default": "",
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
+ "type": {
+ "const": "result.select",
+ "description": "Command discriminator.",
+ "title": "Type",
"type": "string"
},
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
- },
- "width": {
- "default": 352,
- "description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "title": "Width",
- "type": "number"
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
},
- "height": {
- "default": 198,
- "description": "Height in pixels.",
- "exclusiveMinimum": 0,
- "title": "Height",
- "type": "number"
- },
- "zIndex": {
- "default": 0,
- "description": "Canvas stacking order.",
- "title": "Zindex",
- "type": "integer"
- },
- "locked": {
- "default": false,
- "description": "Whether edits to this object are blocked.",
- "title": "Locked",
- "type": "boolean"
- },
- "visible": {
- "default": true,
- "description": "Whether this object is displayed.",
- "title": "Visible",
- "type": "boolean"
- },
- "parentId": {
+ "expectedPreview": {
"anyOf": [
{
- "format": "uuid",
+ "pattern": "^[0-9a-f]{64}$",
"type": "string"
},
{
@@ -11918,100 +12311,46 @@
}
],
"default": null,
- "description": "Parent canvas group ID, or null for the root.",
- "title": "Parentid"
- },
- "tags": {
- "default": [],
- "description": "User-defined search tags.",
- "items": {
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "type": "string"
- },
- "title": "Tags",
- "type": "array"
- },
- "binding": {
- "description": "Business object displayed by this canvas item.",
- "discriminator": {
- "mapping": {
- "empty": "#/$defs/EmptyBinding",
- "generation": "#/$defs/GenerationBinding",
- "material": "#/$defs/MaterialBinding"
- },
- "propertyName": "role"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/EmptyBinding"
- },
- {
- "$ref": "#/$defs/MaterialBinding"
- },
- {
- "$ref": "#/$defs/GenerationBinding"
- }
- ],
- "title": "Binding"
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "editors": {
- "default": [],
- "description": "Attached editable documents.",
- "items": {
- "$ref": "#/$defs/EditorRef"
- },
- "title": "Editors",
- "type": "array"
+ "payload": {
+ "$ref": "#/$defs/ResultSelect",
+ "description": "Adopt an existing generation result."
}
},
"required": [
- "id",
+ "commandId",
"projectId",
- "kind",
- "binding"
+ "type",
+ "payload"
],
- "title": "TextCanvasItem",
+ "title": "ResultSelectCommand",
"type": "object"
},
- "TextExecution": {
+ "ResultSelectCommandOperation": {
"additionalProperties": false,
+ "description": "Adopt an existing generation result.",
"properties": {
- "thinking": {
- "default": "auto",
- "description": "Requested reasoning effort.",
- "enum": [
- "auto",
- "low",
- "medium",
- "high"
- ],
- "title": "Thinking",
+ "type": {
+ "const": "result.select",
+ "description": "Operation discriminator.",
+ "title": "Type",
"type": "string"
},
- "maxTokens": {
- "default": 8192,
- "description": "Maximum generated text tokens.",
- "maximum": 32768,
- "minimum": 1,
- "title": "Maxtokens",
- "type": "integer"
- },
- "kind": {
- "const": "text",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
+ "payload": {
+ "$ref": "#/$defs/ResultSelect",
+ "description": "Adopt an existing generation result."
}
},
"required": [
- "kind"
+ "type",
+ "payload"
],
- "title": "TextExecution",
+ "title": "ResultSelectCommandOperation",
"type": "object"
},
- "TextGenerationSpec": {
+ "ResultVersion": {
"additionalProperties": false,
"properties": {
"id": {
@@ -12033,188 +12372,83 @@
"title": "Revision",
"type": "integer"
},
- "purpose": {
- "default": "draft",
- "description": "Draft settings or executable generation configuration.",
- "enum": [
- "draft",
- "generation"
- ],
- "title": "Purpose",
+ "specId": {
+ "description": "Generation configuration ID.",
+ "format": "uuid",
+ "title": "Specid",
"type": "string"
},
- "modelConfigId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Model configuration ID from the model catalog or user model selections.",
- "title": "Modelconfigid"
- },
- "prompt": {
- "default": "",
- "description": "Generation prompt text.",
- "maxLength": 20000,
- "title": "Prompt",
+ "jobId": {
+ "description": "Generation job ID.",
+ "format": "uuid",
+ "title": "Jobid",
"type": "string"
},
- "promptContent": {
- "anyOf": [
- {
- "items": {
- "discriminator": {
- "mapping": {
- "reference": "#/$defs/PromptReference",
- "text": "#/$defs/PromptText"
- },
- "propertyName": "type"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/PromptText"
- },
- {
- "$ref": "#/$defs/PromptReference"
- }
- ]
- },
- "type": "array"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Structured prompt text and reference tokens.",
- "title": "Promptcontent"
- },
- "currentResultId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Currently adopted result ID.",
- "title": "Currentresultid"
+ "asset": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Immutable asset version."
},
- "kind": {
- "const": "text",
- "description": "Business object or media type.",
- "title": "Kind",
+ "inputFingerprint": {
+ "description": "Fingerprint of the fixed execution input.",
+ "pattern": "^[0-9a-f]{64}$",
+ "title": "Inputfingerprint",
"type": "string"
- },
- "parameters": {
- "$ref": "#/$defs/TextParameters",
- "description": "Typed generation or editing parameters."
}
},
"required": [
"id",
"projectId",
- "kind"
+ "specId",
+ "jobId",
+ "asset",
+ "inputFingerprint"
],
- "title": "TextGenerationSpec",
+ "title": "ResultVersion",
"type": "object"
},
- "TextLayerContent": {
+ "SelectionBox": {
"additionalProperties": false,
"properties": {
+ "x": {
+ "description": "Horizontal coordinate.",
+ "title": "X",
+ "type": "number"
+ },
+ "y": {
+ "description": "Vertical coordinate.",
+ "title": "Y",
+ "type": "number"
+ },
"width": {
"description": "Width in pixels.",
- "maximum": 8192,
- "minimum": 1,
+ "exclusiveMinimum": 0,
"title": "Width",
- "type": "integer"
+ "type": "number"
},
"height": {
"description": "Height in pixels.",
- "maximum": 8192,
- "minimum": 1,
+ "exclusiveMinimum": 0,
"title": "Height",
- "type": "integer"
- },
- "kind": {
- "const": "text",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
- },
- "text": {
- "description": "UTF-8 text content or search query.",
- "maxLength": 10000,
- "title": "Text",
- "type": "string"
- },
- "color": {
- "description": "Serialized display color.",
- "pattern": "^#[0-9a-fA-F]{6}$",
- "title": "Color",
- "type": "string"
- },
- "fontSize": {
- "description": "Text size in pixels.",
- "maximum": 1000,
- "minimum": 4,
- "title": "Fontsize",
"type": "number"
}
},
"required": [
+ "x",
+ "y",
"width",
- "height",
- "kind",
- "text",
- "color",
- "fontSize"
+ "height"
],
- "title": "TextLayerContent",
- "type": "object"
- },
- "TextParameters": {
- "additionalProperties": false,
- "properties": {
- "thinking": {
- "default": "auto",
- "description": "Requested reasoning effort.",
- "enum": [
- "auto",
- "low",
- "medium",
- "high"
- ],
- "title": "Thinking",
- "type": "string"
- },
- "maxTokens": {
- "default": 8192,
- "description": "Maximum generated text tokens.",
- "maximum": 32768,
- "minimum": 1,
- "title": "Maxtokens",
- "type": "integer"
- }
- },
- "title": "TextParameters",
+ "title": "SelectionBox",
"type": "object"
},
- "TimelineCanvasItem": {
+ "SpecCreateCommand": {
"additionalProperties": false,
+ "description": "Create a generation configuration without submitting a job.",
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
"format": "uuid",
- "title": "Id",
+ "title": "Commandid",
"type": "string"
},
"projectId": {
@@ -12223,66 +12457,25 @@
"title": "Projectid",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "kind": {
- "const": "timeline",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
- },
- "title": {
- "default": "",
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
+ "type": {
+ "const": "generationSpec.create",
+ "description": "Command discriminator.",
+ "title": "Type",
"type": "string"
},
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
- },
- "width": {
- "default": 352,
- "description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "title": "Width",
- "type": "number"
- },
- "height": {
- "default": 198,
- "description": "Height in pixels.",
- "exclusiveMinimum": 0,
- "title": "Height",
- "type": "number"
- },
- "zIndex": {
- "default": 0,
- "description": "Canvas stacking order.",
- "title": "Zindex",
- "type": "integer"
- },
- "locked": {
- "default": false,
- "description": "Whether edits to this object are blocked.",
- "title": "Locked",
- "type": "boolean"
- },
- "visible": {
- "default": true,
- "description": "Whether this object is displayed.",
- "title": "Visible",
- "type": "boolean"
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
},
- "parentId": {
+ "expectedPreview": {
"anyOf": [
{
- "format": "uuid",
+ "pattern": "^[0-9a-f]{64}$",
"type": "string"
},
{
@@ -12290,183 +12483,220 @@
}
],
"default": null,
- "description": "Parent canvas group ID, or null for the root.",
- "title": "Parentid"
- },
- "tags": {
- "default": [],
- "description": "User-defined search tags.",
- "items": {
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "type": "string"
- },
- "title": "Tags",
- "type": "array"
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "binding": {
- "$ref": "#/$defs/EditorBinding",
- "description": "Business object displayed by this canvas item."
+ "payload": {
+ "$ref": "#/$defs/SpecWrite",
+ "description": "Create a generation configuration without submitting a job."
}
},
"required": [
- "id",
+ "commandId",
"projectId",
- "kind",
- "binding"
+ "type",
+ "payload"
],
- "title": "TimelineCanvasItem",
+ "title": "SpecCreateCommand",
"type": "object"
},
- "TimelineClip": {
+ "SpecCreateCommandOperation": {
"additionalProperties": false,
+ "description": "Create a generation configuration without submitting a job.",
"properties": {
- "id": {
- "description": "Stable object ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Id",
+ "type": {
+ "const": "generationSpec.create",
+ "description": "Operation discriminator.",
+ "title": "Type",
"type": "string"
},
- "resource": {
- "$ref": "#/$defs/TimelineResource",
- "description": "Clip source from the imported asset collection."
+ "payload": {
+ "$ref": "#/$defs/SpecWrite",
+ "description": "Create a generation configuration without submitting a job."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "SpecCreateCommandOperation",
+ "type": "object"
+ },
+ "SpecPromptCommand": {
+ "additionalProperties": false,
+ "description": "Update prompt text and structured references.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
},
- "start": {
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "generationSpec.setPrompt",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
"anyOf": [
{
- "minimum": 0,
- "type": "number"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Start time in seconds.",
- "title": "Start"
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "inPoint": {
- "description": "Source trim start in seconds.",
- "minimum": 0,
- "title": "Inpoint",
- "type": "number"
+ "payload": {
+ "$ref": "#/$defs/SpecPromptWrite",
+ "description": "Update prompt text and structured references."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "payload"
+ ],
+ "title": "SpecPromptCommand",
+ "type": "object"
+ },
+ "SpecPromptCommandOperation": {
+ "additionalProperties": false,
+ "description": "Update prompt text and structured references.",
+ "properties": {
+ "type": {
+ "const": "generationSpec.setPrompt",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
},
- "outPoint": {
- "description": "Source trim end in seconds.",
- "exclusiveMinimum": 0,
- "title": "Outpoint",
- "type": "number"
- },
- "speed": {
- "default": 1,
- "description": "Playback or motion speed multiplier.",
- "exclusiveMinimum": 0,
- "title": "Speed",
- "type": "number"
- },
- "volume": {
- "default": 1,
- "description": "Linear audio gain.",
- "maximum": 1,
- "minimum": 0,
- "title": "Volume",
- "type": "number"
- },
- "muted": {
- "default": false,
- "description": "Whether audio output is muted.",
- "title": "Muted",
- "type": "boolean"
+ "payload": {
+ "$ref": "#/$defs/SpecPromptWrite",
+ "description": "Update prompt text and structured references."
}
},
"required": [
- "id",
- "resource",
- "inPoint",
- "outPoint"
+ "type",
+ "payload"
],
- "title": "TimelineClip",
+ "title": "SpecPromptCommandOperation",
"type": "object"
},
- "TimelineData": {
+ "SpecPromptWrite": {
"additionalProperties": false,
"properties": {
- "fps": {
- "description": "Frames per second.",
- "minimum": 1,
- "title": "Fps",
- "type": "integer"
- },
- "width": {
- "description": "Width in pixels.",
- "minimum": 1,
- "title": "Width",
- "type": "integer"
- },
- "height": {
- "description": "Height in pixels.",
- "minimum": 1,
- "title": "Height",
- "type": "integer"
+ "specId": {
+ "description": "Generation configuration ID.",
+ "format": "uuid",
+ "title": "Specid",
+ "type": "string"
},
- "tracks": {
- "description": "Ordered timeline tracks.",
- "items": {
- "$ref": "#/$defs/TimelineTrack"
- },
- "minItems": 1,
- "title": "Tracks",
- "type": "array"
+ "prompt": {
+ "description": "Generation prompt text.",
+ "maxLength": 20000,
+ "title": "Prompt",
+ "type": "string"
},
- "importedAssets": {
- "default": [],
- "description": "Source assets available to timeline clips.",
- "items": {
- "$ref": "#/$defs/TimelineResource"
- },
- "title": "Importedassets",
- "type": "array"
+ "promptContent": {
+ "anyOf": [
+ {
+ "items": {
+ "discriminator": {
+ "mapping": {
+ "reference": "#/$defs/PromptReference",
+ "text": "#/$defs/PromptText"
+ },
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/PromptText"
+ },
+ {
+ "$ref": "#/$defs/PromptReference"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Structured prompt text and reference tokens.",
+ "title": "Promptcontent"
+ }
+ },
+ "required": [
+ "specId",
+ "prompt"
+ ],
+ "title": "SpecPromptWrite",
+ "type": "object"
+ },
+ "SpecRestore": {
+ "additionalProperties": false,
+ "properties": {
+ "specId": {
+ "description": "Generation configuration ID.",
+ "format": "uuid",
+ "title": "Specid",
+ "type": "string"
},
- "fonts": {
- "default": [],
- "description": "Document-local registered font resources; omitted when empty.",
- "items": {
- "$ref": "#/$defs/TimelineFontResource"
- },
- "maxItems": 16,
- "title": "Fonts",
- "type": "array"
+ "commandId": {
+ "description": "Historical command providing the settings to restore.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
},
- "overlays": {
- "default": [],
- "description": "Timed text ordered from bottom to top; omitted when empty.",
- "items": {
- "$ref": "#/$defs/TimelineTextOverlay"
- },
- "maxItems": 2000,
- "title": "Overlays",
- "type": "array"
+ "referencePolicy": {
+ "default": "follow_current",
+ "description": "Policy for restoring associated reference bindings.",
+ "enum": [
+ "follow_current",
+ "pinned"
+ ],
+ "title": "Referencepolicy",
+ "type": "string"
}
},
"required": [
- "fps",
- "width",
- "height",
- "tracks"
+ "specId",
+ "commandId"
],
- "title": "TimelineData",
+ "title": "SpecRestore",
"type": "object"
},
- "TimelineDocument": {
+ "SpecRestoreCommand": {
"additionalProperties": false,
+ "description": "Restore generation settings from a historical command.",
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
"format": "uuid",
- "title": "Id",
+ "title": "Commandid",
"type": "string"
},
"projectId": {
@@ -12475,219 +12705,242 @@
"title": "Projectid",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "schemaVersion": {
- "const": 1,
- "default": 1,
- "description": "Record schema version.",
- "title": "Schemaversion",
- "type": "integer"
+ "type": {
+ "const": "generationSpec.restore",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
},
- "inputConnections": {
+ "expectedVersions": {
"default": [],
- "description": "Persisted connections to source assets.",
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
"items": {
- "$ref": "#/$defs/EditorInputConnection"
+ "$ref": "#/$defs/ObjectVersion"
},
- "title": "Inputconnections",
+ "title": "Expectedversions",
"type": "array"
},
- "kind": {
- "const": "timeline",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "data": {
- "$ref": "#/$defs/TimelineData",
- "description": "Typed editable document contents."
+ "payload": {
+ "$ref": "#/$defs/SpecRestore",
+ "description": "Restore generation settings from a historical command."
}
},
"required": [
- "id",
+ "commandId",
"projectId",
- "kind",
- "data"
+ "type",
+ "payload"
],
- "title": "TimelineDocument",
+ "title": "SpecRestoreCommand",
"type": "object"
},
- "TimelineFontResource": {
+ "SpecUpdateCommand": {
"additionalProperties": false,
+ "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged.",
"properties": {
- "id": {
- "description": "Stable document-local font ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Id",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
"type": "string"
},
- "title": {
- "description": "Display title of the font.",
- "maxLength": 255,
- "title": "Title",
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
"type": "string"
},
- "asset": {
- "$ref": "#/$defs/AssetRef",
- "description": "Immutable registered font asset version."
+ "type": {
+ "const": "generationSpec.update",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/SpecWrite",
+ "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged."
}
},
"required": [
- "id",
- "title",
- "asset"
+ "commandId",
+ "projectId",
+ "type",
+ "payload"
],
- "title": "TimelineFontResource",
+ "title": "SpecUpdateCommand",
"type": "object"
},
- "TimelinePackageExportFile": {
+ "SpecUpdateCommandOperation": {
"additionalProperties": false,
+ "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged.",
"properties": {
- "editorId": {
- "description": "Saved timeline ID in the active project.",
- "format": "uuid",
- "title": "Editorid",
+ "type": {
+ "const": "generationSpec.update",
+ "description": "Operation discriminator.",
+ "title": "Type",
"type": "string"
},
- "revision": {
- "description": "Exact saved revision to export.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "path": {
- "description": "New output file under the active execution directory.",
- "maxLength": 4096,
- "minLength": 1,
- "title": "Path",
- "type": "string"
+ "payload": {
+ "$ref": "#/$defs/SpecWrite",
+ "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged."
}
},
"required": [
- "editorId",
- "revision",
- "path"
+ "type",
+ "payload"
],
- "title": "TimelinePackageExportFile",
+ "title": "SpecUpdateCommandOperation",
"type": "object"
},
- "TimelinePackageImportFile": {
+ "SpecWrite": {
"additionalProperties": false,
"properties": {
- "operationId": {
- "description": "Stable import operation identity.",
- "format": "uuid",
- "title": "Operationid",
- "type": "string"
- },
- "archiveFingerprint": {
- "description": "Expected SHA-256 of archive bytes.",
- "pattern": "^sha256:[0-9a-f]{64}$",
- "title": "Archivefingerprint",
- "type": "string"
- },
- "path": {
- "description": "Existing bundle under the active execution directory.",
- "maxLength": 4096,
- "minLength": 1,
- "title": "Path",
- "type": "string"
- },
- "replaceEditorId": {
- "anyOf": [
+ "spec": {
+ "description": "Complete configuration with its current revision; the server increments it on commit. For updates, read the current spec, preserve unedited fields and submit its current expected version. Accepted job snapshots never change.",
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioGenerationSpec",
+ "image": "#/$defs/ImageGenerationSpec",
+ "text": "#/$defs/TextGenerationSpec",
+ "video": "#/$defs/VideoGenerationSpec"
+ },
+ "propertyName": "kind"
+ },
+ "oneOf": [
{
- "format": "uuid",
- "type": "string"
+ "$ref": "#/$defs/TextGenerationSpec"
},
{
- "type": "null"
- }
- ],
- "default": null,
- "description": "Explicit replacement target.",
- "title": "Replaceeditorid"
- },
- "expectedRevision": {
- "anyOf": [
+ "$ref": "#/$defs/ImageGenerationSpec"
+ },
{
- "minimum": 1,
- "type": "integer"
+ "$ref": "#/$defs/VideoGenerationSpec"
},
{
- "type": "null"
+ "$ref": "#/$defs/AudioGenerationSpec"
}
],
- "default": null,
- "description": "Expected replacement revision.",
- "title": "Expectedrevision"
+ "title": "Spec"
}
},
"required": [
- "operationId",
- "archiveFingerprint",
- "path"
+ "spec"
],
- "title": "TimelinePackageImportFile",
+ "title": "SpecWrite",
"type": "object"
},
- "TimelinePackageImportReceipt": {
+ "StackCanvasItem": {
"additionalProperties": false,
"properties": {
- "operationId": {
- "description": "Import identity.",
+ "id": {
+ "description": "Stable identity of this project-owned object.",
"format": "uuid",
- "title": "Operationid",
+ "title": "Id",
"type": "string"
},
- "status": {
- "description": "Partial registration, complete publication, or terminal rejection.",
- "enum": [
- "registered",
- "applied",
- "rejected"
- ],
- "title": "Status",
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
"type": "string"
},
- "editorId": {
- "description": "Stable destination document ID.",
- "format": "uuid",
- "title": "Editorid",
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "kind": {
+ "const": "stack",
+ "description": "Business object or media type.",
+ "title": "Kind",
"type": "string"
},
- "registeredAssetIds": {
- "default": [],
- "description": "Resources actually committed before final publication.",
- "items": {
- "format": "uuid",
- "type": "string"
- },
- "title": "Registeredassetids",
- "type": "array"
+ "title": {
+ "default": "",
+ "description": "User-visible title.",
+ "maxLength": 255,
+ "title": "Title",
+ "type": "string"
},
- "receipt": {
- "anyOf": [
- {
- "$ref": "#/$defs/CommandReceipt"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Final atomic business command receipt, when committed."
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
},
- "errorCode": {
+ "width": {
+ "default": 352,
+ "description": "Width in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Width",
+ "type": "number"
+ },
+ "height": {
+ "default": 198,
+ "description": "Height in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Height",
+ "type": "number"
+ },
+ "zIndex": {
+ "default": 0,
+ "description": "Canvas stacking order.",
+ "title": "Zindex",
+ "type": "integer"
+ },
+ "locked": {
+ "default": false,
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
+ "type": "boolean"
+ },
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
+ },
+ "parentId": {
"anyOf": [
{
+ "format": "uuid",
"type": "string"
},
{
@@ -12695,553 +12948,537 @@
}
],
"default": null,
- "description": "Stable failure code for retryable registration failure.",
- "title": "Errorcode"
- }
- },
- "required": [
- "operationId",
- "status",
- "editorId"
- ],
- "title": "TimelinePackageImportReceipt",
- "type": "object"
- },
- "TimelinePackageImportRequest": {
- "additionalProperties": false,
- "properties": {
- "operationId": {
- "description": "Stable identity for this entire import and all retries.",
- "format": "uuid",
- "title": "Operationid",
- "type": "string"
- },
- "uploadHandle": {
- "description": "Project/session-owned staged ZIP upload.",
- "format": "uuid",
- "title": "Uploadhandle",
- "type": "string"
- },
- "archiveFingerprint": {
- "description": "Fixed archive bytes for recovery and replay.",
- "pattern": "^sha256:[0-9a-f]{64}$",
- "title": "Archivefingerprint",
- "type": "string"
+ "description": "Parent canvas group ID, or null for the root.",
+ "title": "Parentid"
},
- "replaceEditorId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Explicit replacement target; omitted creates a timeline.",
- "title": "Replaceeditorid"
+ "tags": {
+ "default": [],
+ "description": "User-defined search tags.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Tags",
+ "type": "array"
},
- "expectedRevision": {
- "anyOf": [
- {
- "minimum": 1,
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Required original revision for replacement.",
- "title": "Expectedrevision"
+ "binding": {
+ "$ref": "#/$defs/EditorBinding",
+ "description": "Business object displayed by this canvas item."
}
},
"required": [
- "operationId",
- "uploadHandle",
- "archiveFingerprint"
+ "id",
+ "projectId",
+ "kind",
+ "binding"
],
- "title": "TimelinePackageImportRequest",
+ "title": "StackCanvasItem",
"type": "object"
},
- "TimelinePackageManifest": {
+ "StackData": {
"additionalProperties": false,
"properties": {
- "format": {
- "const": "opendirector-timeline-bundle",
- "default": "opendirector-timeline-bundle",
- "description": "Native bundle format.",
- "title": "Format",
- "type": "string"
- },
- "version": {
- "const": 1,
- "default": 1,
- "description": "Native bundle format version.",
- "title": "Version",
- "type": "integer"
- },
- "requiredCapabilities": {
+ "nodeIds": {
"default": [],
- "description": "Required editable document capabilities.",
+ "description": "Ordered member canvas item IDs.",
"items": {
- "const": "timeline.text.v1",
+ "format": "uuid",
"type": "string"
},
- "maxItems": 1,
- "title": "Requiredcapabilities",
+ "title": "Nodeids",
"type": "array"
},
- "resources": {
- "description": "Distinct logical resources; paths may share identical bytes.",
- "items": {
- "$ref": "#/$defs/TimelinePackageResource"
- },
- "maxItems": 4093,
- "title": "Resources",
- "type": "array"
+ "activeIndex": {
+ "default": 0,
+ "description": "Index of the active member.",
+ "minimum": 0,
+ "title": "Activeindex",
+ "type": "integer"
}
},
- "required": [
- "resources"
- ],
- "title": "TimelinePackageManifest",
+ "title": "StackData",
"type": "object"
},
- "TimelinePackageResource": {
+ "StackDocument": {
"additionalProperties": false,
"properties": {
- "source": {
- "$ref": "#/$defs/AssetRef",
- "description": "Original logical reference; only a package mapping key."
- },
- "name": {
- "description": "Original resource filename.",
- "maxLength": 255,
- "minLength": 1,
- "title": "Name",
- "type": "string"
- },
- "path": {
- "description": "Content-addressed archive member.",
- "pattern": "^assets/[0-9a-f]{64}\\.[a-z0-9]{1,10}$",
- "title": "Path",
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
"type": "string"
},
- "kind": {
- "description": "Verified media kind.",
- "enum": [
- "text",
- "image",
- "video",
- "audio",
- "file"
- ],
- "title": "Kind",
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
"type": "string"
},
- "mimeType": {
- "description": "Verified MIME type.",
- "maxLength": 255,
- "minLength": 1,
- "title": "Mimetype",
- "type": "string"
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
},
- "size": {
- "description": "Actual resource byte count.",
- "maximum": 536870912,
- "minimum": 0,
- "title": "Size",
+ "schemaVersion": {
+ "const": 1,
+ "default": 1,
+ "description": "Record schema version.",
+ "title": "Schemaversion",
"type": "integer"
},
- "fingerprint": {
- "description": "SHA-256 identity of resource bytes.",
- "pattern": "^sha256:[0-9a-f]{64}$",
- "title": "Fingerprint",
+ "inputConnections": {
+ "default": [],
+ "description": "Persisted connections to source assets.",
+ "items": {
+ "$ref": "#/$defs/EditorInputConnection"
+ },
+ "title": "Inputconnections",
+ "type": "array"
+ },
+ "kind": {
+ "const": "stack",
+ "description": "Business object or media type.",
+ "title": "Kind",
"type": "string"
+ },
+ "data": {
+ "$ref": "#/$defs/StackData",
+ "description": "Typed editable document contents."
}
},
"required": [
- "source",
- "name",
- "path",
+ "id",
+ "projectId",
"kind",
- "mimeType",
- "size",
- "fingerprint"
+ "data"
],
- "title": "TimelinePackageResource",
+ "title": "StackDocument",
"type": "object"
},
- "TimelinePublishRender": {
+ "StageBezierTransition": {
"additionalProperties": false,
"properties": {
- "itemId": {
- "description": "Canvas item ID.",
- "format": "uuid",
- "title": "Itemid",
- "type": "string"
- },
- "editorId": {
- "description": "Editable document ID.",
- "format": "uuid",
- "title": "Editorid",
- "type": "string"
- },
- "asset": {
- "$ref": "#/$defs/AssetRef",
- "description": "Immutable asset version."
- },
- "outputId": {
- "description": "Published canvas output ID.",
- "format": "uuid",
- "title": "Outputid",
+ "kind": {
+ "const": "bezier",
+ "description": "Cubic Bezier interpolation for the outgoing segment.",
+ "title": "Kind",
"type": "string"
},
- "expectedOutputRevision": {
- "anyOf": [
+ "controlPoints": {
+ "description": "Normalized x1, y1, x2 and y2 control points.",
+ "maxItems": 4,
+ "minItems": 4,
+ "prefixItems": [
{
- "minimum": 1,
- "type": "integer"
+ "maximum": 1,
+ "minimum": 0,
+ "type": "number"
},
{
- "type": "null"
+ "maximum": 1,
+ "minimum": 0,
+ "type": "number"
+ },
+ {
+ "maximum": 1,
+ "minimum": 0,
+ "type": "number"
+ },
+ {
+ "maximum": 1,
+ "minimum": 0,
+ "type": "number"
}
],
- "default": null,
- "description": "Current output node revision when appending a rendered version.",
- "title": "Expectedoutputrevision"
- },
- "title": {
- "default": "合成视频",
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
- "type": "string"
- },
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
+ "title": "Controlpoints",
+ "type": "array"
}
},
"required": [
- "itemId",
- "editorId",
- "asset",
- "outputId"
+ "kind",
+ "controlPoints"
],
- "title": "TimelinePublishRender",
+ "title": "StageBezierTransition",
"type": "object"
},
- "TimelinePublishRenderCommand": {
+ "StageCamera": {
"additionalProperties": false,
- "description": "Publish a rendered timeline result.",
+ "examples": [
+ {
+ "fov": 45,
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 1
+ },
+ "roll": 0,
+ "target": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ ],
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
- },
- "type": {
- "const": "timeline.publishRender",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
+ "position": {
+ "$ref": "#/$defs/Vector3",
+ "description": "Position in the owning canvas or stage."
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
+ "target": {
+ "$ref": "#/$defs/Vector3",
+ "description": "Camera look-at position."
},
- "expectedPreview": {
- "anyOf": [
- {
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "fov": {
+ "description": "Camera vertical field of view in degrees.",
+ "exclusiveMaximum": 180,
+ "exclusiveMinimum": 0,
+ "title": "Fov",
+ "type": "number"
},
- "payload": {
- "$ref": "#/$defs/TimelinePublishRender",
- "description": "Publish a rendered timeline result."
+ "roll": {
+ "default": 0.0,
+ "description": "Roll around the view axis in radians.",
+ "maximum": 3.141592653589793,
+ "minimum": -3.141592653589793,
+ "title": "Roll",
+ "type": "number"
}
},
"required": [
- "commandId",
- "projectId",
- "type",
- "payload"
+ "position",
+ "target",
+ "fov"
],
- "title": "TimelinePublishRenderCommand",
+ "title": "StageCamera",
"type": "object"
},
- "TimelineResource": {
+ "StageEnvironment": {
"additionalProperties": false,
+ "description": "The named environment used by the retained Director scene.",
"properties": {
- "asset": {
- "$ref": "#/$defs/AssetRef",
- "description": "Immutable asset version."
+ "preset": {
+ "default": "studio",
+ "description": "Environment preset reference. 环境预设引用。",
+ "enum": [
+ "studio",
+ "warm-sunset",
+ "moonlit"
+ ],
+ "title": "Preset",
+ "type": "string"
},
- "title": {
- "description": "Display title of the imported asset.",
- "maxLength": 255,
- "title": "Title",
+ "groundColor": {
+ "default": "#181818",
+ "description": "Ground plane color. 地面颜色。",
+ "examples": [
+ "#000000"
+ ],
+ "pattern": "^#[0-9a-fA-F]{6}$",
+ "title": "Groundcolor",
"type": "string"
},
- "durationSeconds": {
+ "groundVisible": {
+ "default": true,
+ "description": "Whether the ground plane is visible. 是否显示地面。",
+ "title": "Groundvisible",
+ "type": "boolean"
+ },
+ "exposure": {
+ "default": 1.0,
+ "description": "Scene exposure from zero to four. 场景曝光范围为 0 到 4。",
+ "maximum": 4,
+ "minimum": 0,
+ "title": "Exposure",
+ "type": "number"
+ },
+ "backgroundAsset": {
"anyOf": [
{
- "exclusiveMinimum": 0,
- "type": "number"
+ "$ref": "#/$defs/AssetRef"
},
{
"type": "null"
}
],
"default": null,
- "description": "Duration in seconds.",
- "title": "Durationseconds"
+ "description": "Optional registered image asset used as the stage background. 可选的已登记图片背景素材。"
}
},
- "required": [
- "asset",
- "title"
- ],
- "title": "TimelineResource",
+ "title": "StageEnvironment",
"type": "object"
},
- "TimelineTextBackground": {
+ "StageLight": {
"additionalProperties": false,
"properties": {
+ "id": {
+ "description": "Stable light role. 稳定灯光角色。",
+ "enum": [
+ "hemisphere",
+ "key",
+ "fill"
+ ],
+ "title": "Id",
+ "type": "string"
+ },
"color": {
- "description": "Background color in #RRGGBB format.",
+ "description": "Light color in #RRGGBB format. 灯光颜色。",
+ "examples": [
+ "#000000"
+ ],
"pattern": "^#[0-9a-fA-F]{6}$",
"title": "Color",
"type": "string"
},
- "opacity": {
- "description": "Background opacity.",
- "maximum": 1,
+ "intensity": {
+ "description": "Light intensity from zero to ten. 灯光强度范围为 0 到 10。",
+ "maximum": 10,
"minimum": 0,
- "title": "Opacity",
+ "title": "Intensity",
"type": "number"
},
- "padding": {
- "description": "Background padding in output pixels.",
- "maximum": 128,
- "minimum": 0,
- "title": "Padding",
- "type": "number"
+ "position": {
+ "$ref": "#/$defs/Vector3",
+ "description": "Light position in stage coordinates. 灯光在舞台坐标中的位置。"
+ },
+ "castShadow": {
+ "default": false,
+ "description": "Whether the light casts shadows. 是否投射阴影。",
+ "title": "Castshadow",
+ "type": "boolean"
}
},
"required": [
+ "id",
"color",
- "opacity",
- "padding"
+ "intensity",
+ "position"
],
- "title": "TimelineTextBackground",
+ "title": "StageLight",
"type": "object"
},
- "TimelineTextOverlay": {
+ "StageMotion": {
"additionalProperties": false,
"properties": {
- "id": {
- "description": "Stable document-local text ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Id",
+ "preset": {
+ "description": "Selected generation or motion preset.",
+ "enum": [
+ "idle",
+ "walk",
+ "run",
+ "wave"
+ ],
+ "title": "Preset",
"type": "string"
},
- "start": {
- "description": "Absolute start time in seconds.",
- "minimum": 0,
- "title": "Start",
- "type": "number"
- },
- "end": {
- "description": "Exclusive absolute end time in seconds.",
+ "speed": {
+ "description": "Playback or motion speed multiplier.",
"exclusiveMinimum": 0,
- "title": "End",
- "type": "number"
- },
- "text": {
- "description": "Plain text normalized to LF, counted in Unicode code points.",
- "maxLength": 4096,
- "minLength": 1,
- "title": "Text",
- "type": "string"
- },
- "x": {
- "description": "Normalized text box left position.",
- "maximum": 1,
- "minimum": 0,
- "title": "X",
+ "title": "Speed",
"type": "number"
},
- "y": {
- "description": "Normalized text box top position.",
+ "amount": {
+ "description": "Magnitude of the procedural motion.",
"maximum": 1,
"minimum": 0,
- "title": "Y",
- "type": "number"
- },
- "maxWidth": {
- "description": "Text box width as a fraction of output width.",
- "exclusiveMinimum": 0,
- "maximum": 1,
- "title": "Maxwidth",
+ "title": "Amount",
"type": "number"
- },
- "fontId": {
- "description": "Font resource ID in this document.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Fontid",
- "type": "string"
- },
- "style": {
- "$ref": "#/$defs/TimelineTextStyle",
- "description": "Output-space text styling."
- },
- "sourceAsset": {
- "anyOf": [
- {
- "$ref": "#/$defs/AssetRef"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Frozen source text asset, independent of subsequent edits."
}
},
"required": [
- "id",
- "start",
- "end",
- "text",
- "x",
- "y",
- "maxWidth",
- "fontId",
- "style"
+ "preset",
+ "speed",
+ "amount"
],
- "title": "TimelineTextOverlay",
+ "title": "StageMotion",
"type": "object"
},
- "TimelineTextStroke": {
+ "StageObject": {
"additionalProperties": false,
"properties": {
- "color": {
- "description": "Stroke color in #RRGGBB format.",
- "pattern": "^#[0-9a-fA-F]{6}$",
- "title": "Color",
+ "position": {
+ "$ref": "#/$defs/Vector3",
+ "description": "Position in the owning canvas or stage."
+ },
+ "rotation": {
+ "$ref": "#/$defs/Vector3",
+ "description": "Rotation in radians around each stage axis."
+ },
+ "scale": {
+ "$ref": "#/$defs/Vector3",
+ "description": "Positive scale along each stage axis."
+ },
+ "id": {
+ "description": "Stable object ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
"type": "string"
},
- "width": {
- "description": "Stroke width in output pixels.",
- "maximum": 32,
- "minimum": 0,
- "title": "Width",
- "type": "number"
- }
- },
- "required": [
- "color",
- "width"
- ],
- "title": "TimelineTextStroke",
- "type": "object"
- },
- "TimelineTextStyle": {
- "additionalProperties": false,
- "properties": {
- "fontSize": {
- "description": "Font size in output pixels.",
- "maximum": 512,
- "minimum": 1,
- "title": "Fontsize",
- "type": "number"
+ "kind": {
+ "description": "Business object or media type.",
+ "enum": [
+ "person",
+ "box",
+ "sphere",
+ "gltf",
+ "cylinder",
+ "cone",
+ "pyramid",
+ "torus",
+ "plane",
+ "capsule",
+ "disk",
+ "arc",
+ "halfCylinder"
+ ],
+ "title": "Kind",
+ "type": "string"
+ },
+ "name": {
+ "description": "User-visible name.",
+ "maxLength": 255,
+ "title": "Name",
+ "type": "string"
},
"color": {
- "description": "Text color in #RRGGBB format.",
+ "description": "Serialized display color.",
+ "examples": [
+ "#000000"
+ ],
"pattern": "^#[0-9a-fA-F]{6}$",
"title": "Color",
"type": "string"
},
- "align": {
- "description": "Horizontal text alignment.",
- "enum": [
- "left",
- "center",
- "right"
- ],
- "title": "Align",
- "type": "string"
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
},
- "lineHeight": {
- "description": "Line height as a font size multiplier.",
- "maximum": 3,
- "minimum": 0.8,
- "title": "Lineheight",
+ "locked": {
+ "default": false,
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
+ "type": "boolean"
+ },
+ "opacity": {
+ "default": 1,
+ "description": "Layer opacity from zero to one.",
+ "maximum": 1,
+ "minimum": 0,
+ "title": "Opacity",
"type": "number"
},
- "background": {
+ "keyframes": {
+ "default": [],
+ "description": "Ordered animation keyframes.",
+ "items": {
+ "$ref": "#/$defs/TransformFrame"
+ },
+ "title": "Keyframes",
+ "type": "array"
+ },
+ "motionClips": {
+ "default": [],
+ "description": "Ordered procedural motion intervals.",
+ "items": {
+ "$ref": "#/$defs/MotionClip"
+ },
+ "title": "Motionclips",
+ "type": "array"
+ },
+ "asset": {
"anyOf": [
{
- "$ref": "#/$defs/TimelineTextBackground"
+ "$ref": "#/$defs/AssetRef"
},
{
"type": "null"
}
],
"default": null,
- "description": "Optional text background."
+ "description": "Registered GLB or self-contained GLTF asset for an imported stage object."
},
- "stroke": {
+ "thumbnailAsset": {
"anyOf": [
{
- "$ref": "#/$defs/TimelineTextStroke"
+ "$ref": "#/$defs/AssetRef"
},
{
"type": "null"
}
],
"default": null,
- "description": "Optional text stroke."
+ "description": "Registered image asset used by the stage object card thumbnail."
+ },
+ "role": {
+ "anyOf": [
+ {
+ "enum": [
+ "character",
+ "scene"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Imported stage object role.",
+ "title": "Role"
+ },
+ "format": {
+ "anyOf": [
+ {
+ "enum": [
+ "glb",
+ "gltf"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Imported stage asset container format.",
+ "title": "Format"
+ },
+ "animationNames": {
+ "default": [],
+ "description": "Animation clip names discovered in the imported asset.",
+ "items": {
+ "type": "string"
+ },
+ "title": "Animationnames",
+ "type": "array"
+ },
+ "hasAnimation": {
+ "default": false,
+ "description": "Whether the imported asset contains animation clips.",
+ "title": "Hasanimation",
+ "type": "boolean"
}
},
"required": [
- "fontSize",
- "color",
- "align",
- "lineHeight"
+ "position",
+ "rotation",
+ "scale",
+ "id",
+ "kind",
+ "name",
+ "color"
],
- "title": "TimelineTextStyle",
+ "title": "StageObject",
"type": "object"
},
- "TimelineTrack": {
+ "StageShot": {
"additionalProperties": false,
"properties": {
"id": {
@@ -13252,46 +13489,104 @@
"title": "Id",
"type": "string"
},
- "kind": {
- "description": "Business object or media type.",
- "enum": [
- "visual",
- "audio"
- ],
- "title": "Kind",
- "type": "string"
- },
- "title": {
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
+ "cameraId": {
+ "description": "Stage camera ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Cameraid",
"type": "string"
},
- "muted": {
- "default": false,
- "description": "Whether audio output is muted.",
- "title": "Muted",
- "type": "boolean"
+ "start": {
+ "description": "Start time in seconds.",
+ "minimum": 0,
+ "title": "Start",
+ "type": "number"
},
- "clips": {
- "default": [],
- "description": "Ordered clips on this track.",
- "items": {
- "$ref": "#/$defs/TimelineClip"
- },
- "title": "Clips",
- "type": "array"
+ "duration": {
+ "description": "Interval duration in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Duration",
+ "type": "number"
}
},
"required": [
"id",
- "kind",
- "title"
+ "cameraId",
+ "start",
+ "duration"
],
- "title": "TimelineTrack",
+ "title": "StageShot",
"type": "object"
},
- "ToolCanvasItem": {
+ "StageTransform": {
+ "additionalProperties": false,
+ "properties": {
+ "position": {
+ "$ref": "#/$defs/Vector3",
+ "description": "Position in the owning canvas or stage."
+ },
+ "rotation": {
+ "$ref": "#/$defs/Vector3",
+ "description": "Rotation in radians around each stage axis."
+ },
+ "scale": {
+ "$ref": "#/$defs/Vector3",
+ "description": "Positive scale along each stage axis."
+ }
+ },
+ "required": [
+ "position",
+ "rotation",
+ "scale"
+ ],
+ "title": "StageTransform",
+ "type": "object"
+ },
+ "StageTransformTransitions": {
+ "additionalProperties": false,
+ "properties": {
+ "position": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/StageBezierTransition"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Outgoing position interpolation."
+ },
+ "rotation": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/StageBezierTransition"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Outgoing rotation interpolation."
+ },
+ "scale": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/StageBezierTransition"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Outgoing scale interpolation."
+ }
+ },
+ "title": "StageTransformTransitions",
+ "type": "object"
+ },
+ "SubjectCanvasItem": {
"additionalProperties": false,
"properties": {
"id": {
@@ -13314,7 +13609,7 @@
"type": "integer"
},
"kind": {
- "const": "tool",
+ "const": "subject",
"description": "Business object or media type.",
"title": "Kind",
"type": "string"
@@ -13399,64 +13694,77 @@
"kind",
"binding"
],
- "title": "ToolCanvasItem",
+ "title": "SubjectCanvasItem",
"type": "object"
},
- "ToolData": {
+ "SubjectData": {
"additionalProperties": false,
"properties": {
- "kind": {
- "description": "Business object or media type.",
- "enum": [
- "camera",
- "style",
- "palette",
- "camera_motion"
- ],
- "title": "Kind",
+ "description": {
+ "default": "",
+ "description": "User-facing annotation only; not subject media or a generation reference",
+ "maxLength": 20000,
+ "title": "Description",
"type": "string"
},
- "fields": {
+ "category": {
+ "default": "",
+ "description": "Subject category.",
+ "maxLength": 100,
+ "title": "Category",
+ "type": "string"
+ },
+ "main": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AssetRef"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Primary subject media."
+ },
+ "auxiliaries": {
"default": [],
- "description": "Named tool-specific parameter fields.",
+ "description": "Ordered auxiliary subject media.",
"items": {
- "$ref": "#/$defs/ToolField"
+ "$ref": "#/$defs/AssetRef"
},
- "title": "Fields",
+ "maxItems": 3,
+ "title": "Auxiliaries",
"type": "array"
},
- "provenance": {
+ "voice": {
"anyOf": [
{
- "$ref": "#/$defs/PaletteProvenance"
+ "$ref": "#/$defs/AssetRef"
},
{
"type": "null"
}
],
"default": null,
- "description": "Recorded origin and execution context."
+ "description": "Subject voice asset version."
},
- "palette": {
+ "librarySource": {
"anyOf": [
{
- "$ref": "#/$defs/PaletteData"
+ "$ref": "#/$defs/SubjectLibrarySource"
},
{
"type": "null"
}
],
"default": null,
- "description": "Reusable palette data."
+ "description": "Immutable source library version."
}
},
- "required": [
- "kind"
- ],
- "title": "ToolData",
+ "title": "SubjectData",
"type": "object"
},
- "ToolDocument": {
+ "SubjectDocument": {
"additionalProperties": false,
"properties": {
"id": {
@@ -13495,13 +13803,13 @@
"type": "array"
},
"kind": {
- "const": "tool",
+ "const": "subject",
"description": "Business object or media type.",
"title": "Kind",
"type": "string"
},
"data": {
- "$ref": "#/$defs/ToolData",
+ "$ref": "#/$defs/SubjectData",
"description": "Typed editable document contents."
}
},
@@ -13511,156 +13819,220 @@
"kind",
"data"
],
- "title": "ToolDocument",
+ "title": "SubjectDocument",
"type": "object"
},
- "ToolDraftBinding": {
+ "SubjectLibrarySource": {
"additionalProperties": false,
+ "description": "Frozen import provenance; subsequent editing never follows the library.",
"properties": {
- "editorId": {
- "description": "Editable document ID.",
- "format": "uuid",
- "title": "Editorid",
- "type": "string"
- },
- "editorRevision": {
- "description": "Expected editable document revision.",
- "minimum": 1,
- "title": "Editorrevision",
- "type": "integer"
- },
"itemId": {
"description": "Canvas item ID.",
"format": "uuid",
"title": "Itemid",
"type": "string"
},
- "itemRevision": {
- "description": "Expected canvas item revision.",
+ "revision": {
+ "description": "Captured library item revision.",
"minimum": 1,
- "title": "Itemrevision",
+ "title": "Revision",
"type": "integer"
+ },
+ "importId": {
+ "description": "Library import ID.",
+ "format": "uuid",
+ "title": "Importid",
+ "type": "string"
}
},
"required": [
- "editorId",
- "editorRevision",
"itemId",
- "itemRevision"
+ "revision",
+ "importId"
],
- "title": "ToolDraftBinding",
+ "title": "SubjectLibrarySource",
"type": "object"
},
- "ToolField": {
+ "TextCanvasItem": {
"additionalProperties": false,
"properties": {
- "name": {
- "description": "User-visible name.",
- "maxLength": 200,
- "minLength": 1,
- "title": "Name",
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
"type": "string"
},
- "values": {
- "description": "Ordered tool field values.",
- "items": {
- "type": "string"
- },
- "title": "Values",
- "type": "array"
- }
- },
- "required": [
- "name",
- "values"
- ],
- "title": "ToolField",
- "type": "object"
- },
- "ToolSelection": {
- "additionalProperties": false,
- "properties": {
- "source": {
- "$ref": "#/$defs/AssetRef",
- "description": "Input source or recorded provenance."
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "kind": {
+ "const": "text",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "title": {
+ "default": "",
+ "description": "User-visible title.",
+ "maxLength": 255,
+ "title": "Title",
+ "type": "string"
+ },
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
},
"width": {
+ "default": 352,
"description": "Width in pixels.",
- "minimum": 1,
+ "exclusiveMinimum": 0,
"title": "Width",
- "type": "integer"
+ "type": "number"
},
"height": {
+ "default": 198,
"description": "Height in pixels.",
- "minimum": 1,
+ "exclusiveMinimum": 0,
"title": "Height",
+ "type": "number"
+ },
+ "zIndex": {
+ "default": 0,
+ "description": "Canvas stacking order.",
+ "title": "Zindex",
"type": "integer"
},
- "mask": {
+ "locked": {
+ "default": false,
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
+ "type": "boolean"
+ },
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
+ },
+ "parentId": {
"anyOf": [
{
- "$ref": "#/$defs/AssetRef"
+ "format": "uuid",
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Ordered strokes or encoded selection mask."
+ "description": "Parent canvas group ID, or null for the root.",
+ "title": "Parentid"
},
- "boxes": {
+ "tags": {
"default": [],
- "description": "Selection rectangles in source image pixels.",
+ "description": "User-defined search tags.",
"items": {
- "$ref": "#/$defs/SelectionBox"
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
},
- "title": "Boxes",
+ "title": "Tags",
+ "type": "array"
+ },
+ "binding": {
+ "description": "Business object displayed by this canvas item.",
+ "discriminator": {
+ "mapping": {
+ "empty": "#/$defs/EmptyBinding",
+ "generation": "#/$defs/GenerationBinding",
+ "material": "#/$defs/MaterialBinding"
+ },
+ "propertyName": "role"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/EmptyBinding"
+ },
+ {
+ "$ref": "#/$defs/MaterialBinding"
+ },
+ {
+ "$ref": "#/$defs/GenerationBinding"
+ }
+ ],
+ "title": "Binding"
+ },
+ "editors": {
+ "default": [],
+ "description": "Attached editable documents.",
+ "items": {
+ "$ref": "#/$defs/EditorRef"
+ },
+ "title": "Editors",
"type": "array"
}
},
"required": [
- "source",
- "width",
- "height"
+ "id",
+ "projectId",
+ "kind",
+ "binding"
],
- "title": "ToolSelection",
+ "title": "TextCanvasItem",
"type": "object"
},
- "TransformFrame": {
+ "TextExecution": {
"additionalProperties": false,
"properties": {
- "id": {
- "description": "Stable object ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Id",
+ "thinking": {
+ "default": "auto",
+ "description": "Requested reasoning effort.",
+ "enum": [
+ "auto",
+ "low",
+ "medium",
+ "high"
+ ],
+ "title": "Thinking",
"type": "string"
},
- "time": {
- "description": "Keyframe time in seconds.",
- "minimum": 0,
- "title": "Time",
- "type": "number"
+ "maxTokens": {
+ "default": 8192,
+ "description": "Maximum generated text tokens.",
+ "maximum": 32768,
+ "minimum": 1,
+ "title": "Maxtokens",
+ "type": "integer"
},
- "value": {
- "$ref": "#/$defs/StageTransform",
- "description": "Keyframed transform or camera pose."
+ "kind": {
+ "const": "text",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
}
},
"required": [
- "id",
- "time",
- "value"
+ "kind"
],
- "title": "TransformFrame",
+ "title": "TextExecution",
"type": "object"
},
- "UploadInfo": {
+ "TextGenerationSpec": {
"additionalProperties": false,
"properties": {
"id": {
- "description": "Stable object ID.",
+ "description": "Stable identity of this project-owned object.",
"format": "uuid",
"title": "Id",
"type": "string"
@@ -13671,32 +14043,27 @@
"title": "Projectid",
"type": "string"
},
- "name": {
- "description": "User-visible name.",
- "title": "Name",
- "type": "string"
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
},
- "status": {
- "description": "Current operation lifecycle state.",
+ "purpose": {
+ "default": "draft",
+ "description": "Draft settings or executable generation configuration.",
"enum": [
- "uploading",
- "ready",
- "registered",
- "cancelled"
+ "draft",
+ "generation"
],
- "title": "Status",
+ "title": "Purpose",
"type": "string"
},
- "kind": {
+ "modelConfigId": {
"anyOf": [
{
- "enum": [
- "text",
- "image",
- "video",
- "audio",
- "file"
- ],
+ "format": "uuid",
"type": "string"
},
{
@@ -13704,36 +14071,47 @@
}
],
"default": null,
- "description": "Business object or media type.",
- "title": "Kind"
+ "description": "Model configuration ID from the model catalog or user model selections.",
+ "title": "Modelconfigid"
},
- "fingerprint": {
- "anyOf": [
- {
- "pattern": "^sha256:[0-9a-f]{64}$",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Immutable content fingerprint.",
- "title": "Fingerprint"
+ "prompt": {
+ "default": "",
+ "description": "Generation prompt text.",
+ "maxLength": 20000,
+ "title": "Prompt",
+ "type": "string"
},
- "metadata": {
+ "promptContent": {
"anyOf": [
{
- "$ref": "#/$defs/MediaMetadata"
+ "items": {
+ "discriminator": {
+ "mapping": {
+ "reference": "#/$defs/PromptReference",
+ "text": "#/$defs/PromptText"
+ },
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/PromptText"
+ },
+ {
+ "$ref": "#/$defs/PromptReference"
+ }
+ ]
+ },
+ "type": "array"
},
{
"type": "null"
}
],
"default": null,
- "description": "Verified media properties."
+ "description": "Structured prompt text and reference tokens.",
+ "title": "Promptcontent"
},
- "assetId": {
+ "currentResultId": {
"anyOf": [
{
"format": "uuid",
@@ -13744,87 +14122,113 @@
}
],
"default": null,
- "description": "Asset ID.",
- "title": "Assetid"
+ "description": "Currently adopted result ID.",
+ "title": "Currentresultid"
+ },
+ "kind": {
+ "const": "text",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "parameters": {
+ "$ref": "#/$defs/TextParameters",
+ "description": "Typed generation or editing parameters."
}
},
"required": [
"id",
"projectId",
- "name",
- "status"
+ "kind"
],
- "title": "UploadInfo",
+ "title": "TextGenerationSpec",
"type": "object"
},
- "Vector3": {
+ "TextLayerContent": {
"additionalProperties": false,
"properties": {
- "x": {
- "description": "X component in stage coordinates.",
- "title": "X",
- "type": "number"
+ "width": {
+ "description": "Width in pixels.",
+ "maximum": 8192,
+ "minimum": 1,
+ "title": "Width",
+ "type": "integer"
},
- "y": {
- "description": "Y component in stage coordinates.",
- "title": "Y",
- "type": "number"
+ "height": {
+ "description": "Height in pixels.",
+ "maximum": 8192,
+ "minimum": 1,
+ "title": "Height",
+ "type": "integer"
},
- "z": {
- "description": "Z component in stage coordinates.",
- "title": "Z",
+ "kind": {
+ "const": "text",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "text": {
+ "description": "UTF-8 text content or search query.",
+ "maxLength": 10000,
+ "title": "Text",
+ "type": "string"
+ },
+ "color": {
+ "description": "Serialized display color.",
+ "examples": [
+ "#000000"
+ ],
+ "pattern": "^#[0-9a-fA-F]{6}$",
+ "title": "Color",
+ "type": "string"
+ },
+ "fontSize": {
+ "description": "Text size in pixels.",
+ "maximum": 1000,
+ "minimum": 4,
+ "title": "Fontsize",
"type": "number"
}
},
"required": [
- "x",
- "y",
- "z"
+ "width",
+ "height",
+ "kind",
+ "text",
+ "color",
+ "fontSize"
],
- "title": "Vector3",
+ "title": "TextLayerContent",
"type": "object"
},
- "VersionsQuery": {
+ "TextParameters": {
"additionalProperties": false,
"properties": {
- "queryId": {
- "description": "Caller-supplied query ID.",
- "format": "uuid",
- "title": "Queryid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
- },
- "type": {
- "description": "Read object versions.",
+ "thinking": {
+ "default": "auto",
+ "description": "Requested reasoning effort.",
"enum": [
- "generationSpec.versions",
- "canvas.versions"
+ "auto",
+ "low",
+ "medium",
+ "high"
],
- "title": "Type",
+ "title": "Thinking",
"type": "string"
},
- "objectId": {
- "description": "Target configuration or canvas item ID.",
- "format": "uuid",
- "title": "Objectid",
- "type": "string"
+ "maxTokens": {
+ "default": 8192,
+ "description": "Maximum generated text tokens.",
+ "maximum": 32768,
+ "minimum": 1,
+ "title": "Maxtokens",
+ "type": "integer"
}
},
- "required": [
- "queryId",
- "projectId",
- "type",
- "objectId"
- ],
- "title": "VersionsQuery",
+ "title": "TextParameters",
"type": "object"
},
- "VideoCanvasItem": {
+ "TimelineCanvasItem": {
"additionalProperties": false,
"properties": {
"id": {
@@ -13847,7 +14251,7 @@
"type": "integer"
},
"kind": {
- "const": "video",
+ "const": "timeline",
"description": "Business object or media type.",
"title": "Kind",
"type": "string"
@@ -13922,137 +14326,305 @@
"type": "array"
},
"binding": {
- "description": "Business object displayed by this canvas item.",
- "discriminator": {
- "mapping": {
- "empty": "#/$defs/EmptyBinding",
- "generation": "#/$defs/GenerationBinding",
- "material": "#/$defs/MaterialBinding"
- },
- "propertyName": "role"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/EmptyBinding"
- },
+ "$ref": "#/$defs/EditorBinding",
+ "description": "Business object displayed by this canvas item."
+ }
+ },
+ "required": [
+ "id",
+ "projectId",
+ "kind",
+ "binding"
+ ],
+ "title": "TimelineCanvasItem",
+ "type": "object"
+ },
+ "TimelineClip": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable object ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
+ "type": "string"
+ },
+ "resource": {
+ "$ref": "#/$defs/TimelineResource",
+ "description": "Clip source from the imported asset collection."
+ },
+ "start": {
+ "anyOf": [
{
- "$ref": "#/$defs/MaterialBinding"
+ "minimum": 0,
+ "type": "number"
},
{
- "$ref": "#/$defs/GenerationBinding"
+ "type": "null"
}
],
- "title": "Binding"
+ "default": null,
+ "description": "Start time in seconds.",
+ "title": "Start"
},
- "editors": {
- "default": [],
- "description": "Attached editable documents.",
- "items": {
- "$ref": "#/$defs/EditorRef"
- },
- "title": "Editors",
- "type": "array"
+ "inPoint": {
+ "description": "Source trim start in seconds.",
+ "minimum": 0,
+ "title": "Inpoint",
+ "type": "number"
+ },
+ "outPoint": {
+ "description": "Source trim end in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Outpoint",
+ "type": "number"
+ },
+ "speed": {
+ "default": 1,
+ "description": "Playback or motion speed multiplier.",
+ "exclusiveMinimum": 0,
+ "title": "Speed",
+ "type": "number"
+ },
+ "volume": {
+ "default": 1,
+ "description": "Linear audio gain.",
+ "maximum": 1,
+ "minimum": 0,
+ "title": "Volume",
+ "type": "number"
+ },
+ "muted": {
+ "default": false,
+ "description": "Whether audio output is muted.",
+ "title": "Muted",
+ "type": "boolean"
}
},
"required": [
"id",
- "projectId",
- "kind",
- "binding"
+ "resource",
+ "inPoint",
+ "outPoint"
],
- "title": "VideoCanvasItem",
+ "title": "TimelineClip",
"type": "object"
},
- "VideoCapabilities": {
+ "TimelineData": {
"additionalProperties": false,
"properties": {
- "outputs": {
- "description": "Supported output resolution and duration combinations.",
+ "fps": {
+ "description": "Frames per second.",
+ "minimum": 1,
+ "title": "Fps",
+ "type": "integer"
+ },
+ "width": {
+ "description": "Width in pixels.",
+ "minimum": 1,
+ "title": "Width",
+ "type": "integer"
+ },
+ "height": {
+ "description": "Height in pixels.",
+ "minimum": 1,
+ "title": "Height",
+ "type": "integer"
+ },
+ "tracks": {
+ "description": "Ordered timeline tracks.",
"items": {
- "$ref": "#/$defs/VideoOutput"
+ "$ref": "#/$defs/TimelineTrack"
},
- "maxItems": 20,
"minItems": 1,
- "title": "Outputs",
+ "title": "Tracks",
"type": "array"
},
- "defaultResolution": {
- "default": "auto",
- "description": "Default output resolution or auto.",
- "title": "Defaultresolution",
+ "importedAssets": {
+ "default": [],
+ "description": "Source assets available to timeline clips.",
+ "items": {
+ "$ref": "#/$defs/TimelineResource"
+ },
+ "title": "Importedassets",
+ "type": "array"
+ },
+ "fonts": {
+ "default": [],
+ "description": "Document-local registered font resources; omitted when empty.",
+ "items": {
+ "$ref": "#/$defs/TimelineFontResource"
+ },
+ "maxItems": 16,
+ "title": "Fonts",
+ "type": "array"
+ },
+ "overlays": {
+ "default": [],
+ "description": "Timed text ordered from bottom to top; omitted when empty.",
+ "items": {
+ "$ref": "#/$defs/TimelineTextOverlay"
+ },
+ "maxItems": 2000,
+ "title": "Overlays",
+ "type": "array"
+ }
+ },
+ "required": [
+ "fps",
+ "width",
+ "height",
+ "tracks"
+ ],
+ "title": "TimelineData",
+ "type": "object"
+ },
+ "TimelineDocument": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
"type": "string"
},
- "defaultDuration": {
- "default": 5,
- "description": "Default output duration in seconds.",
- "maximum": 60,
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
"minimum": 1,
- "title": "Defaultduration",
+ "title": "Revision",
"type": "integer"
},
- "dimensionStep": {
- "default": 2,
- "description": "Required pixel alignment of output dimensions.",
- "enum": [
- 1,
- 2,
- 8,
- 16,
- 32,
- 64
- ],
- "title": "Dimensionstep",
+ "schemaVersion": {
+ "const": 1,
+ "default": 1,
+ "description": "Record schema version.",
+ "title": "Schemaversion",
"type": "integer"
+ },
+ "inputConnections": {
+ "default": [],
+ "description": "Persisted connections to source assets.",
+ "items": {
+ "$ref": "#/$defs/EditorInputConnection"
+ },
+ "title": "Inputconnections",
+ "type": "array"
+ },
+ "kind": {
+ "const": "timeline",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "data": {
+ "$ref": "#/$defs/TimelineData",
+ "description": "Typed editable document contents."
}
},
"required": [
- "outputs"
+ "id",
+ "projectId",
+ "kind",
+ "data"
],
- "title": "VideoCapabilities",
+ "title": "TimelineDocument",
"type": "object"
},
- "VideoExecution": {
+ "TimelineFontResource": {
"additionalProperties": false,
- "description": "Resolved adapter parameters, distinct from user intent and source layout.",
"properties": {
- "kind": {
- "const": "video",
- "description": "Business object or media type.",
- "title": "Kind",
+ "id": {
+ "description": "Stable document-local font ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
"type": "string"
},
- "durationSeconds": {
- "anyOf": [
- {
- "maximum": 60,
- "minimum": 1,
- "type": "number"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Duration in seconds.",
- "title": "Durationseconds"
+ "title": {
+ "description": "Display title of the font.",
+ "maxLength": 255,
+ "title": "Title",
+ "type": "string"
},
- "size": {
- "anyOf": [
- {
- "pattern": "^\\d+x\\d+$",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Effective video dimensions sent to the provider.",
- "title": "Size"
+ "asset": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Immutable registered font asset version."
+ }
+ },
+ "required": [
+ "id",
+ "title",
+ "asset"
+ ],
+ "title": "TimelineFontResource",
+ "type": "object"
+ },
+ "TimelinePackageExportFile": {
+ "additionalProperties": false,
+ "properties": {
+ "editorId": {
+ "description": "Saved timeline ID in the active project.",
+ "format": "uuid",
+ "title": "Editorid",
+ "type": "string"
},
- "resolution": {
+ "revision": {
+ "description": "Exact saved revision to export.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "path": {
+ "description": "New output file under the active execution directory.",
+ "maxLength": 4096,
+ "minLength": 1,
+ "title": "Path",
+ "type": "string"
+ }
+ },
+ "required": [
+ "editorId",
+ "revision",
+ "path"
+ ],
+ "title": "TimelinePackageExportFile",
+ "type": "object"
+ },
+ "TimelinePackageImportFile": {
+ "additionalProperties": false,
+ "properties": {
+ "operationId": {
+ "description": "Stable import operation identity.",
+ "format": "uuid",
+ "title": "Operationid",
+ "type": "string"
+ },
+ "archiveFingerprint": {
+ "description": "Expected SHA-256 of archive bytes.",
+ "pattern": "^sha256:[0-9a-f]{64}$",
+ "title": "Archivefingerprint",
+ "type": "string"
+ },
+ "path": {
+ "description": "Existing bundle under the active execution directory.",
+ "maxLength": 4096,
+ "minLength": 1,
+ "title": "Path",
+ "type": "string"
+ },
+ "replaceEditorId": {
"anyOf": [
{
+ "format": "uuid",
"type": "string"
},
{
@@ -14060,10 +14632,10 @@
}
],
"default": null,
- "description": "Requested output resolution.",
- "title": "Resolution"
+ "description": "Explicit replacement target.",
+ "title": "Replaceeditorid"
},
- "fps": {
+ "expectedRevision": {
"anyOf": [
{
"minimum": 1,
@@ -14074,297 +14646,390 @@
}
],
"default": null,
- "description": "Frames per second.",
- "title": "Fps"
+ "description": "Expected replacement revision.",
+ "title": "Expectedrevision"
+ }
+ },
+ "required": [
+ "operationId",
+ "archiveFingerprint",
+ "path"
+ ],
+ "title": "TimelinePackageImportFile",
+ "type": "object"
+ },
+ "TimelinePackageImportReceipt": {
+ "additionalProperties": false,
+ "properties": {
+ "operationId": {
+ "description": "Import identity.",
+ "format": "uuid",
+ "title": "Operationid",
+ "type": "string"
},
- "numFrames": {
- "anyOf": [
- {
- "minimum": 1,
- "type": "integer"
- },
- {
- "type": "null"
- }
+ "status": {
+ "description": "Partial registration, complete publication, or terminal rejection.",
+ "enum": [
+ "registered",
+ "applied",
+ "rejected"
],
- "default": null,
- "description": "Requested video frame count.",
- "title": "Numframes"
+ "title": "Status",
+ "type": "string"
},
- "numInferenceSteps": {
- "anyOf": [
- {
- "minimum": 1,
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Diffusion sampling step count.",
- "title": "Numinferencesteps"
+ "editorId": {
+ "description": "Stable destination document ID.",
+ "format": "uuid",
+ "title": "Editorid",
+ "type": "string"
},
- "guidanceScale": {
+ "registeredAssetIds": {
+ "default": [],
+ "description": "Resources actually committed before final publication.",
+ "items": {
+ "format": "uuid",
+ "type": "string"
+ },
+ "title": "Registeredassetids",
+ "type": "array"
+ },
+ "receipt": {
"anyOf": [
{
- "minimum": 0,
- "type": "number"
+ "$ref": "#/$defs/CommandReceipt"
},
{
"type": "null"
}
],
"default": null,
- "description": "Diffusion guidance scale.",
- "title": "Guidancescale"
+ "description": "Final atomic business command receipt, when committed."
},
- "seed": {
+ "errorCode": {
"anyOf": [
{
- "type": "integer"
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Random seed, when specified.",
- "title": "Seed"
+ "description": "Stable failure code for retryable registration failure.",
+ "title": "Errorcode"
+ }
+ },
+ "required": [
+ "operationId",
+ "status",
+ "editorId"
+ ],
+ "title": "TimelinePackageImportReceipt",
+ "type": "object"
+ },
+ "TimelinePackageImportRequest": {
+ "additionalProperties": false,
+ "properties": {
+ "operationId": {
+ "description": "Stable identity for this entire import and all retries.",
+ "format": "uuid",
+ "title": "Operationid",
+ "type": "string"
},
- "watermark": {
+ "uploadHandle": {
+ "description": "Project/session-owned staged ZIP upload.",
+ "format": "uuid",
+ "title": "Uploadhandle",
+ "type": "string"
+ },
+ "archiveFingerprint": {
+ "description": "Fixed archive bytes for recovery and replay.",
+ "pattern": "^sha256:[0-9a-f]{64}$",
+ "title": "Archivefingerprint",
+ "type": "string"
+ },
+ "replaceEditorId": {
"anyOf": [
{
- "type": "boolean"
+ "format": "uuid",
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Whether provider watermarking is enabled.",
- "title": "Watermark"
+ "description": "Explicit replacement target; omitted creates a timeline.",
+ "title": "Replaceeditorid"
},
- "generateAudio": {
+ "expectedRevision": {
"anyOf": [
{
- "type": "boolean"
+ "minimum": 1,
+ "type": "integer"
},
{
"type": "null"
}
],
"default": null,
- "description": "Whether video generation includes audio.",
- "title": "Generateaudio"
+ "description": "Required original revision for replacement.",
+ "title": "Expectedrevision"
}
},
"required": [
- "kind"
+ "operationId",
+ "uploadHandle",
+ "archiveFingerprint"
],
- "title": "VideoExecution",
+ "title": "TimelinePackageImportRequest",
"type": "object"
},
- "VideoGenerationSpec": {
+ "TimelinePackageManifest": {
"additionalProperties": false,
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
- "format": "uuid",
- "title": "Id",
+ "format": {
+ "const": "opendirector-timeline-bundle",
+ "default": "opendirector-timeline-bundle",
+ "description": "Native bundle format.",
+ "title": "Format",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
- },
- "revision": {
+ "version": {
+ "const": 1,
"default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
+ "description": "Native bundle format version.",
+ "title": "Version",
"type": "integer"
},
- "purpose": {
- "default": "draft",
- "description": "Draft settings or executable generation configuration.",
+ "requiredCapabilities": {
+ "default": [],
+ "description": "Required editable document capabilities.",
+ "items": {
+ "const": "timeline.text.v1",
+ "type": "string"
+ },
+ "maxItems": 1,
+ "title": "Requiredcapabilities",
+ "type": "array"
+ },
+ "resources": {
+ "description": "Distinct logical resources; paths may share identical bytes.",
+ "items": {
+ "$ref": "#/$defs/TimelinePackageResource"
+ },
+ "maxItems": 4093,
+ "title": "Resources",
+ "type": "array"
+ }
+ },
+ "required": [
+ "resources"
+ ],
+ "title": "TimelinePackageManifest",
+ "type": "object"
+ },
+ "TimelinePackageResource": {
+ "additionalProperties": false,
+ "properties": {
+ "source": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Original logical reference; only a package mapping key."
+ },
+ "name": {
+ "description": "Original resource filename.",
+ "maxLength": 255,
+ "minLength": 1,
+ "title": "Name",
+ "type": "string"
+ },
+ "path": {
+ "description": "Content-addressed archive member.",
+ "pattern": "^assets/[0-9a-f]{64}\\.[a-z0-9]{1,10}$",
+ "title": "Path",
+ "type": "string"
+ },
+ "kind": {
+ "description": "Verified media kind.",
"enum": [
- "draft",
- "generation"
+ "text",
+ "image",
+ "video",
+ "audio",
+ "file"
],
- "title": "Purpose",
+ "title": "Kind",
"type": "string"
},
- "modelConfigId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Model configuration ID from the model catalog or user model selections.",
- "title": "Modelconfigid"
+ "mimeType": {
+ "description": "Verified MIME type.",
+ "maxLength": 255,
+ "minLength": 1,
+ "title": "Mimetype",
+ "type": "string"
},
- "prompt": {
- "default": "",
- "description": "Generation prompt text.",
- "maxLength": 20000,
- "title": "Prompt",
+ "size": {
+ "description": "Actual resource byte count.",
+ "maximum": 536870912,
+ "minimum": 0,
+ "title": "Size",
+ "type": "integer"
+ },
+ "fingerprint": {
+ "description": "SHA-256 identity of resource bytes.",
+ "pattern": "^sha256:[0-9a-f]{64}$",
+ "title": "Fingerprint",
+ "type": "string"
+ }
+ },
+ "required": [
+ "source",
+ "name",
+ "path",
+ "kind",
+ "mimeType",
+ "size",
+ "fingerprint"
+ ],
+ "title": "TimelinePackageResource",
+ "type": "object"
+ },
+ "TimelinePublishRender": {
+ "additionalProperties": false,
+ "properties": {
+ "itemId": {
+ "description": "Canvas item ID.",
+ "format": "uuid",
+ "title": "Itemid",
"type": "string"
},
- "promptContent": {
- "anyOf": [
- {
- "items": {
- "discriminator": {
- "mapping": {
- "reference": "#/$defs/PromptReference",
- "text": "#/$defs/PromptText"
- },
- "propertyName": "type"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/PromptText"
- },
- {
- "$ref": "#/$defs/PromptReference"
- }
- ]
- },
- "type": "array"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Structured prompt text and reference tokens.",
- "title": "Promptcontent"
+ "editorId": {
+ "description": "Editable document ID.",
+ "format": "uuid",
+ "title": "Editorid",
+ "type": "string"
},
- "currentResultId": {
+ "asset": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Immutable asset version."
+ },
+ "outputId": {
+ "description": "Published canvas output ID.",
+ "format": "uuid",
+ "title": "Outputid",
+ "type": "string"
+ },
+ "expectedOutputRevision": {
"anyOf": [
{
- "format": "uuid",
- "type": "string"
+ "minimum": 1,
+ "type": "integer"
},
{
"type": "null"
}
],
"default": null,
- "description": "Currently adopted result ID.",
- "title": "Currentresultid"
+ "description": "Current output node revision when appending a rendered version.",
+ "title": "Expectedoutputrevision"
},
- "kind": {
- "const": "video",
- "description": "Business object or media type.",
- "title": "Kind",
+ "title": {
+ "default": "合成视频",
+ "description": "User-visible title.",
+ "maxLength": 255,
+ "title": "Title",
"type": "string"
},
- "parameters": {
- "$ref": "#/$defs/VideoParameters",
- "description": "Typed generation or editing parameters."
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
}
},
"required": [
- "id",
- "projectId",
- "kind"
+ "itemId",
+ "editorId",
+ "asset",
+ "outputId"
],
- "title": "VideoGenerationSpec",
+ "title": "TimelinePublishRender",
"type": "object"
},
- "VideoOutput": {
+ "TimelinePublishRenderCommand": {
"additionalProperties": false,
+ "description": "Publish a rendered timeline result.",
"properties": {
- "resolution": {
- "description": "Requested output resolution.",
- "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,23}$",
- "title": "Resolution",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
"type": "string"
},
- "durations": {
- "description": "Supported output durations in seconds.",
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "timeline.publishRender",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
"items": {
- "maximum": 60,
- "minimum": 1,
- "type": "integer"
+ "$ref": "#/$defs/ObjectVersion"
},
- "maxItems": 60,
- "minItems": 1,
- "title": "Durations",
+ "title": "Expectedversions",
"type": "array"
},
- "width": {
+ "expectedPreview": {
"anyOf": [
{
- "maximum": 8192,
- "minimum": 64,
- "type": "integer"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Width in pixels.",
- "title": "Width"
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "height": {
- "anyOf": [
- {
- "maximum": 8192,
- "minimum": 64,
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Height in pixels.",
- "title": "Height"
+ "payload": {
+ "$ref": "#/$defs/TimelinePublishRender",
+ "description": "Publish a rendered timeline result."
}
},
"required": [
- "resolution",
- "durations"
+ "commandId",
+ "projectId",
+ "type",
+ "payload"
],
- "title": "VideoOutput",
+ "title": "TimelinePublishRenderCommand",
"type": "object"
},
- "VideoParameters": {
+ "TimelineResource": {
"additionalProperties": false,
"properties": {
- "generateAudio": {
- "default": true,
- "description": "Include audio; value must be allowed by model inputRules.generateAudioOptions.",
- "title": "Generateaudio",
- "type": "boolean"
+ "asset": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Immutable asset version."
},
- "videoMode": {
- "default": "first_frame",
- "description": "Video generation input mode.",
- "enum": [
- "first_frame",
- "reference",
- "continuation"
- ],
- "title": "Videomode",
+ "title": {
+ "description": "Display title of the imported asset.",
+ "maxLength": 255,
+ "title": "Title",
"type": "string"
},
"durationSeconds": {
"anyOf": [
{
- "maximum": 60,
- "minimum": 1,
+ "exclusiveMinimum": 0,
"type": "number"
},
{
@@ -14372,946 +15037,1197 @@
}
],
"default": null,
- "description": "Duration in seconds; fractional values require model inputRules.fractionalDuration. Generated frames may be aligned by the model.",
+ "description": "Duration in seconds.",
"title": "Durationseconds"
- },
- "aspectRatio": {
- "anyOf": [
- {
- "pattern": "^[1-9]\\d?:[1-9]\\d?$",
- "type": "string"
- },
- {
- "type": "null"
- }
+ }
+ },
+ "required": [
+ "asset",
+ "title"
+ ],
+ "title": "TimelineResource",
+ "type": "object"
+ },
+ "TimelineTextBackground": {
+ "additionalProperties": false,
+ "properties": {
+ "color": {
+ "description": "Background color in #RRGGBB format.",
+ "examples": [
+ "#000000"
],
- "default": null,
- "description": "Output width-to-height ratio.",
- "title": "Aspectratio"
- },
- "resolution": {
- "default": "auto",
- "description": "Requested output resolution.",
- "pattern": "^(?:auto|[A-Z0-9][A-Z0-9_.-]{0,23})$",
- "title": "Resolution",
+ "pattern": "^#[0-9a-fA-F]{6}$",
+ "title": "Color",
"type": "string"
+ },
+ "opacity": {
+ "description": "Background opacity.",
+ "maximum": 1,
+ "minimum": 0,
+ "title": "Opacity",
+ "type": "number"
+ },
+ "padding": {
+ "description": "Background padding in output pixels.",
+ "maximum": 128,
+ "minimum": 0,
+ "title": "Padding",
+ "type": "number"
}
},
- "title": "VideoParameters",
+ "required": [
+ "color",
+ "opacity",
+ "padding"
+ ],
+ "title": "TimelineTextBackground",
"type": "object"
},
- "ViewState": {
+ "TimelineTextOverlay": {
"additionalProperties": false,
"properties": {
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ "id": {
+ "description": "Stable document-local text ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
"type": "string"
},
- "clientId": {
- "description": "Client identity for independent view state.",
- "format": "uuid",
- "title": "Clientid",
+ "start": {
+ "description": "Absolute start time in seconds.",
+ "minimum": 0,
+ "title": "Start",
+ "type": "number"
+ },
+ "end": {
+ "description": "Exclusive absolute end time in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "End",
+ "type": "number"
+ },
+ "text": {
+ "description": "Plain text normalized to LF, counted in Unicode code points.",
+ "maxLength": 4096,
+ "minLength": 1,
+ "title": "Text",
"type": "string"
},
- "viewport": {
- "$ref": "#/$defs/Viewport",
- "description": "Canvas pan and zoom state."
+ "x": {
+ "description": "Normalized text box left position.",
+ "maximum": 1,
+ "minimum": 0,
+ "title": "X",
+ "type": "number"
},
- "selectedItemIds": {
- "default": [],
- "description": "Currently selected canvas item IDs.",
- "items": {
- "format": "uuid",
- "type": "string"
- },
- "title": "Selecteditemids",
- "type": "array"
+ "y": {
+ "description": "Normalized text box top position.",
+ "maximum": 1,
+ "minimum": 0,
+ "title": "Y",
+ "type": "number"
},
- "activeEditorId": {
+ "maxWidth": {
+ "description": "Text box width as a fraction of output width.",
+ "exclusiveMinimum": 0,
+ "maximum": 1,
+ "title": "Maxwidth",
+ "type": "number"
+ },
+ "fontId": {
+ "description": "Font resource ID in this document.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Fontid",
+ "type": "string"
+ },
+ "style": {
+ "$ref": "#/$defs/TimelineTextStyle",
+ "description": "Output-space text styling."
+ },
+ "sourceAsset": {
"anyOf": [
{
- "format": "uuid",
- "type": "string"
+ "$ref": "#/$defs/AssetRef"
},
{
"type": "null"
}
],
"default": null,
- "description": "Currently active editable document ID.",
- "title": "Activeeditorid"
- },
- "playheads": {
- "default": [],
- "description": "Playback positions keyed by editor identity.",
- "items": {
- "$ref": "#/$defs/Playhead"
- },
- "title": "Playheads",
- "type": "array"
- },
- "generationCounts": {
- "additionalProperties": {
- "maximum": 8,
- "minimum": 1,
- "type": "integer"
- },
- "description": "Requested generation counts keyed by canvas item ID.",
- "propertyNames": {
- "format": "uuid"
- },
- "title": "Generationcounts",
- "type": "object"
+ "description": "Frozen source text asset, independent of subsequent edits."
}
},
"required": [
- "projectId",
- "clientId"
+ "id",
+ "start",
+ "end",
+ "text",
+ "x",
+ "y",
+ "maxWidth",
+ "fontId",
+ "style"
],
- "title": "ViewState",
+ "title": "TimelineTextOverlay",
"type": "object"
},
- "Viewport": {
+ "TimelineTextStroke": {
"additionalProperties": false,
"properties": {
- "x": {
- "default": 0,
- "description": "Horizontal coordinate.",
- "title": "X",
- "type": "number"
- },
- "y": {
- "default": 0,
- "description": "Vertical coordinate.",
- "title": "Y",
- "type": "number"
+ "color": {
+ "description": "Stroke color in #RRGGBB format.",
+ "examples": [
+ "#000000"
+ ],
+ "pattern": "^#[0-9a-fA-F]{6}$",
+ "title": "Color",
+ "type": "string"
},
- "zoom": {
- "default": 1,
- "description": "Canvas viewport zoom factor.",
- "maximum": 8,
- "minimum": 0.08,
- "title": "Zoom",
+ "width": {
+ "description": "Stroke width in output pixels.",
+ "maximum": 32,
+ "minimum": 0,
+ "title": "Width",
"type": "number"
}
},
- "title": "Viewport",
+ "required": [
+ "color",
+ "width"
+ ],
+ "title": "TimelineTextStroke",
"type": "object"
},
- "VoiceLibraryCapabilities": {
+ "TimelineTextStyle": {
"additionalProperties": false,
"properties": {
- "provider": {
- "description": "Voice registry protocol.",
- "enum": [
- "vllm_omni",
- "moss",
- "minimax",
- "zhipu"
+ "fontSize": {
+ "description": "Font size in output pixels.",
+ "maximum": 512,
+ "minimum": 1,
+ "title": "Fontsize",
+ "type": "number"
+ },
+ "color": {
+ "description": "Text color in #RRGGBB format.",
+ "examples": [
+ "#000000"
],
- "title": "Provider",
+ "pattern": "^#[0-9a-fA-F]{6}$",
+ "title": "Color",
"type": "string"
},
- "connectionId": {
- "description": "Opaque service, endpoint and account identity.",
- "maxLength": 200,
- "minLength": 1,
- "title": "Connectionid",
+ "align": {
+ "description": "Horizontal text alignment.",
+ "enum": [
+ "left",
+ "center",
+ "right"
+ ],
+ "title": "Align",
"type": "string"
},
- "requiresTranscript": {
- "description": "Registered voice must have a reference transcript.",
- "title": "Requirestranscript",
- "type": "boolean"
- },
- "acceptsTranscript": {
- "default": false,
- "description": "Registry stores an optional reference transcript when one is supplied.",
- "title": "Acceptstranscript",
- "type": "boolean"
- },
- "requiresReferenceAudio": {
- "description": "Registered voice must have actual reference audio.",
- "title": "Requiresreferenceaudio",
- "type": "boolean"
- },
- "supportsUploadedVoices": {
- "default": true,
- "description": "Selected model checkpoint accepts uploaded registry voices.",
- "title": "Supportsuploadedvoices",
- "type": "boolean"
+ "lineHeight": {
+ "description": "Line height as a font size multiplier.",
+ "maximum": 3,
+ "minimum": 0.8,
+ "title": "Lineheight",
+ "type": "number"
},
- "referenceEmbeddingDimension": {
+ "background": {
"anyOf": [
{
- "maximum": 65536,
- "minimum": 1,
- "type": "integer"
+ "$ref": "#/$defs/TimelineTextBackground"
},
{
"type": "null"
}
],
"default": null,
- "description": "Accepted registered reference embedding dimension; null requires actual reference audio when required.",
- "title": "Referenceembeddingdimension"
- },
- "canDelete": {
- "description": "Provider supports uploaded voice deletion.",
- "title": "Candelete",
- "type": "boolean"
- },
- "maxBytes": {
- "description": "Maximum audio sample bytes.",
- "minimum": 1,
- "title": "Maxbytes",
- "type": "integer"
- },
- "formats": {
- "description": "Supported recording file extensions.",
- "items": {
- "type": "string"
- },
- "title": "Formats",
- "type": "array"
- },
- "minSeconds": {
- "anyOf": [
- {
- "type": "number"
- },
- {
- "type": "null"
- }
- ],
- "description": "Minimum recording duration, if documented.",
- "title": "Minseconds"
+ "description": "Optional text background."
},
- "maxSeconds": {
+ "stroke": {
"anyOf": [
{
- "type": "number"
+ "$ref": "#/$defs/TimelineTextStroke"
},
{
"type": "null"
}
],
- "description": "Maximum recording duration, if documented.",
- "title": "Maxseconds"
+ "default": null,
+ "description": "Optional text stroke."
}
},
"required": [
- "provider",
- "connectionId",
- "requiresTranscript",
- "requiresReferenceAudio",
- "canDelete",
- "maxBytes",
- "formats",
- "minSeconds",
- "maxSeconds"
+ "fontSize",
+ "color",
+ "align",
+ "lineHeight"
],
- "title": "VoiceLibraryCapabilities",
+ "title": "TimelineTextStyle",
"type": "object"
},
- "VoiceSelection": {
+ "TimelineTrack": {
"additionalProperties": false,
"properties": {
- "connectionId": {
- "description": "Opaque voice service identity.",
- "maxLength": 200,
+ "id": {
+ "description": "Stable object ID.",
+ "maxLength": 100,
"minLength": 1,
- "title": "Connectionid",
+ "pattern": "\\S",
+ "title": "Id",
"type": "string"
},
- "voiceId": {
- "description": "Provider voice identity.",
- "maxLength": 200,
- "minLength": 1,
- "pattern": "^[^/\\\\\\x00-\\x1f\\x7f]+$",
- "title": "Voiceid",
+ "kind": {
+ "description": "Business object or media type.",
+ "enum": [
+ "visual",
+ "audio"
+ ],
+ "title": "Kind",
"type": "string"
},
- "name": {
- "description": "Readable provider voice name.",
+ "title": {
+ "description": "User-visible title.",
"maxLength": 255,
- "minLength": 1,
- "title": "Name",
- "type": "string"
- },
- "source": {
- "description": "Provider voice source; used to check checkpoint compatibility.",
- "enum": [
- "builtin",
- "uploaded"
- ],
- "title": "Source",
+ "title": "Title",
"type": "string"
},
- "hasReferenceAudio": {
- "description": "Provider reports a registered reference recording.",
- "title": "Hasreferenceaudio",
+ "muted": {
+ "default": false,
+ "description": "Whether audio output is muted.",
+ "title": "Muted",
"type": "boolean"
},
- "embeddingDim": {
- "anyOf": [
- {
- "maximum": 65536,
- "minimum": 1,
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Registered reference embedding dimension, when the provider reports one.",
- "title": "Embeddingdim"
- },
- "refText": {
- "anyOf": [
- {
- "maxLength": 100000,
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Provider reference transcript, when available.",
- "title": "Reftext"
+ "clips": {
+ "default": [],
+ "description": "Ordered clips on this track.",
+ "items": {
+ "$ref": "#/$defs/TimelineClip"
+ },
+ "title": "Clips",
+ "type": "array"
}
},
"required": [
- "connectionId",
- "voiceId",
- "name",
- "source",
- "hasReferenceAudio"
+ "id",
+ "kind",
+ "title"
],
- "title": "VoiceSelection",
+ "title": "TimelineTrack",
"type": "object"
- }
- },
- "additionalProperties": false,
- "properties": {
- "project": {
- "$ref": "#/$defs/ProjectSnapshot",
- "description": "Authoritative project snapshot schema."
},
- "canvasItem": {
- "description": "Canvas item schema.",
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioCanvasItem",
- "external": "#/$defs/DirectorCanvasItem",
- "file": "#/$defs/FileCanvasItem",
- "group": "#/$defs/GroupCanvasItem",
- "image": "#/$defs/ImageCanvasItem",
- "stack": "#/$defs/StackCanvasItem",
- "subject": "#/$defs/SubjectCanvasItem",
- "text": "#/$defs/TextCanvasItem",
- "timeline": "#/$defs/TimelineCanvasItem",
- "tool": "#/$defs/ToolCanvasItem",
- "video": "#/$defs/VideoCanvasItem"
+ "ToolCanvasItem": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
},
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TextCanvasItem"
- },
- {
- "$ref": "#/$defs/ImageCanvasItem"
- },
- {
- "$ref": "#/$defs/VideoCanvasItem"
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
},
- {
- "$ref": "#/$defs/AudioCanvasItem"
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
},
- {
- "$ref": "#/$defs/FileCanvasItem"
+ "kind": {
+ "const": "tool",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
},
- {
- "$ref": "#/$defs/SubjectCanvasItem"
+ "title": {
+ "default": "",
+ "description": "User-visible title.",
+ "maxLength": 255,
+ "title": "Title",
+ "type": "string"
},
- {
- "$ref": "#/$defs/TimelineCanvasItem"
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
},
- {
- "$ref": "#/$defs/StackCanvasItem"
+ "width": {
+ "default": 352,
+ "description": "Width in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Width",
+ "type": "number"
},
- {
- "$ref": "#/$defs/ToolCanvasItem"
+ "height": {
+ "default": 198,
+ "description": "Height in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Height",
+ "type": "number"
},
- {
- "$ref": "#/$defs/DirectorCanvasItem"
+ "zIndex": {
+ "default": 0,
+ "description": "Canvas stacking order.",
+ "title": "Zindex",
+ "type": "integer"
},
- {
- "$ref": "#/$defs/GroupCanvasItem"
- }
- ],
- "title": "Canvasitem"
- },
- "generationSpec": {
- "description": "Generation configuration schema.",
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioGenerationSpec",
- "image": "#/$defs/ImageGenerationSpec",
- "text": "#/$defs/TextGenerationSpec",
- "video": "#/$defs/VideoGenerationSpec"
+ "locked": {
+ "default": false,
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
+ "type": "boolean"
},
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TextGenerationSpec"
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
},
- {
- "$ref": "#/$defs/ImageGenerationSpec"
+ "parentId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Parent canvas group ID, or null for the root.",
+ "title": "Parentid"
},
- {
- "$ref": "#/$defs/VideoGenerationSpec"
+ "tags": {
+ "default": [],
+ "description": "User-defined search tags.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Tags",
+ "type": "array"
},
- {
- "$ref": "#/$defs/AudioGenerationSpec"
+ "binding": {
+ "$ref": "#/$defs/EditorBinding",
+ "description": "Business object displayed by this canvas item."
}
+ },
+ "required": [
+ "id",
+ "projectId",
+ "kind",
+ "binding"
],
- "title": "Generationspec"
+ "title": "ToolCanvasItem",
+ "type": "object"
},
- "reference": {
- "description": "Generation reference to create or update.",
- "discriminator": {
- "mapping": {
- "follow_current": "#/$defs/FollowingReference",
- "pinned": "#/$defs/PinnedReference"
+ "ToolData": {
+ "additionalProperties": false,
+ "properties": {
+ "kind": {
+ "description": "Business object or media type.",
+ "enum": [
+ "camera",
+ "style",
+ "palette",
+ "camera_motion"
+ ],
+ "title": "Kind",
+ "type": "string"
},
- "propertyName": "binding"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/PinnedReference"
+ "fields": {
+ "default": [],
+ "description": "Named tool-specific parameter fields.",
+ "items": {
+ "$ref": "#/$defs/ToolField"
+ },
+ "title": "Fields",
+ "type": "array"
},
- {
- "$ref": "#/$defs/FollowingReference"
+ "provenance": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/PaletteProvenance"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Recorded origin and execution context."
+ },
+ "palette": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/PaletteData"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Reusable palette data."
}
+ },
+ "required": [
+ "kind"
],
- "title": "Reference"
+ "title": "ToolData",
+ "type": "object"
},
- "editorDocument": {
- "description": "Editable document schema.",
- "discriminator": {
- "mapping": {
- "director": "#/$defs/DirectorDocument",
- "image_crop": "#/$defs/ImageCropDocument",
- "layers": "#/$defs/LayerDocument",
- "media_edit": "#/$defs/MediaEditDocument",
- "stack": "#/$defs/StackDocument",
- "subject": "#/$defs/SubjectDocument",
- "timeline": "#/$defs/TimelineDocument",
- "tool": "#/$defs/ToolDocument"
+ "ToolDocument": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
},
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TimelineDocument"
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
},
- {
- "$ref": "#/$defs/SubjectDocument"
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
},
- {
- "$ref": "#/$defs/LayerDocument"
+ "schemaVersion": {
+ "const": 1,
+ "default": 1,
+ "description": "Record schema version.",
+ "title": "Schemaversion",
+ "type": "integer"
},
- {
- "$ref": "#/$defs/ImageCropDocument"
+ "inputConnections": {
+ "default": [],
+ "description": "Persisted connections to source assets.",
+ "items": {
+ "$ref": "#/$defs/EditorInputConnection"
+ },
+ "title": "Inputconnections",
+ "type": "array"
},
- {
- "$ref": "#/$defs/StackDocument"
+ "kind": {
+ "const": "tool",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
},
- {
- "$ref": "#/$defs/ToolDocument"
+ "data": {
+ "$ref": "#/$defs/ToolData",
+ "description": "Typed editable document contents."
+ }
+ },
+ "required": [
+ "id",
+ "projectId",
+ "kind",
+ "data"
+ ],
+ "title": "ToolDocument",
+ "type": "object"
+ },
+ "ToolDraftBinding": {
+ "additionalProperties": false,
+ "properties": {
+ "editorId": {
+ "description": "Editable document ID.",
+ "format": "uuid",
+ "title": "Editorid",
+ "type": "string"
},
- {
- "$ref": "#/$defs/DirectorDocument"
+ "editorRevision": {
+ "description": "Expected editable document revision.",
+ "minimum": 1,
+ "title": "Editorrevision",
+ "type": "integer"
},
- {
- "$ref": "#/$defs/MediaEditDocument"
+ "itemId": {
+ "description": "Canvas item ID.",
+ "format": "uuid",
+ "title": "Itemid",
+ "type": "string"
+ },
+ "itemRevision": {
+ "description": "Expected canvas item revision.",
+ "minimum": 1,
+ "title": "Itemrevision",
+ "type": "integer"
}
+ },
+ "required": [
+ "editorId",
+ "editorRevision",
+ "itemId",
+ "itemRevision"
],
- "title": "Editordocument"
+ "title": "ToolDraftBinding",
+ "type": "object"
},
- "command": {
- "description": "Immutable command recorded in this commit.",
- "discriminator": {
- "mapping": {
- "artifact.publish": "#/$defs/ArtifactPublishCommand",
- "asset.delete": "#/$defs/AssetDeleteCommand",
- "asset.import": "#/$defs/AssetImportCommand",
- "asset.updateMetadata": "#/$defs/AssetMetadataCommand",
- "asset.writeText": "#/$defs/AssetWriteTextCommand",
- "canvas.applyEdit": "#/$defs/CanvasApplyEditCommand",
- "canvas.applyVersion": "#/$defs/NodeVersionApplyCommand",
- "canvas.attachEditor": "#/$defs/CanvasEditorAttachCommand",
- "canvas.configure": "#/$defs/CanvasConfigureCommand",
- "canvas.createGeneration": "#/$defs/CanvasCreateGenerationCommand",
- "canvas.detachEditor": "#/$defs/CanvasEditorDetachCommand",
- "canvas.hide": "#/$defs/CanvasHideCommand",
- "canvas.materialize": "#/$defs/CanvasMaterializeCommand",
- "canvas.move": "#/$defs/CanvasMoveCommand",
- "canvas.publishMedia": "#/$defs/CanvasPublishMediaCommand",
- "canvas.show": "#/$defs/CanvasShowCommand",
- "canvas.update": "#/$defs/CanvasUpdateCommand",
- "creation.batch": "#/$defs/BatchCommand",
- "editor.create": "#/$defs/EditorCreateCommand",
- "editor.save": "#/$defs/EditorSaveCommand",
- "generation.submit": "#/$defs/GenerationSubmitCommand",
- "generationSpec.create": "#/$defs/SpecCreateCommand",
- "generationSpec.restore": "#/$defs/SpecRestoreCommand",
- "generationSpec.setPrompt": "#/$defs/SpecPromptCommand",
- "generationSpec.update": "#/$defs/SpecUpdateCommand",
- "history.redo": "#/$defs/HistoryRedoCommand",
- "history.undo": "#/$defs/HistoryUndoCommand",
- "job.cancel": "#/$defs/JobCancelCommand",
- "job.checkpoint": "#/$defs/JobCheckpointCommand",
- "job.recover": "#/$defs/JobRecoverCommand",
- "project.create": "#/$defs/ProjectCreateCommand",
- "project.rename": "#/$defs/ProjectRenameCommand",
- "project.restore": "#/$defs/ProjectRestoreCommand",
- "project.trash": "#/$defs/ProjectTrashCommand",
- "reference.add": "#/$defs/ReferenceAddCommand",
- "reference.remove": "#/$defs/ReferenceRemoveCommand",
- "reference.restore": "#/$defs/ReferenceRestoreCommand",
- "reference.update": "#/$defs/ReferenceUpdateCommand",
- "result.select": "#/$defs/ResultSelectCommand",
- "timeline.publishRender": "#/$defs/TimelinePublishRenderCommand"
+ "ToolField": {
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "description": "User-visible name.",
+ "maxLength": 200,
+ "minLength": 1,
+ "title": "Name",
+ "type": "string"
},
- "propertyName": "type"
+ "values": {
+ "description": "Ordered tool field values.",
+ "items": {
+ "type": "string"
+ },
+ "title": "Values",
+ "type": "array"
+ }
},
- "oneOf": [
- {
- "$ref": "#/$defs/ProjectCreateCommand"
+ "required": [
+ "name",
+ "values"
+ ],
+ "title": "ToolField",
+ "type": "object"
+ },
+ "ToolSelection": {
+ "additionalProperties": false,
+ "properties": {
+ "source": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Input source or recorded provenance."
},
- {
- "$ref": "#/$defs/ProjectRenameCommand"
+ "width": {
+ "description": "Width in pixels.",
+ "minimum": 1,
+ "title": "Width",
+ "type": "integer"
},
- {
- "$ref": "#/$defs/ProjectTrashCommand"
+ "height": {
+ "description": "Height in pixels.",
+ "minimum": 1,
+ "title": "Height",
+ "type": "integer"
},
- {
- "$ref": "#/$defs/ProjectRestoreCommand"
+ "mask": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AssetRef"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Ordered strokes or encoded selection mask."
},
- {
- "$ref": "#/$defs/AssetImportCommand"
+ "boxes": {
+ "default": [],
+ "description": "Selection rectangles in source image pixels.",
+ "items": {
+ "$ref": "#/$defs/SelectionBox"
+ },
+ "title": "Boxes",
+ "type": "array"
+ }
+ },
+ "required": [
+ "source",
+ "width",
+ "height"
+ ],
+ "title": "ToolSelection",
+ "type": "object"
+ },
+ "TransformFrame": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable object ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
+ "type": "string"
},
- {
- "$ref": "#/$defs/ArtifactPublishCommand"
+ "time": {
+ "description": "Keyframe time in seconds.",
+ "minimum": 0,
+ "title": "Time",
+ "type": "number"
},
- {
- "$ref": "#/$defs/AssetWriteTextCommand"
+ "value": {
+ "$ref": "#/$defs/StageTransform",
+ "description": "Keyframed transform or camera pose."
},
- {
- "$ref": "#/$defs/AssetMetadataCommand"
+ "keyedChannels": {
+ "anyOf": [
+ {
+ "items": {
+ "enum": [
+ "position",
+ "rotation",
+ "scale"
+ ],
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Transform properties explicitly keyed at this frame.",
+ "title": "Keyedchannels"
},
- {
- "$ref": "#/$defs/AssetDeleteCommand"
+ "transitions": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/StageTransformTransitions"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Per-property interpolation for the outgoing segment."
+ }
+ },
+ "required": [
+ "id",
+ "time",
+ "value"
+ ],
+ "title": "TransformFrame",
+ "type": "object"
+ },
+ "UploadInfo": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable object ID.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
},
- {
- "$ref": "#/$defs/CanvasCreateGenerationCommand"
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
},
- {
- "$ref": "#/$defs/CanvasShowCommand"
- },
- {
- "$ref": "#/$defs/CanvasMoveCommand"
- },
- {
- "$ref": "#/$defs/CanvasUpdateCommand"
- },
- {
- "$ref": "#/$defs/CanvasHideCommand"
+ "name": {
+ "description": "User-visible name.",
+ "title": "Name",
+ "type": "string"
},
- {
- "$ref": "#/$defs/CanvasMaterializeCommand"
+ "status": {
+ "description": "Current operation lifecycle state.",
+ "enum": [
+ "uploading",
+ "ready",
+ "registered",
+ "cancelled"
+ ],
+ "title": "Status",
+ "type": "string"
},
- {
- "$ref": "#/$defs/CanvasApplyEditCommand"
+ "kind": {
+ "anyOf": [
+ {
+ "enum": [
+ "text",
+ "image",
+ "video",
+ "audio",
+ "file"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Business object or media type.",
+ "title": "Kind"
},
- {
- "$ref": "#/$defs/CanvasPublishMediaCommand"
+ "fingerprint": {
+ "anyOf": [
+ {
+ "pattern": "^sha256:[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Immutable content fingerprint.",
+ "title": "Fingerprint"
},
- {
- "$ref": "#/$defs/TimelinePublishRenderCommand"
+ "metadata": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/MediaMetadata"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Verified media properties."
},
- {
- "$ref": "#/$defs/NodeVersionApplyCommand"
+ "assetId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Asset ID.",
+ "title": "Assetid"
+ }
+ },
+ "required": [
+ "id",
+ "projectId",
+ "name",
+ "status"
+ ],
+ "title": "UploadInfo",
+ "type": "object"
+ },
+ "Vector3": {
+ "additionalProperties": false,
+ "properties": {
+ "x": {
+ "description": "X component in stage coordinates.",
+ "title": "X",
+ "type": "number"
},
- {
- "$ref": "#/$defs/CanvasConfigureCommand"
+ "y": {
+ "description": "Y component in stage coordinates.",
+ "title": "Y",
+ "type": "number"
},
- {
- "$ref": "#/$defs/CanvasEditorAttachCommand"
+ "z": {
+ "description": "Z component in stage coordinates.",
+ "title": "Z",
+ "type": "number"
+ }
+ },
+ "required": [
+ "x",
+ "y",
+ "z"
+ ],
+ "title": "Vector3",
+ "type": "object"
+ },
+ "VersionsQuery": {
+ "additionalProperties": false,
+ "properties": {
+ "queryId": {
+ "description": "Caller-supplied query ID.",
+ "format": "uuid",
+ "title": "Queryid",
+ "type": "string"
},
- {
- "$ref": "#/$defs/CanvasEditorDetachCommand"
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
},
- {
- "$ref": "#/$defs/SpecCreateCommand"
+ "type": {
+ "description": "Read object versions.",
+ "enum": [
+ "generationSpec.versions",
+ "canvas.versions"
+ ],
+ "title": "Type",
+ "type": "string"
},
- {
- "$ref": "#/$defs/SpecUpdateCommand"
+ "objectId": {
+ "description": "Target configuration or canvas item ID.",
+ "format": "uuid",
+ "title": "Objectid",
+ "type": "string"
+ }
+ },
+ "required": [
+ "queryId",
+ "projectId",
+ "type",
+ "objectId"
+ ],
+ "title": "VersionsQuery",
+ "type": "object"
+ },
+ "VideoCanvasItem": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
},
- {
- "$ref": "#/$defs/SpecRestoreCommand"
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
},
- {
- "$ref": "#/$defs/SpecPromptCommand"
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
},
- {
- "$ref": "#/$defs/ReferenceAddCommand"
+ "kind": {
+ "const": "video",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
},
- {
- "$ref": "#/$defs/ReferenceUpdateCommand"
+ "title": {
+ "default": "",
+ "description": "User-visible title.",
+ "maxLength": 255,
+ "title": "Title",
+ "type": "string"
},
- {
- "$ref": "#/$defs/ReferenceRestoreCommand"
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
},
- {
- "$ref": "#/$defs/ReferenceRemoveCommand"
+ "width": {
+ "default": 352,
+ "description": "Width in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Width",
+ "type": "number"
},
- {
- "$ref": "#/$defs/GenerationSubmitCommand"
+ "height": {
+ "default": 198,
+ "description": "Height in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Height",
+ "type": "number"
},
- {
- "$ref": "#/$defs/JobCancelCommand"
+ "zIndex": {
+ "default": 0,
+ "description": "Canvas stacking order.",
+ "title": "Zindex",
+ "type": "integer"
},
- {
- "$ref": "#/$defs/JobRecoverCommand"
+ "locked": {
+ "default": false,
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
+ "type": "boolean"
},
- {
- "$ref": "#/$defs/JobCheckpointCommand"
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
},
- {
- "$ref": "#/$defs/ResultSelectCommand"
- },
- {
- "$ref": "#/$defs/EditorCreateCommand"
- },
- {
- "$ref": "#/$defs/EditorSaveCommand"
+ "parentId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Parent canvas group ID, or null for the root.",
+ "title": "Parentid"
},
- {
- "$ref": "#/$defs/HistoryUndoCommand"
+ "tags": {
+ "default": [],
+ "description": "User-defined search tags.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Tags",
+ "type": "array"
},
- {
- "$ref": "#/$defs/HistoryRedoCommand"
+ "binding": {
+ "description": "Business object displayed by this canvas item.",
+ "discriminator": {
+ "mapping": {
+ "empty": "#/$defs/EmptyBinding",
+ "generation": "#/$defs/GenerationBinding",
+ "material": "#/$defs/MaterialBinding"
+ },
+ "propertyName": "role"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/EmptyBinding"
+ },
+ {
+ "$ref": "#/$defs/MaterialBinding"
+ },
+ {
+ "$ref": "#/$defs/GenerationBinding"
+ }
+ ],
+ "title": "Binding"
},
- {
- "$ref": "#/$defs/BatchCommand"
+ "editors": {
+ "default": [],
+ "description": "Attached editable documents.",
+ "items": {
+ "$ref": "#/$defs/EditorRef"
+ },
+ "title": "Editors",
+ "type": "array"
}
+ },
+ "required": [
+ "id",
+ "projectId",
+ "kind",
+ "binding"
],
- "title": "Command"
- },
- "receipt": {
- "$ref": "#/$defs/CommandReceipt",
- "description": "Immutable command execution receipt."
+ "title": "VideoCanvasItem",
+ "type": "object"
},
- "query": {
- "description": "Read-only project query.",
- "discriminator": {
- "mapping": {
- "asset.preview": "#/$defs/AssetPreviewQuery",
- "asset.search": "#/$defs/AssetSearchQuery",
- "asset.usage": "#/$defs/AssetUsageQuery",
- "canvas.status": "#/$defs/CanvasStatusQuery",
- "canvas.versions": "#/$defs/VersionsQuery",
- "generationSpec.versions": "#/$defs/VersionsQuery",
- "job.get": "#/$defs/ObjectQuery",
- "object.get": "#/$defs/ObjectQuery",
- "project.get": "#/$defs/ProjectQuery"
- },
- "propertyName": "type"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/ProjectQuery"
- },
- {
- "$ref": "#/$defs/ObjectQuery"
- },
- {
- "$ref": "#/$defs/VersionsQuery"
- },
- {
- "$ref": "#/$defs/AssetSearchQuery"
+ "VideoCapabilities": {
+ "additionalProperties": false,
+ "properties": {
+ "outputs": {
+ "description": "Supported output resolution and duration combinations.",
+ "items": {
+ "$ref": "#/$defs/VideoOutput"
+ },
+ "maxItems": 20,
+ "minItems": 1,
+ "title": "Outputs",
+ "type": "array"
},
- {
- "$ref": "#/$defs/AssetUsageQuery"
+ "defaultResolution": {
+ "default": "auto",
+ "description": "Default output resolution or auto.",
+ "title": "Defaultresolution",
+ "type": "string"
},
- {
- "$ref": "#/$defs/CanvasStatusQuery"
+ "defaultDuration": {
+ "default": 5,
+ "description": "Default output duration in seconds.",
+ "maximum": 60,
+ "minimum": 1,
+ "title": "Defaultduration",
+ "type": "integer"
},
- {
- "$ref": "#/$defs/AssetPreviewQuery"
+ "dimensionStep": {
+ "default": 2,
+ "description": "Required pixel alignment of output dimensions.",
+ "enum": [
+ 1,
+ 2,
+ 8,
+ 16,
+ 32,
+ 64
+ ],
+ "title": "Dimensionstep",
+ "type": "integer"
}
+ },
+ "required": [
+ "outputs"
],
- "title": "Query"
- },
- "event": {
- "$ref": "#/$defs/ProjectEvent",
- "description": "Project change event, if emitted."
- },
- "job": {
- "$ref": "#/$defs/Job",
- "description": "Generation execution record."
- },
- "result": {
- "$ref": "#/$defs/ResultVersion",
- "description": "Generated result schema."
- },
- "snapshot": {
- "$ref": "#/$defs/InputSnapshot",
- "description": "Fixed generation input schema."
+ "title": "VideoCapabilities",
+ "type": "object"
},
- "executionParameters": {
- "description": "Effective provider execution parameter schema.",
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioExecution",
- "image": "#/$defs/ImageExecution",
- "text": "#/$defs/TextExecution",
- "video": "#/$defs/VideoExecution"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TextExecution"
- },
- {
- "$ref": "#/$defs/ImageExecution"
+ "VideoExecution": {
+ "additionalProperties": false,
+ "description": "Resolved adapter parameters, distinct from user intent and source layout.",
+ "properties": {
+ "kind": {
+ "const": "video",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
},
- {
- "$ref": "#/$defs/VideoExecution"
+ "durationSeconds": {
+ "anyOf": [
+ {
+ "maximum": 60,
+ "minimum": 1,
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Duration in seconds.",
+ "title": "Durationseconds"
},
- {
- "$ref": "#/$defs/AudioExecution"
- }
- ],
- "title": "Executionparameters"
- },
- "promptPart": {
- "description": "Structured prompt token schema.",
- "discriminator": {
- "mapping": {
- "reference": "#/$defs/PromptReference",
- "text": "#/$defs/PromptText"
+ "size": {
+ "anyOf": [
+ {
+ "pattern": "^\\d+x\\d+$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Effective video dimensions sent to the provider.",
+ "title": "Size"
},
- "propertyName": "type"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/PromptText"
+ "resolution": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Requested output resolution.",
+ "title": "Resolution"
},
- {
- "$ref": "#/$defs/PromptReference"
- }
- ],
- "title": "Promptpart"
- },
- "publicModel": {
- "$ref": "#/$defs/ModelConfigPublic",
- "description": "Public model connection schema."
- },
- "writeModel": {
- "$ref": "#/$defs/ModelConfigWrite",
- "description": "Model configuration input schema."
- },
- "capabilities": {
- "$ref": "#/$defs/NodeCapabilities",
- "description": "Available canvas item operations."
- },
- "viewState": {
- "$ref": "#/$defs/ViewState",
- "description": "Client-specific canvas view state."
- },
- "timelinePackageManifest": {
- "$ref": "#/$defs/TimelinePackageManifest",
- "description": "Native editable timeline bundle manifest."
- },
- "timelinePackageImport": {
- "$ref": "#/$defs/TimelinePackageImportRequest",
- "description": "Recoverable native bundle import request."
- },
- "timelinePackageReceipt": {
- "$ref": "#/$defs/TimelinePackageImportReceipt",
- "description": "Native bundle import progress and final receipt."
- },
- "upload": {
- "$ref": "#/$defs/UploadInfo",
- "description": "Staged upload schema."
- }
- },
- "required": [
- "project",
- "canvasItem",
- "generationSpec",
- "reference",
- "editorDocument",
- "command",
- "receipt",
- "query",
- "event",
- "job",
- "result",
- "snapshot",
- "executionParameters",
- "promptPart",
- "publicModel",
- "writeModel",
- "capabilities",
- "viewState",
- "timelinePackageManifest",
- "timelinePackageImport",
- "timelinePackageReceipt",
- "upload"
- ],
- "title": "CreationContracts",
- "type": "object"
- },
- "output": {
- "$defs": {
- "ArtifactPublish": {
- "additionalProperties": false,
- "description": "Publish a file from a server-owned execution context without generating media.",
- "examples": [
- {
- "name": "片段 01",
- "path": "clips/segment-01.mp4"
- }
- ],
- "properties": {
- "path": {
- "description": "Artifact path relative to the server-owned execution directory.",
- "maxLength": 4096,
- "minLength": 1,
- "title": "Path",
- "type": "string"
- },
- "name": {
- "description": "User-visible name.",
- "maxLength": 255,
- "minLength": 1,
- "title": "Name",
- "type": "string"
- },
- "expectedKind": {
+ "fps": {
"anyOf": [
{
- "enum": [
- "text",
- "image",
- "video",
- "audio",
- "file"
- ],
- "type": "string"
+ "minimum": 1,
+ "type": "integer"
},
{
"type": "null"
}
],
"default": null,
- "description": "Required media kind, when specified.",
- "title": "Expectedkind"
+ "description": "Frames per second.",
+ "title": "Fps"
},
- "sources": {
- "default": [],
- "description": "Ordered source asset versions.",
- "items": {
- "$ref": "#/$defs/AssetRef"
- },
- "maxItems": 100,
- "title": "Sources",
- "type": "array"
- }
- },
- "required": [
- "path",
- "name",
- "expectedKind",
- "sources"
- ],
- "title": "ArtifactPublish",
- "type": "object"
- },
- "ArtifactPublishCommand": {
- "additionalProperties": false,
- "description": "Register an execution file as a project asset.",
- "properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
+ "numFrames": {
+ "anyOf": [
+ {
+ "minimum": 1,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Requested video frame count.",
+ "title": "Numframes"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "numInferenceSteps": {
+ "anyOf": [
+ {
+ "minimum": 1,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Diffusion sampling step count.",
+ "title": "Numinferencesteps"
},
- "type": {
- "const": "artifact.publish",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
+ "guidanceScale": {
+ "anyOf": [
+ {
+ "minimum": 0,
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Diffusion guidance scale.",
+ "title": "Guidancescale"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
+ "seed": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Random seed, when specified.",
+ "title": "Seed"
},
- "expectedPreview": {
+ "watermark": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
+ "type": "boolean"
},
{
"type": "null"
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "description": "Whether provider watermarking is enabled.",
+ "title": "Watermark"
},
- "payload": {
- "$ref": "#/$defs/ArtifactPublish",
- "description": "Register an execution file as a project asset."
+ "generateAudio": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether video generation includes audio.",
+ "title": "Generateaudio"
}
},
"required": [
- "commandId",
- "projectId",
- "type",
- "expectedVersions",
- "expectedPreview",
- "payload"
+ "kind"
],
- "title": "ArtifactPublishCommand",
+ "title": "VideoExecution",
"type": "object"
},
- "Asset": {
+ "VideoGenerationSpec": {
"additionalProperties": false,
"properties": {
"id": {
@@ -15333,122 +16249,252 @@
"title": "Revision",
"type": "integer"
},
- "kind": {
- "description": "Business object or media type.",
+ "purpose": {
+ "default": "draft",
+ "description": "Draft settings or executable generation configuration.",
"enum": [
- "text",
- "image",
- "video",
- "audio",
- "file"
+ "draft",
+ "generation"
],
- "title": "Kind",
+ "title": "Purpose",
"type": "string"
},
- "name": {
- "description": "User-visible name.",
- "maxLength": 255,
- "minLength": 1,
- "title": "Name",
- "type": "string"
+ "modelConfigId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Model configuration ID from the model catalog or user model selections.",
+ "title": "Modelconfigid"
},
- "fingerprint": {
- "description": "Immutable content fingerprint.",
- "pattern": "^sha256:[0-9a-f]{64}$",
- "title": "Fingerprint",
+ "prompt": {
+ "default": "",
+ "description": "Generation prompt text.",
+ "maxLength": 20000,
+ "title": "Prompt",
"type": "string"
},
- "path": {
- "description": "Immutable asset path relative to the project directory.",
- "title": "Path",
- "type": "string"
+ "promptContent": {
+ "anyOf": [
+ {
+ "items": {
+ "discriminator": {
+ "mapping": {
+ "reference": "#/$defs/PromptReference",
+ "text": "#/$defs/PromptText"
+ },
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/PromptText"
+ },
+ {
+ "$ref": "#/$defs/PromptReference"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Structured prompt text and reference tokens.",
+ "title": "Promptcontent"
},
- "metadata": {
- "$ref": "#/$defs/MediaMetadata",
- "description": "Verified media properties."
+ "currentResultId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Currently adopted result ID.",
+ "title": "Currentresultid"
},
- "provenance": {
- "$ref": "#/$defs/AssetProvenance",
- "description": "Recorded origin and execution context."
+ "kind": {
+ "const": "video",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "parameters": {
+ "$ref": "#/$defs/VideoParameters",
+ "description": "Typed generation or editing parameters."
}
},
"required": [
"id",
"projectId",
- "revision",
- "kind",
- "name",
- "fingerprint",
- "path",
- "metadata",
- "provenance"
+ "kind"
],
- "title": "Asset",
+ "title": "VideoGenerationSpec",
"type": "object"
},
- "AssetDelete": {
+ "VideoOutput": {
"additionalProperties": false,
"properties": {
- "assetIds": {
- "description": "Target asset IDs.",
+ "resolution": {
+ "description": "Requested output resolution.",
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,23}$",
+ "title": "Resolution",
+ "type": "string"
+ },
+ "durations": {
+ "description": "Supported output durations in seconds.",
"items": {
- "format": "uuid",
- "type": "string"
+ "maximum": 60,
+ "minimum": 1,
+ "type": "integer"
},
- "maxItems": 100,
+ "maxItems": 60,
"minItems": 1,
- "title": "Assetids",
+ "title": "Durations",
"type": "array"
},
- "clearHistory": {
- "default": false,
- "description": "Whether the confirmed deletion also clears dependent history.",
- "title": "Clearhistory",
- "type": "boolean"
+ "width": {
+ "anyOf": [
+ {
+ "maximum": 8192,
+ "minimum": 64,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Width in pixels.",
+ "title": "Width"
+ },
+ "height": {
+ "anyOf": [
+ {
+ "maximum": 8192,
+ "minimum": 64,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Height in pixels.",
+ "title": "Height"
}
},
"required": [
- "assetIds",
- "clearHistory"
+ "resolution",
+ "durations"
],
- "title": "AssetDelete",
+ "title": "VideoOutput",
"type": "object"
},
- "AssetDeleteCommand": {
+ "VideoParameters": {
"additionalProperties": false,
- "description": "Delete assets after an impact preview.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
+ "generateAudio": {
+ "default": true,
+ "description": "Include audio; value must be allowed by model inputRules.generateAudioOptions.",
+ "title": "Generateaudio",
+ "type": "boolean"
+ },
+ "videoMode": {
+ "default": "first_frame",
+ "description": "Video generation input mode.",
+ "enum": [
+ "first_frame",
+ "reference",
+ "continuation"
+ ],
+ "title": "Videomode",
"type": "string"
},
+ "durationSeconds": {
+ "anyOf": [
+ {
+ "maximum": 60,
+ "minimum": 1,
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Duration in seconds; fractional values require model inputRules.fractionalDuration. Generated frames may be aligned by the model.",
+ "title": "Durationseconds"
+ },
+ "aspectRatio": {
+ "anyOf": [
+ {
+ "pattern": "^[1-9]\\d?:[1-9]\\d?$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Output width-to-height ratio.",
+ "title": "Aspectratio"
+ },
+ "resolution": {
+ "default": "auto",
+ "description": "Requested output resolution.",
+ "pattern": "^(?:auto|[A-Z0-9][A-Z0-9_.-]{0,23})$",
+ "title": "Resolution",
+ "type": "string"
+ }
+ },
+ "title": "VideoParameters",
+ "type": "object"
+ },
+ "ViewState": {
+ "additionalProperties": false,
+ "properties": {
"projectId": {
"description": "Owning project ID.",
"format": "uuid",
"title": "Projectid",
"type": "string"
},
- "type": {
- "const": "asset.delete",
- "description": "Command discriminator.",
- "title": "Type",
+ "clientId": {
+ "description": "Client identity for independent view state.",
+ "format": "uuid",
+ "title": "Clientid",
"type": "string"
},
- "expectedVersions": {
+ "viewport": {
+ "$ref": "#/$defs/Viewport",
+ "description": "Canvas pan and zoom state."
+ },
+ "selectedItemIds": {
"default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "description": "Currently selected canvas item IDs.",
"items": {
- "$ref": "#/$defs/ObjectVersion"
+ "format": "uuid",
+ "type": "string"
},
- "title": "Expectedversions",
+ "title": "Selecteditemids",
"type": "array"
},
- "expectedPreview": {
+ "activeEditorId": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
+ "format": "uuid",
"type": "string"
},
{
@@ -15456,321 +16502,225 @@
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "description": "Currently active editable document ID.",
+ "title": "Activeeditorid"
},
- "payload": {
- "$ref": "#/$defs/AssetDelete",
- "description": "Delete assets after an impact preview."
+ "playheads": {
+ "default": [],
+ "description": "Playback positions keyed by editor identity.",
+ "items": {
+ "$ref": "#/$defs/Playhead"
+ },
+ "title": "Playheads",
+ "type": "array"
+ },
+ "generationCounts": {
+ "additionalProperties": {
+ "maximum": 8,
+ "minimum": 1,
+ "type": "integer"
+ },
+ "description": "Requested generation counts keyed by canvas item ID.",
+ "propertyNames": {
+ "format": "uuid"
+ },
+ "title": "Generationcounts",
+ "type": "object"
}
},
"required": [
- "commandId",
"projectId",
- "type",
- "expectedVersions",
- "expectedPreview",
- "payload"
+ "clientId"
],
- "title": "AssetDeleteCommand",
+ "title": "ViewState",
"type": "object"
},
- "AssetImport": {
+ "Viewport": {
"additionalProperties": false,
"properties": {
- "uploadHandle": {
- "description": "Server-issued staged upload ID.",
- "format": "uuid",
- "title": "Uploadhandle",
- "type": "string"
+ "x": {
+ "default": 0,
+ "description": "Horizontal coordinate.",
+ "title": "X",
+ "type": "number"
},
- "name": {
- "description": "User-visible name.",
- "maxLength": 255,
- "minLength": 1,
- "title": "Name",
- "type": "string"
+ "y": {
+ "default": 0,
+ "description": "Vertical coordinate.",
+ "title": "Y",
+ "type": "number"
},
- "expectedKind": {
- "description": "Required media kind, when specified.",
- "enum": [
- "text",
- "image",
- "video",
- "audio",
- "file"
- ],
- "title": "Expectedkind",
- "type": "string"
+ "zoom": {
+ "default": 1,
+ "description": "Canvas viewport zoom factor.",
+ "maximum": 8,
+ "minimum": 0.08,
+ "title": "Zoom",
+ "type": "number"
}
},
- "required": [
- "uploadHandle",
- "name",
- "expectedKind"
- ],
- "title": "AssetImport",
+ "title": "Viewport",
"type": "object"
},
- "AssetImportCommand": {
+ "VoiceLibraryCapabilities": {
"additionalProperties": false,
- "description": "Register an uploaded file as a project asset.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
+ "provider": {
+ "description": "Voice registry protocol.",
+ "enum": [
+ "vllm_omni",
+ "moss",
+ "minimax",
+ "zhipu"
+ ],
+ "title": "Provider",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ "connectionId": {
+ "description": "Opaque service, endpoint and account identity.",
+ "maxLength": 200,
+ "minLength": 1,
+ "title": "Connectionid",
"type": "string"
},
- "type": {
- "const": "asset.import",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
+ "requiresTranscript": {
+ "description": "Registered voice must have a reference transcript.",
+ "title": "Requirestranscript",
+ "type": "boolean"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
+ "acceptsTranscript": {
+ "default": false,
+ "description": "Registry stores an optional reference transcript when one is supplied.",
+ "title": "Acceptstranscript",
+ "type": "boolean"
},
- "expectedPreview": {
+ "requiresReferenceAudio": {
+ "description": "Registered voice must have actual reference audio.",
+ "title": "Requiresreferenceaudio",
+ "type": "boolean"
+ },
+ "supportsUploadedVoices": {
+ "default": true,
+ "description": "Selected model checkpoint accepts uploaded registry voices.",
+ "title": "Supportsuploadedvoices",
+ "type": "boolean"
+ },
+ "referenceEmbeddingDimension": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
+ "maximum": 65536,
+ "minimum": 1,
+ "type": "integer"
},
{
"type": "null"
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
- },
- "payload": {
- "$ref": "#/$defs/AssetImport",
- "description": "Register an uploaded file as a project asset."
- }
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "expectedVersions",
- "expectedPreview",
- "payload"
- ],
- "title": "AssetImportCommand",
- "type": "object"
- },
- "AssetMetadataCommand": {
- "additionalProperties": false,
- "description": "Rename an asset.",
- "properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
+ "description": "Accepted registered reference embedding dimension; null requires actual reference audio when required.",
+ "title": "Referenceembeddingdimension"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "canDelete": {
+ "description": "Provider supports uploaded voice deletion.",
+ "title": "Candelete",
+ "type": "boolean"
},
- "type": {
- "const": "asset.updateMetadata",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
+ "maxBytes": {
+ "description": "Maximum audio sample bytes.",
+ "minimum": 1,
+ "title": "Maxbytes",
+ "type": "integer"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "formats": {
+ "description": "Supported recording file extensions.",
"items": {
- "$ref": "#/$defs/ObjectVersion"
+ "type": "string"
},
- "title": "Expectedversions",
+ "title": "Formats",
"type": "array"
},
- "expectedPreview": {
+ "minSeconds": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
+ "type": "number"
},
{
"type": "null"
}
],
- "default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "description": "Minimum recording duration, if documented.",
+ "title": "Minseconds"
},
- "payload": {
- "$ref": "#/$defs/AssetMetadataUpdate",
- "description": "Rename an asset."
+ "maxSeconds": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Maximum recording duration, if documented.",
+ "title": "Maxseconds"
}
},
"required": [
- "commandId",
- "projectId",
- "type",
- "expectedVersions",
- "expectedPreview",
- "payload"
+ "provider",
+ "connectionId",
+ "requiresTranscript",
+ "requiresReferenceAudio",
+ "canDelete",
+ "maxBytes",
+ "formats",
+ "minSeconds",
+ "maxSeconds"
],
- "title": "AssetMetadataCommand",
+ "title": "VoiceLibraryCapabilities",
"type": "object"
},
- "AssetMetadataUpdate": {
+ "VoiceSelection": {
"additionalProperties": false,
"properties": {
- "assetId": {
- "description": "Asset ID.",
- "format": "uuid",
- "title": "Assetid",
+ "connectionId": {
+ "description": "Opaque voice service identity.",
+ "maxLength": 200,
+ "minLength": 1,
+ "title": "Connectionid",
"type": "string"
},
- "name": {
- "description": "User-visible name.",
- "maxLength": 255,
- "minLength": 1,
- "title": "Name",
- "type": "string"
- }
- },
- "required": [
- "assetId",
- "name"
- ],
- "title": "AssetMetadataUpdate",
- "type": "object"
- },
- "AssetPreviewQuery": {
- "additionalProperties": false,
- "properties": {
- "queryId": {
- "description": "Caller-supplied query ID.",
- "format": "uuid",
- "title": "Queryid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ "voiceId": {
+ "description": "Provider voice identity.",
+ "maxLength": 200,
+ "minLength": 1,
+ "pattern": "^[^/\\\\\\x00-\\x1f\\x7f]+$",
+ "title": "Voiceid",
"type": "string"
},
- "type": {
- "const": "asset.preview",
- "description": "Preview an asset; does not establish model observation.",
- "title": "Type",
+ "name": {
+ "description": "Readable provider voice name.",
+ "maxLength": 255,
+ "minLength": 1,
+ "title": "Name",
"type": "string"
},
- "objectId": {
- "description": "Asset ID.",
- "format": "uuid",
- "title": "Objectid",
- "type": "string"
- }
- },
- "required": [
- "queryId",
- "projectId",
- "type",
- "objectId"
- ],
- "title": "AssetPreviewQuery",
- "type": "object"
- },
- "AssetProvenance": {
- "additionalProperties": false,
- "properties": {
"source": {
- "description": "Input source or recorded provenance.",
+ "description": "Provider voice source; used to check checkpoint compatibility.",
"enum": [
- "upload",
- "manual",
- "agent_written",
- "generated",
- "edited",
- "rendered",
- "imported"
+ "builtin",
+ "uploaded"
],
"title": "Source",
"type": "string"
},
- "jobId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Generation job ID.",
- "title": "Jobid"
- },
- "toolTaskId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Tool execution ID.",
- "title": "Tooltaskid"
- },
- "sourceItemId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Source canvas item ID.",
- "title": "Sourceitemid"
- },
- "editorDocumentId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Editable document ID.",
- "title": "Editordocumentid"
+ "hasReferenceAudio": {
+ "description": "Provider reports a registered reference recording.",
+ "title": "Hasreferenceaudio",
+ "type": "boolean"
},
- "editorRevision": {
+ "embeddingDim": {
"anyOf": [
{
+ "maximum": 65536,
"minimum": 1,
"type": "integer"
},
@@ -15779,99 +16729,13 @@
}
],
"default": null,
- "description": "Expected editable document revision.",
- "title": "Editorrevision"
- },
- "sources": {
- "default": [],
- "description": "Ordered source asset versions.",
- "items": {
- "$ref": "#/$defs/AssetRef"
- },
- "title": "Sources",
- "type": "array"
- },
- "inputFingerprint": {
- "anyOf": [
- {
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Fingerprint of the fixed execution input.",
- "title": "Inputfingerprint"
- },
- "agentRunId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Agent turn ID.",
- "title": "Agentrunid"
- },
- "agentRuntime": {
- "anyOf": [
- {
- "enum": [
- "opencode",
- "codex",
- "claude",
- "jiuwenswarm",
- "deepseek"
- ],
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Native Agent runtime that produced this asset.",
- "title": "Agentruntime"
- },
- "modelSnapshot": {
- "anyOf": [
- {
- "$ref": "#/$defs/ModelSnapshot"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Fixed model connection recorded for provenance."
- },
- "prompt": {
- "anyOf": [
- {
- "maxLength": 20000,
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Generation prompt text.",
- "title": "Prompt"
+ "description": "Registered reference embedding dimension, when the provider reports one.",
+ "title": "Embeddingdim"
},
- "importedFrom": {
+ "refText": {
"anyOf": [
{
- "enum": [
- "generated",
- "edited"
- ],
+ "maxLength": 100000,
"type": "string"
},
{
@@ -15879,1067 +16743,610 @@
}
],
"default": null,
- "description": "Original source recorded by a canvas archive this asset was imported from.",
- "title": "Importedfrom"
+ "description": "Provider reference transcript, when available.",
+ "title": "Reftext"
}
},
"required": [
+ "connectionId",
+ "voiceId",
+ "name",
"source",
- "jobId",
- "toolTaskId",
- "sourceItemId",
- "editorDocumentId",
- "editorRevision",
- "sources",
- "inputFingerprint",
- "agentRunId",
- "agentRuntime",
- "modelSnapshot",
- "prompt",
- "importedFrom"
+ "hasReferenceAudio"
],
- "title": "AssetProvenance",
+ "title": "VoiceSelection",
"type": "object"
+ }
+ },
+ "additionalProperties": false,
+ "properties": {
+ "project": {
+ "$ref": "#/$defs/ProjectSnapshot",
+ "description": "Authoritative project snapshot schema."
},
- "AssetRef": {
- "additionalProperties": false,
- "properties": {
- "assetId": {
- "description": "ID of a registered project asset from project.assets[].id or a successful asset command result.",
- "format": "uuid",
- "title": "Assetid",
- "type": "string"
+ "canvasItem": {
+ "description": "Canvas item schema.",
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioCanvasItem",
+ "external": "#/$defs/DirectorCanvasItem",
+ "file": "#/$defs/FileCanvasItem",
+ "group": "#/$defs/GroupCanvasItem",
+ "image": "#/$defs/ImageCanvasItem",
+ "stack": "#/$defs/StackCanvasItem",
+ "subject": "#/$defs/SubjectCanvasItem",
+ "text": "#/$defs/TextCanvasItem",
+ "timeline": "#/$defs/TimelineCanvasItem",
+ "tool": "#/$defs/ToolCanvasItem",
+ "video": "#/$defs/VideoCanvasItem"
},
- "revision": {
- "description": "Referenced immutable asset revision.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TextCanvasItem"
},
- "fingerprint": {
- "description": "Immutable content fingerprint.",
- "pattern": "^sha256:[0-9a-f]{64}$",
- "title": "Fingerprint",
- "type": "string"
+ {
+ "$ref": "#/$defs/ImageCanvasItem"
},
- "kind": {
- "description": "Business object or media type.",
- "enum": [
- "text",
- "image",
- "video",
- "audio",
- "file"
- ],
- "title": "Kind",
- "type": "string"
- }
- },
- "required": [
- "assetId",
- "revision",
- "fingerprint",
- "kind"
- ],
- "title": "AssetRef",
- "type": "object"
- },
- "AssetSearchQuery": {
- "additionalProperties": false,
- "properties": {
- "queryId": {
- "description": "Caller-supplied query ID.",
- "format": "uuid",
- "title": "Queryid",
- "type": "string"
+ {
+ "$ref": "#/$defs/VideoCanvasItem"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ {
+ "$ref": "#/$defs/AudioCanvasItem"
},
- "type": {
- "const": "asset.search",
- "description": "Search project assets.",
- "title": "Type",
- "type": "string"
+ {
+ "$ref": "#/$defs/FileCanvasItem"
},
- "text": {
- "default": "",
- "description": "Asset search text.",
- "maxLength": 1000,
- "title": "Text",
- "type": "string"
+ {
+ "$ref": "#/$defs/SubjectCanvasItem"
},
- "offset": {
- "default": 0,
- "description": "Number of matching records to skip.",
- "minimum": 0,
- "title": "Offset",
- "type": "integer"
+ {
+ "$ref": "#/$defs/TimelineCanvasItem"
},
- "limit": {
- "default": 50,
- "description": "Maximum number of records to return.",
- "maximum": 200,
- "minimum": 1,
- "title": "Limit",
- "type": "integer"
+ {
+ "$ref": "#/$defs/StackCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/ToolCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/DirectorCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/GroupCanvasItem"
}
- },
- "required": [
- "queryId",
- "projectId",
- "type",
- "text",
- "offset",
- "limit"
],
- "title": "AssetSearchQuery",
- "type": "object"
+ "title": "Canvasitem"
},
- "AssetUsageQuery": {
- "additionalProperties": false,
- "properties": {
- "queryId": {
- "description": "Caller-supplied query ID.",
- "format": "uuid",
- "title": "Queryid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "generationSpec": {
+ "description": "Generation configuration schema.",
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioGenerationSpec",
+ "image": "#/$defs/ImageGenerationSpec",
+ "text": "#/$defs/TextGenerationSpec",
+ "video": "#/$defs/VideoGenerationSpec"
},
- "type": {
- "const": "asset.usage",
- "description": "Read asset dependencies.",
- "title": "Type",
- "type": "string"
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TextGenerationSpec"
},
- "objectId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Asset ID, or all assets when omitted.",
- "title": "Objectid"
+ {
+ "$ref": "#/$defs/ImageGenerationSpec"
},
- "offset": {
- "default": 0,
- "description": "Number of matching records to skip.",
- "minimum": 0,
- "title": "Offset",
- "type": "integer"
+ {
+ "$ref": "#/$defs/VideoGenerationSpec"
},
- "limit": {
- "default": 50,
- "description": "Maximum number of records to return.",
- "maximum": 200,
- "minimum": 1,
- "title": "Limit",
- "type": "integer"
+ {
+ "$ref": "#/$defs/AudioGenerationSpec"
}
- },
- "required": [
- "queryId",
- "projectId",
- "type",
- "objectId",
- "offset",
- "limit"
],
- "title": "AssetUsageQuery",
- "type": "object"
+ "title": "Generationspec"
},
- "AssetWriteText": {
- "additionalProperties": false,
- "properties": {
- "name": {
- "description": "User-visible name.",
- "maxLength": 255,
- "minLength": 1,
- "title": "Name",
- "type": "string"
+ "reference": {
+ "description": "Generation reference to create or update.",
+ "discriminator": {
+ "mapping": {
+ "follow_current": "#/$defs/FollowingReference",
+ "pinned": "#/$defs/PinnedReference"
},
- "text": {
- "description": "UTF-8 text content or search query.",
- "maxLength": 1048576,
- "title": "Text",
- "type": "string"
+ "propertyName": "binding"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/PinnedReference"
},
- "previousAsset": {
- "anyOf": [
- {
- "$ref": "#/$defs/AssetRef"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Previous immutable version for a new text asset version."
+ {
+ "$ref": "#/$defs/FollowingReference"
}
- },
- "required": [
- "name",
- "text",
- "previousAsset"
],
- "title": "AssetWriteText",
- "type": "object"
+ "title": "Reference"
},
- "AssetWriteTextCommand": {
- "additionalProperties": false,
- "description": "Write a text asset or a new version of an existing text asset.",
- "properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
+ "editorDocument": {
+ "description": "Editable document schema.",
+ "discriminator": {
+ "mapping": {
+ "director": "#/$defs/DirectorDocument",
+ "image_crop": "#/$defs/ImageCropDocument",
+ "layers": "#/$defs/LayerDocument",
+ "media_edit": "#/$defs/MediaEditDocument",
+ "stack": "#/$defs/StackDocument",
+ "subject": "#/$defs/SubjectDocument",
+ "timeline": "#/$defs/TimelineDocument",
+ "tool": "#/$defs/ToolDocument"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TimelineDocument"
},
- "type": {
- "const": "asset.writeText",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
+ {
+ "$ref": "#/$defs/SubjectDocument"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
+ {
+ "$ref": "#/$defs/LayerDocument"
},
- "expectedPreview": {
- "anyOf": [
- {
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ {
+ "$ref": "#/$defs/ImageCropDocument"
},
- "payload": {
- "$ref": "#/$defs/AssetWriteText",
- "description": "Write a text asset or a new version of an existing text asset."
+ {
+ "$ref": "#/$defs/StackDocument"
+ },
+ {
+ "$ref": "#/$defs/ToolDocument"
+ },
+ {
+ "$ref": "#/$defs/DirectorDocument"
+ },
+ {
+ "$ref": "#/$defs/MediaEditDocument"
}
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "expectedVersions",
- "expectedPreview",
- "payload"
],
- "title": "AssetWriteTextCommand",
- "type": "object"
+ "title": "Editordocument"
},
- "AudioCanvasItem": {
- "additionalProperties": false,
- "properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
- "format": "uuid",
- "title": "Id",
- "type": "string"
+ "command": {
+ "description": "Immutable command recorded in this commit.",
+ "discriminator": {
+ "mapping": {
+ "artifact.publish": "#/$defs/ArtifactPublishCommand",
+ "asset.delete": "#/$defs/AssetDeleteCommand",
+ "asset.import": "#/$defs/AssetImportCommand",
+ "asset.updateMetadata": "#/$defs/AssetMetadataCommand",
+ "asset.writeText": "#/$defs/AssetWriteTextCommand",
+ "canvas.applyEdit": "#/$defs/CanvasApplyEditCommand",
+ "canvas.applyVersion": "#/$defs/NodeVersionApplyCommand",
+ "canvas.attachEditor": "#/$defs/CanvasEditorAttachCommand",
+ "canvas.configure": "#/$defs/CanvasConfigureCommand",
+ "canvas.createGeneration": "#/$defs/CanvasCreateGenerationCommand",
+ "canvas.detachEditor": "#/$defs/CanvasEditorDetachCommand",
+ "canvas.hide": "#/$defs/CanvasHideCommand",
+ "canvas.materialize": "#/$defs/CanvasMaterializeCommand",
+ "canvas.move": "#/$defs/CanvasMoveCommand",
+ "canvas.publishMedia": "#/$defs/CanvasPublishMediaCommand",
+ "canvas.show": "#/$defs/CanvasShowCommand",
+ "canvas.update": "#/$defs/CanvasUpdateCommand",
+ "creation.batch": "#/$defs/BatchCommand",
+ "director.apply": "#/$defs/DirectorApplyCommand",
+ "director.camera.delete": "#/$defs/DirectorCameraDeleteCommand",
+ "director.duration.set": "#/$defs/DirectorSetDurationCommand",
+ "director.storyboard.append": "#/$defs/DirectorStoryboardAppendCommand",
+ "director.storyboard.delete": "#/$defs/DirectorStoryboardDeleteCommand",
+ "director.storyboard.reorder": "#/$defs/DirectorStoryboardReorderCommand",
+ "director.storyboard.resize": "#/$defs/DirectorStoryboardResizeCommand",
+ "editor.create": "#/$defs/EditorCreateCommand",
+ "editor.save": "#/$defs/EditorSaveCommand",
+ "generation.submit": "#/$defs/GenerationSubmitCommand",
+ "generationSpec.create": "#/$defs/SpecCreateCommand",
+ "generationSpec.restore": "#/$defs/SpecRestoreCommand",
+ "generationSpec.setPrompt": "#/$defs/SpecPromptCommand",
+ "generationSpec.update": "#/$defs/SpecUpdateCommand",
+ "history.redo": "#/$defs/HistoryRedoCommand",
+ "history.undo": "#/$defs/HistoryUndoCommand",
+ "job.cancel": "#/$defs/JobCancelCommand",
+ "job.checkpoint": "#/$defs/JobCheckpointCommand",
+ "job.recover": "#/$defs/JobRecoverCommand",
+ "project.create": "#/$defs/ProjectCreateCommand",
+ "project.rename": "#/$defs/ProjectRenameCommand",
+ "project.restore": "#/$defs/ProjectRestoreCommand",
+ "project.trash": "#/$defs/ProjectTrashCommand",
+ "reference.add": "#/$defs/ReferenceAddCommand",
+ "reference.remove": "#/$defs/ReferenceRemoveCommand",
+ "reference.restore": "#/$defs/ReferenceRestoreCommand",
+ "reference.update": "#/$defs/ReferenceUpdateCommand",
+ "result.select": "#/$defs/ResultSelectCommand",
+ "timeline.publishRender": "#/$defs/TimelinePublishRenderCommand"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/ProjectCreateCommand"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
+ {
+ "$ref": "#/$defs/ProjectRenameCommand"
},
- "kind": {
- "const": "audio",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
+ {
+ "$ref": "#/$defs/ProjectTrashCommand"
},
- "title": {
- "default": "",
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
- "type": "string"
+ {
+ "$ref": "#/$defs/ProjectRestoreCommand"
},
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
+ {
+ "$ref": "#/$defs/AssetImportCommand"
},
- "width": {
- "default": 352,
- "description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "title": "Width",
- "type": "number"
+ {
+ "$ref": "#/$defs/ArtifactPublishCommand"
},
- "height": {
- "default": 198,
- "description": "Height in pixels.",
- "exclusiveMinimum": 0,
- "title": "Height",
- "type": "number"
+ {
+ "$ref": "#/$defs/AssetWriteTextCommand"
},
- "zIndex": {
- "default": 0,
- "description": "Canvas stacking order.",
- "title": "Zindex",
- "type": "integer"
+ {
+ "$ref": "#/$defs/AssetMetadataCommand"
},
- "locked": {
- "default": false,
- "description": "Whether edits to this object are blocked.",
- "title": "Locked",
- "type": "boolean"
+ {
+ "$ref": "#/$defs/AssetDeleteCommand"
},
- "visible": {
- "default": true,
- "description": "Whether this object is displayed.",
- "title": "Visible",
- "type": "boolean"
+ {
+ "$ref": "#/$defs/CanvasCreateGenerationCommand"
},
- "parentId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Parent canvas group ID, or null for the root.",
- "title": "Parentid"
+ {
+ "$ref": "#/$defs/CanvasShowCommand"
},
- "tags": {
- "default": [],
- "description": "User-defined search tags.",
- "items": {
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "type": "string"
- },
- "title": "Tags",
- "type": "array"
+ {
+ "$ref": "#/$defs/CanvasMoveCommand"
},
- "binding": {
- "description": "Business object displayed by this canvas item.",
- "discriminator": {
- "mapping": {
- "empty": "#/$defs/EmptyBinding",
- "generation": "#/$defs/GenerationBinding",
- "material": "#/$defs/MaterialBinding"
- },
- "propertyName": "role"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/EmptyBinding"
- },
- {
- "$ref": "#/$defs/MaterialBinding"
- },
- {
- "$ref": "#/$defs/GenerationBinding"
- }
- ],
- "title": "Binding"
+ {
+ "$ref": "#/$defs/CanvasUpdateCommand"
},
- "editors": {
- "default": [],
- "description": "Attached editable documents.",
- "items": {
- "$ref": "#/$defs/EditorRef"
- },
- "title": "Editors",
- "type": "array"
- }
- },
- "required": [
- "id",
- "projectId",
- "revision",
- "kind",
- "title",
- "position",
- "width",
- "height",
- "zIndex",
- "locked",
- "visible",
- "parentId",
- "tags",
- "binding",
- "editors"
- ],
- "title": "AudioCanvasItem",
- "type": "object"
- },
- "AudioExecution": {
- "additionalProperties": false,
- "properties": {
- "kind": {
- "const": "audio",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
+ {
+ "$ref": "#/$defs/CanvasHideCommand"
},
- "voice": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Provider voice identifier or name.",
- "title": "Voice"
+ {
+ "$ref": "#/$defs/CanvasMaterializeCommand"
},
- "speaker": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Provider speaker identifier.",
- "title": "Speaker"
+ {
+ "$ref": "#/$defs/CanvasApplyEditCommand"
},
- "format": {
- "description": "Audio container or codec format.",
- "enum": [
- "mp3",
- "wav"
- ],
- "title": "Format",
- "type": "string"
+ {
+ "$ref": "#/$defs/CanvasPublishMediaCommand"
},
- "sampleRate": {
- "anyOf": [
- {
- "minimum": 1,
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Audio samples per second.",
- "title": "Samplerate"
+ {
+ "$ref": "#/$defs/TimelinePublishRenderCommand"
},
- "creationType": {
- "default": "audio",
- "description": "Speech or music creation mode.",
- "enum": [
- "audio",
- "music"
- ],
- "title": "Creationtype",
- "type": "string"
+ {
+ "$ref": "#/$defs/NodeVersionApplyCommand"
},
- "instrumental": {
- "default": false,
- "description": "Legacy explicit instrumental choice retained for stored records.",
- "title": "Instrumental",
- "type": "boolean"
+ {
+ "$ref": "#/$defs/CanvasConfigureCommand"
},
- "maxDurationSeconds": {
- "anyOf": [
- {
- "maximum": 360,
- "minimum": 8,
- "type": "number"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Maximum generated audio duration in seconds.",
- "title": "Maxdurationseconds"
+ {
+ "$ref": "#/$defs/CanvasEditorAttachCommand"
},
- "scoreMode": {
- "anyOf": [
- {
- "enum": [
- "melody",
- "full"
- ],
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Whether reference music supplies melody or full accompaniment.",
- "title": "Scoremode"
+ {
+ "$ref": "#/$defs/CanvasEditorDetachCommand"
},
- "seed": {
- "anyOf": [
- {
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Random seed fixed when the job was accepted.",
- "title": "Seed"
- }
- },
- "required": [
- "kind",
- "voice",
- "speaker",
- "format",
- "sampleRate"
- ],
- "title": "AudioExecution",
- "type": "object"
- },
- "AudioGenerationSpec": {
- "additionalProperties": false,
- "properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
- "format": "uuid",
- "title": "Id",
- "type": "string"
+ {
+ "$ref": "#/$defs/SpecCreateCommand"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ {
+ "$ref": "#/$defs/SpecUpdateCommand"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
+ {
+ "$ref": "#/$defs/SpecRestoreCommand"
},
- "purpose": {
- "default": "draft",
- "description": "Draft settings or executable generation configuration.",
- "enum": [
- "draft",
- "generation"
- ],
- "title": "Purpose",
- "type": "string"
+ {
+ "$ref": "#/$defs/SpecPromptCommand"
},
- "modelConfigId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Model configuration ID from the model catalog or user model selections.",
- "title": "Modelconfigid"
+ {
+ "$ref": "#/$defs/ReferenceAddCommand"
},
- "prompt": {
- "default": "",
- "description": "Generation prompt text.",
- "maxLength": 20000,
- "title": "Prompt",
- "type": "string"
+ {
+ "$ref": "#/$defs/ReferenceUpdateCommand"
},
- "promptContent": {
- "anyOf": [
- {
- "items": {
- "discriminator": {
- "mapping": {
- "reference": "#/$defs/PromptReference",
- "text": "#/$defs/PromptText"
- },
- "propertyName": "type"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/PromptText"
- },
- {
- "$ref": "#/$defs/PromptReference"
- }
- ]
- },
- "type": "array"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Structured prompt text and reference tokens.",
- "title": "Promptcontent"
+ {
+ "$ref": "#/$defs/ReferenceRestoreCommand"
},
- "currentResultId": {
- "anyOf": [
- {
- "format": "uuid",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Currently adopted result ID.",
- "title": "Currentresultid"
+ {
+ "$ref": "#/$defs/ReferenceRemoveCommand"
},
- "kind": {
- "const": "audio",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
+ {
+ "$ref": "#/$defs/GenerationSubmitCommand"
},
- "parameters": {
- "$ref": "#/$defs/AudioParameters",
- "description": "Typed generation or editing parameters."
- }
- },
- "required": [
- "id",
- "projectId",
- "revision",
- "purpose",
- "modelConfigId",
- "prompt",
- "promptContent",
- "currentResultId",
- "kind",
- "parameters"
- ],
- "title": "AudioGenerationSpec",
- "type": "object"
- },
- "AudioParameters": {
- "additionalProperties": false,
- "properties": {
- "creationType": {
- "default": "audio",
- "description": "Speech or music creation mode.",
- "enum": [
- "audio",
- "music"
- ],
- "title": "Creationtype",
- "type": "string"
+ {
+ "$ref": "#/$defs/JobCancelCommand"
},
- "mode": {
- "default": "tts",
- "description": "Operation mode within this contract variant.",
- "enum": [
- "tts",
- "unified"
- ],
- "title": "Mode",
- "type": "string"
+ {
+ "$ref": "#/$defs/JobRecoverCommand"
},
- "voice": {
- "anyOf": [
- {
- "maxLength": 200,
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Provider voice identifier or name; library voices retain provider naming.",
- "title": "Voice"
+ {
+ "$ref": "#/$defs/JobCheckpointCommand"
},
- "voiceSelection": {
- "anyOf": [
- {
- "$ref": "#/$defs/VoiceSelection"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Connection-scoped voice selection; validated against the live registry before generation."
+ {
+ "$ref": "#/$defs/ResultSelectCommand"
},
- "instrumental": {
- "default": false,
- "description": "Legacy explicit instrumental choice retained for stored records.",
- "title": "Instrumental",
- "type": "boolean"
+ {
+ "$ref": "#/$defs/EditorCreateCommand"
},
- "lyrics": {
- "default": "",
- "description": "Song lyrics; empty lyrics request instrumental music.",
- "maxLength": 5000,
- "title": "Lyrics",
- "type": "string"
+ {
+ "$ref": "#/$defs/EditorSaveCommand"
},
- "durationSeconds": {
- "anyOf": [
- {
- "maximum": 360,
- "minimum": 8,
- "type": "number"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Maximum music duration in seconds.",
- "title": "Durationseconds"
+ {
+ "$ref": "#/$defs/DirectorApplyCommand"
},
- "scoreMode": {
- "default": "melody",
- "description": "Music with one audio reference: follow its transcribed melody, or melody and chords",
- "enum": [
- "melody",
- "full"
- ],
- "title": "Scoremode",
- "type": "string"
+ {
+ "$ref": "#/$defs/DirectorStoryboardAppendCommand"
},
- "durationFromReference": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Music with one audio reference: cap the length at the reference length (unset follows it) instead of durationSeconds",
- "title": "Durationfromreference"
- }
- },
- "required": [
- "creationType",
- "mode",
- "voice"
- ],
- "title": "AudioParameters",
- "type": "object"
- },
- "BatchCommand": {
- "additionalProperties": false,
- "description": "Apply multiple operations atomically; all succeed or none are committed.",
- "properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
+ {
+ "$ref": "#/$defs/DirectorStoryboardReorderCommand"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ {
+ "$ref": "#/$defs/DirectorStoryboardResizeCommand"
},
- "type": {
- "const": "creation.batch",
- "description": "Batch command discriminator.",
- "title": "Type",
- "type": "string"
+ {
+ "$ref": "#/$defs/DirectorStoryboardDeleteCommand"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
+ {
+ "$ref": "#/$defs/DirectorSetDurationCommand"
},
- "expectedPreview": {
- "anyOf": [
- {
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ {
+ "$ref": "#/$defs/DirectorCameraDeleteCommand"
},
- "payload": {
- "$ref": "#/$defs/BatchPayload",
- "description": "Ordered operations committed atomically."
+ {
+ "$ref": "#/$defs/HistoryUndoCommand"
+ },
+ {
+ "$ref": "#/$defs/HistoryRedoCommand"
+ },
+ {
+ "$ref": "#/$defs/BatchCommand"
}
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "expectedVersions",
- "expectedPreview",
- "payload"
],
- "title": "BatchCommand",
- "type": "object"
+ "title": "Command"
},
- "BatchPayload": {
- "additionalProperties": false,
- "properties": {
- "operations": {
- "description": "Ordered operations committed as one atomic transaction.",
- "items": {
- "discriminator": {
- "mapping": {
- "canvas.applyEdit": "#/$defs/CanvasApplyEditCommandOperation",
- "canvas.attachEditor": "#/$defs/CanvasEditorAttachCommandOperation",
- "canvas.configure": "#/$defs/CanvasConfigureCommandOperation",
- "canvas.detachEditor": "#/$defs/CanvasEditorDetachCommandOperation",
- "canvas.hide": "#/$defs/CanvasHideCommandOperation",
- "canvas.materialize": "#/$defs/CanvasMaterializeCommandOperation",
- "canvas.move": "#/$defs/CanvasMoveCommandOperation",
- "canvas.show": "#/$defs/CanvasShowCommandOperation",
- "canvas.update": "#/$defs/CanvasUpdateCommandOperation",
- "editor.create": "#/$defs/EditorCreateCommandOperation",
- "editor.save": "#/$defs/EditorSaveCommandOperation",
- "generationSpec.create": "#/$defs/SpecCreateCommandOperation",
- "generationSpec.setPrompt": "#/$defs/SpecPromptCommandOperation",
- "generationSpec.update": "#/$defs/SpecUpdateCommandOperation",
- "reference.add": "#/$defs/ReferenceAddCommandOperation",
- "reference.remove": "#/$defs/ReferenceRemoveCommandOperation",
- "reference.restore": "#/$defs/ReferenceRestoreCommandOperation",
- "reference.update": "#/$defs/ReferenceUpdateCommandOperation",
- "result.select": "#/$defs/ResultSelectCommandOperation"
- },
- "propertyName": "type"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/CanvasShowCommandOperation"
- },
- {
- "$ref": "#/$defs/CanvasMoveCommandOperation"
- },
- {
- "$ref": "#/$defs/CanvasUpdateCommandOperation"
- },
- {
- "$ref": "#/$defs/CanvasHideCommandOperation"
- },
- {
- "$ref": "#/$defs/CanvasMaterializeCommandOperation"
- },
- {
- "$ref": "#/$defs/CanvasApplyEditCommandOperation"
- },
- {
- "$ref": "#/$defs/CanvasConfigureCommandOperation"
- },
- {
- "$ref": "#/$defs/CanvasEditorAttachCommandOperation"
- },
- {
- "$ref": "#/$defs/CanvasEditorDetachCommandOperation"
- },
- {
- "$ref": "#/$defs/SpecCreateCommandOperation"
- },
- {
- "$ref": "#/$defs/SpecUpdateCommandOperation"
- },
- {
- "$ref": "#/$defs/SpecPromptCommandOperation"
- },
- {
- "$ref": "#/$defs/ReferenceAddCommandOperation"
- },
- {
- "$ref": "#/$defs/ReferenceUpdateCommandOperation"
- },
- {
- "$ref": "#/$defs/ReferenceRestoreCommandOperation"
- },
- {
- "$ref": "#/$defs/ReferenceRemoveCommandOperation"
- },
- {
- "$ref": "#/$defs/ResultSelectCommandOperation"
- },
- {
- "$ref": "#/$defs/EditorCreateCommandOperation"
- },
- {
- "$ref": "#/$defs/EditorSaveCommandOperation"
- }
- ]
- },
- "maxItems": 500,
- "minItems": 1,
- "title": "Operations",
- "type": "array"
- }
- },
- "required": [
- "operations"
- ],
- "title": "BatchPayload",
- "type": "object"
+ "receipt": {
+ "$ref": "#/$defs/CommandReceipt",
+ "description": "Immutable command execution receipt."
},
- "CameraFrame": {
- "additionalProperties": false,
- "properties": {
- "id": {
- "description": "Stable object ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Id",
- "type": "string"
+ "query": {
+ "description": "Read-only project query.",
+ "discriminator": {
+ "mapping": {
+ "asset.preview": "#/$defs/AssetPreviewQuery",
+ "asset.search": "#/$defs/AssetSearchQuery",
+ "asset.usage": "#/$defs/AssetUsageQuery",
+ "canvas.status": "#/$defs/CanvasStatusQuery",
+ "canvas.versions": "#/$defs/VersionsQuery",
+ "director.storyboard.get": "#/$defs/DirectorStoryboardQuery",
+ "generationSpec.versions": "#/$defs/VersionsQuery",
+ "job.get": "#/$defs/ObjectQuery",
+ "object.get": "#/$defs/ObjectQuery",
+ "project.get": "#/$defs/ProjectQuery"
},
- "time": {
- "description": "Keyframe time in seconds.",
- "minimum": 0,
- "title": "Time",
- "type": "number"
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/ProjectQuery"
},
- "value": {
- "$ref": "#/$defs/StageCamera",
- "description": "Keyframed transform or camera pose."
+ {
+ "$ref": "#/$defs/ObjectQuery"
+ },
+ {
+ "$ref": "#/$defs/VersionsQuery"
+ },
+ {
+ "$ref": "#/$defs/AssetSearchQuery"
+ },
+ {
+ "$ref": "#/$defs/AssetUsageQuery"
+ },
+ {
+ "$ref": "#/$defs/CanvasStatusQuery"
+ },
+ {
+ "$ref": "#/$defs/AssetPreviewQuery"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardQuery"
}
- },
- "required": [
- "id",
- "time",
- "value"
],
- "title": "CameraFrame",
- "type": "object"
+ "title": "Query"
},
- "CameraRig": {
- "additionalProperties": false,
- "properties": {
- "id": {
- "description": "Stable object ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Id",
- "type": "string"
+ "event": {
+ "$ref": "#/$defs/ProjectEvent",
+ "description": "Project change event, if emitted."
+ },
+ "job": {
+ "$ref": "#/$defs/Job",
+ "description": "Generation execution record."
+ },
+ "result": {
+ "$ref": "#/$defs/ResultVersion",
+ "description": "Generated result schema."
+ },
+ "snapshot": {
+ "$ref": "#/$defs/InputSnapshot",
+ "description": "Fixed generation input schema."
+ },
+ "executionParameters": {
+ "description": "Effective provider execution parameter schema.",
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioExecution",
+ "image": "#/$defs/ImageExecution",
+ "text": "#/$defs/TextExecution",
+ "video": "#/$defs/VideoExecution"
},
- "name": {
- "description": "User-visible name.",
- "maxLength": 255,
- "title": "Name",
- "type": "string"
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TextExecution"
},
- "pose": {
- "$ref": "#/$defs/StageCamera",
- "description": "Camera position and look-at target."
+ {
+ "$ref": "#/$defs/ImageExecution"
},
- "keyframes": {
- "default": [],
- "description": "Ordered animation keyframes.",
- "items": {
- "$ref": "#/$defs/CameraFrame"
- },
- "title": "Keyframes",
- "type": "array"
+ {
+ "$ref": "#/$defs/VideoExecution"
+ },
+ {
+ "$ref": "#/$defs/AudioExecution"
}
- },
- "required": [
- "id",
- "name",
- "pose",
- "keyframes"
],
- "title": "CameraRig",
- "type": "object"
+ "title": "Executionparameters"
},
- "CanvasApplyEdit": {
- "additionalProperties": false,
- "properties": {
- "itemId": {
- "description": "Canvas item ID.",
- "format": "uuid",
- "title": "Itemid",
- "type": "string"
- },
- "source": {
- "$ref": "#/$defs/AssetRef",
- "description": "Input source or recorded provenance."
+ "promptPart": {
+ "description": "Structured prompt token schema.",
+ "discriminator": {
+ "mapping": {
+ "reference": "#/$defs/PromptReference",
+ "text": "#/$defs/PromptText"
},
- "asset": {
- "$ref": "#/$defs/AssetRef",
- "description": "Immutable asset version."
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/PromptText"
},
- "editorId": {
- "description": "Editable document ID.",
- "format": "uuid",
- "title": "Editorid",
- "type": "string"
+ {
+ "$ref": "#/$defs/PromptReference"
}
- },
- "required": [
- "itemId",
- "source",
- "asset",
- "editorId"
],
- "title": "CanvasApplyEdit",
- "type": "object"
+ "title": "Promptpart"
},
- "CanvasApplyEditCommand": {
+ "publicModel": {
+ "$ref": "#/$defs/ModelConfigPublic",
+ "description": "Public model connection schema."
+ },
+ "writeModel": {
+ "$ref": "#/$defs/ModelConfigWrite",
+ "description": "Model configuration input schema."
+ },
+ "capabilities": {
+ "$ref": "#/$defs/NodeCapabilities",
+ "description": "Available canvas item operations."
+ },
+ "viewState": {
+ "$ref": "#/$defs/ViewState",
+ "description": "Client-specific canvas view state."
+ },
+ "timelinePackageManifest": {
+ "$ref": "#/$defs/TimelinePackageManifest",
+ "description": "Native editable timeline bundle manifest."
+ },
+ "timelinePackageImport": {
+ "$ref": "#/$defs/TimelinePackageImportRequest",
+ "description": "Recoverable native bundle import request."
+ },
+ "timelinePackageReceipt": {
+ "$ref": "#/$defs/TimelinePackageImportReceipt",
+ "description": "Native bundle import progress and final receipt."
+ },
+ "upload": {
+ "$ref": "#/$defs/UploadInfo",
+ "description": "Staged upload schema."
+ }
+ },
+ "required": [
+ "project",
+ "canvasItem",
+ "generationSpec",
+ "reference",
+ "editorDocument",
+ "command",
+ "receipt",
+ "query",
+ "event",
+ "job",
+ "result",
+ "snapshot",
+ "executionParameters",
+ "promptPart",
+ "publicModel",
+ "writeModel",
+ "capabilities",
+ "viewState",
+ "timelinePackageManifest",
+ "timelinePackageImport",
+ "timelinePackageReceipt",
+ "upload"
+ ],
+ "title": "CreationContracts",
+ "type": "object"
+ },
+ "output": {
+ "$defs": {
+ "ArtifactPublish": {
"additionalProperties": false,
- "description": "Apply an editor result to a canvas item.",
+ "description": "Publish a file from a server-owned execution context without generating media.",
+ "examples": [
+ {
+ "name": "片段 01",
+ "path": "clips/segment-01.mp4"
+ }
+ ],
+ "properties": {
+ "path": {
+ "description": "Artifact path relative to the server-owned execution directory.",
+ "maxLength": 4096,
+ "minLength": 1,
+ "title": "Path",
+ "type": "string"
+ },
+ "name": {
+ "description": "User-visible name.",
+ "maxLength": 255,
+ "minLength": 1,
+ "title": "Name",
+ "type": "string"
+ },
+ "expectedKind": {
+ "anyOf": [
+ {
+ "enum": [
+ "text",
+ "image",
+ "video",
+ "audio",
+ "file"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Required media kind, when specified.",
+ "title": "Expectedkind"
+ },
+ "sources": {
+ "default": [],
+ "description": "Ordered source asset versions.",
+ "items": {
+ "$ref": "#/$defs/AssetRef"
+ },
+ "maxItems": 100,
+ "title": "Sources",
+ "type": "array"
+ }
+ },
+ "required": [
+ "path",
+ "name",
+ "expectedKind",
+ "sources"
+ ],
+ "title": "ArtifactPublish",
+ "type": "object"
+ },
+ "ArtifactPublishCommand": {
+ "additionalProperties": false,
+ "description": "Register an execution file as a project asset.",
"properties": {
"commandId": {
"description": "Stable command ID for idempotent replay.",
@@ -16954,7 +17361,7 @@
"type": "string"
},
"type": {
- "const": "canvas.applyEdit",
+ "const": "artifact.publish",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -16983,8 +17390,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/CanvasApplyEdit",
- "description": "Apply an editor result to a canvas item."
+ "$ref": "#/$defs/ArtifactPublish",
+ "description": "Register an execution file as a project asset."
}
},
"required": [
@@ -16995,64 +17402,115 @@
"expectedPreview",
"payload"
],
- "title": "CanvasApplyEditCommand",
+ "title": "ArtifactPublishCommand",
"type": "object"
},
- "CanvasApplyEditCommandOperation": {
+ "Asset": {
"additionalProperties": false,
- "description": "Apply an editor result to a canvas item.",
"properties": {
- "type": {
- "const": "canvas.applyEdit",
- "description": "Operation discriminator.",
- "title": "Type",
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
"type": "string"
},
- "payload": {
- "$ref": "#/$defs/CanvasApplyEdit",
- "description": "Apply an editor result to a canvas item."
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "kind": {
+ "description": "Business object or media type.",
+ "enum": [
+ "text",
+ "image",
+ "video",
+ "audio",
+ "file"
+ ],
+ "title": "Kind",
+ "type": "string"
+ },
+ "name": {
+ "description": "User-visible name.",
+ "maxLength": 255,
+ "minLength": 1,
+ "title": "Name",
+ "type": "string"
+ },
+ "fingerprint": {
+ "description": "Immutable content fingerprint.",
+ "pattern": "^sha256:[0-9a-f]{64}$",
+ "title": "Fingerprint",
+ "type": "string"
+ },
+ "path": {
+ "description": "Immutable asset path relative to the project directory.",
+ "title": "Path",
+ "type": "string"
+ },
+ "metadata": {
+ "$ref": "#/$defs/MediaMetadata",
+ "description": "Verified media properties."
+ },
+ "provenance": {
+ "$ref": "#/$defs/AssetProvenance",
+ "description": "Recorded origin and execution context."
}
},
"required": [
- "type",
- "payload"
+ "id",
+ "projectId",
+ "revision",
+ "kind",
+ "name",
+ "fingerprint",
+ "path",
+ "metadata",
+ "provenance"
],
- "title": "CanvasApplyEditCommandOperation",
+ "title": "Asset",
"type": "object"
},
- "CanvasConfigure": {
+ "AssetDelete": {
"additionalProperties": false,
"properties": {
- "itemId": {
- "description": "Canvas item ID.",
- "format": "uuid",
- "title": "Itemid",
- "type": "string"
- },
- "specId": {
- "description": "Generation configuration ID.",
- "format": "uuid",
- "title": "Specid",
- "type": "string"
+ "assetIds": {
+ "description": "Target asset IDs.",
+ "items": {
+ "format": "uuid",
+ "type": "string"
+ },
+ "maxItems": 100,
+ "minItems": 1,
+ "title": "Assetids",
+ "type": "array"
},
- "preserveMaterial": {
+ "clearHistory": {
"default": false,
- "description": "Whether configuring generation retains current material.",
- "title": "Preservematerial",
+ "description": "Whether the confirmed deletion also clears dependent history.",
+ "title": "Clearhistory",
"type": "boolean"
}
},
"required": [
- "itemId",
- "specId",
- "preserveMaterial"
+ "assetIds",
+ "clearHistory"
],
- "title": "CanvasConfigure",
+ "title": "AssetDelete",
"type": "object"
},
- "CanvasConfigureCommand": {
+ "AssetDeleteCommand": {
"additionalProperties": false,
- "description": "Bind a generation configuration to a canvas item.",
+ "description": "Delete assets after an impact preview.",
"properties": {
"commandId": {
"description": "Stable command ID for idempotent replay.",
@@ -17067,7 +17525,7 @@
"type": "string"
},
"type": {
- "const": "canvas.configure",
+ "const": "asset.delete",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -17096,8 +17554,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/CanvasConfigure",
- "description": "Bind a generation configuration to a canvas item."
+ "$ref": "#/$defs/AssetDelete",
+ "description": "Delete assets after an impact preview."
}
},
"required": [
@@ -17108,152 +17566,49 @@
"expectedPreview",
"payload"
],
- "title": "CanvasConfigureCommand",
+ "title": "AssetDeleteCommand",
"type": "object"
},
- "CanvasConfigureCommandOperation": {
+ "AssetImport": {
"additionalProperties": false,
- "description": "Bind a generation configuration to a canvas item.",
"properties": {
- "type": {
- "const": "canvas.configure",
- "description": "Operation discriminator.",
- "title": "Type",
+ "uploadHandle": {
+ "description": "Server-issued staged upload ID.",
+ "format": "uuid",
+ "title": "Uploadhandle",
"type": "string"
},
- "payload": {
- "$ref": "#/$defs/CanvasConfigure",
- "description": "Bind a generation configuration to a canvas item."
- }
- },
- "required": [
- "type",
- "payload"
- ],
- "title": "CanvasConfigureCommandOperation",
- "type": "object"
- },
- "CanvasCreateGeneration": {
- "additionalProperties": false,
- "properties": {
- "spec": {
- "description": "New configuration with purpose=generation.",
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioGenerationSpec",
- "image": "#/$defs/ImageGenerationSpec",
- "text": "#/$defs/TextGenerationSpec",
- "video": "#/$defs/VideoGenerationSpec"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TextGenerationSpec"
- },
- {
- "$ref": "#/$defs/ImageGenerationSpec"
- },
- {
- "$ref": "#/$defs/VideoGenerationSpec"
- },
- {
- "$ref": "#/$defs/AudioGenerationSpec"
- }
- ],
- "title": "Spec"
+ "name": {
+ "description": "User-visible name.",
+ "maxLength": 255,
+ "minLength": 1,
+ "title": "Name",
+ "type": "string"
},
- "item": {
- "description": "Visible item bound to spec.id with role=generation.",
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioCanvasItem",
- "external": "#/$defs/DirectorCanvasItem",
- "file": "#/$defs/FileCanvasItem",
- "group": "#/$defs/GroupCanvasItem",
- "image": "#/$defs/ImageCanvasItem",
- "stack": "#/$defs/StackCanvasItem",
- "subject": "#/$defs/SubjectCanvasItem",
- "text": "#/$defs/TextCanvasItem",
- "timeline": "#/$defs/TimelineCanvasItem",
- "tool": "#/$defs/ToolCanvasItem",
- "video": "#/$defs/VideoCanvasItem"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TextCanvasItem"
- },
- {
- "$ref": "#/$defs/ImageCanvasItem"
- },
- {
- "$ref": "#/$defs/VideoCanvasItem"
- },
- {
- "$ref": "#/$defs/AudioCanvasItem"
- },
- {
- "$ref": "#/$defs/FileCanvasItem"
- },
- {
- "$ref": "#/$defs/SubjectCanvasItem"
- },
- {
- "$ref": "#/$defs/TimelineCanvasItem"
- },
- {
- "$ref": "#/$defs/StackCanvasItem"
- },
- {
- "$ref": "#/$defs/ToolCanvasItem"
- },
- {
- "$ref": "#/$defs/DirectorCanvasItem"
- },
- {
- "$ref": "#/$defs/GroupCanvasItem"
- }
+ "expectedKind": {
+ "description": "Required media kind, when specified.",
+ "enum": [
+ "text",
+ "image",
+ "video",
+ "audio",
+ "file"
],
- "title": "Item"
- },
- "references": {
- "default": [],
- "description": "Input references. Every canvas-derived reference must retain its source node: source.id for follow_current, sourceVersion for pinned. Never replace a canvas reference with an asset-only binding.",
- "items": {
- "description": "Generation input reference. Preserve source canvas identity for canvas-derived references, whether following or pinned.",
- "discriminator": {
- "mapping": {
- "follow_current": "#/$defs/FollowingReference",
- "pinned": "#/$defs/PinnedReference"
- },
- "propertyName": "binding"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/PinnedReference"
- },
- {
- "$ref": "#/$defs/FollowingReference"
- }
- ]
- },
- "title": "References",
- "type": "array"
+ "title": "Expectedkind",
+ "type": "string"
}
},
"required": [
- "spec",
- "item",
- "references"
+ "uploadHandle",
+ "name",
+ "expectedKind"
],
- "title": "CanvasCreateGeneration",
+ "title": "AssetImport",
"type": "object"
},
- "CanvasCreateGenerationCommand": {
+ "AssetImportCommand": {
"additionalProperties": false,
- "description": "Create a visible generation node and references atomically, preserving canvas source connections, including pinned ones.",
+ "description": "Register an uploaded file as a project asset.",
"properties": {
"commandId": {
"description": "Stable command ID for idempotent replay.",
@@ -17268,7 +17623,7 @@
"type": "string"
},
"type": {
- "const": "canvas.createGeneration",
+ "const": "asset.import",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -17297,8 +17652,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/CanvasCreateGeneration",
- "description": "Create a visible generation node and references atomically, preserving canvas source connections, including pinned ones."
+ "$ref": "#/$defs/AssetImport",
+ "description": "Register an uploaded file as a project asset."
}
},
"required": [
@@ -17309,35 +17664,12 @@
"expectedPreview",
"payload"
],
- "title": "CanvasCreateGenerationCommand",
- "type": "object"
- },
- "CanvasEditorAttach": {
- "additionalProperties": false,
- "properties": {
- "itemId": {
- "description": "Canvas item ID.",
- "format": "uuid",
- "title": "Itemid",
- "type": "string"
- },
- "editorId": {
- "description": "Editable document ID.",
- "format": "uuid",
- "title": "Editorid",
- "type": "string"
- }
- },
- "required": [
- "itemId",
- "editorId"
- ],
- "title": "CanvasEditorAttach",
+ "title": "AssetImportCommand",
"type": "object"
},
- "CanvasEditorAttachCommand": {
+ "AssetMetadataCommand": {
"additionalProperties": false,
- "description": "Attach an editor document to a canvas item.",
+ "description": "Rename an asset.",
"properties": {
"commandId": {
"description": "Stable command ID for idempotent replay.",
@@ -17352,7 +17684,7 @@
"type": "string"
},
"type": {
- "const": "canvas.attachEditor",
+ "const": "asset.updateMetadata",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -17381,8 +17713,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/CanvasEditorAttach",
- "description": "Attach an editor document to a canvas item."
+ "$ref": "#/$defs/AssetMetadataUpdate",
+ "description": "Rename an asset."
}
},
"required": [
@@ -17393,39 +17725,40 @@
"expectedPreview",
"payload"
],
- "title": "CanvasEditorAttachCommand",
+ "title": "AssetMetadataCommand",
"type": "object"
},
- "CanvasEditorAttachCommandOperation": {
+ "AssetMetadataUpdate": {
"additionalProperties": false,
- "description": "Attach an editor document to a canvas item.",
"properties": {
- "type": {
- "const": "canvas.attachEditor",
- "description": "Operation discriminator.",
- "title": "Type",
+ "assetId": {
+ "description": "Asset ID.",
+ "format": "uuid",
+ "title": "Assetid",
"type": "string"
},
- "payload": {
- "$ref": "#/$defs/CanvasEditorAttach",
- "description": "Attach an editor document to a canvas item."
+ "name": {
+ "description": "User-visible name.",
+ "maxLength": 255,
+ "minLength": 1,
+ "title": "Name",
+ "type": "string"
}
},
"required": [
- "type",
- "payload"
+ "assetId",
+ "name"
],
- "title": "CanvasEditorAttachCommandOperation",
+ "title": "AssetMetadataUpdate",
"type": "object"
},
- "CanvasEditorDetachCommand": {
+ "AssetPreviewQuery": {
"additionalProperties": false,
- "description": "Detach an editor document from a canvas item.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
+ "queryId": {
+ "description": "Caller-supplied query ID.",
"format": "uuid",
- "title": "Commandid",
+ "title": "Queryid",
"type": "string"
},
"projectId": {
@@ -17435,123 +17768,48 @@
"type": "string"
},
"type": {
- "const": "canvas.detachEditor",
- "description": "Command discriminator.",
+ "const": "asset.preview",
+ "description": "Preview an asset; does not establish model observation.",
"title": "Type",
"type": "string"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
- },
- "expectedPreview": {
- "anyOf": [
- {
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
- },
- "payload": {
- "$ref": "#/$defs/CanvasEditorAttach",
- "description": "Detach an editor document from a canvas item."
- }
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "expectedVersions",
- "expectedPreview",
- "payload"
- ],
- "title": "CanvasEditorDetachCommand",
- "type": "object"
- },
- "CanvasEditorDetachCommandOperation": {
- "additionalProperties": false,
- "description": "Detach an editor document from a canvas item.",
- "properties": {
- "type": {
- "const": "canvas.detachEditor",
- "description": "Operation discriminator.",
- "title": "Type",
- "type": "string"
- },
- "payload": {
- "$ref": "#/$defs/CanvasEditorAttach",
- "description": "Detach an editor document from a canvas item."
- }
- },
- "required": [
- "type",
- "payload"
- ],
- "title": "CanvasEditorDetachCommandOperation",
- "type": "object"
- },
- "CanvasHide": {
- "additionalProperties": false,
- "properties": {
- "itemId": {
- "description": "Canvas item ID.",
+ "objectId": {
+ "description": "Asset ID.",
"format": "uuid",
- "title": "Itemid",
+ "title": "Objectid",
"type": "string"
}
},
"required": [
- "itemId"
+ "queryId",
+ "projectId",
+ "type",
+ "objectId"
],
- "title": "CanvasHide",
+ "title": "AssetPreviewQuery",
"type": "object"
},
- "CanvasHideCommand": {
+ "AssetProvenance": {
"additionalProperties": false,
- "description": "Remove a canvas item; preserves project contents. Remove all visible items to clear the canvas.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
- },
- "type": {
- "const": "canvas.hide",
- "description": "Command discriminator.",
- "title": "Type",
+ "source": {
+ "description": "Input source or recorded provenance.",
+ "enum": [
+ "upload",
+ "manual",
+ "agent_written",
+ "generated",
+ "edited",
+ "rendered",
+ "imported"
+ ],
+ "title": "Source",
"type": "string"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
- },
- "expectedPreview": {
+ "jobId": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
+ "format": "uuid",
"type": "string"
},
{
@@ -17559,131 +17817,24 @@
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
- },
- "payload": {
- "$ref": "#/$defs/CanvasHide",
- "description": "Remove a canvas item; preserves project contents. Remove all visible items to clear the canvas."
- }
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "expectedVersions",
- "expectedPreview",
- "payload"
- ],
- "title": "CanvasHideCommand",
- "type": "object"
- },
- "CanvasHideCommandOperation": {
- "additionalProperties": false,
- "description": "Remove a canvas item; preserves project contents. Remove all visible items to clear the canvas.",
- "properties": {
- "type": {
- "const": "canvas.hide",
- "description": "Operation discriminator.",
- "title": "Type",
- "type": "string"
- },
- "payload": {
- "$ref": "#/$defs/CanvasHide",
- "description": "Remove a canvas item; preserves project contents. Remove all visible items to clear the canvas."
- }
- },
- "required": [
- "type",
- "payload"
- ],
- "title": "CanvasHideCommandOperation",
- "type": "object"
- },
- "CanvasItemBase": {
- "additionalProperties": false,
- "properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
- "format": "uuid",
- "title": "Id",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
- },
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
+ "description": "Generation job ID.",
+ "title": "Jobid"
},
- "kind": {
- "description": "Business object or media type.",
- "enum": [
- "text",
- "image",
- "video",
- "audio",
- "file",
- "group",
- "timeline",
- "subject",
- "stack",
- "tool",
- "external"
+ "toolTaskId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
],
- "title": "Kind",
- "type": "string"
- },
- "title": {
- "default": "",
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
- "type": "string"
- },
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
- },
- "width": {
- "default": 352,
- "description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "title": "Width",
- "type": "number"
- },
- "height": {
- "default": 198,
- "description": "Height in pixels.",
- "exclusiveMinimum": 0,
- "title": "Height",
- "type": "number"
- },
- "zIndex": {
- "default": 0,
- "description": "Canvas stacking order.",
- "title": "Zindex",
- "type": "integer"
- },
- "locked": {
- "default": false,
- "description": "Whether edits to this object are blocked.",
- "title": "Locked",
- "type": "boolean"
- },
- "visible": {
- "default": true,
- "description": "Whether this object is displayed.",
- "title": "Visible",
- "type": "boolean"
+ "default": null,
+ "description": "Tool execution ID.",
+ "title": "Tooltaskid"
},
- "parentId": {
+ "sourceItemId": {
"anyOf": [
{
"format": "uuid",
@@ -17694,106 +17845,218 @@
}
],
"default": null,
- "description": "Parent canvas group ID, or null for the root.",
- "title": "Parentid"
+ "description": "Source canvas item ID.",
+ "title": "Sourceitemid"
},
- "tags": {
- "default": [],
- "description": "User-defined search tags.",
- "items": {
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "type": "string"
+ "editorDocumentId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Editable document ID.",
+ "title": "Editordocumentid"
+ },
+ "editorRevision": {
+ "anyOf": [
+ {
+ "minimum": 1,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Expected editable document revision.",
+ "title": "Editorrevision"
+ },
+ "directorRender": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/DirectorRenderEvidence"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Frozen Director video output evidence and source version."
+ },
+ "sources": {
+ "default": [],
+ "description": "Ordered source asset versions.",
+ "items": {
+ "$ref": "#/$defs/AssetRef"
},
- "title": "Tags",
+ "title": "Sources",
"type": "array"
+ },
+ "inputFingerprint": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the fixed execution input.",
+ "title": "Inputfingerprint"
+ },
+ "agentRunId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Agent turn ID.",
+ "title": "Agentrunid"
+ },
+ "agentRuntime": {
+ "anyOf": [
+ {
+ "enum": [
+ "opencode",
+ "codex",
+ "claude",
+ "jiuwenswarm",
+ "deepseek"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Native Agent runtime that produced this asset.",
+ "title": "Agentruntime"
+ },
+ "modelSnapshot": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/ModelSnapshot"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fixed model connection recorded for provenance."
+ },
+ "prompt": {
+ "anyOf": [
+ {
+ "maxLength": 20000,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Generation prompt text.",
+ "title": "Prompt"
+ },
+ "importedFrom": {
+ "anyOf": [
+ {
+ "enum": [
+ "generated",
+ "edited"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Original source recorded by a canvas archive this asset was imported from.",
+ "title": "Importedfrom"
}
},
"required": [
- "id",
- "projectId",
- "revision",
- "kind",
- "title",
- "position",
- "width",
- "height",
- "zIndex",
- "locked",
- "visible",
- "parentId",
- "tags"
+ "source",
+ "jobId",
+ "toolTaskId",
+ "sourceItemId",
+ "editorDocumentId",
+ "editorRevision",
+ "sources",
+ "inputFingerprint",
+ "agentRunId",
+ "agentRuntime",
+ "modelSnapshot",
+ "prompt",
+ "importedFrom"
],
- "title": "CanvasItemBase",
+ "title": "AssetProvenance",
"type": "object"
},
- "CanvasItemVersion": {
+ "AssetRef": {
"additionalProperties": false,
"properties": {
- "objectType": {
- "const": "canvas_item",
- "description": "Source canvas item type.",
- "title": "Objecttype",
- "type": "string"
- },
- "id": {
- "description": "Stable object ID.",
+ "assetId": {
+ "description": "ID of a registered project asset from project.assets[].id or a successful asset command result.",
"format": "uuid",
- "title": "Id",
+ "title": "Assetid",
"type": "string"
},
"revision": {
- "description": "Current object revision for optimistic concurrency.",
+ "description": "Referenced immutable asset revision.",
"minimum": 1,
"title": "Revision",
"type": "integer"
- }
- },
- "required": [
- "objectType",
- "id",
- "revision"
- ],
- "title": "CanvasItemVersion",
- "type": "object"
- },
- "CanvasMaterialize": {
- "additionalProperties": false,
- "properties": {
- "itemId": {
- "description": "Canvas item ID.",
- "format": "uuid",
- "title": "Itemid",
- "type": "string"
},
- "asset": {
- "$ref": "#/$defs/AssetRef",
- "description": "Immutable asset version."
+ "fingerprint": {
+ "description": "Immutable content fingerprint.",
+ "pattern": "^sha256:[0-9a-f]{64}$",
+ "title": "Fingerprint",
+ "type": "string"
},
- "discardGenerationDraft": {
- "default": false,
- "description": "Whether material replacement discards the generation draft.",
- "title": "Discardgenerationdraft",
- "type": "boolean"
+ "kind": {
+ "description": "Business object or media type.",
+ "enum": [
+ "text",
+ "image",
+ "video",
+ "audio",
+ "file"
+ ],
+ "title": "Kind",
+ "type": "string"
}
},
"required": [
- "itemId",
- "asset",
- "discardGenerationDraft"
+ "assetId",
+ "revision",
+ "fingerprint",
+ "kind"
],
- "title": "CanvasMaterialize",
+ "title": "AssetRef",
"type": "object"
},
- "CanvasMaterializeCommand": {
+ "AssetSearchQuery": {
"additionalProperties": false,
- "description": "Bind an asset to an empty or material canvas item.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
+ "queryId": {
+ "description": "Caller-supplied query ID.",
"format": "uuid",
- "title": "Commandid",
+ "title": "Queryid",
"type": "string"
},
"projectId": {
@@ -17803,95 +18066,147 @@
"type": "string"
},
"type": {
- "const": "canvas.materialize",
- "description": "Command discriminator.",
+ "const": "asset.search",
+ "description": "Search project assets.",
"title": "Type",
"type": "string"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
- },
- "expectedPreview": {
- "anyOf": [
- {
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "text": {
+ "default": "",
+ "description": "Asset search text.",
+ "maxLength": 1000,
+ "title": "Text",
+ "type": "string"
},
- "payload": {
- "$ref": "#/$defs/CanvasMaterialize",
- "description": "Bind an asset to an empty or material canvas item."
+ "offset": {
+ "default": 0,
+ "description": "Number of matching records to skip.",
+ "minimum": 0,
+ "title": "Offset",
+ "type": "integer"
+ },
+ "limit": {
+ "default": 50,
+ "description": "Maximum number of records to return.",
+ "maximum": 200,
+ "minimum": 1,
+ "title": "Limit",
+ "type": "integer"
}
},
"required": [
- "commandId",
+ "queryId",
"projectId",
"type",
- "expectedVersions",
- "expectedPreview",
- "payload"
+ "text",
+ "offset",
+ "limit"
],
- "title": "CanvasMaterializeCommand",
+ "title": "AssetSearchQuery",
"type": "object"
},
- "CanvasMaterializeCommandOperation": {
+ "AssetUsageQuery": {
"additionalProperties": false,
- "description": "Bind an asset to an empty or material canvas item.",
"properties": {
+ "queryId": {
+ "description": "Caller-supplied query ID.",
+ "format": "uuid",
+ "title": "Queryid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
"type": {
- "const": "canvas.materialize",
- "description": "Operation discriminator.",
+ "const": "asset.usage",
+ "description": "Read asset dependencies.",
"title": "Type",
"type": "string"
},
- "payload": {
- "$ref": "#/$defs/CanvasMaterialize",
- "description": "Bind an asset to an empty or material canvas item."
+ "objectId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Asset ID, or all assets when omitted.",
+ "title": "Objectid"
+ },
+ "offset": {
+ "default": 0,
+ "description": "Number of matching records to skip.",
+ "minimum": 0,
+ "title": "Offset",
+ "type": "integer"
+ },
+ "limit": {
+ "default": 50,
+ "description": "Maximum number of records to return.",
+ "maximum": 200,
+ "minimum": 1,
+ "title": "Limit",
+ "type": "integer"
}
},
"required": [
+ "queryId",
+ "projectId",
"type",
- "payload"
+ "objectId",
+ "offset",
+ "limit"
],
- "title": "CanvasMaterializeCommandOperation",
+ "title": "AssetUsageQuery",
"type": "object"
},
- "CanvasMove": {
+ "AssetWriteText": {
"additionalProperties": false,
"properties": {
- "items": {
- "description": "Ordered entries in this collection.",
- "items": {
- "$ref": "#/$defs/CanvasMoveItem"
- },
- "maxItems": 500,
- "minItems": 1,
- "title": "Items",
- "type": "array"
+ "name": {
+ "description": "User-visible name.",
+ "maxLength": 255,
+ "minLength": 1,
+ "title": "Name",
+ "type": "string"
+ },
+ "text": {
+ "description": "UTF-8 text content or search query.",
+ "maxLength": 1048576,
+ "title": "Text",
+ "type": "string"
+ },
+ "previousAsset": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AssetRef"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Previous immutable version for a new text asset version."
}
},
"required": [
- "items"
+ "name",
+ "text",
+ "previousAsset"
],
- "title": "CanvasMove",
+ "title": "AssetWriteText",
"type": "object"
},
- "CanvasMoveCommand": {
+ "AssetWriteTextCommand": {
"additionalProperties": false,
- "description": "Move one or more canvas items.",
+ "description": "Write a text asset or a new version of an existing text asset.",
"properties": {
"commandId": {
"description": "Stable command ID for idempotent replay.",
@@ -17906,7 +18221,7 @@
"type": "string"
},
"type": {
- "const": "canvas.move",
+ "const": "asset.writeText",
"description": "Command discriminator.",
"title": "Type",
"type": "string"
@@ -17935,8 +18250,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/CanvasMove",
- "description": "Move one or more canvas items."
+ "$ref": "#/$defs/AssetWriteText",
+ "description": "Write a text asset or a new version of an existing text asset."
}
},
"required": [
@@ -17947,128 +18262,79 @@
"expectedPreview",
"payload"
],
- "title": "CanvasMoveCommand",
+ "title": "AssetWriteTextCommand",
"type": "object"
},
- "CanvasMoveCommandOperation": {
+ "AudioCanvasItem": {
"additionalProperties": false,
- "description": "Move one or more canvas items.",
"properties": {
- "type": {
- "const": "canvas.move",
- "description": "Operation discriminator.",
- "title": "Type",
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
"type": "string"
},
- "payload": {
- "$ref": "#/$defs/CanvasMove",
- "description": "Move one or more canvas items."
- }
- },
- "required": [
- "type",
- "payload"
- ],
- "title": "CanvasMoveCommandOperation",
- "type": "object"
- },
- "CanvasMoveItem": {
- "additionalProperties": false,
- "properties": {
- "itemId": {
- "description": "Canvas item ID.",
+ "projectId": {
+ "description": "Owning project ID.",
"format": "uuid",
- "title": "Itemid",
+ "title": "Projectid",
"type": "string"
},
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
- }
- },
- "required": [
- "itemId",
- "position"
- ],
- "title": "CanvasMoveItem",
- "type": "object"
- },
- "CanvasPresentationUpdate": {
- "additionalProperties": false,
- "properties": {
- "itemId": {
- "description": "Canvas item ID.",
- "format": "uuid",
- "title": "Itemid",
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "kind": {
+ "const": "audio",
+ "description": "Business object or media type.",
+ "title": "Kind",
"type": "string"
},
"title": {
- "anyOf": [
- {
- "maxLength": 255,
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
+ "default": "",
"description": "User-visible title.",
- "title": "Title"
+ "maxLength": 255,
+ "title": "Title",
+ "type": "string"
+ },
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
},
"width": {
- "anyOf": [
- {
- "exclusiveMinimum": 0,
- "type": "number"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
+ "default": 352,
"description": "Width in pixels.",
- "title": "Width"
+ "exclusiveMinimum": 0,
+ "title": "Width",
+ "type": "number"
},
"height": {
- "anyOf": [
- {
- "exclusiveMinimum": 0,
- "type": "number"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
+ "default": 198,
"description": "Height in pixels.",
- "title": "Height"
+ "exclusiveMinimum": 0,
+ "title": "Height",
+ "type": "number"
},
"zIndex": {
- "anyOf": [
- {
- "type": "integer"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
+ "default": 0,
"description": "Canvas stacking order.",
- "title": "Zindex"
+ "title": "Zindex",
+ "type": "integer"
},
"locked": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
+ "default": false,
"description": "Whether edits to this object are blocked.",
- "title": "Locked"
+ "title": "Locked",
+ "type": "boolean"
+ },
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
},
"parentId": {
"anyOf": [
@@ -18083,45 +18349,97 @@
"default": null,
"description": "Parent canvas group ID, or null for the root.",
"title": "Parentid"
+ },
+ "tags": {
+ "default": [],
+ "description": "User-defined search tags.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Tags",
+ "type": "array"
+ },
+ "binding": {
+ "description": "Business object displayed by this canvas item.",
+ "discriminator": {
+ "mapping": {
+ "empty": "#/$defs/EmptyBinding",
+ "generation": "#/$defs/GenerationBinding",
+ "material": "#/$defs/MaterialBinding"
+ },
+ "propertyName": "role"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/EmptyBinding"
+ },
+ {
+ "$ref": "#/$defs/MaterialBinding"
+ },
+ {
+ "$ref": "#/$defs/GenerationBinding"
+ }
+ ],
+ "title": "Binding"
+ },
+ "editors": {
+ "default": [],
+ "description": "Attached editable documents.",
+ "items": {
+ "$ref": "#/$defs/EditorRef"
+ },
+ "title": "Editors",
+ "type": "array"
}
},
"required": [
- "itemId",
+ "id",
+ "projectId",
+ "revision",
+ "kind",
"title",
+ "position",
"width",
"height",
"zIndex",
"locked",
- "parentId"
+ "visible",
+ "parentId",
+ "tags",
+ "binding",
+ "editors"
],
- "title": "CanvasPresentationUpdate",
+ "title": "AudioCanvasItem",
"type": "object"
},
- "CanvasPublishMedia": {
+ "AudioExecution": {
"additionalProperties": false,
"properties": {
- "itemId": {
- "description": "Canvas item ID.",
- "format": "uuid",
- "title": "Itemid",
+ "kind": {
+ "const": "audio",
+ "description": "Business object or media type.",
+ "title": "Kind",
"type": "string"
},
- "source": {
+ "voice": {
"anyOf": [
{
- "$ref": "#/$defs/AssetRef"
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "description": "Input source or recorded provenance."
+ "description": "Provider voice identifier or name.",
+ "title": "Voice"
},
- "sourceEditorId": {
+ "speaker": {
"anyOf": [
{
- "format": "uuid",
"type": "string"
},
{
@@ -18129,81 +18447,111 @@
}
],
"default": null,
- "description": "Source editable document ID.",
- "title": "Sourceeditorid"
+ "description": "Provider speaker identifier.",
+ "title": "Speaker"
},
- "document": {
- "description": "Editable document owned by this operation.",
- "discriminator": {
- "mapping": {
- "director": "#/$defs/DirectorDocument",
- "image_crop": "#/$defs/ImageCropDocument",
- "layers": "#/$defs/LayerDocument",
- "media_edit": "#/$defs/MediaEditDocument",
- "stack": "#/$defs/StackDocument",
- "subject": "#/$defs/SubjectDocument",
- "timeline": "#/$defs/TimelineDocument",
- "tool": "#/$defs/ToolDocument"
- },
- "propertyName": "kind"
- },
- "oneOf": [
+ "format": {
+ "description": "Audio container or codec format.",
+ "enum": [
+ "mp3",
+ "wav"
+ ],
+ "title": "Format",
+ "type": "string"
+ },
+ "sampleRate": {
+ "anyOf": [
{
- "$ref": "#/$defs/TimelineDocument"
+ "minimum": 1,
+ "type": "integer"
},
{
- "$ref": "#/$defs/SubjectDocument"
- },
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Audio samples per second.",
+ "title": "Samplerate"
+ },
+ "creationType": {
+ "default": "audio",
+ "description": "Speech or music creation mode.",
+ "enum": [
+ "audio",
+ "music"
+ ],
+ "title": "Creationtype",
+ "type": "string"
+ },
+ "instrumental": {
+ "default": false,
+ "description": "Legacy explicit instrumental choice retained for stored records.",
+ "title": "Instrumental",
+ "type": "boolean"
+ },
+ "maxDurationSeconds": {
+ "anyOf": [
{
- "$ref": "#/$defs/LayerDocument"
+ "maximum": 360,
+ "minimum": 8,
+ "type": "number"
},
{
- "$ref": "#/$defs/ImageCropDocument"
- },
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Maximum generated audio duration in seconds.",
+ "title": "Maxdurationseconds"
+ },
+ "scoreMode": {
+ "anyOf": [
{
- "$ref": "#/$defs/StackDocument"
+ "enum": [
+ "melody",
+ "full"
+ ],
+ "type": "string"
},
{
- "$ref": "#/$defs/ToolDocument"
- },
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether reference music supplies melody or full accompaniment.",
+ "title": "Scoremode"
+ },
+ "seed": {
+ "anyOf": [
{
- "$ref": "#/$defs/DirectorDocument"
+ "type": "integer"
},
{
- "$ref": "#/$defs/MediaEditDocument"
+ "type": "null"
}
],
- "title": "Document"
- },
- "outputs": {
- "description": "Ordered published media outputs.",
- "items": {
- "$ref": "#/$defs/MediaPublicationOutput"
- },
- "maxItems": 50,
- "minItems": 1,
- "title": "Outputs",
- "type": "array"
+ "default": null,
+ "description": "Random seed fixed when the job was accepted.",
+ "title": "Seed"
}
},
"required": [
- "itemId",
- "source",
- "sourceEditorId",
- "document",
- "outputs"
+ "kind",
+ "voice",
+ "speaker",
+ "format",
+ "sampleRate"
],
- "title": "CanvasPublishMedia",
+ "title": "AudioExecution",
"type": "object"
},
- "CanvasPublishMediaCommand": {
+ "AudioGenerationSpec": {
"additionalProperties": false,
- "description": "Publish edited media outputs with their editor snapshot.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
+ "id": {
+ "description": "Stable identity of this project-owned object.",
"format": "uuid",
- "title": "Commandid",
+ "title": "Id",
"type": "string"
},
"projectId": {
@@ -18212,25 +18560,27 @@
"title": "Projectid",
"type": "string"
},
- "type": {
- "const": "canvas.publishMedia",
- "description": "Command discriminator.",
- "title": "Type",
- "type": "string"
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
+ "purpose": {
+ "default": "draft",
+ "description": "Draft settings or executable generation configuration.",
+ "enum": [
+ "draft",
+ "generation"
+ ],
+ "title": "Purpose",
+ "type": "string"
},
- "expectedPreview": {
+ "modelConfigId": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
+ "format": "uuid",
"type": "string"
},
{
@@ -18238,144 +18588,113 @@
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "description": "Model configuration ID from the model catalog or user model selections.",
+ "title": "Modelconfigid"
},
- "payload": {
- "$ref": "#/$defs/CanvasPublishMedia",
- "description": "Publish edited media outputs with their editor snapshot."
- }
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "expectedVersions",
- "expectedPreview",
- "payload"
- ],
- "title": "CanvasPublishMediaCommand",
- "type": "object"
- },
- "CanvasReferenceSources": {
- "additionalProperties": false,
- "properties": {
- "followCurrent": {
- "$ref": "#/$defs/FollowingReferenceSource",
- "description": "Source fields for a follow_current reference."
+ "prompt": {
+ "default": "",
+ "description": "Generation prompt text.",
+ "maxLength": 20000,
+ "title": "Prompt",
+ "type": "string"
},
- "pinned": {
- "$ref": "#/$defs/PinnedReferenceSource",
- "description": "Source fields for a pinned reference retaining its canvas connection."
- }
- },
- "required": [
- "followCurrent",
- "pinned"
- ],
- "title": "CanvasReferenceSources",
- "type": "object"
- },
- "CanvasShow": {
- "additionalProperties": false,
- "properties": {
- "item": {
- "description": "Canvas display item to create or restore.",
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioCanvasItem",
- "external": "#/$defs/DirectorCanvasItem",
- "file": "#/$defs/FileCanvasItem",
- "group": "#/$defs/GroupCanvasItem",
- "image": "#/$defs/ImageCanvasItem",
- "stack": "#/$defs/StackCanvasItem",
- "subject": "#/$defs/SubjectCanvasItem",
- "text": "#/$defs/TextCanvasItem",
- "timeline": "#/$defs/TimelineCanvasItem",
- "tool": "#/$defs/ToolCanvasItem",
- "video": "#/$defs/VideoCanvasItem"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TextCanvasItem"
- },
- {
- "$ref": "#/$defs/ImageCanvasItem"
- },
- {
- "$ref": "#/$defs/VideoCanvasItem"
- },
- {
- "$ref": "#/$defs/AudioCanvasItem"
- },
- {
- "$ref": "#/$defs/FileCanvasItem"
- },
- {
- "$ref": "#/$defs/SubjectCanvasItem"
- },
- {
- "$ref": "#/$defs/TimelineCanvasItem"
- },
+ "promptContent": {
+ "anyOf": [
{
- "$ref": "#/$defs/StackCanvasItem"
+ "items": {
+ "discriminator": {
+ "mapping": {
+ "reference": "#/$defs/PromptReference",
+ "text": "#/$defs/PromptText"
+ },
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/PromptText"
+ },
+ {
+ "$ref": "#/$defs/PromptReference"
+ }
+ ]
+ },
+ "type": "array"
},
{
- "$ref": "#/$defs/ToolCanvasItem"
- },
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Structured prompt text and reference tokens.",
+ "title": "Promptcontent"
+ },
+ "currentResultId": {
+ "anyOf": [
{
- "$ref": "#/$defs/DirectorCanvasItem"
+ "format": "uuid",
+ "type": "string"
},
{
- "$ref": "#/$defs/GroupCanvasItem"
+ "type": "null"
}
],
- "title": "Item"
+ "default": null,
+ "description": "Currently adopted result ID.",
+ "title": "Currentresultid"
+ },
+ "kind": {
+ "const": "audio",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "parameters": {
+ "$ref": "#/$defs/AudioParameters",
+ "description": "Typed generation or editing parameters."
}
},
"required": [
- "item"
+ "id",
+ "projectId",
+ "revision",
+ "purpose",
+ "modelConfigId",
+ "prompt",
+ "promptContent",
+ "currentResultId",
+ "kind",
+ "parameters"
],
- "title": "CanvasShow",
+ "title": "AudioGenerationSpec",
"type": "object"
},
- "CanvasShowCommand": {
+ "AudioParameters": {
"additionalProperties": false,
- "description": "Create or restore a canvas display item.",
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ "creationType": {
+ "default": "audio",
+ "description": "Speech or music creation mode.",
+ "enum": [
+ "audio",
+ "music"
+ ],
+ "title": "Creationtype",
"type": "string"
},
- "type": {
- "const": "canvas.show",
- "description": "Command discriminator.",
- "title": "Type",
+ "mode": {
+ "default": "tts",
+ "description": "Operation mode within this contract variant.",
+ "enum": [
+ "tts",
+ "unified"
+ ],
+ "title": "Mode",
"type": "string"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
- },
- "expectedPreview": {
+ "voice": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
+ "maxLength": 200,
"type": "string"
},
{
@@ -18383,96 +18702,84 @@
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
- },
- "payload": {
- "$ref": "#/$defs/CanvasShow",
- "description": "Create or restore a canvas display item."
- }
- },
- "required": [
- "commandId",
- "projectId",
- "type",
- "expectedVersions",
- "expectedPreview",
- "payload"
- ],
- "title": "CanvasShowCommand",
- "type": "object"
- },
- "CanvasShowCommandOperation": {
- "additionalProperties": false,
- "description": "Create or restore a canvas display item.",
- "properties": {
- "type": {
- "const": "canvas.show",
- "description": "Operation discriminator.",
- "title": "Type",
- "type": "string"
+ "description": "Provider voice identifier or name; library voices retain provider naming.",
+ "title": "Voice"
},
- "payload": {
- "$ref": "#/$defs/CanvasShow",
- "description": "Create or restore a canvas display item."
- }
- },
- "required": [
- "type",
- "payload"
- ],
- "title": "CanvasShowCommandOperation",
- "type": "object"
- },
- "CanvasStatusQuery": {
- "additionalProperties": false,
- "properties": {
- "queryId": {
- "description": "Caller-supplied query ID.",
- "format": "uuid",
- "title": "Queryid",
- "type": "string"
+ "voiceSelection": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/VoiceSelection"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Connection-scoped voice selection; validated against the live registry before generation."
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "instrumental": {
+ "default": false,
+ "description": "Legacy explicit instrumental choice retained for stored records.",
+ "title": "Instrumental",
+ "type": "boolean"
},
- "type": {
- "const": "canvas.status",
- "description": "Read node status, current asset and reusable referenceSources.",
- "title": "Type",
+ "lyrics": {
+ "default": "",
+ "description": "Song lyrics; empty lyrics request instrumental music.",
+ "maxLength": 5000,
+ "title": "Lyrics",
"type": "string"
},
- "objectId": {
- "description": "Canvas item ID.",
- "format": "uuid",
- "title": "Objectid",
+ "durationSeconds": {
+ "anyOf": [
+ {
+ "maximum": 360,
+ "minimum": 8,
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Maximum music duration in seconds.",
+ "title": "Durationseconds"
+ },
+ "scoreMode": {
+ "default": "melody",
+ "description": "Music with one audio reference: follow its transcribed melody, or melody and chords",
+ "enum": [
+ "melody",
+ "full"
+ ],
+ "title": "Scoremode",
"type": "string"
},
- "waitSeconds": {
- "default": 0,
- "description": "Wait for generation changes; zero returns immediately.",
- "maximum": 30,
- "minimum": 0,
- "title": "Waitseconds",
- "type": "number"
+ "durationFromReference": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Music with one audio reference: cap the length at the reference length (unset follows it) instead of durationSeconds",
+ "title": "Durationfromreference"
}
},
"required": [
- "queryId",
- "projectId",
- "type",
- "objectId",
- "waitSeconds"
+ "creationType",
+ "mode",
+ "voice"
],
- "title": "CanvasStatusQuery",
+ "title": "AudioParameters",
"type": "object"
},
- "CanvasUpdateCommand": {
+ "BatchCommand": {
"additionalProperties": false,
- "description": "Update canvas presentation, grouping or lock state.",
+ "description": "Apply multiple operations atomically; all succeed or none are committed.",
"properties": {
"commandId": {
"description": "Stable command ID for idempotent replay.",
@@ -18487,8 +18794,8 @@
"type": "string"
},
"type": {
- "const": "canvas.update",
- "description": "Command discriminator.",
+ "const": "creation.batch",
+ "description": "Batch command discriminator.",
"title": "Type",
"type": "string"
},
@@ -18516,8 +18823,8 @@
"title": "Expectedpreview"
},
"payload": {
- "$ref": "#/$defs/CanvasPresentationUpdate",
- "description": "Update canvas presentation, grouping or lock state."
+ "$ref": "#/$defs/BatchPayload",
+ "description": "Ordered operations committed atomically."
}
},
"required": [
@@ -18528,324 +18835,430 @@
"expectedPreview",
"payload"
],
- "title": "CanvasUpdateCommand",
+ "title": "BatchCommand",
"type": "object"
},
- "CanvasUpdateCommandOperation": {
+ "BatchPayload": {
"additionalProperties": false,
- "description": "Update canvas presentation, grouping or lock state.",
"properties": {
- "type": {
- "const": "canvas.update",
- "description": "Operation discriminator.",
- "title": "Type",
- "type": "string"
- },
- "payload": {
- "$ref": "#/$defs/CanvasPresentationUpdate",
- "description": "Update canvas presentation, grouping or lock state."
+ "operations": {
+ "description": "Ordered operations committed as one atomic transaction.",
+ "items": {
+ "discriminator": {
+ "mapping": {
+ "canvas.applyEdit": "#/$defs/CanvasApplyEditCommandOperation",
+ "canvas.attachEditor": "#/$defs/CanvasEditorAttachCommandOperation",
+ "canvas.configure": "#/$defs/CanvasConfigureCommandOperation",
+ "canvas.detachEditor": "#/$defs/CanvasEditorDetachCommandOperation",
+ "canvas.hide": "#/$defs/CanvasHideCommandOperation",
+ "canvas.materialize": "#/$defs/CanvasMaterializeCommandOperation",
+ "canvas.move": "#/$defs/CanvasMoveCommandOperation",
+ "canvas.show": "#/$defs/CanvasShowCommandOperation",
+ "canvas.update": "#/$defs/CanvasUpdateCommandOperation",
+ "director.apply": "#/$defs/DirectorApplyCommandOperation",
+ "director.camera.delete": "#/$defs/DirectorCameraDeleteCommandOperation",
+ "director.duration.set": "#/$defs/DirectorSetDurationCommandOperation",
+ "director.storyboard.delete": "#/$defs/DirectorStoryboardDeleteCommandOperation",
+ "director.storyboard.reorder": "#/$defs/DirectorStoryboardReorderCommandOperation",
+ "director.storyboard.resize": "#/$defs/DirectorStoryboardResizeCommandOperation",
+ "editor.create": "#/$defs/EditorCreateCommandOperation",
+ "editor.save": "#/$defs/EditorSaveCommandOperation",
+ "generationSpec.create": "#/$defs/SpecCreateCommandOperation",
+ "generationSpec.setPrompt": "#/$defs/SpecPromptCommandOperation",
+ "generationSpec.update": "#/$defs/SpecUpdateCommandOperation",
+ "reference.add": "#/$defs/ReferenceAddCommandOperation",
+ "reference.remove": "#/$defs/ReferenceRemoveCommandOperation",
+ "reference.restore": "#/$defs/ReferenceRestoreCommandOperation",
+ "reference.update": "#/$defs/ReferenceUpdateCommandOperation",
+ "result.select": "#/$defs/ResultSelectCommandOperation"
+ },
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/CanvasShowCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/CanvasMoveCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/CanvasUpdateCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/CanvasHideCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/CanvasMaterializeCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/CanvasApplyEditCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/CanvasConfigureCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/CanvasEditorAttachCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/CanvasEditorDetachCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/SpecCreateCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/SpecUpdateCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/SpecPromptCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/ReferenceAddCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/ReferenceUpdateCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/ReferenceRestoreCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/ReferenceRemoveCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/ResultSelectCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/EditorCreateCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/EditorSaveCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/DirectorApplyCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardReorderCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardResizeCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardDeleteCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/DirectorSetDurationCommandOperation"
+ },
+ {
+ "$ref": "#/$defs/DirectorCameraDeleteCommandOperation"
+ }
+ ]
+ },
+ "maxItems": 500,
+ "minItems": 1,
+ "title": "Operations",
+ "type": "array"
}
},
"required": [
- "type",
- "payload"
+ "operations"
],
- "title": "CanvasUpdateCommandOperation",
+ "title": "BatchPayload",
"type": "object"
},
- "ChangedObject": {
+ "CameraChannels": {
"additionalProperties": false,
"properties": {
- "version": {
- "$ref": "#/$defs/ObjectVersion",
- "description": "Version of the referenced record."
+ "position": {
+ "default": [],
+ "description": "Independent camera position channel.",
+ "items": {
+ "$ref": "#/$defs/CameraVectorFrame"
+ },
+ "title": "Position",
+ "type": "array"
},
- "change": {
- "description": "Kind of business object change.",
- "enum": [
- "created",
- "updated",
- "hidden",
- "deleted"
- ],
- "title": "Change",
- "type": "string"
+ "target": {
+ "default": [],
+ "description": "Independent camera target channel.",
+ "items": {
+ "$ref": "#/$defs/CameraVectorFrame"
+ },
+ "title": "Target",
+ "type": "array"
+ },
+ "up": {
+ "default": [],
+ "description": "Independent camera up-vector channel.",
+ "items": {
+ "$ref": "#/$defs/CameraVectorFrame"
+ },
+ "title": "Up",
+ "type": "array"
+ },
+ "focalLength": {
+ "default": [],
+ "description": "Independent camera focal-length channel.",
+ "items": {
+ "$ref": "#/$defs/CameraNumberFrame"
+ },
+ "title": "Focallength",
+ "type": "array"
}
},
"required": [
- "version",
- "change"
+ "position",
+ "target",
+ "up",
+ "focalLength"
],
- "title": "ChangedObject",
+ "title": "CameraChannels",
"type": "object"
},
- "CommandBase": {
+ "CameraFrame": {
"additionalProperties": false,
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
+ "id": {
+ "description": "Stable object ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
"type": "string"
},
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
- "type": "string"
+ "time": {
+ "description": "Keyframe time in seconds.",
+ "minimum": 0,
+ "title": "Time",
+ "type": "number"
},
- "type": {
- "description": "Operation or variant discriminator.",
- "title": "Type",
+ "value": {
+ "$ref": "#/$defs/StageCamera",
+ "description": "Keyframed transform or camera pose."
+ }
+ },
+ "required": [
+ "id",
+ "time",
+ "value"
+ ],
+ "title": "CameraFrame",
+ "type": "object"
+ },
+ "CameraNumberFrame": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable channel keyframe ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
"type": "string"
},
- "expectedVersions": {
- "default": [],
- "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Expectedversions",
- "type": "array"
+ "time": {
+ "description": "Keyframe time in seconds.",
+ "minimum": 0,
+ "title": "Time",
+ "type": "number"
},
- "expectedPreview": {
+ "value": {
+ "description": "Keyframed camera focal length.",
+ "exclusiveMinimum": 0,
+ "title": "Value",
+ "type": "number"
+ },
+ "transition": {
"anyOf": [
{
- "pattern": "^[0-9a-f]{64}$",
- "type": "string"
+ "$ref": "#/$defs/StageBezierTransition"
},
{
"type": "null"
}
],
"default": null,
- "description": "Fingerprint of the confirmed impact preview.",
- "title": "Expectedpreview"
+ "description": "Interpolation for the outgoing segment."
}
},
"required": [
- "commandId",
- "projectId",
- "type",
- "expectedVersions",
- "expectedPreview"
+ "id",
+ "time",
+ "value",
+ "transition"
],
- "title": "CommandBase",
+ "title": "CameraNumberFrame",
"type": "object"
},
- "CommandReceipt": {
+ "CameraRig": {
"additionalProperties": false,
"properties": {
- "commandId": {
- "description": "Stable command ID for idempotent replay.",
- "format": "uuid",
- "title": "Commandid",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
- "format": "uuid",
- "title": "Projectid",
+ "id": {
+ "description": "Stable object ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
"type": "string"
},
- "inputFingerprint": {
- "description": "Fingerprint of the fixed execution input.",
- "pattern": "^[0-9a-f]{64}$",
- "title": "Inputfingerprint",
+ "name": {
+ "description": "User-visible name.",
+ "maxLength": 255,
+ "title": "Name",
"type": "string"
},
- "status": {
- "description": "Current operation lifecycle state.",
+ "aspectRatio": {
+ "default": "16:9",
+ "description": "Camera output aspect ratio.",
"enum": [
- "applied",
- "accepted",
- "noop",
- "rejected"
+ "16:9",
+ "2.39:1",
+ "9:16",
+ "1:1",
+ "4:3",
+ "3:4"
],
- "title": "Status",
+ "title": "Aspectratio",
"type": "string"
},
- "changed": {
- "default": [],
- "description": "Business objects changed by the operation.",
- "items": {
- "$ref": "#/$defs/ObjectVersion"
- },
- "title": "Changed",
- "type": "array"
+ "pose": {
+ "$ref": "#/$defs/StageCamera",
+ "description": "Camera position and look-at target."
},
- "jobIds": {
+ "keyframes": {
"default": [],
- "description": "Generation jobs associated with this operation.",
+ "description": "Ordered animation keyframes.",
"items": {
- "format": "uuid",
- "type": "string"
+ "$ref": "#/$defs/CameraFrame"
},
- "title": "Jobids",
+ "title": "Keyframes",
"type": "array"
},
- "issues": {
- "default": [],
- "description": "Validation or execution issues.",
- "items": {
- "$ref": "#/$defs/ContractIssue"
- },
- "title": "Issues",
- "type": "array"
+ "channels": {
+ "$ref": "#/$defs/CameraChannels",
+ "description": "Independent authoritative camera channels."
+ }
+ },
+ "required": [
+ "id",
+ "name",
+ "aspectRatio",
+ "pose",
+ "keyframes",
+ "channels"
+ ],
+ "title": "CameraRig",
+ "type": "object"
+ },
+ "CameraVectorFrame": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable channel keyframe ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
+ "type": "string"
},
- "eventCursor": {
+ "time": {
+ "description": "Keyframe time in seconds.",
+ "minimum": 0,
+ "title": "Time",
+ "type": "number"
+ },
+ "value": {
+ "$ref": "#/$defs/Vector3",
+ "description": "Keyframed camera vector."
+ },
+ "transition": {
"anyOf": [
{
- "minimum": 0,
- "type": "integer"
+ "$ref": "#/$defs/StageBezierTransition"
},
{
"type": "null"
}
],
"default": null,
- "description": "Latest committed project event cursor.",
- "title": "Eventcursor"
+ "description": "Interpolation for the outgoing segment."
}
},
"required": [
- "commandId",
- "projectId",
- "inputFingerprint",
- "status",
- "changed",
- "jobIds",
- "issues",
- "eventCursor"
+ "id",
+ "time",
+ "value",
+ "transition"
],
- "title": "CommandReceipt",
+ "title": "CameraVectorFrame",
"type": "object"
},
- "ContainerBinding": {
+ "CanvasApplyEdit": {
"additionalProperties": false,
"properties": {
- "role": {
- "const": "container",
- "description": "Business role of this binding or reference.",
- "title": "Role",
+ "itemId": {
+ "description": "Canvas item ID.",
+ "format": "uuid",
+ "title": "Itemid",
+ "type": "string"
+ },
+ "source": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Input source or recorded provenance."
+ },
+ "asset": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Immutable asset version."
+ },
+ "editorId": {
+ "description": "Editable document ID.",
+ "format": "uuid",
+ "title": "Editorid",
"type": "string"
}
},
"required": [
- "role"
+ "itemId",
+ "source",
+ "asset",
+ "editorId"
],
- "title": "ContainerBinding",
- "type": "object"
- },
- "Contract": {
- "additionalProperties": false,
- "properties": {},
- "title": "Contract",
+ "title": "CanvasApplyEdit",
"type": "object"
},
- "ContractIssue": {
+ "CanvasApplyEditCommand": {
"additionalProperties": false,
+ "description": "Apply an editor result to a canvas item.",
"properties": {
- "code": {
- "description": "Stable error or issue code.",
- "enum": [
- "timeline_package_invalid",
- "timeline_package_too_large",
- "timeline_revision_missing",
- "timeline_import_missing",
- "timeline_import_conflict",
- "timeline_registration_rejected",
- "timeline_font_too_large",
- "timeline_font_unavailable",
- "timeline_font_unsupported",
- "timeline_font_invalid",
- "timeline_font_fingerprint",
- "timeline_font_coverage",
- "timeline_font_total_bytes",
- "timeline_font_unverified",
- "timeline_font_mime",
- "timeline_bundled_font_fingerprint",
- "timeline_bundled_font_unavailable",
- "invalid_input",
- "revision_conflict",
- "role_restricted",
- "missing_object",
- "reference_invalid",
- "image_quality_unsupported",
- "bigmodel_video_model",
- "bigmodel_video_output",
- "bigmodel_video_image",
- "bigmodel_video_frames",
- "bigmodel_video_prompt",
- "bigmodel_video_cancel",
- "kling_model",
- "kling_mode",
- "kling_image",
- "kling_frames",
- "kling_prompt",
- "kling_aspect",
- "kling_output",
- "kling_cancel",
- "capability_unsupported",
- "preview_expired",
- "storage_unavailable",
- "submission_unknown",
- "provider_error",
- "moss_speech_text",
- "moss_speech_voice",
- "moss_speech_reference",
- "moss_prompt_limit",
- "moss_image_size",
- "moss_image_reference",
- "moss_layout_reference",
- "bigmodel_image_size",
- "bigmodel_image_reference",
- "bigmodel_image_prompt",
- "minimax_image_reference",
- "minimax_image_count",
- "minimax_image_bytes",
- "minimax_speech_text",
- "minimax_speech_voice",
- "minimax_speech_reference",
- "minimax_speech_model",
- "zhipu_speech_text",
- "zhipu_speech_voice",
- "zhipu_speech_reference",
- "voice_library_unsupported",
- "voice_connection_changed",
- "voice_reference_required",
- "voice_transcript_required",
- "voice_transcript_too_long",
- "voice_description_too_long",
- "voice_not_found",
- "voice_delete_unsupported",
- "voice_consent_required",
- "voice_name_invalid",
- "voice_audio_invalid",
- "voice_format",
- "voice_size",
- "voice_duration",
- "voice_provider_protocol",
- "voice_provider_error",
- "voice_provider_timeout",
- "voice_model_unsupported",
- "voice_name_taken",
- "voice_provider_quota"
- ],
- "title": "Code",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
"type": "string"
},
- "message": {
- "description": "Human-readable issue description.",
- "maxLength": 500,
- "minLength": 1,
- "title": "Message",
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
"type": "string"
},
- "objectId": {
+ "type": {
+ "const": "canvas.applyEdit",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
"anyOf": [
{
- "format": "uuid",
+ "pattern": "^[0-9a-f]{64}$",
"type": "string"
},
{
@@ -18853,13 +19266,112 @@
}
],
"default": null,
- "description": "Target business object ID.",
- "title": "Objectid"
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "field": {
+ "payload": {
+ "$ref": "#/$defs/CanvasApplyEdit",
+ "description": "Apply an editor result to a canvas item."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "CanvasApplyEditCommand",
+ "type": "object"
+ },
+ "CanvasApplyEditCommandOperation": {
+ "additionalProperties": false,
+ "description": "Apply an editor result to a canvas item.",
+ "properties": {
+ "type": {
+ "const": "canvas.applyEdit",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasApplyEdit",
+ "description": "Apply an editor result to a canvas item."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "CanvasApplyEditCommandOperation",
+ "type": "object"
+ },
+ "CanvasConfigure": {
+ "additionalProperties": false,
+ "properties": {
+ "itemId": {
+ "description": "Canvas item ID.",
+ "format": "uuid",
+ "title": "Itemid",
+ "type": "string"
+ },
+ "specId": {
+ "description": "Generation configuration ID.",
+ "format": "uuid",
+ "title": "Specid",
+ "type": "string"
+ },
+ "preserveMaterial": {
+ "default": false,
+ "description": "Whether configuring generation retains current material.",
+ "title": "Preservematerial",
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "itemId",
+ "specId",
+ "preserveMaterial"
+ ],
+ "title": "CanvasConfigure",
+ "type": "object"
+ },
+ "CanvasConfigureCommand": {
+ "additionalProperties": false,
+ "description": "Bind a generation configuration to a canvas item.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "canvas.configure",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
"anyOf": [
{
- "maxLength": 200,
+ "pattern": "^[0-9a-f]{64}$",
"type": "string"
},
{
@@ -18867,28 +19379,79 @@
}
],
"default": null,
- "description": "Path of the field responsible for this issue.",
- "title": "Field"
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasConfigure",
+ "description": "Bind a generation configuration to a canvas item."
}
},
"required": [
- "code",
- "message",
- "objectId",
- "field"
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
],
- "title": "ContractIssue",
+ "title": "CanvasConfigureCommand",
"type": "object"
},
- "CreationContracts": {
+ "CanvasConfigureCommandOperation": {
"additionalProperties": false,
+ "description": "Bind a generation configuration to a canvas item.",
"properties": {
- "project": {
- "$ref": "#/$defs/ProjectSnapshot",
- "description": "Authoritative project snapshot schema."
+ "type": {
+ "const": "canvas.configure",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
},
- "canvasItem": {
- "description": "Canvas item schema.",
+ "payload": {
+ "$ref": "#/$defs/CanvasConfigure",
+ "description": "Bind a generation configuration to a canvas item."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "CanvasConfigureCommandOperation",
+ "type": "object"
+ },
+ "CanvasCreateGeneration": {
+ "additionalProperties": false,
+ "properties": {
+ "spec": {
+ "description": "New configuration with purpose=generation.",
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioGenerationSpec",
+ "image": "#/$defs/ImageGenerationSpec",
+ "text": "#/$defs/TextGenerationSpec",
+ "video": "#/$defs/VideoGenerationSpec"
+ },
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TextGenerationSpec"
+ },
+ {
+ "$ref": "#/$defs/ImageGenerationSpec"
+ },
+ {
+ "$ref": "#/$defs/VideoGenerationSpec"
+ },
+ {
+ "$ref": "#/$defs/AudioGenerationSpec"
+ }
+ ],
+ "title": "Spec"
+ },
+ "item": {
+ "description": "Visible item bound to spec.id with role=generation.",
"discriminator": {
"mapping": {
"audio": "#/$defs/AudioCanvasItem",
@@ -18940,442 +19503,3661 @@
"$ref": "#/$defs/GroupCanvasItem"
}
],
- "title": "Canvasitem"
+ "title": "Item"
},
- "generationSpec": {
- "description": "Generation configuration schema.",
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioGenerationSpec",
- "image": "#/$defs/ImageGenerationSpec",
- "text": "#/$defs/TextGenerationSpec",
- "video": "#/$defs/VideoGenerationSpec"
+ "references": {
+ "default": [],
+ "description": "Input references. Every canvas-derived reference must retain its source node: source.id for follow_current, sourceVersion for pinned. Never replace a canvas reference with an asset-only binding.",
+ "items": {
+ "description": "Generation input reference. Preserve source canvas identity for canvas-derived references, whether following or pinned.",
+ "discriminator": {
+ "mapping": {
+ "follow_current": "#/$defs/FollowingReference",
+ "pinned": "#/$defs/PinnedReference"
+ },
+ "propertyName": "binding"
},
- "propertyName": "kind"
+ "oneOf": [
+ {
+ "$ref": "#/$defs/PinnedReference"
+ },
+ {
+ "$ref": "#/$defs/FollowingReference"
+ }
+ ]
},
- "oneOf": [
- {
- "$ref": "#/$defs/TextGenerationSpec"
- },
- {
- "$ref": "#/$defs/ImageGenerationSpec"
- },
+ "title": "References",
+ "type": "array"
+ }
+ },
+ "required": [
+ "spec",
+ "item",
+ "references"
+ ],
+ "title": "CanvasCreateGeneration",
+ "type": "object"
+ },
+ "CanvasCreateGenerationCommand": {
+ "additionalProperties": false,
+ "description": "Create a visible generation node and references atomically, preserving canvas source connections, including pinned ones.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "canvas.createGeneration",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
{
- "$ref": "#/$defs/VideoGenerationSpec"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
- "$ref": "#/$defs/AudioGenerationSpec"
+ "type": "null"
}
],
- "title": "Generationspec"
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "reference": {
- "description": "Generation reference to create or update.",
- "discriminator": {
- "mapping": {
- "follow_current": "#/$defs/FollowingReference",
- "pinned": "#/$defs/PinnedReference"
- },
- "propertyName": "binding"
+ "payload": {
+ "$ref": "#/$defs/CanvasCreateGeneration",
+ "description": "Create a visible generation node and references atomically, preserving canvas source connections, including pinned ones."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "CanvasCreateGenerationCommand",
+ "type": "object"
+ },
+ "CanvasEditorAttach": {
+ "additionalProperties": false,
+ "properties": {
+ "itemId": {
+ "description": "Canvas item ID.",
+ "format": "uuid",
+ "title": "Itemid",
+ "type": "string"
+ },
+ "editorId": {
+ "description": "Editable document ID.",
+ "format": "uuid",
+ "title": "Editorid",
+ "type": "string"
+ }
+ },
+ "required": [
+ "itemId",
+ "editorId"
+ ],
+ "title": "CanvasEditorAttach",
+ "type": "object"
+ },
+ "CanvasEditorAttachCommand": {
+ "additionalProperties": false,
+ "description": "Attach an editor document to a canvas item.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "canvas.attachEditor",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
},
- "oneOf": [
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
{
- "$ref": "#/$defs/PinnedReference"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
- "$ref": "#/$defs/FollowingReference"
+ "type": "null"
}
],
- "title": "Reference"
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "editorDocument": {
- "description": "Editable document schema.",
- "discriminator": {
- "mapping": {
- "director": "#/$defs/DirectorDocument",
- "image_crop": "#/$defs/ImageCropDocument",
- "layers": "#/$defs/LayerDocument",
- "media_edit": "#/$defs/MediaEditDocument",
- "stack": "#/$defs/StackDocument",
- "subject": "#/$defs/SubjectDocument",
- "timeline": "#/$defs/TimelineDocument",
- "tool": "#/$defs/ToolDocument"
- },
- "propertyName": "kind"
- },
- "oneOf": [
- {
- "$ref": "#/$defs/TimelineDocument"
- },
- {
- "$ref": "#/$defs/SubjectDocument"
- },
- {
- "$ref": "#/$defs/LayerDocument"
- },
- {
- "$ref": "#/$defs/ImageCropDocument"
- },
- {
- "$ref": "#/$defs/StackDocument"
- },
- {
- "$ref": "#/$defs/ToolDocument"
- },
+ "payload": {
+ "$ref": "#/$defs/CanvasEditorAttach",
+ "description": "Attach an editor document to a canvas item."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "CanvasEditorAttachCommand",
+ "type": "object"
+ },
+ "CanvasEditorAttachCommandOperation": {
+ "additionalProperties": false,
+ "description": "Attach an editor document to a canvas item.",
+ "properties": {
+ "type": {
+ "const": "canvas.attachEditor",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasEditorAttach",
+ "description": "Attach an editor document to a canvas item."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "CanvasEditorAttachCommandOperation",
+ "type": "object"
+ },
+ "CanvasEditorDetachCommand": {
+ "additionalProperties": false,
+ "description": "Detach an editor document from a canvas item.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "canvas.detachEditor",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
{
- "$ref": "#/$defs/DirectorDocument"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
- "$ref": "#/$defs/MediaEditDocument"
+ "type": "null"
}
],
- "title": "Editordocument"
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "command": {
- "description": "Immutable command recorded in this commit.",
- "discriminator": {
- "mapping": {
- "artifact.publish": "#/$defs/ArtifactPublishCommand",
- "asset.delete": "#/$defs/AssetDeleteCommand",
- "asset.import": "#/$defs/AssetImportCommand",
- "asset.updateMetadata": "#/$defs/AssetMetadataCommand",
- "asset.writeText": "#/$defs/AssetWriteTextCommand",
- "canvas.applyEdit": "#/$defs/CanvasApplyEditCommand",
- "canvas.applyVersion": "#/$defs/NodeVersionApplyCommand",
- "canvas.attachEditor": "#/$defs/CanvasEditorAttachCommand",
- "canvas.configure": "#/$defs/CanvasConfigureCommand",
- "canvas.createGeneration": "#/$defs/CanvasCreateGenerationCommand",
- "canvas.detachEditor": "#/$defs/CanvasEditorDetachCommand",
- "canvas.hide": "#/$defs/CanvasHideCommand",
- "canvas.materialize": "#/$defs/CanvasMaterializeCommand",
- "canvas.move": "#/$defs/CanvasMoveCommand",
- "canvas.publishMedia": "#/$defs/CanvasPublishMediaCommand",
- "canvas.show": "#/$defs/CanvasShowCommand",
- "canvas.update": "#/$defs/CanvasUpdateCommand",
- "creation.batch": "#/$defs/BatchCommand",
- "editor.create": "#/$defs/EditorCreateCommand",
- "editor.save": "#/$defs/EditorSaveCommand",
- "generation.submit": "#/$defs/GenerationSubmitCommand",
- "generationSpec.create": "#/$defs/SpecCreateCommand",
- "generationSpec.restore": "#/$defs/SpecRestoreCommand",
- "generationSpec.setPrompt": "#/$defs/SpecPromptCommand",
- "generationSpec.update": "#/$defs/SpecUpdateCommand",
- "history.redo": "#/$defs/HistoryRedoCommand",
- "history.undo": "#/$defs/HistoryUndoCommand",
- "job.cancel": "#/$defs/JobCancelCommand",
- "job.checkpoint": "#/$defs/JobCheckpointCommand",
- "job.recover": "#/$defs/JobRecoverCommand",
- "project.create": "#/$defs/ProjectCreateCommand",
- "project.rename": "#/$defs/ProjectRenameCommand",
- "project.restore": "#/$defs/ProjectRestoreCommand",
- "project.trash": "#/$defs/ProjectTrashCommand",
- "reference.add": "#/$defs/ReferenceAddCommand",
- "reference.remove": "#/$defs/ReferenceRemoveCommand",
- "reference.restore": "#/$defs/ReferenceRestoreCommand",
- "reference.update": "#/$defs/ReferenceUpdateCommand",
- "result.select": "#/$defs/ResultSelectCommand",
- "timeline.publishRender": "#/$defs/TimelinePublishRenderCommand"
- },
- "propertyName": "type"
+ "payload": {
+ "$ref": "#/$defs/CanvasEditorAttach",
+ "description": "Detach an editor document from a canvas item."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "CanvasEditorDetachCommand",
+ "type": "object"
+ },
+ "CanvasEditorDetachCommandOperation": {
+ "additionalProperties": false,
+ "description": "Detach an editor document from a canvas item.",
+ "properties": {
+ "type": {
+ "const": "canvas.detachEditor",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasEditorAttach",
+ "description": "Detach an editor document from a canvas item."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "CanvasEditorDetachCommandOperation",
+ "type": "object"
+ },
+ "CanvasHide": {
+ "additionalProperties": false,
+ "properties": {
+ "itemId": {
+ "description": "Canvas item ID.",
+ "format": "uuid",
+ "title": "Itemid",
+ "type": "string"
+ }
+ },
+ "required": [
+ "itemId"
+ ],
+ "title": "CanvasHide",
+ "type": "object"
+ },
+ "CanvasHideCommand": {
+ "additionalProperties": false,
+ "description": "Remove a canvas item; preserves project contents. Remove all visible items to clear the canvas.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "canvas.hide",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
},
- "oneOf": [
- {
- "$ref": "#/$defs/ProjectCreateCommand"
- },
- {
- "$ref": "#/$defs/ProjectRenameCommand"
- },
- {
- "$ref": "#/$defs/ProjectTrashCommand"
- },
- {
- "$ref": "#/$defs/ProjectRestoreCommand"
- },
- {
- "$ref": "#/$defs/AssetImportCommand"
- },
- {
- "$ref": "#/$defs/ArtifactPublishCommand"
- },
- {
- "$ref": "#/$defs/AssetWriteTextCommand"
- },
- {
- "$ref": "#/$defs/AssetMetadataCommand"
- },
- {
- "$ref": "#/$defs/AssetDeleteCommand"
- },
- {
- "$ref": "#/$defs/CanvasCreateGenerationCommand"
- },
- {
- "$ref": "#/$defs/CanvasShowCommand"
- },
- {
- "$ref": "#/$defs/CanvasMoveCommand"
- },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
{
- "$ref": "#/$defs/CanvasUpdateCommand"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
- "$ref": "#/$defs/CanvasHideCommand"
- },
- {
- "$ref": "#/$defs/CanvasMaterializeCommand"
- },
- {
- "$ref": "#/$defs/CanvasApplyEditCommand"
- },
- {
- "$ref": "#/$defs/CanvasPublishMediaCommand"
- },
- {
- "$ref": "#/$defs/TimelinePublishRenderCommand"
- },
- {
- "$ref": "#/$defs/NodeVersionApplyCommand"
- },
- {
- "$ref": "#/$defs/CanvasConfigureCommand"
- },
- {
- "$ref": "#/$defs/CanvasEditorAttachCommand"
- },
- {
- "$ref": "#/$defs/CanvasEditorDetachCommand"
- },
- {
- "$ref": "#/$defs/SpecCreateCommand"
- },
- {
- "$ref": "#/$defs/SpecUpdateCommand"
- },
- {
- "$ref": "#/$defs/SpecRestoreCommand"
- },
- {
- "$ref": "#/$defs/SpecPromptCommand"
- },
- {
- "$ref": "#/$defs/ReferenceAddCommand"
- },
- {
- "$ref": "#/$defs/ReferenceUpdateCommand"
- },
- {
- "$ref": "#/$defs/ReferenceRestoreCommand"
- },
- {
- "$ref": "#/$defs/ReferenceRemoveCommand"
- },
- {
- "$ref": "#/$defs/GenerationSubmitCommand"
- },
- {
- "$ref": "#/$defs/JobCancelCommand"
- },
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasHide",
+ "description": "Remove a canvas item; preserves project contents. Remove all visible items to clear the canvas."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "CanvasHideCommand",
+ "type": "object"
+ },
+ "CanvasHideCommandOperation": {
+ "additionalProperties": false,
+ "description": "Remove a canvas item; preserves project contents. Remove all visible items to clear the canvas.",
+ "properties": {
+ "type": {
+ "const": "canvas.hide",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasHide",
+ "description": "Remove a canvas item; preserves project contents. Remove all visible items to clear the canvas."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "CanvasHideCommandOperation",
+ "type": "object"
+ },
+ "CanvasItemBase": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "kind": {
+ "description": "Business object or media type.",
+ "enum": [
+ "text",
+ "image",
+ "video",
+ "audio",
+ "file",
+ "group",
+ "timeline",
+ "subject",
+ "stack",
+ "tool",
+ "external"
+ ],
+ "title": "Kind",
+ "type": "string"
+ },
+ "title": {
+ "default": "",
+ "description": "User-visible title.",
+ "maxLength": 255,
+ "title": "Title",
+ "type": "string"
+ },
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
+ },
+ "width": {
+ "default": 352,
+ "description": "Width in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Width",
+ "type": "number"
+ },
+ "height": {
+ "default": 198,
+ "description": "Height in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Height",
+ "type": "number"
+ },
+ "zIndex": {
+ "default": 0,
+ "description": "Canvas stacking order.",
+ "title": "Zindex",
+ "type": "integer"
+ },
+ "locked": {
+ "default": false,
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
+ "type": "boolean"
+ },
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
+ },
+ "parentId": {
+ "anyOf": [
{
- "$ref": "#/$defs/JobRecoverCommand"
+ "format": "uuid",
+ "type": "string"
},
{
- "$ref": "#/$defs/JobCheckpointCommand"
- },
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Parent canvas group ID, or null for the root.",
+ "title": "Parentid"
+ },
+ "tags": {
+ "default": [],
+ "description": "User-defined search tags.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Tags",
+ "type": "array"
+ }
+ },
+ "required": [
+ "id",
+ "projectId",
+ "revision",
+ "kind",
+ "title",
+ "position",
+ "width",
+ "height",
+ "zIndex",
+ "locked",
+ "visible",
+ "parentId",
+ "tags"
+ ],
+ "title": "CanvasItemBase",
+ "type": "object"
+ },
+ "CanvasItemVersion": {
+ "additionalProperties": false,
+ "properties": {
+ "objectType": {
+ "const": "canvas_item",
+ "description": "Source canvas item type.",
+ "title": "Objecttype",
+ "type": "string"
+ },
+ "id": {
+ "description": "Stable object ID.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
+ },
+ "revision": {
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ }
+ },
+ "required": [
+ "objectType",
+ "id",
+ "revision"
+ ],
+ "title": "CanvasItemVersion",
+ "type": "object"
+ },
+ "CanvasMaterialize": {
+ "additionalProperties": false,
+ "properties": {
+ "itemId": {
+ "description": "Canvas item ID.",
+ "format": "uuid",
+ "title": "Itemid",
+ "type": "string"
+ },
+ "asset": {
+ "$ref": "#/$defs/AssetRef",
+ "description": "Immutable asset version."
+ },
+ "discardGenerationDraft": {
+ "default": false,
+ "description": "Whether material replacement discards the generation draft.",
+ "title": "Discardgenerationdraft",
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "itemId",
+ "asset",
+ "discardGenerationDraft"
+ ],
+ "title": "CanvasMaterialize",
+ "type": "object"
+ },
+ "CanvasMaterializeCommand": {
+ "additionalProperties": false,
+ "description": "Bind an asset to an empty or material canvas item.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "canvas.materialize",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasMaterialize",
+ "description": "Bind an asset to an empty or material canvas item."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "CanvasMaterializeCommand",
+ "type": "object"
+ },
+ "CanvasMaterializeCommandOperation": {
+ "additionalProperties": false,
+ "description": "Bind an asset to an empty or material canvas item.",
+ "properties": {
+ "type": {
+ "const": "canvas.materialize",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasMaterialize",
+ "description": "Bind an asset to an empty or material canvas item."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "CanvasMaterializeCommandOperation",
+ "type": "object"
+ },
+ "CanvasMove": {
+ "additionalProperties": false,
+ "properties": {
+ "items": {
+ "description": "Ordered entries in this collection.",
+ "items": {
+ "$ref": "#/$defs/CanvasMoveItem"
+ },
+ "maxItems": 500,
+ "minItems": 1,
+ "title": "Items",
+ "type": "array"
+ }
+ },
+ "required": [
+ "items"
+ ],
+ "title": "CanvasMove",
+ "type": "object"
+ },
+ "CanvasMoveCommand": {
+ "additionalProperties": false,
+ "description": "Move one or more canvas items.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "canvas.move",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasMove",
+ "description": "Move one or more canvas items."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "CanvasMoveCommand",
+ "type": "object"
+ },
+ "CanvasMoveCommandOperation": {
+ "additionalProperties": false,
+ "description": "Move one or more canvas items.",
+ "properties": {
+ "type": {
+ "const": "canvas.move",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasMove",
+ "description": "Move one or more canvas items."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "CanvasMoveCommandOperation",
+ "type": "object"
+ },
+ "CanvasMoveItem": {
+ "additionalProperties": false,
+ "properties": {
+ "itemId": {
+ "description": "Canvas item ID.",
+ "format": "uuid",
+ "title": "Itemid",
+ "type": "string"
+ },
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
+ }
+ },
+ "required": [
+ "itemId",
+ "position"
+ ],
+ "title": "CanvasMoveItem",
+ "type": "object"
+ },
+ "CanvasPresentationUpdate": {
+ "additionalProperties": false,
+ "properties": {
+ "itemId": {
+ "description": "Canvas item ID.",
+ "format": "uuid",
+ "title": "Itemid",
+ "type": "string"
+ },
+ "title": {
+ "anyOf": [
+ {
+ "maxLength": 255,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "User-visible title.",
+ "title": "Title"
+ },
+ "width": {
+ "anyOf": [
+ {
+ "exclusiveMinimum": 0,
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Width in pixels.",
+ "title": "Width"
+ },
+ "height": {
+ "anyOf": [
+ {
+ "exclusiveMinimum": 0,
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Height in pixels.",
+ "title": "Height"
+ },
+ "zIndex": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Canvas stacking order.",
+ "title": "Zindex"
+ },
+ "locked": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked"
+ },
+ "parentId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Parent canvas group ID, or null for the root.",
+ "title": "Parentid"
+ }
+ },
+ "required": [
+ "itemId",
+ "title",
+ "width",
+ "height",
+ "zIndex",
+ "locked",
+ "parentId"
+ ],
+ "title": "CanvasPresentationUpdate",
+ "type": "object"
+ },
+ "CanvasPublishMedia": {
+ "additionalProperties": false,
+ "properties": {
+ "itemId": {
+ "description": "Canvas item ID.",
+ "format": "uuid",
+ "title": "Itemid",
+ "type": "string"
+ },
+ "source": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AssetRef"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Input source or recorded provenance."
+ },
+ "sourceEditorId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Source editable document ID.",
+ "title": "Sourceeditorid"
+ },
+ "document": {
+ "description": "Editable document owned by this operation.",
+ "discriminator": {
+ "mapping": {
+ "director": "#/$defs/DirectorDocument",
+ "image_crop": "#/$defs/ImageCropDocument",
+ "layers": "#/$defs/LayerDocument",
+ "media_edit": "#/$defs/MediaEditDocument",
+ "stack": "#/$defs/StackDocument",
+ "subject": "#/$defs/SubjectDocument",
+ "timeline": "#/$defs/TimelineDocument",
+ "tool": "#/$defs/ToolDocument"
+ },
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TimelineDocument"
+ },
+ {
+ "$ref": "#/$defs/SubjectDocument"
+ },
+ {
+ "$ref": "#/$defs/LayerDocument"
+ },
+ {
+ "$ref": "#/$defs/ImageCropDocument"
+ },
+ {
+ "$ref": "#/$defs/StackDocument"
+ },
+ {
+ "$ref": "#/$defs/ToolDocument"
+ },
+ {
+ "$ref": "#/$defs/DirectorDocument"
+ },
+ {
+ "$ref": "#/$defs/MediaEditDocument"
+ }
+ ],
+ "title": "Document"
+ },
+ "directorPlan": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/DirectorOutputPlan"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Frozen Director video output plan, when publishing a stage video."
+ },
+ "directorAcceptedAt": {
+ "anyOf": [
+ {
+ "minimum": 1,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Project event cursor fixed when the browser accepted a Director video render.",
+ "title": "Directoracceptedat"
+ },
+ "outputs": {
+ "description": "Ordered published media outputs.",
+ "items": {
+ "$ref": "#/$defs/MediaPublicationOutput"
+ },
+ "maxItems": 50,
+ "minItems": 1,
+ "title": "Outputs",
+ "type": "array"
+ }
+ },
+ "required": [
+ "itemId",
+ "source",
+ "sourceEditorId",
+ "document",
+ "directorPlan",
+ "outputs"
+ ],
+ "title": "CanvasPublishMedia",
+ "type": "object"
+ },
+ "CanvasPublishMediaCommand": {
+ "additionalProperties": false,
+ "description": "Publish edited media outputs with their editor snapshot.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "canvas.publishMedia",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasPublishMedia",
+ "description": "Publish edited media outputs with their editor snapshot."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "CanvasPublishMediaCommand",
+ "type": "object"
+ },
+ "CanvasReferenceSources": {
+ "additionalProperties": false,
+ "properties": {
+ "followCurrent": {
+ "$ref": "#/$defs/FollowingReferenceSource",
+ "description": "Source fields for a follow_current reference."
+ },
+ "pinned": {
+ "$ref": "#/$defs/PinnedReferenceSource",
+ "description": "Source fields for a pinned reference retaining its canvas connection."
+ }
+ },
+ "required": [
+ "followCurrent",
+ "pinned"
+ ],
+ "title": "CanvasReferenceSources",
+ "type": "object"
+ },
+ "CanvasShow": {
+ "additionalProperties": false,
+ "properties": {
+ "item": {
+ "description": "Canvas display item to create or restore.",
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioCanvasItem",
+ "external": "#/$defs/DirectorCanvasItem",
+ "file": "#/$defs/FileCanvasItem",
+ "group": "#/$defs/GroupCanvasItem",
+ "image": "#/$defs/ImageCanvasItem",
+ "stack": "#/$defs/StackCanvasItem",
+ "subject": "#/$defs/SubjectCanvasItem",
+ "text": "#/$defs/TextCanvasItem",
+ "timeline": "#/$defs/TimelineCanvasItem",
+ "tool": "#/$defs/ToolCanvasItem",
+ "video": "#/$defs/VideoCanvasItem"
+ },
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TextCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/ImageCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/VideoCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/AudioCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/FileCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/SubjectCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/TimelineCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/StackCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/ToolCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/DirectorCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/GroupCanvasItem"
+ }
+ ],
+ "title": "Item"
+ }
+ },
+ "required": [
+ "item"
+ ],
+ "title": "CanvasShow",
+ "type": "object"
+ },
+ "CanvasShowCommand": {
+ "additionalProperties": false,
+ "description": "Create or restore a canvas display item.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "canvas.show",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasShow",
+ "description": "Create or restore a canvas display item."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "CanvasShowCommand",
+ "type": "object"
+ },
+ "CanvasShowCommandOperation": {
+ "additionalProperties": false,
+ "description": "Create or restore a canvas display item.",
+ "properties": {
+ "type": {
+ "const": "canvas.show",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasShow",
+ "description": "Create or restore a canvas display item."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "CanvasShowCommandOperation",
+ "type": "object"
+ },
+ "CanvasStatusQuery": {
+ "additionalProperties": false,
+ "properties": {
+ "queryId": {
+ "description": "Caller-supplied query ID.",
+ "format": "uuid",
+ "title": "Queryid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "canvas.status",
+ "description": "Read node status, current asset and reusable referenceSources.",
+ "title": "Type",
+ "type": "string"
+ },
+ "objectId": {
+ "description": "Canvas item ID.",
+ "format": "uuid",
+ "title": "Objectid",
+ "type": "string"
+ },
+ "waitSeconds": {
+ "default": 0,
+ "description": "Wait for generation changes; zero returns immediately.",
+ "maximum": 30,
+ "minimum": 0,
+ "title": "Waitseconds",
+ "type": "number"
+ }
+ },
+ "required": [
+ "queryId",
+ "projectId",
+ "type",
+ "objectId",
+ "waitSeconds"
+ ],
+ "title": "CanvasStatusQuery",
+ "type": "object"
+ },
+ "CanvasUpdateCommand": {
+ "additionalProperties": false,
+ "description": "Update canvas presentation, grouping or lock state.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "canvas.update",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasPresentationUpdate",
+ "description": "Update canvas presentation, grouping or lock state."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "CanvasUpdateCommand",
+ "type": "object"
+ },
+ "CanvasUpdateCommandOperation": {
+ "additionalProperties": false,
+ "description": "Update canvas presentation, grouping or lock state.",
+ "properties": {
+ "type": {
+ "const": "canvas.update",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/CanvasPresentationUpdate",
+ "description": "Update canvas presentation, grouping or lock state."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "CanvasUpdateCommandOperation",
+ "type": "object"
+ },
+ "ChangedObject": {
+ "additionalProperties": false,
+ "properties": {
+ "version": {
+ "$ref": "#/$defs/ObjectVersion",
+ "description": "Version of the referenced record."
+ },
+ "change": {
+ "description": "Kind of business object change.",
+ "enum": [
+ "created",
+ "updated",
+ "hidden",
+ "deleted"
+ ],
+ "title": "Change",
+ "type": "string"
+ }
+ },
+ "required": [
+ "version",
+ "change"
+ ],
+ "title": "ChangedObject",
+ "type": "object"
+ },
+ "CommandBase": {
+ "additionalProperties": false,
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "description": "Operation or variant discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview"
+ ],
+ "title": "CommandBase",
+ "type": "object"
+ },
+ "CommandReceipt": {
+ "additionalProperties": false,
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "inputFingerprint": {
+ "description": "Fingerprint of the fixed execution input.",
+ "pattern": "^[0-9a-f]{64}$",
+ "title": "Inputfingerprint",
+ "type": "string"
+ },
+ "status": {
+ "description": "Current operation lifecycle state.",
+ "enum": [
+ "applied",
+ "accepted",
+ "noop",
+ "rejected"
+ ],
+ "title": "Status",
+ "type": "string"
+ },
+ "changed": {
+ "default": [],
+ "description": "Business objects changed by the operation.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Changed",
+ "type": "array"
+ },
+ "jobIds": {
+ "default": [],
+ "description": "Generation jobs associated with this operation.",
+ "items": {
+ "format": "uuid",
+ "type": "string"
+ },
+ "title": "Jobids",
+ "type": "array"
+ },
+ "issues": {
+ "default": [],
+ "description": "Validation or execution issues.",
+ "items": {
+ "$ref": "#/$defs/ContractIssue"
+ },
+ "title": "Issues",
+ "type": "array"
+ },
+ "directorDurations": {
+ "default": [],
+ "description": "Director main timeline results in operation order.",
+ "items": {
+ "$ref": "#/$defs/DirectorDurationResult"
+ },
+ "title": "Directordurations",
+ "type": "array"
+ },
+ "directorStoryboard": {
+ "default": [],
+ "description": "Storyboard outcomes in command operation order.",
+ "items": {
+ "$ref": "#/$defs/DirectorStoryboardResult"
+ },
+ "title": "Directorstoryboard",
+ "type": "array"
+ },
+ "eventCursor": {
+ "anyOf": [
+ {
+ "minimum": 0,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Latest committed project event cursor.",
+ "title": "Eventcursor"
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "inputFingerprint",
+ "status",
+ "changed",
+ "jobIds",
+ "issues",
+ "eventCursor"
+ ],
+ "title": "CommandReceipt",
+ "type": "object"
+ },
+ "ContainerBinding": {
+ "additionalProperties": false,
+ "properties": {
+ "role": {
+ "const": "container",
+ "description": "Business role of this binding or reference.",
+ "title": "Role",
+ "type": "string"
+ }
+ },
+ "required": [
+ "role"
+ ],
+ "title": "ContainerBinding",
+ "type": "object"
+ },
+ "Contract": {
+ "additionalProperties": false,
+ "properties": {},
+ "title": "Contract",
+ "type": "object"
+ },
+ "ContractIssue": {
+ "additionalProperties": false,
+ "properties": {
+ "code": {
+ "description": "Stable error or issue code.",
+ "enum": [
+ "timeline_package_invalid",
+ "timeline_package_too_large",
+ "timeline_revision_missing",
+ "timeline_import_missing",
+ "timeline_import_conflict",
+ "timeline_registration_rejected",
+ "timeline_font_too_large",
+ "timeline_font_unavailable",
+ "timeline_font_unsupported",
+ "timeline_font_invalid",
+ "timeline_font_fingerprint",
+ "timeline_font_coverage",
+ "timeline_font_total_bytes",
+ "timeline_font_unverified",
+ "timeline_font_mime",
+ "timeline_bundled_font_fingerprint",
+ "timeline_bundled_font_unavailable",
+ "storyboard_leading_gap",
+ "storyboard_internal_gap",
+ "storyboard_overlap",
+ "storyboard_exceeds_duration",
+ "storyboard_duration_invalid",
+ "storyboard_camera_unknown",
+ "storyboard_block_invalid",
+ "storyboard_block_exists",
+ "storyboard_exhausted",
+ "storyboard_order_invalid",
+ "storyboard_block_unknown",
+ "director_camera_unknown",
+ "director_camera_required",
+ "invalid_input",
+ "revision_conflict",
+ "role_restricted",
+ "missing_object",
+ "reference_invalid",
+ "image_quality_unsupported",
+ "bigmodel_video_model",
+ "bigmodel_video_output",
+ "bigmodel_video_image",
+ "bigmodel_video_frames",
+ "bigmodel_video_prompt",
+ "bigmodel_video_cancel",
+ "kling_model",
+ "kling_mode",
+ "kling_image",
+ "kling_frames",
+ "kling_prompt",
+ "kling_aspect",
+ "kling_output",
+ "kling_cancel",
+ "capability_unsupported",
+ "preview_expired",
+ "storage_unavailable",
+ "submission_unknown",
+ "provider_error",
+ "moss_speech_text",
+ "moss_speech_voice",
+ "moss_speech_reference",
+ "moss_prompt_limit",
+ "moss_image_size",
+ "moss_image_reference",
+ "moss_layout_reference",
+ "bigmodel_image_size",
+ "bigmodel_image_reference",
+ "bigmodel_image_prompt",
+ "minimax_image_reference",
+ "minimax_image_count",
+ "minimax_image_bytes",
+ "minimax_speech_text",
+ "minimax_speech_voice",
+ "minimax_speech_reference",
+ "minimax_speech_model",
+ "zhipu_speech_text",
+ "zhipu_speech_voice",
+ "zhipu_speech_reference",
+ "voice_library_unsupported",
+ "voice_connection_changed",
+ "voice_reference_required",
+ "voice_transcript_required",
+ "voice_transcript_too_long",
+ "voice_description_too_long",
+ "voice_not_found",
+ "voice_delete_unsupported",
+ "voice_consent_required",
+ "voice_name_invalid",
+ "voice_audio_invalid",
+ "voice_format",
+ "voice_size",
+ "voice_duration",
+ "voice_provider_protocol",
+ "voice_provider_error",
+ "voice_provider_timeout",
+ "voice_model_unsupported",
+ "voice_name_taken",
+ "voice_provider_quota"
+ ],
+ "title": "Code",
+ "type": "string"
+ },
+ "message": {
+ "description": "Human-readable issue description.",
+ "maxLength": 500,
+ "minLength": 1,
+ "title": "Message",
+ "type": "string"
+ },
+ "objectId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Target business object ID.",
+ "title": "Objectid"
+ },
+ "field": {
+ "anyOf": [
+ {
+ "maxLength": 200,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Path of the field responsible for this issue.",
+ "title": "Field"
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "objectId",
+ "field"
+ ],
+ "title": "ContractIssue",
+ "type": "object"
+ },
+ "CreationContracts": {
+ "additionalProperties": false,
+ "properties": {
+ "project": {
+ "$ref": "#/$defs/ProjectSnapshot",
+ "description": "Authoritative project snapshot schema."
+ },
+ "canvasItem": {
+ "description": "Canvas item schema.",
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioCanvasItem",
+ "external": "#/$defs/DirectorCanvasItem",
+ "file": "#/$defs/FileCanvasItem",
+ "group": "#/$defs/GroupCanvasItem",
+ "image": "#/$defs/ImageCanvasItem",
+ "stack": "#/$defs/StackCanvasItem",
+ "subject": "#/$defs/SubjectCanvasItem",
+ "text": "#/$defs/TextCanvasItem",
+ "timeline": "#/$defs/TimelineCanvasItem",
+ "tool": "#/$defs/ToolCanvasItem",
+ "video": "#/$defs/VideoCanvasItem"
+ },
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TextCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/ImageCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/VideoCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/AudioCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/FileCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/SubjectCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/TimelineCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/StackCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/ToolCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/DirectorCanvasItem"
+ },
+ {
+ "$ref": "#/$defs/GroupCanvasItem"
+ }
+ ],
+ "title": "Canvasitem"
+ },
+ "generationSpec": {
+ "description": "Generation configuration schema.",
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioGenerationSpec",
+ "image": "#/$defs/ImageGenerationSpec",
+ "text": "#/$defs/TextGenerationSpec",
+ "video": "#/$defs/VideoGenerationSpec"
+ },
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TextGenerationSpec"
+ },
+ {
+ "$ref": "#/$defs/ImageGenerationSpec"
+ },
+ {
+ "$ref": "#/$defs/VideoGenerationSpec"
+ },
+ {
+ "$ref": "#/$defs/AudioGenerationSpec"
+ }
+ ],
+ "title": "Generationspec"
+ },
+ "reference": {
+ "description": "Generation reference to create or update.",
+ "discriminator": {
+ "mapping": {
+ "follow_current": "#/$defs/FollowingReference",
+ "pinned": "#/$defs/PinnedReference"
+ },
+ "propertyName": "binding"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/PinnedReference"
+ },
+ {
+ "$ref": "#/$defs/FollowingReference"
+ }
+ ],
+ "title": "Reference"
+ },
+ "editorDocument": {
+ "description": "Editable document schema.",
+ "discriminator": {
+ "mapping": {
+ "director": "#/$defs/DirectorDocument",
+ "image_crop": "#/$defs/ImageCropDocument",
+ "layers": "#/$defs/LayerDocument",
+ "media_edit": "#/$defs/MediaEditDocument",
+ "stack": "#/$defs/StackDocument",
+ "subject": "#/$defs/SubjectDocument",
+ "timeline": "#/$defs/TimelineDocument",
+ "tool": "#/$defs/ToolDocument"
+ },
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TimelineDocument"
+ },
+ {
+ "$ref": "#/$defs/SubjectDocument"
+ },
+ {
+ "$ref": "#/$defs/LayerDocument"
+ },
+ {
+ "$ref": "#/$defs/ImageCropDocument"
+ },
+ {
+ "$ref": "#/$defs/StackDocument"
+ },
+ {
+ "$ref": "#/$defs/ToolDocument"
+ },
+ {
+ "$ref": "#/$defs/DirectorDocument"
+ },
+ {
+ "$ref": "#/$defs/MediaEditDocument"
+ }
+ ],
+ "title": "Editordocument"
+ },
+ "command": {
+ "description": "Immutable command recorded in this commit.",
+ "discriminator": {
+ "mapping": {
+ "artifact.publish": "#/$defs/ArtifactPublishCommand",
+ "asset.delete": "#/$defs/AssetDeleteCommand",
+ "asset.import": "#/$defs/AssetImportCommand",
+ "asset.updateMetadata": "#/$defs/AssetMetadataCommand",
+ "asset.writeText": "#/$defs/AssetWriteTextCommand",
+ "canvas.applyEdit": "#/$defs/CanvasApplyEditCommand",
+ "canvas.applyVersion": "#/$defs/NodeVersionApplyCommand",
+ "canvas.attachEditor": "#/$defs/CanvasEditorAttachCommand",
+ "canvas.configure": "#/$defs/CanvasConfigureCommand",
+ "canvas.createGeneration": "#/$defs/CanvasCreateGenerationCommand",
+ "canvas.detachEditor": "#/$defs/CanvasEditorDetachCommand",
+ "canvas.hide": "#/$defs/CanvasHideCommand",
+ "canvas.materialize": "#/$defs/CanvasMaterializeCommand",
+ "canvas.move": "#/$defs/CanvasMoveCommand",
+ "canvas.publishMedia": "#/$defs/CanvasPublishMediaCommand",
+ "canvas.show": "#/$defs/CanvasShowCommand",
+ "canvas.update": "#/$defs/CanvasUpdateCommand",
+ "creation.batch": "#/$defs/BatchCommand",
+ "director.apply": "#/$defs/DirectorApplyCommand",
+ "director.camera.delete": "#/$defs/DirectorCameraDeleteCommand",
+ "director.duration.set": "#/$defs/DirectorSetDurationCommand",
+ "director.storyboard.append": "#/$defs/DirectorStoryboardAppendCommand",
+ "director.storyboard.delete": "#/$defs/DirectorStoryboardDeleteCommand",
+ "director.storyboard.reorder": "#/$defs/DirectorStoryboardReorderCommand",
+ "director.storyboard.resize": "#/$defs/DirectorStoryboardResizeCommand",
+ "editor.create": "#/$defs/EditorCreateCommand",
+ "editor.save": "#/$defs/EditorSaveCommand",
+ "generation.submit": "#/$defs/GenerationSubmitCommand",
+ "generationSpec.create": "#/$defs/SpecCreateCommand",
+ "generationSpec.restore": "#/$defs/SpecRestoreCommand",
+ "generationSpec.setPrompt": "#/$defs/SpecPromptCommand",
+ "generationSpec.update": "#/$defs/SpecUpdateCommand",
+ "history.redo": "#/$defs/HistoryRedoCommand",
+ "history.undo": "#/$defs/HistoryUndoCommand",
+ "job.cancel": "#/$defs/JobCancelCommand",
+ "job.checkpoint": "#/$defs/JobCheckpointCommand",
+ "job.recover": "#/$defs/JobRecoverCommand",
+ "project.create": "#/$defs/ProjectCreateCommand",
+ "project.rename": "#/$defs/ProjectRenameCommand",
+ "project.restore": "#/$defs/ProjectRestoreCommand",
+ "project.trash": "#/$defs/ProjectTrashCommand",
+ "reference.add": "#/$defs/ReferenceAddCommand",
+ "reference.remove": "#/$defs/ReferenceRemoveCommand",
+ "reference.restore": "#/$defs/ReferenceRestoreCommand",
+ "reference.update": "#/$defs/ReferenceUpdateCommand",
+ "result.select": "#/$defs/ResultSelectCommand",
+ "timeline.publishRender": "#/$defs/TimelinePublishRenderCommand"
+ },
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/ProjectCreateCommand"
+ },
+ {
+ "$ref": "#/$defs/ProjectRenameCommand"
+ },
+ {
+ "$ref": "#/$defs/ProjectTrashCommand"
+ },
+ {
+ "$ref": "#/$defs/ProjectRestoreCommand"
+ },
+ {
+ "$ref": "#/$defs/AssetImportCommand"
+ },
+ {
+ "$ref": "#/$defs/ArtifactPublishCommand"
+ },
+ {
+ "$ref": "#/$defs/AssetWriteTextCommand"
+ },
+ {
+ "$ref": "#/$defs/AssetMetadataCommand"
+ },
+ {
+ "$ref": "#/$defs/AssetDeleteCommand"
+ },
+ {
+ "$ref": "#/$defs/CanvasCreateGenerationCommand"
+ },
+ {
+ "$ref": "#/$defs/CanvasShowCommand"
+ },
+ {
+ "$ref": "#/$defs/CanvasMoveCommand"
+ },
+ {
+ "$ref": "#/$defs/CanvasUpdateCommand"
+ },
+ {
+ "$ref": "#/$defs/CanvasHideCommand"
+ },
+ {
+ "$ref": "#/$defs/CanvasMaterializeCommand"
+ },
+ {
+ "$ref": "#/$defs/CanvasApplyEditCommand"
+ },
+ {
+ "$ref": "#/$defs/CanvasPublishMediaCommand"
+ },
+ {
+ "$ref": "#/$defs/TimelinePublishRenderCommand"
+ },
+ {
+ "$ref": "#/$defs/NodeVersionApplyCommand"
+ },
+ {
+ "$ref": "#/$defs/CanvasConfigureCommand"
+ },
+ {
+ "$ref": "#/$defs/CanvasEditorAttachCommand"
+ },
+ {
+ "$ref": "#/$defs/CanvasEditorDetachCommand"
+ },
+ {
+ "$ref": "#/$defs/SpecCreateCommand"
+ },
+ {
+ "$ref": "#/$defs/SpecUpdateCommand"
+ },
+ {
+ "$ref": "#/$defs/SpecRestoreCommand"
+ },
+ {
+ "$ref": "#/$defs/SpecPromptCommand"
+ },
+ {
+ "$ref": "#/$defs/ReferenceAddCommand"
+ },
+ {
+ "$ref": "#/$defs/ReferenceUpdateCommand"
+ },
+ {
+ "$ref": "#/$defs/ReferenceRestoreCommand"
+ },
+ {
+ "$ref": "#/$defs/ReferenceRemoveCommand"
+ },
+ {
+ "$ref": "#/$defs/GenerationSubmitCommand"
+ },
+ {
+ "$ref": "#/$defs/JobCancelCommand"
+ },
+ {
+ "$ref": "#/$defs/JobRecoverCommand"
+ },
+ {
+ "$ref": "#/$defs/JobCheckpointCommand"
+ },
+ {
+ "$ref": "#/$defs/ResultSelectCommand"
+ },
+ {
+ "$ref": "#/$defs/EditorCreateCommand"
+ },
+ {
+ "$ref": "#/$defs/EditorSaveCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorApplyCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardAppendCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardReorderCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardResizeCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardDeleteCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorSetDurationCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorCameraDeleteCommand"
+ },
+ {
+ "$ref": "#/$defs/HistoryUndoCommand"
+ },
+ {
+ "$ref": "#/$defs/HistoryRedoCommand"
+ },
+ {
+ "$ref": "#/$defs/BatchCommand"
+ }
+ ],
+ "title": "Command"
+ },
+ "receipt": {
+ "$ref": "#/$defs/CommandReceipt",
+ "description": "Immutable command execution receipt."
+ },
+ "query": {
+ "description": "Read-only project query.",
+ "discriminator": {
+ "mapping": {
+ "asset.preview": "#/$defs/AssetPreviewQuery",
+ "asset.search": "#/$defs/AssetSearchQuery",
+ "asset.usage": "#/$defs/AssetUsageQuery",
+ "canvas.status": "#/$defs/CanvasStatusQuery",
+ "canvas.versions": "#/$defs/VersionsQuery",
+ "director.storyboard.get": "#/$defs/DirectorStoryboardQuery",
+ "generationSpec.versions": "#/$defs/VersionsQuery",
+ "job.get": "#/$defs/ObjectQuery",
+ "object.get": "#/$defs/ObjectQuery",
+ "project.get": "#/$defs/ProjectQuery"
+ },
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/ProjectQuery"
+ },
+ {
+ "$ref": "#/$defs/ObjectQuery"
+ },
+ {
+ "$ref": "#/$defs/VersionsQuery"
+ },
+ {
+ "$ref": "#/$defs/AssetSearchQuery"
+ },
+ {
+ "$ref": "#/$defs/AssetUsageQuery"
+ },
+ {
+ "$ref": "#/$defs/CanvasStatusQuery"
+ },
+ {
+ "$ref": "#/$defs/AssetPreviewQuery"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardQuery"
+ }
+ ],
+ "title": "Query"
+ },
+ "event": {
+ "$ref": "#/$defs/ProjectEvent",
+ "description": "Project change event, if emitted."
+ },
+ "job": {
+ "$ref": "#/$defs/Job",
+ "description": "Generation execution record."
+ },
+ "result": {
+ "$ref": "#/$defs/ResultVersion",
+ "description": "Generated result schema."
+ },
+ "snapshot": {
+ "$ref": "#/$defs/InputSnapshot",
+ "description": "Fixed generation input schema."
+ },
+ "executionParameters": {
+ "description": "Effective provider execution parameter schema.",
+ "discriminator": {
+ "mapping": {
+ "audio": "#/$defs/AudioExecution",
+ "image": "#/$defs/ImageExecution",
+ "text": "#/$defs/TextExecution",
+ "video": "#/$defs/VideoExecution"
+ },
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/TextExecution"
+ },
+ {
+ "$ref": "#/$defs/ImageExecution"
+ },
+ {
+ "$ref": "#/$defs/VideoExecution"
+ },
+ {
+ "$ref": "#/$defs/AudioExecution"
+ }
+ ],
+ "title": "Executionparameters"
+ },
+ "promptPart": {
+ "description": "Structured prompt token schema.",
+ "discriminator": {
+ "mapping": {
+ "reference": "#/$defs/PromptReference",
+ "text": "#/$defs/PromptText"
+ },
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/$defs/PromptText"
+ },
+ {
+ "$ref": "#/$defs/PromptReference"
+ }
+ ],
+ "title": "Promptpart"
+ },
+ "publicModel": {
+ "$ref": "#/$defs/ModelConfigPublic",
+ "description": "Public model connection schema."
+ },
+ "writeModel": {
+ "$ref": "#/$defs/ModelConfigWrite",
+ "description": "Model configuration input schema."
+ },
+ "capabilities": {
+ "$ref": "#/$defs/NodeCapabilities",
+ "description": "Available canvas item operations."
+ },
+ "viewState": {
+ "$ref": "#/$defs/ViewState",
+ "description": "Client-specific canvas view state."
+ },
+ "timelinePackageManifest": {
+ "$ref": "#/$defs/TimelinePackageManifest",
+ "description": "Native editable timeline bundle manifest."
+ },
+ "timelinePackageImport": {
+ "$ref": "#/$defs/TimelinePackageImportRequest",
+ "description": "Recoverable native bundle import request."
+ },
+ "timelinePackageReceipt": {
+ "$ref": "#/$defs/TimelinePackageImportReceipt",
+ "description": "Native bundle import progress and final receipt."
+ },
+ "upload": {
+ "$ref": "#/$defs/UploadInfo",
+ "description": "Staged upload schema."
+ }
+ },
+ "required": [
+ "project",
+ "canvasItem",
+ "generationSpec",
+ "reference",
+ "editorDocument",
+ "command",
+ "receipt",
+ "query",
+ "event",
+ "job",
+ "result",
+ "snapshot",
+ "executionParameters",
+ "promptPart",
+ "publicModel",
+ "writeModel",
+ "capabilities",
+ "viewState",
+ "timelinePackageManifest",
+ "timelinePackageImport",
+ "timelinePackageReceipt",
+ "upload"
+ ],
+ "title": "CreationContracts",
+ "type": "object"
+ },
+ "DirectorApply": {
+ "additionalProperties": false,
+ "properties": {
+ "document": {
+ "$ref": "#/$defs/DirectorDocumentWrite",
+ "description": "Authoritative Director Stage document applied atomically."
+ }
+ },
+ "required": [
+ "document"
+ ],
+ "title": "DirectorApply",
+ "type": "object"
+ },
+ "DirectorApplyCommand": {
+ "additionalProperties": false,
+ "description": "Apply an authoritative Director Stage document atomically.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "director.apply",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/DirectorApply",
+ "description": "Apply an authoritative Director Stage document atomically."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "DirectorApplyCommand",
+ "type": "object"
+ },
+ "DirectorApplyCommandOperation": {
+ "additionalProperties": false,
+ "description": "Apply an authoritative Director Stage document atomically.",
+ "properties": {
+ "type": {
+ "const": "director.apply",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/DirectorApply",
+ "description": "Apply an authoritative Director Stage document atomically."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "DirectorApplyCommandOperation",
+ "type": "object"
+ },
+ "DirectorCameraDelete": {
+ "additionalProperties": false,
+ "properties": {
+ "documentId": {
+ "description": "Director Stage document that owns the camera.",
+ "format": "uuid",
+ "title": "Documentid",
+ "type": "string"
+ },
+ "cameraId": {
+ "description": "Camera to delete with its Storyboard blocks.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Cameraid",
+ "type": "string"
+ }
+ },
+ "required": [
+ "documentId",
+ "cameraId"
+ ],
+ "title": "DirectorCameraDelete",
+ "type": "object"
+ },
+ "DirectorCameraDeleteCommand": {
+ "additionalProperties": false,
+ "description": "Delete a non-final Director Stage camera and its Storyboard blocks atomically.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "director.camera.delete",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
+ {
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/DirectorCameraDelete",
+ "description": "Delete a non-final Director Stage camera and its Storyboard blocks atomically."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "DirectorCameraDeleteCommand",
+ "type": "object"
+ },
+ "DirectorCameraDeleteCommandOperation": {
+ "additionalProperties": false,
+ "description": "Delete a non-final Director Stage camera and its Storyboard blocks atomically.",
+ "properties": {
+ "type": {
+ "const": "director.camera.delete",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/DirectorCameraDelete",
+ "description": "Delete a non-final Director Stage camera and its Storyboard blocks atomically."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "DirectorCameraDeleteCommandOperation",
+ "type": "object"
+ },
+ "DirectorCanvasItem": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "kind": {
+ "const": "external",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "title": {
+ "default": "",
+ "description": "User-visible title.",
+ "maxLength": 255,
+ "title": "Title",
+ "type": "string"
+ },
+ "position": {
+ "$ref": "#/$defs/Point",
+ "description": "Position in the owning canvas or stage."
+ },
+ "width": {
+ "default": 352,
+ "description": "Width in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Width",
+ "type": "number"
+ },
+ "height": {
+ "default": 198,
+ "description": "Height in pixels.",
+ "exclusiveMinimum": 0,
+ "title": "Height",
+ "type": "number"
+ },
+ "zIndex": {
+ "default": 0,
+ "description": "Canvas stacking order.",
+ "title": "Zindex",
+ "type": "integer"
+ },
+ "locked": {
+ "default": false,
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
+ "type": "boolean"
+ },
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
+ },
+ "parentId": {
+ "anyOf": [
+ {
+ "format": "uuid",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Parent canvas group ID, or null for the root.",
+ "title": "Parentid"
+ },
+ "tags": {
+ "default": [],
+ "description": "User-defined search tags.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Tags",
+ "type": "array"
+ },
+ "binding": {
+ "$ref": "#/$defs/EditorBinding",
+ "description": "Business object displayed by this canvas item."
+ }
+ },
+ "required": [
+ "id",
+ "projectId",
+ "revision",
+ "kind",
+ "title",
+ "position",
+ "width",
+ "height",
+ "zIndex",
+ "locked",
+ "visible",
+ "parentId",
+ "tags",
+ "binding"
+ ],
+ "title": "DirectorCanvasItem",
+ "type": "object"
+ },
+ "DirectorData": {
+ "additionalProperties": false,
+ "properties": {
+ "background": {
+ "description": "Composition background color.",
+ "examples": [
+ "#000000"
+ ],
+ "pattern": "^#[0-9a-fA-F]{6}$",
+ "title": "Background",
+ "type": "string"
+ },
+ "grid": {
+ "default": true,
+ "description": "Whether to display the stage grid.",
+ "title": "Grid",
+ "type": "boolean"
+ },
+ "duration": {
+ "description": "Interval duration in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Duration",
+ "type": "number"
+ },
+ "fps": {
+ "default": 30,
+ "description": "Frames per second. 帧率。",
+ "enum": [
+ 24,
+ 25,
+ 30,
+ 50,
+ 60
+ ],
+ "title": "Fps",
+ "type": "integer"
+ },
+ "aspectRatio": {
+ "default": "16:9",
+ "description": "Output width-to-height ratio.",
+ "enum": [
+ "16:9",
+ "2.39:1",
+ "9:16",
+ "1:1",
+ "4:3",
+ "3:4"
+ ],
+ "title": "Aspectratio",
+ "type": "string"
+ },
+ "cameras": {
+ "description": "Editable stage cameras.",
+ "items": {
+ "$ref": "#/$defs/CameraRig"
+ },
+ "minItems": 1,
+ "title": "Cameras",
+ "type": "array"
+ },
+ "activeCameraId": {
+ "description": "Active stage camera ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Activecameraid",
+ "type": "string"
+ },
+ "cameraSource": {
+ "default": "camera",
+ "description": "Camera selection strategy.",
+ "enum": [
+ "camera",
+ "storyboard"
+ ],
+ "title": "Camerasource",
+ "type": "string"
+ },
+ "shots": {
+ "default": [],
+ "description": "Ordered camera shot intervals.",
+ "items": {
+ "$ref": "#/$defs/StageShot"
+ },
+ "title": "Shots",
+ "type": "array"
+ },
+ "objects": {
+ "default": [],
+ "description": "Editable stage objects.",
+ "items": {
+ "$ref": "#/$defs/StageObject"
+ },
+ "title": "Objects",
+ "type": "array"
+ },
+ "environment": {
+ "$ref": "#/$defs/StageEnvironment",
+ "description": "Authoritative environment reference and ground configuration. 权威环境引用和地面配置。"
+ },
+ "lights": {
+ "description": "The three retained stage lights. 舞台保留的三盏灯光。",
+ "items": {
+ "$ref": "#/$defs/StageLight"
+ },
+ "maxItems": 3,
+ "minItems": 3,
+ "title": "Lights",
+ "type": "array"
+ },
+ "stills": {
+ "default": [],
+ "description": "Captured still frames pinned as project image assets, oldest first.",
+ "items": {
+ "$ref": "#/$defs/AssetRef"
+ },
+ "title": "Stills",
+ "type": "array"
+ }
+ },
+ "required": [
+ "background",
+ "grid",
+ "duration",
+ "fps",
+ "aspectRatio",
+ "cameras",
+ "activeCameraId",
+ "cameraSource",
+ "shots",
+ "objects",
+ "environment",
+ "lights",
+ "stills"
+ ],
+ "title": "DirectorData",
+ "type": "object"
+ },
+ "DirectorDataWrite": {
+ "additionalProperties": false,
+ "description": "A Director Stage document entering the project through a command.\n\nIt has the same fields and dump as the stored ``DirectorData``. Shot relations are\nnot checked while the command is parsed: both HTTP and Agent entry points parse the\npayload before the application service runs, so checking here would reject the write\nwith a generic code before the write boundary could report the specific one. The\nstored model still validates the committed snapshot as the last line of defence.",
+ "properties": {
+ "background": {
+ "description": "Composition background color.",
+ "examples": [
+ "#000000"
+ ],
+ "pattern": "^#[0-9a-fA-F]{6}$",
+ "title": "Background",
+ "type": "string"
+ },
+ "grid": {
+ "default": true,
+ "description": "Whether to display the stage grid.",
+ "title": "Grid",
+ "type": "boolean"
+ },
+ "duration": {
+ "description": "Interval duration in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Duration",
+ "type": "number"
+ },
+ "fps": {
+ "default": 30,
+ "description": "Frames per second. 帧率。",
+ "enum": [
+ 24,
+ 25,
+ 30,
+ 50,
+ 60
+ ],
+ "title": "Fps",
+ "type": "integer"
+ },
+ "aspectRatio": {
+ "default": "16:9",
+ "description": "Output width-to-height ratio.",
+ "enum": [
+ "16:9",
+ "2.39:1",
+ "9:16",
+ "1:1",
+ "4:3",
+ "3:4"
+ ],
+ "title": "Aspectratio",
+ "type": "string"
+ },
+ "cameras": {
+ "description": "Editable stage cameras.",
+ "items": {
+ "$ref": "#/$defs/CameraRig"
+ },
+ "minItems": 1,
+ "title": "Cameras",
+ "type": "array"
+ },
+ "activeCameraId": {
+ "description": "Active stage camera ID.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Activecameraid",
+ "type": "string"
+ },
+ "cameraSource": {
+ "default": "camera",
+ "description": "Camera selection strategy.",
+ "enum": [
+ "camera",
+ "storyboard"
+ ],
+ "title": "Camerasource",
+ "type": "string"
+ },
+ "shots": {
+ "default": [],
+ "description": "Ordered camera shot intervals.",
+ "items": {
+ "$ref": "#/$defs/StageShot"
+ },
+ "title": "Shots",
+ "type": "array"
+ },
+ "objects": {
+ "default": [],
+ "description": "Editable stage objects.",
+ "items": {
+ "$ref": "#/$defs/StageObject"
+ },
+ "title": "Objects",
+ "type": "array"
+ },
+ "environment": {
+ "$ref": "#/$defs/StageEnvironment",
+ "description": "Authoritative environment reference and ground configuration. 权威环境引用和地面配置。"
+ },
+ "lights": {
+ "description": "The three retained stage lights. 舞台保留的三盏灯光。",
+ "items": {
+ "$ref": "#/$defs/StageLight"
+ },
+ "maxItems": 3,
+ "minItems": 3,
+ "title": "Lights",
+ "type": "array"
+ },
+ "stills": {
+ "default": [],
+ "description": "Captured still frames pinned as project image assets, oldest first.",
+ "items": {
+ "$ref": "#/$defs/AssetRef"
+ },
+ "title": "Stills",
+ "type": "array"
+ }
+ },
+ "required": [
+ "background",
+ "grid",
+ "duration",
+ "fps",
+ "aspectRatio",
+ "cameras",
+ "activeCameraId",
+ "cameraSource",
+ "shots",
+ "objects",
+ "environment",
+ "lights",
+ "stills"
+ ],
+ "title": "DirectorDataWrite",
+ "type": "object"
+ },
+ "DirectorDocument": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "schemaVersion": {
+ "const": 1,
+ "default": 1,
+ "description": "Record schema version.",
+ "title": "Schemaversion",
+ "type": "integer"
+ },
+ "inputConnections": {
+ "default": [],
+ "description": "Persisted connections to source assets.",
+ "items": {
+ "$ref": "#/$defs/EditorInputConnection"
+ },
+ "title": "Inputconnections",
+ "type": "array"
+ },
+ "kind": {
+ "const": "director",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "data": {
+ "$ref": "#/$defs/DirectorData",
+ "description": "Typed editable document contents."
+ }
+ },
+ "required": [
+ "id",
+ "projectId",
+ "revision",
+ "schemaVersion",
+ "inputConnections",
+ "kind",
+ "data"
+ ],
+ "title": "DirectorDocument",
+ "type": "object"
+ },
+ "DirectorDocumentWrite": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable identity of this project-owned object.",
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "revision": {
+ "default": 1,
+ "description": "Current object revision for optimistic concurrency.",
+ "minimum": 1,
+ "title": "Revision",
+ "type": "integer"
+ },
+ "schemaVersion": {
+ "const": 1,
+ "default": 1,
+ "description": "Record schema version.",
+ "title": "Schemaversion",
+ "type": "integer"
+ },
+ "inputConnections": {
+ "default": [],
+ "description": "Persisted connections to source assets.",
+ "items": {
+ "$ref": "#/$defs/EditorInputConnection"
+ },
+ "title": "Inputconnections",
+ "type": "array"
+ },
+ "kind": {
+ "const": "director",
+ "description": "Business object or media type.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "data": {
+ "$ref": "#/$defs/DirectorDataWrite",
+ "description": "Typed editable document contents."
+ }
+ },
+ "required": [
+ "id",
+ "projectId",
+ "revision",
+ "schemaVersion",
+ "inputConnections",
+ "kind",
+ "data"
+ ],
+ "title": "DirectorDocumentWrite",
+ "type": "object"
+ },
+ "DirectorDurationResult": {
+ "additionalProperties": false,
+ "properties": {
+ "documentId": {
+ "description": "Director Stage document whose main timeline was evaluated.",
+ "format": "uuid",
+ "title": "Documentid",
+ "type": "string"
+ },
+ "requestedDuration": {
+ "description": "Main timeline duration requested in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Requestedduration",
+ "type": "number"
+ },
+ "appliedDuration": {
+ "description": "Main timeline duration applied in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Appliedduration",
+ "type": "number"
+ },
+ "clampReason": {
+ "anyOf": [
{
- "$ref": "#/$defs/ResultSelectCommand"
+ "const": "storyboard_end",
+ "type": "string"
},
{
- "$ref": "#/$defs/EditorCreateCommand"
- },
+ "type": "null"
+ }
+ ],
+ "description": "Stable reason for a limited duration, or null.",
+ "title": "Clampreason"
+ }
+ },
+ "required": [
+ "documentId",
+ "requestedDuration",
+ "appliedDuration",
+ "clampReason"
+ ],
+ "title": "DirectorDurationResult",
+ "type": "object"
+ },
+ "DirectorOutputPlan": {
+ "additionalProperties": false,
+ "properties": {
+ "cameraSource": {
+ "description": "Camera selection strategy fixed for this render.",
+ "enum": [
+ "camera",
+ "storyboard"
+ ],
+ "title": "Camerasource",
+ "type": "string"
+ },
+ "cameraId": {
+ "anyOf": [
{
- "$ref": "#/$defs/EditorSaveCommand"
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
},
{
- "$ref": "#/$defs/HistoryUndoCommand"
- },
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Camera rig fixed for a camera render; omitted for storyboard renders.",
+ "title": "Cameraid"
+ },
+ "width": {
+ "description": "Expected output width in pixels.",
+ "minimum": 1,
+ "title": "Width",
+ "type": "integer"
+ },
+ "height": {
+ "description": "Expected output height in pixels.",
+ "minimum": 1,
+ "title": "Height",
+ "type": "integer"
+ },
+ "durationSeconds": {
+ "description": "Expected output duration in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Durationseconds",
+ "type": "number"
+ },
+ "frameRate": {
+ "description": "Expected output frames per second.",
+ "exclusiveMinimum": 0,
+ "title": "Framerate",
+ "type": "number"
+ }
+ },
+ "required": [
+ "cameraSource",
+ "cameraId",
+ "width",
+ "height",
+ "durationSeconds",
+ "frameRate"
+ ],
+ "title": "DirectorOutputPlan",
+ "type": "object"
+ },
+ "DirectorRenderEvidence": {
+ "additionalProperties": false,
+ "properties": {
+ "acceptedProjectCursor": {
+ "description": "Event cursor of the accepted project snapshot.",
+ "minimum": 1,
+ "title": "Acceptedprojectcursor",
+ "type": "integer"
+ },
+ "sourceEditorId": {
+ "description": "Editable Director Stage document fixed at acceptance.",
+ "format": "uuid",
+ "title": "Sourceeditorid",
+ "type": "string"
+ },
+ "sourceEditorRevision": {
+ "description": "Source stage revision fixed at acceptance.",
+ "minimum": 1,
+ "title": "Sourceeditorrevision",
+ "type": "integer"
+ },
+ "plan": {
+ "$ref": "#/$defs/DirectorOutputPlan",
+ "description": "The accepted camera strategy, output size, duration and frame rate."
+ }
+ },
+ "required": [
+ "acceptedProjectCursor",
+ "sourceEditorId",
+ "sourceEditorRevision",
+ "plan"
+ ],
+ "title": "DirectorRenderEvidence",
+ "type": "object"
+ },
+ "DirectorSetDuration": {
+ "additionalProperties": false,
+ "properties": {
+ "documentId": {
+ "description": "Director Stage document whose main timeline will change.",
+ "format": "uuid",
+ "title": "Documentid",
+ "type": "string"
+ },
+ "duration": {
+ "description": "Requested main timeline duration in seconds.",
+ "exclusiveMinimum": 0,
+ "title": "Duration",
+ "type": "number"
+ }
+ },
+ "required": [
+ "documentId",
+ "duration"
+ ],
+ "title": "DirectorSetDuration",
+ "type": "object"
+ },
+ "DirectorSetDurationCommand": {
+ "additionalProperties": false,
+ "description": "Set the Director Stage main timeline duration, preserving the Storyboard and animation.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "director.duration.set",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
{
- "$ref": "#/$defs/HistoryRedoCommand"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
- "$ref": "#/$defs/BatchCommand"
+ "type": "null"
}
],
- "title": "Command"
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "receipt": {
- "$ref": "#/$defs/CommandReceipt",
- "description": "Immutable command execution receipt."
+ "payload": {
+ "$ref": "#/$defs/DirectorSetDuration",
+ "description": "Set the Director Stage main timeline duration, preserving the Storyboard and animation."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "DirectorSetDurationCommand",
+ "type": "object"
+ },
+ "DirectorSetDurationCommandOperation": {
+ "additionalProperties": false,
+ "description": "Set the Director Stage main timeline duration, preserving the Storyboard and animation.",
+ "properties": {
+ "type": {
+ "const": "director.duration.set",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
},
- "query": {
- "description": "Read-only project query.",
- "discriminator": {
- "mapping": {
- "asset.preview": "#/$defs/AssetPreviewQuery",
- "asset.search": "#/$defs/AssetSearchQuery",
- "asset.usage": "#/$defs/AssetUsageQuery",
- "canvas.status": "#/$defs/CanvasStatusQuery",
- "canvas.versions": "#/$defs/VersionsQuery",
- "generationSpec.versions": "#/$defs/VersionsQuery",
- "job.get": "#/$defs/ObjectQuery",
- "object.get": "#/$defs/ObjectQuery",
- "project.get": "#/$defs/ProjectQuery"
- },
- "propertyName": "type"
+ "payload": {
+ "$ref": "#/$defs/DirectorSetDuration",
+ "description": "Set the Director Stage main timeline duration, preserving the Storyboard and animation."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "DirectorSetDurationCommandOperation",
+ "type": "object"
+ },
+ "DirectorStoryboardAppend": {
+ "additionalProperties": false,
+ "properties": {
+ "documentId": {
+ "description": "Director Stage document that receives the Storyboard block.",
+ "format": "uuid",
+ "title": "Documentid",
+ "type": "string"
+ },
+ "cameraId": {
+ "description": "Existing stage camera the new block references.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Cameraid",
+ "type": "string"
+ },
+ "blockId": {
+ "description": "Stable identity of the new Storyboard block; it must not be in use.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Blockid",
+ "type": "string"
+ }
+ },
+ "required": [
+ "documentId",
+ "cameraId",
+ "blockId"
+ ],
+ "title": "DirectorStoryboardAppend",
+ "type": "object"
+ },
+ "DirectorStoryboardAppendCommand": {
+ "additionalProperties": false,
+ "description": "Append an existing camera to the end of the continuous Director Stage Storyboard.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "director.storyboard.append",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
},
- "oneOf": [
- {
- "$ref": "#/$defs/ProjectQuery"
- },
- {
- "$ref": "#/$defs/ObjectQuery"
- },
- {
- "$ref": "#/$defs/VersionsQuery"
- },
- {
- "$ref": "#/$defs/AssetSearchQuery"
- },
- {
- "$ref": "#/$defs/AssetUsageQuery"
- },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
{
- "$ref": "#/$defs/CanvasStatusQuery"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
- "$ref": "#/$defs/AssetPreviewQuery"
+ "type": "null"
}
],
- "title": "Query"
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "event": {
- "$ref": "#/$defs/ProjectEvent",
- "description": "Project change event, if emitted."
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardAppend",
+ "description": "Append an existing camera to the end of the continuous Director Stage Storyboard."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "DirectorStoryboardAppendCommand",
+ "type": "object"
+ },
+ "DirectorStoryboardBlock": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable block identity.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Id",
+ "type": "string"
},
- "job": {
- "$ref": "#/$defs/Job",
- "description": "Generation execution record."
+ "cameraId": {
+ "description": "Stage camera the block references.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Cameraid",
+ "type": "string"
},
- "result": {
- "$ref": "#/$defs/ResultVersion",
- "description": "Generated result schema."
+ "order": {
+ "description": "Position in the stored Storyboard, starting at zero.",
+ "minimum": 0,
+ "title": "Order",
+ "type": "integer"
},
- "snapshot": {
- "$ref": "#/$defs/InputSnapshot",
- "description": "Fixed generation input schema."
+ "start": {
+ "description": "Block start in seconds, as stored.",
+ "minimum": 0,
+ "title": "Start",
+ "type": "number"
},
- "executionParameters": {
- "description": "Effective provider execution parameter schema.",
- "discriminator": {
- "mapping": {
- "audio": "#/$defs/AudioExecution",
- "image": "#/$defs/ImageExecution",
- "text": "#/$defs/TextExecution",
- "video": "#/$defs/VideoExecution"
- },
- "propertyName": "kind"
+ "duration": {
+ "description": "Block duration in seconds, as stored.",
+ "exclusiveMinimum": 0,
+ "title": "Duration",
+ "type": "number"
+ }
+ },
+ "required": [
+ "id",
+ "cameraId",
+ "order",
+ "start",
+ "duration"
+ ],
+ "title": "DirectorStoryboardBlock",
+ "type": "object"
+ },
+ "DirectorStoryboardDelete": {
+ "additionalProperties": false,
+ "properties": {
+ "documentId": {
+ "description": "Director Stage document that owns the Storyboard.",
+ "format": "uuid",
+ "title": "Documentid",
+ "type": "string"
+ },
+ "blockId": {
+ "description": "Storyboard block to delete.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Blockid",
+ "type": "string"
+ }
+ },
+ "required": [
+ "documentId",
+ "blockId"
+ ],
+ "title": "DirectorStoryboardDelete",
+ "type": "object"
+ },
+ "DirectorStoryboardDeleteCommand": {
+ "additionalProperties": false,
+ "description": "Delete a Storyboard block and shift later blocks without changing their durations.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "director.storyboard.delete",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
},
- "oneOf": [
- {
- "$ref": "#/$defs/TextExecution"
- },
- {
- "$ref": "#/$defs/ImageExecution"
- },
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
{
- "$ref": "#/$defs/VideoExecution"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
- "$ref": "#/$defs/AudioExecution"
+ "type": "null"
}
],
- "title": "Executionparameters"
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
+ },
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardDelete",
+ "description": "Delete a Storyboard block and shift later blocks without changing their durations."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "DirectorStoryboardDeleteCommand",
+ "type": "object"
+ },
+ "DirectorStoryboardDeleteCommandOperation": {
+ "additionalProperties": false,
+ "description": "Delete a Storyboard block and shift later blocks without changing their durations.",
+ "properties": {
+ "type": {
+ "const": "director.storyboard.delete",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardDelete",
+ "description": "Delete a Storyboard block and shift later blocks without changing their durations."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "DirectorStoryboardDeleteCommandOperation",
+ "type": "object"
+ },
+ "DirectorStoryboardQuery": {
+ "additionalProperties": false,
+ "properties": {
+ "queryId": {
+ "description": "Caller-supplied query ID.",
+ "format": "uuid",
+ "title": "Queryid",
+ "type": "string"
+ },
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "director.storyboard.get",
+ "description": "Read the stored Director Stage Storyboard and whether a block can be appended.",
+ "title": "Type",
+ "type": "string"
+ },
+ "objectId": {
+ "description": "Director Stage document ID.",
+ "format": "uuid",
+ "title": "Objectid",
+ "type": "string"
+ }
+ },
+ "required": [
+ "queryId",
+ "projectId",
+ "type",
+ "objectId"
+ ],
+ "title": "DirectorStoryboardQuery",
+ "type": "object"
+ },
+ "DirectorStoryboardReorder": {
+ "additionalProperties": false,
+ "properties": {
+ "documentId": {
+ "description": "Director Stage document that owns the Storyboard.",
+ "format": "uuid",
+ "title": "Documentid",
+ "type": "string"
+ },
+ "blockIds": {
+ "description": "Every Storyboard block ID exactly once, in the desired order.",
+ "items": {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ "title": "Blockids",
+ "type": "array"
+ }
+ },
+ "required": [
+ "documentId",
+ "blockIds"
+ ],
+ "title": "DirectorStoryboardReorder",
+ "type": "object"
+ },
+ "DirectorStoryboardReorderCommand": {
+ "additionalProperties": false,
+ "description": "Reorder the continuous Storyboard by block ID, preserving durations and camera references.",
+ "properties": {
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
+ "format": "uuid",
+ "title": "Commandid",
+ "type": "string"
},
- "promptPart": {
- "description": "Structured prompt token schema.",
- "discriminator": {
- "mapping": {
- "reference": "#/$defs/PromptReference",
- "text": "#/$defs/PromptText"
- },
- "propertyName": "type"
+ "projectId": {
+ "description": "Owning project ID.",
+ "format": "uuid",
+ "title": "Projectid",
+ "type": "string"
+ },
+ "type": {
+ "const": "director.storyboard.reorder",
+ "description": "Command discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
},
- "oneOf": [
+ "title": "Expectedversions",
+ "type": "array"
+ },
+ "expectedPreview": {
+ "anyOf": [
{
- "$ref": "#/$defs/PromptText"
+ "pattern": "^[0-9a-f]{64}$",
+ "type": "string"
},
{
- "$ref": "#/$defs/PromptReference"
+ "type": "null"
}
],
- "title": "Promptpart"
- },
- "publicModel": {
- "$ref": "#/$defs/ModelConfigPublic",
- "description": "Public model connection schema."
- },
- "writeModel": {
- "$ref": "#/$defs/ModelConfigWrite",
- "description": "Model configuration input schema."
- },
- "capabilities": {
- "$ref": "#/$defs/NodeCapabilities",
- "description": "Available canvas item operations."
- },
- "viewState": {
- "$ref": "#/$defs/ViewState",
- "description": "Client-specific canvas view state."
+ "default": null,
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "timelinePackageManifest": {
- "$ref": "#/$defs/TimelinePackageManifest",
- "description": "Native editable timeline bundle manifest."
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardReorder",
+ "description": "Reorder the continuous Storyboard by block ID, preserving durations and camera references."
+ }
+ },
+ "required": [
+ "commandId",
+ "projectId",
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "DirectorStoryboardReorderCommand",
+ "type": "object"
+ },
+ "DirectorStoryboardReorderCommandOperation": {
+ "additionalProperties": false,
+ "description": "Reorder the continuous Storyboard by block ID, preserving durations and camera references.",
+ "properties": {
+ "type": {
+ "const": "director.storyboard.reorder",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
},
- "timelinePackageImport": {
- "$ref": "#/$defs/TimelinePackageImportRequest",
- "description": "Recoverable native bundle import request."
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardReorder",
+ "description": "Reorder the continuous Storyboard by block ID, preserving durations and camera references."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
+ ],
+ "title": "DirectorStoryboardReorderCommandOperation",
+ "type": "object"
+ },
+ "DirectorStoryboardResize": {
+ "additionalProperties": false,
+ "properties": {
+ "documentId": {
+ "description": "Director Stage document that owns the Storyboard.",
+ "format": "uuid",
+ "title": "Documentid",
+ "type": "string"
},
- "timelinePackageReceipt": {
- "$ref": "#/$defs/TimelinePackageImportReceipt",
- "description": "Native bundle import progress and final receipt."
+ "blockId": {
+ "description": "Block that owns the boundary on its right.",
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "title": "Blockid",
+ "type": "string"
},
- "upload": {
- "$ref": "#/$defs/UploadInfo",
- "description": "Staged upload schema."
+ "duration": {
+ "description": "New duration of that block in seconds; must leave the Storyboard continuous and within the timeline.",
+ "title": "Duration",
+ "type": "number"
}
},
"required": [
- "project",
- "canvasItem",
- "generationSpec",
- "reference",
- "editorDocument",
- "command",
- "receipt",
- "query",
- "event",
- "job",
- "result",
- "snapshot",
- "executionParameters",
- "promptPart",
- "publicModel",
- "writeModel",
- "capabilities",
- "viewState",
- "timelinePackageManifest",
- "timelinePackageImport",
- "timelinePackageReceipt",
- "upload"
+ "documentId",
+ "blockId",
+ "duration"
],
- "title": "CreationContracts",
+ "title": "DirectorStoryboardResize",
"type": "object"
},
- "DirectorCanvasItem": {
+ "DirectorStoryboardResizeCommand": {
"additionalProperties": false,
+ "description": "Resize the given block and shift all subsequent blocks, preserving their durations.",
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
+ "commandId": {
+ "description": "Stable command ID for idempotent replay.",
"format": "uuid",
- "title": "Id",
+ "title": "Commandid",
"type": "string"
},
"projectId": {
@@ -19384,66 +23166,25 @@
"title": "Projectid",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
- "minimum": 1,
- "title": "Revision",
- "type": "integer"
- },
- "kind": {
- "const": "external",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
- },
- "title": {
- "default": "",
- "description": "User-visible title.",
- "maxLength": 255,
- "title": "Title",
+ "type": {
+ "const": "director.storyboard.resize",
+ "description": "Command discriminator.",
+ "title": "Type",
"type": "string"
},
- "position": {
- "$ref": "#/$defs/Point",
- "description": "Position in the owning canvas or stage."
- },
- "width": {
- "default": 352,
- "description": "Width in pixels.",
- "exclusiveMinimum": 0,
- "title": "Width",
- "type": "number"
- },
- "height": {
- "default": 198,
- "description": "Height in pixels.",
- "exclusiveMinimum": 0,
- "title": "Height",
- "type": "number"
- },
- "zIndex": {
- "default": 0,
- "description": "Canvas stacking order.",
- "title": "Zindex",
- "type": "integer"
- },
- "locked": {
- "default": false,
- "description": "Whether edits to this object are blocked.",
- "title": "Locked",
- "type": "boolean"
- },
- "visible": {
- "default": true,
- "description": "Whether this object is displayed.",
- "title": "Visible",
- "type": "boolean"
+ "expectedVersions": {
+ "default": [],
+ "description": "Current versions of mutated existing objects; payload revision fields do not replace these.",
+ "items": {
+ "$ref": "#/$defs/ObjectVersion"
+ },
+ "title": "Expectedversions",
+ "type": "array"
},
- "parentId": {
+ "expectedPreview": {
"anyOf": [
{
- "format": "uuid",
+ "pattern": "^[0-9a-f]{64}$",
"type": "string"
},
{
@@ -19451,198 +23192,245 @@
}
],
"default": null,
- "description": "Parent canvas group ID, or null for the root.",
- "title": "Parentid"
- },
- "tags": {
- "default": [],
- "description": "User-defined search tags.",
- "items": {
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "type": "string"
- },
- "title": "Tags",
- "type": "array"
+ "description": "Fingerprint of the confirmed impact preview.",
+ "title": "Expectedpreview"
},
- "binding": {
- "$ref": "#/$defs/EditorBinding",
- "description": "Business object displayed by this canvas item."
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardResize",
+ "description": "Resize the given block and shift all subsequent blocks, preserving their durations."
}
},
"required": [
- "id",
+ "commandId",
"projectId",
- "revision",
- "kind",
- "title",
- "position",
- "width",
- "height",
- "zIndex",
- "locked",
- "visible",
- "parentId",
- "tags",
- "binding"
+ "type",
+ "expectedVersions",
+ "expectedPreview",
+ "payload"
+ ],
+ "title": "DirectorStoryboardResizeCommand",
+ "type": "object"
+ },
+ "DirectorStoryboardResizeCommandOperation": {
+ "additionalProperties": false,
+ "description": "Resize the given block and shift all subsequent blocks, preserving their durations.",
+ "properties": {
+ "type": {
+ "const": "director.storyboard.resize",
+ "description": "Operation discriminator.",
+ "title": "Type",
+ "type": "string"
+ },
+ "payload": {
+ "$ref": "#/$defs/DirectorStoryboardResize",
+ "description": "Resize the given block and shift all subsequent blocks, preserving their durations."
+ }
+ },
+ "required": [
+ "type",
+ "payload"
],
- "title": "DirectorCanvasItem",
+ "title": "DirectorStoryboardResizeCommandOperation",
"type": "object"
},
- "DirectorData": {
+ "DirectorStoryboardResult": {
"additionalProperties": false,
"properties": {
- "background": {
- "description": "Composition background color.",
- "pattern": "^#[0-9a-fA-F]{6}$",
- "title": "Background",
- "type": "string"
- },
- "grid": {
- "default": true,
- "description": "Whether to display the stage grid.",
- "title": "Grid",
- "type": "boolean"
- },
- "duration": {
- "description": "Interval duration in seconds.",
- "exclusiveMinimum": 0,
- "title": "Duration",
- "type": "number"
+ "operationIndex": {
+ "description": "Zero-based position in the command or batch.",
+ "minimum": 0,
+ "title": "Operationindex",
+ "type": "integer"
},
- "aspectRatio": {
- "default": "16:9",
- "description": "Output width-to-height ratio.",
+ "operation": {
+ "description": "Storyboard or related operation evaluated.",
"enum": [
- "16:9",
- "9:16",
- "1:1",
- "4:3",
- "3:4"
+ "director.storyboard.append",
+ "director.storyboard.reorder",
+ "director.storyboard.resize",
+ "director.storyboard.delete",
+ "director.camera.delete",
+ "director.duration.set"
],
- "title": "Aspectratio",
+ "title": "Operation",
"type": "string"
},
- "cameras": {
- "description": "Editable stage cameras.",
+ "documentId": {
+ "description": "Director Stage document that owns the Storyboard.",
+ "format": "uuid",
+ "title": "Documentid",
+ "type": "string"
+ },
+ "version": {
+ "description": "Committed document revision for the enclosing transaction.",
+ "minimum": 1,
+ "title": "Version",
+ "type": "integer"
+ },
+ "blocks": {
+ "description": "Block identities, order and stored times after this operation, before subsequent batch operations.",
"items": {
- "$ref": "#/$defs/CameraRig"
+ "$ref": "#/$defs/DirectorStoryboardBlock"
},
- "minItems": 1,
- "title": "Cameras",
+ "title": "Blocks",
"type": "array"
},
- "activeCameraId": {
- "description": "Active stage camera ID.",
- "maxLength": 100,
- "minLength": 1,
- "pattern": "\\S",
- "title": "Activecameraid",
- "type": "string"
- },
- "cameraSource": {
- "default": "camera",
- "description": "Camera selection strategy.",
- "enum": [
- "camera",
- "storyboard"
- ],
- "title": "Camerasource",
- "type": "string"
- },
- "shots": {
- "default": [],
- "description": "Ordered camera shot intervals.",
+ "affectedBlockIds": {
+ "description": "New or changed surviving block IDs, in resulting order.",
"items": {
- "$ref": "#/$defs/StageShot"
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
},
- "title": "Shots",
+ "title": "Affectedblockids",
"type": "array"
},
- "objects": {
- "default": [],
- "description": "Editable stage objects.",
+ "removedBlockIds": {
+ "description": "Removed block IDs, in their previous order.",
"items": {
- "$ref": "#/$defs/StageObject"
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
},
- "title": "Objects",
+ "title": "Removedblockids",
"type": "array"
+ },
+ "blockId": {
+ "anyOf": [
+ {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Block explicitly targeted by the operation, when applicable.",
+ "title": "Blockid"
+ },
+ "cameraId": {
+ "anyOf": [
+ {
+ "maxLength": 100,
+ "minLength": 1,
+ "pattern": "\\S",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Camera explicitly targeted by the operation, when applicable.",
+ "title": "Cameraid"
+ },
+ "appendLimitReason": {
+ "anyOf": [
+ {
+ "const": "storyboard_tail",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Stable reason a new block is shorter than the default duration, or null.",
+ "title": "Appendlimitreason"
}
},
"required": [
- "background",
- "grid",
- "duration",
- "aspectRatio",
- "cameras",
- "activeCameraId",
- "cameraSource",
- "shots",
- "objects"
+ "operationIndex",
+ "operation",
+ "documentId",
+ "version",
+ "blocks",
+ "affectedBlockIds",
+ "removedBlockIds",
+ "blockId",
+ "cameraId",
+ "appendLimitReason"
],
- "title": "DirectorData",
+ "title": "DirectorStoryboardResult",
"type": "object"
},
- "DirectorDocument": {
+ "DirectorStoryboardState": {
"additionalProperties": false,
"properties": {
- "id": {
- "description": "Stable identity of this project-owned object.",
- "format": "uuid",
- "title": "Id",
- "type": "string"
- },
- "projectId": {
- "description": "Owning project ID.",
+ "documentId": {
+ "description": "Director Stage document that owns the Storyboard.",
"format": "uuid",
- "title": "Projectid",
+ "title": "Documentid",
"type": "string"
},
- "revision": {
- "default": 1,
- "description": "Current object revision for optimistic concurrency.",
+ "version": {
+ "description": "Current revision of the Director Stage document.",
"minimum": 1,
- "title": "Revision",
+ "title": "Version",
"type": "integer"
},
- "schemaVersion": {
- "const": 1,
- "default": 1,
- "description": "Record schema version.",
- "title": "Schemaversion",
- "type": "integer"
+ "storyboardEnd": {
+ "description": "End of the last block in seconds; zero when the Storyboard is empty.",
+ "minimum": 0,
+ "title": "Storyboardend",
+ "type": "number"
},
- "inputConnections": {
- "default": [],
- "description": "Persisted connections to source assets.",
+ "canAppend": {
+ "description": "Whether a block can be appended in the main-timeline time that remains.",
+ "title": "Canappend",
+ "type": "boolean"
+ },
+ "cannotAppendReason": {
+ "anyOf": [
+ {
+ "enum": [
+ "storyboard_leading_gap",
+ "storyboard_internal_gap",
+ "storyboard_overlap",
+ "storyboard_exceeds_duration",
+ "storyboard_duration_invalid",
+ "storyboard_camera_unknown",
+ "storyboard_block_invalid",
+ "storyboard_block_exists",
+ "storyboard_exhausted",
+ "storyboard_order_invalid",
+ "storyboard_block_unknown",
+ "director_camera_unknown",
+ "director_camera_required"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Stable reason no block can be appended; null when one can.",
+ "title": "Cannotappendreason"
+ },
+ "blocks": {
+ "description": "Storyboard blocks in stored order, reported as stored.",
"items": {
- "$ref": "#/$defs/EditorInputConnection"
+ "$ref": "#/$defs/DirectorStoryboardBlock"
},
- "title": "Inputconnections",
+ "title": "Blocks",
"type": "array"
- },
- "kind": {
- "const": "director",
- "description": "Business object or media type.",
- "title": "Kind",
- "type": "string"
- },
- "data": {
- "$ref": "#/$defs/DirectorData",
- "description": "Typed editable document contents."
}
},
"required": [
- "id",
- "projectId",
- "revision",
- "schemaVersion",
- "inputConnections",
- "kind",
- "data"
+ "documentId",
+ "version",
+ "storyboardEnd",
+ "canAppend",
+ "cannotAppendReason",
+ "blocks"
],
- "title": "DirectorDocument",
+ "title": "DirectorStoryboardState",
"type": "object"
},
"EditorBinding": {
@@ -20099,7 +23887,7 @@
"description": "Editable document owned by this operation.",
"discriminator": {
"mapping": {
- "director": "#/$defs/DirectorDocument",
+ "director": "#/$defs/DirectorDocumentWrite",
"image_crop": "#/$defs/ImageCropDocument",
"layers": "#/$defs/LayerDocument",
"media_edit": "#/$defs/MediaEditDocument",
@@ -20130,7 +23918,7 @@
"$ref": "#/$defs/ToolDocument"
},
{
- "$ref": "#/$defs/DirectorDocument"
+ "$ref": "#/$defs/DirectorDocumentWrite"
},
{
"$ref": "#/$defs/MediaEditDocument"
@@ -23522,6 +27310,20 @@
"description": "Video frames per second.",
"title": "Framerate"
},
+ "frameCount": {
+ "anyOf": [
+ {
+ "minimum": 1,
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Number of video frames reported by the media container.",
+ "title": "Framecount"
+ },
"hasAudio": {
"anyOf": [
{
@@ -23562,6 +27364,35 @@
"default": null,
"description": "Audio channel count.",
"title": "Channels"
+ },
+ "selfContained": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether a model container embeds all its buffers and images.",
+ "title": "Selfcontained"
+ },
+ "animationNames": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Animation clip names declared by a parsed model container, in document order.",
+ "title": "Animationnames"
}
},
"required": [
@@ -23573,7 +27404,9 @@
"frameRate",
"hasAudio",
"sampleRate",
- "channels"
+ "channels",
+ "selfContained",
+ "animationNames"
],
"title": "MediaMetadata",
"type": "object"
@@ -25509,6 +29342,9 @@
},
"color": {
"description": "Serialized display color.",
+ "examples": [
+ "#000000"
+ ],
"pattern": "^#[0-9a-fA-F]{6}$",
"title": "Color",
"type": "string"
@@ -26947,19 +30783,81 @@
}
},
"required": [
- "id",
- "projectId",
- "revision",
- "schemaVersion",
- "inputConnections",
+ "id",
+ "projectId",
+ "revision",
+ "schemaVersion",
+ "inputConnections",
+ "kind",
+ "data"
+ ],
+ "title": "StackDocument",
+ "type": "object"
+ },
+ "StageBezierTransition": {
+ "additionalProperties": false,
+ "properties": {
+ "kind": {
+ "const": "bezier",
+ "description": "Cubic Bezier interpolation for the outgoing segment.",
+ "title": "Kind",
+ "type": "string"
+ },
+ "controlPoints": {
+ "description": "Normalized x1, y1, x2 and y2 control points.",
+ "maxItems": 4,
+ "minItems": 4,
+ "prefixItems": [
+ {
+ "maximum": 1,
+ "minimum": 0,
+ "type": "number"
+ },
+ {
+ "maximum": 1,
+ "minimum": 0,
+ "type": "number"
+ },
+ {
+ "maximum": 1,
+ "minimum": 0,
+ "type": "number"
+ },
+ {
+ "maximum": 1,
+ "minimum": 0,
+ "type": "number"
+ }
+ ],
+ "title": "Controlpoints",
+ "type": "array"
+ }
+ },
+ "required": [
"kind",
- "data"
+ "controlPoints"
],
- "title": "StackDocument",
+ "title": "StageBezierTransition",
"type": "object"
},
"StageCamera": {
"additionalProperties": false,
+ "examples": [
+ {
+ "fov": 45,
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 1
+ },
+ "roll": 0,
+ "target": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ ],
"properties": {
"position": {
"$ref": "#/$defs/Vector3",
@@ -26975,16 +30873,137 @@
"exclusiveMinimum": 0,
"title": "Fov",
"type": "number"
+ },
+ "roll": {
+ "default": 0.0,
+ "description": "Roll around the view axis in radians.",
+ "maximum": 3.141592653589793,
+ "minimum": -3.141592653589793,
+ "title": "Roll",
+ "type": "number"
}
},
"required": [
"position",
"target",
- "fov"
+ "fov",
+ "roll"
],
"title": "StageCamera",
"type": "object"
},
+ "StageEnvironment": {
+ "additionalProperties": false,
+ "description": "The named environment used by the retained Director scene.",
+ "properties": {
+ "preset": {
+ "default": "studio",
+ "description": "Environment preset reference. 环境预设引用。",
+ "enum": [
+ "studio",
+ "warm-sunset",
+ "moonlit"
+ ],
+ "title": "Preset",
+ "type": "string"
+ },
+ "groundColor": {
+ "default": "#181818",
+ "description": "Ground plane color. 地面颜色。",
+ "examples": [
+ "#000000"
+ ],
+ "pattern": "^#[0-9a-fA-F]{6}$",
+ "title": "Groundcolor",
+ "type": "string"
+ },
+ "groundVisible": {
+ "default": true,
+ "description": "Whether the ground plane is visible. 是否显示地面。",
+ "title": "Groundvisible",
+ "type": "boolean"
+ },
+ "exposure": {
+ "default": 1.0,
+ "description": "Scene exposure from zero to four. 场景曝光范围为 0 到 4。",
+ "maximum": 4,
+ "minimum": 0,
+ "title": "Exposure",
+ "type": "number"
+ },
+ "backgroundAsset": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AssetRef"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional registered image asset used as the stage background. 可选的已登记图片背景素材。"
+ }
+ },
+ "required": [
+ "preset",
+ "groundColor",
+ "groundVisible",
+ "exposure",
+ "backgroundAsset"
+ ],
+ "title": "StageEnvironment",
+ "type": "object"
+ },
+ "StageLight": {
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "description": "Stable light role. 稳定灯光角色。",
+ "enum": [
+ "hemisphere",
+ "key",
+ "fill"
+ ],
+ "title": "Id",
+ "type": "string"
+ },
+ "color": {
+ "description": "Light color in #RRGGBB format. 灯光颜色。",
+ "examples": [
+ "#000000"
+ ],
+ "pattern": "^#[0-9a-fA-F]{6}$",
+ "title": "Color",
+ "type": "string"
+ },
+ "intensity": {
+ "description": "Light intensity from zero to ten. 灯光强度范围为 0 到 10。",
+ "maximum": 10,
+ "minimum": 0,
+ "title": "Intensity",
+ "type": "number"
+ },
+ "position": {
+ "$ref": "#/$defs/Vector3",
+ "description": "Light position in stage coordinates. 灯光在舞台坐标中的位置。"
+ },
+ "castShadow": {
+ "default": false,
+ "description": "Whether the light casts shadows. 是否投射阴影。",
+ "title": "Castshadow",
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "id",
+ "color",
+ "intensity",
+ "position",
+ "castShadow"
+ ],
+ "title": "StageLight",
+ "type": "object"
+ },
"StageMotion": {
"additionalProperties": false,
"properties": {
@@ -27049,7 +31068,17 @@
"enum": [
"person",
"box",
- "sphere"
+ "sphere",
+ "gltf",
+ "cylinder",
+ "cone",
+ "pyramid",
+ "torus",
+ "plane",
+ "capsule",
+ "disk",
+ "arc",
+ "halfCylinder"
],
"title": "Kind",
"type": "string"
@@ -27062,10 +31091,33 @@
},
"color": {
"description": "Serialized display color.",
+ "examples": [
+ "#000000"
+ ],
"pattern": "^#[0-9a-fA-F]{6}$",
"title": "Color",
"type": "string"
},
+ "visible": {
+ "default": true,
+ "description": "Whether this object is displayed.",
+ "title": "Visible",
+ "type": "boolean"
+ },
+ "locked": {
+ "default": false,
+ "description": "Whether edits to this object are blocked.",
+ "title": "Locked",
+ "type": "boolean"
+ },
+ "opacity": {
+ "default": 1,
+ "description": "Layer opacity from zero to one.",
+ "maximum": 1,
+ "minimum": 0,
+ "title": "Opacity",
+ "type": "number"
+ },
"keyframes": {
"default": [],
"description": "Ordered animation keyframes.",
@@ -27083,6 +31135,79 @@
},
"title": "Motionclips",
"type": "array"
+ },
+ "asset": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AssetRef"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Registered GLB or self-contained GLTF asset for an imported stage object."
+ },
+ "thumbnailAsset": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AssetRef"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Registered image asset used by the stage object card thumbnail."
+ },
+ "role": {
+ "anyOf": [
+ {
+ "enum": [
+ "character",
+ "scene"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Imported stage object role.",
+ "title": "Role"
+ },
+ "format": {
+ "anyOf": [
+ {
+ "enum": [
+ "glb",
+ "gltf"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Imported stage asset container format.",
+ "title": "Format"
+ },
+ "animationNames": {
+ "default": [],
+ "description": "Animation clip names discovered in the imported asset.",
+ "items": {
+ "type": "string"
+ },
+ "title": "Animationnames",
+ "type": "array"
+ },
+ "hasAnimation": {
+ "default": false,
+ "description": "Whether the imported asset contains animation clips.",
+ "title": "Hasanimation",
+ "type": "boolean"
}
},
"required": [
@@ -27093,8 +31218,17 @@
"kind",
"name",
"color",
+ "visible",
+ "locked",
+ "opacity",
"keyframes",
- "motionClips"
+ "motionClips",
+ "asset",
+ "thumbnailAsset",
+ "role",
+ "format",
+ "animationNames",
+ "hasAnimation"
],
"title": "StageObject",
"type": "object"
@@ -27164,6 +31298,54 @@
"title": "StageTransform",
"type": "object"
},
+ "StageTransformTransitions": {
+ "additionalProperties": false,
+ "properties": {
+ "position": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/StageBezierTransition"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Outgoing position interpolation."
+ },
+ "rotation": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/StageBezierTransition"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Outgoing rotation interpolation."
+ },
+ "scale": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/StageBezierTransition"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Outgoing scale interpolation."
+ }
+ },
+ "required": [
+ "position",
+ "rotation",
+ "scale"
+ ],
+ "title": "StageTransformTransitions",
+ "type": "object"
+ },
"SubjectCanvasItem": {
"additionalProperties": false,
"properties": {
@@ -27794,6 +31976,9 @@
},
"color": {
"description": "Serialized display color.",
+ "examples": [
+ "#000000"
+ ],
"pattern": "^#[0-9a-fA-F]{6}$",
"title": "Color",
"type": "string"
@@ -28706,6 +32891,9 @@
"properties": {
"color": {
"description": "Background color in #RRGGBB format.",
+ "examples": [
+ "#000000"
+ ],
"pattern": "^#[0-9a-fA-F]{6}$",
"title": "Color",
"type": "string"
@@ -28829,6 +33017,9 @@
"properties": {
"color": {
"description": "Stroke color in #RRGGBB format.",
+ "examples": [
+ "#000000"
+ ],
"pattern": "^#[0-9a-fA-F]{6}$",
"title": "Color",
"type": "string"
@@ -28860,6 +33051,9 @@
},
"color": {
"description": "Text color in #RRGGBB format.",
+ "examples": [
+ "#000000"
+ ],
"pattern": "^#[0-9a-fA-F]{6}$",
"title": "Color",
"type": "string"
@@ -29342,12 +33536,47 @@
"value": {
"$ref": "#/$defs/StageTransform",
"description": "Keyframed transform or camera pose."
+ },
+ "keyedChannels": {
+ "anyOf": [
+ {
+ "items": {
+ "enum": [
+ "position",
+ "rotation",
+ "scale"
+ ],
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Transform properties explicitly keyed at this frame.",
+ "title": "Keyedchannels"
+ },
+ "transitions": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/StageTransformTransitions"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Per-property interpolation for the outgoing segment."
}
},
"required": [
"id",
"time",
- "value"
+ "value",
+ "keyedChannels",
+ "transitions"
],
"title": "TransformFrame",
"type": "object"
@@ -30621,6 +34850,13 @@
"canvas.show": "#/$defs/CanvasShowCommand",
"canvas.update": "#/$defs/CanvasUpdateCommand",
"creation.batch": "#/$defs/BatchCommand",
+ "director.apply": "#/$defs/DirectorApplyCommand",
+ "director.camera.delete": "#/$defs/DirectorCameraDeleteCommand",
+ "director.duration.set": "#/$defs/DirectorSetDurationCommand",
+ "director.storyboard.append": "#/$defs/DirectorStoryboardAppendCommand",
+ "director.storyboard.delete": "#/$defs/DirectorStoryboardDeleteCommand",
+ "director.storyboard.reorder": "#/$defs/DirectorStoryboardReorderCommand",
+ "director.storyboard.resize": "#/$defs/DirectorStoryboardResizeCommand",
"editor.create": "#/$defs/EditorCreateCommand",
"editor.save": "#/$defs/EditorSaveCommand",
"generation.submit": "#/$defs/GenerationSubmitCommand",
@@ -30758,6 +34994,27 @@
{
"$ref": "#/$defs/EditorSaveCommand"
},
+ {
+ "$ref": "#/$defs/DirectorApplyCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardAppendCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardReorderCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardResizeCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardDeleteCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorSetDurationCommand"
+ },
+ {
+ "$ref": "#/$defs/DirectorCameraDeleteCommand"
+ },
{
"$ref": "#/$defs/HistoryUndoCommand"
},
@@ -30783,6 +35040,7 @@
"asset.usage": "#/$defs/AssetUsageQuery",
"canvas.status": "#/$defs/CanvasStatusQuery",
"canvas.versions": "#/$defs/VersionsQuery",
+ "director.storyboard.get": "#/$defs/DirectorStoryboardQuery",
"generationSpec.versions": "#/$defs/VersionsQuery",
"job.get": "#/$defs/ObjectQuery",
"object.get": "#/$defs/ObjectQuery",
@@ -30811,6 +35069,9 @@
},
{
"$ref": "#/$defs/AssetPreviewQuery"
+ },
+ {
+ "$ref": "#/$defs/DirectorStoryboardQuery"
}
],
"title": "Query"
diff --git a/src/contracts/generated.ts b/src/contracts/generated.ts
index 8cf9b8972..c92df6331 100644
--- a/src/contracts/generated.ts
+++ b/src/contracts/generated.ts
@@ -66,6 +66,7 @@ export interface AssetProvenanceInput extends ContractInput {
readonly sourceItemId?: string | null;
readonly editorDocumentId?: string | null;
readonly editorRevision?: number | null;
+ readonly directorRender?: DirectorRenderEvidenceInput | null;
readonly sources?: ReadonlyArray;
readonly inputFingerprint?: string | null;
readonly agentRunId?: string | null;
@@ -147,7 +148,14 @@ export interface BatchCommandInput extends CommandBaseInput {
}
export interface BatchPayloadInput extends ContractInput {
- readonly operations: ReadonlyArray;
+ readonly operations: ReadonlyArray;
+}
+
+export interface CameraChannelsInput extends ContractInput {
+ readonly position?: ReadonlyArray;
+ readonly target?: ReadonlyArray;
+ readonly up?: ReadonlyArray;
+ readonly focalLength?: ReadonlyArray;
}
export interface CameraFrameInput extends ContractInput {
@@ -156,11 +164,27 @@ export interface CameraFrameInput extends ContractInput {
readonly value: StageCameraInput;
}
+export interface CameraNumberFrameInput extends ContractInput {
+ readonly id: string;
+ readonly time: number;
+ readonly value: number;
+ readonly transition?: StageBezierTransitionInput | null;
+}
+
export interface CameraRigInput extends ContractInput {
readonly id: string;
readonly name: string;
+ readonly aspectRatio?: "16:9" | "2.39:1" | "9:16" | "1:1" | "4:3" | "3:4";
readonly pose: StageCameraInput;
readonly keyframes?: ReadonlyArray;
+ readonly channels?: CameraChannelsInput;
+}
+
+export interface CameraVectorFrameInput extends ContractInput {
+ readonly id: string;
+ readonly time: number;
+ readonly value: Vector3Input;
+ readonly transition?: StageBezierTransitionInput | null;
}
export interface CanvasApplyEditInput extends ContractInput {
@@ -313,6 +337,8 @@ export interface CanvasPublishMediaInput extends ContractInput {
readonly source?: AssetRefInput | null;
readonly sourceEditorId?: string | null;
readonly document: TimelineDocumentInput | SubjectDocumentInput | LayerDocumentInput | ImageCropDocumentInput | StackDocumentInput | ToolDocumentInput | DirectorDocumentInput | MediaEditDocumentInput;
+ readonly directorPlan?: DirectorOutputPlanInput | null;
+ readonly directorAcceptedAt?: number | null;
readonly outputs: ReadonlyArray;
}
@@ -377,6 +403,8 @@ export interface CommandReceiptInput extends ContractInput {
readonly changed?: ReadonlyArray;
readonly jobIds?: ReadonlyArray;
readonly issues?: ReadonlyArray;
+ readonly directorDurations?: ReadonlyArray;
+ readonly directorStoryboard?: ReadonlyArray;
readonly eventCursor?: number | null;
}
@@ -388,7 +416,7 @@ export interface ContractInput {
}
export interface ContractIssueInput extends ContractInput {
- readonly code: "timeline_package_invalid" | "timeline_package_too_large" | "timeline_revision_missing" | "timeline_import_missing" | "timeline_import_conflict" | "timeline_registration_rejected" | "timeline_font_too_large" | "timeline_font_unavailable" | "timeline_font_unsupported" | "timeline_font_invalid" | "timeline_font_fingerprint" | "timeline_font_coverage" | "timeline_font_total_bytes" | "timeline_font_unverified" | "timeline_font_mime" | "timeline_bundled_font_fingerprint" | "timeline_bundled_font_unavailable" | "invalid_input" | "revision_conflict" | "role_restricted" | "missing_object" | "reference_invalid" | "image_quality_unsupported" | "bigmodel_video_model" | "bigmodel_video_output" | "bigmodel_video_image" | "bigmodel_video_frames" | "bigmodel_video_prompt" | "bigmodel_video_cancel" | "kling_model" | "kling_mode" | "kling_image" | "kling_frames" | "kling_prompt" | "kling_aspect" | "kling_output" | "kling_cancel" | "capability_unsupported" | "preview_expired" | "storage_unavailable" | "submission_unknown" | "provider_error" | "moss_speech_text" | "moss_speech_voice" | "moss_speech_reference" | "moss_prompt_limit" | "moss_image_size" | "moss_image_reference" | "moss_layout_reference" | "bigmodel_image_size" | "bigmodel_image_reference" | "bigmodel_image_prompt" | "minimax_image_reference" | "minimax_image_count" | "minimax_image_bytes" | "minimax_speech_text" | "minimax_speech_voice" | "minimax_speech_reference" | "minimax_speech_model" | "zhipu_speech_text" | "zhipu_speech_voice" | "zhipu_speech_reference" | "voice_library_unsupported" | "voice_connection_changed" | "voice_reference_required" | "voice_transcript_required" | "voice_transcript_too_long" | "voice_description_too_long" | "voice_not_found" | "voice_delete_unsupported" | "voice_consent_required" | "voice_name_invalid" | "voice_audio_invalid" | "voice_format" | "voice_size" | "voice_duration" | "voice_provider_protocol" | "voice_provider_error" | "voice_provider_timeout" | "voice_model_unsupported" | "voice_name_taken" | "voice_provider_quota";
+ readonly code: "timeline_package_invalid" | "timeline_package_too_large" | "timeline_revision_missing" | "timeline_import_missing" | "timeline_import_conflict" | "timeline_registration_rejected" | "timeline_font_too_large" | "timeline_font_unavailable" | "timeline_font_unsupported" | "timeline_font_invalid" | "timeline_font_fingerprint" | "timeline_font_coverage" | "timeline_font_total_bytes" | "timeline_font_unverified" | "timeline_font_mime" | "timeline_bundled_font_fingerprint" | "timeline_bundled_font_unavailable" | "storyboard_leading_gap" | "storyboard_internal_gap" | "storyboard_overlap" | "storyboard_exceeds_duration" | "storyboard_duration_invalid" | "storyboard_camera_unknown" | "storyboard_block_invalid" | "storyboard_block_exists" | "storyboard_exhausted" | "storyboard_order_invalid" | "storyboard_block_unknown" | "director_camera_unknown" | "director_camera_required" | "invalid_input" | "revision_conflict" | "role_restricted" | "missing_object" | "reference_invalid" | "image_quality_unsupported" | "bigmodel_video_model" | "bigmodel_video_output" | "bigmodel_video_image" | "bigmodel_video_frames" | "bigmodel_video_prompt" | "bigmodel_video_cancel" | "kling_model" | "kling_mode" | "kling_image" | "kling_frames" | "kling_prompt" | "kling_aspect" | "kling_output" | "kling_cancel" | "capability_unsupported" | "preview_expired" | "storage_unavailable" | "submission_unknown" | "provider_error" | "moss_speech_text" | "moss_speech_voice" | "moss_speech_reference" | "moss_prompt_limit" | "moss_image_size" | "moss_image_reference" | "moss_layout_reference" | "bigmodel_image_size" | "bigmodel_image_reference" | "bigmodel_image_prompt" | "minimax_image_reference" | "minimax_image_count" | "minimax_image_bytes" | "minimax_speech_text" | "minimax_speech_voice" | "minimax_speech_reference" | "minimax_speech_model" | "zhipu_speech_text" | "zhipu_speech_voice" | "zhipu_speech_reference" | "voice_library_unsupported" | "voice_connection_changed" | "voice_reference_required" | "voice_transcript_required" | "voice_transcript_too_long" | "voice_description_too_long" | "voice_not_found" | "voice_delete_unsupported" | "voice_consent_required" | "voice_name_invalid" | "voice_audio_invalid" | "voice_format" | "voice_size" | "voice_duration" | "voice_provider_protocol" | "voice_provider_error" | "voice_provider_timeout" | "voice_model_unsupported" | "voice_name_taken" | "voice_provider_quota";
readonly message: string;
readonly objectId?: string | null;
readonly field?: string | null;
@@ -400,9 +428,9 @@ export interface CreationContractsInput extends ContractInput {
readonly generationSpec: TextGenerationSpecInput | ImageGenerationSpecInput | VideoGenerationSpecInput | AudioGenerationSpecInput;
readonly reference: PinnedReferenceInput | FollowingReferenceInput;
readonly editorDocument: TimelineDocumentInput | SubjectDocumentInput | LayerDocumentInput | ImageCropDocumentInput | StackDocumentInput | ToolDocumentInput | DirectorDocumentInput | MediaEditDocumentInput;
- readonly command: ProjectCreateCommandInput | ProjectRenameCommandInput | ProjectTrashCommandInput | ProjectRestoreCommandInput | AssetImportCommandInput | ArtifactPublishCommandInput | AssetWriteTextCommandInput | AssetMetadataCommandInput | AssetDeleteCommandInput | CanvasCreateGenerationCommandInput | CanvasShowCommandInput | CanvasMoveCommandInput | CanvasUpdateCommandInput | CanvasHideCommandInput | CanvasMaterializeCommandInput | CanvasApplyEditCommandInput | CanvasPublishMediaCommandInput | TimelinePublishRenderCommandInput | NodeVersionApplyCommandInput | CanvasConfigureCommandInput | CanvasEditorAttachCommandInput | CanvasEditorDetachCommandInput | SpecCreateCommandInput | SpecUpdateCommandInput | SpecRestoreCommandInput | SpecPromptCommandInput | ReferenceAddCommandInput | ReferenceUpdateCommandInput | ReferenceRestoreCommandInput | ReferenceRemoveCommandInput | GenerationSubmitCommandInput | JobCancelCommandInput | JobRecoverCommandInput | JobCheckpointCommandInput | ResultSelectCommandInput | EditorCreateCommandInput | EditorSaveCommandInput | HistoryUndoCommandInput | HistoryRedoCommandInput | BatchCommandInput;
+ readonly command: ProjectCreateCommandInput | ProjectRenameCommandInput | ProjectTrashCommandInput | ProjectRestoreCommandInput | AssetImportCommandInput | ArtifactPublishCommandInput | AssetWriteTextCommandInput | AssetMetadataCommandInput | AssetDeleteCommandInput | CanvasCreateGenerationCommandInput | CanvasShowCommandInput | CanvasMoveCommandInput | CanvasUpdateCommandInput | CanvasHideCommandInput | CanvasMaterializeCommandInput | CanvasApplyEditCommandInput | CanvasPublishMediaCommandInput | TimelinePublishRenderCommandInput | NodeVersionApplyCommandInput | CanvasConfigureCommandInput | CanvasEditorAttachCommandInput | CanvasEditorDetachCommandInput | SpecCreateCommandInput | SpecUpdateCommandInput | SpecRestoreCommandInput | SpecPromptCommandInput | ReferenceAddCommandInput | ReferenceUpdateCommandInput | ReferenceRestoreCommandInput | ReferenceRemoveCommandInput | GenerationSubmitCommandInput | JobCancelCommandInput | JobRecoverCommandInput | JobCheckpointCommandInput | ResultSelectCommandInput | EditorCreateCommandInput | EditorSaveCommandInput | DirectorApplyCommandInput | DirectorStoryboardAppendCommandInput | DirectorStoryboardReorderCommandInput | DirectorStoryboardResizeCommandInput | DirectorStoryboardDeleteCommandInput | DirectorSetDurationCommandInput | DirectorCameraDeleteCommandInput | HistoryUndoCommandInput | HistoryRedoCommandInput | BatchCommandInput;
readonly receipt: CommandReceiptInput;
- readonly query: ProjectQueryInput | ObjectQueryInput | VersionsQueryInput | AssetSearchQueryInput | AssetUsageQueryInput | CanvasStatusQueryInput | AssetPreviewQueryInput;
+ readonly query: ProjectQueryInput | ObjectQueryInput | VersionsQueryInput | AssetSearchQueryInput | AssetUsageQueryInput | CanvasStatusQueryInput | AssetPreviewQueryInput | DirectorStoryboardQueryInput;
readonly event: ProjectEventInput;
readonly job: JobInput;
readonly result: ResultVersionInput;
@@ -419,6 +447,35 @@ export interface CreationContractsInput extends ContractInput {
readonly upload: UploadInfoInput;
}
+export interface DirectorApplyInput extends ContractInput {
+ readonly document: DirectorDocumentWriteInput;
+}
+
+export interface DirectorApplyCommandInput extends CommandBaseInput {
+ readonly type: "director.apply";
+ readonly payload: DirectorApplyInput;
+}
+
+export interface DirectorApplyCommandOperationInput {
+ readonly type: "director.apply";
+ readonly payload: DirectorApplyInput;
+}
+
+export interface DirectorCameraDeleteInput extends ContractInput {
+ readonly documentId: string;
+ readonly cameraId: string;
+}
+
+export interface DirectorCameraDeleteCommandInput extends CommandBaseInput {
+ readonly type: "director.camera.delete";
+ readonly payload: DirectorCameraDeleteInput;
+}
+
+export interface DirectorCameraDeleteCommandOperationInput {
+ readonly type: "director.camera.delete";
+ readonly payload: DirectorCameraDeleteInput;
+}
+
export interface DirectorCanvasItemInput extends EditorCanvasItemInput {
readonly kind: "external";
}
@@ -427,12 +484,19 @@ export interface DirectorDataInput extends ContractInput {
readonly background: string;
readonly grid?: boolean;
readonly duration: number;
- readonly aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
+ readonly fps?: 24 | 25 | 30 | 50 | 60;
+ readonly aspectRatio?: "16:9" | "2.39:1" | "9:16" | "1:1" | "4:3" | "3:4";
readonly cameras: ReadonlyArray;
readonly activeCameraId: string;
readonly cameraSource?: "camera" | "storyboard";
readonly shots?: ReadonlyArray;
readonly objects?: ReadonlyArray;
+ readonly environment?: StageEnvironmentInput;
+ readonly lights?: ReadonlyArray;
+ readonly stills?: ReadonlyArray;
+}
+
+export interface DirectorDataWriteInput extends DirectorDataInput {
}
export interface DirectorDocumentInput extends EditorDocumentBaseInput {
@@ -440,6 +504,141 @@ export interface DirectorDocumentInput extends EditorDocumentBaseInput {
readonly data: DirectorDataInput;
}
+export interface DirectorDocumentWriteInput extends EditorDocumentBaseInput {
+ readonly kind: "director";
+ readonly data: DirectorDataWriteInput;
+}
+
+export interface DirectorDurationResultInput extends ContractInput {
+ readonly documentId: string;
+ readonly requestedDuration: number;
+ readonly appliedDuration: number;
+ readonly clampReason: "storyboard_end" | null;
+}
+
+export interface DirectorOutputPlanInput extends ContractInput {
+ readonly cameraSource: "camera" | "storyboard";
+ readonly cameraId?: string | null;
+ readonly width: number;
+ readonly height: number;
+ readonly durationSeconds: number;
+ readonly frameRate: number;
+}
+
+export interface DirectorRenderEvidenceInput extends ContractInput {
+ readonly acceptedProjectCursor: number;
+ readonly sourceEditorId: string;
+ readonly sourceEditorRevision: number;
+ readonly plan: DirectorOutputPlanInput;
+}
+
+export interface DirectorSetDurationInput extends ContractInput {
+ readonly documentId: string;
+ readonly duration: number;
+}
+
+export interface DirectorSetDurationCommandInput extends CommandBaseInput {
+ readonly type: "director.duration.set";
+ readonly payload: DirectorSetDurationInput;
+}
+
+export interface DirectorSetDurationCommandOperationInput {
+ readonly type: "director.duration.set";
+ readonly payload: DirectorSetDurationInput;
+}
+
+export interface DirectorStoryboardAppendInput extends ContractInput {
+ readonly documentId: string;
+ readonly cameraId: string;
+ readonly blockId: string;
+}
+
+export interface DirectorStoryboardAppendCommandInput extends CommandBaseInput {
+ readonly type: "director.storyboard.append";
+ readonly payload: DirectorStoryboardAppendInput;
+}
+
+export interface DirectorStoryboardBlockInput extends ContractInput {
+ readonly id: string;
+ readonly cameraId: string;
+ readonly order: number;
+ readonly start: number;
+ readonly duration: number;
+}
+
+export interface DirectorStoryboardDeleteInput extends ContractInput {
+ readonly documentId: string;
+ readonly blockId: string;
+}
+
+export interface DirectorStoryboardDeleteCommandInput extends CommandBaseInput {
+ readonly type: "director.storyboard.delete";
+ readonly payload: DirectorStoryboardDeleteInput;
+}
+
+export interface DirectorStoryboardDeleteCommandOperationInput {
+ readonly type: "director.storyboard.delete";
+ readonly payload: DirectorStoryboardDeleteInput;
+}
+
+export interface DirectorStoryboardQueryInput extends QueryBaseInput {
+ readonly type: "director.storyboard.get";
+ readonly objectId: string;
+}
+
+export interface DirectorStoryboardReorderInput extends ContractInput {
+ readonly documentId: string;
+ readonly blockIds: ReadonlyArray;
+}
+
+export interface DirectorStoryboardReorderCommandInput extends CommandBaseInput {
+ readonly type: "director.storyboard.reorder";
+ readonly payload: DirectorStoryboardReorderInput;
+}
+
+export interface DirectorStoryboardReorderCommandOperationInput {
+ readonly type: "director.storyboard.reorder";
+ readonly payload: DirectorStoryboardReorderInput;
+}
+
+export interface DirectorStoryboardResizeInput extends ContractInput {
+ readonly documentId: string;
+ readonly blockId: string;
+ readonly duration: number;
+}
+
+export interface DirectorStoryboardResizeCommandInput extends CommandBaseInput {
+ readonly type: "director.storyboard.resize";
+ readonly payload: DirectorStoryboardResizeInput;
+}
+
+export interface DirectorStoryboardResizeCommandOperationInput {
+ readonly type: "director.storyboard.resize";
+ readonly payload: DirectorStoryboardResizeInput;
+}
+
+export interface DirectorStoryboardResultInput extends ContractInput {
+ readonly operationIndex: number;
+ readonly operation: "director.storyboard.append" | "director.storyboard.reorder" | "director.storyboard.resize" | "director.storyboard.delete" | "director.camera.delete" | "director.duration.set";
+ readonly documentId: string;
+ readonly version: number;
+ readonly blocks: ReadonlyArray;
+ readonly affectedBlockIds: ReadonlyArray;
+ readonly removedBlockIds: ReadonlyArray;
+ readonly blockId?: string | null;
+ readonly cameraId?: string | null;
+ readonly appendLimitReason?: "storyboard_tail" | null;
+}
+
+export interface DirectorStoryboardStateInput extends ContractInput {
+ readonly documentId: string;
+ readonly version: number;
+ readonly storyboardEnd: number;
+ readonly canAppend: boolean;
+ readonly cannotAppendReason?: "storyboard_leading_gap" | "storyboard_internal_gap" | "storyboard_overlap" | "storyboard_exceeds_duration" | "storyboard_duration_invalid" | "storyboard_camera_unknown" | "storyboard_block_invalid" | "storyboard_block_exists" | "storyboard_exhausted" | "storyboard_order_invalid" | "storyboard_block_unknown" | "director_camera_unknown" | "director_camera_required" | null;
+ readonly blocks: ReadonlyArray;
+}
+
export interface EditorBindingInput extends ContractInput {
readonly role: "editor";
readonly objectRef: EditorRefInput;
@@ -488,7 +687,7 @@ export interface EditorSaveCommandOperationInput {
}
export interface EditorWriteInput extends ContractInput {
- readonly document: TimelineDocumentInput | SubjectDocumentInput | LayerDocumentInput | ImageCropDocumentInput | StackDocumentInput | ToolDocumentInput | DirectorDocumentInput | MediaEditDocumentInput;
+ readonly document: TimelineDocumentInput | SubjectDocumentInput | LayerDocumentInput | ImageCropDocumentInput | StackDocumentInput | ToolDocumentInput | DirectorDocumentWriteInput | MediaEditDocumentInput;
}
export interface EmptyBindingInput extends ContractInput {
@@ -802,9 +1001,12 @@ export interface MediaMetadataInput extends ContractInput {
readonly height?: number | null;
readonly durationSeconds?: number | null;
readonly frameRate?: number | null;
+ readonly frameCount?: number | null;
readonly hasAudio?: boolean | null;
readonly sampleRate?: number | null;
readonly channels?: number | null;
+ readonly selfContained?: boolean | null;
+ readonly animationNames?: ReadonlyArray | null;
}
export interface MediaPublicationOutputInput extends ContractInput {
@@ -1183,10 +1385,32 @@ export interface StackDocumentInput extends EditorDocumentBaseInput {
readonly data: StackDataInput;
}
+export interface StageBezierTransitionInput extends ContractInput {
+ readonly kind: "bezier";
+ readonly controlPoints: readonly [number, number, number, number];
+}
+
export interface StageCameraInput extends ContractInput {
readonly position: Vector3Input;
readonly target: Vector3Input;
readonly fov: number;
+ readonly roll?: number;
+}
+
+export interface StageEnvironmentInput extends ContractInput {
+ readonly preset?: "studio" | "warm-sunset" | "moonlit";
+ readonly groundColor?: string;
+ readonly groundVisible?: boolean;
+ readonly exposure?: number;
+ readonly backgroundAsset?: AssetRefInput | null;
+}
+
+export interface StageLightInput extends ContractInput {
+ readonly id: "hemisphere" | "key" | "fill";
+ readonly color: string;
+ readonly intensity: number;
+ readonly position: Vector3Input;
+ readonly castShadow?: boolean;
}
export interface StageMotionInput extends ContractInput {
@@ -1197,11 +1421,20 @@ export interface StageMotionInput extends ContractInput {
export interface StageObjectInput extends StageTransformInput {
readonly id: string;
- readonly kind: "person" | "box" | "sphere";
+ readonly kind: "person" | "box" | "sphere" | "gltf" | "cylinder" | "cone" | "pyramid" | "torus" | "plane" | "capsule" | "disk" | "arc" | "halfCylinder";
readonly name: string;
readonly color: string;
+ readonly visible?: boolean;
+ readonly locked?: boolean;
+ readonly opacity?: number;
readonly keyframes?: ReadonlyArray;
readonly motionClips?: ReadonlyArray;
+ readonly asset?: AssetRefInput | null;
+ readonly thumbnailAsset?: AssetRefInput | null;
+ readonly role?: "character" | "scene" | null;
+ readonly format?: "glb" | "gltf" | null;
+ readonly animationNames?: ReadonlyArray;
+ readonly hasAnimation?: boolean;
}
export interface StageShotInput extends ContractInput {
@@ -1217,6 +1450,12 @@ export interface StageTransformInput extends ContractInput {
readonly scale: Vector3Input;
}
+export interface StageTransformTransitionsInput extends ContractInput {
+ readonly position?: StageBezierTransitionInput | null;
+ readonly rotation?: StageBezierTransitionInput | null;
+ readonly scale?: StageBezierTransitionInput | null;
+}
+
export interface SubjectCanvasItemInput extends EditorCanvasItemInput {
readonly kind: "subject";
}
@@ -1452,6 +1691,8 @@ export interface TransformFrameInput extends ContractInput {
readonly id: string;
readonly time: number;
readonly value: StageTransformInput;
+ readonly keyedChannels?: ReadonlyArray<"position" | "rotation" | "scale"> | null;
+ readonly transitions?: StageTransformTransitionsInput | null;
}
export interface UploadInfoInput extends ContractInput {
@@ -1568,7 +1809,7 @@ export type ReferenceInput = PinnedReferenceInput | FollowingReferenceInput;
export type EditorDocumentInput = TimelineDocumentInput | SubjectDocumentInput | LayerDocumentInput | ImageCropDocumentInput | StackDocumentInput | ToolDocumentInput | DirectorDocumentInput | MediaEditDocumentInput;
-export type CommandInput = ProjectCreateCommandInput | ProjectRenameCommandInput | ProjectTrashCommandInput | ProjectRestoreCommandInput | AssetImportCommandInput | ArtifactPublishCommandInput | AssetWriteTextCommandInput | AssetMetadataCommandInput | AssetDeleteCommandInput | CanvasCreateGenerationCommandInput | CanvasShowCommandInput | CanvasMoveCommandInput | CanvasUpdateCommandInput | CanvasHideCommandInput | CanvasMaterializeCommandInput | CanvasApplyEditCommandInput | CanvasPublishMediaCommandInput | TimelinePublishRenderCommandInput | NodeVersionApplyCommandInput | CanvasConfigureCommandInput | CanvasEditorAttachCommandInput | CanvasEditorDetachCommandInput | SpecCreateCommandInput | SpecUpdateCommandInput | SpecRestoreCommandInput | SpecPromptCommandInput | ReferenceAddCommandInput | ReferenceUpdateCommandInput | ReferenceRestoreCommandInput | ReferenceRemoveCommandInput | GenerationSubmitCommandInput | JobCancelCommandInput | JobRecoverCommandInput | JobCheckpointCommandInput | ResultSelectCommandInput | EditorCreateCommandInput | EditorSaveCommandInput | HistoryUndoCommandInput | HistoryRedoCommandInput | BatchCommandInput;
+export type CommandInput = ProjectCreateCommandInput | ProjectRenameCommandInput | ProjectTrashCommandInput | ProjectRestoreCommandInput | AssetImportCommandInput | ArtifactPublishCommandInput | AssetWriteTextCommandInput | AssetMetadataCommandInput | AssetDeleteCommandInput | CanvasCreateGenerationCommandInput | CanvasShowCommandInput | CanvasMoveCommandInput | CanvasUpdateCommandInput | CanvasHideCommandInput | CanvasMaterializeCommandInput | CanvasApplyEditCommandInput | CanvasPublishMediaCommandInput | TimelinePublishRenderCommandInput | NodeVersionApplyCommandInput | CanvasConfigureCommandInput | CanvasEditorAttachCommandInput | CanvasEditorDetachCommandInput | SpecCreateCommandInput | SpecUpdateCommandInput | SpecRestoreCommandInput | SpecPromptCommandInput | ReferenceAddCommandInput | ReferenceUpdateCommandInput | ReferenceRestoreCommandInput | ReferenceRemoveCommandInput | GenerationSubmitCommandInput | JobCancelCommandInput | JobRecoverCommandInput | JobCheckpointCommandInput | ResultSelectCommandInput | EditorCreateCommandInput | EditorSaveCommandInput | DirectorApplyCommandInput | DirectorStoryboardAppendCommandInput | DirectorStoryboardReorderCommandInput | DirectorStoryboardResizeCommandInput | DirectorStoryboardDeleteCommandInput | DirectorSetDurationCommandInput | DirectorCameraDeleteCommandInput | HistoryUndoCommandInput | HistoryRedoCommandInput | BatchCommandInput;
export type ExecutionParametersInput = TextExecutionInput | ImageExecutionInput | VideoExecutionInput | AudioExecutionInput;
@@ -1646,6 +1887,7 @@ export interface AssetProvenance extends Contract {
readonly sourceItemId: string | null;
readonly editorDocumentId: string | null;
readonly editorRevision: number | null;
+ readonly directorRender?: DirectorRenderEvidence | null;
readonly sources: ReadonlyArray;
readonly inputFingerprint: string | null;
readonly agentRunId: string | null;
@@ -1727,7 +1969,14 @@ export interface BatchCommand extends CommandBase {
}
export interface BatchPayload extends Contract {
- readonly operations: ReadonlyArray;
+ readonly operations: ReadonlyArray;
+}
+
+export interface CameraChannels extends Contract {
+ readonly position: ReadonlyArray;
+ readonly target: ReadonlyArray;
+ readonly up: ReadonlyArray;
+ readonly focalLength: ReadonlyArray;
}
export interface CameraFrame extends Contract {
@@ -1736,11 +1985,27 @@ export interface CameraFrame extends Contract {
readonly value: StageCamera;
}
+export interface CameraNumberFrame extends Contract {
+ readonly id: string;
+ readonly time: number;
+ readonly value: number;
+ readonly transition: StageBezierTransition | null;
+}
+
export interface CameraRig extends Contract {
readonly id: string;
readonly name: string;
+ readonly aspectRatio: "16:9" | "2.39:1" | "9:16" | "1:1" | "4:3" | "3:4";
readonly pose: StageCamera;
readonly keyframes: ReadonlyArray;
+ readonly channels: CameraChannels;
+}
+
+export interface CameraVectorFrame extends Contract {
+ readonly id: string;
+ readonly time: number;
+ readonly value: Vector3;
+ readonly transition: StageBezierTransition | null;
}
export interface CanvasApplyEdit extends Contract {
@@ -1893,6 +2158,8 @@ export interface CanvasPublishMedia extends Contract {
readonly source: AssetRef | null;
readonly sourceEditorId: string | null;
readonly document: TimelineDocument | SubjectDocument | LayerDocument | ImageCropDocument | StackDocument | ToolDocument | DirectorDocument | MediaEditDocument;
+ readonly directorPlan: DirectorOutputPlan | null;
+ readonly directorAcceptedAt?: number | null;
readonly outputs: ReadonlyArray;
}
@@ -1957,6 +2224,8 @@ export interface CommandReceipt extends Contract {
readonly changed: ReadonlyArray;
readonly jobIds: ReadonlyArray;
readonly issues: ReadonlyArray;
+ readonly directorDurations?: ReadonlyArray;
+ readonly directorStoryboard?: ReadonlyArray;
readonly eventCursor: number | null;
}
@@ -1968,7 +2237,7 @@ export interface Contract {
}
export interface ContractIssue extends Contract {
- readonly code: "timeline_package_invalid" | "timeline_package_too_large" | "timeline_revision_missing" | "timeline_import_missing" | "timeline_import_conflict" | "timeline_registration_rejected" | "timeline_font_too_large" | "timeline_font_unavailable" | "timeline_font_unsupported" | "timeline_font_invalid" | "timeline_font_fingerprint" | "timeline_font_coverage" | "timeline_font_total_bytes" | "timeline_font_unverified" | "timeline_font_mime" | "timeline_bundled_font_fingerprint" | "timeline_bundled_font_unavailable" | "invalid_input" | "revision_conflict" | "role_restricted" | "missing_object" | "reference_invalid" | "image_quality_unsupported" | "bigmodel_video_model" | "bigmodel_video_output" | "bigmodel_video_image" | "bigmodel_video_frames" | "bigmodel_video_prompt" | "bigmodel_video_cancel" | "kling_model" | "kling_mode" | "kling_image" | "kling_frames" | "kling_prompt" | "kling_aspect" | "kling_output" | "kling_cancel" | "capability_unsupported" | "preview_expired" | "storage_unavailable" | "submission_unknown" | "provider_error" | "moss_speech_text" | "moss_speech_voice" | "moss_speech_reference" | "moss_prompt_limit" | "moss_image_size" | "moss_image_reference" | "moss_layout_reference" | "bigmodel_image_size" | "bigmodel_image_reference" | "bigmodel_image_prompt" | "minimax_image_reference" | "minimax_image_count" | "minimax_image_bytes" | "minimax_speech_text" | "minimax_speech_voice" | "minimax_speech_reference" | "minimax_speech_model" | "zhipu_speech_text" | "zhipu_speech_voice" | "zhipu_speech_reference" | "voice_library_unsupported" | "voice_connection_changed" | "voice_reference_required" | "voice_transcript_required" | "voice_transcript_too_long" | "voice_description_too_long" | "voice_not_found" | "voice_delete_unsupported" | "voice_consent_required" | "voice_name_invalid" | "voice_audio_invalid" | "voice_format" | "voice_size" | "voice_duration" | "voice_provider_protocol" | "voice_provider_error" | "voice_provider_timeout" | "voice_model_unsupported" | "voice_name_taken" | "voice_provider_quota";
+ readonly code: "timeline_package_invalid" | "timeline_package_too_large" | "timeline_revision_missing" | "timeline_import_missing" | "timeline_import_conflict" | "timeline_registration_rejected" | "timeline_font_too_large" | "timeline_font_unavailable" | "timeline_font_unsupported" | "timeline_font_invalid" | "timeline_font_fingerprint" | "timeline_font_coverage" | "timeline_font_total_bytes" | "timeline_font_unverified" | "timeline_font_mime" | "timeline_bundled_font_fingerprint" | "timeline_bundled_font_unavailable" | "storyboard_leading_gap" | "storyboard_internal_gap" | "storyboard_overlap" | "storyboard_exceeds_duration" | "storyboard_duration_invalid" | "storyboard_camera_unknown" | "storyboard_block_invalid" | "storyboard_block_exists" | "storyboard_exhausted" | "storyboard_order_invalid" | "storyboard_block_unknown" | "director_camera_unknown" | "director_camera_required" | "invalid_input" | "revision_conflict" | "role_restricted" | "missing_object" | "reference_invalid" | "image_quality_unsupported" | "bigmodel_video_model" | "bigmodel_video_output" | "bigmodel_video_image" | "bigmodel_video_frames" | "bigmodel_video_prompt" | "bigmodel_video_cancel" | "kling_model" | "kling_mode" | "kling_image" | "kling_frames" | "kling_prompt" | "kling_aspect" | "kling_output" | "kling_cancel" | "capability_unsupported" | "preview_expired" | "storage_unavailable" | "submission_unknown" | "provider_error" | "moss_speech_text" | "moss_speech_voice" | "moss_speech_reference" | "moss_prompt_limit" | "moss_image_size" | "moss_image_reference" | "moss_layout_reference" | "bigmodel_image_size" | "bigmodel_image_reference" | "bigmodel_image_prompt" | "minimax_image_reference" | "minimax_image_count" | "minimax_image_bytes" | "minimax_speech_text" | "minimax_speech_voice" | "minimax_speech_reference" | "minimax_speech_model" | "zhipu_speech_text" | "zhipu_speech_voice" | "zhipu_speech_reference" | "voice_library_unsupported" | "voice_connection_changed" | "voice_reference_required" | "voice_transcript_required" | "voice_transcript_too_long" | "voice_description_too_long" | "voice_not_found" | "voice_delete_unsupported" | "voice_consent_required" | "voice_name_invalid" | "voice_audio_invalid" | "voice_format" | "voice_size" | "voice_duration" | "voice_provider_protocol" | "voice_provider_error" | "voice_provider_timeout" | "voice_model_unsupported" | "voice_name_taken" | "voice_provider_quota";
readonly message: string;
readonly objectId: string | null;
readonly field: string | null;
@@ -1980,9 +2249,9 @@ export interface CreationContracts extends Contract {
readonly generationSpec: TextGenerationSpec | ImageGenerationSpec | VideoGenerationSpec | AudioGenerationSpec;
readonly reference: PinnedReference | FollowingReference;
readonly editorDocument: TimelineDocument | SubjectDocument | LayerDocument | ImageCropDocument | StackDocument | ToolDocument | DirectorDocument | MediaEditDocument;
- readonly command: ProjectCreateCommand | ProjectRenameCommand | ProjectTrashCommand | ProjectRestoreCommand | AssetImportCommand | ArtifactPublishCommand | AssetWriteTextCommand | AssetMetadataCommand | AssetDeleteCommand | CanvasCreateGenerationCommand | CanvasShowCommand | CanvasMoveCommand | CanvasUpdateCommand | CanvasHideCommand | CanvasMaterializeCommand | CanvasApplyEditCommand | CanvasPublishMediaCommand | TimelinePublishRenderCommand | NodeVersionApplyCommand | CanvasConfigureCommand | CanvasEditorAttachCommand | CanvasEditorDetachCommand | SpecCreateCommand | SpecUpdateCommand | SpecRestoreCommand | SpecPromptCommand | ReferenceAddCommand | ReferenceUpdateCommand | ReferenceRestoreCommand | ReferenceRemoveCommand | GenerationSubmitCommand | JobCancelCommand | JobRecoverCommand | JobCheckpointCommand | ResultSelectCommand | EditorCreateCommand | EditorSaveCommand | HistoryUndoCommand | HistoryRedoCommand | BatchCommand;
+ readonly command: ProjectCreateCommand | ProjectRenameCommand | ProjectTrashCommand | ProjectRestoreCommand | AssetImportCommand | ArtifactPublishCommand | AssetWriteTextCommand | AssetMetadataCommand | AssetDeleteCommand | CanvasCreateGenerationCommand | CanvasShowCommand | CanvasMoveCommand | CanvasUpdateCommand | CanvasHideCommand | CanvasMaterializeCommand | CanvasApplyEditCommand | CanvasPublishMediaCommand | TimelinePublishRenderCommand | NodeVersionApplyCommand | CanvasConfigureCommand | CanvasEditorAttachCommand | CanvasEditorDetachCommand | SpecCreateCommand | SpecUpdateCommand | SpecRestoreCommand | SpecPromptCommand | ReferenceAddCommand | ReferenceUpdateCommand | ReferenceRestoreCommand | ReferenceRemoveCommand | GenerationSubmitCommand | JobCancelCommand | JobRecoverCommand | JobCheckpointCommand | ResultSelectCommand | EditorCreateCommand | EditorSaveCommand | DirectorApplyCommand | DirectorStoryboardAppendCommand | DirectorStoryboardReorderCommand | DirectorStoryboardResizeCommand | DirectorStoryboardDeleteCommand | DirectorSetDurationCommand | DirectorCameraDeleteCommand | HistoryUndoCommand | HistoryRedoCommand | BatchCommand;
readonly receipt: CommandReceipt;
- readonly query: ProjectQuery | ObjectQuery | VersionsQuery | AssetSearchQuery | AssetUsageQuery | CanvasStatusQuery | AssetPreviewQuery;
+ readonly query: ProjectQuery | ObjectQuery | VersionsQuery | AssetSearchQuery | AssetUsageQuery | CanvasStatusQuery | AssetPreviewQuery | DirectorStoryboardQuery;
readonly event: ProjectEvent;
readonly job: Job;
readonly result: ResultVersion;
@@ -1999,6 +2268,35 @@ export interface CreationContracts extends Contract {
readonly upload: UploadInfo;
}
+export interface DirectorApply extends Contract {
+ readonly document: DirectorDocumentWrite;
+}
+
+export interface DirectorApplyCommand extends CommandBase {
+ readonly type: "director.apply";
+ readonly payload: DirectorApply;
+}
+
+export interface DirectorApplyCommandOperation {
+ readonly type: "director.apply";
+ readonly payload: DirectorApply;
+}
+
+export interface DirectorCameraDelete extends Contract {
+ readonly documentId: string;
+ readonly cameraId: string;
+}
+
+export interface DirectorCameraDeleteCommand extends CommandBase {
+ readonly type: "director.camera.delete";
+ readonly payload: DirectorCameraDelete;
+}
+
+export interface DirectorCameraDeleteCommandOperation {
+ readonly type: "director.camera.delete";
+ readonly payload: DirectorCameraDelete;
+}
+
export interface DirectorCanvasItem extends EditorCanvasItem {
readonly kind: "external";
}
@@ -2007,12 +2305,19 @@ export interface DirectorData extends Contract {
readonly background: string;
readonly grid: boolean;
readonly duration: number;
- readonly aspectRatio: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
+ readonly fps: 24 | 25 | 30 | 50 | 60;
+ readonly aspectRatio: "16:9" | "2.39:1" | "9:16" | "1:1" | "4:3" | "3:4";
readonly cameras: ReadonlyArray;
readonly activeCameraId: string;
readonly cameraSource: "camera" | "storyboard";
readonly shots: ReadonlyArray;
readonly objects: ReadonlyArray;
+ readonly environment: StageEnvironment;
+ readonly lights: ReadonlyArray;
+ readonly stills: ReadonlyArray;
+}
+
+export interface DirectorDataWrite extends DirectorData {
}
export interface DirectorDocument extends EditorDocumentBase {
@@ -2020,6 +2325,141 @@ export interface DirectorDocument extends EditorDocumentBase {
readonly data: DirectorData;
}
+export interface DirectorDocumentWrite extends EditorDocumentBase {
+ readonly kind: "director";
+ readonly data: DirectorDataWrite;
+}
+
+export interface DirectorDurationResult extends Contract {
+ readonly documentId: string;
+ readonly requestedDuration: number;
+ readonly appliedDuration: number;
+ readonly clampReason: "storyboard_end" | null;
+}
+
+export interface DirectorOutputPlan extends Contract {
+ readonly cameraSource: "camera" | "storyboard";
+ readonly cameraId: string | null;
+ readonly width: number;
+ readonly height: number;
+ readonly durationSeconds: number;
+ readonly frameRate: number;
+}
+
+export interface DirectorRenderEvidence extends Contract {
+ readonly acceptedProjectCursor: number;
+ readonly sourceEditorId: string;
+ readonly sourceEditorRevision: number;
+ readonly plan: DirectorOutputPlan;
+}
+
+export interface DirectorSetDuration extends Contract {
+ readonly documentId: string;
+ readonly duration: number;
+}
+
+export interface DirectorSetDurationCommand extends CommandBase {
+ readonly type: "director.duration.set";
+ readonly payload: DirectorSetDuration;
+}
+
+export interface DirectorSetDurationCommandOperation {
+ readonly type: "director.duration.set";
+ readonly payload: DirectorSetDuration;
+}
+
+export interface DirectorStoryboardAppend extends Contract {
+ readonly documentId: string;
+ readonly cameraId: string;
+ readonly blockId: string;
+}
+
+export interface DirectorStoryboardAppendCommand extends CommandBase {
+ readonly type: "director.storyboard.append";
+ readonly payload: DirectorStoryboardAppend;
+}
+
+export interface DirectorStoryboardBlock extends Contract {
+ readonly id: string;
+ readonly cameraId: string;
+ readonly order: number;
+ readonly start: number;
+ readonly duration: number;
+}
+
+export interface DirectorStoryboardDelete extends Contract {
+ readonly documentId: string;
+ readonly blockId: string;
+}
+
+export interface DirectorStoryboardDeleteCommand extends CommandBase {
+ readonly type: "director.storyboard.delete";
+ readonly payload: DirectorStoryboardDelete;
+}
+
+export interface DirectorStoryboardDeleteCommandOperation {
+ readonly type: "director.storyboard.delete";
+ readonly payload: DirectorStoryboardDelete;
+}
+
+export interface DirectorStoryboardQuery extends QueryBase {
+ readonly type: "director.storyboard.get";
+ readonly objectId: string;
+}
+
+export interface DirectorStoryboardReorder extends Contract {
+ readonly documentId: string;
+ readonly blockIds: ReadonlyArray;
+}
+
+export interface DirectorStoryboardReorderCommand extends CommandBase {
+ readonly type: "director.storyboard.reorder";
+ readonly payload: DirectorStoryboardReorder;
+}
+
+export interface DirectorStoryboardReorderCommandOperation {
+ readonly type: "director.storyboard.reorder";
+ readonly payload: DirectorStoryboardReorder;
+}
+
+export interface DirectorStoryboardResize extends Contract {
+ readonly documentId: string;
+ readonly blockId: string;
+ readonly duration: number;
+}
+
+export interface DirectorStoryboardResizeCommand extends CommandBase {
+ readonly type: "director.storyboard.resize";
+ readonly payload: DirectorStoryboardResize;
+}
+
+export interface DirectorStoryboardResizeCommandOperation {
+ readonly type: "director.storyboard.resize";
+ readonly payload: DirectorStoryboardResize;
+}
+
+export interface DirectorStoryboardResult extends Contract {
+ readonly operationIndex: number;
+ readonly operation: "director.storyboard.append" | "director.storyboard.reorder" | "director.storyboard.resize" | "director.storyboard.delete" | "director.camera.delete" | "director.duration.set";
+ readonly documentId: string;
+ readonly version: number;
+ readonly blocks: ReadonlyArray;
+ readonly affectedBlockIds: ReadonlyArray;
+ readonly removedBlockIds: ReadonlyArray;
+ readonly blockId: string | null;
+ readonly cameraId: string | null;
+ readonly appendLimitReason: "storyboard_tail" | null;
+}
+
+export interface DirectorStoryboardState extends Contract {
+ readonly documentId: string;
+ readonly version: number;
+ readonly storyboardEnd: number;
+ readonly canAppend: boolean;
+ readonly cannotAppendReason: "storyboard_leading_gap" | "storyboard_internal_gap" | "storyboard_overlap" | "storyboard_exceeds_duration" | "storyboard_duration_invalid" | "storyboard_camera_unknown" | "storyboard_block_invalid" | "storyboard_block_exists" | "storyboard_exhausted" | "storyboard_order_invalid" | "storyboard_block_unknown" | "director_camera_unknown" | "director_camera_required" | null;
+ readonly blocks: ReadonlyArray;
+}
+
export interface EditorBinding extends Contract {
readonly role: "editor";
readonly objectRef: EditorRef;
@@ -2068,7 +2508,7 @@ export interface EditorSaveCommandOperation {
}
export interface EditorWrite extends Contract {
- readonly document: TimelineDocument | SubjectDocument | LayerDocument | ImageCropDocument | StackDocument | ToolDocument | DirectorDocument | MediaEditDocument;
+ readonly document: TimelineDocument | SubjectDocument | LayerDocument | ImageCropDocument | StackDocument | ToolDocument | DirectorDocumentWrite | MediaEditDocument;
}
export interface EmptyBinding extends Contract {
@@ -2382,9 +2822,12 @@ export interface MediaMetadata extends Contract {
readonly height: number | null;
readonly durationSeconds: number | null;
readonly frameRate: number | null;
+ readonly frameCount?: number | null;
readonly hasAudio: boolean | null;
readonly sampleRate: number | null;
readonly channels: number | null;
+ readonly selfContained: boolean | null;
+ readonly animationNames: ReadonlyArray | null;
}
export interface MediaPublicationOutput extends Contract {
@@ -2762,10 +3205,32 @@ export interface StackDocument extends EditorDocumentBase {
readonly data: StackData;
}
+export interface StageBezierTransition extends Contract {
+ readonly kind: "bezier";
+ readonly controlPoints: readonly [number, number, number, number];
+}
+
export interface StageCamera extends Contract {
readonly position: Vector3;
readonly target: Vector3;
readonly fov: number;
+ readonly roll: number;
+}
+
+export interface StageEnvironment extends Contract {
+ readonly preset: "studio" | "warm-sunset" | "moonlit";
+ readonly groundColor: string;
+ readonly groundVisible: boolean;
+ readonly exposure: number;
+ readonly backgroundAsset: AssetRef | null;
+}
+
+export interface StageLight extends Contract {
+ readonly id: "hemisphere" | "key" | "fill";
+ readonly color: string;
+ readonly intensity: number;
+ readonly position: Vector3;
+ readonly castShadow: boolean;
}
export interface StageMotion extends Contract {
@@ -2776,11 +3241,20 @@ export interface StageMotion extends Contract {
export interface StageObject extends StageTransform {
readonly id: string;
- readonly kind: "person" | "box" | "sphere";
+ readonly kind: "person" | "box" | "sphere" | "gltf" | "cylinder" | "cone" | "pyramid" | "torus" | "plane" | "capsule" | "disk" | "arc" | "halfCylinder";
readonly name: string;
readonly color: string;
+ readonly visible: boolean;
+ readonly locked: boolean;
+ readonly opacity: number;
readonly keyframes: ReadonlyArray;
readonly motionClips: ReadonlyArray;
+ readonly asset: AssetRef | null;
+ readonly thumbnailAsset: AssetRef | null;
+ readonly role: "character" | "scene" | null;
+ readonly format: "glb" | "gltf" | null;
+ readonly animationNames: ReadonlyArray;
+ readonly hasAnimation: boolean;
}
export interface StageShot extends Contract {
@@ -2796,6 +3270,12 @@ export interface StageTransform extends Contract {
readonly scale: Vector3;
}
+export interface StageTransformTransitions extends Contract {
+ readonly position: StageBezierTransition | null;
+ readonly rotation: StageBezierTransition | null;
+ readonly scale: StageBezierTransition | null;
+}
+
export interface SubjectCanvasItem extends EditorCanvasItem {
readonly kind: "subject";
}
@@ -3031,6 +3511,8 @@ export interface TransformFrame extends Contract {
readonly id: string;
readonly time: number;
readonly value: StageTransform;
+ readonly keyedChannels: ReadonlyArray<"position" | "rotation" | "scale"> | null;
+ readonly transitions: StageTransformTransitions | null;
}
export interface UploadInfo extends Contract {
@@ -3147,7 +3629,7 @@ export type Reference = PinnedReference | FollowingReference;
export type EditorDocument = TimelineDocument | SubjectDocument | LayerDocument | ImageCropDocument | StackDocument | ToolDocument | DirectorDocument | MediaEditDocument;
-export type Command = ProjectCreateCommand | ProjectRenameCommand | ProjectTrashCommand | ProjectRestoreCommand | AssetImportCommand | ArtifactPublishCommand | AssetWriteTextCommand | AssetMetadataCommand | AssetDeleteCommand | CanvasCreateGenerationCommand | CanvasShowCommand | CanvasMoveCommand | CanvasUpdateCommand | CanvasHideCommand | CanvasMaterializeCommand | CanvasApplyEditCommand | CanvasPublishMediaCommand | TimelinePublishRenderCommand | NodeVersionApplyCommand | CanvasConfigureCommand | CanvasEditorAttachCommand | CanvasEditorDetachCommand | SpecCreateCommand | SpecUpdateCommand | SpecRestoreCommand | SpecPromptCommand | ReferenceAddCommand | ReferenceUpdateCommand | ReferenceRestoreCommand | ReferenceRemoveCommand | GenerationSubmitCommand | JobCancelCommand | JobRecoverCommand | JobCheckpointCommand | ResultSelectCommand | EditorCreateCommand | EditorSaveCommand | HistoryUndoCommand | HistoryRedoCommand | BatchCommand;
+export type Command = ProjectCreateCommand | ProjectRenameCommand | ProjectTrashCommand | ProjectRestoreCommand | AssetImportCommand | ArtifactPublishCommand | AssetWriteTextCommand | AssetMetadataCommand | AssetDeleteCommand | CanvasCreateGenerationCommand | CanvasShowCommand | CanvasMoveCommand | CanvasUpdateCommand | CanvasHideCommand | CanvasMaterializeCommand | CanvasApplyEditCommand | CanvasPublishMediaCommand | TimelinePublishRenderCommand | NodeVersionApplyCommand | CanvasConfigureCommand | CanvasEditorAttachCommand | CanvasEditorDetachCommand | SpecCreateCommand | SpecUpdateCommand | SpecRestoreCommand | SpecPromptCommand | ReferenceAddCommand | ReferenceUpdateCommand | ReferenceRestoreCommand | ReferenceRemoveCommand | GenerationSubmitCommand | JobCancelCommand | JobRecoverCommand | JobCheckpointCommand | ResultSelectCommand | EditorCreateCommand | EditorSaveCommand | DirectorApplyCommand | DirectorStoryboardAppendCommand | DirectorStoryboardReorderCommand | DirectorStoryboardResizeCommand | DirectorStoryboardDeleteCommand | DirectorSetDurationCommand | DirectorCameraDeleteCommand | HistoryUndoCommand | HistoryRedoCommand | BatchCommand;
export type ExecutionParameters = TextExecution | ImageExecution | VideoExecution | AudioExecution;
diff --git a/src/i18n/messages/en-US/editors.ts b/src/i18n/messages/en-US/editors.ts
index ccab55bc8..d44257587 100644
--- a/src/i18n/messages/en-US/editors.ts
+++ b/src/i18n/messages/en-US/editors.ts
@@ -196,7 +196,7 @@ export const editors = {
"editors.stage.label.motionClip": "Motion clip",
"editors.stage.label.shot": "Shot",
"editors.stage.defaultCameraName": "Camera 1",
- "editors.stage.defaultPersonName": "Person 1",
+ "editors.stage.defaultPersonName": "Default Character",
"editors.stage.error.invalidTransform":
"The stage object position, rotation, or scale is invalid.",
"editors.stage.error.invalidCamera":
@@ -214,6 +214,10 @@ export const editors = {
"A keyframe references a missing or duplicate stage object.",
"editors.stage.error.invalidLegacyObject": "A legacy stage object is invalid.",
"editors.stage.error.jointMotionPerson": "Only people support joint motion.",
+ "editors.stage.error.importedSceneMotion":
+ "Scene assets cannot carry character motion clips.",
+ "editors.stage.error.importedMotionUnavailable":
+ "This imported character has no animation data.",
"editors.stage.error.invalidDocument":
"The local director preview format is invalid.",
"editors.stage.error.invalidObject":
@@ -225,6 +229,31 @@ export const editors = {
"editors.stage.error.shotCamera":
"A shot references a camera that does not exist.",
"editors.stage.error.cameraMissing": "The camera does not exist.",
+ "editors.stage.error.exportStoryboardEmpty":
+ "Exporting from the storyboard needs at least one shot.",
+ // Why the Storyboard is not continuous or cannot take another block. The stable codes
+ // never change; this is display copy only, worded like the backend storyboard_errors
+ // catalog so a precheck and a server rejection read the same.
+ "editors.stage.storyboard.reason.leadingGap":
+ "The Storyboard must start at 0; the first block cannot begin later.",
+ "editors.stage.storyboard.reason.internalGap":
+ "Storyboard blocks cannot leave gaps; start each block where the previous one ends.",
+ "editors.stage.storyboard.reason.overlap":
+ "Storyboard blocks cannot overlap; start each block where the previous one ends.",
+ "editors.stage.storyboard.reason.exceedsDuration":
+ "The Storyboard cannot end after the main timeline; shorten the blocks or lengthen the main timeline.",
+ "editors.stage.storyboard.reason.durationInvalid":
+ "Every Storyboard block needs a duration greater than 0; lengthen this block.",
+ "editors.stage.storyboard.reason.cameraUnknown":
+ "A Storyboard block references a camera that does not exist; choose an existing camera.",
+ "editors.stage.storyboard.reason.orderInvalid": "Include each Storyboard block ID exactly once in the desired order.",
+ "editors.stage.storyboard.reason.blockUnknown": "The Storyboard block to edit could not be found.",
+ "editors.stage.storyboard.reason.blockInvalid":
+ "A Storyboard block needs a non-empty identity.",
+ "editors.stage.storyboard.reason.blockExists":
+ "This Storyboard block identity is already in use; choose another one.",
+ "editors.stage.storyboard.reason.exhausted":
+ "No main-timeline time remains for another Storyboard block.",
"editors.layerDocument.defaultName": "Original image",
"editors.layerDocument.error.size":
@@ -291,64 +320,271 @@ export const editors = {
"editors.stage.ui.objectPerson": "Person",
"editors.stage.ui.objectBox": "Box",
"editors.stage.ui.objectSphere": "Sphere",
- "editors.stage.ui.degreesSuffix": " (degrees)",
+ "editors.stage.ui.objectCylinder": "Cylinder",
+ "editors.stage.ui.objectCone": "Cone",
+ "editors.stage.ui.objectPyramid": "Pyramid",
+ "editors.stage.ui.objectTorus": "Torus",
+ "editors.stage.ui.objectPlane": "Plane",
+ "editors.stage.ui.objectCapsule": "Capsule",
+ "editors.stage.ui.objectDisk": "Disk",
+ "editors.stage.ui.objectArc": "Arc",
+ "editors.stage.ui.objectHalfCylinder": "Half cylinder",
+ "editors.stage.ui.objectGltf": "Imported model",
+ "editors.stage.ui.importAsset": "Import GLB / GLTF",
+ "editors.stage.ui.assetRole": "Imported asset role",
+ "editors.stage.ui.assetCharacter": "Character",
+ "editors.stage.ui.assetScene": "Scene",
+ "editors.stage.ui.assetNotice":
+ "This character has no animation data; it still follows camera, storyboard, and transform keyframes.",
+ "editors.stage.ui.assetUnavailable":
+ "The imported asset is unavailable. Reopen the project or import it again.",
+ "editors.stage.ui.assetLoadFailed":
+ "Could not load “{name}”. The file may be corrupt or reference external resources.",
+ "editors.stage.ui.assetCorrupt":
+ "Could not read “{name}”: the GLB header is valid but the embedded JSON is missing or corrupt.",
+ "editors.stage.ui.assetTooLarge":
+ "“{name}” is larger than {size} MB. Use a smaller GLB or GLTF file.",
+ "editors.stage.ui.assetUnsupported":
+ "Only GLB and self-contained GLTF files are supported. FBX and external GLTF resources are not supported yet.",
+ "editors.stage.ui.assetImported":
+ "Imported {name} · {animationCount} animation clips",
+ "editors.stage.ui.assetImportedStatic": "Imported {name} · no animation data",
+ "editors.stage.ui.thumbnailFailed":
+ "{name} was imported, but its preview thumbnail could not be generated.",
"editors.stage.ui.editFailed": "The stage change failed.",
"editors.stage.ui.cameraName": "Camera {number}",
"editors.stage.ui.keepCamera": "Keep at least one camera.",
- "editors.stage.ui.cameraInUse":
- "A shot still uses this camera. Replace or delete that shot first.",
- "editors.stage.ui.webglInit": "WebGL could not start: {reason}",
+ "editors.stage.ui.webglInit": "WebGL could not start: {reason}. Make sure hardware acceleration is on (chrome://gpu shows the WebGL status) and restart the browser; if it still fails, close other tabs that use WebGL.",
"editors.stage.ui.webglLost":
"The WebGL context was lost. Save the stage data, reopen the editor, and continue.",
"editors.stage.ui.rendererNotReady": "The stage renderer is not ready yet.",
"editors.stage.ui.screenshotFailed": "The screenshot failed.",
"editors.stage.ui.importFailed": "The stage could not be imported.",
+ "editors.stage.ui.importForeignAssets":
+ "The stage file pins imported models that are not registered in this project: {names}. Open the stage in its original project, or import the model files here first.",
+ "editors.stage.ui.exportUnsavedImports":
+ "The stage file cannot carry imported models that exist only in this browser: {names}. Apply edits to save them to the project first.",
"editors.stage.ui.exportFailed": "The preview video export failed.",
"editors.stage.ui.motionTitle": "{title} · Motion preview",
"editors.stage.ui.addCanvasFailed": "Adding to the canvas failed.",
- "editors.stage.ui.title": "Director preview · {title}",
- "editors.stage.ui.subtitle":
- "Local 3D stage · camera and subject keyframes",
+ "editors.stage.ui.brand": "3D Director Stage",
+ "editors.stage.ui.unsavedTitle": "Unsaved stage changes",
+ "editors.stage.ui.keepEditing": "Keep editing",
+ "editors.stage.ui.discardClose": "Discard and close",
+ "editors.stage.ui.saveClose": "Save and close",
"editors.stage.ui.undo": "Undo",
"editors.stage.ui.redo": "Redo",
"editors.stage.ui.importJson": "Import stage JSON",
"editors.stage.ui.exportJson": "Export stage JSON",
- "editors.stage.ui.screenshot": "Download camera still",
+ "editors.stage.ui.screenshot": "Capture camera still",
+ "editors.stage.ui.stillSaving": "Saving photo…",
+ "editors.stage.ui.shotMaterials": "Shot materials",
+ "editors.stage.ui.shortcuts": "Shortcuts",
+ "editors.stage.ui.splitPreview": "Live preview {name}",
+ "editors.stage.ui.splitExit": "Exit split view",
+ "editors.stage.ui.splitRatioAria": "Split ratio",
+ "editors.stage.ui.leftPanelWidthAria": "Left Director Stage panel width",
+ "editors.stage.ui.rightPanelWidthAria": "Right Director Stage panel width",
+ "editors.stage.ui.timelineHeightAria": "Director Stage timeline height",
+ "editors.stage.ui.sliderAria": "{name} slider",
+ "editors.stage.ui.viewSettings": "View settings",
+ "editors.stage.ui.viewSettingsRail": "View settings overlay",
+ "editors.stage.ui.viewGround": "Ground",
+ "editors.stage.ui.viewGrid": "Grid",
+ "editors.stage.ui.viewMotionPaths": "Motion paths",
+ "editors.stage.ui.viewObjectNames": "Object names",
+ "editors.stage.ui.viewHeightGuides": "Object height guides",
+ "editors.stage.ui.viewIndicator": "View indicator",
+ "editors.stage.ui.focusObject": "Focus {name}",
+ "editors.stage.ui.placeHint": "Click the viewport to place {name} · Esc cancels",
+ "editors.stage.ui.assetPlacementHint": "Click a preview card, then click the viewport grid to place it.",
+ "editors.stage.ui.duplicateObject": "Duplicate",
+ "editors.stage.ui.helpTitle": "Director console controls",
+ "editors.stage.ui.helpViewNav": "View navigation",
+ "editors.stage.ui.helpOrbit": "Left-drag · orbit",
+ "editors.stage.ui.helpPan": "Right-drag · pan",
+ "editors.stage.ui.helpZoom": "Wheel · zoom",
+ "editors.stage.ui.helpMove": "Hold W/A/S/D to move · Q/E lower or raise · Shift sprints",
+ "editors.stage.ui.helpEditor": "Editor",
+ "editors.stage.ui.helpEscape": "Escape · close overlays or guarded-close the editor",
+ "editors.stage.ui.helpTab": "Tab · cycle focus inside the console",
+ "editors.stage.ui.closeHelp": "Close help",
+ "editors.stage.ui.closeDrawer": "Collapse shot materials",
+ "editors.stage.ui.selectAllStills": "Select all",
+ "editors.stage.ui.selectedStillsCount": {
+ one: "{count} selected",
+ other: "{count} selected",
+ },
+ "editors.stage.ui.stillName": "Capture_{number}",
+ "editors.stage.ui.duplicateSuffix": "{name} copy",
+ "editors.stage.ui.objectLocked": "The stage object is locked. Unlock it before editing or removing it.",
+ "editors.stage.ui.deleteTrackKeyframe": "Delete the {label} keyframe at {time} seconds",
+ "editors.stage.ui.stillEmpty":
+ "No shot materials yet; captures land here automatically.",
+ "editors.stage.ui.stillMissing": "Media unavailable",
+ "editors.stage.ui.previewStill": "Preview {name}",
+ "editors.stage.ui.closePreview": "Close preview",
+ "editors.stage.ui.deleteSelectedStills": "Delete selected",
+ "editors.stage.ui.downloadSelectedStills": "Download selected",
+ "editors.stage.ui.addStillsToCanvas": "Add to canvas",
+ "editors.stage.ui.stillsAddedToCanvas": "Added {count} still(s) to canvas.",
+ "editors.stage.ui.stillDownloadFailed": "The photo download failed.",
+ "editors.stage.ui.stillCaptured":
+ "Still captured. Applying registers it as a project image asset.",
"editors.stage.ui.renderMp4": "Render preview MP4",
"editors.stage.ui.renderProgress": "Rendering preview {percent}%",
"editors.stage.ui.cancelRender": "Cancel rendering",
"editors.stage.ui.renderDone":
- "Preview MP4 complete · {width}×{height} · 30 fps",
+ "Preview MP4 complete · {width}×{height} · {fps} fps",
+ "editors.stage.ui.exportVideo": "Export video",
+ "editors.stage.ui.exportSubtitle":
+ "Pick one camera to export the full dynamic preview.",
+ "editors.stage.ui.exportSourceLabel": "Camera source",
+ "editors.stage.ui.exportSourceStoryboard": "Storyboard",
+ "editors.stage.ui.exportAspectLabel": "Aspect",
+ "editors.stage.ui.exportDurationLabel": "Duration",
+ "editors.stage.ui.exportClarityLabel": "Quality",
+ "editors.stage.ui.exportClarityStandard": "Standard · 1280 px long edge",
+ "editors.stage.ui.exportClarityHigh": "High · 1920 px long edge",
+ "editors.stage.ui.exportFpsLabel": "Frame rate",
+ "editors.stage.ui.exportFpsOption": "{fps} FPS",
+ "editors.stage.ui.exportNoteStoryboard": "Uses hard cuts and ends at the last Storyboard block.",
+ "editors.stage.ui.exportNoteCamera":
+ "Uses {name} throughout, keeping that camera's moves and the subjects' motion.",
+ "editors.stage.ui.exportNoteClean":
+ "The output contains no guides, control points or editor interface.",
+ "editors.stage.ui.exportConfirm": "Export",
+ "editors.stage.ui.exportCancel": "Cancel",
"editors.stage.ui.downloadMp4": "Download preview MP4",
"editors.stage.ui.addedToCanvas": "Added to canvas",
"editors.stage.ui.addToCanvas": "Add preview video to canvas",
+ "editors.stage.ui.assetLibrary": "Assets",
+ "editors.stage.ui.assetSearchPlaceholder": "Search assets",
+ "editors.stage.ui.assetSearchAria": "Search stage assets",
+ "editors.stage.ui.objectTreeTitle": "Objects",
+ "editors.stage.ui.objectSearchPlaceholder": "Search objects",
+ "editors.stage.ui.objectSearchAria": "Search scene objects",
+ "editors.stage.ui.properties": "Properties",
"editors.stage.ui.sceneObjects": "Scene subjects",
+ "editors.stage.ui.tabCharacters": "Characters",
+ "editors.stage.ui.tabObjects": "Objects",
+ "editors.stage.ui.tabCameras": "Cameras",
+ "editors.stage.ui.tabBackground": "Background",
+ "editors.stage.ui.backgroundFilters": "Background categories",
+ "editors.stage.ui.backgroundFilter.all": "All",
+ "editors.stage.ui.backgroundFilter.panoramic": "Panoramic background",
+ "editors.stage.ui.backgroundFilter.flat": "Flat background",
+ "editors.stage.ui.backgroundMine": "Mine",
+ "editors.stage.ui.backgroundAdd": "Add background",
+ "editors.stage.ui.backgroundImporting": "Adding background…",
+ "editors.stage.ui.backgroundImported": "Added background “{name}”",
+ "editors.stage.ui.backgroundImportFailed": "Could not add background “{name}”",
+ "editors.stage.ui.backgroundCanvasImages": "Canvas images",
+ "editors.stage.ui.backgroundEmpty": "No backgrounds yet. Upload an image or choose one from the canvas images.",
+ "editors.stage.ui.backgroundNoMatches": "No backgrounds match the current search and category.",
+ "editors.stage.ui.cameraPreview": "Camera preview",
+ "editors.stage.ui.collapseCameraPreview": "Collapse camera preview",
+ "editors.stage.ui.expandCameraPreview": "Expand camera preview",
+ "editors.stage.ui.moveCameraPreview": "Move camera preview",
+ "editors.stage.ui.aspectMask": "Aspect mask",
+ "editors.stage.ui.cameraHint": "Select a camera to edit its framing on the right.",
+ "editors.stage.ui.addCamera": "Add camera",
+ "editors.stage.ui.viewfinder": "Viewfinder",
+ "editors.stage.ui.viewfinderFov": "Viewfinder FOV",
+ "editors.stage.ui.cameraPresets": "Camera presets",
+ "editors.stage.ui.preset.frontMedium": "Front medium",
+ "editors.stage.ui.preset.frontClose": "Front close-up",
+ "editors.stage.ui.preset.frontWide": "Front wide",
+ "editors.stage.ui.preset.sideTrack": "Side tracking",
+ "editors.stage.ui.preset.sideClose": "Side close-up",
+ "editors.stage.ui.preset.backMedium": "Back medium",
+ "editors.stage.ui.preset.overheadWide": "Overhead wide",
+ "editors.stage.ui.preset.highAngle": "High 45°",
+ "editors.stage.ui.preset.lowAngle": "Low angle",
+ "editors.stage.ui.preset.lowWide": "Low wide",
+ "editors.stage.ui.preset.overShoulder": "Over the shoulder",
+ "editors.stage.ui.preset.bird": "Bird's eye",
+ "editors.stage.ui.preset.dutch": "Dutch angle",
+ "editors.stage.ui.cameraMoves": "Camera moves",
+ "editors.stage.ui.savedChip": "Saved",
+ "editors.stage.ui.unsavedChip": "Unsaved",
"editors.stage.ui.background": "Background color",
+ "editors.stage.ui.environmentPreset": "Environment preset",
+ "editors.stage.ui.environmentPreset.custom": "Custom",
+ "editors.stage.ui.environmentPreset.studio": "Studio",
+ "editors.stage.ui.environmentPreset.warm-sunset": "Warm sunset",
+ "editors.stage.ui.environmentPreset.moonlit": "Moonlit",
+ "editors.stage.ui.backgroundAsset": "Background image",
+ "editors.stage.ui.backgroundAssetFallback": "Use background color",
+ "editors.stage.ui.backgroundAssetUnavailable": "Background image unavailable; using the background color fallback.",
+ "editors.stage.ui.groundColor": "Ground color",
+ "editors.stage.ui.groundVisible": "Show ground",
+ "editors.stage.ui.exposure": "Exposure",
+ "editors.stage.ui.light.hemisphere": "Hemisphere light",
+ "editors.stage.ui.light.key": "Key light",
+ "editors.stage.ui.light.fill": "Fill light",
+ "editors.stage.ui.lightColor": "{role} color",
+ "editors.stage.ui.lightIntensity": "{role} intensity",
+ "editors.stage.ui.lightPosition": "{role} position",
+ "editors.stage.ui.lightPositionAxis": "{role} position {axis}",
+ "editors.stage.ui.lightCastShadow": "{role} casts shadows",
"editors.stage.ui.grid": "Show ground grid",
- "editors.stage.ui.orbitHint": "Left-drag orbit · right-drag pan · wheel zoom",
+ "editors.stage.ui.orbitHint": "Left-drag orbit · right-drag pan · wheel zoom · hold WASD to move · Q/E lower or raise · Shift sprints",
+ "editors.stage.ui.shortcutHint":
+ "1/2/3 toggle the move, rotate and scale handles; G grounds the subject; arrow keys nudge (Shift for larger steps)",
+ "editors.stage.ui.resetView": "Reset view",
"editors.stage.ui.selectHint":
- "Click a subject to select it, then adjust its transform on the right.",
+ "Click a subject to select it, then drag the handles in the preview or adjust its transform on the right.",
+ "editors.stage.ui.gizmoSelect": "Select",
+ "editors.stage.ui.gizmoMove": "Move",
+ "editors.stage.ui.gizmoRotate": "Rotate",
+ "editors.stage.ui.gizmoScale": "Scale",
+ "editors.stage.ui.gizmoDropGround": "Drop to ground",
+ "editors.stage.ui.elevationValue": "{height} m",
+ "editors.stage.ui.elevationAria": "Height above ground {height} m",
+ "editors.stage.ui.gizmoModeAria": "Preview transform handles",
+ "editors.stage.ui.gizmoAnimatedHint":
+ "This subject has transform keyframes, so dragging records a pose keyframe at the playhead.",
"editors.stage.ui.stageAria": "Interactive 3D director stage",
"editors.stage.ui.pause": "Pause",
"editors.stage.ui.playAction": "Play motion and keyframes",
+ "editors.stage.ui.previewMode": "Preview mode",
+ "editors.stage.ui.previewModeStatic": "Static",
+ "editors.stage.ui.previewModeDynamic": "Dynamic",
"editors.stage.ui.time": "{time} / {duration} s",
"editors.stage.ui.totalDuration": "Total duration",
"editors.stage.ui.stageDurationAria": "Stage duration",
+ "editors.stage.ui.stageDurationClamped": "Requested {requested} s. Applied {applied} s to keep all Storyboard blocks.",
"editors.stage.ui.recordKeyframe": "Record a keyframe here",
+ "editors.stage.ui.addTrackKeyframe": "Add {label} keyframe at {time}s",
"editors.stage.ui.playheadAria": "Stage playhead",
- "editors.stage.ui.deleteKeyframe": "Delete keyframe at {frame} s",
- "editors.stage.ui.keyframeHint":
- "Adjust the camera or subject at the start and end, then record keyframes to preview.",
- "editors.stage.ui.storyboard": "Shot track",
- "editors.stage.ui.addShot": "Add current camera at playhead",
- "editors.stage.ui.shotHint":
- "Shots cannot overlap; gaps use the current camera. Switch “Storyboard cuts” to preview and export the same shot sequence.",
- "editors.stage.ui.shot": "Shot {number}",
- "editors.stage.ui.shotCameraAria": "Shot {number} camera",
- "editors.stage.ui.shotStartAria": "Shot {number} start",
- "editors.stage.ui.shotDurationAria": "Shot {number} duration",
- "editors.stage.ui.locate": "Locate",
- "editors.stage.ui.deleteShot": "Delete shot {number}",
+ "editors.stage.ui.timelineTitle": "Timeline",
+ "editors.stage.ui.timelineCurrentTime": "Current time",
+ "editors.stage.ui.timelinePlayheadAria": "Current time marker at {time} seconds",
+ "editors.stage.ui.timelineAria": "Director Stage timeline tracks",
+ "editors.stage.ui.timelineTime": "{time}s",
+ "editors.stage.ui.timelinePointAria": "{label} at {time} seconds",
+ "editors.stage.ui.timelineIntervalAria":
+ "{label} interval from {start} to {end} seconds",
+ "editors.stage.ui.transitionEditorAria": "{label} interval transition editor",
+ "editors.stage.ui.transitionEditorTitle": "{label} · {start}f → {end}f",
+ "editors.stage.ui.transitionFormula": "Value = start + k(t) × (end − start)",
+ "editors.stage.ui.transitionClose": "Close interval transition editor",
+ "editors.stage.ui.transitionLabel": "Transition",
+ "editors.stage.ui.transitionLinear": "Linear",
+ "editors.stage.ui.transitionBezier": "Bezier",
+ "editors.stage.ui.transitionControlPoints": "Bezier control points (x1, y1, x2, y2)",
+ "editors.stage.ui.transitionControlPoint": "Control point {point}",
+ "editors.stage.ui.trackShots": "Shots",
+ "editors.stage.ui.timelineCollapseGroup": "Collapse {label}",
+ "editors.stage.ui.timelineExpandGroup": "Expand {label}",
+ "editors.stage.ui.trackPosition": "Position",
+ "editors.stage.ui.trackRotation": "Rotation",
+ "editors.stage.ui.trackScale": "Scale",
+ "editors.stage.ui.trackMotion": "Motion",
+ "editors.stage.ui.trackTarget": "Target",
+ "editors.stage.ui.trackUp": "Up",
+ "editors.stage.ui.trackFocalLength": "Focal length",
"editors.stage.ui.transform": "Subject transform",
"editors.stage.ui.camera": "Camera",
"editors.stage.ui.name": "Name",
@@ -377,19 +613,28 @@ export const editors = {
"editors.stage.ui.deleteCamera": "Delete current camera",
"editors.stage.ui.outputAspect": "Output aspect",
"editors.stage.ui.outputAspectAria": "Director output aspect",
- "editors.stage.ui.source": "Preview and export source",
- "editors.stage.ui.sourceAria": "Director shot source",
- "editors.stage.ui.currentCamera": "Current camera, full duration",
- "editors.stage.ui.storyboardCut": "Storyboard cuts",
+ "editors.stage.ui.source": "Preview source",
+ "editors.stage.ui.sourceAria": "Director preview source",
+ "editors.stage.ui.storyboardCut": "Storyboard",
+ // The Storyboard track: its `+`, the camera chooser above it, the blocks and the preview.
+ "editors.stage.ui.storyboardAdd": "Add camera to Storyboard",
+ "editors.stage.ui.storyboardEditing": "Editing the Storyboard…",
+ "editors.stage.ui.storyboardAdding": "Adding a Storyboard block…",
+ "editors.stage.ui.storyboardEmpty": "Add a Storyboard block first.",
+ "editors.stage.ui.storyboardChooser": "Choose a camera for the Storyboard",
+ "editors.stage.ui.storyboardSearch": "Search cameras",
+ "editors.stage.ui.storyboardSearchEmpty": "No camera matches this search.",
+ "editors.stage.ui.storyboardDeleteBlock": "Delete Storyboard block",
+ "editors.stage.ui.storyboardBlockAria":
+ "Storyboard block {name} from {start} to {end} seconds",
"editors.stage.ui.cameraShort": "Camera",
"editors.stage.ui.target": "Target",
"editors.stage.ui.focal": "Focal length (35mm film, 16:9 equivalent)",
"editors.stage.ui.verticalFov": "Vertical field of view {value}°",
"editors.stage.ui.resetCamera": "Reset camera",
- "editors.stage.ui.footerHint":
- "Editing the camera or a subject writes a keyframe at the current time; preview, stills, and MP4 share the aspect and sampling. Storyboard cuts, segmented joint motion, and 30 fps MP4 export are supported. External skinned FBX/GLB characters and cloud director versions are not connected yet.",
"editors.stage.ui.importAria": "Import director stage",
"editors.stage.ui.startSeconds": "Start (s)",
"editors.stage.ui.durationSeconds": "Duration (s)",
+ "editors.stage.ui.locate": "Locate",
"editors.stage.ui.previewSuffix": "preview",
} as const;
diff --git a/src/i18n/messages/en-US/errors.ts b/src/i18n/messages/en-US/errors.ts
index 7d58efdc2..cb3228a9b 100644
--- a/src/i18n/messages/en-US/errors.ts
+++ b/src/i18n/messages/en-US/errors.ts
@@ -226,6 +226,9 @@ export const errors = {
"errors.backend.resultCandidate": "Result kept as a candidate",
"errors.backend.mediaEmpty": "The media has no readable content.",
"errors.backend.mediaReadFailed": "Could not read the media.",
+ "errors.backend.directorAssetMissing":
+ "The director stage contains an imported asset without a registered project asset.",
+ "errors.backend.directorStageTitle": "Director stage",
"errors.backend.unsupportedGeneration":
"This node does not support generation settings.",
"errors.backend.assemblyMissing":
@@ -240,6 +243,8 @@ export const errors = {
"The pinned reference version is missing or its content changed.",
"errors.backend.savingResult":
"The result is being saved. Try again shortly.",
+ "errors.backend.mediaPreparationPending":
+ "An earlier media publication is still preparing. Retry it before changing the output.",
"errors.backend.editSourceUnsaved": "The edit source has not been saved.",
"errors.backend.notDirectorStage":
"This is not a publishable director stage.",
diff --git a/src/i18n/messages/zh-CN/editors.ts b/src/i18n/messages/zh-CN/editors.ts
index d90be7290..14f699ed0 100644
--- a/src/i18n/messages/zh-CN/editors.ts
+++ b/src/i18n/messages/zh-CN/editors.ts
@@ -185,7 +185,7 @@ export const editors = {
"editors.stage.label.motionClip": "动作片段",
"editors.stage.label.shot": "分镜",
"editors.stage.defaultCameraName": "摄像机 1",
- "editors.stage.defaultPersonName": "人物 1",
+ "editors.stage.defaultPersonName": "默认人物",
"editors.stage.error.invalidTransform": "舞台对象的位置、旋转或缩放无效。",
"editors.stage.error.invalidCamera": "摄像机位置、目标或视角无效。",
"editors.stage.error.invalidKeyframes": "关键帧列表无效。",
@@ -199,6 +199,8 @@ export const editors = {
"editors.stage.error.missingObject": "关键帧引用了缺失或重复的舞台对象。",
"editors.stage.error.invalidLegacyObject": "旧舞台对象无效。",
"editors.stage.error.jointMotionPerson": "只有人物支持关节动作。",
+ "editors.stage.error.importedSceneMotion": "场景素材不能携带角色动作片段。",
+ "editors.stage.error.importedMotionUnavailable": "此导入人物没有动画数据。",
"editors.stage.error.invalidDocument": "本地导演预演格式无效。",
"editors.stage.error.invalidObject": "舞台对象 ID、类型或颜色无效。",
"editors.stage.error.invalidMotionClip": "动作片段无效。",
@@ -206,6 +208,24 @@ export const editors = {
"editors.stage.error.cameraRequired": "至少保留一个摄像机,当前摄像机必须存在。",
"editors.stage.error.shotCamera": "分镜引用了不存在的摄像机。",
"editors.stage.error.cameraMissing": "摄像机不存在。",
+ "editors.stage.error.exportStoryboardEmpty": "按分镜编排导出时至少需要一个分镜。",
+ // Why the Storyboard is not continuous or cannot take another block. The stable codes
+ // never change and are not translated; this is display copy only, worded like the
+ // backend storyboard_errors catalog so a precheck and a server rejection read the same.
+ "editors.stage.storyboard.reason.leadingGap": "分镜必须从 0 秒开始,第一个分镜块之前不能留空。",
+ "editors.stage.storyboard.reason.internalGap":
+ "分镜块之间不能留有空隙,请让每个分镜块从前一个分镜块结束的位置开始。",
+ "editors.stage.storyboard.reason.overlap":
+ "分镜块之间不能重叠,请让每个分镜块从前一个分镜块结束的位置开始。",
+ "editors.stage.storyboard.reason.exceedsDuration":
+ "分镜的结束时间不能超过主时间轴时长,请缩短分镜块或延长主时间轴。",
+ "editors.stage.storyboard.reason.durationInvalid": "每个分镜块的时长都必须大于 0,请延长该分镜块。",
+ "editors.stage.storyboard.reason.cameraUnknown": "分镜块引用的机位不存在,请选择已有机位。",
+ "editors.stage.storyboard.reason.orderInvalid": "请在目标顺序中为每个分镜块提供且仅提供一个标识。",
+ "editors.stage.storyboard.reason.blockUnknown": "要编辑的分镜块不存在。",
+ "editors.stage.storyboard.reason.blockInvalid": "分镜块标识不能为空。",
+ "editors.stage.storyboard.reason.blockExists": "该分镜块标识已被使用,请换一个标识。",
+ "editors.stage.storyboard.reason.exhausted": "主时间轴已没有可用时长,无法再添加分镜块。",
"editors.layerDocument.defaultName": "原始图片",
"editors.layerDocument.error.size":
@@ -260,59 +280,261 @@ export const editors = {
"editors.stage.ui.objectPerson": "人物",
"editors.stage.ui.objectBox": "方块",
"editors.stage.ui.objectSphere": "球体",
- "editors.stage.ui.degreesSuffix": "(度)",
+ "editors.stage.ui.objectCylinder": "圆柱",
+ "editors.stage.ui.objectCone": "圆锥",
+ "editors.stage.ui.objectPyramid": "四棱锥",
+ "editors.stage.ui.objectTorus": "圆环",
+ "editors.stage.ui.objectPlane": "平面",
+ "editors.stage.ui.objectCapsule": "胶囊",
+ "editors.stage.ui.objectDisk": "圆盘",
+ "editors.stage.ui.objectArc": "半圆弧",
+ "editors.stage.ui.objectHalfCylinder": "半圆柱",
+ "editors.stage.ui.objectGltf": "导入模型",
+ "editors.stage.ui.importAsset": "导入 GLB / GLTF",
+ "editors.stage.ui.assetRole": "导入素材角色",
+ "editors.stage.ui.assetCharacter": "人物",
+ "editors.stage.ui.assetScene": "场景",
+ "editors.stage.ui.assetNotice":
+ "此人物没有动画数据,但仍会跟随摄像机、分镜和变换关键帧。",
+ "editors.stage.ui.assetUnavailable": "导入素材不可用,请重新打开工程或再次导入。",
+ "editors.stage.ui.assetLoadFailed":
+ "无法加载「{name}」。文件可能损坏,或引用了外部资源。",
+ "editors.stage.ui.assetCorrupt":
+ "无法读取「{name}」:GLB 头有效,但内嵌 JSON 缺失或已损坏。",
+ "editors.stage.ui.assetTooLarge":
+ "「{name}」超过 {size} MB,请使用更小的 GLB 或 GLTF 文件。",
+ "editors.stage.ui.assetUnsupported":
+ "目前仅支持 GLB 和自包含 GLTF;FBX 及外部 GLTF 资源暂不支持。",
+ "editors.stage.ui.assetImported": "已导入 {name} · {animationCount} 个动画片段",
+ "editors.stage.ui.assetImportedStatic": "已导入 {name} · 无动画数据",
+ "editors.stage.ui.thumbnailFailed":
+ "已导入{name},但无法生成预览缩略图。",
"editors.stage.ui.editFailed": "舞台修改失败。",
"editors.stage.ui.cameraName": "摄像机 {number}",
"editors.stage.ui.keepCamera": "至少保留一个摄像机。",
- "editors.stage.ui.cameraInUse": "此机位仍被分镜引用,请先更换或删除对应分镜。",
- "editors.stage.ui.webglInit": "无法初始化 WebGL:{reason}",
+ "editors.stage.ui.webglInit": "无法初始化 WebGL:{reason}。请确认浏览器已启用硬件加速(chrome://gpu 可查看 WebGL 状态)并重启浏览器后重试;仍失败时关闭其他占用 WebGL 的标签页。",
"editors.stage.ui.webglLost": "WebGL 上下文已丢失。可先保存舞台数据,重新打开编辑器后继续。",
"editors.stage.ui.rendererNotReady": "舞台渲染器尚未就绪。",
"editors.stage.ui.screenshotFailed": "截图失败。",
"editors.stage.ui.importFailed": "导入舞台失败。",
+ "editors.stage.ui.importForeignAssets":
+ "舞台文件引用了未在本工程登记的导入模型:{names}。请在原工程中打开,或先在此工程导入对应模型文件。",
+ "editors.stage.ui.exportUnsavedImports":
+ "舞台文件无法携带仅存在于当前浏览器的导入模型:{names}。请先应用编辑,将其保存为工程素材。",
"editors.stage.ui.exportFailed": "预演视频导出失败。",
"editors.stage.ui.motionTitle": "{title} · 动作预演",
"editors.stage.ui.addCanvasFailed": "加入画布失败。",
- "editors.stage.ui.title": "导演预演 · {title}",
- "editors.stage.ui.subtitle": "本地 3D 舞台 · 镜头与主体关键帧",
+ "editors.stage.ui.brand": "3D导演台",
+ "editors.stage.ui.unsavedTitle": "舞台有未保存的修改",
+ "editors.stage.ui.keepEditing": "继续编辑",
+ "editors.stage.ui.discardClose": "直接关闭",
+ "editors.stage.ui.saveClose": "保存并关闭",
"editors.stage.ui.undo": "撤销",
"editors.stage.ui.redo": "重做",
"editors.stage.ui.importJson": "导入舞台 JSON",
"editors.stage.ui.exportJson": "导出舞台 JSON",
- "editors.stage.ui.screenshot": "下载镜头截图",
+ "editors.stage.ui.screenshot": "捕获镜头定格",
+ "editors.stage.ui.stillSaving": "正在保存照片…",
+ "editors.stage.ui.shotMaterials": "镜头素材",
+ "editors.stage.ui.shortcuts": "快捷键",
+ "editors.stage.ui.splitPreview": "实时预览 {name}",
+ "editors.stage.ui.splitExit": "退出分屏",
+ "editors.stage.ui.splitRatioAria": "分屏比例",
+ "editors.stage.ui.leftPanelWidthAria": "导演台左侧面板宽度",
+ "editors.stage.ui.rightPanelWidthAria": "导演台右侧面板宽度",
+ "editors.stage.ui.timelineHeightAria": "导演台时间轴高度",
+ "editors.stage.ui.sliderAria": "{name} 滑杆",
+ "editors.stage.ui.viewSettings": "视图设置",
+ "editors.stage.ui.viewSettingsRail": "视图设置浮层",
+ "editors.stage.ui.viewGround": "地面",
+ "editors.stage.ui.viewGrid": "网格",
+ "editors.stage.ui.viewMotionPaths": "运动路径",
+ "editors.stage.ui.viewObjectNames": "对象名称",
+ "editors.stage.ui.viewHeightGuides": "对象高度参考线",
+ "editors.stage.ui.viewIndicator": "视角指示器",
+ "editors.stage.ui.focusObject": "聚焦 {name}",
+ "editors.stage.ui.placeHint": "在视口中单击放置{name} · Esc 取消",
+ "editors.stage.ui.assetPlacementHint": "点击预览卡片,再点击画面网格放置对象。",
+ "editors.stage.ui.duplicateObject": "复制",
+ "editors.stage.ui.helpTitle": "导演台操作",
+ "editors.stage.ui.helpViewNav": "视角导航",
+ "editors.stage.ui.helpOrbit": "左键拖拽 · 环绕",
+ "editors.stage.ui.helpPan": "右键拖拽 · 平移",
+ "editors.stage.ui.helpZoom": "滚轮 · 缩放",
+ "editors.stage.ui.helpMove": "按住 W/A/S/D 移动 · Q/E 下降或上升 · Shift 加速",
+ "editors.stage.ui.helpEditor": "编辑器",
+ "editors.stage.ui.helpEscape": "Escape · 关闭浮层或守卫关闭编辑器",
+ "editors.stage.ui.helpTab": "Tab · 在控制台内循环焦点",
+ "editors.stage.ui.closeHelp": "关闭帮助",
+ "editors.stage.ui.closeDrawer": "收起镜头素材",
+ "editors.stage.ui.selectAllStills": "全选",
+ "editors.stage.ui.selectedStillsCount": "已选择 {count} 张",
+ "editors.stage.ui.stillName": "Capture_{number}",
+ "editors.stage.ui.duplicateSuffix": "{name} 副本",
+ "editors.stage.ui.objectLocked": "舞台对象已锁定,请先解锁再编辑或删除。",
+ "editors.stage.ui.deleteTrackKeyframe": "删除{label}在 {time} 秒的关键帧",
+ "editors.stage.ui.stillEmpty": "暂无镜头素材,拍摄后自动入库。",
+ "editors.stage.ui.stillMissing": "素材暂不可用",
+ "editors.stage.ui.previewStill": "预览 {name}",
+ "editors.stage.ui.closePreview": "关闭预览",
+ "editors.stage.ui.deleteSelectedStills": "删除选中照片",
+ "editors.stage.ui.downloadSelectedStills": "下载选中照片",
+ "editors.stage.ui.addStillsToCanvas": "添加到画布",
+ "editors.stage.ui.stillsAddedToCanvas": "已添加 {count} 张到画布。",
+ "editors.stage.ui.stillDownloadFailed": "下载照片失败。",
+ "editors.stage.ui.stillCaptured": "已捕获定格,应用后登记为工程图片素材。",
"editors.stage.ui.renderMp4": "合成预演 MP4",
"editors.stage.ui.renderProgress": "正在合成预演 {percent}%",
"editors.stage.ui.cancelRender": "取消合成",
- "editors.stage.ui.renderDone": "预演 MP4 已完成 · {width}×{height} · 30 fps",
+ "editors.stage.ui.renderDone": "预演 MP4 已完成 · {width}×{height} · {fps} fps",
+ "editors.stage.ui.exportVideo": "导出视频",
+ "editors.stage.ui.exportSubtitle": "选择一个机位导出完整动态预演。",
+ "editors.stage.ui.exportSourceLabel": "机位来源",
+ "editors.stage.ui.exportSourceStoryboard": "分镜编排",
+ "editors.stage.ui.exportAspectLabel": "画幅",
+ "editors.stage.ui.exportDurationLabel": "时长",
+ "editors.stage.ui.exportClarityLabel": "清晰度",
+ "editors.stage.ui.exportClarityStandard": "标准 · 长边 1280 px",
+ "editors.stage.ui.exportClarityHigh": "高清 · 长边 1920 px",
+ "editors.stage.ui.exportFpsLabel": "帧率",
+ "editors.stage.ui.exportFpsOption": "{fps} FPS",
+ "editors.stage.ui.exportNoteStoryboard": "按分镜块硬切,导出到最后一个分镜块结束。",
+ "editors.stage.ui.exportNoteCamera":
+ "全程使用{name},保留该机位的运镜和角色动作。",
+ "editors.stage.ui.exportNoteClean":
+ "成片不包含辅助线、控制点或编辑界面。",
+ "editors.stage.ui.exportConfirm": "导出",
+ "editors.stage.ui.exportCancel": "取消",
"editors.stage.ui.downloadMp4": "下载预演 MP4",
"editors.stage.ui.addedToCanvas": "已加入画布",
"editors.stage.ui.addToCanvas": "将预演视频加入画布",
+ "editors.stage.ui.assetLibrary": "资产",
+ "editors.stage.ui.assetSearchPlaceholder": "搜索素材",
+ "editors.stage.ui.assetSearchAria": "搜索导演台素材",
+ "editors.stage.ui.objectTreeTitle": "对象",
+ "editors.stage.ui.objectSearchPlaceholder": "搜索对象",
+ "editors.stage.ui.objectSearchAria": "搜索场景对象",
+ "editors.stage.ui.properties": "属性",
"editors.stage.ui.sceneObjects": "场景主体",
+ "editors.stage.ui.tabCharacters": "角色",
+ "editors.stage.ui.tabObjects": "物体",
+ "editors.stage.ui.tabCameras": "机位",
+ "editors.stage.ui.tabBackground": "背景",
+ "editors.stage.ui.backgroundFilters": "背景分类",
+ "editors.stage.ui.backgroundFilter.all": "全部",
+ "editors.stage.ui.backgroundFilter.panoramic": "全景背景",
+ "editors.stage.ui.backgroundFilter.flat": "平面背景",
+ "editors.stage.ui.backgroundMine": "我的",
+ "editors.stage.ui.backgroundAdd": "添加背景",
+ "editors.stage.ui.backgroundImporting": "正在添加背景…",
+ "editors.stage.ui.backgroundImported": "已添加背景「{name}」",
+ "editors.stage.ui.backgroundImportFailed": "无法添加背景「{name}」",
+ "editors.stage.ui.backgroundCanvasImages": "画布图片",
+ "editors.stage.ui.backgroundEmpty": "暂无背景。上传图片或从画布图片中选择。",
+ "editors.stage.ui.backgroundNoMatches": "没有符合当前搜索和分类的背景。",
+ "editors.stage.ui.cameraPreview": "机位预览",
+ "editors.stage.ui.collapseCameraPreview": "折叠机位预览",
+ "editors.stage.ui.expandCameraPreview": "展开机位预览",
+ "editors.stage.ui.moveCameraPreview": "移动机位预览",
+ "editors.stage.ui.aspectMask": "画幅遮罩",
+ "editors.stage.ui.cameraHint": "选择机位后,在右侧调整取景。",
+ "editors.stage.ui.addCamera": "添加机位",
+ "editors.stage.ui.viewfinder": "取景器",
+ "editors.stage.ui.viewfinderFov": "取景器 FOV",
+ "editors.stage.ui.cameraPresets": "机位预设",
+ "editors.stage.ui.preset.frontMedium": "正面中景",
+ "editors.stage.ui.preset.frontClose": "正面特写",
+ "editors.stage.ui.preset.frontWide": "正面全景",
+ "editors.stage.ui.preset.sideTrack": "侧面跟拍",
+ "editors.stage.ui.preset.sideClose": "侧面近景",
+ "editors.stage.ui.preset.backMedium": "背面中景",
+ "editors.stage.ui.preset.overheadWide": "俯拍全景",
+ "editors.stage.ui.preset.highAngle": "45° 俯拍",
+ "editors.stage.ui.preset.lowAngle": "低角度仰拍",
+ "editors.stage.ui.preset.lowWide": "低角度广角",
+ "editors.stage.ui.preset.overShoulder": "过肩",
+ "editors.stage.ui.preset.bird": "鸟瞰",
+ "editors.stage.ui.preset.dutch": "荷兰角",
+ "editors.stage.ui.cameraMoves": "运镜预设",
+ "editors.stage.ui.savedChip": "已保存",
+ "editors.stage.ui.unsavedChip": "未保存",
"editors.stage.ui.background": "背景颜色",
+ "editors.stage.ui.environmentPreset": "环境预设",
+ "editors.stage.ui.environmentPreset.custom": "自定义",
+ "editors.stage.ui.environmentPreset.studio": "摄影棚",
+ "editors.stage.ui.environmentPreset.warm-sunset": "暖色夕阳",
+ "editors.stage.ui.environmentPreset.moonlit": "月夜",
+ "editors.stage.ui.backgroundAsset": "背景图片",
+ "editors.stage.ui.backgroundAssetFallback": "使用背景颜色",
+ "editors.stage.ui.backgroundAssetUnavailable": "背景图片不可用,已回退到背景颜色。",
+ "editors.stage.ui.groundColor": "地面颜色",
+ "editors.stage.ui.groundVisible": "显示地面",
+ "editors.stage.ui.exposure": "曝光",
+ "editors.stage.ui.light.hemisphere": "半球光",
+ "editors.stage.ui.light.key": "主光",
+ "editors.stage.ui.light.fill": "补光",
+ "editors.stage.ui.lightColor": "{role}颜色",
+ "editors.stage.ui.lightIntensity": "{role}强度",
+ "editors.stage.ui.lightPosition": "{role}位置",
+ "editors.stage.ui.lightPositionAxis": "{role}位置{axis}",
+ "editors.stage.ui.lightCastShadow": "{role}投射阴影",
"editors.stage.ui.grid": "显示地面网格",
- "editors.stage.ui.orbitHint": "左键环绕 · 右键平移 · 滚轮缩放",
- "editors.stage.ui.selectHint": "点击主体选择,再调整右侧变换。",
+ "editors.stage.ui.orbitHint": "左键环绕 · 右键平移 · 滚轮缩放 · 按住 WASD 移动 · Q/E 下降或上升 · Shift 加速",
+ "editors.stage.ui.shortcutHint":
+ "1/2/3 切换移动、旋转、缩放操作轴;G 让主体落地;方向键微移(Shift 加大步长)",
+ "editors.stage.ui.resetView": "重置视角",
+ "editors.stage.ui.selectHint":
+ "点击主体选择,然后在预览中拖动操作轴,或在右侧调整变换。",
+ "editors.stage.ui.gizmoSelect": "选择",
+ "editors.stage.ui.gizmoMove": "移动",
+ "editors.stage.ui.gizmoRotate": "旋转",
+ "editors.stage.ui.gizmoScale": "缩放",
+ "editors.stage.ui.gizmoDropGround": "落到地面",
+ "editors.stage.ui.elevationValue": "{height} 米",
+ "editors.stage.ui.elevationAria": "离地高度 {height} 米",
+ "editors.stage.ui.gizmoModeAria": "预览变换操作轴",
+ "editors.stage.ui.gizmoAnimatedHint":
+ "此主体已有变换关键帧,拖拽会在播放头记录姿势关键帧。",
"editors.stage.ui.stageAria": "可交互的三维导演舞台",
"editors.stage.ui.pause": "暂停",
"editors.stage.ui.playAction": "播放动作与关键帧",
+ "editors.stage.ui.previewMode": "预演模式",
+ "editors.stage.ui.previewModeStatic": "静态",
+ "editors.stage.ui.previewModeDynamic": "动态",
"editors.stage.ui.time": "{time} / {duration} 秒",
"editors.stage.ui.totalDuration": "总时长",
"editors.stage.ui.stageDurationAria": "舞台总时长",
+ "editors.stage.ui.stageDurationClamped": "请求时长 {requested} 秒。为保留全部分镜块,实际应用 {applied} 秒。",
"editors.stage.ui.recordKeyframe": "在此记录关键帧",
+ "editors.stage.ui.addTrackKeyframe": "在 {time} 秒为{label}添加关键帧",
"editors.stage.ui.playheadAria": "舞台播放位置",
- "editors.stage.ui.deleteKeyframe": "删除 {frame} 秒关键帧",
- "editors.stage.ui.keyframeHint":
- "在起点和终点分别调整镜头或主体,然后记录关键帧即可预演。",
- "editors.stage.ui.storyboard": "分镜轨道",
- "editors.stage.ui.addShot": "在播放头添加当前机位",
- "editors.stage.ui.shotHint":
- "镜头区间不能重叠;空白区间使用当前机位。切换“分镜硬切”可预览并导出同一镜头序列。",
- "editors.stage.ui.shot": "镜头 {number}",
- "editors.stage.ui.shotCameraAria": "镜头 {number} 机位",
- "editors.stage.ui.shotStartAria": "镜头 {number} 开始",
- "editors.stage.ui.shotDurationAria": "镜头 {number} 时长",
- "editors.stage.ui.locate": "定位",
- "editors.stage.ui.deleteShot": "删除镜头 {number}",
+ "editors.stage.ui.timelineTitle": "时间轴",
+ "editors.stage.ui.timelineCurrentTime": "当前时间",
+ "editors.stage.ui.timelinePlayheadAria": "当前时间标记,{time} 秒",
+ "editors.stage.ui.timelineAria": "导演舞台时间线轨道",
+ "editors.stage.ui.timelineTime": "{time} 秒",
+ "editors.stage.ui.timelinePointAria": "{label},{time} 秒",
+ "editors.stage.ui.timelineIntervalAria":
+ "{label} 从 {start} 秒到 {end} 秒的区间",
+ "editors.stage.ui.transitionEditorAria": "{label}区间变化编辑器",
+ "editors.stage.ui.transitionEditorTitle": "{label} · {start}f → {end}f",
+ "editors.stage.ui.transitionFormula": "值 = 起点 + k(t) ×(终点 − 起点)",
+ "editors.stage.ui.transitionClose": "关闭区间变化编辑器",
+ "editors.stage.ui.transitionLabel": "过渡",
+ "editors.stage.ui.transitionLinear": "线性",
+ "editors.stage.ui.transitionBezier": "贝塞尔",
+ "editors.stage.ui.transitionControlPoints": "贝塞尔控制点(x1, y1, x2, y2)",
+ "editors.stage.ui.transitionControlPoint": "控制点 {point}",
+ "editors.stage.ui.trackShots": "分镜",
+ "editors.stage.ui.timelineCollapseGroup": "收起{label}",
+ "editors.stage.ui.timelineExpandGroup": "展开{label}",
+ "editors.stage.ui.trackPosition": "位置",
+ "editors.stage.ui.trackRotation": "旋转",
+ "editors.stage.ui.trackScale": "缩放",
+ "editors.stage.ui.trackMotion": "动作",
+ "editors.stage.ui.trackTarget": "目标",
+ "editors.stage.ui.trackUp": "上方向",
+ "editors.stage.ui.trackFocalLength": "焦距",
"editors.stage.ui.transform": "主体变换",
"editors.stage.ui.camera": "摄像机",
"editors.stage.ui.name": "名称",
@@ -341,19 +563,27 @@ export const editors = {
"editors.stage.ui.deleteCamera": "删除当前机位",
"editors.stage.ui.outputAspect": "输出画幅",
"editors.stage.ui.outputAspectAria": "导演输出画幅",
- "editors.stage.ui.source": "预览与导出来源",
- "editors.stage.ui.sourceAria": "导演镜头来源",
- "editors.stage.ui.currentCamera": "当前机位全程",
- "editors.stage.ui.storyboardCut": "分镜硬切",
+ "editors.stage.ui.source": "预览来源",
+ "editors.stage.ui.sourceAria": "导演预览来源",
+ "editors.stage.ui.storyboardCut": "分镜",
+ // The Storyboard track: its `+`, the camera chooser above it, the blocks and the preview.
+ "editors.stage.ui.storyboardAdd": "向分镜添加机位",
+ "editors.stage.ui.storyboardEditing": "正在编辑分镜…",
+ "editors.stage.ui.storyboardAdding": "正在添加分镜块…",
+ "editors.stage.ui.storyboardEmpty": "请先添加分镜块。",
+ "editors.stage.ui.storyboardChooser": "选择要添加到分镜的机位",
+ "editors.stage.ui.storyboardSearch": "搜索机位",
+ "editors.stage.ui.storyboardSearchEmpty": "没有匹配的机位。",
+ "editors.stage.ui.storyboardDeleteBlock": "删除分镜块",
+ "editors.stage.ui.storyboardBlockAria": "分镜块 {name},{start} 秒到 {end} 秒",
"editors.stage.ui.cameraShort": "机位",
"editors.stage.ui.target": "目标",
"editors.stage.ui.focal": "焦距(35mm 胶片,16:9 等效)",
"editors.stage.ui.verticalFov": "垂直视角 {value}°",
"editors.stage.ui.resetCamera": "重置镜头",
- "editors.stage.ui.footerHint":
- "修改机位或主体会写入当前时间的关键帧;预览、截图与 MP4 共用画幅和采样。支持分镜硬切、分段关节动作和 30 fps MP4 导出。外部 FBX/GLB 蒙皮角色与云端导演版本尚未接入。",
"editors.stage.ui.importAria": "导入导演舞台",
"editors.stage.ui.startSeconds": "开始(秒)",
"editors.stage.ui.durationSeconds": "时长(秒)",
+ "editors.stage.ui.locate": "定位",
"editors.stage.ui.previewSuffix": "预演",
} as const;
diff --git a/src/i18n/messages/zh-CN/errors.ts b/src/i18n/messages/zh-CN/errors.ts
index bdda4b443..8a1de6fb3 100644
--- a/src/i18n/messages/zh-CN/errors.ts
+++ b/src/i18n/messages/zh-CN/errors.ts
@@ -163,6 +163,9 @@ export const errors = {
"errors.backend.resultCandidate": "结果已保留为候选",
"errors.backend.mediaEmpty": "素材没有可读取的内容。",
"errors.backend.mediaReadFailed": "素材读取失败。",
+ "errors.backend.directorAssetMissing":
+ "导演台包含尚未登记为工程素材的导入资产。",
+ "errors.backend.directorStageTitle": "导演台",
"errors.backend.unsupportedGeneration": "该节点不支持生成配置。",
"errors.backend.assemblyMissing":
"装配连线对应的主体素材或时间线片段已不存在。",
@@ -173,6 +176,8 @@ export const errors = {
"errors.backend.materialReference": "素材节点不能直接接受生成参考。",
"errors.backend.fixedReferenceMissing": "固定参考版本已缺失或内容已改变。",
"errors.backend.savingResult": "结果正在保存,请稍候。",
+ "errors.backend.mediaPreparationPending":
+ "上一次媒体发布仍在准备中,请先重试后再更改输出。",
"errors.backend.editSourceUnsaved": "编辑来源尚未保存。",
"errors.backend.notDirectorStage": "不是可发布的导演舞台。",
"errors.backend.noRealMedia": "编辑来源没有真实素材。",
diff --git a/tests/browser/creation_server.py b/tests/browser/creation_server.py
index 63df50662..a49fb07f6 100644
--- a/tests/browser/creation_server.py
+++ b/tests/browser/creation_server.py
@@ -190,6 +190,71 @@ async def legacy_fixture(request: Request):
return dict(id=project_id, name=name, path=str(directory))
+@app.post('/api/creation-test-agent-storyboard')
+async def agent_storyboard(request: Request):
+ """Call the in-process Agent tool without starting a model conversation."""
+ from uuid import uuid4
+ from opendirector.agent.tools import AgentTools
+ from opendirector.domain.projects import identifier
+ from opendirector.infrastructure.creation_projects import CreationProjects
+ value = await request.json()
+ project_id = identifier(value['projectId'])
+ tool = value['tool']
+ if tool not in ('execute_command', 'query'):
+ raise ProjectError('Unknown fixture tool.', 400)
+ tools = AgentTools(CreationProjects(store), None, None)
+ return await tools.execute(
+ project_id, uuid4(), request.headers['X-OpenDirector-Session'],
+ 'storyboard-acceptance', tool, value['input'], [], None)
+
+
+@app.post('/api/creation-test-legacy-storyboard')
+async def legacy_storyboard(request: Request):
+ """Store gaps in a Director Stage's Storyboard the way a build without the
+ continuity rule saved it. Every write boundary refuses such a document today, so
+ this fixture is the only way a browser journey can hold a project with one and
+ check that the project still opens while that stage stays refused."""
+ from uuid import uuid4
+ from opendirector.domain.creation.commands import parse_command
+ from opendirector.domain.creation.project import ProjectSnapshot
+ from opendirector.domain.projects import identifier
+ from opendirector.infrastructure.creation_projects import CreationProjects
+ value = await request.json()
+ project_id, document_id = identifier(value['projectId']), identifier(value['documentId'])
+ item_id = identifier(value['itemId'])
+ shots = [dict(id=shot['id'], cameraId=shot['cameraId'], start=shot['start'], duration=shot['duration'])
+ for shot in value['shots']]
+
+ def written_by_an_older_service(before):
+ # No Storyboard rule runs when a snapshot is validated, so the store still
+ # accepts what a service without the continuity rule wrote.
+ data = before.model_dump(mode='json')
+ document = next(d for d in data['editorDocuments'] if d['id'] == document_id)
+ document['data']['shots'] = shots
+ # The store requires every changed object to advance its revision exactly once.
+ document['revision'] += 1
+ return ProjectSnapshot.model_validate(data)
+
+ # The command only names the canvas item; the mutator above is what the commit
+ # stores. Like any other write, it names the current version of each object it changes.
+ projects = CreationProjects(store)
+ snapshot = await asyncio.to_thread(projects.snapshot, project_id)
+ command = parse_command(dict(
+ commandId=uuid4(), projectId=project_id, type='canvas.update',
+ expectedVersions=[
+ dict(objectType='canvas_item', id=item_id,
+ revision=next(item.revision for item in snapshot.canvasItems if str(item.id) == item_id)),
+ dict(objectType='editor_document', id=document_id,
+ revision=next(document.revision for document in snapshot.editorDocuments
+ if str(document.id) == document_id))],
+ payload=dict(itemId=item_id)))
+ # A fixture is an external writer, so it needs no open browser session.
+ receipt = await asyncio.to_thread(projects.commit, command, written_by_an_older_service, source='external')
+ if receipt.status != 'applied':
+ raise ProjectError('The fixture could not store the legacy Storyboard.', 409)
+ return dict(status=receipt.status)
+
+
@app.post('/api/creation-test-gate')
async def gate(request: Request):
value = await request.json()
diff --git a/tests/browser/director_stage_animation.mjs b/tests/browser/director_stage_animation.mjs
new file mode 100644
index 000000000..33c4e92bc
--- /dev/null
+++ b/tests/browser/director_stage_animation.mjs
@@ -0,0 +1,250 @@
+/** Third-phase Director Stage acceptance: an animated GLB follows the stage
+ * timeline into the same sampled MP4. Runs against the isolated fixture. */
+import assert from "node:assert/strict";
+import { makeAnimatedGlb } from "./director_stage_fixture.mjs";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE ?? "playwright-core"
+);
+
+const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5179";
+const api = process.env.CREATION_API_URL ?? "http://127.0.0.1:8019";
+const headers = {
+ "X-OpenDirector-Request": "1",
+ "Content-Type": "application/json",
+};
+
+async function call(path, body) {
+ const response = await fetch(api + path, {
+ headers,
+ ...(body
+ ? { method: "POST", body: JSON.stringify(body) }
+ : {}),
+ });
+ assert.ok(response.ok, `${response.status}: ${await response.clone().text()}`);
+ return response.json();
+}
+
+assert.equal((await call("/api/creation-test-health")).isolated, true);
+
+const projectId = crypto.randomUUID();
+await call(`/api/creation/projects/${projectId}/commands`, {
+ commandId: crypto.randomUUID(),
+ projectId,
+ type: "project.create",
+ payload: { name: `Director animation ${projectId.slice(0, 8)}` },
+});
+
+const state = () => call(`/api/creation/projects/${projectId}`);
+const browser = await chromium.launch({
+ headless: true,
+ ...(process.env.CHROMIUM_PATH
+ ? { executablePath: process.env.CHROMIUM_PATH }
+ : {}),
+ args: ["--no-sandbox", "--enable-unsafe-swiftshader"],
+});
+const page = await browser.newPage({
+ locale: "en-US",
+ viewport: { width: 1700, height: 1100 },
+});
+await page.addInitScript(() =>
+ localStorage.setItem("opendirector.modelSetup.v1", "dismissed"),
+);
+page.setDefaultTimeout(20000);
+const errors = [];
+page.on("pageerror", (error) => errors.push(error.message));
+
+const until = async (predicate, label) => {
+ const deadline = Date.now() + 20000;
+ let snapshot;
+ while (Date.now() < deadline) {
+ snapshot = await state();
+ if (predicate(snapshot)) return snapshot;
+ await page.waitForTimeout(100);
+ }
+ throw new Error(`Timeout: ${label}; snapshot: ${JSON.stringify(snapshot)}`);
+};
+
+const directorDocument = (snapshot) =>
+ snapshot.editorDocuments.find(
+ (candidate) => candidate.kind === "director",
+ );
+
+try {
+ await page.goto(`${base}/ai-tool/ai-canvas/${projectId}?creation=unified`);
+ await page.getByText("Saved on this device", { exact: true }).waitFor();
+ await page
+ .getByRole("button", { name: "Add Director Stage", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor();
+ await until(
+ (snapshot) => directorDocument(snapshot)?.kind === "director",
+ "created director document",
+ );
+ const itemId = (await state()).canvasItems.find(
+ (item) => item.kind === "external",
+ ).id;
+
+ await page.getByLabel("Stage duration", { exact: true }).fill("2");
+ await page.getByLabel("Stage duration", { exact: true }).press("Enter");
+ await until((snapshot) => directorDocument(snapshot)?.data.duration === 2, "stage duration saved");
+ await page
+ .locator('input[type="file"][accept*=".glb"]')
+ .setInputFiles({
+ name: "walker.glb",
+ mimeType: "model/gltf-binary",
+ buffer: makeAnimatedGlb(),
+ });
+ await page
+ .getByText("Imported walker · 1 animation clips", { exact: true })
+ .waitFor();
+ await page
+ .getByRole("button", { name: "walker", exact: true })
+ .waitFor();
+
+ const playhead = page.getByRole("slider", { name: "Stage playhead", exact: true });
+ const viewport = page.getByRole("img", {
+ name: "Interactive 3D director stage",
+ exact: true,
+ });
+ await viewport.waitFor();
+ // Screenshots of the same pose differ by rasterization jitter alone, so
+ // compare decoded pixels: identical poses stay near zero, a rotated model
+ // does not. Byte equality is too strict for WebGL output.
+ const pixelDiff = async (a, b) =>
+ page.evaluate(async ([aSrc, bSrc]) => {
+ const load = (src) =>
+ new Promise((resolve, reject) => {
+ const image = new Image();
+ image.onload = () => resolve(image);
+ image.onerror = reject;
+ image.src = src;
+ });
+ const [first, second] = [await load(aSrc), await load(bSrc)];
+ const canvas = document.createElement("canvas");
+ canvas.width = first.width;
+ canvas.height = first.height;
+ const context = canvas.getContext("2d", { willReadFrequently: true });
+ context.drawImage(first, 0, 0);
+ const left = context.getImageData(0, 0, canvas.width, canvas.height).data;
+ context.clearRect(0, 0, canvas.width, canvas.height);
+ context.drawImage(second, 0, 0);
+ const right = context.getImageData(0, 0, canvas.width, canvas.height).data;
+ let max = 0,
+ total = 0;
+ for (let i = 0; i < left.length; i += 4) {
+ const channel = Math.max(
+ Math.abs(left[i] - right[i]),
+ Math.abs(left[i + 1] - right[i + 1]),
+ Math.abs(left[i + 2] - right[i + 2]),
+ );
+ max = Math.max(max, channel);
+ total += channel;
+ }
+ return { max, mean: total / (left.length / 4) };
+ }, [
+ `data:image/png;base64,${a.toString("base64")}`,
+ `data:image/png;base64,${b.toString("base64")}`,
+ ]);
+
+ await playhead.fill("1");
+ await page
+ .getByRole("button", { name: "Add motion at playhead", exact: true })
+ .click();
+ await page.getByLabel("Motion 1", { exact: true }).waitFor();
+ // Rest baseline with the clip already present: the viewport shows a
+ // persistent indicator on objects carrying a clip, so the pose comparison
+ // must not straddle that change. The clip spans [1, 2].
+ await playhead.fill("0.1");
+ await page.waitForTimeout(200);
+ const rest = await viewport.screenshot();
+ // 1.5 is inside the clip, 0.1 has left it again.
+ await playhead.fill("1.5");
+ await page.waitForTimeout(200);
+ const animated = await viewport.screenshot();
+ await playhead.fill("0.1");
+ await page.waitForTimeout(200);
+ const restored = await viewport.screenshot();
+ const animatedDiff = await pixelDiff(restored, animated);
+ assert.ok(
+ animatedDiff.mean > 0.2,
+ `playhead scrub animates the imported model (mean=${animatedDiff.mean})`,
+ );
+ const restoreDiff = await pixelDiff(restored, rest);
+ assert.ok(
+ restoreDiff.mean < 0.1 && restoreDiff.max <= 8,
+ `leaving the motion clip restores the authored rest pose (mean=${restoreDiff.mean}, max=${restoreDiff.max})`,
+ );
+
+ await page
+ .getByRole("button", { name: "Render preview MP4", exact: true })
+ .click();
+ // The render button opens the export dialog; the defaults (active camera,
+ // standard quality, 30 FPS) match what this flow used to render directly.
+ await page
+ .getByRole("dialog", { name: "Export video" })
+ .getByRole("button", { name: "Export", exact: true })
+ .click();
+ await page
+ .getByText("Preview MP4 complete · 1280×720 · 30 fps", { exact: true })
+ .waitFor({ timeout: 240000 });
+ // Applying saves and closes the stage editor in one step.
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor({ state: "detached" });
+
+ const committed = await until((snapshot) => {
+ const document = directorDocument(snapshot);
+ const imported = document?.data.objects.find(
+ (object) => object.kind === "gltf",
+ );
+ return (
+ imported?.animationNames?.length === 1 &&
+ imported?.motionClips?.length === 1
+ );
+ }, "committed animated stage document");
+ const document = directorDocument(committed);
+ const imported = document.data.objects.find((object) => object.kind === "gltf");
+ assert.deepEqual(imported.animationNames, ["Walk"]);
+ assert.equal(imported.hasAnimation, true);
+ assert.deepEqual(
+ { start: imported.motionClips[0].start, duration: imported.motionClips[0].duration },
+ { start: 1, duration: 1 },
+ );
+ assert.equal(imported.motionClips[0].motion.preset, "walk");
+ assert.ok(
+ committed.assets.some((asset) => asset.id === imported.asset.assetId),
+ "the animated model registers as a project asset",
+ );
+
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor({ state: "detached" });
+ assert.deepEqual(errors, []);
+ console.log(
+ JSON.stringify({
+ passed: true,
+ projectId,
+ itemId,
+ documentId: document.id,
+ checks: [
+ "animated GLB import discovers clips",
+ "motion clip binds the imported model",
+ "playhead scrub animates the preview",
+ "leaving the motion clip restores the authored rest pose",
+ "MP4 renders through the same sampling",
+ "animation metadata and motion clip persist",
+ "no page errors",
+ ],
+ }),
+ );
+} catch (error) {
+ console.error((await page.locator("body").innerText()).slice(-2500));
+ throw error;
+} finally {
+ await browser.close();
+}
diff --git a/tests/browser/director_stage_console.mjs b/tests/browser/director_stage_console.mjs
new file mode 100644
index 000000000..2b20945dc
--- /dev/null
+++ b/tests/browser/director_stage_console.mjs
@@ -0,0 +1,423 @@
+/** Console-phase acceptance: controls cheat-sheet, split live preview and
+ * transform sliders over the fullscreen console. */
+import assert from "node:assert/strict";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE ?? "playwright-core"
+);
+
+const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5179";
+const api = process.env.CREATION_API_URL ?? "http://127.0.0.1:8019";
+const headers = {
+ "X-OpenDirector-Request": "1",
+ "Content-Type": "application/json",
+};
+
+async function call(path, body, extra = {}) {
+ const response = await fetch(api + path, {
+ headers: { ...headers, ...extra },
+ ...(body ? { method: "POST", body: JSON.stringify(body) } : {}),
+ });
+ assert.ok(response.ok, `${response.status}: ${await response.clone().text()}`);
+ return response.json();
+}
+
+assert.equal((await call("/api/creation-test-health")).isolated, true);
+
+const projectId = crypto.randomUUID();
+await call(`/api/creation/projects/${projectId}/commands`, {
+ commandId: crypto.randomUUID(),
+ projectId,
+ type: "project.create",
+ payload: { name: `Console ${projectId.slice(0, 8)}` },
+});
+const state = () => call(`/api/creation/projects/${projectId}`);
+const browser = await chromium.launch({
+ headless: true,
+ ...(process.env.CHROMIUM_PATH
+ ? { executablePath: process.env.CHROMIUM_PATH }
+ : {}),
+ args: ["--no-sandbox", "--enable-unsafe-swiftshader"],
+});
+const page = await browser.newPage({
+ locale: "en-US",
+ viewport: { width: 1700, height: 1100 },
+});
+await page.addInitScript(() =>
+ localStorage.setItem("opendirector.modelSetup.v1", "dismissed"),
+);
+page.setDefaultTimeout(20000);
+const errors = [];
+page.on("pageerror", (error) => errors.push(error.message));
+
+const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
+const until = async (predicate, label) => {
+ const deadline = Date.now() + 20000;
+ let snapshot;
+ while (Date.now() < deadline) {
+ snapshot = await state();
+ if (predicate(snapshot)) return snapshot;
+ await sleep(100);
+ }
+ throw new Error(`Timeout: ${label}; snapshot: ${JSON.stringify(snapshot)}`);
+};
+const stageDoc = (snapshot) =>
+ snapshot.editorDocuments.find((candidate) => candidate.kind === "director");
+
+let itemId;
+try {
+ await page.goto(`${base}/ai-tool/ai-canvas/${projectId}?creation=unified`);
+ await page.getByText("Saved on this device", { exact: true }).waitFor();
+ await page
+ .getByRole("button", { name: "Add Director Stage", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor();
+ const created = await until(
+ (snapshot) => stageDoc(snapshot)?.kind === "director",
+ "created director document",
+ );
+ itemId = created.canvasItems.find((item) => item.kind === "external").id;
+
+ // The first completed placement opens the console controls once: arm,
+ // land the click, then the panel appears.
+ const scene = await page.locator(".cw-stage-scene").boundingBox();
+ assert.ok(scene);
+ await page
+ .locator('.cw-stage-object-grid button[data-stage-placement-kind="person"]')
+ .first()
+ .click();
+ await page.mouse.click(
+ scene.x + scene.width * 0.55,
+ scene.y + scene.height * 0.5,
+ );
+ const firstHelp = page.getByRole("dialog", { name: "Director console controls" });
+ await firstHelp.getByText("Left-drag · orbit").waitFor();
+ await firstHelp
+ .getByRole("button", { name: "Close help", exact: true })
+ .click();
+ assert.equal(
+ await page
+ .getByRole("dialog", { name: "Director console controls" })
+ .count(),
+ 0,
+ );
+ const objectHeading = page.locator(
+ ".cw-stage-right-tree-panel > .cw-stage-panel-heading",
+ );
+ const propertiesHeading = page.locator(
+ ".cw-stage-inspector > .cw-stage-panel-heading",
+ );
+ const objectHeadingBox = await objectHeading.boundingBox();
+ const propertiesHeadingBox = await propertiesHeading.boundingBox();
+ assert.ok(objectHeadingBox && propertiesHeadingBox);
+ assert.ok(
+ Math.abs(objectHeadingBox.x - propertiesHeadingBox.x) <= 1,
+ `object and properties headings share the same left edge: ${JSON.stringify({ objectHeadingBox, propertiesHeadingBox })}`,
+ );
+ const objectIconBox = await objectHeading
+ .locator(".cw-stage-panel-icon")
+ .boundingBox();
+ const propertiesIconBox = await propertiesHeading
+ .locator(".cw-stage-panel-icon")
+ .boundingBox();
+ assert.ok(objectIconBox && propertiesIconBox);
+ assert.ok(
+ Math.abs(
+ objectIconBox.x -
+ objectHeadingBox.x -
+ (propertiesIconBox.x - propertiesHeadingBox.x),
+ ) <= 1 &&
+ Math.abs(objectIconBox.width - propertiesIconBox.width) <= 1 &&
+ Math.abs(objectIconBox.height - propertiesIconBox.height) <= 1 &&
+ Math.abs(
+ objectIconBox.y -
+ objectHeadingBox.y -
+ (propertiesIconBox.y - propertiesHeadingBox.y),
+ ) <= 1,
+ `object and properties icons align: ${JSON.stringify({ objectIconBox, propertiesIconBox })}`,
+ );
+ // A second placement does not reopen it: the marker is one-shot.
+ await page
+ .locator('.cw-stage-object-grid button[data-stage-placement-kind="person"]')
+ .first()
+ .click();
+ await page.mouse.click(
+ scene.x + scene.width * 0.45,
+ scene.y + scene.height * 0.5,
+ );
+ await page.waitForTimeout(300);
+ assert.equal(
+ await page
+ .getByRole("dialog", { name: "Director console controls" })
+ .count(),
+ 0,
+ );
+ // The top-bar entry reopens the same panel; Escape owns the close.
+ await page
+ .getByRole("button", { name: "Shortcuts", exact: true })
+ .click();
+ const reopened = page.getByRole("dialog", { name: "Director console controls" });
+ await reopened.waitFor();
+ await reopened.hover();
+ await page.keyboard.press("Escape");
+ assert.equal(
+ await page
+ .getByRole("dialog", { name: "Director console controls" })
+ .count(),
+ 0,
+ "Escape closes the help panel without guard-closing the editor",
+ );
+ assert.equal(
+ await page.getByRole("button", { name: "Apply edits", exact: true }).count(),
+ 1,
+ "the editor itself stays open",
+ );
+
+ // Transform values use the compact Jiemeng-style drag rows and pair with
+ // exact inputs. Groups can collapse without losing their current values.
+ await page
+ .locator('.cw-stage-object-grid button[data-stage-placement-kind="person"]')
+ .first()
+ .click();
+ const positionGroup = page.getByRole("button", {
+ name: "Position",
+ exact: true,
+ });
+ await positionGroup.waitFor();
+ assert.equal(
+ await positionGroup.getAttribute("aria-expanded"),
+ "true",
+ "position group starts expanded",
+ );
+ await positionGroup.click();
+ assert.equal(
+ await page.getByLabel("Position X", { exact: true }).count(),
+ 0,
+ "position group collapses its controls",
+ );
+ await positionGroup.click();
+
+ const positionSlider = page.getByRole("slider", {
+ name: "Position X slider",
+ exact: true,
+ });
+ await positionSlider.waitFor();
+ assert.equal(
+ await page.getByRole("button", { name: "Rotation", exact: true }).count(),
+ 1,
+ "rotation groups do not append a redundant degrees suffix",
+ );
+ assert.equal(
+ await page
+ .getByRole("button", { name: "Rotation (degrees)", exact: true })
+ .count(),
+ 0,
+ "rotation groups omit the old degrees suffix",
+ );
+ assert.equal(
+ await positionSlider.evaluate((element) => getComputedStyle(element).cursor),
+ "ew-resize",
+ "position value uses a horizontal drag cursor",
+ );
+ const positionInput = page.getByLabel("Position X", { exact: true });
+ assert.equal(
+ await positionInput.getAttribute("step"),
+ "0.01",
+ "drag values expose hundredth precision",
+ );
+ assert.equal(
+ await positionSlider.getAttribute("aria-valuemin"),
+ "-20",
+ "position values expose a lower bound",
+ );
+ assert.equal(
+ await positionSlider.getAttribute("aria-valuemax"),
+ "20",
+ "position values expose an upper bound",
+ );
+ assert.equal(
+ await positionSlider
+ .locator(".cw-stage-drag-value-label")
+ .getAttribute("title"),
+ "Position X",
+ "the compact axis label keeps the complete field name available",
+ );
+ const numberBox = positionSlider.locator(".cw-stage-drag-value-number");
+ assert.equal(
+ await numberBox.evaluate((element) => getComputedStyle(element).minWidth),
+ "0px",
+ "the numeric value owns a shrinkable layout box",
+ );
+ assert.equal(
+ await positionInput.evaluate((element) => getComputedStyle(element).textAlign),
+ "right",
+ "numeric values stay right aligned",
+ );
+ const sliderBox = await positionSlider.boundingBox();
+ assert.ok(sliderBox, "position drag row is visible");
+ await positionInput.fill("-19.99");
+ assert.equal(
+ await positionInput.inputValue(),
+ "-19.99",
+ "long signed values keep both decimal places",
+ );
+ const longValueBox = await positionInput.boundingBox();
+ assert.ok(longValueBox, "long numeric value remains measurable");
+ assert.ok(
+ longValueBox.x + longValueBox.width <= sliderBox?.x + sliderBox?.width + 1,
+ "long numeric values stay inside the drag row",
+ );
+ await positionInput.fill("12345.67");
+ assert.equal(
+ await positionInput.inputValue(),
+ "20",
+ "values above the upper bound are clamped",
+ );
+ await positionInput.fill("-12345.67");
+ assert.equal(
+ await positionInput.inputValue(),
+ "-20",
+ "values below the lower bound are clamped",
+ );
+ await positionInput.fill("0.01");
+ assert.equal(
+ await positionInput.inputValue(),
+ "0.01",
+ "exact input accepts two decimal places",
+ );
+ const initialPositionX = Number(await positionInput.inputValue());
+ const inputBox = await positionInput.boundingBox();
+ assert.ok(inputBox, "position exact input is visible");
+ assert.ok(
+ Math.abs(sliderBox.width - inputBox.width) <= 2 &&
+ Math.abs(sliderBox.height - inputBox.height) <= 2 &&
+ Math.abs(sliderBox.x - inputBox.x) <= 1 &&
+ Math.abs(sliderBox.y - inputBox.y) <= 1,
+ `the exact input covers the drag row instead of producing a second-sized box: ${JSON.stringify({ inputBox, sliderBox })}`,
+ );
+ assert.equal(
+ await positionInput.evaluate((element) => getComputedStyle(element).outlineStyle),
+ "none",
+ "dragging the exact input does not render an inner focus outline",
+ );
+ await page.evaluate(() => {
+ window.__stageNativeDragStarts = 0;
+ document.addEventListener(
+ "dragstart",
+ () => {
+ window.__stageNativeDragStarts += 1;
+ },
+ true,
+ );
+ });
+ const dragY = inputBox.y + inputBox.height / 2;
+ await page.mouse.move(inputBox.x + inputBox.width / 2, dragY);
+ await page.mouse.down();
+ await page.mouse.move(inputBox.x + inputBox.width / 2 + 48, dragY, {
+ steps: 8,
+ });
+ await page.mouse.up();
+ const draggedPositionX = Number(await positionInput.inputValue());
+ assert.ok(
+ draggedPositionX > initialPositionX,
+ "dragging the value row updates the exact input immediately",
+ );
+ assert.equal(
+ await page.evaluate(() => window.__stageNativeDragStarts),
+ 0,
+ "dragging the input does not create a native duplicate drag box",
+ );
+ assert.equal(
+ draggedPositionX,
+ Number((initialPositionX + 0.06).toFixed(2)),
+ "dragging uses hundredth increments",
+ );
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor({ state: "detached" });
+ const saved = await until(
+ (snapshot) =>
+ stageDoc(snapshot)?.data.objects.some(
+ (object) => Math.abs(object.position.x - draggedPositionX) < 1e-6,
+ ),
+ "slider-driven position persists",
+ );
+ const movedId = saved.editorDocuments
+ .find((doc) => doc.kind === "director")
+ .data.objects.find(
+ (object) => Math.abs(object.position.x - draggedPositionX) < 1e-6,
+ ).id;
+
+ // Select a camera in the object tree before editing its inspector. The
+ // property panel follows the selected scene object rather than the asset
+ // library tab.
+ await page.locator(`.react-flow__node[data-id="${itemId}"]`).click();
+ await page
+ .getByRole("button", { name: "Open Director Stage", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor();
+ await page
+ .getByRole("tab", { name: "Cameras", exact: true })
+ .click();
+ await page
+ .getByRole("treeitem")
+ .getByRole("button", { name: "Camera 1", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Duplicate as new camera", exact: true })
+ .click();
+ assert.equal(
+ await page.getByLabel("Camera name", { exact: true }).inputValue(),
+ "Camera 2",
+ "duplicating a camera selects the new camera in the inspector",
+ );
+ const cameraPreview = page.getByRole("button", { name: "Camera preview", exact: true });
+ assert.equal(await cameraPreview.getAttribute("aria-expanded"), "true");
+ await cameraPreview.click();
+ assert.equal(await cameraPreview.getAttribute("aria-expanded"), "false");
+ await cameraPreview.click();
+ assert.equal(await cameraPreview.getAttribute("aria-expanded"), "true");
+
+ // The preview selection is editor-local: the moved object stays as saved.
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor({ state: "detached" });
+ const final = await state();
+ assert.ok(
+ final.editorDocuments
+ .find((doc) => doc.kind === "director")
+ .data.objects.some((object) => object.id === movedId),
+ "the slider-moved object survives",
+ );
+ assert.deepEqual(errors, []);
+} catch (error) {
+ console.error((await page.locator("body").innerText()).slice(-2500));
+ throw error;
+} finally {
+ await browser.close();
+}
+console.log(
+ JSON.stringify({
+ passed: true,
+ projectId,
+ itemId,
+ checks: [
+ "first object add opens the console controls once",
+ "the top-bar shortcuts entry reopens the panel",
+ "Escape closes the help panel without closing the editor",
+ "transform sliders drive the exact inputs and persist",
+ "the right inspector duplicates a camera",
+ "the independent preview follows the selected camera",
+ "no page errors",
+ ],
+ }),
+);
diff --git a/tests/browser/director_stage_delivery.mjs b/tests/browser/director_stage_delivery.mjs
new file mode 100644
index 000000000..73bd6858d
--- /dev/null
+++ b/tests/browser/director_stage_delivery.mjs
@@ -0,0 +1,165 @@
+/** A stored editor delivery that the backend definitively refuses (422) must
+ * not replay forever: the Director Stage recovers on the next attempt. */
+import assert from "node:assert/strict";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE ?? "playwright-core"
+);
+
+const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5179";
+const api = process.env.CREATION_API_URL ?? "http://127.0.0.1:8019";
+const headers = {
+ "X-OpenDirector-Request": "1",
+ "Content-Type": "application/json",
+};
+async function call(path, body) {
+ const response = await fetch(api + path, {
+ headers,
+ ...(body ? { method: "POST", body: JSON.stringify(body) } : {}),
+ });
+ assert.ok(response.ok, `${response.status}: ${await response.clone().text()}`);
+ return response.json();
+}
+assert.equal((await call("/api/creation-test-health")).isolated, true);
+
+const projectId = crypto.randomUUID();
+await call(`/api/creation/projects/${projectId}/commands`, {
+ commandId: crypto.randomUUID(),
+ projectId,
+ type: "project.create",
+ payload: { name: `Stage delivery ${projectId.slice(0, 8)}` },
+});
+const state = () => call(`/api/creation/projects/${projectId}`);
+
+const browser = await chromium.launch({
+ headless: true,
+ ...(process.env.CHROMIUM_PATH ? { executablePath: process.env.CHROMIUM_PATH } : {}),
+ args: ["--no-sandbox", "--enable-unsafe-swiftshader"],
+});
+const page = await browser.newPage({
+ locale: "en-US",
+ viewport: { width: 1700, height: 1100 },
+});
+await page.addInitScript(() =>
+ localStorage.setItem("opendirector.modelSetup.v1", "dismissed"),
+);
+page.setDefaultTimeout(20000);
+const errors = [];
+page.on("pageerror", (error) => errors.push(error.message));
+
+const until = async (predicate, label) => {
+ const deadline = Date.now() + 20000;
+ let snapshot;
+ while (Date.now() < deadline) {
+ snapshot = await state();
+ if (predicate(snapshot)) return snapshot;
+ await page.waitForTimeout(100);
+ }
+ throw new Error(`Timeout: ${label}`);
+};
+
+try {
+ await page.goto(`${base}/ai-tool/ai-canvas/${projectId}?creation=unified`);
+ await page.getByText("Saved on this device", { exact: true }).waitFor();
+ await page.getByRole("button", { name: "Add Director Stage", exact: true }).click();
+ await page.getByRole("button", { name: "Apply edits", exact: true }).waitFor();
+ // Baseline save registers the editor document; the delivery key needs the item.
+ await page.getByRole("button", { name: "Apply edits", exact: true }).click();
+ const applied = await until(
+ (snapshot) => snapshot.editorDocuments.some((d) => d.kind === "director"),
+ "stage saved",
+ );
+ const itemId = applied.canvasItems.find((i) => i.kind === "external").id;
+ const documentId = applied.editorDocuments.find((d) => d.kind === "director").id;
+ await page.getByRole("button", { name: "Add Director Stage", exact: true }).waitFor();
+
+ // Poison the stored delivery the way a mid-transition failure leaves it: a
+ // prepared plan whose operations the backend now refuses at the HTTP
+ // boundary. A reload keeps the entry, exactly like a long-lived tab.
+ await page.evaluate(
+ ([projectId, itemId]) => {
+ sessionStorage.setItem(
+ `opendirector.editor.delivery:${projectId}:${itemId}`,
+ JSON.stringify({
+ id: crypto.randomUUID(),
+ key: JSON.stringify({ title: "Director Stage 1" }),
+ data: { title: "Director Stage 1" },
+ plan: {
+ operations: [
+ {
+ type: "editor.save",
+ payload: {
+ document: {
+ id: crypto.randomUUID(),
+ projectId,
+ kind: "director",
+ data: { legacyJunk: true },
+ },
+ },
+ },
+ ],
+ versions: [],
+ },
+ }),
+ );
+ },
+ [projectId, itemId],
+ );
+ await page.reload();
+ await page.getByText("Saved on this device", { exact: true }).waitFor();
+
+ await page.locator(`.react-flow__node[data-id="${itemId}"]`).click();
+ await page.getByRole("button", { name: "Open Director Stage", exact: true }).click();
+ await page.getByRole("button", { name: "Apply edits", exact: true }).waitFor();
+
+ // The refused delivery may cost one attempt — the reported error dialog —
+ // but never more: rendering must recover without discarding the edits.
+ const render = page.getByRole("button", { name: "Render preview MP4", exact: true });
+ await render.click();
+ const recovered = await page
+ .getByText("Preview MP4 complete · 1280×720 · 30 fps", { exact: true })
+ .waitFor({ timeout: 240000 })
+ .then(() => true, () => false);
+ if (!recovered) {
+ // The single refusal surfaced; the retry replans with current code.
+ await page.getByRole("alert").waitFor();
+ assert.equal(await render.isDisabled(), false, "editor stays operable");
+ await render.click();
+ await page
+ .getByText("Preview MP4 complete · 1280×720 · 30 fps", { exact: true })
+ .waitFor({ timeout: 240000 });
+ }
+
+ // Applying also recovers: the same stored delivery cannot block the commit.
+ await page.getByRole("button", { name: "Apply edits", exact: true }).click();
+ await page
+ .getByRole("button", { name: "Add Director Stage", exact: true })
+ .waitFor();
+ await until(
+ (snapshot) =>
+ snapshot.editorDocuments.some(
+ (d) => d.id === documentId && d.revision >= 2,
+ ),
+ "stage committed after recovery",
+ );
+
+ assert.deepEqual(errors, []);
+ console.log(
+ JSON.stringify({
+ passed: true,
+ projectId,
+ itemId,
+ documentId,
+ checks: [
+ "a refused stored delivery costs at most one attempt",
+ "the retry replans instead of replaying the refused operations",
+ "preview MP4 renders and apply recovers",
+ "no page errors",
+ ],
+ }),
+ );
+} catch (error) {
+ console.error((await page.locator("body").innerText()).slice(-2500));
+ throw error;
+} finally {
+ await browser.close();
+}
diff --git a/tests/browser/director_stage_entry.mjs b/tests/browser/director_stage_entry.mjs
new file mode 100644
index 000000000..2425f7a5c
--- /dev/null
+++ b/tests/browser/director_stage_entry.mjs
@@ -0,0 +1,938 @@
+/** Second-phase Director Stage acceptance: create, import GLB, edit, reopen, undo, and redo.
+ * DIRECTOR_STAGE_LOCALE runs the same flow in another UI language (default en-US). */
+import assert from "node:assert/strict";
+import { makeCorruptGlb, makeGlb } from "./director_stage_fixture.mjs";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE ?? "playwright-core"
+);
+
+const locale = process.env.DIRECTOR_STAGE_LOCALE ?? "en-US";
+const L = {
+ "en-US": {
+ saved: "Saved on this device",
+ addStage: "Add Director Stage",
+ apply: "Apply edits",
+ cameraName: "Camera name",
+ playhead: "Stage playhead",
+ timeline: "Director Stage timeline tracks",
+ previewMode: "Preview mode",
+ staticPreview: "Static",
+ dynamicPreview: "Dynamic",
+ positionX: "Position X",
+ recordKeyframe: "Record a keyframe here",
+ closeEditor: "Close editor",
+ transitionEditor: "Acceptance camera · Target interval transition editor",
+ transition: "Transition",
+ bezier: "Bezier",
+ controlX1: "Control point x1",
+ undo: "Undo",
+ redo: "Redo",
+ openStage: "Open Director Stage",
+ importAsset: "Import GLB / GLTF",
+ importJson: "Import stage JSON",
+ exportJson: "Export stage JSON",
+ background: "Background",
+ backgroundAsset: "Background image",
+ backgroundAll: "All",
+ backgroundPanoramic: "Panoramic background",
+ backgroundFlat: "Flat background",
+ backgroundAdd: "Add background",
+ backgroundCanvasImages: "Canvas images",
+ backgroundEmpty:
+ "No backgrounds yet. Upload an image or choose one from the canvas images.",
+ backgroundImported: "Added background “acceptance-background.png”",
+ environmentPreset: "Environment preset",
+ groundColor: "Ground color",
+ groundVisible: "Show ground",
+ exposure: "Exposure",
+ keyLight: "Key light",
+ keyIntensity: "Key light intensity",
+ noAnimationNote: "Character · Imported acceptance · no animation data",
+ corruptAssetNotice:
+ "Could not read “broken.glb”: the GLB header is valid but the embedded JSON is missing or corrupt.",
+ loadFailedNotice:
+ "Could not load “broken.glb”. The file may be corrupt or reference external resources.",
+ unsupportedAssetNotice:
+ "Only GLB and self-contained GLTF files are supported. FBX and external GLTF resources are not supported yet.",
+ exportUnsavedImportsNotice:
+ "The stage file cannot carry imported models that exist only in this browser: acceptance. Apply edits to save them to the project first.",
+ importForeignAssetsNotice:
+ "The stage file pins imported models that are not registered in this project: Foreign actor. Open the stage in its original project, or import the model files here first.",
+ },
+ "zh-CN": {
+ saved: "已保存到本机",
+ addStage: "添加导演台",
+ apply: "应用编辑",
+ cameraName: "机位名称",
+ playhead: "舞台播放位置",
+ timeline: "导演舞台时间线轨道",
+ previewMode: "预演模式",
+ staticPreview: "静态",
+ dynamicPreview: "动态",
+ positionX: "位置 X",
+ recordKeyframe: "在此记录关键帧",
+ closeEditor: "关闭编辑器",
+ transitionEditor: "Acceptance camera · 目标区间变化编辑器",
+ transition: "过渡",
+ bezier: "贝塞尔",
+ controlX1: "控制点 x1",
+ undo: "撤销",
+ redo: "重做",
+ openStage: "打开导演台",
+ importAsset: "导入 GLB / GLTF",
+ importJson: "导入舞台 JSON",
+ exportJson: "导出舞台 JSON",
+ background: "背景",
+ backgroundAsset: "背景图片",
+ backgroundAll: "全部",
+ backgroundPanoramic: "全景背景",
+ backgroundFlat: "平面背景",
+ backgroundAdd: "添加背景",
+ backgroundCanvasImages: "画布图片",
+ backgroundEmpty: "暂无背景。上传图片或从画布图片中选择。",
+ backgroundImported: "已添加背景「acceptance-background.png」",
+ environmentPreset: "环境预设",
+ groundColor: "地面颜色",
+ groundVisible: "显示地面",
+ exposure: "曝光",
+ keyLight: "主光",
+ keyIntensity: "主光强度",
+ noAnimationNote: "人物 · 已导入 acceptance · 无动画数据",
+ corruptAssetNotice:
+ "无法读取「broken.glb」:GLB 头有效,但内嵌 JSON 缺失或已损坏。",
+ loadFailedNotice:
+ "无法加载「broken.glb」。文件可能损坏,或引用了外部资源。",
+ unsupportedAssetNotice:
+ "目前仅支持 GLB 和自包含 GLTF;FBX 及外部 GLTF 资源暂不支持。",
+ exportUnsavedImportsNotice:
+ "舞台文件无法携带仅存在于当前浏览器的导入模型:acceptance。请先应用编辑,将其保存为工程素材。",
+ importForeignAssetsNotice:
+ "舞台文件引用了未在本工程登记的导入模型:Foreign actor。请在原工程中打开,或先在此工程导入对应模型文件。",
+ },
+}[locale];
+assert.ok(L, `Unsupported DIRECTOR_STAGE_LOCALE: ${locale}`);
+
+const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5179";
+const api = process.env.CREATION_API_URL ?? "http://127.0.0.1:8019";
+const headers = {
+ "X-OpenDirector-Request": "1",
+ "Content-Type": "application/json",
+};
+
+async function call(path, body) {
+ const response = await fetch(api + path, {
+ headers,
+ ...(body
+ ? { method: "POST", body: JSON.stringify(body) }
+ : {}),
+ });
+ assert.ok(response.ok, `${response.status}: ${await response.clone().text()}`);
+ return response.json();
+}
+
+assert.equal((await call("/api/creation-test-health")).isolated, true);
+
+const projectId = crypto.randomUUID();
+await call(`/api/creation/projects/${projectId}/commands`, {
+ commandId: crypto.randomUUID(),
+ projectId,
+ type: "project.create",
+ payload: { name: `Director Stage entry ${projectId.slice(0, 8)}` },
+});
+
+const state = () => call(`/api/creation/projects/${projectId}`);
+const browser = await chromium.launch({
+ headless: true,
+ ...(process.env.CHROMIUM_PATH
+ ? { executablePath: process.env.CHROMIUM_PATH }
+ : {}),
+ args: ["--no-sandbox", "--enable-unsafe-swiftshader"],
+});
+const page = await browser.newPage({
+ locale,
+ viewport: { width: 1700, height: 1100 },
+});
+await page.addInitScript((value) => {
+ localStorage.setItem("opendirector.modelSetup.v1", "dismissed");
+ localStorage.setItem("opendirector.locale.v1", value);
+}, locale);
+page.setDefaultTimeout(20000);
+const errors = [];
+page.on("pageerror", (error) => errors.push(error.message));
+
+const until = async (predicate, label) => {
+ const deadline = Date.now() + 20000;
+ let snapshot;
+ while (Date.now() < deadline) {
+ snapshot = await state();
+ if (predicate(snapshot)) return snapshot;
+ await page.waitForTimeout(100);
+ }
+ throw new Error(`Timeout: ${label}; snapshot: ${JSON.stringify(snapshot)}`);
+};
+
+const director = (snapshot, itemId) => {
+ const item = snapshot.canvasItems.find(
+ (candidate) =>
+ candidate.id === itemId ||
+ (itemId === undefined &&
+ candidate.visible &&
+ candidate.kind === "external"),
+ );
+ const document = item
+ ? snapshot.editorDocuments.find(
+ (candidate) => candidate.id === item.binding?.objectRef?.id,
+ )
+ : undefined;
+ return { item, document };
+};
+
+const keyframeCount = (document) =>
+ document.data.objects.reduce(
+ (count, object) => count + object.keyframes.length,
+ 0,
+ ) +
+ document.data.cameras.reduce(
+ (count, camera) => count + camera.keyframes.length,
+ 0,
+ );
+
+// A well-formed stage document pinning a model asset this project never
+// registered; import must refuse it by naming the object.
+const foreignStage = {
+ format: "opendirector-local-stage",
+ version: 2,
+ background: "#151923",
+ grid: true,
+ duration: 6,
+ aspectRatio: "16:9",
+ activeCameraId: "camera-1",
+ cameraSource: "camera",
+ shots: [],
+ cameras: [
+ {
+ id: "camera-1",
+ name: "Camera",
+ pose: {
+ position: { x: 5, y: 3.5, z: 7 },
+ target: { x: 0, y: 1, z: 0 },
+ fov: 45,
+ },
+ keyframes: [],
+ },
+ ],
+ objects: [
+ {
+ id: "foreign-actor",
+ kind: "gltf",
+ name: "Foreign actor",
+ color: "#b8c5ff",
+ role: "character",
+ format: "glb",
+ asset: {
+ assetId: crypto.randomUUID(),
+ revision: 1,
+ fingerprint: `sha256:${"c".repeat(64)}`,
+ kind: "file",
+ },
+ animationNames: ["Walk"],
+ hasAnimation: true,
+ position: { x: 0, y: 0, z: 0 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ keyframes: [],
+ motionClips: [],
+ },
+ ],
+};
+
+try {
+ await page.goto(`${base}/ai-tool/ai-canvas/${projectId}?creation=unified`);
+ await page.getByText(L.saved, { exact: true }).waitFor();
+
+ const addStage = page.getByRole("button", {
+ name: L.addStage,
+ exact: true,
+ });
+ await addStage.waitFor();
+ assert.equal(await addStage.isEnabled(), true);
+ await addStage.click();
+
+ await page
+ .getByRole("button", { name: L.apply, exact: true })
+ .waitFor();
+ const created = await until((snapshot) => {
+ const result = director(snapshot);
+ return result.item?.kind === "external" && result.document?.kind === "director";
+ }, "created external item and director document");
+ const createdRefs = director(created);
+ assert.ok(createdRefs.item);
+ assert.ok(createdRefs.document);
+ assert.equal(createdRefs.item.binding.objectRef.kind, "director");
+ assert.equal(createdRefs.document.kind, "director");
+ const itemId = createdRefs.item.id;
+ const documentId = createdRefs.document.id;
+ // Stages start empty; the subject identity below comes from the imported
+ // model object later in this flow.
+ assert.equal(createdRefs.document.data.objects.length, 0);
+ assert.equal(keyframeCount(createdRefs.document), 0);
+
+ // Environment controls edit the persisted document through the same local
+ // history/apply path as camera and object edits.
+ await page.getByRole("tab", { name: L.background, exact: true }).click();
+ await page.getByRole("button", { name: L.backgroundAll, exact: true }).waitFor();
+ assert.equal(
+ await page.getByRole("button", { name: L.backgroundPanoramic, exact: true }).count(),
+ 1,
+ );
+ assert.equal(
+ await page.getByRole("button", { name: L.backgroundFlat, exact: true }).count(),
+ 1,
+ );
+ assert.equal(await page.getByText(L.backgroundCanvasImages, { exact: true }).count(), 1);
+ assert.equal(await page.getByText(L.backgroundEmpty, { exact: true }).count(), 1);
+ assert.equal(await page.getByLabel(L.backgroundAsset, { exact: true }).inputValue(), "");
+ await page.getByLabel(L.backgroundAdd, { exact: true }).setInputFiles({
+ name: "acceptance-background.png",
+ mimeType: "image/png",
+ buffer: Buffer.from(
+ "iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAIAAAB7QOjdAAAAD0lEQVR4nGPUCKhgYGAAAARuAPJNZv30AAAAAElFTkSuQmCC",
+ "base64",
+ ),
+ });
+ await page.getByText(L.backgroundImported, { exact: true }).waitFor();
+ const backgroundImported = await until(
+ (snapshot) => snapshot.assets.some(
+ (asset) => asset.name === "acceptance-background.png" && asset.kind === "image",
+ ),
+ "imported background image asset",
+ );
+ const backgroundAsset = backgroundImported.assets.find(
+ (asset) => asset.name === "acceptance-background.png" && asset.kind === "image",
+ );
+ assert.ok(backgroundAsset);
+ assert.equal(
+ await page.getByLabel(L.backgroundAsset, { exact: true }).inputValue(),
+ backgroundAsset.id,
+ );
+ await page.getByLabel(L.environmentPreset, { exact: true }).selectOption("moonlit");
+ assert.equal(await page.getByLabel(L.environmentPreset, { exact: true }).inputValue(), "moonlit");
+ assert.equal(await page.getByLabel(L.exposure, { exact: true }).inputValue(), "0.8");
+ await page.getByRole("button", { name: L.keyLight, exact: true }).click();
+ assert.equal(await page.getByLabel(L.keyIntensity, { exact: true }).inputValue(), "2.4");
+ await page.getByLabel(L.groundColor, { exact: true }).fill("#405060");
+ await page.getByLabel(L.groundVisible, { exact: true }).uncheck();
+ await page.getByLabel(L.exposure, { exact: true }).fill("2.25");
+ await page.getByLabel(L.keyIntensity, { exact: true }).fill("4.2");
+ await page.getByRole("button", { name: L.apply, exact: true }).click();
+ const environmentCommitted = await until((snapshot) => {
+ const result = director(snapshot, itemId);
+ return (
+ result.document?.data.environment?.groundColor === "#405060" &&
+ result.document.data.environment.groundVisible === false &&
+ result.document.data.environment.preset === "moonlit" &&
+ result.document.data.environment.exposure === 2.25 &&
+ result.document.data.lights.find((light) => light.id === "key")?.intensity === 4.2
+ );
+ }, "persisted ground and key light edits");
+ const savedEnvironment = director(environmentCommitted, itemId).document.data;
+ assert.equal(savedEnvironment.environment.groundColor, "#405060");
+ assert.equal(savedEnvironment.environment.groundVisible, false);
+ assert.equal(savedEnvironment.environment.exposure, 2.25);
+ assert.equal(savedEnvironment.environment.preset, "moonlit");
+ assert.equal(savedEnvironment.environment.backgroundAsset.assetId, backgroundAsset.id);
+ assert.equal(savedEnvironment.lights.find((light) => light.id === "key").intensity, 4.2);
+
+ await page.locator(`.react-flow__node[data-id="${itemId}"]`).click();
+ await page.getByRole("button", { name: L.openStage, exact: true }).click();
+ await page.getByRole("button", { name: L.apply, exact: true }).waitFor();
+ await page.getByRole("tab", { name: L.background, exact: true }).click();
+ assert.equal(await page.getByLabel(L.groundColor, { exact: true }).inputValue(), "#405060");
+ assert.equal(await page.getByLabel(L.groundVisible, { exact: true }).isChecked(), false);
+ assert.equal(await page.getByLabel(L.exposure, { exact: true }).inputValue(), "2.25");
+ assert.equal(
+ await page.getByLabel(L.backgroundAsset, { exact: true }).inputValue(),
+ backgroundAsset.id,
+ );
+ await page.getByRole("button", { name: L.keyLight, exact: true }).click();
+ assert.equal(await page.getByLabel(L.keyIntensity, { exact: true }).inputValue(), "4.2");
+
+ // Corrupt GLB JSON, plain non-GLB bytes, external GLTF, and GLB with
+ // external references are rejected with localized notices before anything
+ // reaches the project.
+ await page
+ .locator('input[type="file"][accept*=".glb"]')
+ .setInputFiles({
+ name: "broken.glb",
+ mimeType: "model/gltf-binary",
+ buffer: makeCorruptGlb(),
+ });
+ await page.getByText(L.corruptAssetNotice, { exact: true }).waitFor();
+ await page
+ .locator('input[type="file"][accept*=".glb"]')
+ .setInputFiles({
+ name: "broken.glb",
+ mimeType: "model/gltf-binary",
+ buffer: Buffer.from("not a glb at all"),
+ });
+ await page.getByText(L.loadFailedNotice, { exact: true }).waitFor();
+ await page
+ .locator('input[type="file"][accept*=".glb"]')
+ .setInputFiles({
+ name: "external.gltf",
+ mimeType: "model/gltf+json",
+ buffer: Buffer.from(
+ JSON.stringify({
+ asset: { version: "2.0" },
+ buffers: [{ uri: "scene.bin", byteLength: 4 }],
+ }),
+ ),
+ });
+ await page.getByText(L.unsupportedAssetNotice, { exact: true }).waitFor();
+ await page
+ .locator('input[type="file"][accept*=".glb"]')
+ .setInputFiles({
+ name: "external.glb",
+ mimeType: "model/gltf-binary",
+ buffer: makeGlb({ images: [{ uri: "texture.png" }] }),
+ });
+ await page.getByText(L.unsupportedAssetNotice, { exact: true }).waitFor();
+ await page
+ .locator('input[type="file"][accept*=".glb"]')
+ .setInputFiles({
+ name: "acceptance.glb",
+ mimeType: "model/gltf-binary",
+ buffer: makeGlb(),
+ });
+ await page
+ .locator(".cw-stage-right-tree")
+ .getByRole("button", { name: "acceptance", exact: true })
+ .waitFor();
+ await page.getByText(L.noAnimationNote, { exact: true }).waitFor();
+
+ // The export carries no model bytes, so it must name imports that exist
+ // only as browser URLs instead of writing unopenable objects.
+ await page
+ .getByRole("button", { name: L.exportJson, exact: true })
+ .click();
+ await page
+ .getByText(L.exportUnsavedImportsNotice, { exact: true })
+ .waitFor();
+ // Stage JSON imports reject objects pinning assets this project never
+ // registered, keeping the in-progress stage untouched.
+ await page
+ .locator('input[type="file"][accept^="application/json"]')
+ .setInputFiles({
+ name: "foreign.stage.json",
+ mimeType: "application/json",
+ buffer: Buffer.from(JSON.stringify(foreignStage)),
+ });
+ await page
+ .getByText(L.importForeignAssetsNotice, { exact: true })
+ .waitFor();
+ await page
+ .locator(".cw-stage-right-tree")
+ .getByRole("button", { name: "acceptance", exact: true })
+ .waitFor();
+
+ const previewMode = page.getByRole("group", { name: L.previewMode, exact: true });
+ await previewMode.getByRole("button", { name: L.staticPreview, exact: true }).waitFor();
+ assert.equal(
+ await previewMode.getByRole("button", { name: L.staticPreview, exact: true }).getAttribute("aria-pressed"),
+ "true",
+ );
+ const timeline = page.getByTestId("director-stage-timeline");
+ assert.equal(await timeline.count(), 0);
+ await previewMode.getByRole("button", { name: L.dynamicPreview, exact: true }).click();
+ await timeline.waitFor();
+ assert.equal(await timeline.getAttribute("aria-label"), L.timeline);
+ // The imported model is the stage's only subject; its identity drives the
+ // object-track and undo checks below.
+ const importedGroupRow = timeline.locator(
+ '.cw-stage-track-group-row[data-track-group-kind="object"]',
+ );
+ await importedGroupRow.waitFor();
+ const objectId = await importedGroupRow.getAttribute("data-source-id");
+ assert.ok(objectId, "the imported model object owns an object track group");
+ assert.equal(
+ await page.locator('[data-testid="director-stage-active-state"]').count(),
+ 0,
+ );
+ assert.equal(await page.locator(".cw-stage-keyframe-editor").count(), 0);
+ assert.equal(await page.locator(".cw-stage-storyboard").count(), 0);
+ const ruler = timeline.locator(".cw-stage-track-ruler");
+ const majorTicks = ruler.locator('[data-tick-kind="major"]');
+ const minorTicks = ruler.locator('[data-tick-kind="minor"]');
+ assert.ok((await majorTicks.count()) >= 2);
+ assert.ok((await minorTicks.count()) > (await majorTicks.count()));
+ assert.equal(
+ await ruler.locator(".cw-stage-track-ruler-label").count(),
+ await majorTicks.count(),
+ );
+ const rulerLane = timeline.locator(".cw-stage-track-lane").first();
+ const rulerLaneBox = await rulerLane.boundingBox();
+ const firstMajorBox = await majorTicks.first().boundingBox();
+ const lastMajorBox = await majorTicks.last().boundingBox();
+ const rulerCaptionBox = await ruler.locator(".cw-stage-track-ruler-caption").boundingBox();
+ const firstLabelBox = await majorTicks
+ .first()
+ .locator(".cw-stage-track-ruler-label")
+ .boundingBox();
+ const lastLabelBox = await majorTicks
+ .last()
+ .locator(".cw-stage-track-ruler-label")
+ .boundingBox();
+ assert.ok(
+ rulerLaneBox &&
+ firstMajorBox &&
+ lastMajorBox &&
+ rulerCaptionBox &&
+ firstLabelBox &&
+ lastLabelBox,
+ );
+ assert.ok(Math.abs(firstMajorBox.x - rulerLaneBox.x) <= 1);
+ assert.ok(Math.abs(lastMajorBox.x - rulerLaneBox.x - rulerLaneBox.width) <= 1);
+ assert.ok(
+ Math.abs(firstLabelBox.y - rulerCaptionBox.y) < 0.5,
+ "the first time value shares the current-time row",
+ );
+ assert.ok(
+ Math.abs(lastLabelBox.y - rulerCaptionBox.y) < 0.5,
+ "the last time value shares the current-time row",
+ );
+ const majorGridLines = timeline.locator('[data-grid-kind="major"]');
+ const minorGridLines = timeline.locator('[data-grid-kind="minor"]');
+ assert.equal(await majorGridLines.count(), await majorTicks.count());
+ assert.equal(await minorGridLines.count(), await minorTicks.count());
+ const firstGridBox = await majorGridLines.first().boundingBox();
+ const lastGridBox = await majorGridLines.last().boundingBox();
+ assert.ok(firstGridBox && lastGridBox);
+ assert.ok(Math.abs(firstGridBox.x - rulerLaneBox.x) <= 1);
+ assert.ok(Math.abs(lastGridBox.x - rulerLaneBox.x - rulerLaneBox.width) <= 1);
+ const objectGroup = timeline.locator(
+ `.cw-stage-track-group-row[data-track-group-kind="object"][data-source-id="${objectId}"]`,
+ );
+ await objectGroup.waitFor();
+ assert.equal(await objectGroup.locator(".cw-stage-track-group-label").count(), 1);
+ assert.ok(
+ (await objectGroup.locator(".cw-stage-track-group-label").innerText()).length > 0,
+ "dynamic timeline names the current scene object",
+ );
+ const objectTracks = timeline.locator(
+ `.cw-stage-track-row[data-source-id="${objectId}"]`,
+ );
+ const objectGroupToggle = objectGroup.getByRole("button");
+ const timelineChevron = objectGroup.locator(".cw-stage-track-group-chevron");
+ const treeChevron = page.locator(".cw-stage-tree-chevron").first();
+ for (const chevron of [timelineChevron, treeChevron]) {
+ await chevron.waitFor();
+ const style = await chevron.evaluate((element) => {
+ const pseudo = getComputedStyle(element, "::before");
+ return {
+ borderRightWidth: pseudo.borderRightWidth,
+ borderBottomWidth: pseudo.borderBottomWidth,
+ };
+ });
+ assert.notEqual(style.borderRightWidth, "0px");
+ assert.notEqual(style.borderBottomWidth, "0px");
+ }
+ assert.equal(await objectGroupToggle.getAttribute("aria-expanded"), "true");
+ assert.equal(await objectTracks.count(), 4);
+ const expandedTimelineBox = await timeline.boundingBox();
+ assert.ok(expandedTimelineBox);
+ await objectGroupToggle.click();
+ assert.equal(await objectGroupToggle.getAttribute("aria-expanded"), "false");
+ assert.equal(await objectTracks.count(), 0);
+ const collapsedTimelineBox = await timeline.boundingBox();
+ assert.ok(collapsedTimelineBox);
+ assert.ok(
+ collapsedTimelineBox.height < expandedTimelineBox.height,
+ "collapsing an object group shrinks the track area",
+ );
+ await objectGroupToggle.click();
+ assert.equal(await objectGroupToggle.getAttribute("aria-expanded"), "true");
+ assert.equal(await objectTracks.count(), 4);
+ const restoredTimelineBox = await timeline.boundingBox();
+ assert.ok(restoredTimelineBox);
+ assert.ok(
+ Math.abs(restoredTimelineBox.height - expandedTimelineBox.height) <= 1,
+ "expanding an object group restores the track area height",
+ );
+
+ const inspector = page.locator(".cw-stage-inspector");
+ await page
+ .locator(".cw-stage-right-tree")
+ .getByRole("button", { name: "acceptance", exact: true })
+ .click();
+ assert.equal(await inspector.getByLabel(L.cameraName, { exact: true }).count(), 0);
+ const cameraTreeItem = page
+ .locator(".cw-stage-right-tree [role=group]")
+ .last()
+ .locator('[role="treeitem"] button')
+ .first();
+ await cameraTreeItem.click();
+ await page.getByLabel(L.cameraName, { exact: true }).waitFor();
+
+ await page.getByLabel(L.cameraName, { exact: true }).fill("Acceptance camera");
+ await page.getByRole("slider", { name: L.playhead, exact: true }).fill("5");
+ const cameraTargetTrack = timeline.locator(
+ '.cw-stage-track-row[data-track-kind="camera-channel"]',
+ ).nth(1);
+ const cameraTargetAdd = cameraTargetTrack.locator(".cw-stage-track-add");
+ const cameraTargetGlyph = cameraTargetAdd.locator(".cw-stage-track-add-glyph");
+ assert.equal(await cameraTargetAdd.getAttribute("aria-pressed"), "false");
+ assert.equal(
+ await cameraTargetGlyph.evaluate((element) => getComputedStyle(element).backgroundColor),
+ await cameraTargetTrack.locator(".cw-stage-track-label").evaluate(
+ (element) => getComputedStyle(element).backgroundColor,
+ ),
+ );
+ const addBox = await cameraTargetAdd.boundingBox();
+ const glyphBox = await cameraTargetGlyph.boundingBox();
+ assert.ok(addBox);
+ assert.ok(glyphBox);
+ assert.equal(addBox.width, 18);
+ assert.equal(addBox.height, 18);
+ assert.ok(
+ Math.abs(addBox.x + addBox.width / 2 - glyphBox.x - glyphBox.width / 2) <= 0.5,
+ "keyframe diamond is horizontally centered in its button",
+ );
+ assert.ok(
+ Math.abs(addBox.y + addBox.height / 2 - glyphBox.y - glyphBox.height / 2) <= 0.5,
+ "keyframe diamond is vertically centered in its button",
+ );
+ assert.equal(
+ await cameraTargetAdd.evaluate((element) => getComputedStyle(element).backgroundColor),
+ "rgba(0, 0, 0, 0)",
+ );
+ await cameraTargetAdd.hover();
+ await page.waitForTimeout(180);
+ assert.equal(
+ await cameraTargetAdd.evaluate((element) => getComputedStyle(element).backgroundColor),
+ "rgb(48, 48, 48)",
+ );
+ assert.equal(
+ await timeline.getByTestId("director-stage-ruler-playhead").evaluate(
+ (element) => getComputedStyle(element).cursor,
+ ),
+ "ew-resize",
+ );
+ assert.equal(
+ await cameraTargetTrack.locator(".cw-stage-track-label").evaluate(
+ (element) => getComputedStyle(element, "::before").display,
+ ),
+ "none",
+ );
+ const rulerPlayhead = timeline.getByTestId("director-stage-ruler-playhead");
+ assert.equal(await rulerPlayhead.evaluate((element) => element.tagName), "SPAN");
+ assert.equal(
+ await timeline.locator(".cw-stage-track-playhead").evaluate(
+ (element) => getComputedStyle(element).width,
+ ),
+ "2px",
+ );
+ const rulerPlayheadBox = await rulerPlayhead.boundingBox();
+ const rulerScaleBox = await timeline.locator(".cw-stage-track-ruler-scale").boundingBox();
+ assert.ok(rulerPlayheadBox);
+ assert.ok(rulerScaleBox);
+ await page.mouse.move(
+ rulerPlayheadBox.x + rulerPlayheadBox.width / 2,
+ rulerPlayheadBox.y + rulerPlayheadBox.height / 2,
+ );
+ await page.mouse.down();
+ await page.mouse.move(
+ rulerScaleBox.x + rulerScaleBox.width / 2,
+ rulerPlayheadBox.y + rulerPlayheadBox.height / 2,
+ { steps: 3 },
+ );
+ await page.mouse.up();
+ assert.equal(
+ await page.getByRole("slider", { name: L.playhead, exact: true }).inputValue(),
+ "3",
+ );
+ await page.getByRole("slider", { name: L.playhead, exact: true }).fill("5");
+ await cameraTargetAdd.click();
+ assert.equal(await cameraTargetAdd.getAttribute("aria-pressed"), "true");
+ assert.equal(
+ await cameraTargetGlyph.evaluate((element) => getComputedStyle(element).backgroundColor),
+ "rgb(217, 217, 217)",
+ );
+ await cameraTargetTrack.getByRole("button", {
+ name: /Acceptance camera.*Target.*5\.00 seconds|Acceptance camera.*目标.*5\.00 秒/,
+ }).waitFor();
+ await page.getByRole("slider", { name: L.playhead, exact: true }).fill("3");
+ assert.equal(await cameraTargetAdd.getAttribute("aria-pressed"), "false");
+ await cameraTargetAdd.click();
+ assert.equal(await cameraTargetAdd.getAttribute("aria-pressed"), "true");
+ const cameraTargetIntervals = cameraTargetTrack.locator(
+ '[data-testid="director-stage-track-interval"]',
+ );
+ await cameraTargetIntervals.first().waitFor();
+ assert.equal(await cameraTargetIntervals.count(), 1);
+ const cameraTargetInterval = cameraTargetIntervals.first();
+ const intervalBox = await cameraTargetInterval.boundingBox();
+ assert.ok(intervalBox);
+ assert.ok(intervalBox.width > 0, "keyframe interval is visible");
+ assert.ok(
+ Math.abs(
+ Number.parseFloat(
+ await cameraTargetInterval.evaluate((element) => getComputedStyle(element).height),
+ ) - 3,
+ ) <= 0.1,
+ "keyframe interval is three pixels thick",
+ );
+ assert.ok(
+ Math.abs(
+ Number.parseFloat(
+ await cameraTargetInterval.evaluate((element) => getComputedStyle(element).top),
+ ) - 8,
+ ) <= 0.1,
+ "keyframe interval is centered in its track",
+ );
+ assert.equal(await cameraTargetInterval.evaluate((element) => element.tagName), "BUTTON");
+ assert.equal(await cameraTargetInterval.getAttribute("aria-pressed"), "false");
+ await cameraTargetInterval.click();
+ assert.equal(await cameraTargetInterval.getAttribute("aria-pressed"), "true");
+ await page.waitForTimeout(180);
+ assert.equal(
+ await cameraTargetInterval.evaluate((element) => getComputedStyle(element).backgroundColor),
+ "rgb(217, 217, 217)",
+ );
+ const transitionEditor = page.getByRole("dialog", {
+ name: L.transitionEditor,
+ exact: true,
+ });
+ await transitionEditor.waitFor();
+ const transitionEditorBox = await transitionEditor.boundingBox();
+ assert.ok(transitionEditorBox);
+ assert.ok(
+ transitionEditorBox.y + transitionEditorBox.height < intervalBox.y,
+ "transition editor is anchored above its selected interval",
+ );
+ assert.equal(
+ await transitionEditor.evaluate((element) => getComputedStyle(element).backgroundColor),
+ "rgb(41, 41, 41)",
+ );
+ const transitionSelect = transitionEditor.getByLabel(L.transition, { exact: true });
+ assert.equal(await transitionSelect.inputValue(), "linear");
+ const linearPath = await transitionEditor.locator(".cw-stage-transition-curve").getAttribute("d");
+ await transitionSelect.selectOption("bezier");
+ assert.equal(await transitionSelect.inputValue(), "bezier");
+ await transitionEditor.getByLabel(L.controlX1, { exact: true }).fill("0.8");
+ assert.equal(await transitionEditor.getByLabel(L.controlX1, { exact: true }).inputValue(), "0.8");
+ assert.notEqual(
+ await transitionEditor.locator(".cw-stage-transition-curve").getAttribute("d"),
+ linearPath,
+ );
+ assert.equal(await cameraTargetInterval.locator(".cw-stage-track-interval-curve").count(), 1);
+ if (process.env.DIRECTOR_STAGE_SCREENSHOT) {
+ await page.screenshot({ path: process.env.DIRECTOR_STAGE_SCREENSHOT });
+ }
+ await page.getByRole("slider", { name: L.playhead, exact: true }).fill("5");
+ assert.equal(await cameraTargetAdd.getAttribute("aria-pressed"), "true");
+ await page
+ .getByRole("slider", { name: L.playhead, exact: true })
+ .press("Home");
+ await page.getByRole("slider", { name: L.playhead, exact: true }).fill("1");
+ const heldTime = await page.getByRole("slider", { name: L.playhead, exact: true }).inputValue();
+ await previewMode.getByRole("button", { name: L.dynamicPreview, exact: true }).click();
+ await new Promise((resolve) => setTimeout(resolve, 350));
+ assert.equal(
+ await page.getByRole("slider", { name: L.playhead, exact: true }).inputValue(),
+ heldTime,
+ "switching to dynamic mode must not start playback",
+ );
+ await previewMode.getByRole("button", { name: L.staticPreview, exact: true }).click();
+ assert.equal(await timeline.count(), 0);
+ await new Promise((resolve) => setTimeout(resolve, 100));
+ assert.equal(await timeline.count(), 0);
+ await previewMode.getByRole("button", { name: L.dynamicPreview, exact: true }).click();
+ await timeline.waitFor();
+ await page
+ .getByRole("slider", { name: L.playhead, exact: true })
+ .press("End");
+ await page
+ .locator(".cw-stage-right-tree")
+ .getByRole("button", { name: "acceptance", exact: true })
+ .click();
+ await page.getByLabel(L.positionX, { exact: true }).fill("2");
+ await page
+ .getByRole("button", { name: L.recordKeyframe, exact: true })
+ .click();
+ const positionPoint = timeline.getByRole("button", {
+ name: /Acceptance camera.*Position.*6\.00 seconds|Acceptance camera.*位置.*6\.00 秒/,
+ });
+ await positionPoint.waitFor();
+ await page.getByRole("button", { name: L.apply, exact: true }).click();
+
+ const committed = await until((snapshot) => {
+ const result = director(snapshot, itemId);
+ return (
+ result.item?.id === itemId &&
+ result.document?.id === documentId &&
+ result.document.data.cameras[0].name === "Acceptance camera" &&
+ keyframeCount(result.document) >= 2 &&
+ result.document.data.cameras[0].channels.position.some((frame) => frame.time === 6) &&
+ result.document.data.cameras[0].channels.target.some((frame) => frame.time === 6) &&
+ result.document.data.cameras[0].channels.target.some(
+ (frame) => frame.time === 3 && frame.transition?.kind === "bezier" &&
+ frame.transition.controlPoints[0] === 0.8,
+ )
+ );
+ }, "edited director document with keyframes");
+ const committedRefs = director(committed, itemId);
+ assert.equal(committedRefs.document.data.objects[0].id, objectId);
+ const imported = committedRefs.document.data.objects.find(
+ (object) => object.kind === "gltf",
+ );
+ assert.ok(imported);
+ assert.equal(imported.role, "character");
+ assert.equal(imported.format, "glb");
+ assert.equal(imported.asset.kind, "file");
+ assert.ok(
+ committed.assets.some((asset) => asset.id === imported.asset.assetId),
+ );
+ const importedObjectId = imported.id;
+ const importedAssetId = imported.asset.assetId;
+ assert.ok(
+ committedRefs.document.data.objects[0].keyframes.some(
+ (frame) => frame.time === 6,
+ ),
+ );
+ assert.ok(
+ committedRefs.document.data.cameras[0].keyframes.some(
+ (frame) => frame.time === 6,
+ ),
+ );
+
+ // Applying saves and closes the stage editor in one step.
+ // The toolbar undo carries an aria-label; the stage modal's undo is plain text.
+ const undo = page
+ .locator(".cw-undo-controls")
+ .getByRole("button", { name: L.undo, exact: true });
+ await undo.waitFor();
+ assert.equal(await undo.isEnabled(), true);
+ await undo.click();
+ const undone = await until((snapshot) => {
+ const result = director(snapshot, itemId);
+ return (
+ result.item?.id === itemId &&
+ result.document?.id === documentId &&
+ result.document.data.cameras[0].name !== "Acceptance camera" &&
+ keyframeCount(result.document) === 0
+ );
+ }, "undo restores the original director document without changing identity");
+ assert.equal(
+ director(undone, itemId).document.data.objects.length,
+ 0,
+ "undo restores the stage before the model draft was applied",
+ );
+ assert.equal(
+ director(undone, itemId).document.data.objects.some(
+ (object) => object.id === importedObjectId,
+ ),
+ false,
+ );
+
+ const redo = page.getByLabel(L.redo, { exact: true });
+ const redoDeadline = Date.now() + 20000;
+ while (!(await redo.isEnabled())) {
+ if (Date.now() > redoDeadline) throw new Error("redo never became enabled");
+ await page.waitForTimeout(100);
+ }
+ await redo.click();
+ const redone = await until((snapshot) => {
+ const result = director(snapshot, itemId);
+ return (
+ result.item?.id === itemId &&
+ result.document?.id === documentId &&
+ result.document.data.cameras[0].name === "Acceptance camera" &&
+ keyframeCount(result.document) >= 2
+ );
+ }, "redo restores the edited director document without changing identity");
+ assert.equal(director(redone, itemId).document.data.objects[0].id, objectId);
+ const redoneImported = director(redone, itemId).document.data.objects.find(
+ (object) => object.id === importedObjectId,
+ );
+ assert.equal(redoneImported.asset.assetId, importedAssetId);
+
+ await page.locator(`.react-flow__node[data-id="${itemId}"]`).click();
+ await page
+ .getByRole("button", { name: L.openStage, exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: L.apply, exact: true })
+ .waitFor();
+ await page
+ .locator(".cw-stage-right-tree [role=group]")
+ .last()
+ .locator('[role="treeitem"] button')
+ .first()
+ .click();
+ assert.equal(
+ await page.getByLabel(L.cameraName, { exact: true }).inputValue(),
+ "Acceptance camera",
+ );
+ await page
+ .locator(".cw-stage-left")
+ .getByRole("button", { name: "acceptance", exact: true })
+ .waitFor();
+ await previewMode.getByRole("button", { name: L.dynamicPreview, exact: true }).click();
+ await timeline.waitFor();
+ const reopenedTargetTrack = timeline.locator(
+ '.cw-stage-track-row[data-track-kind="camera-channel"]',
+ ).nth(1);
+ await reopenedTargetTrack.locator('[data-testid="director-stage-track-interval"]').first().click();
+ const reopenedTransitionEditor = page.getByRole("dialog", {
+ name: L.transitionEditor,
+ exact: true,
+ });
+ await reopenedTransitionEditor.waitFor();
+ assert.equal(
+ await reopenedTransitionEditor.getByLabel(L.transition, { exact: true }).inputValue(),
+ "bezier",
+ );
+ assert.equal(
+ await reopenedTransitionEditor.getByLabel(L.controlX1, { exact: true }).inputValue(),
+ "0.8",
+ );
+ await reopenedTargetTrack.locator(".cw-stage-track-point").first().waitFor();
+ assert.deepEqual(director(await state(), itemId).document, director(redone, itemId).document);
+ await page
+ .getByRole("button", { name: L.closeEditor, exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: L.apply, exact: true })
+ .waitFor({ state: "detached" });
+ assert.deepEqual(errors, []);
+ console.log(
+ JSON.stringify({
+ passed: true,
+ projectId,
+ itemId,
+ documentId,
+ objectId,
+ checks: [
+ "shared creation toolbar entry",
+ "automatic editor opening",
+ "external node projects to director document",
+ "corrupt GLB JSON is reported as corruption, not a load failure",
+ "GLB import previews before save and registers a file asset",
+ "stage JSON export names imports that are not saved yet",
+ "stage JSON import rejects foreign pinned assets",
+ "imported asset identity survives undo, redo, and reopen",
+ "keyframes persist and reopen",
+ "timeline tracks are visible, localized, and locate the playhead",
+ "interval transition curves persist and reopen",
+ "undo preserves node and document identities",
+ "redo restores the edited document and keyframes",
+ "no page errors",
+ ],
+ }),
+ );
+} catch (error) {
+ console.error((await page.locator("body").innerText()).slice(-2500));
+ throw error;
+} finally {
+ await browser.close();
+}
diff --git a/tests/browser/director_stage_fixture.mjs b/tests/browser/director_stage_fixture.mjs
new file mode 100644
index 000000000..17b507d4f
--- /dev/null
+++ b/tests/browser/director_stage_fixture.mjs
@@ -0,0 +1,274 @@
+/** GLB and image fixtures for Director Stage browser checks. */
+import { execFileSync } from "node:child_process";
+import { Buffer } from "node:buffer";
+import { fileURLToPath } from "node:url";
+import { writeFileSync } from "node:fs";
+import { deflateSync } from "node:zlib";
+
+function baseDocument() {
+ return {
+ asset: { version: "2.0" },
+ scene: 0,
+ scenes: [{ nodes: [0] }],
+ nodes: [{ mesh: 0 }],
+ meshes: [
+ {
+ primitives: [
+ {
+ attributes: { POSITION: 0 },
+ indices: 1,
+ },
+ ],
+ },
+ ],
+ buffers: [{ byteLength: 42 }],
+ bufferViews: [
+ { buffer: 0, byteOffset: 0, byteLength: 36 },
+ { buffer: 0, byteOffset: 36, byteLength: 6 },
+ ],
+ accessors: [
+ {
+ bufferView: 0,
+ componentType: 5126,
+ count: 3,
+ type: "VEC3",
+ min: [0, 0, 0],
+ max: [1, 1, 0],
+ },
+ { bufferView: 1, componentType: 5123, count: 3, type: "SCALAR" },
+ ],
+ };
+}
+
+function baseBinary() {
+ const binary = Buffer.alloc(44);
+ binary.writeFloatLE(0, 0);
+ binary.writeFloatLE(0, 4);
+ binary.writeFloatLE(0, 8);
+ binary.writeFloatLE(1, 12);
+ binary.writeFloatLE(0, 16);
+ binary.writeFloatLE(0, 20);
+ binary.writeFloatLE(0, 24);
+ binary.writeFloatLE(1, 28);
+ binary.writeFloatLE(0, 32);
+ binary.writeUInt16LE(0, 36);
+ binary.writeUInt16LE(1, 38);
+ binary.writeUInt16LE(2, 40);
+ return binary;
+}
+
+const chunk = (type, data) => {
+ const header = Buffer.alloc(8);
+ header.writeUInt32LE(data.length, 0);
+ header.writeUInt32LE(type, 4);
+ return Buffer.concat([header, data]);
+};
+
+function glbOf(document, binary) {
+ const json = Buffer.from(JSON.stringify(document));
+ const jsonChunk = Buffer.concat([
+ json,
+ Buffer.alloc((4 - (json.length % 4)) % 4, 0x20),
+ ]);
+ const body = Buffer.concat([
+ chunk(0x4e4f534a, jsonChunk),
+ chunk(0x004e4942, binary),
+ ]);
+ const header = Buffer.alloc(12);
+ header.writeUInt32LE(0x46546c67, 0);
+ header.writeUInt32LE(2, 4);
+ header.writeUInt32LE(12 + body.length, 8);
+ return Buffer.concat([header, body]);
+}
+
+export function makeGlb(overrides = {}) {
+ return glbOf({ ...baseDocument(), ...overrides }, baseBinary());
+}
+
+/** A valid GLB container whose embedded JSON chunk cannot be parsed; the
+ * browser probe must report corruption instead of external resources. */
+export function makeCorruptGlb() {
+ const json = Buffer.from("not json at all");
+ const jsonChunk = Buffer.concat([
+ json,
+ Buffer.alloc((4 - (json.length % 4)) % 4, 0x20),
+ ]);
+ const body = chunk(0x4e4f534a, jsonChunk);
+ const header = Buffer.alloc(12);
+ header.writeUInt32LE(0x46546c67, 0);
+ header.writeUInt32LE(2, 4);
+ header.writeUInt32LE(12 + body.length, 8);
+ return Buffer.concat([header, body]);
+}
+
+/** A one-triangle GLB whose "Walk" clip rotates the node 90 degrees in one second. */
+export function makeAnimatedGlb() {
+ const base = baseDocument();
+ const document = {
+ ...base,
+ buffers: [{ byteLength: 84 }],
+ bufferViews: [
+ ...base.bufferViews,
+ { buffer: 0, byteOffset: 44, byteLength: 8 },
+ { buffer: 0, byteOffset: 52, byteLength: 32 },
+ ],
+ accessors: [
+ ...base.accessors,
+ {
+ bufferView: 2,
+ componentType: 5126,
+ count: 2,
+ type: "SCALAR",
+ min: [0],
+ max: [1],
+ },
+ { bufferView: 3, componentType: 5126, count: 2, type: "VEC4" },
+ ],
+ animations: [
+ {
+ name: "Walk",
+ channels: [{ sampler: 0, target: { node: 0, path: "rotation" } }],
+ samplers: [{ input: 2, output: 3, interpolation: "LINEAR" }],
+ },
+ ],
+ };
+ const binary = Buffer.alloc(84);
+ baseBinary().copy(binary, 0);
+ binary.writeFloatLE(0, 44);
+ binary.writeFloatLE(1, 48);
+ const half = Math.SQRT1_2;
+ binary.writeFloatLE(0, 52);
+ binary.writeFloatLE(0, 56);
+ binary.writeFloatLE(0, 60);
+ binary.writeFloatLE(1, 64);
+ binary.writeFloatLE(0, 68);
+ binary.writeFloatLE(0, 72);
+ binary.writeFloatLE(half, 76);
+ binary.writeFloatLE(half, 80);
+ return glbOf(document, binary);
+}
+
+/** A GLB whose one mesh is a square of `size` units to a side, centred where the
+ * object stands and facing +Z, in a plain diffuse colour given as linear red, green
+ * and blue. It is lit from both sides, so a camera on its +Z side sees it as that
+ * colour, and how much of the picture it fills is set by `size` alone. */
+export function makePanelGlb(size = 3, colour = [0.8, 0.05, 0.05]) {
+ const half = size / 2;
+ const positions = [-half, -half, 0, half, -half, 0, half, half, 0, -half, half, 0];
+ // Four vertices at three floats, four normals at three floats, six corners.
+ const [positionsAt, normalsAt, indicesAt] = [0, 48, 96];
+ const binary = Buffer.alloc(indicesAt + 12);
+ positions.forEach((value, index) => binary.writeFloatLE(value, positionsAt + index * 4));
+ for (let vertex = 0; vertex < 4; vertex += 1)
+ binary.writeFloatLE(1, normalsAt + vertex * 12 + 8);
+ [0, 1, 2, 0, 2, 3].forEach((vertex, index) =>
+ binary.writeUInt16LE(vertex, indicesAt + index * 2),
+ );
+ return glbOf(
+ {
+ ...baseDocument(),
+ buffers: [{ byteLength: binary.length }],
+ bufferViews: [
+ { buffer: 0, byteOffset: positionsAt, byteLength: 48, target: 34962 },
+ { buffer: 0, byteOffset: normalsAt, byteLength: 48, target: 34962 },
+ { buffer: 0, byteOffset: indicesAt, byteLength: 12, target: 34963 },
+ ],
+ accessors: [
+ {
+ bufferView: 0,
+ componentType: 5126,
+ count: 4,
+ type: "VEC3",
+ min: [-half, -half, 0],
+ max: [half, half, 0],
+ },
+ { bufferView: 1, componentType: 5126, count: 4, type: "VEC3" },
+ { bufferView: 2, componentType: 5123, count: 6, type: "SCALAR" },
+ ],
+ materials: [
+ {
+ pbrMetallicRoughness: {
+ baseColorFactor: [...colour, 1],
+ metallicFactor: 0,
+ roughnessFactor: 1,
+ },
+ doubleSided: true,
+ },
+ ],
+ meshes: [
+ {
+ primitives: [
+ { attributes: { POSITION: 0, NORMAL: 1 }, indices: 2, material: 0 },
+ ],
+ },
+ ],
+ },
+ binary,
+ );
+}
+
+/** A PNG of one plain colour, `width` by `height`, for a background an image makes. */
+export function makePng(width, height, [red, green, blue]) {
+ const row = Buffer.alloc(1 + width * 3);
+ for (let x = 0; x < width; x += 1) row.set([red, green, blue], 1 + x * 3);
+ const crc = (bytes) => {
+ let value = 0xffffffff;
+ for (const byte of bytes) {
+ value ^= byte;
+ for (let bit = 0; bit < 8; bit += 1)
+ value = (value >>> 1) ^ (0xedb88320 & -(value & 1));
+ }
+ return (value ^ 0xffffffff) >>> 0;
+ };
+ const section = (type, data) => {
+ const head = Buffer.alloc(4);
+ head.writeUInt32BE(data.length);
+ const body = Buffer.concat([Buffer.from(type, "latin1"), data]);
+ const tail = Buffer.alloc(4);
+ tail.writeUInt32BE(crc(body));
+ return Buffer.concat([head, body, tail]);
+ };
+ const header = Buffer.alloc(13);
+ header.writeUInt32BE(width, 0);
+ header.writeUInt32BE(height, 4);
+ // Eight bits to a channel, three channels, no interlace.
+ header[8] = 8;
+ header[9] = 2;
+ return Buffer.concat([
+ Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]),
+ section("IHDR", header),
+ section(
+ "IDAT",
+ deflateSync(Buffer.concat(Array.from({ length: height }, () => row))),
+ ),
+ section("IEND", Buffer.alloc(0)),
+ ]);
+}
+
+/** Inspect the downloaded bytes with independent media tools. */
+export function probeMp4(path) {
+ const probe = JSON.parse(execFileSync("ffprobe", [
+ "-v", "error", "-count_frames", "-show_streams", "-show_format",
+ "-of", "json", path,
+ ]));
+ const pixels = execFileSync("ffmpeg", [
+ "-v", "error", "-i", path, "-vf", "scale=1:1",
+ "-fps_mode", "passthrough", "-pix_fmt", "rgb24", "-f", "rawvideo", "-",
+ ]);
+ return {
+ duration: Number(probe.format.duration),
+ stream: probe.streams[0],
+ colors: Array.from({ length: pixels.length / 3 }, (_, index) =>
+ [...pixels.subarray(index * 3, index * 3 + 3)]),
+ };
+}
+
+if (process.argv[1] === fileURLToPath(import.meta.url)) {
+ const destination = process.argv[2];
+ if (!destination) throw new Error("Usage: node director_stage_fixture.mjs [--animated]");
+ writeFileSync(
+ destination,
+ process.argv.includes("--animated") ? makeAnimatedGlb() : makeGlb(),
+ );
+ console.log(destination);
+}
diff --git a/tests/browser/director_stage_gizmo.mjs b/tests/browser/director_stage_gizmo.mjs
new file mode 100644
index 000000000..5d108354f
--- /dev/null
+++ b/tests/browser/director_stage_gizmo.mjs
@@ -0,0 +1,740 @@
+/** Director Stage gizmo acceptance: preview dragging repositions a
+ * keyframe-free subject through base transforms only, and once the subject
+ * carries transform keyframes the same drag poses it at the playhead through
+ * the keyframe writer the numeric fields use.
+ * DIRECTOR_STAGE_LOCALE runs the same flow in another UI language. */
+import assert from "node:assert/strict";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE ?? "playwright-core"
+);
+
+const locale = process.env.DIRECTOR_STAGE_LOCALE ?? "en-US";
+const L = {
+ "en-US": {
+ saved: "Saved on this device",
+ addStage: "Add Director Stage",
+ apply: "Apply edits",
+ positionX: "Position X",
+ positionY: "Position Y",
+ positionZ: "Position Z",
+ rotationX: "Rotation X",
+ undo: "Undo",
+ redo: "Redo",
+ previewMode: "Preview mode",
+ dynamicPreview: "Dynamic",
+ selectGizmo: "Select",
+ dropGround: "Drop to ground",
+ elevationUnit: " m",
+ elevationValue: "{height} m",
+ elevationAria: "Height above ground {height} m",
+ playhead: "Stage playhead",
+ recordKeyframe: "Record a keyframe here",
+ openStage: "Open Director Stage",
+ },
+ "zh-CN": {
+ saved: "已保存到本机",
+ addStage: "添加导演台",
+ apply: "应用编辑",
+ positionX: "位置 X",
+ positionY: "位置 Y",
+ positionZ: "位置 Z",
+ rotationX: "旋转 X",
+ undo: "撤销",
+ redo: "重做",
+ previewMode: "预演模式",
+ dynamicPreview: "动态",
+ selectGizmo: "选择",
+ dropGround: "落到地面",
+ elevationUnit: " 米",
+ elevationValue: "{height} 米",
+ elevationAria: "离地高度 {height} 米",
+ playhead: "舞台播放位置",
+ recordKeyframe: "在此记录关键帧",
+ openStage: "打开导演台",
+ },
+}[locale];
+assert.ok(L, `Unsupported DIRECTOR_STAGE_LOCALE: ${locale}`);
+
+const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5179";
+const api = process.env.CREATION_API_URL ?? "http://127.0.0.1:8019";
+const headers = {
+ "X-OpenDirector-Request": "1",
+ "Content-Type": "application/json",
+};
+
+async function call(path, body) {
+ const response = await fetch(api + path, {
+ headers,
+ ...(body
+ ? { method: "POST", body: JSON.stringify(body) }
+ : {}),
+ });
+ assert.ok(response.ok, `${response.status}: ${await response.clone().text()}`);
+ return response.json();
+}
+
+assert.equal((await call("/api/creation-test-health")).isolated, true);
+
+const projectId = crypto.randomUUID();
+await call(`/api/creation/projects/${projectId}/commands`, {
+ commandId: crypto.randomUUID(),
+ projectId,
+ type: "project.create",
+ payload: { name: `Director Stage gizmo ${projectId.slice(0, 8)}` },
+});
+
+const state = () => call(`/api/creation/projects/${projectId}`);
+const browser = await chromium.launch({
+ headless: true,
+ ...(process.env.CHROMIUM_PATH
+ ? { executablePath: process.env.CHROMIUM_PATH }
+ : {}),
+ args: ["--no-sandbox", "--enable-unsafe-swiftshader"],
+});
+const page = await browser.newPage({
+ locale,
+ viewport: { width: 1700, height: 1100 },
+});
+await page.addInitScript((value) => {
+ localStorage.setItem("opendirector.locale.v1", value);
+ localStorage.setItem("opendirector.modelSetup.v1", "dismissed");
+}, locale);
+page.setDefaultTimeout(20000);
+const errors = [];
+page.on("pageerror", (error) => errors.push(error.message));
+
+const until = async (predicate, label) => {
+ const deadline = Date.now() + 20000;
+ let snapshot;
+ while (Date.now() < deadline) {
+ snapshot = await state();
+ if (predicate(snapshot)) return snapshot;
+ await page.waitForTimeout(100);
+ }
+ throw new Error(`Timeout: ${label}; snapshot: ${JSON.stringify(snapshot)}`);
+};
+
+const director = (snapshot, itemId) => {
+ const item = snapshot.canvasItems.find((candidate) => candidate.id === itemId);
+ const document = snapshot.editorDocuments.find(
+ (candidate) => candidate.id === item?.binding?.objectRef?.id,
+ );
+ return { item, document };
+};
+
+const keyframeCount = (document) =>
+ document.data.objects.reduce(
+ (count, object) => count + object.keyframes.length,
+ 0,
+ ) +
+ document.data.cameras.reduce(
+ (count, camera) => count + camera.keyframes.length,
+ 0,
+ );
+
+/** Grabs the translate X handle of the placement gizmo. The default subject
+ * sits at the world origin under a camera at (5, 3.5, 7) looking at (0, 1, 0),
+ * so the handle projects near the viewport's horizontal center, three fifths
+ * down, offset along the screen projection of the world X axis. */
+const xHandlePoint = async () => {
+ const box = await page
+ .locator(".cw-stage-scene")
+ .boundingBox();
+ assert.ok(box, "stage viewport is visible");
+ const width = box.width,
+ height = box.height;
+ const center = { x: box.x + width / 2, y: box.y + height * 0.625 };
+ const direction = { x: 0.98, y: 0.19 };
+ const length = Math.hypot(direction.x, direction.y);
+ return {
+ from: {
+ x: center.x + (direction.x / length) * width * 0.03,
+ y: center.y + (direction.y / length) * width * 0.03,
+ },
+ by: width * 0.11,
+ };
+};
+
+/** Drags the X translate handle rightwards along its own screen axis. */
+const dragXHandle = async () => {
+ const { from, by } = await xHandlePoint();
+ const direction = { x: 0.98, y: 0.19 };
+ const length = Math.hypot(direction.x, direction.y);
+ await page.mouse.move(from.x, from.y);
+ await page.mouse.down();
+ await page.mouse.move(
+ from.x + (direction.x / length) * by,
+ from.y + (direction.y / length) * by,
+ { steps: 12 },
+ );
+ await page.mouse.up();
+};
+
+const positionX = () => page.getByLabel(L.positionX, { exact: true });
+
+/** Default stage camera every fresh stage starts with: the projection helper
+ * below mirrors its look-at math. */
+const DEFAULT_CAMERA = {
+ eye: { x: 5, y: 3.5, z: 7 },
+ target: { x: 0, y: 1, z: 0 },
+ fov: 45,
+};
+const sub3 = (a, b) => ({ x: a.x - b.x, y: a.y - b.y, z: a.z - b.z });
+const cross3 = (a, b) => ({
+ x: a.y * b.z - a.z * b.y,
+ y: a.z * b.x - a.x * b.z,
+ z: a.x * b.y - a.y * b.x,
+});
+const dot3 = (a, b) => a.x * b.x + a.y * b.y + a.z * b.z;
+const normalize3 = (a) => {
+ const length = Math.hypot(a.x, a.y, a.z);
+ return { x: a.x / length, y: a.y / length, z: a.z / length };
+};
+const VIEW_BASIS = (() => {
+ const forward = normalize3(sub3(DEFAULT_CAMERA.target, DEFAULT_CAMERA.eye));
+ const right = normalize3(cross3(forward, { x: 0, y: 1, z: 0 }));
+ return { forward, right, up: normalize3(cross3(right, forward)) };
+})();
+
+/** Projects a world point to viewport pixels under the default camera, so a
+ * drag can find the gizmo of a subject that no longer sits at the origin. */
+const projectToViewport = (px, py, pz, box) => {
+ const view = sub3({ x: px, y: py, z: pz }, DEFAULT_CAMERA.eye);
+ const depth = dot3(view, VIEW_BASIS.forward);
+ const halfH = depth * Math.tan((DEFAULT_CAMERA.fov * Math.PI) / 360);
+ const halfW = halfH * (box.width / box.height);
+ return {
+ x: box.x + ((dot3(view, VIEW_BASIS.right) / halfW + 1) / 2) * box.width,
+ y: box.y + ((1 - dot3(view, VIEW_BASIS.up) / halfH) / 2) * box.height,
+ };
+};
+
+/** Drags the X translate handle of a subject at an arbitrary base position:
+ * projects the base position and its +X offset to get the arrow's screen
+ * direction at that depth, then pulls along it like dragXHandle does. */
+const dragXHandleAt = async (position) => {
+ const box = await page.locator(".cw-stage-scene").boundingBox();
+ assert.ok(box, "stage viewport is visible");
+ const center = projectToViewport(
+ position.x,
+ position.y,
+ position.z,
+ box,
+ );
+ const ahead = projectToViewport(position.x + 1, position.y, position.z, box);
+ const dx = ahead.x - center.x,
+ dy = ahead.y - center.y;
+ const length = Math.hypot(dx, dy);
+ const from = {
+ x: center.x + (dx / length) * box.width * 0.03,
+ y: center.y + (dy / length) * box.width * 0.03,
+ };
+ const by = box.width * 0.11;
+ await page.mouse.move(from.x, from.y);
+ await page.mouse.down();
+ await page.mouse.move(from.x + (dx / length) * by, from.y + (dy / length) * by, {
+ steps: 12,
+ });
+ await page.mouse.up();
+};
+
+const fieldNumber = (label) =>
+ page.getByLabel(label, { exact: true }).inputValue().then(Number);
+
+const neutralPixelsNear = async (screenshot, center, radius) =>
+ page.evaluate(
+ ({ dataUrl, center, radius }) =>
+ new Promise((resolve, reject) => {
+ const image = new Image();
+ image.onload = () => {
+ const canvas = document.createElement("canvas");
+ canvas.width = image.naturalWidth;
+ canvas.height = image.naturalHeight;
+ const context = canvas.getContext("2d");
+ if (!context) return reject(new Error("2D canvas is unavailable"));
+ context.drawImage(image, 0, 0);
+ const pixels = context.getImageData(
+ 0,
+ 0,
+ canvas.width,
+ canvas.height,
+ ).data;
+ const scale = canvas.width / window.innerWidth;
+ const x = center.x * scale;
+ const y = center.y * scale;
+ const r = radius * scale;
+ let count = 0;
+ for (
+ let py = Math.max(0, Math.floor(y - r));
+ py < Math.min(canvas.height, Math.ceil(y + r));
+ py += 2
+ ) {
+ for (
+ let px = Math.max(0, Math.floor(x - r));
+ px < Math.min(canvas.width, Math.ceil(x + r));
+ px += 2
+ ) {
+ const offset = (py * canvas.width + px) * 4;
+ const red = pixels[offset];
+ const green = pixels[offset + 1];
+ const blue = pixels[offset + 2];
+ const brightest = Math.max(red, green, blue);
+ const darkest = Math.min(red, green, blue);
+ if (brightest > 160 && brightest - darkest < 35) count++;
+ }
+ }
+ resolve(count);
+ };
+ image.onerror = () => reject(new Error("screenshot decode failed"));
+ image.src = dataUrl;
+ }),
+ {
+ dataUrl: `data:image/png;base64,${screenshot.toString("base64")}`,
+ center,
+ radius,
+ },
+ );
+
+const waitForFieldValue = (label, value) =>
+ page.waitForFunction(
+ ({ label, value }) => {
+ const field = document.querySelector(`[aria-label="${label}"]`);
+ return (
+ field instanceof HTMLInputElement &&
+ Math.abs(Number(field.value) - value) < 0.01
+ );
+ },
+ { label, value },
+ );
+
+try {
+ await page.goto(`${base}/ai-tool/ai-canvas/${projectId}?creation=unified`);
+ await page.getByText(L.saved, { exact: true }).waitFor();
+
+ const addStage = page.getByRole("button", { name: L.addStage, exact: true });
+ await addStage.waitFor();
+ await addStage.click();
+ await page
+ .getByRole("button", { name: L.apply, exact: true })
+ .waitFor();
+
+ // Wait for the stage surface before checking the mutually exclusive
+ // transform tool state and starting the first drag.
+ await page.locator(".cw-stage-scene canvas:not(.cw-stage-pipcanvas)").waitFor();
+ const selectGizmo = page.locator('.cw-stage-gizmo button[data-tool="select"]');
+ const moveGizmo = page.locator('.cw-stage-gizmo button[data-tool="translate"]');
+ const rotateGizmo = page.locator('.cw-stage-gizmo button[data-tool="rotate"]');
+ const scaleGizmo = page.locator('.cw-stage-gizmo button[data-tool="scale"]');
+ const dropGround = page.locator('.cw-stage-gizmo button[data-tool="drop-ground"]');
+ assert.equal((await selectGizmo.textContent()).trim(), L.selectGizmo);
+ assert.equal((await dropGround.textContent()).trim(), L.dropGround);
+ assert.equal(await selectGizmo.getAttribute("aria-pressed"), "false");
+ assert.equal(await moveGizmo.getAttribute("aria-pressed"), "true");
+ assert.equal(await rotateGizmo.getAttribute("aria-pressed"), "false");
+ assert.equal(await scaleGizmo.getAttribute("aria-pressed"), "false");
+ await rotateGizmo.click();
+ assert.equal(await moveGizmo.getAttribute("aria-pressed"), "false");
+ assert.equal(await rotateGizmo.getAttribute("aria-pressed"), "true");
+ assert.equal(await scaleGizmo.getAttribute("aria-pressed"), "false");
+ await moveGizmo.click();
+ await selectGizmo.click();
+ assert.equal(await selectGizmo.getAttribute("aria-pressed"), "true");
+ assert.equal(await moveGizmo.getAttribute("aria-pressed"), "false");
+ await moveGizmo.click();
+ const viewportMetrics = await page.evaluate(() => {
+ const canvas = document.querySelector(
+ ".cw-stage-scene canvas:not(.cw-stage-pipcanvas)",
+ );
+ const rect = canvas?.getBoundingClientRect();
+ return canvas instanceof HTMLCanvasElement && rect
+ ? {
+ width: rect.width,
+ height: rect.height,
+ bufferWidth: canvas.width / window.devicePixelRatio,
+ bufferHeight: canvas.height / window.devicePixelRatio,
+ }
+ : null;
+ });
+ assert.ok(viewportMetrics, "the stage canvas has a measurable viewport");
+ assert.ok(
+ Math.abs(viewportMetrics.bufferWidth - viewportMetrics.width) < 1 &&
+ Math.abs(viewportMetrics.bufferHeight - viewportMetrics.height) < 1,
+ `the WebGL buffer follows the visible viewport (${JSON.stringify(viewportMetrics)})`,
+ );
+
+ // Stages start empty; import a minimal single-subject stage so the gizmo
+ // flow runs against the same origin-seated, keyframe-free subject the
+ // built-in default used to provide. Importing keeps the draft's history
+ // to this one entry, so the later one-undo expectations still hold.
+ await page
+ .locator('input[type="file"][accept^="application/json"]')
+ .setInputFiles({
+ name: "seed.stage.json",
+ mimeType: "application/json",
+ buffer: Buffer.from(
+ JSON.stringify({
+ format: "opendirector-local-stage",
+ version: 2,
+ background: "#151923",
+ grid: true,
+ duration: 6,
+ fps: 30,
+ aspectRatio: "16:9",
+ activeCameraId: "camera-1",
+ cameraSource: "camera",
+ shots: [],
+ cameras: [
+ {
+ id: "camera-1",
+ name: "Camera 1",
+ pose: {
+ position: { x: 5, y: 3.5, z: 7 },
+ target: { x: 0, y: 1, z: 0 },
+ fov: 45,
+ },
+ keyframes: [],
+ },
+ ],
+ objects: [
+ {
+ id: "seed-subject",
+ kind: "person",
+ name: "Subject",
+ color: "#a09af9",
+ position: { x: 0, y: 0, z: 0 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ visible: true,
+ locked: false,
+ opacity: 1,
+ keyframes: [],
+ motionClips: [],
+ },
+ ],
+ }),
+ ),
+ });
+ await waitForFieldValue(L.positionY, 0);
+
+ const positionY = page.getByLabel(L.positionY, { exact: true });
+
+ // How far the selected subject stands above the ground is read from its
+ // lowest rendered point, in DOM over the frame. The seed seats the subject's
+ // origin on the ground, and the built-in person's feet start a little above
+ // that origin: the same few centimetres drop-to-ground takes back.
+ const elevationValue = page.locator(".cw-stage-elevation-value");
+ const elevationText = () => elevationValue.textContent().then((text) => text.trim());
+ const elevationNumber = async () => {
+ const text = await elevationText();
+ assert.ok(
+ text.endsWith(L.elevationUnit),
+ `the readout names its unit (${text})`,
+ );
+ const value = text.slice(0, -L.elevationUnit.length);
+ assert.ok(/^\d+\.\d\d$/.test(value), `the readout keeps two decimals (${text})`);
+ return Number(value);
+ };
+ const waitForElevation = (shown) =>
+ page.waitForFunction(
+ (shown) => {
+ const layer = document.querySelector(".cw-stage-elevation");
+ const label = document.querySelector(".cw-stage-elevation-value");
+ return (
+ layer instanceof HTMLElement &&
+ label instanceof HTMLElement &&
+ (getComputedStyle(layer).display !== "none" &&
+ getComputedStyle(label).display !== "none") === shown
+ );
+ },
+ shown,
+ );
+ await waitForElevation(true);
+ const seated = await elevationNumber();
+ assert.ok(
+ seated > 0.03 && seated < 0.06,
+ `a subject seated by its origin reads the height of its feet (${seated})`,
+ );
+ assert.equal(await elevationText(), L.elevationValue.replace("{height}", seated.toFixed(2)));
+ assert.equal(
+ await elevationValue.getAttribute("aria-label"),
+ L.elevationAria.replace("{height}", seated.toFixed(2)),
+ );
+
+ const stageBox = await page.locator(".cw-stage-scene").boundingBox();
+ assert.ok(stageBox, "stage viewport is visible for underground placement");
+ const undergroundCenter = projectToViewport(0, -0.45, 0, stageBox);
+ const baseline = await page.locator(".cw-stage-scene").screenshot();
+ const baselinePixels = await neutralPixelsNear(
+ baseline,
+ undergroundCenter,
+ Math.min(stageBox.width, stageBox.height) * 0.02,
+ );
+ await positionY.fill("-1");
+ await waitForFieldValue(L.positionY, -1);
+ // Below the ground the translucent ground says so; there is no height to read.
+ await waitForElevation(false);
+ await dropGround.click();
+ const groundedY = await page.waitForFunction(
+ (label) => {
+ const field = document.querySelector(`[aria-label="${label}"]`);
+ if (!(field instanceof HTMLInputElement)) return false;
+ const value = Number(field.value);
+ return Number.isFinite(value) && value < -0.01 ? value : false;
+ },
+ L.positionY,
+ );
+ assert.ok(
+ Number(groundedY) < -0.01,
+ `drop-to-ground uses the rendered bottom (got ${groundedY})`,
+ );
+ assert.equal(await dropGround.isDisabled(), false);
+ await positionY.fill("-1");
+ await waitForFieldValue(L.positionY, -1);
+ await page.waitForTimeout(200);
+ const underground = await page.locator(".cw-stage-scene").screenshot();
+ const undergroundPixels = await neutralPixelsNear(
+ underground,
+ undergroundCenter,
+ Math.min(stageBox.width, stageBox.height) * 0.02,
+ );
+ assert.ok(
+ undergroundPixels > baselinePixels + 12,
+ `the below-ground portion remains visible (${baselinePixels} -> ${undergroundPixels} neutral pixels)`,
+ );
+ await positionY.fill("0");
+ await waitForFieldValue(L.positionY, 0);
+ await waitForElevation(true);
+ assert.ok(
+ Math.abs((await elevationNumber()) - seated) < 0.006,
+ "the readout comes back with the lift",
+ );
+ // Dropped, the subject reads nothing; lifted by a known amount, it reads that
+ // amount and the feet's height together, which is what another drop takes back.
+ await dropGround.click();
+ await waitForElevation(false);
+ const lift = 1.26;
+ await positionY.fill(String(lift));
+ await waitForFieldValue(L.positionY, lift);
+ await waitForElevation(true);
+ const lifted = await elevationNumber();
+ assert.ok(
+ Math.abs(lifted - lift - seated) < 0.011,
+ `a lifted subject reads its height above the ground (${lifted}, lifted ${lift} from the ground with feet ${seated})`,
+ );
+ assert.equal(await elevationText(), L.elevationValue.replace("{height}", lifted.toFixed(2)));
+ assert.equal(
+ await elevationValue.getAttribute("aria-label"),
+ L.elevationAria.replace("{height}", lifted.toFixed(2)),
+ );
+ await dropGround.click();
+ await waitForElevation(false);
+ await positionY.fill("0");
+ await waitForFieldValue(L.positionY, 0);
+ await waitForElevation(true);
+ await page.waitForTimeout(150);
+
+ await dragXHandle();
+ const dragged = Number(await positionX().inputValue());
+ // A miss would orbit the camera instead; the persisted-pose assertions
+ // below would catch that, but fail fast here with the observed value.
+ assert.ok(
+ dragged > 0.5,
+ `gizmo drag moved the subject along X (got ${dragged})`,
+ );
+
+ // Placement edits are ordinary history entries: one undo restores the
+ // original position without touching any other subject data. The canvas
+ // toolbar undo carries an aria-label; scope to the modal's plain-text one.
+ const modalUndo = page
+ .locator(".cw-stage-console")
+ .getByRole("button", { name: L.undo, exact: true });
+ await modalUndo.click();
+ await page.waitForFunction(
+ (label) => {
+ const field = document.querySelector(`[aria-label="${label}"]`);
+ return field instanceof HTMLInputElement &&
+ Math.abs(Number(field.value)) < 0.01;
+ },
+ L.positionX,
+ );
+ const undone = Number(await positionX().inputValue());
+ assert.ok(Math.abs(undone) < 0.01, `undo restored X (got ${undone})`);
+
+ // Undo-and-apply persists the un-dragged pose with only the t=0 anchor the
+ // numeric-field parking authored; the drag itself adds no frame.
+ await page.getByRole("button", { name: L.apply, exact: true }).click();
+ const appliedUndo = await until((snapshot) => {
+ const result = director(snapshot, snapshot.canvasItems.find(
+ (candidate) => candidate.visible && candidate.kind === "external",
+ )?.id);
+ // Wait for the applied draft itself: the freshly created document also
+ // exists before the apply and stages no longer seed a default subject.
+ // The parked subject carries the one t=0 anchor its numeric-field
+ // parking authored; the drag itself must add no frame beyond it.
+ return (
+ result.document?.kind === "director" &&
+ result.document.data.objects.length === 1 &&
+ keyframeCount(result.document) === 1
+ );
+ }, "stage document persisted after undo apply");
+ const undoItemId = appliedUndo.canvasItems.find(
+ (candidate) => candidate.visible && candidate.kind === "external",
+ ).id;
+ const undoDocument = director(appliedUndo, undoItemId).document;
+ assert.equal(keyframeCount(undoDocument), 1);
+ assert.ok(
+ Math.abs(undoDocument.data.objects[0].position.x) < 0.01,
+ "undo apply persisted the original X",
+ );
+
+ // Reopen and drag again: the placement persists as a base transform, and a
+ // recorded keyframe then keeps the subject draggable, posing it at the
+ // playhead, with no camera-pose side effects.
+ await page.locator(`.react-flow__node[data-id="${undoItemId}"]`).click();
+ await page.getByRole("button", { name: L.openStage, exact: true }).click();
+ await page
+ .getByRole("button", { name: L.apply, exact: true })
+ .waitFor();
+ // Select the rotate tool explicitly. Its ring turns the subject around the
+ // X axis without touching its position, and the upper-left arc carries no
+ // translate arrows. It runs before the translate drag while the subject
+ // still sits at the world origin, where the gizmo center is fixed.
+ await rotateGizmo.click();
+ const ringBox = await page.locator(".cw-stage-scene").boundingBox();
+ const ringCenter = {
+ x: ringBox.x + ringBox.width / 2,
+ y: ringBox.y + ringBox.height * 0.625,
+ };
+ const radial = { x: -0.5, y: -0.866 };
+ const ringPx = Math.min(ringBox.width, ringBox.height) * 0.053;
+ const grab = {
+ x: ringCenter.x + radial.x * ringPx,
+ y: ringCenter.y + radial.y * ringPx,
+ };
+ await page.mouse.move(grab.x, grab.y);
+ await page.mouse.down();
+ await page.mouse.move(grab.x + 0.866 * 80, grab.y - 0.5 * 80, { steps: 12 });
+ await page.mouse.up();
+ const turned = Number(
+ await page.getByLabel(L.rotationX, { exact: true }).inputValue(),
+ );
+ assert.ok(
+ Math.abs(turned) > 30,
+ `rotate drag turned the subject (got ${turned})`,
+ );
+ assert.ok(
+ Math.abs(Number(await positionX().inputValue())) < 0.01,
+ "rotation left the placement position unchanged",
+ );
+
+ await moveGizmo.click();
+ await dragXHandle();
+ const draggedAgain = Number(await positionX().inputValue());
+ assert.ok(
+ draggedAgain > 0.5,
+ `second gizmo drag moved the subject along X (got ${draggedAgain})`,
+ );
+
+ // A keyframed subject must stay draggable: with the playhead at 0, record a
+ // frame first, then drag the X handle again. The pose lands in the frame at
+ // the playhead through the same writer as the numeric fields.
+ const previewMode = page.getByRole("group", { name: L.previewMode, exact: true });
+ await previewMode.getByRole("button", { name: L.dynamicPreview, exact: true }).click();
+ await page.getByTestId("director-stage-timeline").waitFor();
+ await page.locator(".cw-stage-transport").getByRole("button").first().click();
+ await page.getByRole("slider", { name: L.playhead, exact: true }).press("Home");
+ await page
+ .getByRole("button", { name: L.recordKeyframe, exact: true })
+ .click();
+ await page.locator(".cw-stage-track-point.is-keyframe").first().waitFor();
+ // Read the base transform fresh after recording and project it to the
+ // moved gizmo; the timeline itself is the source of the keyframe state.
+ const posedPosition = {
+ x: await fieldNumber(L.positionX),
+ y: await fieldNumber(L.positionY),
+ z: await fieldNumber(L.positionZ),
+ };
+ await dragXHandleAt(posedPosition);
+ const posedDragged = await fieldNumber(L.positionX);
+ assert.ok(
+ posedDragged > posedPosition.x + 0.1,
+ `drag on the keyframed subject moved the pose along X (got ${posedDragged})`,
+ );
+ // The pose drag is one history entry: one undo restores the pose the record
+ // button captured, and redo re-applies the dragged pose.
+ await modalUndo.click();
+ await waitForFieldValue(L.positionX, posedPosition.x);
+ await page
+ .locator(".cw-stage-console")
+ .getByRole("button", { name: L.redo, exact: true })
+ .click();
+ await waitForFieldValue(L.positionX, posedDragged);
+
+ await page.getByRole("button", { name: L.apply, exact: true }).click();
+ const applied = await until((snapshot) => {
+ const result = director(snapshot, undoItemId);
+ return (
+ result.document?.kind === "director" &&
+ result.document.data.objects[0].position.x > 0.5 &&
+ Math.abs(result.document.data.objects[0].rotation.x) > 0.5 &&
+ result.document.data.objects[0].keyframes.length === 1
+ );
+ }, "dragged placement, rotation and pose keyframe persisted after apply");
+ const document = director(applied, undoItemId).document;
+ const subject = document.data.objects[0];
+ // The drags authored no frames of their own: the recorded frame at 0 is
+ // still the only one, and the pose drag overwrote its value in place while
+ // the base transform carries the same dragged pose.
+ assert.equal(subject.keyframes.length, 1);
+ assert.ok(
+ Math.abs(subject.keyframes[0].time) < 1e-9,
+ "pose frame sits at the playhead time",
+ );
+ assert.ok(
+ Math.abs(subject.keyframes[0].value.position.x - subject.position.x) <
+ 0.01,
+ "pose keyframe holds the dragged position",
+ );
+ assert.ok(
+ Math.abs(subject.position.x - posedDragged) < 0.01,
+ "base transform carries the dragged pose",
+ );
+ const pose = document.data.cameras[0].pose;
+ assert.deepEqual(pose.position, { x: 5, y: 3.5, z: 7 });
+ assert.deepEqual(pose.target, { x: 0, y: 1, z: 0 });
+ assert.equal(pose.fov, 45);
+ assert.equal(
+ document.data.cameras[0].keyframes.length,
+ 1,
+ "drags authored no camera keyframes beyond the recorded frame",
+ );
+
+ // Apply already closed the editor; the modal is gone from the canvas.
+ await page
+ .getByRole("button", { name: L.apply, exact: true })
+ .waitFor({ state: "detached" });
+ assert.deepEqual(errors, []);
+ console.log(
+ JSON.stringify({
+ passed: true,
+ projectId,
+ itemId: undoItemId,
+ checks: [
+ "translate drag moves the selected subject",
+ "one undo restores the placement",
+ "rotate ring turns the subject in place",
+ "placement and rotation persist as base transforms",
+ "drags author no keyframes beyond the recorded frame",
+ "dragging after a recorded keyframe poses at the playhead",
+ "one undo reverts the pose drag",
+ "dragging leaves the camera pose untouched",
+ "no page errors",
+ ],
+ }),
+ );
+} catch (error) {
+ console.error((await page.locator("body").innerText()).slice(-2500));
+ throw error;
+} finally {
+ await browser.close();
+}
diff --git a/tests/browser/director_stage_interaction.mjs b/tests/browser/director_stage_interaction.mjs
new file mode 100644
index 000000000..71f850971
--- /dev/null
+++ b/tests/browser/director_stage_interaction.mjs
@@ -0,0 +1,470 @@
+/** Batch-5 acceptance: view settings, scene tree, two-step placement,
+ * default keyboard camera movement and the anchored action bar over the
+ * fullscreen console. */
+import assert from "node:assert/strict";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE ?? "playwright-core"
+);
+
+const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5179";
+const api = process.env.CREATION_API_URL ?? "http://127.0.0.1:8019";
+const headers = {
+ "X-OpenDirector-Request": "1",
+ "Content-Type": "application/json",
+};
+
+async function call(path, body, extra = {}) {
+ const response = await fetch(api + path, {
+ headers: { ...headers, ...extra },
+ ...(body ? { method: "POST", body: JSON.stringify(body) } : {}),
+ });
+ assert.ok(
+ response.ok,
+ `${response.status}: ${await response.clone().text()}`,
+ );
+ return response.json();
+}
+
+assert.equal((await call("/api/creation-test-health")).isolated, true);
+
+const projectId = crypto.randomUUID();
+await call(`/api/creation/projects/${projectId}/commands`, {
+ commandId: crypto.randomUUID(),
+ projectId,
+ type: "project.create",
+ payload: { name: `Interact ${projectId.slice(0, 8)}` },
+});
+const state = () => call(`/api/creation/projects/${projectId}`);
+const browser = await chromium.launch({
+ headless: true,
+ ...(process.env.CHROMIUM_PATH
+ ? { executablePath: process.env.CHROMIUM_PATH }
+ : {}),
+ args: ["--no-sandbox", "--enable-unsafe-swiftshader"],
+});
+const page = await browser.newPage({
+ locale: "en-US",
+ viewport: { width: 1700, height: 1100 },
+});
+await page.addInitScript(() =>
+ localStorage.setItem("opendirector.modelSetup.v1", "dismissed"),
+);
+page.setDefaultTimeout(20000);
+const errors = [];
+page.on("pageerror", (error) => errors.push(error.message));
+
+const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
+const until = async (predicate, label) => {
+ const deadline = Date.now() + 20000;
+ let snapshot;
+ while (Date.now() < deadline) {
+ snapshot = await state();
+ if (predicate(snapshot)) return snapshot;
+ await sleep(100);
+ }
+ throw new Error(`Timeout: ${label}; snapshot: ${JSON.stringify(snapshot)}`);
+};
+const stageDoc = (snapshot) =>
+ snapshot.editorDocuments.find((candidate) => candidate.kind === "director");
+const sceneBox = async () => {
+ const box = await page.locator(".cw-stage-scene").boundingBox();
+ assert.ok(box);
+ return box;
+};
+const DEFAULT_CAMERA = {
+ eye: { x: 8, y: 6, z: 10 },
+ target: { x: 0, y: 1, z: 0 },
+ fov: 45,
+};
+const sub3 = (a, b) => ({ x: a.x - b.x, y: a.y - b.y, z: a.z - b.z });
+const cross3 = (a, b) => ({
+ x: a.y * b.z - a.z * b.y,
+ y: a.z * b.x - a.x * b.z,
+ z: a.x * b.y - a.y * b.x,
+});
+const normalize3 = (a) => {
+ const length = Math.hypot(a.x, a.y, a.z);
+ return { x: a.x / length, y: a.y / length, z: a.z / length };
+};
+const groundPointAt = (box, xFraction, yFraction) => {
+ const forward = normalize3(sub3(DEFAULT_CAMERA.target, DEFAULT_CAMERA.eye));
+ const right = normalize3(cross3(forward, { x: 0, y: 1, z: 0 }));
+ const up = normalize3(cross3(right, forward));
+ const nx = xFraction * 2 - 1;
+ const ny = 1 - yFraction * 2;
+ const halfHeight = Math.tan((DEFAULT_CAMERA.fov * Math.PI) / 360);
+ const halfWidth = halfHeight * (box.width / box.height);
+ const direction = normalize3({
+ x: forward.x + right.x * halfWidth * nx + up.x * halfHeight * ny,
+ y: forward.y + right.y * halfWidth * nx + up.y * halfHeight * ny,
+ z: forward.z + right.z * halfWidth * nx + up.z * halfHeight * ny,
+ });
+ const distance = -DEFAULT_CAMERA.eye.y / direction.y;
+ return {
+ x: DEFAULT_CAMERA.eye.x + direction.x * distance,
+ z: DEFAULT_CAMERA.eye.z + direction.z * distance,
+ };
+};
+
+let itemId;
+try {
+ await page.goto(`${base}/ai-tool/ai-canvas/${projectId}?creation=unified`);
+ await page.getByText("Saved on this device", { exact: true }).waitFor();
+ await page
+ .getByRole("button", { name: "Add Director Stage", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor();
+ const created = await until(
+ (snapshot) => stageDoc(snapshot)?.kind === "director",
+ "created director document",
+ );
+ itemId = created.canvasItems.find((item) => item.kind === "external").id;
+
+ // Two-step placement arms instead of adding, and Esc disarms.
+ assert.equal(
+ await page.getByRole("button", { name: "+ Person", exact: true }).count(),
+ 0,
+ "characters are placed from preview cards, not direct add buttons",
+ );
+ await page
+ .locator('.cw-stage-object-grid button[data-stage-placement-kind="person"]')
+ .first()
+ .click();
+ await page.locator(".cw-stage-placehint").waitFor();
+ await page.keyboard.press("Escape");
+ assert.equal(await page.locator(".cw-stage-placehint").count(), 0);
+
+ // Arming again and clicking the scene lands the object there; the
+ // first completed placement opens the console controls once.
+ await page
+ .locator('.cw-stage-object-grid button[data-stage-placement-kind="person"]')
+ .first()
+ .click();
+ const box = await sceneBox();
+ await page.mouse.click(box.x + box.width * 0.62, box.y + box.height * 0.55);
+ const help = page.getByRole("dialog", { name: "Director console controls" });
+ await help.waitFor();
+ await help.getByRole("button", { name: "Close help", exact: true }).click();
+
+ // Built-in objects use the same preview-card placement flow; the former
+ // direct + Box controls are intentionally gone.
+ await page.getByRole("tab", { name: "Objects", exact: true }).click();
+ assert.equal(
+ await page.getByRole("button", { name: "+ Box", exact: true }).count(),
+ 0,
+ "objects are placed from preview cards, not direct add buttons",
+ );
+ const boxCard = page.locator(
+ '.cw-stage-object-grid button[data-stage-placement-kind="box"]',
+ );
+ assert.equal(await boxCard.count(), 1, "the Box preview card is available");
+ await boxCard.click();
+ const objectPlacementBox = await sceneBox();
+ await page.mouse.click(
+ objectPlacementBox.x + objectPlacementBox.width * 0.38,
+ objectPlacementBox.y + objectPlacementBox.height * 0.55,
+ );
+ await until(
+ (snapshot) => stageDoc(snapshot) === undefined || true,
+ "placement pending",
+ );
+ await page.getByRole("button", { name: "Apply edits", exact: true }).click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor({ state: "detached" });
+ const placed = await until(
+ (snapshot) => (stageDoc(snapshot)?.data.objects ?? []).length === 2,
+ "the placed person and object persist",
+ );
+ const landed = stageDoc(placed).data.objects[0];
+ assert.ok(
+ landed.position.x > 0.5 || Math.abs(landed.position.z) > 0.5,
+ `the object landed at the clicked spot (${landed.position.x}, ${landed.position.z})`,
+ );
+ assert.ok(
+ landed.position.y < -0.01,
+ `the placed character is grounded by its rendered bottom (y=${landed.position.y})`,
+ );
+ assert.equal(stageDoc(placed).data.objects[1].kind, "box");
+
+ // The scene tree groups subjects with collapsing heads.
+ await page.locator(`.react-flow__node[data-id="${itemId}"]`).click();
+ await page
+ .getByRole("button", { name: "Open Director Stage", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor();
+ const tooltipPolicy = await page
+ .locator('.cw-domain-overlay[role="dialog"] button')
+ .evaluateAll((buttons) => {
+ const isIconOnly = (button) =>
+ button.hasAttribute("data-icon") ||
+ button.classList.contains("cw-stage-row-action") ||
+ button.classList.contains("cw-stage-tab") ||
+ button.classList.contains("cw-stage-transport-play") ||
+ button.classList.contains("cw-stage-record-keyframe") ||
+ button.classList.contains("cw-stage-track-add") ||
+ button.classList.contains("cw-stage-storyboard-add") ||
+ button.classList.contains("cw-stage-track-interval") ||
+ button.classList.contains("cw-stage-track-point");
+ return {
+ missingIconTooltips: buttons
+ .filter((button) => isIconOnly(button) && !button.title.trim())
+ .map((button) => button.outerHTML),
+ redundantTextTooltips: buttons
+ .filter(
+ (button) =>
+ !isIconOnly(button) &&
+ button.title.trim() &&
+ button.textContent?.trim(),
+ )
+ .map((button) => button.textContent.trim()),
+ };
+ });
+ assert.deepEqual(
+ tooltipPolicy.missingIconTooltips,
+ [],
+ "non-obvious icon controls expose a hover tooltip",
+ );
+ assert.deepEqual(
+ tooltipPolicy.redundantTextTooltips,
+ [],
+ "text-labelled controls do not duplicate their label as a hover tooltip",
+ );
+ const tree = page.locator(".cw-stage-tree");
+ assert.equal(
+ await tree
+ .locator(".cw-stage-tree-row")
+ .getByText("Person 1", { exact: true })
+ .count(),
+ 1,
+ "the built-in character uses the default display name",
+ );
+ const environmentInspector = page.getByTestId(
+ "director-stage-environment-inspector",
+ );
+ const environmentScene = await sceneBox();
+ await page.mouse.click(
+ environmentScene.x + environmentScene.width * 0.5,
+ environmentScene.y + environmentScene.height * 0.15,
+ );
+ await environmentInspector.waitFor();
+ await page.getByLabel("Environment preset", { exact: true }).waitFor();
+ const treeScroll = page.locator(".cw-stage-tree-scroll");
+ const inspectorScroll = page.locator(".cw-stage-inspector-scroll");
+ const treeScrollBox = await treeScroll.boundingBox();
+ const inspectorScrollBox = await inspectorScroll.boundingBox();
+ assert.ok(
+ treeScrollBox &&
+ inspectorScrollBox &&
+ Math.abs(
+ treeScrollBox.x +
+ treeScrollBox.width -
+ (inspectorScrollBox.x + inspectorScrollBox.width),
+ ) < 1,
+ "object and property scroll areas share the same right edge",
+ );
+ assert.equal(
+ await environmentInspector
+ .getByLabel("Environment preset", { exact: true })
+ .count(),
+ 1,
+ "empty viewport selection exposes environment properties",
+ );
+ assert.equal(
+ await environmentInspector
+ .getByRole("slider", { name: "Exposure slider", exact: true })
+ .count(),
+ 1,
+ "environment scalar controls use the shared draggable value rows",
+ );
+ const keyLight = environmentInspector.getByRole("button", { name: "Key light", exact: true });
+ assert.equal(await keyLight.getAttribute("aria-expanded"), "false");
+ await keyLight.click();
+ assert.equal(
+ await environmentInspector
+ .getByRole("slider", { name: "Key light intensity slider", exact: true })
+ .count(),
+ 1,
+ "light scalar controls use the shared draggable value rows",
+ );
+ const environmentPreset = environmentInspector.getByLabel(
+ "Environment preset",
+ { exact: true },
+ );
+ await environmentPreset.selectOption("studio");
+ const backgroundColor = environmentInspector.getByLabel("Background color", {
+ exact: true,
+ });
+ assert.equal(
+ await backgroundColor.inputValue(),
+ "#0d0d0d",
+ "environment inspector exposes the current background color",
+ );
+ const backgroundRow = backgroundColor.locator(
+ "xpath=ancestor::label[contains(@class, 'cw-inspector-property-row')]",
+ );
+ const backgroundLabelBox = await backgroundRow
+ .locator(".cw-inspector-property-label")
+ .boundingBox();
+ const backgroundControlBox = await backgroundRow
+ .locator(".cw-inspector-color-control")
+ .boundingBox();
+ assert.ok(
+ backgroundLabelBox &&
+ backgroundControlBox &&
+ backgroundControlBox.x > backgroundLabelBox.x &&
+ Math.abs(backgroundControlBox.y - backgroundLabelBox.y) < 12,
+ "environment properties align their label and control well in one row",
+ );
+ assert.equal(
+ await backgroundRow.getByText("#0D0D0D", { exact: true }).count(),
+ 1,
+ "color properties pair the swatch with a readable color value",
+ );
+ await environmentInspector
+ .getByLabel("Ground color", { exact: true })
+ .fill("#405060");
+ assert.equal(
+ await environmentPreset.inputValue(),
+ "custom",
+ "manual environment edits are labeled as custom rather than a stale preset",
+ );
+ await environmentInspector
+ .getByLabel("Show ground", { exact: true })
+ .uncheck();
+ await environmentInspector
+ .getByLabel("Key light intensity", { exact: true })
+ .fill("4.2");
+ await environmentInspector
+ .getByLabel("Show ground grid", { exact: true })
+ .uncheck();
+ assert.equal(
+ await environmentInspector
+ .getByLabel("Show ground", { exact: true })
+ .isChecked(),
+ false,
+ "the no-selection inspector updates the persisted ground visibility",
+ );
+ assert.equal(
+ await environmentInspector
+ .getByLabel("Key light intensity", { exact: true })
+ .inputValue(),
+ "4.2",
+ "the no-selection inspector updates stage lights",
+ );
+ await tree.getByRole("group").filter({ hasText: "Characters (1)" }).waitFor();
+ await tree
+ .getByRole("treeitem", { name: "Person 1", exact: false })
+ .getByRole("button")
+ .first()
+ .click();
+ assert.equal(
+ await environmentInspector.count(),
+ 0,
+ "selecting an object restores object properties",
+ );
+ await tree
+ .getByRole("treeitem", { name: "Person 1", exact: false })
+ .getByRole("button", { name: "Focus Person 1", exact: true })
+ .click();
+ await tree
+ .getByRole("group")
+ .filter({ hasText: "Characters (1)" })
+ .getByRole("button", { name: /Characters \(1\)/, exact: false })
+ .click();
+ assert.equal(
+ await tree
+ .getByRole("group")
+ .filter({ hasText: "Characters (1)" })
+ .getByRole("treeitem")
+ .count(),
+ 0,
+ "the group head collapses its rows",
+ );
+
+ // The anchored action bar duplicates and deletes the selection.
+ await tree
+ .getByRole("group")
+ .filter({ hasText: "Characters (1)" })
+ .getByRole("button", { name: /Characters \(1\)/, exact: false })
+ .click();
+ await tree
+ .getByRole("treeitem", { name: "Person 1", exact: false })
+ .locator("button")
+ .first()
+ .click();
+ const actionBar = page.locator(".cw-stage-actionbar");
+ await actionBar.waitFor();
+ await actionBar
+ .getByRole("button", { name: "Duplicate", exact: true })
+ .click();
+ await tree.getByRole("group").filter({ hasText: "Characters (2)" }).waitFor();
+ await actionBar
+ .getByRole("button", { name: "Delete this subject", exact: true })
+ .click();
+ await tree.getByRole("group").filter({ hasText: "Characters (1)" }).waitFor();
+
+ // View settings toggle the indicator and the name labels.
+ await page
+ .getByRole("button", { name: "View settings overlay", exact: true })
+ .click();
+ const menu = page.locator(".cw-stage-viewmenu");
+ await menu.waitFor();
+ assert.equal(await page.locator(".cw-stage-viewinfo").isVisible(), true);
+ await menu.getByLabel("View indicator", { exact: true }).uncheck();
+ await page.waitForTimeout(300);
+ assert.equal(await page.locator(".cw-stage-viewinfo").isVisible(), false);
+ await menu.getByLabel("View indicator", { exact: true }).check();
+ await menu.getByLabel("Object names", { exact: true }).uncheck();
+ await page.waitForTimeout(300);
+ assert.equal(await page.locator(".cw-stage-name").first().isVisible(), false);
+ await menu.getByLabel("Object names", { exact: true }).check();
+ await page.keyboard.press("Escape");
+
+ // Keyboard camera movement is always available; the old mode toggle is
+ // intentionally gone. Holding a movement key changes the rendered view.
+ assert.equal(
+ await page.getByRole("button", { name: "Roam view", exact: true }).count(),
+ 0,
+ "camera movement does not require a roam-mode button",
+ );
+ const scene = await sceneBox();
+ const canvas = page.locator(".cw-stage-scene canvas").first();
+ const before = await canvas.evaluate((element) => element.toDataURL());
+ await page.mouse.click(scene.x + scene.width / 2, scene.y + scene.height / 2);
+ await page.keyboard.down("d");
+ await page.waitForTimeout(250);
+ await page.keyboard.up("d");
+ const after = await canvas.evaluate((element) => element.toDataURL());
+ assert.notEqual(after, before, "holding D moves the default viewport camera");
+ assert.deepEqual(errors, []);
+} catch (error) {
+ console.error((await page.locator("body").innerText()).slice(-2500));
+ throw error;
+} finally {
+ await browser.close();
+}
+console.log(
+ JSON.stringify({
+ passed: true,
+ projectId,
+ itemId,
+ checks: [
+ "arming a preset shows the hint and Escape disarms",
+ "preview cards place characters and built-in objects",
+ "a viewport click lands the object and opens the first-time help",
+ "the scene tree groups subjects and collapses",
+ "empty viewport selection exposes environment properties",
+ "object selection restores object properties",
+ "tree focus selects without dirtying the camera",
+ "the anchored action bar duplicates and deletes",
+ "view settings toggle the indicator and name labels",
+ "WASD/QE move the default viewport camera without a roam toggle",
+ "no page errors",
+ ],
+ }),
+);
diff --git a/tests/browser/director_stage_layout.mjs b/tests/browser/director_stage_layout.mjs
new file mode 100644
index 000000000..0a3d6b131
--- /dev/null
+++ b/tests/browser/director_stage_layout.mjs
@@ -0,0 +1,213 @@
+/** First-phase Director Stage acceptance: resize the left and right panels
+ * and the dynamic timeline with pointer and keyboard input. */
+import assert from "node:assert/strict";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE ?? "playwright-core",
+);
+
+const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5179";
+const api = process.env.CREATION_API_URL ?? "http://127.0.0.1:8019";
+const headers = {
+ "X-OpenDirector-Request": "1",
+ "Content-Type": "application/json",
+};
+
+async function call(path, body) {
+ const response = await fetch(api + path, {
+ headers,
+ ...(body ? { method: "POST", body: JSON.stringify(body) } : {}),
+ });
+ assert.ok(response.ok, `${response.status}: ${await response.clone().text()}`);
+ return response.json();
+}
+
+assert.equal((await call("/api/creation-test-health")).isolated, true);
+
+const projectId = crypto.randomUUID();
+await call(`/api/creation/projects/${projectId}/commands`, {
+ commandId: crypto.randomUUID(),
+ projectId,
+ type: "project.create",
+ payload: { name: `Director Stage layout ${projectId.slice(0, 8)}` },
+});
+const state = () => call(`/api/creation/projects/${projectId}`);
+const browser = await chromium.launch({
+ headless: true,
+ ...(process.env.CHROMIUM_PATH
+ ? { executablePath: process.env.CHROMIUM_PATH }
+ : {}),
+ args: ["--no-sandbox", "--enable-unsafe-swiftshader"],
+});
+const page = await browser.newPage({
+ locale: "en-US",
+ viewport: { width: 1700, height: 1100 },
+});
+await page.addInitScript(() => {
+ localStorage.setItem("opendirector.modelSetup.v1", "dismissed");
+});
+page.setDefaultTimeout(20000);
+const errors = [];
+page.on("pageerror", (error) => errors.push(error.message));
+
+const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
+const stageDocument = (snapshot) =>
+ snapshot.editorDocuments.find((candidate) => candidate.kind === "director");
+const until = async (predicate, label) => {
+ const deadline = Date.now() + 20000;
+ let snapshot;
+ while (Date.now() < deadline) {
+ snapshot = await state();
+ if (predicate(snapshot)) return snapshot;
+ await sleep(100);
+ }
+ throw new Error(`Timeout: ${label}; snapshot: ${JSON.stringify(snapshot)}`);
+};
+
+const value = (locator) => locator.getAttribute("aria-valuenow");
+const numericValue = async (locator) => Number(await value(locator));
+const drag = async (locator, dx, dy) => {
+ const box = await locator.boundingBox();
+ assert.ok(box);
+ const x = box.x + box.width / 2;
+ const y = box.y + box.height / 2;
+ await page.mouse.move(x, y);
+ await page.mouse.down();
+ await page.mouse.move(x + dx, y + dy, { steps: 5 });
+ await page.mouse.up();
+};
+
+let itemId;
+try {
+ await page.goto(`${base}/ai-tool/ai-canvas/${projectId}?creation=unified`);
+ await page.getByText("Saved on this device", { exact: true }).waitFor();
+ await page
+ .getByRole("button", { name: "Add Director Stage", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor();
+ const created = await until(
+ (snapshot) => stageDocument(snapshot)?.kind === "director",
+ "created director document",
+ );
+ itemId = created.canvasItems.find((item) => item.kind === "external").id;
+
+ const left = page.getByTestId("director-stage-left-resizer");
+ const right = page.getByTestId("director-stage-right-resizer");
+ assert.equal(await numericValue(left), 196);
+ assert.equal(await numericValue(right), 232);
+
+ await left.focus();
+ await left.press("ArrowRight");
+ assert.equal(await numericValue(left), 204);
+ await right.focus();
+ await right.press("ArrowLeft");
+ assert.equal(await numericValue(right), 240);
+
+ const leftBeforeDrag = await numericValue(left);
+ await drag(left, 40, 0);
+ assert.ok(
+ (await numericValue(left)) > leftBeforeDrag,
+ "left panel grows when its separator moves right",
+ );
+
+ const rightBeforeDrag = await numericValue(right);
+ await drag(right, -40, 0);
+ assert.ok(
+ (await numericValue(right)) > rightBeforeDrag,
+ "right panel grows when its separator moves left",
+ );
+
+ await page
+ .getByRole("group", { name: "Preview mode", exact: true })
+ .getByRole("button", { name: "Dynamic", exact: true })
+ .click();
+ const timeline = page.getByTestId("director-stage-timeline-resizer");
+ await timeline.waitFor();
+ assert.equal(await numericValue(timeline), 176);
+ await timeline.focus();
+ await timeline.press("ArrowUp");
+ assert.equal(await numericValue(timeline), 184);
+ const timelineBeforeDrag = await numericValue(timeline);
+ await drag(timeline, 0, -32);
+ assert.ok(
+ (await numericValue(timeline)) > timelineBeforeDrag,
+ "timeline grows when its top edge moves upward",
+ );
+
+ const leftPanel = page.locator(".cw-stage-left");
+ const rightPanel = page.locator(".cw-stage-right");
+ const footer = page.locator(".cw-stage-bottom");
+ const consoleBox = await page.locator(".cw-stage-console").boundingBox();
+ const leftPanelBox = await leftPanel.boundingBox();
+ const rightPanelBox = await rightPanel.boundingBox();
+ const leftResizerBox = await left.boundingBox();
+ const rightResizerBox = await right.boundingBox();
+ const footerBox = await footer.boundingBox();
+ assert.ok(
+ consoleBox &&
+ leftPanelBox &&
+ rightPanelBox &&
+ leftResizerBox &&
+ rightResizerBox &&
+ footerBox,
+ );
+ assert.ok(
+ Math.abs(leftPanelBox.y + leftPanelBox.height - footerBox.y) < 2,
+ "left panel ends at the dynamic timeline",
+ );
+ assert.ok(
+ Math.abs(rightPanelBox.y + rightPanelBox.height - footerBox.y) < 2,
+ "right panel ends at the dynamic timeline",
+ );
+ assert.ok(
+ Math.abs(leftResizerBox.y + leftResizerBox.height - footerBox.y) < 2,
+ "left separator highlight ends at the dynamic timeline",
+ );
+ assert.ok(
+ Math.abs(rightResizerBox.y + rightResizerBox.height - footerBox.y) < 2,
+ "right separator highlight ends at the dynamic timeline",
+ );
+ assert.ok((await leftPanel.boundingBox()).width > 196);
+ assert.ok((await rightPanel.boundingBox()).width > 232);
+ assert.ok((await footer.boundingBox()).height > 176);
+
+ // Layout is session-only. Applying and reopening the same document starts
+ // from the default layout and does not write view dimensions to the project.
+ await page.getByRole("button", { name: "Apply edits", exact: true }).click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor({ state: "detached" });
+ await page.locator(`.react-flow__node[data-id="${itemId}"]`).click();
+ await page
+ .getByRole("button", { name: "Open Director Stage", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor();
+ assert.equal(await numericValue(page.getByTestId("director-stage-left-resizer")), 196);
+ assert.equal(await numericValue(page.getByTestId("director-stage-right-resizer")), 232);
+
+ assert.deepEqual(errors, []);
+} catch (error) {
+ console.error((await page.locator("body").innerText()).slice(-2500));
+ throw error;
+} finally {
+ await browser.close();
+}
+
+console.log(
+ JSON.stringify({
+ passed: true,
+ projectId,
+ itemId,
+ checks: [
+ "left and right panel keyboard resizing",
+ "left and right panel pointer resizing",
+ "dynamic timeline keyboard and pointer resizing",
+ "layout geometry follows the announced values",
+ "layout resets on editor reopen and is not persisted",
+ "no page errors",
+ ],
+ }),
+);
diff --git a/tests/browser/director_stage_output.mjs b/tests/browser/director_stage_output.mjs
new file mode 100644
index 000000000..44c798e26
--- /dev/null
+++ b/tests/browser/director_stage_output.mjs
@@ -0,0 +1,541 @@
+/** Fourth-phase Director Stage acceptance: captured stills and preview MP4s
+ * become tracked project assets that the timeline can reference. */
+import assert from "node:assert/strict";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE ?? "playwright-core"
+);
+
+const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5179";
+const api = process.env.CREATION_API_URL ?? "http://127.0.0.1:8019";
+const headers = {
+ "X-OpenDirector-Request": "1",
+ "Content-Type": "application/json",
+};
+
+async function call(path, body, extra = {}) {
+ const response = await fetch(api + path, {
+ headers: { ...headers, ...extra },
+ ...(body
+ ? { method: "POST", body: JSON.stringify(body) }
+ : {}),
+ });
+ assert.ok(response.ok, `${response.status}: ${await response.clone().text()}`);
+ return response.json();
+}
+
+assert.equal((await call("/api/creation-test-health")).isolated, true);
+
+const projectId = crypto.randomUUID();
+await call(`/api/creation/projects/${projectId}/commands`, {
+ commandId: crypto.randomUUID(),
+ projectId,
+ type: "project.create",
+ payload: { name: `Director output ${projectId.slice(0, 8)}` },
+});
+
+const state = () => call(`/api/creation/projects/${projectId}`);
+const browser = await chromium.launch({
+ headless: true,
+ ...(process.env.CHROMIUM_PATH
+ ? { executablePath: process.env.CHROMIUM_PATH }
+ : {}),
+ args: ["--no-sandbox", "--enable-unsafe-swiftshader"],
+});
+const page = await browser.newPage({
+ locale: "en-US",
+ viewport: { width: 1700, height: 1100 },
+ // Still capture must stay at encoder resolution on high-DPI displays;
+ // run once with CREATION_DEVICE_SCALE_FACTOR=2 to verify.
+ ...(process.env.CREATION_DEVICE_SCALE_FACTOR
+ ? {
+ deviceScaleFactor: Number(process.env.CREATION_DEVICE_SCALE_FACTOR),
+ }
+ : {}),
+});
+await page.addInitScript(() => {
+ localStorage.setItem("opendirector.modelSetup.v1", "dismissed");
+ localStorage.setItem("opendirector.locale.v1", "en-US");
+});
+page.setDefaultTimeout(20000);
+const errors = [];
+page.on("pageerror", (error) => errors.push(error.message));
+
+const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
+const until = async (predicate, label) => {
+ const deadline = Date.now() + 20000;
+ let snapshot;
+ while (Date.now() < deadline) {
+ snapshot = await state();
+ if (predicate(snapshot)) return snapshot;
+ await sleep(100);
+ }
+ throw new Error(`Timeout: ${label}; snapshot: ${JSON.stringify(snapshot)}`);
+};
+
+const stageDoc = (snapshot) =>
+ snapshot.editorDocuments.find((candidate) => candidate.kind === "director");
+const imageAssets = (snapshot) =>
+ snapshot.assets.filter((asset) => asset.kind === "image");
+const browserSessions = new Set();
+page.on("request", (request) => {
+ const value = request.headers()["x-opendirector-session"];
+ if (value) browserSessions.add(value);
+});
+const apply = async () => {
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor({ state: "detached" });
+};
+const openStage = async (itemId) => {
+ await page.locator(`.react-flow__node[data-id="${itemId}"]`).click();
+ await page
+ .getByRole("button", { name: "Open Director Stage", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor();
+};
+
+const timelineId = crypto.randomUUID();
+const clipId = crypto.randomUUID();
+let firstStill, secondStill, videoRef, videoAsset, itemId;
+try {
+ await page.goto(`${base}/ai-tool/ai-canvas/${projectId}?creation=unified`);
+ await page.getByText("Saved on this device", { exact: true }).waitFor();
+ await page
+ .getByRole("button", { name: "Add Director Stage", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor();
+ const created = await until(
+ (snapshot) => stageDoc(snapshot)?.kind === "director",
+ "created director document",
+ );
+ itemId = created.canvasItems.find((item) => item.kind === "external").id;
+ // Stages start empty; import the same minimal single-subject stage the
+ // gizmo journey does, so the reopened stage below has a selected subject
+ // whose Position X can be edited. The seed lands before the first apply,
+ // so the subject is part of the persisted document. It keeps the default
+ // duration, which the step below then changes to 1.
+ await page
+ .locator('input[type="file"][accept^="application/json"]')
+ .setInputFiles({
+ name: "seed.stage.json",
+ mimeType: "application/json",
+ buffer: Buffer.from(
+ JSON.stringify({
+ format: "opendirector-local-stage",
+ version: 2,
+ background: "#151923",
+ grid: true,
+ duration: 6,
+ fps: 30,
+ aspectRatio: "16:9",
+ activeCameraId: "camera-1",
+ cameraSource: "camera",
+ shots: [],
+ cameras: [
+ {
+ id: "camera-1",
+ name: "Camera 1",
+ pose: {
+ position: { x: 5, y: 3.5, z: 7 },
+ target: { x: 0, y: 1, z: 0 },
+ fov: 45,
+ },
+ keyframes: [],
+ },
+ ],
+ objects: [
+ {
+ id: "seed-subject",
+ kind: "person",
+ name: "Subject",
+ color: "#a09af9",
+ position: { x: 0, y: 0, z: 0 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ visible: true,
+ locked: false,
+ opacity: 1,
+ keyframes: [],
+ motionClips: [],
+ },
+ ],
+ }),
+ ),
+ });
+ await page.getByLabel("Position X", { exact: true }).waitFor();
+ // The console opens in static mode; the timeline transport with the stage
+ // duration lives in dynamic mode.
+ await page
+ .getByRole("button", { name: "Dynamic", exact: true })
+ .click();
+ await page.getByLabel("Stage duration", { exact: true }).fill("1");
+ await page.getByLabel("Stage duration", { exact: true }).press("Enter");
+ await until((snapshot) => stageDoc(snapshot)?.data.duration === 1, "stage duration saved");
+
+ const capture = page.getByRole("button", {
+ name: "Capture camera still",
+ exact: true,
+ });
+ const readyDeadline = Date.now() + 20000;
+ while (!(await capture.isEnabled())) {
+ if (Date.now() > readyDeadline) throw new Error("stage renderer not ready");
+ await page.waitForTimeout(100);
+ }
+ await apply();
+
+ const captured = await until(
+ (snapshot) => stageDoc(snapshot)?.data.stills?.length === 1,
+ "first apply registers a captured still",
+ );
+ firstStill = stageDoc(captured).data.stills[0];
+ assert.equal(firstStill.kind, "image");
+ const firstImage = captured.assets.find(
+ (asset) => asset.id === firstStill.assetId,
+ );
+ assert.ok(firstImage, "the still is a real project asset");
+ assert.equal(firstImage.metadata.mimeType, "image/png");
+ assert.equal(firstImage.metadata.width, 1280);
+ assert.equal(firstImage.metadata.height, 720);
+
+ // The drawer reopens the collection: preview, selection and the
+ // add-to-canvas channel all act on the pinned still.
+ await openStage(itemId);
+ await page
+ .getByRole("button", { name: /^Shot materials/, exact: false })
+ .click();
+ const drawer = page.getByRole("region", { name: "Shot materials" });
+ await drawer.getByText("Capture_01", { exact: true }).waitFor();
+ await drawer.getByText("16:9", { exact: true }).waitFor();
+ await drawer
+ .getByRole("button", { name: "Preview Capture_01", exact: true })
+ .click();
+ const lightbox = page.getByRole("dialog", { name: "Capture_01" });
+ await lightbox.locator("img").waitFor();
+ await lightbox
+ .getByRole("button", { name: "Close preview", exact: true })
+ .click();
+ await drawer.getByLabel("Capture_01", { exact: true }).check();
+ await drawer.getByText("1 selected", { exact: true }).waitFor();
+ await drawer
+ .getByRole("button", { name: "Add to canvas", exact: true })
+ .click();
+ // Publishing saves the stage first; wait for the completion notice so
+ // the apply below never races the publication.
+ await page
+ .getByText("Added 1 still(s) to canvas.", { exact: true })
+ .waitFor({ timeout: 60000 });
+ const stillPublished = await until(
+ (snapshot) =>
+ snapshot.canvasItems.some(
+ (item) => item.kind === "image" && item.binding.role === "material",
+ ),
+ "the pinned still publishes an image node",
+ );
+ const stillItem = stillPublished.canvasItems.find(
+ (item) => item.kind === "image" && item.binding.role === "material",
+ );
+ // The publication imports the still bytes fresh: a distinct asset with
+ // the pinned still's content fingerprint.
+ assert.equal(
+ stillItem.binding.objectRef.fingerprint,
+ firstStill.fingerprint,
+ );
+ // The publication imported its own copy; applying without a new capture
+ // must not import anything beyond that.
+ const assetsBeforeApply = imageAssets(await state()).length;
+ await apply();
+ const unchanged = await until(
+ (snapshot) => stageDoc(snapshot)?.data.stills?.length === 1,
+ "apply without capture keeps the pinned still",
+ );
+ assert.equal(imageAssets(unchanged).length, assetsBeforeApply);
+ assert.deepEqual(
+ stageDoc(unchanged).data.stills.map((still) => still.assetId),
+ [firstStill.assetId],
+ );
+
+ await openStage(itemId);
+ await page.getByLabel("Position X", { exact: true }).fill("2");
+ await capture.click();
+ await page
+ .getByText(
+ "Still captured. Applying registers it as a project image asset.",
+ { exact: true },
+ )
+ .waitFor();
+ await apply();
+ const recaptured = await until(
+ (snapshot) =>
+ imageAssets(snapshot).length === imageAssets(unchanged).length + 1,
+ "an explicit capture registers a second still",
+ );
+ const stillList = stageDoc(recaptured).data.stills;
+ assert.equal(stillList.length, 2);
+ secondStill = stillList[1];
+ assert.notEqual(secondStill.assetId, firstStill.assetId);
+ assert.ok(
+ recaptured.assets.some((asset) => asset.id === firstStill.assetId),
+ "the earlier still stays registered instead of being overwritten",
+ );
+
+ // Deleting from the drawer drops the pin but keeps the asset registered.
+ await openStage(itemId);
+ await page
+ .getByRole("button", { name: /^Shot materials/, exact: false })
+ .click();
+ const deleteDrawer = page.getByRole("region", { name: "Shot materials" });
+ await deleteDrawer.getByText("Capture_02", { exact: true }).waitFor();
+ await deleteDrawer.getByLabel("Capture_01", { exact: true }).check();
+ await deleteDrawer
+ .getByRole("button", { name: "Delete selected", exact: true })
+ .click();
+ await apply();
+ const deleted = await until(
+ (snapshot) => stageDoc(snapshot)?.data.stills?.length === 1,
+ "a drawer deletion removes only the selected pin",
+ );
+ assert.equal(stageDoc(deleted).data.stills[0].assetId, secondStill.assetId);
+ assert.ok(
+ deleted.assets.some((asset) => asset.id === firstStill.assetId),
+ "the deleted still's asset stays registered",
+ );
+
+ // Export dialog: source, linked duration, quality and frame rate.
+ await openStage(itemId);
+ await page
+ .getByRole("button", { name: "Render preview MP4", exact: true })
+ .click();
+ const exportDialog = page.getByRole("dialog", { name: "Export video" });
+ await exportDialog
+ .getByText("Pick one camera to export the full dynamic preview.", {
+ exact: true,
+ })
+ .waitFor();
+ // No shots yet: per-camera options only, duration follows the document.
+ assert.equal(
+ await exportDialog.getByRole("option", { name: "Storyboard" }).count(),
+ 0,
+ );
+ await exportDialog.getByText("00:01.0").waitFor();
+ await exportDialog.getByLabel("Frame rate").selectOption("25");
+ await exportDialog
+ .getByRole("button", { name: "Export", exact: true })
+ .click();
+ await page
+ .getByText("Preview MP4 complete · 1280×720 · 25 fps", { exact: true })
+ .waitFor({ timeout: 240000 });
+ await page
+ .getByRole("button", { name: "Add preview video to canvas", exact: true })
+ .click();
+ const published = await until(
+ (snapshot) =>
+ snapshot.canvasItems.some(
+ (item) => item.kind === "video" && item.binding.role === "material",
+ ),
+ "the preview MP4 publishes an output node",
+ );
+ const outputItem = published.canvasItems.find(
+ (item) => item.kind === "video" && item.binding.role === "material",
+ );
+ videoRef = outputItem.binding.objectRef;
+ videoAsset = published.assets.find((asset) => asset.id === videoRef.assetId);
+ assert.ok(videoAsset, "the MP4 output pins a real project asset");
+ assert.equal(videoAsset.kind, "video");
+ assert.equal(videoAsset.metadata.mimeType, "video/mp4");
+ assert.ok(videoAsset.metadata.durationSeconds >= 0.9);
+
+ // A second export from the same session must render and publish again:
+ // the drawer keeps preparing fresh documents instead of reusing the
+ // previous render's frozen state. (Storyboard-shot authoring has no UI in
+ // this build, so the source stays per-camera.)
+ await page
+ .getByRole("button", { name: "Render preview MP4", exact: true })
+ .click();
+ const secondDialog = page.getByRole("dialog", { name: "Export video" });
+ await secondDialog.getByText("00:01.0").waitFor();
+ assert.equal(
+ await secondDialog.getByRole("option", { name: "Storyboard" }).count(),
+ 0,
+ );
+ await secondDialog.getByLabel("Frame rate").selectOption("25");
+ await secondDialog
+ .getByRole("button", { name: "Export", exact: true })
+ .click();
+ await page
+ .getByText("Preview MP4 complete · 1280×720 · 25 fps", { exact: true })
+ .waitFor({ timeout: 240000 });
+ await page
+ .getByRole("button", { name: "Add preview video to canvas", exact: true })
+ .click();
+ await until(
+ (snapshot) =>
+ snapshot.canvasItems.filter(
+ (item) => item.kind === "video" && item.binding.role === "material",
+ ).length === 2,
+ "the second export publishes another output node",
+ );
+
+ // Captures made after a render must still publish: the drawer always
+ // prepares fresh instead of reusing the render's frozen document.
+ await capture.click();
+ await page
+ .getByText(
+ "Still captured. Applying registers it as a project image asset.",
+ { exact: true },
+ )
+ .waitFor();
+ await page
+ .getByRole("button", { name: /^Shot materials/, exact: false })
+ .click();
+ // Drawer names are positional: after the deletion the remaining still
+ // renumbers to Capture_01, so the fresh capture lands as Capture_02.
+ const lateDrawer = page.getByRole("region", { name: "Shot materials" });
+ await lateDrawer.getByText("Capture_02", { exact: true }).waitFor();
+ await lateDrawer.getByLabel("Capture_02", { exact: true }).check();
+ await lateDrawer
+ .getByRole("button", { name: "Add to canvas", exact: true })
+ .click();
+ await page
+ .getByText("Added 1 still(s) to canvas.", { exact: true })
+ .waitFor({ timeout: 60000 });
+
+ await page.reload({ waitUntil: "domcontentloaded" });
+ await page.getByText("Saved on this device", { exact: true }).waitFor();
+ const reopened = await state();
+ assert.equal(stageDoc(reopened).data.stills[0].assetId, secondStill.assetId);
+ assert.ok(
+ reopened.canvasItems.some((item) => item.id === outputItem.id),
+ "the published output node survives reload",
+ );
+ await openStage(itemId);
+ await apply();
+ assert.deepEqual(errors, []);
+} catch (error) {
+ console.error((await page.locator("body").innerText()).slice(-2500));
+ throw error;
+} finally {
+ await browser.close();
+}
+
+// The browser lease outlives page close; release it before opening a
+// session of our own to reference the published output from a timeline.
+for (const id of browserSessions) {
+ const response = await fetch(`${api}/api/creation/sessions/${id}`, {
+ method: "DELETE",
+ headers,
+ });
+ assert.ok(
+ response.ok,
+ `release ${id}: ${response.status} ${await response.text()}`,
+ );
+}
+const sessionId = crypto.randomUUID();
+const session = { "X-OpenDirector-Session": sessionId };
+await call(`/api/creation/projects/${projectId}/open`, {}, session);
+const resource = {
+ asset: videoRef,
+ title: "Director shot",
+ durationSeconds: videoAsset.metadata.durationSeconds,
+};
+await call(
+ `/api/creation/projects/${projectId}/commands`,
+ {
+ commandId: crypto.randomUUID(),
+ projectId,
+ type: "creation.batch",
+ payload: {
+ operations: [
+ {
+ type: "editor.create",
+ payload: {
+ document: {
+ id: timelineId,
+ projectId,
+ revision: 1,
+ kind: "timeline",
+ inputConnections: [],
+ data: {
+ fps: 30,
+ width: 1280,
+ height: 720,
+ importedAssets: [resource],
+ tracks: [
+ {
+ id: "visual",
+ kind: "visual",
+ title: "Visual",
+ clips: [
+ {
+ id: clipId,
+ resource,
+ inPoint: 0,
+ outPoint: videoAsset.metadata.durationSeconds,
+ },
+ ],
+ },
+ ],
+ },
+ },
+ },
+ },
+ {
+ type: "canvas.show",
+ payload: {
+ item: {
+ id: crypto.randomUUID(),
+ projectId,
+ kind: "timeline",
+ title: "Director timeline",
+ binding: {
+ role: "editor",
+ objectRef: { id: timelineId, kind: "timeline" },
+ },
+ },
+ },
+ },
+ ],
+ },
+ },
+ session,
+);
+await fetch(`${api}/api/creation/sessions/${sessionId}`, { method: "DELETE" });
+const final = await until(
+ (snapshot) => snapshot.editorDocuments.some((doc) => doc.id === timelineId),
+ "timeline referencing the director output",
+);
+const timeline = final.editorDocuments.find((doc) => doc.id === timelineId);
+assert.equal(
+ timeline.data.tracks[0].clips[0].resource.asset.assetId,
+ videoAsset.id,
+);
+console.log(
+ JSON.stringify({
+ passed: true,
+ projectId,
+ itemId,
+ stillAssetIds: [firstStill.assetId, secondStill.assetId],
+ videoAssetId: videoAsset.id,
+ timelineId,
+ checks: [
+ "first apply auto-captures a 1280x720 still asset",
+ "the drawer previews, selects and publishes the pinned still to the canvas",
+ "an explicit capture appends a second still and keeps the old one registered",
+ "a drawer deletion removes only the selected pin",
+ "the export dialog offers per-camera sources and a linked duration",
+ "the export dialog renders at the chosen frame rate",
+ "a second export from the same session renders and publishes again",
+ "captures made after a render still publish through a fresh prepare",
+ "preview MP4 publishes an output node with a real video asset",
+ "timeline clip references the published assetId",
+ "stage, stills, output and timeline survive reload",
+ "no page errors",
+ ],
+ }),
+);
diff --git a/tests/browser/director_stage_pointer_alignment.mjs b/tests/browser/director_stage_pointer_alignment.mjs
new file mode 100644
index 000000000..11be64631
--- /dev/null
+++ b/tests/browser/director_stage_pointer_alignment.mjs
@@ -0,0 +1,518 @@
+import assert from "node:assert/strict";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE ?? "playwright-core"
+);
+
+const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5179";
+const api = process.env.CREATION_API_URL ?? "http://127.0.0.1:8019";
+const headers = {
+ "X-OpenDirector-Request": "1",
+ "Content-Type": "application/json",
+};
+async function call(path, body) {
+ const response = await fetch(api + path, {
+ headers,
+ ...(body ? { method: "POST", body: JSON.stringify(body) } : {}),
+ });
+ assert.ok(
+ response.ok,
+ `${response.status}: ${await response.clone().text()}`,
+ );
+ return response.json();
+}
+
+assert.equal((await call("/api/creation-test-health")).isolated, true);
+const projectId = crypto.randomUUID();
+await call(`/api/creation/projects/${projectId}/commands`, {
+ commandId: crypto.randomUUID(),
+ projectId,
+ type: "project.create",
+ payload: { name: `Pointer alignment ${projectId.slice(0, 8)}` },
+});
+const state = () => call(`/api/creation/projects/${projectId}`);
+const stageDoc = (snapshot) =>
+ snapshot.editorDocuments.find((candidate) => candidate.kind === "director");
+const browser = await chromium.launch({
+ headless: true,
+ ...(process.env.CHROMIUM_PATH
+ ? { executablePath: process.env.CHROMIUM_PATH }
+ : {}),
+ args: ["--no-sandbox", "--enable-unsafe-swiftshader"],
+});
+const page = await browser.newPage({
+ locale: "en-US",
+ viewport: { width: 1700, height: 1100 },
+ deviceScaleFactor: 2,
+});
+page.setDefaultTimeout(20000);
+await page.addInitScript(() =>
+ localStorage.setItem("opendirector.modelSetup.v1", "dismissed"),
+);
+const until = async (predicate, label) => {
+ const deadline = Date.now() + 20000;
+ let snapshot;
+ while (Date.now() < deadline) {
+ snapshot = await state();
+ if (predicate(snapshot)) return snapshot;
+ await page.waitForTimeout(100);
+ }
+ throw new Error(`Timeout: ${label}; snapshot: ${JSON.stringify(snapshot)}`);
+};
+const sub3 = (a, b) => ({ x: a.x - b.x, y: a.y - b.y, z: a.z - b.z });
+const cross3 = (a, b) => ({
+ x: a.y * b.z - a.z * b.y,
+ y: a.z * b.x - a.x * b.z,
+ z: a.x * b.y - a.y * b.x,
+});
+const normalize3 = (a) => {
+ const length = Math.hypot(a.x, a.y, a.z);
+ return { x: a.x / length, y: a.y / length, z: a.z / length };
+};
+const camera = {
+ eye: { x: 5, y: 3.5, z: 7 },
+ target: { x: 0, y: 1, z: 0 },
+ fov: 45,
+};
+const groundPointAt = (box, xFraction, yFraction) => {
+ const forward = normalize3(sub3(camera.target, camera.eye));
+ const right = normalize3(cross3(forward, { x: 0, y: 1, z: 0 }));
+ const up = normalize3(cross3(right, forward));
+ const nx = xFraction * 2 - 1;
+ const ny = 1 - yFraction * 2;
+ const halfHeight = Math.tan((camera.fov * Math.PI) / 360);
+ const halfWidth = halfHeight * (box.width / box.height);
+ const direction = normalize3({
+ x: forward.x + right.x * halfWidth * nx + up.x * halfHeight * ny,
+ y: forward.y + right.y * halfWidth * nx + up.y * halfHeight * ny,
+ z: forward.z + right.z * halfWidth * nx + up.z * halfHeight * ny,
+ });
+ const distance = -camera.eye.y / direction.y;
+ return {
+ x: camera.eye.x + direction.x * distance,
+ z: camera.eye.z + direction.z * distance,
+ };
+};
+const projectPointAt = (box, point) => {
+ const forward = normalize3(sub3(camera.target, camera.eye));
+ const right = normalize3(cross3(forward, { x: 0, y: 1, z: 0 }));
+ const up = normalize3(cross3(right, forward));
+ const view = sub3(point, camera.eye);
+ const depth = view.x * forward.x + view.y * forward.y + view.z * forward.z;
+ const halfHeight = depth * Math.tan((camera.fov * Math.PI) / 360);
+ const halfWidth = halfHeight * (box.width / box.height);
+ return {
+ x:
+ box.x +
+ (((view.x * right.x + view.y * right.y + view.z * right.z) / halfWidth +
+ 1) *
+ box.width) /
+ 2,
+ y:
+ box.y +
+ ((1 - (view.x * up.x + view.y * up.y + view.z * up.z) / halfHeight) *
+ box.height) /
+ 2,
+ };
+};
+const coloredPixelsNear = async (screenshot, center, radius) =>
+ page.evaluate(
+ ({ dataUrl, center, radius }) =>
+ new Promise((resolve, reject) => {
+ const image = new Image();
+ image.onload = () => {
+ const canvas = document.createElement("canvas");
+ canvas.width = image.naturalWidth;
+ canvas.height = image.naturalHeight;
+ const context = canvas.getContext("2d");
+ if (!context) return reject(new Error("2D canvas is unavailable"));
+ context.drawImage(image, 0, 0);
+ const pixels = context.getImageData(
+ 0,
+ 0,
+ canvas.width,
+ canvas.height,
+ ).data;
+ const scale = canvas.width / window.innerWidth;
+ const x = center.x * scale;
+ const y = center.y * scale;
+ const r = radius * scale;
+ let count = 0;
+ for (
+ let py = Math.max(0, Math.floor(y - r));
+ py < Math.min(canvas.height, Math.ceil(y + r));
+ py += 2
+ ) {
+ for (
+ let px = Math.max(0, Math.floor(x - r));
+ px < Math.min(canvas.width, Math.ceil(x + r));
+ px += 2
+ ) {
+ const offset = (py * canvas.width + px) * 4;
+ const red = pixels[offset];
+ const green = pixels[offset + 1];
+ const blue = pixels[offset + 2];
+ if (
+ (red > 180 && green < 80 && blue < 80) ||
+ (green > 180 && red < 80 && blue < 80) ||
+ (blue > 180 && red < 80 && green < 100)
+ )
+ count++;
+ }
+ }
+ resolve(count);
+ };
+ image.onerror = () => reject(new Error("screenshot decode failed"));
+ image.src = dataUrl;
+ }),
+ {
+ dataUrl: `data:image/png;base64,${screenshot.toString("base64")}`,
+ center,
+ radius,
+ },
+ );
+
+try {
+ await page.goto(`${base}/ai-tool/ai-canvas/${projectId}?creation=unified`);
+ await page.getByText("Saved on this device", { exact: true }).waitFor();
+ await page
+ .getByRole("button", { name: "Add Director Stage", exact: true })
+ .click();
+ await page.getByRole("button", { name: "Apply edits", exact: true }).waitFor();
+ const box = await page.locator(".cw-stage-scene").boundingBox();
+ assert.ok(box);
+ const clicks = [
+ [0.37, 0.53],
+ [0.58, 0.59],
+ [0.69, 0.66],
+ ];
+ for (const [x, y] of clicks) {
+ await page
+ .locator('.cw-stage-object-grid button[data-stage-placement-kind="person"]')
+ .first()
+ .click();
+ await page.mouse.click(box.x + box.width * x, box.y + box.height * y);
+ if (
+ await page
+ .getByRole("dialog", { name: "Director console controls" })
+ .count()
+ )
+ await page
+ .getByRole("dialog", { name: "Director console controls" })
+ .getByRole("button", { name: "Close help", exact: true })
+ .click();
+ }
+ const first = groundPointAt(box, ...clicks[0]);
+ const firstCenter = projectPointAt(box, { x: first.x, y: 0.9, z: first.z });
+ await page.mouse.click(firstCenter.x, firstCenter.y);
+ assert.equal(
+ await page
+ .locator(".cw-stage-right-tree .cw-stage-tree-row")
+ .filter({ hasText: "Person 1" })
+ .locator("button")
+ .first()
+ .getAttribute("aria-selected"),
+ "true",
+ "clicking the visible object center selects the object under the cursor",
+ );
+ await page.waitForTimeout(500);
+ const handleCenter = projectPointAt(box, { x: first.x, y: 0, z: first.z });
+ const handleAhead = projectPointAt(box, { x: first.x + 1, y: 0, z: first.z });
+ const handleDirection = {
+ x: handleAhead.x - handleCenter.x,
+ y: handleAhead.y - handleCenter.y,
+ };
+ const handleLength = Math.hypot(handleDirection.x, handleDirection.y);
+ const handleStart = {
+ x: handleCenter.x + (handleDirection.x / handleLength) * box.width * 0.03,
+ y: handleCenter.y + (handleDirection.y / handleLength) * box.width * 0.03,
+ };
+ const beforeDrag = Number(
+ await page.getByLabel("Position X", { exact: true }).inputValue(),
+ );
+ await page.mouse.move(handleStart.x, handleStart.y);
+ await page.mouse.down();
+ await page.mouse.move(
+ handleStart.x + (handleDirection.x / handleLength) * box.width * 0.08,
+ handleStart.y + (handleDirection.y / handleLength) * box.width * 0.08,
+ { steps: 12 },
+ );
+ await page.mouse.up();
+ const afterDrag = Number(
+ await page.getByLabel("Position X", { exact: true }).inputValue(),
+ );
+ assert.ok(
+ afterDrag > beforeDrag + 0.1,
+ `the visible X gizmo follows Person 1 after selection (before ${beforeDrag}, after ${afterDrag})`,
+ );
+ await page
+ .locator(".cw-stage-console")
+ .getByRole("button", { name: "Undo", exact: true })
+ .click();
+ await page.waitForFunction(
+ ({ label, value }) => {
+ const field = document.querySelector(`[aria-label="${label}"]`);
+ return (
+ field instanceof HTMLInputElement &&
+ Math.abs(Number(field.value) - value) < 0.01
+ );
+ },
+ { label: "Position X", value: beforeDrag },
+ );
+ // How far the selected subject stands above the ground is drawn in DOM over
+ // the WebGL frame. At 2x it has to land where the frame lands, follow the
+ // drag while the pointer is still down, and take no pointer itself.
+ const positionY = page.getByLabel("Position Y", { exact: true });
+ const readElevation = () =>
+ page.evaluate(() => {
+ const layer = document.querySelector(".cw-stage-elevation");
+ const label = document.querySelector(".cw-stage-elevation-value");
+ const ring = document.querySelector(".cw-stage-elevation-ring");
+ const rect = (element) => {
+ if (!element) return null;
+ const bounds = element.getBoundingClientRect();
+ return { x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height };
+ };
+ return {
+ shown:
+ layer instanceof HTMLElement &&
+ getComputedStyle(layer).display !== "none",
+ text: (label?.textContent ?? "").trim(),
+ aria: label?.getAttribute("aria-label") ?? null,
+ layer: rect(layer),
+ label: rect(label),
+ ring: rect(ring),
+ lines: [...document.querySelectorAll(".cw-stage-elevation-line")].map(
+ (line) => ({
+ shown: getComputedStyle(line).display !== "none",
+ from: {
+ x: Number(line.getAttribute("x1")),
+ y: Number(line.getAttribute("y1")),
+ },
+ to: {
+ x: Number(line.getAttribute("x2")),
+ y: Number(line.getAttribute("y2")),
+ },
+ }),
+ ),
+ };
+ });
+ const waitForElevation = (shown) =>
+ page.waitForFunction(
+ (shown) => {
+ const layer = document.querySelector(".cw-stage-elevation");
+ return (
+ layer instanceof HTMLElement &&
+ (getComputedStyle(layer).display !== "none") === shown
+ );
+ },
+ shown,
+ );
+ const metres = (text) => Number(text.replace(/[^\d.]/g, ""));
+ const near = (actual, expected, tolerance, what) =>
+ assert.ok(
+ Math.hypot(actual.x - expected.x, actual.y - expected.y) <= tolerance,
+ `${what}: (${actual.x.toFixed(1)}, ${actual.y.toFixed(1)}) against (${expected.x.toFixed(1)}, ${expected.y.toFixed(1)})`,
+ );
+ await waitForElevation(false);
+
+ // The Y arrow runs up from where the X arrow starts.
+ const liftAhead = projectPointAt(box, { x: first.x, y: 1, z: first.z });
+ const liftDirection = { x: liftAhead.x - handleCenter.x, y: liftAhead.y - handleCenter.y };
+ const liftLength = Math.hypot(liftDirection.x, liftDirection.y);
+ const liftStart = {
+ x: handleCenter.x + (liftDirection.x / liftLength) * box.width * 0.03,
+ y: handleCenter.y + (liftDirection.y / liftLength) * box.width * 0.03,
+ };
+ const liftBy = {
+ x: (liftDirection.x / liftLength) * box.width * 0.08,
+ y: (liftDirection.y / liftLength) * box.width * 0.08,
+ };
+ const beforeLift = Number(await positionY.inputValue());
+ await page.mouse.move(liftStart.x, liftStart.y);
+ await page.mouse.down();
+ await page.mouse.move(liftStart.x + liftBy.x, liftStart.y + liftBy.y, {
+ steps: 12,
+ });
+ // Read before the pointer is let go: nothing is saved yet, and the readout
+ // has to be on the drag's live transform all the same.
+ const during = await readElevation();
+ await page.mouse.up();
+ const afterLift = Number(await positionY.inputValue());
+ assert.ok(afterLift > beforeLift + 0.1, `the visible Y gizmo lifts Person 1 (before ${beforeLift}, after ${afterLift})`);
+ assert.ok(during.shown && metres(during.text) > 0.1, `the readout follows the lift while the pointer is down (${JSON.stringify(during.text)})`);
+
+ await page.waitForFunction(
+ ({ height }) =>
+ document.querySelector(".cw-stage-elevation-value")?.textContent?.trim() ===
+ `${height} m`,
+ { height: metres(during.text).toFixed(2) },
+ );
+ const lifted = await readElevation();
+ // The feet of a person placed on the ground sit a few centimetres above its
+ // origin, which is what the position field shows.
+ assert.ok(
+ Math.abs(metres(lifted.text) - (afterLift - beforeLift)) < 0.02,
+ `the readout is the height above the ground (${lifted.text}; the field moved from ${beforeLift} to ${afterLift})`,
+ );
+ assert.equal(lifted.aria, `Height above ground ${metres(lifted.text).toFixed(2)} m`);
+
+ // Geometry in CSS pixels, where the frame's own projection puts the ground
+ // point and the subject's lowest point.
+ const height = metres(lifted.text);
+ const ground = projectPointAt(box, { x: first.x, y: 0, z: first.z });
+ const feet = projectPointAt(box, { x: first.x, y: height, z: first.z });
+ const origin = { x: lifted.layer.x, y: lifted.layer.y };
+ const at = (point) => ({ x: point.x + origin.x, y: point.y + origin.y });
+ assert.equal(lifted.lines.length, 2);
+ assert.ok(lifted.lines[0].shown && lifted.lines[1].shown, "a long line frames its value");
+ near(at(lifted.lines[0].from), ground, 5, "the line starts on the ground under the subject");
+ near(at(lifted.lines[1].to), feet, 5, "the line ends at the subject's lowest point");
+ const gapMiddle = at({
+ x: (lifted.lines[0].to.x + lifted.lines[1].from.x) / 2,
+ y: (lifted.lines[0].to.y + lifted.lines[1].from.y) / 2,
+ });
+ const labelMiddle = {
+ x: lifted.label.x + lifted.label.width / 2,
+ y: lifted.label.y + lifted.label.height / 2,
+ };
+ const lineMiddle = {
+ x: (at(lifted.lines[0].from).x + at(lifted.lines[1].to).x) / 2,
+ y: (at(lifted.lines[0].from).y + at(lifted.lines[1].to).y) / 2,
+ };
+ near(gapMiddle, labelMiddle, 1.5, "the value sits in the line's gap");
+ near(labelMiddle, lineMiddle, 5.5, "the value sits halfway along the line");
+ const gap = Math.hypot(
+ lifted.lines[1].from.x - lifted.lines[0].to.x,
+ lifted.lines[1].from.y - lifted.lines[0].to.y,
+ );
+ assert.ok(
+ Math.abs(gap - (lifted.label.height + 6)) < 1.5,
+ `the gap is the value's height and a little air (${gap} for a value ${lifted.label.height} high)`,
+ );
+ near(
+ { x: lifted.ring.x + lifted.ring.width / 2, y: lifted.ring.y + lifted.ring.height / 2 },
+ ground,
+ 5,
+ "the ring marks where the subject would land",
+ );
+ assert.ok(
+ Math.abs(lifted.ring.width - 12) < 1,
+ `the ring keeps a twelve-pixel diameter (${lifted.ring.width})`,
+ );
+ const under = await page.evaluate(
+ ({ x, y }) => {
+ const hit = document.elementFromPoint(x, y);
+ return { tag: hit?.tagName ?? null, over: Boolean(hit?.closest(".cw-stage-scene")) };
+ },
+ labelMiddle,
+ );
+ assert.deepEqual(
+ under,
+ { tag: "CANVAS", over: true },
+ "the readout takes no pointer: the frame is what lies under the value",
+ );
+ // ELEVATION_SHOT names a file for a picture of the readout at 2x.
+ if (process.env.ELEVATION_SHOT)
+ await page.screenshot({
+ path: process.env.ELEVATION_SHOT,
+ clip: {
+ x: ground.x - box.width * 0.12,
+ y: feet.y - box.height * 0.12,
+ width: box.width * 0.24,
+ height: box.height * 0.36,
+ },
+ });
+
+ // The viewfinder shows a camera's picture; the readout belongs to the
+ // orbit view and comes back with it.
+ const viewfinderButton = page.getByRole("button", {
+ name: "Viewfinder",
+ exact: true,
+ });
+ await viewfinderButton.click();
+ await page.locator(".cw-stage-fovbar").waitFor();
+ await waitForElevation(false);
+ await viewfinderButton.click();
+ await page.locator(".cw-stage-fovbar").waitFor({ state: "detached" });
+ await waitForElevation(true);
+
+ // An export shows its progress in place of the gizmo and the readout, and
+ // gives the readout back when it ends, here by being cancelled. Sixty frames
+ // a second keep it running long enough to be seen and cancelled.
+ await page
+ .getByRole("button", { name: "Render preview MP4", exact: true })
+ .click();
+ const exportDialog = page.getByRole("dialog", { name: "Export video" });
+ await exportDialog.waitFor();
+ await exportDialog.getByLabel("Frame rate").selectOption("60");
+ await exportDialog
+ .getByRole("button", { name: "Export", exact: true })
+ .click();
+ const rendering = page.locator(".cw-render-status");
+ await rendering.waitFor();
+ await waitForElevation(false);
+ await rendering
+ .getByRole("button", { name: "Cancel rendering", exact: true })
+ .click();
+ await rendering.waitFor({ state: "detached" });
+ await waitForElevation(true);
+
+ await page
+ .locator(".cw-stage-console")
+ .getByRole("button", { name: "Undo", exact: true })
+ .click();
+ await page.waitForFunction(
+ ({ label, value }) => {
+ const field = document.querySelector(`[aria-label="${label}"]`);
+ return (
+ field instanceof HTMLInputElement &&
+ Math.abs(Number(field.value) - value) < 0.01
+ );
+ },
+ { label: "Position Y", value: beforeLift },
+ );
+ await waitForElevation(false);
+
+ const screenshot = await page.screenshot();
+ const gizmoPixels = await coloredPixelsNear(
+ screenshot,
+ projectPointAt(box, { x: first.x, y: 0, z: first.z }),
+ box.width * 0.24,
+ );
+ assert.ok(
+ gizmoPixels > 100,
+ `the rendered gizmo is in the selected object's viewport region (colored pixels ${gizmoPixels})`,
+ );
+ await page.getByRole("button", { name: "Apply edits", exact: true }).click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor({ state: "detached" });
+ const snapshot = await until(
+ (candidate) => (stageDoc(candidate)?.data.objects ?? []).length === 3,
+ "three placed people",
+ );
+ const objects = stageDoc(snapshot).data.objects;
+ for (const [index, [x, y]] of clicks.entries()) {
+ const expected = groundPointAt(box, x, y);
+ const actual = objects[index].position;
+ const distance = Math.hypot(actual.x - expected.x, actual.z - expected.z);
+ assert.ok(
+ distance < 0.05,
+ `click ${index} landed at (${actual.x}, ${actual.z}), expected (${expected.x}, ${expected.z}), error ${distance}`,
+ );
+ }
+ console.log(
+ JSON.stringify({
+ passed: true,
+ projectId,
+ objects,
+ checks: [
+ "the readout follows a Y drag while the pointer is down and reads the height above the ground after it",
+ "at 2x the line, its value and the ring land where the frame's projection puts them",
+ "the readout takes no pointer, leaves with the viewfinder, and comes back after an export",
+ ],
+ }),
+ );
+} finally {
+ await browser.close();
+}
diff --git a/tests/browser/director_stage_storyboard.mjs b/tests/browser/director_stage_storyboard.mjs
new file mode 100644
index 000000000..e2683a7f8
--- /dev/null
+++ b/tests/browser/director_stage_storyboard.mjs
@@ -0,0 +1,5359 @@
+/** Director Stage acceptance for Storyboard creation, presentation and preview.
+ *
+ * Runs only against an isolated creation server with real project storage and model
+ * stubs (no real model is called). One project is created through the isolated API.
+ * It covers the camera chooser above `+`, the add through the shared
+ * `director.storyboard.append` command, block selection, the playhead, undo and redo,
+ * save and reopen, and the same inputs through the HTTP command endpoint. Preview
+ * checks compare rendered frames and exercise thumbnail refresh and narrow blocks.
+ * A drag to another place is followed with real pointer gestures: the cursors, the one
+ * block that is carried, everything that stays still meanwhile, the line that says where
+ * the block would be let in, at the end of the Storyboard when it would be last, what
+ * each way of ending the drag leaves, where the playhead goes once the block is let go,
+ * and what a save the server refuses puts back.
+ * DIRECTOR_STAGE_LOCALE reruns the flow in another UI language (default en-US). */
+import assert from "node:assert/strict";
+import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { makePanelGlb, makePng, probeMp4 } from "./director_stage_fixture.mjs";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE ?? "playwright-core"
+);
+
+const verifyMp4 = process.argv.includes("--verify-mp4");
+const locale = process.env.DIRECTOR_STAGE_LOCALE ?? "en-US";
+/** Where the Director Stage window is written as PNGs for a visual check, when a
+ * directory is named for it. Nothing is written without it. */
+const screenshotDir = process.env.DIRECTOR_STAGE_STORYBOARD_SCREENSHOT_DIR;
+const L = {
+ "en-US": {
+ saved: "Saved on this device",
+ addStage: "Add Director Stage",
+ apply: "Apply edits",
+ closeEditor: "Close editor",
+ discardClose: "Discard and close",
+ timeline: "Director Stage timeline tracks",
+ previewMode: "Preview mode",
+ dynamicPreview: "Dynamic",
+ playhead: "Stage playhead",
+ stageDuration: "Stage duration",
+ durationClamped: "Requested 3 s. Applied 5 s to keep all Storyboard blocks.",
+ cameraName: "Camera name",
+ defaultCamera: "Camera 1",
+ secondCamera: "Camera 2",
+ renamedCamera: "Wide",
+ camerasTab: "Cameras",
+ addCamera: "Add camera",
+ openStage: "Open Director Stage",
+ undo: "Undo",
+ redo: "Redo",
+ storyboardAdd: "Add camera to Storyboard",
+ storyboardChooser: "Choose a camera for the Storyboard",
+ storyboardSearch: "Search cameras",
+ storyboardSearchEmpty: "No camera matches this search.",
+ storyboardAdding: "Adding a Storyboard block…",
+ storyboardEditing: "Editing the Storyboard…",
+ storyboardBlock: "Storyboard block {name} from {start} to {end} seconds",
+ reasonExhausted:
+ "No main-timeline time remains for another Storyboard block.",
+ reasonLeadingGap:
+ "The Storyboard must start at 0; the first block cannot begin later.",
+ reasonInternalGap:
+ "Storyboard blocks cannot leave gaps; start each block where the previous one ends.",
+ revisionConflict:
+ "This item changed since it was loaded. Reload it and try again.",
+ // The preview source.
+ previewSource: "Director preview source",
+ previewStoryboard: "Storyboard",
+ storyboardEmpty: "Add a Storyboard block first.",
+ editCamera: "Edit camera",
+ renamedAway: "Reverse",
+ onMarker: "On marker",
+ away: "Away",
+ position: "Position",
+ recordKeyframe: "Record a keyframe here",
+ pause: "Pause",
+ renderMp4: "Render preview MP4",
+ exportSourceLabel: "Camera source",
+ exportSourceStoryboard: "Storyboard",
+ exportVideo: "Export video",
+ exportFps: "Frame rate",
+ exportConfirm: "Export",
+ exportNote: "Uses hard cuts and ends at the last Storyboard block.",
+ downloadMp4: "Download preview MP4",
+ publishMp4: "Add preview video to canvas",
+ exportCancel: "Cancel",
+ splitPreview: "Live preview {name}",
+ splitExit: "Exit split view",
+ viewfinder: "Viewfinder",
+ viewfinderFov: "Viewfinder FOV",
+ cameraPreview: "Camera preview",
+ presetOverhead: "Overhead wide",
+ deleteCamera: "Delete current camera",
+ deleteBlock: "Delete Storyboard block",
+ playAction: "Play motion and keyframes",
+ shotMaterials: "Shot materials",
+ closeDrawer: "Collapse shot materials",
+ cameraShort: "Camera",
+ target: "Target",
+ focal: "Focal length (35mm film, 16:9 equivalent)",
+ screenshot: "Capture camera still",
+ deleteSelectedStills: "Delete selected",
+ stillEmpty: "No shot materials yet; captures land here automatically.",
+ // What a load puts into the scene.
+ objectsTab: "Objects",
+ backgroundTab: "Background",
+ onModel: "On the model",
+ backgroundAdd: "Add background",
+ backgroundAsset: "Background image",
+ backgroundImported: "Added background “{name}”",
+ backgroundUnavailable:
+ "Background image unavailable; using the background color fallback.",
+ modelLoadFailed:
+ "Could not load “{name}”. The file may be corrupt or reference external resources.",
+ },
+ "zh-CN": {
+ saved: "已保存到本机",
+ addStage: "添加导演台",
+ apply: "应用编辑",
+ closeEditor: "关闭编辑器",
+ discardClose: "直接关闭",
+ timeline: "导演舞台时间线轨道",
+ previewMode: "预演模式",
+ dynamicPreview: "动态",
+ playhead: "舞台播放位置",
+ stageDuration: "舞台总时长",
+ durationClamped: "请求时长 3 秒。为保留全部分镜块,实际应用 5 秒。",
+ cameraName: "机位名称",
+ defaultCamera: "摄像机 1",
+ secondCamera: "摄像机 2",
+ renamedCamera: "广角",
+ camerasTab: "机位",
+ addCamera: "添加机位",
+ openStage: "打开导演台",
+ undo: "撤销",
+ redo: "重做",
+ storyboardAdd: "向分镜添加机位",
+ storyboardChooser: "选择要添加到分镜的机位",
+ storyboardSearch: "搜索机位",
+ storyboardSearchEmpty: "没有匹配的机位。",
+ storyboardAdding: "正在添加分镜块…",
+ storyboardEditing: "正在编辑分镜…",
+ storyboardBlock: "分镜块 {name},{start} 秒到 {end} 秒",
+ reasonExhausted: "主时间轴已没有可用时长,无法再添加分镜块。",
+ reasonLeadingGap: "分镜必须从 0 秒开始,第一个分镜块之前不能留空。",
+ reasonInternalGap: "分镜块之间不能留有空隙,请让每个分镜块从前一个分镜块结束的位置开始。",
+ // The backend raises this conflict with an English sentence as its Chinese copy
+ // (validate_command); the journey asserts what the page shows today.
+ revisionConflict: "Object changed; reread before modifying",
+ // The preview source.
+ previewSource: "导演预览来源",
+ previewStoryboard: "分镜",
+ storyboardEmpty: "请先添加分镜块。",
+ editCamera: "编辑机位",
+ renamedAway: "反打",
+ onMarker: "看向标记",
+ away: "看向别处",
+ position: "位置",
+ recordKeyframe: "在此记录关键帧",
+ pause: "暂停",
+ renderMp4: "合成预演 MP4",
+ exportSourceLabel: "机位来源",
+ exportSourceStoryboard: "分镜编排",
+ exportVideo: "导出视频",
+ exportFps: "帧率",
+ exportConfirm: "导出",
+ exportNote: "按分镜块硬切,导出到最后一个分镜块结束。",
+ downloadMp4: "下载预演 MP4",
+ publishMp4: "将预演视频加入画布",
+ exportCancel: "取消",
+ splitPreview: "实时预览 {name}",
+ splitExit: "退出分屏",
+ viewfinder: "取景器",
+ viewfinderFov: "取景器 FOV",
+ cameraPreview: "机位预览",
+ presetOverhead: "俯拍全景",
+ deleteCamera: "删除当前机位",
+ deleteBlock: "删除分镜块",
+ playAction: "播放动作与关键帧",
+ shotMaterials: "镜头素材",
+ closeDrawer: "收起镜头素材",
+ cameraShort: "机位",
+ target: "目标",
+ focal: "焦距(35mm 胶片,16:9 等效)",
+ screenshot: "捕获镜头定格",
+ deleteSelectedStills: "删除选中照片",
+ stillEmpty: "暂无镜头素材,拍摄后自动入库。",
+ // 加载给场景带来的内容。
+ objectsTab: "物体",
+ backgroundTab: "背景",
+ onModel: "看向模型",
+ backgroundAdd: "添加背景",
+ backgroundAsset: "背景图片",
+ backgroundImported: "已添加背景「{name}」",
+ backgroundUnavailable: "背景图片不可用,已回退到背景颜色。",
+ modelLoadFailed: "无法加载「{name}」。文件可能损坏,或引用了外部资源。",
+ },
+}[locale];
+assert.ok(L, `Unsupported DIRECTOR_STAGE_LOCALE: ${locale}`);
+
+const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5179";
+const api = process.env.CREATION_API_URL ?? "http://127.0.0.1:8019";
+const headers = {
+ "X-OpenDirector-Request": "1",
+ "Content-Type": "application/json",
+};
+
+/** Fill a catalog sentence's `{name}` placeholders. */
+const text = (template, values) =>
+ template.replace(/\{(\w+)\}/g, (_, key) => values[key]);
+
+async function call(path, body, extraHeaders) {
+ const response = await fetch(api + path, {
+ headers: { ...headers, ...extraHeaders },
+ ...(body ? { method: "POST", body: JSON.stringify(body) } : {}),
+ });
+ assert.ok(
+ response.ok,
+ `${path}: ${response.status}: ${await response.clone().text()}`,
+ );
+ return response.json();
+}
+
+assert.equal((await call("/api/creation-test-health")).isolated, true);
+
+const projectId = crypto.randomUUID();
+await call(`/api/creation/projects/${projectId}/commands`, {
+ commandId: crypto.randomUUID(),
+ projectId,
+ type: "project.create",
+ payload: { name: `Director Stage storyboard ${projectId.slice(0, 8)}` },
+});
+
+const state = () => call(`/api/creation/projects/${projectId}`);
+
+/** Send one command the way an external caller does; a rejection is a result, not a failure. */
+async function send(type, payload, expectedVersions) {
+ const response = await fetch(
+ `${api}/api/creation/projects/${projectId}/commands`,
+ {
+ method: "POST",
+ headers: {
+ ...headers,
+ ...(browserSession ? { "X-OpenDirector-Session": browserSession } : {}),
+ },
+ body: JSON.stringify({
+ commandId: crypto.randomUUID(),
+ projectId,
+ type,
+ payload,
+ ...(expectedVersions ? { expectedVersions } : {}),
+ }),
+ },
+ );
+ assert.ok(
+ response.ok,
+ `${type}: ${response.status}: ${await response.clone().text()}`,
+ );
+ return response.json();
+}
+
+const agentTool = (tool, input) =>
+ call(
+ "/api/creation-test-agent-storyboard",
+ { projectId, tool, input },
+ { "X-OpenDirector-Session": browserSession },
+ );
+const agentCommand = (type, payload, expectedVersions) =>
+ agentTool("execute_command", { type, payload, expectedVersions });
+
+const browser = await chromium.launch({
+ headless: true,
+ ...(process.env.CHROMIUM_PATH
+ ? { executablePath: process.env.CHROMIUM_PATH }
+ : {}),
+ args: ["--no-sandbox", "--enable-unsafe-swiftshader"],
+});
+const page = await browser.newPage({
+ locale,
+ viewport: { width: 1700, height: 1100 },
+});
+await page.addInitScript((value) => {
+ localStorage.setItem("opendirector.modelSetup.v1", "dismissed");
+ localStorage.setItem("opendirector.locale.v1", value);
+}, locale);
+/** Work that asks for idle time can be held back, so a step can see a block wait for
+ * its thumbnail before the picture is made. A held callback runs when it is let in.
+ * With nothing held, every call reaches the browser as it was. */
+await page.addInitScript(() => {
+ const request = window.requestIdleCallback?.bind(window);
+ const cancel = window.cancelIdleCallback?.bind(window);
+ const held = [];
+ window.__storyboardHoldIdle = false;
+ window.requestIdleCallback = (callback, options) => {
+ if (!window.__storyboardHoldIdle)
+ return request
+ ? request(callback, options)
+ : window.setTimeout(callback, 0);
+ const at = held.length;
+ held.push(() =>
+ (request ?? ((task) => window.setTimeout(task, 0)))(callback, options),
+ );
+ // Negative, so a held callback is never mistaken for the browser's own.
+ return -at - 1;
+ };
+ window.cancelIdleCallback = (id) => {
+ if (id >= 0) cancel?.(id);
+ else held[-id - 1] = null;
+ };
+ window.__storyboardReleaseIdle = () => {
+ // Let in what was held, and hold nothing more: work that follows asks on its own.
+ window.__storyboardHoldIdle = false;
+ for (const run of held.splice(0)) run?.();
+ };
+});
+/** An imported model's bytes reach the open editor as a `blob:` URL, which no network
+ * hold can reach: the document's projection has already fetched them. While
+ * `__storyboardHoldModel` is set, a read of a `blob:` URL waits until
+ * `__storyboardReleaseModel()` is called; with `__storyboardFailModel` set first, the
+ * read fails instead. With nothing held, every call reaches the browser as it was. */
+await page.addInitScript(() => {
+ const read = window.fetch;
+ const held = [];
+ window.__storyboardHoldModel = false;
+ window.__storyboardFailModel = false;
+ window.__storyboardModelReads = 0;
+ window.fetch = (input, init) => {
+ const url = typeof input === "string" ? input : input.url;
+ if (!window.__storyboardHoldModel || !url.startsWith("blob:"))
+ return read(input, init);
+ window.__storyboardModelReads += 1;
+ return new Promise((resolve, reject) => {
+ held.push(() =>
+ window.__storyboardFailModel
+ ? reject(new TypeError("Failed to fetch"))
+ : resolve(read(input, init)),
+ );
+ });
+ };
+ window.__storyboardReleaseModel = () => {
+ window.__storyboardHoldModel = false;
+ for (const go of held.splice(0)) go();
+ };
+});
+page.setDefaultTimeout(20000);
+const errors = [];
+page.on("pageerror", (error) => errors.push(error.message));
+/** The session the page holds the project with. A command sent while the page is
+ * open must name that same session: a project is open in one session at a time. */
+let browserSession;
+page.on("request", (request) => {
+ browserSession = request.headers()["x-opendirector-session"] ?? browserSession;
+});
+
+const until = async (predicate, label) => {
+ const deadline = Date.now() + 20000;
+ let snapshot;
+ while (Date.now() < deadline) {
+ snapshot = await state();
+ if (predicate(snapshot)) return snapshot;
+ await page.waitForTimeout(100);
+ }
+ const stored = snapshot.editorDocuments
+ .filter((document) => document.kind === "director")
+ .map((document) => storedBlocks(document));
+ throw new Error(`Timeout: ${label}; stored Storyboards: ${JSON.stringify(stored)}`);
+};
+
+/** The Director Stage bound to one canvas item: the item and its stored document. */
+const director = (snapshot, itemId) => {
+ const item = snapshot.canvasItems.find(
+ (candidate) =>
+ candidate.id === itemId ||
+ (itemId === undefined &&
+ candidate.visible &&
+ candidate.kind === "external"),
+ );
+ const document = item
+ ? snapshot.editorDocuments.find(
+ (candidate) => candidate.id === item.binding?.objectRef?.id,
+ )
+ : undefined;
+ return { item, document };
+};
+
+/** (camera, start, duration) per block: what a reader of the stored Storyboard sees. */
+const storedBlocks = (document) =>
+ (document.data.shots ?? []).map((shot) => [
+ shot.cameraId,
+ shot.start,
+ shot.duration,
+ ]);
+const storedIds = (document) => (document.data.shots ?? []).map((shot) => shot.id);
+/** The version a command must name for a stored document. */
+const version = (document) => ({
+ objectType: "editor_document",
+ id: document.id,
+ revision: document.revision,
+});
+/** A stored document as a command payload: the same content without output-only fields. */
+const payloadOf = (document) => {
+ const { schemaVersion, ...payload } = structuredClone(document);
+ return payload;
+};
+/** Holds back the reply to every command of one type until it is let go, so the page
+ * is seen while such a command is in flight. `reached` comes true once one has
+ * arrived here and waits, `release()` lets its reply go on, and `released` comes true
+ * once it has. The route stays until the caller removes it. */
+const holdReplies = async (type) => {
+ let release, reportReached, reportReleased;
+ const gate = new Promise((resolve) => {
+ release = resolve;
+ });
+ const reached = new Promise((resolve) => {
+ reportReached = resolve;
+ });
+ const released = new Promise((resolve) => {
+ reportReleased = resolve;
+ });
+ await page.route("**/commands", async (route) => {
+ if (route.request().postDataJSON()?.type !== type) return route.continue();
+ reportReached();
+ await gate;
+ await route.continue();
+ reportReleased();
+ });
+ return { reached, release, released };
+};
+
+try {
+ await page.goto(`${base}/ai-tool/ai-canvas/${projectId}?creation=unified`);
+ await page.getByText(L.saved, { exact: true }).waitFor();
+
+ const addStage = page.getByRole("button", { name: L.addStage, exact: true });
+ await addStage.waitFor();
+ await addStage.click();
+ const apply = page.getByRole("button", { name: L.apply, exact: true });
+ await apply.waitFor();
+ const created = director(
+ await until(
+ (snapshot) => director(snapshot).document?.kind === "director",
+ "created Director Stage",
+ ),
+ );
+ const itemId = created.item.id;
+ const documentId = created.document.id;
+ assert.deepEqual(
+ created.document.data.shots ?? [],
+ [],
+ "a new stage has an empty Storyboard",
+ );
+ const [firstCamera, ...rest] = created.document.data.cameras;
+ assert.equal(rest.length, 0, "a new stage holds exactly the default camera");
+ assert.equal(firstCamera.name, L.defaultCamera);
+
+ // A second camera exists through the ordinary editor; applying it makes the
+ // persisted active camera the second one, so a later block click on the first
+ // camera can be told apart from a write of the active camera.
+ await page.getByRole("tab", { name: L.camerasTab, exact: true }).click();
+ await page.getByRole("button", { name: L.addCamera, exact: true }).click();
+ await apply.click();
+ await apply.waitFor({ state: "detached" });
+ const withCameras = director(
+ await until(
+ (snapshot) => director(snapshot, itemId).document?.data.cameras.length === 2,
+ "second camera persisted",
+ ),
+ itemId,
+ );
+ const secondCamera = withCameras.document.data.cameras[1];
+ assert.equal(secondCamera.name, L.secondCamera);
+ const activeCameraId = withCameras.document.data.activeCameraId;
+ const cameraSource = withCameras.document.data.cameraSource;
+ assert.equal(activeCameraId, secondCamera.id);
+ assert.equal(cameraSource, "camera");
+
+ await page.locator(`.react-flow__node[data-id="${itemId}"]`).click();
+ await page.getByRole("button", { name: L.openStage, exact: true }).click();
+ await apply.waitFor();
+ const previewMode = page.getByRole("group", {
+ name: L.previewMode,
+ exact: true,
+ });
+ const dynamicPreview = previewMode.getByRole("button", {
+ name: L.dynamicPreview,
+ exact: true,
+ });
+ await dynamicPreview.click();
+ const timeline = page.getByTestId("director-stage-timeline");
+ /** With DIRECTOR_STAGE_STORYBOARD_SCREENSHOT_DIR set, writes the timeline at twice
+ * its size, so a block can be looked at, as `-.png`. Does nothing
+ * without it. Precedent: DIRECTOR_STAGE_SCREENSHOT in director_stage_entry.mjs. */
+ const shootTimeline = async (name) => {
+ if (!screenshotDir) return;
+ await mkdir(screenshotDir, { recursive: true });
+ const box = await timeline.boundingBox();
+ const session = await page.context().newCDPSession(page);
+ try {
+ const { data } = await session.send("Page.captureScreenshot", {
+ format: "png",
+ clip: {
+ x: box.x,
+ y: box.y - 4,
+ width: box.width,
+ height: Math.min(box.height, 150),
+ scale: 2,
+ },
+ captureBeyondViewport: true,
+ });
+ await writeFile(
+ join(screenshotDir, `${name}-${locale}.png`),
+ Buffer.from(data, "base64"),
+ );
+ } finally {
+ await session.detach();
+ }
+ };
+ /** The whole Director Stage window, as the user sees it. */
+ const shootWindow = async (name) => {
+ if (!screenshotDir) return;
+ await mkdir(screenshotDir, { recursive: true });
+ await page.screenshot({
+ path: join(screenshotDir, `${name}-${locale}.png`),
+ });
+ };
+ /** The pixels of a screenshot of a box: rows of [red, green, blue]. */
+ const pixels = async (clip) => {
+ const png = await page.screenshot({ clip });
+ return page.evaluate(async (base64) => {
+ const image = new Image();
+ image.src = `data:image/png;base64,${base64}`;
+ await image.decode();
+ const canvas = document.createElement("canvas");
+ canvas.width = image.naturalWidth;
+ canvas.height = image.naturalHeight;
+ const context = canvas.getContext("2d");
+ context.drawImage(image, 0, 0);
+ const { data } = context.getImageData(0, 0, canvas.width, canvas.height);
+ return Array.from({ length: canvas.height }, (_, y) =>
+ Array.from({ length: canvas.width }, (_, x) => {
+ const offset = (y * canvas.width + x) * 4;
+ return [data[offset], data[offset + 1], data[offset + 2]];
+ }),
+ );
+ }, png.toString("base64"));
+ };
+ await timeline.waitFor();
+ assert.equal(await timeline.getAttribute("aria-label"), L.timeline);
+
+ const shotsRow = timeline.locator(
+ '.cw-stage-track-row[data-track-kind="shots"]',
+ );
+ const add = shotsRow.getByRole("button", { name: L.storyboardAdd, exact: true });
+ const chooser = page.getByRole("dialog", {
+ name: L.storyboardChooser,
+ exact: true,
+ });
+ const search = chooser.getByLabel(L.storyboardSearch, { exact: true });
+ const options = chooser.getByRole("button");
+ const blocks = shotsRow.getByTestId("director-stage-storyboard-block");
+ const playhead = () =>
+ page.getByRole("slider", { name: L.playhead, exact: true }).inputValue();
+ const inspectorCamera = () =>
+ page.getByLabel(L.cameraName, { exact: true }).inputValue();
+ const durationInput = page.getByLabel(L.stageDuration, { exact: true });
+ const deleteCamera = page.getByRole("button", { name: L.deleteCamera, exact: true });
+ const deleteBlock = shotsRow.getByTestId("director-stage-storyboard-delete-block");
+ /** The line that says where a carried block would be let in. */
+ const markers = shotsRow.getByTestId("director-stage-storyboard-insert-marker");
+ /** What the timeline shows for each Storyboard block. */
+ const blockStates = () =>
+ blocks.evaluateAll((elements) =>
+ elements.map((element) => ({
+ id: element.dataset.blockId,
+ name: element.textContent,
+ selected: element.getAttribute("aria-pressed"),
+ label: element.getAttribute("aria-label"),
+ })),
+ );
+ const resizeHandle = (index, edge) =>
+ blocks.nth(index)
+ .getByTestId("director-stage-storyboard-resize-handle")
+ .and(page.locator(`[data-edge="${edge}"]`));
+ const center = async (locator) => {
+ await locator.waitFor();
+ const box = await locator.boundingBox();
+ assert.ok(box, "the gesture target is visible");
+ return { x: box.x + box.width / 2, y: box.y + box.height / 2 };
+ };
+ /** The surface that holds the blocks and, during a gesture, the pointer. */
+ const surface = shotsRow.locator(".cw-stage-storyboard-blocks");
+ /** The cursor of an element, as the pointer sees it over that element. */
+ const cursorOf = (locator) =>
+ locator.evaluate((element) => getComputedStyle(element).cursor);
+ /** The cursor the pointer shows over the page at one point. */
+ const cursorShownAt = (x, y) =>
+ page.evaluate(
+ ([x, y]) => getComputedStyle(document.elementFromPoint(x, y)).cursor,
+ [x, y],
+ );
+ /** The pointer travels to one point in small steps, then a frame is allowed to
+ * answer it. */
+ const moveInFrames = async (x, y) => {
+ await page.mouse.move(x, y, { steps: 4 });
+ await page.evaluate(() => new Promise((resolve) => requestAnimationFrame(resolve)));
+ };
+ const openChooser = async () => {
+ await add.click();
+ await chooser.waitFor();
+ };
+ const assertChooserClosed = async (how) => {
+ await chooser.waitFor({ state: "detached" });
+ assert.equal(await add.getAttribute("aria-expanded"), "false", how);
+ await apply.waitFor();
+ };
+
+ // The chooser opens above `+`, left edges aligned, with a small vertical gap.
+ assert.equal(await add.isEnabled(), true);
+ assert.equal(await blocks.count(), 0);
+ await openChooser();
+ assert.equal(await add.getAttribute("aria-expanded"), "true");
+ const addBox = await add.boundingBox();
+ const chooserBox = await chooser.boundingBox();
+ assert.ok(addBox && chooserBox);
+ assert.ok(
+ Math.abs(chooserBox.x - addBox.x) <= 1,
+ `left edges aligned: chooser ${chooserBox.x}, + ${addBox.x}`,
+ );
+ const gap = addBox.y - (chooserBox.y + chooserBox.height);
+ assert.ok(gap >= 1 && gap <= 12, `a small vertical gap above +: ${gap}`);
+ // Nothing clips or covers it: the chooser itself is what the pointer would hit.
+ assert.equal(
+ await chooser.evaluate((element) => {
+ const bounds = element.getBoundingClientRect();
+ return [
+ [bounds.left + 2, bounds.top + 2],
+ [bounds.left + bounds.width - 2, bounds.top + 2],
+ [bounds.left + 2, bounds.bottom - 2],
+ [bounds.left + bounds.width / 2, bounds.top + bounds.height / 2],
+ ].every(([x, y]) => element.contains(document.elementFromPoint(x, y)));
+ }),
+ true,
+ "the chooser is neither clipped nor covered",
+ );
+ // Every existing camera, the default one first.
+ assert.deepEqual(await options.allTextContents(), [
+ L.defaultCamera,
+ L.secondCamera,
+ ]);
+
+ // Name search narrows the list and says when nothing matches.
+ await search.fill("2");
+ assert.deepEqual(await options.allTextContents(), [L.secondCamera]);
+ await search.fill("no-such-camera");
+ assert.equal(await options.count(), 0);
+ await chooser.getByText(L.storyboardSearchEmpty, { exact: true }).waitFor();
+ await search.fill("");
+ assert.deepEqual(await options.allTextContents(), [
+ L.defaultCamera,
+ L.secondCamera,
+ ]);
+
+ // Escape closes the chooser and leaves the editor open.
+ await search.press("Escape");
+ await assertChooserClosed("Escape");
+
+ // A pointer-down outside closes it.
+ await openChooser();
+ await page.mouse.click(700, 420);
+ await assertChooserClosed("outside pointer-down");
+
+ // Pressing `+` again closes it; it still opens afterwards.
+ await openChooser();
+ await add.click();
+ await assertChooserClosed("`+` pressed again");
+ await openChooser();
+ await add.click();
+ await assertChooserClosed("`+` pressed again");
+
+ const playheadSlider = page.getByRole("slider", {
+ name: L.playhead,
+ exact: true,
+ });
+ /** Wait until the project holds `count` Storyboard blocks and return the document. */
+ const persisted = async (count, label) =>
+ director(
+ await until(
+ (snapshot) =>
+ (director(snapshot, itemId).document?.data.shots ?? []).length === count,
+ label,
+ ),
+ itemId,
+ ).document;
+ /** The persisted document, once the timeline also shows the blocks. */
+ const stored = async (count, label) => {
+ const document = await persisted(count, label);
+ await blocks.nth(count - 1).waitFor();
+ return document;
+ };
+
+ // First add. The chosen camera becomes a block through the shared command while
+ // the editor stays open and "Apply edits" is never pressed. The block is selected,
+ // the playhead jumps to its start, its camera is the selected camera, and neither
+ // the persisted active camera nor the preview source is written.
+ await playheadSlider.fill("1.5");
+ assert.equal(await playhead(), "1.5");
+ const beforeFirst = director(await state(), itemId).document;
+ await openChooser();
+ await chooser.getByRole("button", { name: L.defaultCamera, exact: true }).click();
+ const first = await stored(1, "first Storyboard block persisted");
+ assert.deepEqual(
+ storedBlocks(first),
+ [[firstCamera.id, 0, 2]],
+ "a new block lasts two seconds",
+ );
+ assert.ok(
+ first.revision > beforeFirst.revision,
+ "the document moved to a new revision",
+ );
+ assert.deepEqual(await blockStates(), [
+ {
+ id: storedIds(first)[0],
+ name: L.defaultCamera,
+ selected: "true",
+ label: text(L.storyboardBlock, {
+ name: L.defaultCamera,
+ start: "0.00",
+ end: "2.00",
+ }),
+ },
+ ]);
+ assert.equal(
+ await playhead(),
+ "0",
+ "the playhead moves to the new block's start",
+ );
+ assert.equal(await inspectorCamera(), L.defaultCamera);
+ assert.equal(first.data.activeCameraId, activeCameraId);
+ assert.equal(
+ first.data.cameraSource,
+ cameraSource,
+ "the add does not write the active camera or the preview source",
+ );
+
+ // The same camera again is another block with its own identity, not a longer one.
+ // The append's reply is held back once to see the state while the command is in
+ // flight: `+` is disabled, names why, and a press opens no chooser.
+ const appendReply = await holdReplies("director.storyboard.append");
+ await openChooser();
+ await chooser
+ .getByRole("button", { name: L.defaultCamera, exact: true })
+ .click();
+ await appendReply.reached;
+ await page.waitForFunction(
+ () =>
+ document.querySelector(".cw-stage-storyboard-add")?.disabled === true,
+ );
+ assert.equal(await add.getAttribute("title"), L.storyboardAdding);
+ // While that command is in flight the track cannot be edited. Its blocks still
+ // select, and say so with the ordinary pointer rather than a grab.
+ const heldBlock = await center(blocks.nth(0));
+ await page.mouse.move(heldBlock.x, heldBlock.y);
+ assert.equal(
+ await cursorShownAt(heldBlock.x, heldBlock.y),
+ "pointer",
+ "a block that cannot be edited keeps the pointer",
+ );
+ const busyBox = await add.boundingBox();
+ await page.mouse.click(
+ busyBox.x + busyBox.width / 2,
+ busyBox.y + busyBox.height / 2,
+ );
+ assert.equal(await chooser.count(), 0, "no second command starts");
+ appendReply.release();
+ await appendReply.released;
+ await page.unroute("**/commands");
+ const second = await stored(2, "second Storyboard block persisted");
+ assert.equal(await add.isEnabled(), true, "`+` is usable again once the command landed");
+ const [firstId, secondId] = storedIds(second);
+ assert.notEqual(secondId, firstId);
+ assert.deepEqual(
+ storedBlocks(second),
+ [
+ [firstCamera.id, 0, 2],
+ [firstCamera.id, 2, 2],
+ ],
+ );
+ assert.deepEqual(
+ (await blockStates()).map((block) => [block.name, block.selected]),
+ [
+ [L.defaultCamera, "false"],
+ [L.defaultCamera, "true"],
+ ],
+ "the new block is the selected one",
+ );
+ assert.equal(await playhead(), "2");
+ assert.equal(await inspectorCamera(), L.defaultCamera);
+ assert.equal(second.data.activeCameraId, activeCameraId);
+ assert.equal(second.data.cameraSource, cameraSource);
+
+ // An ordinary click selects the block and its camera only: the playhead keeps its
+ // time, nothing is written, and the persisted active camera stays the second one.
+ await playheadSlider.fill("1");
+ await blocks.nth(0).click();
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.selected),
+ ["true", "false"],
+ );
+ assert.equal(await inspectorCamera(), L.defaultCamera);
+ assert.equal(
+ await playhead(),
+ "1",
+ "an ordinary click does not move the playhead",
+ );
+ const afterClick = director(await state(), itemId).document;
+ assert.equal(
+ afterClick.revision,
+ second.revision,
+ "an ordinary click writes nothing",
+ );
+ assert.equal(afterClick.data.activeCameraId, activeCameraId);
+ assert.equal(afterClick.data.cameraSource, cameraSource);
+
+ // The body of an editable block is where a drag to another place begins, and says so
+ // with an open hand. A handle beside a boundary resizes, and keeps its own cursor.
+ const bodyPoint = await center(blocks.nth(0));
+ await page.mouse.move(bodyPoint.x, bodyPoint.y);
+ assert.equal(
+ await cursorShownAt(bodyPoint.x, bodyPoint.y),
+ "grab",
+ "the body of an editable block offers a grab",
+ );
+ const handlePoint = await center(resizeHandle(0, "right"));
+ await page.mouse.move(handlePoint.x, handlePoint.y);
+ assert.equal(
+ await cursorShownAt(handlePoint.x, handlePoint.y),
+ "ew-resize",
+ "a boundary handle keeps its resize cursor",
+ );
+ // With nothing in progress, the controls that would change the Storyboard are usable.
+ assert.equal(await add.isEnabled(), true);
+ assert.equal(await add.getAttribute("title"), L.storyboardAdd);
+ assert.equal(await durationInput.isEnabled(), true);
+ assert.equal(await deleteCamera.isEnabled(), true);
+
+ // From the press on, the pointer is a closed hand: over the block, and over the
+ // surface, which owns the pointer once it moves, wherever the pointer goes.
+ await page.mouse.move(bodyPoint.x, bodyPoint.y);
+ await page.mouse.down();
+ assert.equal(
+ await cursorShownAt(bodyPoint.x, bodyPoint.y),
+ "grabbing",
+ "the pressed block closes the hand",
+ );
+ assert.equal(
+ await cursorOf(surface),
+ "grabbing",
+ "the surface closes the hand from the press",
+ );
+ await moveInFrames(bodyPoint.x + 40, bodyPoint.y);
+ assert.equal(
+ await cursorShownAt(bodyPoint.x + 40, bodyPoint.y),
+ "grabbing",
+ "the hand stays closed while the pointer moves over the block",
+ );
+ // Away from the track, the cursor is whatever the surface says: while it holds the
+ // pointer, the page's own element under the pointer is not the one the pointer shows.
+ const surfaceBox = await surface.boundingBox();
+ const away = { x: bodyPoint.x + 40, y: surfaceBox.y - 200 };
+ await moveInFrames(away.x, away.y);
+ assert.equal(await cursorOf(surface), "grabbing", "the hand stays closed outside the track");
+ await moveInFrames(bodyPoint.x + 40, bodyPoint.y);
+ // A drag in progress is one more thing the controls that would change the Storyboard
+ // wait for, and `+` names the reason it gives while an edit is in flight.
+ assert.equal(await add.isDisabled(), true, "`+` waits while a block is carried");
+ assert.equal(await add.getAttribute("title"), L.storyboardEditing);
+ assert.equal(
+ await deleteCamera.isDisabled(),
+ true,
+ "deleting the camera waits while a block is carried",
+ );
+ assert.equal(
+ await durationInput.isDisabled(),
+ true,
+ "the main duration waits while a block is carried",
+ );
+ await page.keyboard.press("Escape");
+ await page.mouse.up();
+ assert.equal(await add.isEnabled(), true, "`+` is back once the drag is over");
+ assert.equal(await add.getAttribute("title"), L.storyboardAdd);
+ assert.equal(await deleteCamera.isEnabled(), true);
+ assert.equal(await durationInput.isEnabled(), true);
+ await page.mouse.move(700, 420);
+
+ // A rejection leaves the draft as it is and names the reason. While the editor is
+ // open, the same document is changed through the HTTP command endpoint, as an Agent
+ // would change it. The next add from the timeline carries the version the editor
+ // knows and is refused as a conflict instead of overwriting that change.
+ const reopenEditor = async () => {
+ await page.locator(`.react-flow__node[data-id="${itemId}"]`).click();
+ await page.getByRole("button", { name: L.openStage, exact: true }).click();
+ await apply.waitFor();
+ await dynamicPreview.click();
+ await timeline.waitFor();
+ };
+ const beforeConflict = director(await state(), itemId).document;
+ assert.equal(
+ (
+ await send(
+ "director.apply",
+ {
+ document: {
+ ...payloadOf(beforeConflict),
+ data: { ...beforeConflict.data, duration: 8 },
+ },
+ },
+ [version(beforeConflict)],
+ )
+ ).status,
+ "applied",
+ );
+ await openChooser();
+ await chooser.getByRole("button", { name: L.defaultCamera, exact: true }).click();
+ await page.locator(".cw-stage-error").filter({ hasText: L.revisionConflict }).waitFor();
+ assert.equal(await chooser.count(), 0, "the chooser closed on the choice");
+ assert.equal(await blocks.count(), 2, "the refused add leaves the draft as it is");
+ assert.equal(await add.isEnabled(), true, "`+` is usable again after the refusal");
+ const afterConflict = director(await state(), itemId).document;
+ assert.equal(afterConflict.data.duration, 8, "the external change stays");
+ assert.deepEqual(
+ storedIds(afterConflict),
+ [firstId, secondId],
+ "nothing was written by the refused add",
+ );
+ // The editor still holds the version from before that change, so it is reopened to
+ // read the document again.
+ await page.getByRole("button", { name: L.closeEditor, exact: true }).click();
+ await apply.waitFor({ state: "detached" });
+ await reopenEditor();
+ assert.equal(await blocks.count(), 2);
+
+ // A draft with unsaved changes is committed before the add. The unsaved draft also
+ // shortens the main timeline to leave one second, so the same add shows the tail
+ // fill: the new block takes what is left instead of two seconds.
+ // Both blocks reference the first camera, so the second camera is picked in the tree.
+ await page
+ .locator(".cw-stage-right-tree")
+ .getByRole("button", { name: L.secondCamera, exact: true })
+ .click();
+ assert.equal(await inspectorCamera(), L.secondCamera);
+ const cameraNameInput = page.getByLabel(L.cameraName, { exact: true });
+ await cameraNameInput.fill(L.renamedCamera);
+ await durationInput.fill("5");
+ const unsaved = director(await state(), itemId).document;
+ assert.equal(
+ unsaved.data.cameras[1].name,
+ L.secondCamera,
+ "the draft edit is not saved yet",
+ );
+ assert.equal(unsaved.data.duration, 8);
+ await durationInput.press("Enter");
+ await until(
+ (snapshot) => director(snapshot, itemId).document?.data.duration === 5,
+ "requested main timeline duration persisted",
+ );
+ await openChooser();
+ const acceptedAppend = page.waitForResponse((response) =>
+ response.url().endsWith("/commands") && response.request().method() === "POST" &&
+ response.request().postDataJSON().type === "director.storyboard.append");
+ await chooser
+ .getByRole("button", { name: L.renamedCamera, exact: true })
+ .click();
+ const [uiAppend] = (await (await acceptedAppend).json()).directorStoryboard ?? [];
+ const third = await stored(3, "third Storyboard block persisted");
+ assert.equal(
+ third.data.cameras[1].name,
+ L.renamedCamera,
+ "the unsaved draft was committed first",
+ );
+ assert.equal(third.data.duration, 5);
+ assert.deepEqual(
+ storedBlocks(third),
+ [
+ [firstCamera.id, 0, 2],
+ [firstCamera.id, 2, 2],
+ [secondCamera.id, 4, 1],
+ ],
+ "with one second left the new block lasts one second",
+ );
+ await durationInput.fill("3");
+ await durationInput.press("Enter");
+ await page.getByText(L.durationClamped, { exact: true }).waitFor();
+ assert.equal(await durationInput.inputValue(), "5");
+ assert.deepEqual(
+ director(await state(), itemId).document,
+ third,
+ "a no-op clamp preserves the saved edit list and animation",
+ );
+ const thirdId = storedIds(third)[2];
+ assert.equal(third.data.activeCameraId, activeCameraId);
+ assert.equal(third.data.cameraSource, cameraSource);
+ assert.deepEqual(
+ (await blockStates()).map((block) => [block.id, block.name, block.selected]),
+ [
+ [firstId, L.defaultCamera, "false"],
+ [secondId, L.defaultCamera, "false"],
+ [thirdId, L.renamedCamera, "true"],
+ ],
+ );
+ assert.equal(await playhead(), "4");
+ assert.equal(await inspectorCamera(), L.renamedCamera);
+
+ // No positive time remains: `+` is disabled and names the reason where a pointer
+ // can read it and where assistive technology reads it, and a press opens nothing.
+ assert.equal(await add.isEnabled(), false);
+ assert.equal(await add.getAttribute("title"), L.reasonExhausted);
+ const reasonId = await add.getAttribute("aria-describedby");
+ assert.ok(reasonId, "the disabled `+` points at its reason");
+ assert.equal(
+ (await page.locator(`[id="${reasonId}"]`).textContent()).trim(),
+ L.reasonExhausted,
+ );
+ const disabledBox = await add.boundingBox();
+ await page.mouse.click(
+ disabledBox.x + disabledBox.width / 2,
+ disabledBox.y + disabledBox.height / 2,
+ );
+ assert.equal(await chooser.count(), 0);
+
+ // In the editor the add is one local history step on top of the unsaved edits: one
+ // undo removes only the block and keeps those edits, one redo brings the same block back.
+ const consoleRoot = page.locator(".cw-stage-console");
+ const stageUndo = consoleRoot.getByRole("button", { name: L.undo, exact: true });
+ const stageRedo = consoleRoot.getByRole("button", { name: L.redo, exact: true });
+ await stageUndo.click();
+ await blocks.nth(2).waitFor({ state: "detached" });
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.id),
+ [firstId, secondId],
+ "one undo removes the added block and nothing else",
+ );
+ assert.equal(await durationInput.inputValue(), "5", "the undo keeps the duration edit");
+ assert.equal(await inspectorCamera(), L.renamedCamera, "the undo keeps the rename");
+ await stageRedo.click();
+ await blocks.nth(2).waitFor();
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.id),
+ [firstId, secondId, thirdId],
+ "redo restores the same block",
+ );
+ // The undone step removed the selected block, so its selection went with it. The
+ // block that redo brings back is not selected again without the user's action, and
+ // nothing else is selected in its place.
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.selected),
+ ["false", "false", "false"],
+ "a block restored by redo is not selected again",
+ );
+ assert.equal(
+ director(await state(), itemId).document.revision,
+ third.revision,
+ "a local undo and redo write nothing",
+ );
+
+ // The same add is one step in the project's history: undo removes exactly that
+ // block and keeps the edits saved before it; redo restores identity, order and times.
+ await page.getByRole("button", { name: L.closeEditor, exact: true }).click();
+ await apply.waitFor({ state: "detached" });
+ const toolbarUndo = page
+ .locator(".cw-undo-controls")
+ .getByRole("button", { name: L.undo, exact: true });
+ const toolbarRedo = page
+ .locator(".cw-undo-controls")
+ .getByRole("button", { name: L.redo, exact: true });
+ await toolbarUndo.click();
+ const undone = await persisted(2, "history undo removes the appended block");
+ assert.deepEqual(storedIds(undone), [firstId, secondId]);
+ assert.equal(
+ undone.data.cameras[1].name,
+ L.renamedCamera,
+ "history undo keeps the edits saved before the add",
+ );
+ assert.equal(undone.data.duration, 5);
+ await toolbarRedo.click();
+ const redone = await persisted(3, "history redo restores the appended block");
+ assert.deepEqual(storedIds(redone), [firstId, secondId, thirdId]);
+ assert.deepEqual(storedBlocks(redone), storedBlocks(third));
+
+ // Reopening shows the saved Storyboard exactly as it is stored.
+ await reopenEditor();
+ await blocks.nth(2).waitFor();
+ const shown = (id, name, start, end) => ({
+ id,
+ name,
+ selected: "false",
+ label: text(L.storyboardBlock, { name, start, end }),
+ });
+ assert.deepEqual(await blockStates(), [
+ shown(firstId, L.defaultCamera, "0.00", "2.00"),
+ shown(secondId, L.defaultCamera, "2.00", "4.00"),
+ shown(thirdId, L.renamedCamera, "4.00", "5.00"),
+ ]);
+ assert.equal(await add.isEnabled(), false, "the reopened track is still full");
+ assert.equal(
+ director(await state(), itemId).document.revision,
+ redone.revision,
+ "reopening writes nothing",
+ );
+
+ // A stage file whose Storyboard has a gap is refused with the localized reason and
+ // leaves the draft as it is.
+ const importInput = page.locator(
+ 'input[type="file"][accept^="application/json"]',
+ );
+ for (const [shots, reason] of [
+ // A gap before the first block, then a gap between two blocks.
+ [[["gap-a", firstCamera.id, 1, 1], ["gap-b", secondCamera.id, 2, 1]], L.reasonLeadingGap],
+ [[["gap-a", firstCamera.id, 0, 1], ["gap-b", secondCamera.id, 2, 1]], L.reasonInternalGap],
+ ]) {
+ const gapped = {
+ format: "opendirector-local-stage",
+ version: 2,
+ ...redone.data,
+ shots: shots.map(([id, cameraId, start, duration]) => ({
+ id,
+ cameraId,
+ start,
+ duration,
+ })),
+ };
+ await importInput.setInputFiles({
+ name: "gapped.stage.json",
+ mimeType: "application/json",
+ buffer: Buffer.from(JSON.stringify(gapped)),
+ });
+ await page.locator(".cw-stage-error").filter({ hasText: reason }).waitFor();
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.id),
+ [firstId, secondId, thirdId],
+ "a refused import leaves the draft as it is",
+ );
+ assert.equal(await durationInput.inputValue(), "5");
+ }
+ assert.equal(
+ director(await state(), itemId).document.revision,
+ redone.revision,
+ "a refused import writes nothing",
+ );
+ // The draft is still the saved one, so the editor closes without asking to apply.
+ await page.getByRole("button", { name: L.closeEditor, exact: true }).click();
+ await apply.waitFor({ state: "detached" });
+
+ // The same inputs through the Agent tool store the same blocks as the UI.
+ assert.ok(browserSession, "the page holds the project's session");
+ const source = director(await state(), itemId).document;
+ const agentDocumentId = crypto.randomUUID();
+ const agentItemId = crypto.randomUUID();
+ const agentDocument = {
+ ...payloadOf(source),
+ id: agentDocumentId,
+ revision: 1,
+ inputConnections: [],
+ data: { ...source.data, shots: [] },
+ };
+ assert.equal(
+ (await send("editor.create", { document: agentDocument })).status,
+ "applied",
+ );
+ // A second Director Stage on the canvas, bound to that document.
+ assert.equal(
+ (
+ await send("canvas.show", {
+ item: {
+ id: agentItemId,
+ projectId,
+ kind: "external",
+ title: "Agent stage",
+ position: { x: 1040, y: 262 },
+ width: 340,
+ height: 180,
+ zIndex: 0,
+ locked: false,
+ parentId: null,
+ binding: {
+ role: "editor",
+ objectRef: {
+ objectType: "editor_document",
+ id: agentDocumentId,
+ kind: "director",
+ },
+ },
+ },
+ })
+ ).status,
+ "applied",
+ );
+ // The same cameras, in the order the three choices made through the timeline.
+ for (const [blockId, cameraId] of [
+ ["ui-first", firstCamera.id],
+ ["ui-second", firstCamera.id],
+ ["ui-third", secondCamera.id],
+ ]) {
+ const current = (await state()).editorDocuments.find(
+ (document) => document.id === agentDocumentId,
+ );
+ const receipt = await agentCommand(
+ "director.storyboard.append",
+ { documentId: agentDocumentId, cameraId, blockId },
+ [version(current)],
+ );
+ assert.equal(receipt.status, "applied", JSON.stringify(receipt));
+ const [result] = receipt.directorStoryboard;
+ assert.equal(result.documentId, agentDocumentId);
+ assert.equal(result.version, current.revision + 1);
+ assert.deepEqual(result.affectedBlockIds, [blockId]);
+ assert.deepEqual(result.removedBlockIds, []);
+ if (blockId === "ui-third") {
+ assert.equal(uiAppend.version, third.revision);
+ assert.equal(uiAppend.appendLimitReason, "storyboard_tail");
+ assert.equal(result.appendLimitReason, uiAppend.appendLimitReason);
+ const timing = ({ cameraId, order, start, duration }) => [cameraId, order, start, duration];
+ assert.deepEqual(result.blocks.map(timing), uiAppend.blocks.map(timing));
+ }
+ assert.deepEqual(
+ receipt.changed.map((change) => [
+ change.objectType,
+ change.id,
+ change.revision,
+ ]),
+ [["editor_document", agentDocumentId, current.revision + 1]],
+ "the receipt names the stored revision",
+ );
+ }
+ const agentStored = (await state()).editorDocuments.find(
+ (document) => document.id === agentDocumentId,
+ );
+ assert.deepEqual(storedIds(agentStored), ["ui-first", "ui-second", "ui-third"]);
+ assert.deepEqual(
+ storedBlocks(agentStored),
+ storedBlocks(source),
+ "the same inputs store the same blocks",
+ );
+ // No time is left here either; the rejection carries the stable code.
+ const exhausted = await agentCommand(
+ "director.storyboard.append",
+ {
+ documentId: agentDocumentId,
+ cameraId: firstCamera.id,
+ blockId: "ui-fourth",
+ },
+ [version(agentStored)],
+ );
+ assert.equal(exhausted.status, "rejected");
+ assert.deepEqual(
+ exhausted.issues.map((issue) => issue.code),
+ ["storyboard_exhausted"],
+ );
+ const clamped = await agentCommand(
+ "director.duration.set",
+ { documentId: agentDocumentId, duration: 3 },
+ [version(agentStored)],
+ );
+ assert.equal(clamped.status, "noop");
+ assert.deepEqual(clamped.directorDurations, [{
+ documentId: agentDocumentId,
+ requestedDuration: 3,
+ appliedDuration: 5,
+ clampReason: "storyboard_end",
+ }]);
+ const stale = await agentCommand(
+ "director.storyboard.delete",
+ { documentId: agentDocumentId, blockId: "ui-first" },
+ [{ ...version(agentStored), revision: agentStored.revision - 1 }],
+ );
+ assert.equal(stale.status, "rejected");
+ assert.deepEqual(stale.issues.map(({ code }) => code), ["revision_conflict"]);
+ // The Storyboard query reports each stored document as it is.
+ const storyboardOf = async (document) =>
+ call(`/api/creation/projects/${projectId}/queries`, {
+ queryId: crypto.randomUUID(),
+ projectId,
+ type: "director.storyboard.get",
+ objectId: document.id,
+ });
+ for (const document of [source, agentStored]) {
+ const queried = document === source
+ ? await storyboardOf(document)
+ : await agentTool("query", { type: "director.storyboard.get", objectId: document.id });
+ assert.deepEqual(queried, {
+ documentId: document.id,
+ version: document.revision,
+ storyboardEnd: 5,
+ canAppend: false,
+ cannotAppendReason: "storyboard_exhausted",
+ blocks: document.data.shots.map((shot, order) => ({
+ id: shot.id,
+ cameraId: shot.cameraId,
+ order,
+ start: shot.start,
+ duration: shot.duration,
+ })),
+ });
+ }
+
+ // A Director Stage whose stored Storyboard is not continuous is refused when it is
+ // opened, with the reason, while the canvas stays usable. No write accepts such a
+ // document any more, so the isolated fixture stores it as an older build did.
+ await call("/api/creation-test-legacy-storyboard", {
+ projectId,
+ documentId: agentDocumentId,
+ itemId: agentItemId,
+ shots: [
+ { id: "old-a", cameraId: firstCamera.id, start: 1, duration: 1 },
+ { id: "old-b", cameraId: secondCamera.id, start: 4, duration: 0.5 },
+ ],
+ });
+ const legacy = (await state()).editorDocuments.find(
+ (document) => document.id === agentDocumentId,
+ );
+ assert.deepEqual(
+ storedBlocks(legacy),
+ [
+ [firstCamera.id, 1, 1],
+ [secondCamera.id, 4, 0.5],
+ ],
+ "the gaps are stored as they were written",
+ );
+ assert.deepEqual(await storyboardOf(legacy), {
+ documentId: agentDocumentId,
+ version: legacy.revision,
+ storyboardEnd: 4.5,
+ canAppend: false,
+ cannotAppendReason: "storyboard_leading_gap",
+ blocks: [
+ { id: "old-a", cameraId: firstCamera.id, order: 0, start: 1, duration: 1 },
+ { id: "old-b", cameraId: secondCamera.id, order: 1, start: 4, duration: 0.5 },
+ ],
+ });
+ const refused = await send(
+ "director.storyboard.append",
+ { documentId: agentDocumentId, cameraId: firstCamera.id, blockId: "old-c" },
+ [version(legacy)],
+ );
+ assert.equal(refused.status, "rejected");
+ assert.deepEqual(
+ refused.issues.map((issue) => issue.code),
+ ["storyboard_leading_gap"],
+ );
+
+ await page.reload();
+ await page.getByText(L.saved, { exact: true }).waitFor();
+ await page.locator(`.react-flow__node[data-id="${agentItemId}"]`).click();
+ await page.getByRole("button", { name: L.openStage, exact: true }).click();
+ await page.getByRole("status").filter({ hasText: L.reasonLeadingGap }).waitFor();
+ assert.equal(await apply.count(), 0, "the editor never mounts");
+ assert.equal(
+ director(await state(), agentItemId).document.revision,
+ legacy.revision,
+ "the refusal writes nothing",
+ );
+ assert.equal(await addStage.count(), 1, "the canvas keeps its creation entry");
+ // Edit the continuous stage beside it, then read the result back from the API.
+ await reopenEditor();
+ const readEditedStage = (snapshot) => director(snapshot, itemId).document;
+ await playheadSlider.fill("1.5");
+ await page.getByRole("button", { name: L.recordKeyframe, exact: true }).click();
+ await apply.click();
+ await apply.waitFor({ state: "detached" });
+ const startingStage = readEditedStage(await until(
+ (snapshot) => readEditedStage(snapshot).data.cameras.some(
+ ({ keyframes }) => keyframes.some(({ time }) => time === 1.5),
+ ),
+ "camera keyframe persisted before Storyboard editing",
+ ));
+ await reopenEditor();
+ const startingIds = storedIds(startingStage);
+ assert.deepEqual(startingIds, [firstId, secondId, thirdId]);
+ const [firstShot, secondShot, lastShot] = startingStage.data.shots;
+ const shape = (document) =>
+ document.data.shots.map(({ id, cameraId, start, duration }) => [
+ id, cameraId, start, duration,
+ ]);
+ const storedWithoutShots = ({ data: { shots, ...data } }) => data;
+ const assertOnlyShotsChanged = (document) =>
+ assert.deepEqual(storedWithoutShots(document), storedWithoutShots(startingStage));
+ const gestureCommands = [];
+ const observeMoves = (request) => {
+ if (!request.url().endsWith("/commands") || request.method() !== "POST") return;
+ const command = request.postDataJSON();
+ const operations = command.type === "creation.batch" ? command.payload.operations : [command];
+ if (operations.some(({ payload }) =>
+ payload.documentId === documentId || payload.document?.id === documentId
+ )) gestureCommands.push(command.type);
+ };
+ page.on("request", observeMoves);
+ const expectSavedShape = async (expected, label) => {
+ const snapshot = await until(
+ (snapshot) => JSON.stringify(shape(readEditedStage(snapshot))) === JSON.stringify(expected),
+ label,
+ );
+ const document = readEditedStage(snapshot);
+ assertOnlyShotsChanged(document);
+ return document;
+ };
+
+ await playheadSlider.fill("1");
+ const activeBlock = () => shotsRow.locator('[data-block-id][aria-current="time"]');
+ assert.equal(await activeBlock().getAttribute("data-block-id"), firstId);
+ /** Where every block's box is, in the order the track shows them. */
+ const blockBoxes = () =>
+ blocks.evaluateAll((elements) =>
+ elements.map((element) => {
+ const { x, y, width, height } = element.getBoundingClientRect();
+ return { x, y, width, height };
+ }),
+ );
+ /** A page expression: each block's id, left edge and length as they are laid out. */
+ const trackBoxesSource = `(() =>
+ [...document.querySelectorAll('[data-testid="director-stage-storyboard-block"]')].map(
+ (element) => {
+ const { x, width } = element.getBoundingClientRect();
+ return {
+ id: element.dataset.blockId,
+ x,
+ width,
+ // The lift of the block's box: whether it is carried.
+ lift: getComputedStyle(element.parentElement).opacity,
+ };
+ },
+ ))()`;
+ const trackBoxes = () => page.evaluate(trackBoxesSource);
+ /** How the box of each block is shown: how see-through, how far it is moved from its
+ * place, and its shadow. A block at rest is `["1", "none", "none"]`. */
+ const boxLooks = () =>
+ blocks.evaluateAll((elements) =>
+ elements.map((element) => {
+ const style = getComputedStyle(element.parentElement);
+ return [style.opacity, style.transform, style.boxShadow];
+ }),
+ );
+ /** Lets `count` frames pass. */
+ const passFrames = (count) =>
+ page.evaluate(
+ (count) =>
+ new Promise((resolve) => {
+ const tick = () => (count -= 1) > 0 ? requestAnimationFrame(tick) : resolve();
+ requestAnimationFrame(tick);
+ }),
+ count,
+ );
+ /** Lets a few frames pass for the boxes to reach a place, then returns them. */
+ const settledBoxes = async (ready) => {
+ for (let frame = 0; frame < 30 && !ready(await blockBoxes()); frame += 1)
+ await page.evaluate(() => new Promise((resolve) => requestAnimationFrame(resolve)));
+ return blockBoxes();
+ };
+ const within = (actual, expected, what) =>
+ assert.ok(
+ Math.abs(actual - expected) <= 1,
+ `${what}: ${actual} against ${expected}`,
+ );
+ /** One second of the main timeline, in pixels. */
+ const unit = (await blocks.first().boundingBox()).width / 2;
+ const from = await center(blocks.first());
+ const to = await center(blocks.last());
+ await page.mouse.move(from.x, from.y);
+ await page.mouse.down();
+ await moveInFrames(from.x + 2, from.y);
+ await page.mouse.up();
+ assert.deepEqual(gestureCommands, [], "a move below the threshold only selects");
+ assert.equal(await blocks.first().getAttribute("aria-pressed"), "true");
+
+ // Past the threshold the pressed block alone follows the pointer, sideways only, with
+ // the point it was pressed at kept under the pointer. Nothing else moves: not the
+ // other blocks, not the playhead, not the block the playhead outlines.
+ const restingBoxes = await blockBoxes();
+ /** The lift of the first block's box: how see-through it is, and its shadow. */
+ const liftOf = () =>
+ blocks.first().evaluate((element) => {
+ const style = getComputedStyle(element.parentElement);
+ return { opacity: Number(style.opacity), shadow: style.boxShadow };
+ });
+ const restingLift = await liftOf();
+ await page.mouse.move(from.x, from.y);
+ await page.mouse.down();
+ await moveInFrames(from.x + 40, from.y + 12);
+ let dragBoxes = await settledBoxes(
+ (shown) => Math.abs(shown[0].x - (restingBoxes[0].x + 40)) <= 1,
+ );
+ within(dragBoxes[0].x, restingBoxes[0].x + 40, "the dragged block follows the pointer");
+ within(dragBoxes[0].y, restingBoxes[0].y, "the dragged block keeps its row");
+ assert.deepEqual(
+ dragBoxes.slice(1),
+ restingBoxes.slice(1),
+ "the other blocks do not move",
+ );
+ // A release would keep the order here, so the track says nothing about a place.
+ assert.equal(
+ await markers.count(),
+ 0,
+ "no line while the carried block is still within its own place",
+ );
+ await moveInFrames(from.x + unit * 1.4, from.y);
+ dragBoxes = await settledBoxes(
+ (shown) => Math.abs(shown[0].x - (restingBoxes[0].x + unit * 1.4)) <= 1,
+ );
+ within(
+ dragBoxes[0].x,
+ restingBoxes[0].x + unit * 1.4,
+ "the dragged block keeps following the pointer",
+ );
+ assert.deepEqual(
+ dragBoxes.slice(1),
+ restingBoxes.slice(1),
+ "the other blocks still do not move",
+ );
+ // The carried block's centre is still short of the next block's centre: a release
+ // would keep the order, and there is still no line.
+ assert.equal(
+ await markers.count(),
+ 0,
+ "no line while the carried block's centre is short of the next block's centre",
+ );
+ assert.equal(
+ await page.evaluate(() => String(window.getSelection())),
+ "",
+ "carrying a block selects no text",
+ );
+ // Its centre past the centre of the next block, a release would change the order: it
+ // would be let in after that block and before the last one, and one line stands in
+ // that gap, at the left edge of the block that would then follow it.
+ const between = to.x - unit * 1.25;
+ await moveInFrames(between, to.y);
+ await markers.first().waitFor({ state: "attached" });
+ assert.equal(
+ await markers.count(),
+ 1,
+ "one line once a release would change the order",
+ );
+ // Where the blocks lay four seconds out themselves, one second being the width of a
+ // block at rest over its stored length.
+ const pixelsPerSecond = restingBoxes[1].width / secondShot.duration;
+ const markerTrack = await surface.boundingBox();
+ const lineCentre = async () => {
+ const box = await markers.boundingBox();
+ assert.ok(box, "the line is shown");
+ return box.x + box.width / 2;
+ };
+ /** Where `seconds` of the main timeline is laid out, as the line is kept inside the
+ * track: a line at the very end of a track that the Storyboard fills stands just inside
+ * its right edge, so that neither of its chevrons is cut off. */
+ const laidOutAt = (seconds) =>
+ Math.min(markerTrack.x + seconds * pixelsPerSecond, markerTrack.x + markerTrack.width - 4);
+ within(
+ await lineCentre(),
+ laidOutAt(4),
+ "the line stands in the gap the carried block would be let into",
+ );
+ /** The one line, waited for until it stands where `seconds` of the main timeline is
+ * laid out: it is drawn in a frame of its own, like the block it belongs to. */
+ const lineAt = async (seconds, label) => {
+ const expected = laidOutAt(seconds);
+ let centre;
+ for (let frame = 0; frame < 30; frame++) {
+ await markers.first().waitFor({ state: "attached" });
+ centre = await lineCentre();
+ if (Math.abs(centre - expected) <= 1) break;
+ await page.evaluate(() => new Promise((resolve) => requestAnimationFrame(resolve)));
+ }
+ assert.equal(await markers.count(), 1, `exactly one line: ${label}`);
+ within(centre, expected, label);
+ return centre;
+ };
+ /** One computed style of the line, or of one of its two ends. */
+ const markerStyle = (property, which) =>
+ markers.evaluate(
+ (element, [property, which]) => getComputedStyle(element, which)[property],
+ [property, which],
+ );
+ assert.equal(await markerStyle("width"), "3px", "the line is 3px thick");
+ /** A CSS colour as the page paints it, `rgb(…)`, whatever way it was written. */
+ const painted = (colour) =>
+ page.evaluate((colour) => {
+ const context = document.createElement("canvas").getContext("2d");
+ context.fillStyle = colour;
+ context.fillRect(0, 0, 1, 1);
+ const [red, green, blue] = context.getImageData(0, 0, 1, 1).data;
+ return `rgb(${red}, ${green}, ${blue})`;
+ }, colour);
+ const accent = await markers.evaluate((element) =>
+ getComputedStyle(element).getPropertyValue("--stage-accent"));
+ assert.equal(await painted(accent), "rgb(255, 255, 255)", "the accent colour is white");
+ assert.equal(
+ await markerStyle("backgroundColor"),
+ await painted(accent),
+ "the line is drawn in the accent colour",
+ );
+ // Through the whole track: the blocks leave a margin above and below them, and the
+ // line runs on through both, as tall as the surface the blocks are laid out in.
+ within(
+ await markers.evaluate((element) => element.getBoundingClientRect().height),
+ markerTrack.height,
+ "the line is as tall as the track",
+ );
+ // A small chevron at either end of the line, each pointing to the line's centre.
+ assert.deepEqual(
+ await Promise.all(
+ ["::before", "::after"].map((which) => markerStyle("content", which)),
+ ),
+ ['""', '""'],
+ "each end of the line has a chevron",
+ );
+ /** How one end of the line is drawn, read from its computed style: how big its box
+ * is; the colours it paints; where its box stands against the line's, as its top and
+ * bottom edges and its centre against the line's; and which way the corner its two
+ * painted sides share points once turned, as a unit vector. */
+ const lineEnd = (which) =>
+ markers.evaluate((element, which) => {
+ const line = getComputedStyle(element);
+ const style = getComputedStyle(element, which);
+ const sides = ["Top", "Right", "Bottom", "Left"];
+ const widths = sides.map((side) => parseFloat(style[`border${side}Width`]));
+ // With its borders: what the chevron takes up in the line.
+ const box = {
+ width: parseFloat(style.width) + widths[1] + widths[3],
+ height: parseFloat(style.height) + widths[0] + widths[2],
+ left: parseFloat(style.left),
+ top: parseFloat(style.top),
+ };
+ const matrix = new DOMMatrix(
+ style.transform === "none" ? undefined : style.transform,
+ );
+ const corner = [
+ (widths[1] > 0 ? 1 : 0) - (widths[3] > 0 ? 1 : 0),
+ (widths[2] > 0 ? 1 : 0) - (widths[0] > 0 ? 1 : 0),
+ ];
+ const angle = Math.atan2(matrix.b, matrix.a);
+ return {
+ size: [box.width, box.height],
+ colours: [
+ ...sides
+ .filter((side, index) => widths[index] > 0)
+ .map((side) => style[`border${side}Color`]),
+ ...(style.backgroundColor === "rgba(0, 0, 0, 0)"
+ ? []
+ : [style.backgroundColor]),
+ ],
+ // In the line's own pixels, from its left and top edges.
+ centre: box.left + matrix.e + box.width / 2 - parseFloat(line.width) / 2,
+ top: box.top + matrix.f,
+ bottom: box.top + matrix.f + box.height - parseFloat(line.height),
+ turned: [
+ corner[0] * Math.cos(angle) - corner[1] * Math.sin(angle),
+ corner[0] * Math.sin(angle) + corner[1] * Math.cos(angle),
+ ],
+ };
+ }, which);
+ for (const which of ["::before", "::after"]) {
+ const { size } = await lineEnd(which);
+ assert.ok(
+ size.every((side) => side > 0 && side <= 10),
+ `${which} is a small chevron: ${size.join(" × ")}`,
+ );
+ }
+ for (const which of ["::before", "::after"]) {
+ const { colours } = await lineEnd(which);
+ assert.ok(colours.length > 0, `${which} paints something`);
+ assert.deepEqual(
+ [...new Set(colours)],
+ [await painted(accent)],
+ `${which} is drawn in the colour of the line`,
+ );
+ }
+ // One chevron at either end of the line, each centred on it.
+ const [topEnd, bottomEnd] = await Promise.all(
+ ["::before", "::after"].map(lineEnd),
+ );
+ within(topEnd.top, 0, "the first chevron stands at the top end of the line");
+ within(bottomEnd.bottom, 0, "the second chevron stands at the bottom end of the line");
+ for (const [which, end] of [["::before", topEnd], ["::after", bottomEnd]])
+ within(end.centre, 0, `${which} is centred on the line`);
+ // Each chevron is a corner turned to point at the line's centre: down from the top
+ // end, up from the bottom one.
+ within(topEnd.turned[0], 0, "the chevron at the top end points straight down the line");
+ assert.ok(topEnd.turned[1] > 0.7, "the chevron at the top end points to the line's centre");
+ within(bottomEnd.turned[0], 0, "the chevron at the bottom end points straight up the line");
+ assert.ok(
+ bottomEnd.turned[1] < -0.7,
+ "the chevron at the bottom end points to the line's centre",
+ );
+ // The line is a hint and takes no pointer of its own.
+ assert.equal(await markerStyle("pointerEvents"), "none", "the line takes no pointer");
+ // It is over every block: above the blocks at rest, above the block under the playhead,
+ // which is lifted over its neighbours, and above the carried block, which is lifted
+ // above all the others. `auto` is no lift at all, which counts as zero.
+ const levels = await surface.evaluate((element) => {
+ const level = (node) => {
+ const value = getComputedStyle(node).zIndex;
+ return value === "auto" ? 0 : Number(value);
+ };
+ return {
+ line: level(element.querySelector('[data-testid="director-stage-storyboard-insert-marker"]')),
+ blocks: [...element.querySelectorAll(".cw-stage-storyboard-block")].map(level),
+ shells: [...element.querySelectorAll(".cw-stage-storyboard-block-shell")].map(level),
+ };
+ });
+ assert.ok(
+ [...levels.blocks, ...levels.shells].every((level) => levels.line > level),
+ `the line is above every block: ${JSON.stringify(levels)}`,
+ );
+ // So where it stands on the second block, halfway up the lane, that block's fill gives
+ // way to the line's white. The carried block is out of the way by then.
+ await settledBoxes(
+ (shown) => Math.abs(shown[0].x - (restingBoxes[0].x + between - from.x)) <= 1,
+ );
+ const lineX = Math.floor(await lineCentre());
+ const [[under]] = await pixels({
+ x: lineX,
+ y: Math.floor(restingBoxes[1].y + restingBoxes[1].height / 2),
+ width: 1,
+ height: 1,
+ });
+ assert.deepEqual(under, [255, 255, 255], "the line is painted over the block it stands on");
+ // It is drawn in the Storyboard row, which the timeline stacks below the lane that
+ // draws the playhead. The row is a stacking context of its own, so nothing in it,
+ // however high, reaches over the playhead.
+ const stacked = await page.evaluate(() => {
+ const row = document.querySelector('.cw-stage-track-row[data-track-kind="shots"]');
+ const lane = document.querySelector(".cw-stage-track-playhead-lane");
+ return {
+ sameTimeline: row.parentElement === lane.parentElement,
+ row: Number(getComputedStyle(row).zIndex),
+ lane: Number(getComputedStyle(lane).zIndex),
+ };
+ });
+ assert.equal(
+ await shotsRow.getByTestId("director-stage-storyboard-insert-marker").count(),
+ 1,
+ "the line is drawn in the Storyboard row",
+ );
+ assert.equal(stacked.sameTimeline, true, "the row and the playhead lane share a timeline");
+ assert.ok(
+ stacked.row < stacked.lane,
+ `the Storyboard row is stacked below the playhead lane: ${JSON.stringify(stacked)}`,
+ );
+ // Flat against the right edge of the track, with its centre still short of the last
+ // block's centre (4.2 s against 4.5 s), the block is let in last all the same: the
+ // pointer cannot take it further than the edge of the window, so the edge is where it
+ // is put. The line stands at the end of the last block, which here is the end of the
+ // track, kept just inside it.
+ const rightEdge = markerTrack.x + markerTrack.width;
+ await moveInFrames(from.x + unit * 3.2, to.y);
+ await settledBoxes((shown) => Math.abs(shown[0].x + shown[0].width - rightEdge) <= 1);
+ within(
+ (await blockBoxes())[0].x + (await blockBoxes())[0].width,
+ rightEdge,
+ "the carried block is flat against the right edge of the track",
+ );
+ await lineAt(
+ 5,
+ "flat against the right edge, the block is let in last although its centre is short of the last block's centre",
+ );
+ // Past the centre of the last block too, in the same drag, the track does not show the
+ // new order until the block is let go.
+ await moveInFrames(to.x + 8, to.y);
+ assert.deepEqual(
+ (await blockBoxes()).slice(1),
+ restingBoxes.slice(1),
+ "the other blocks do not give way",
+ );
+ assert.equal(
+ await activeBlock().getAttribute("data-block-id"),
+ firstId,
+ "the outline stays on the block under the playhead",
+ );
+ assert.equal(await playhead(), "1", "the playhead does not move while a block is dragged");
+ assert.deepEqual(readEditedStage(await state()), startingStage);
+ // Last of the three, the block is let in where the line already stood when it came to
+ // the edge of the track.
+ await lineAt(5, "carried past a second block, the line stands at the end of the Storyboard");
+ // The block stays inside the track. Carried past the track's edge, on either side, it
+ // stops with its own edge at the track's edge while the pointer goes on without it.
+ // The track ends at the window's edge, so a pointer past its right edge is one that
+ // has left the window; that the page receives it where it is is checked itself.
+ await page.evaluate(() => {
+ window.__storyboardPointerX = null;
+ window.addEventListener(
+ "pointermove",
+ (event) => { window.__storyboardPointerX = event.clientX; },
+ true,
+ );
+ });
+ const trackBox = await surface.boundingBox();
+ const trackRight = trackBox.x + trackBox.width;
+ const stoppedAt = async (edge, what) => {
+ dragBoxes = await settledBoxes((shown) => Math.abs(shown[0].x - edge) <= 1);
+ within(dragBoxes[0].x, edge, what);
+ };
+ await stoppedAt(
+ trackRight - restingBoxes[0].width,
+ "the dragged block stays inside the right edge of the track",
+ );
+ await moveInFrames(trackRight + 200, to.y);
+ assert.equal(
+ await page.evaluate(() => window.__storyboardPointerX),
+ trackRight + 200,
+ "the page receives the pointer past the window's edge",
+ );
+ await stoppedAt(
+ trackRight - restingBoxes[0].width,
+ "the dragged block stops at the right edge of the track",
+ );
+ // The pointer goes on past the track, and where the block would land goes with it:
+ // still last, so the line stays where it was.
+ await lineAt(5, "the line stays at the last place while the pointer is past the track");
+ await moveInFrames(trackBox.x - 200, to.y);
+ await stoppedAt(trackBox.x, "the dragged block stops at the left edge of the track");
+ assert.equal(await activeBlock().getAttribute("data-block-id"), firstId);
+ assert.equal(await playhead(), "1");
+ // Carried back to where it starts, a release would keep the order: no line.
+ assert.equal(
+ await markers.count(),
+ 0,
+ "no line once the block is carried back into its own place",
+ );
+ await moveInFrames(to.x + 8, to.y);
+ await stoppedAt(
+ trackRight - restingBoxes[0].width,
+ "the dragged block follows the pointer back",
+ );
+ await lineAt(5, "carried out of its own place again, the line is back");
+ // Carried, the block is lifted: over the blocks it passes, with a shadow under it
+ // and a little see-through, and otherwise the block it was.
+ within(dragBoxes[0].width, restingBoxes[0].width, "the dragged block keeps its width");
+ within(dragBoxes[0].height, restingBoxes[0].height, "the dragged block keeps its height");
+ const lifted = await liftOf();
+ assert.ok(
+ Math.abs(lifted.opacity - 0.9) <= 0.01,
+ `the dragged block is a little see-through: ${lifted.opacity}`,
+ );
+ assert.notEqual(lifted.shadow, "none", "the dragged block has a shadow under it");
+ assert.notEqual(
+ lifted.shadow,
+ restingLift.shadow,
+ "the shadow is the drag's, not one the block has at rest",
+ );
+ assert.equal(
+ await page.evaluate(
+ ([x, y]) =>
+ document
+ .elementsFromPoint(x, y)
+ .map((element) => element.closest("[data-block-id]")?.dataset.blockId)
+ .find(Boolean) ?? null,
+ [trackBox.x + trackBox.width * 0.9, to.y],
+ ),
+ firstId,
+ "the dragged block is over the blocks it passes",
+ );
+ /** How the first block itself is painted: its outline, its shadow, its fill, its
+ * edge and the colour of its name. */
+ const paintOfFirst = () =>
+ blocks.first().evaluate((element) => {
+ const style = getComputedStyle(element);
+ return [
+ style.outlineStyle,
+ style.outlineWidth,
+ style.outlineColor,
+ style.outlineOffset,
+ style.boxShadow,
+ style.backgroundColor,
+ style.borderColor,
+ style.color,
+ ];
+ });
+ /** Whether the first block shows the ring keyboard focus gives a stage button: an
+ * outline, or a shadow, in the focus colour the page names. */
+ const keyboardRing = async () => {
+ const { focus, outline, shadow } = await blocks.first().evaluate((element) => {
+ const style = getComputedStyle(element);
+ return {
+ focus: style.getPropertyValue("--stage-focus").trim(),
+ outline: [style.outlineStyle, style.outlineColor],
+ shadow: style.boxShadow,
+ };
+ });
+ const colour = await painted(focus);
+ return {
+ shown:
+ (outline[0] !== "none" && outline[1] === colour) || shadow.includes(colour),
+ };
+ };
+ const carriedPaint = await paintOfFirst();
+ assert.equal(
+ await blocks.first().evaluate((element) => element.matches(":focus-visible")),
+ false,
+ "this carry is an ordinary one: the block is not in keyboard focus",
+ );
+ await shootTimeline("carried");
+ await page.keyboard.press("Escape");
+ assert.deepEqual(await liftOf(), restingLift, "Escape lets the dragged block down");
+ assert.deepEqual(
+ await blockBoxes(),
+ restingBoxes,
+ "Escape puts the dragged block back at once",
+ );
+ assert.equal(await markers.count(), 0, "Escape takes the line away");
+ await page.mouse.up();
+ assert.deepEqual((await blockStates()).map(({ id }) => id), startingIds);
+ assert.equal(await activeBlock().getAttribute("data-block-id"), firstId);
+ assert.deepEqual(gestureCommands, [], "Escape writes nothing");
+
+ // That Escape was a key press, and from it the block that had the press is in
+ // keyboard focus. Pressed and carried again, it is the block it was a moment ago,
+ // selected and under the playhead, and it is painted as it was then: lifted over the
+ // others, with no ring and no fill of keyboard focus. A keyboard user is never in a
+ // drag, so no focus is hidden from anyone. Once the drag is over the ring is back.
+ await page.mouse.move(from.x, from.y);
+ await page.mouse.down();
+ await moveInFrames(from.x + 40, from.y);
+ await settledBoxes(
+ (shown) => Math.abs(shown[0].x - (restingBoxes[0].x + 40)) <= 1,
+ );
+ assert.equal(
+ await blocks.first().evaluate((element) => element.matches(":focus-visible")),
+ true,
+ "after the Escape the block pressed again is in keyboard focus",
+ );
+ assert.equal(
+ (await keyboardRing()).shown,
+ false,
+ "a carried block shows no ring of keyboard focus",
+ );
+ assert.deepEqual(
+ await paintOfFirst(),
+ carriedPaint,
+ "carried with keyboard focus, the block is painted as it was without it",
+ );
+ await shootTimeline("carried-with-keyboard-focus");
+ await page.keyboard.press("Escape");
+ await page.mouse.up();
+ assert.deepEqual(await blockBoxes(), restingBoxes, "the second Escape puts the block back at once");
+ assert.equal((await keyboardRing()).shown, true, "once the drag is over, the ring of keyboard focus is back");
+ assert.deepEqual(gestureCommands, [], "a drag cancelled twice writes nothing");
+
+ assert.equal(await resizeHandle(0, "left").count(), 0, "time zero has no resize handle");
+ const beforeCancel = await resizeHandle(0, "right").boundingBox();
+ const internal = await center(resizeHandle(0, "right"));
+ await page.mouse.move(internal.x, internal.y);
+ await page.mouse.down();
+ await moveInFrames(internal.x - 20, internal.y);
+ assert.ok((await resizeHandle(0, "right").boundingBox()).x < beforeCancel.x);
+ assert.equal(await markers.count(), 0, "a resize shows no line");
+ assert.equal(
+ await cursorOf(surface),
+ "ew-resize",
+ "a boundary being resized keeps its cursor from the surface",
+ );
+ await page.evaluate(() => {
+ document.querySelector('[data-testid="director-stage-storyboard-resize-handle"][data-edge="right"]')
+ .dispatchEvent(new PointerEvent("pointercancel", {
+ bubbles: true, pointerId: 1, pointerType: "mouse", isPrimary: true,
+ }));
+ });
+ await page.mouse.up();
+ assert.deepEqual(await resizeHandle(0, "right").boundingBox(), beforeCancel);
+ assert.deepEqual(gestureCommands, [], "pointer cancellation writes nothing");
+ assert.deepEqual(readEditedStage(await state()), startingStage);
+
+ const fullEnd = await center(resizeHandle(2, "right"));
+ const trackStart = (await blocks.first().boundingBox()).x;
+ for (const [handle, offset] of [
+ [internal, trackStart - internal.x - 20],
+ [fullEnd, 32],
+ ]) {
+ await page.mouse.move(handle.x, handle.y);
+ await page.mouse.down();
+ await moveInFrames(handle.x + offset, handle.y);
+ await page.mouse.up();
+ }
+ assert.deepEqual(gestureCommands, [], "zero length and timeline overflow write nothing");
+ assert.deepEqual(readEditedStage(await state()), startingStage);
+
+ // The shared command saves these cuts even if a different stage edit is pending.
+ await blocks.last().click();
+ const draftCameraName = "Unsaved camera name";
+ await cameraNameInput.fill(draftCameraName);
+ await cameraNameInput.press("Tab");
+ await blocks.last().getByText(draftCameraName, { exact: true }).waitFor();
+ // The press is on the block's thumbnail. The picture is part of the block: it is
+ // dragged with the block, and is not a picture for the browser to drag away.
+ const shotPicture = blocks.first().locator(".cw-stage-storyboard-block-thumbnail img");
+ await blocks.first().and(page.locator('[data-thumbnail-state="ready"]')).waitFor();
+ await shotPicture.waitFor();
+ const picturePoint = await center(shotPicture);
+ assert.equal(
+ await page.evaluate(
+ ([x, y]) => document.elementFromPoint(x, y)?.tagName,
+ [picturePoint.x, picturePoint.y],
+ ),
+ "IMG",
+ "the press lands on the picture",
+ );
+ await page.mouse.move(picturePoint.x, picturePoint.y);
+ await page.mouse.down();
+ /** How long the block waits before it follows: from the first pointer move after the
+ * press, read in the page, to the first frame at whose start the block's box has left
+ * its place. */
+ const followLag = page.evaluate(
+ (blockId) =>
+ new Promise((resolve, reject) => {
+ const shell = document.querySelector(
+ `[data-testid="director-stage-storyboard-block"][data-block-id="${blockId}"]`,
+ ).parentElement;
+ const origin = shell.getBoundingClientRect().left;
+ const deadline = performance.now() + 5000;
+ let started = null;
+ let moved = null;
+ const onMove = () => {
+ window.removeEventListener("pointermove", onMove, true);
+ started = performance.now();
+ };
+ window.addEventListener("pointermove", onMove, true);
+ const tick = () => {
+ if (shell.getBoundingClientRect().left !== origin) moved ??= performance.now();
+ if (moved !== null) return resolve(moved - started);
+ if (performance.now() > deadline)
+ return reject(new Error("the block never began to follow the pointer"));
+ requestAnimationFrame(tick);
+ };
+ requestAnimationFrame(tick);
+ }),
+ firstId,
+ );
+ await page.mouse.move(to.x + 8, to.y);
+ const firstDragFeedbackMs = await followLag;
+ assert.equal(
+ await activeBlock().getAttribute("data-block-id"),
+ firstId,
+ "the outline does not follow the drag",
+ );
+ assert.deepEqual(readEditedStage(await state()), startingStage);
+ assert.deepEqual(gestureCommands, [], "drag feedback writes nothing");
+ // Flat against the right edge of the track, its centre still short of the last block's
+ // centre (4.2 s against 4.5 s), the block would be saved last all the same; and out of
+ // the track, up here, it would still land there.
+ const flushX = picturePoint.x + unit * 3.2;
+ await moveInFrames(flushX, to.y);
+ await settledBoxes((shown) => Math.abs(shown[0].x + shown[0].width - rightEdge) <= 1);
+ await lineAt(
+ 5,
+ "flat against the right edge, the block would be saved last although its centre is short of the last block's centre",
+ );
+ await moveInFrames(flushX, 2);
+ await lineAt(5, "the line stays while the pointer is above the track");
+ const reordered = [
+ [secondId, secondShot.cameraId, 0, 2],
+ [thirdId, lastShot.cameraId, 2, 1],
+ [firstId, firstShot.cameraId, 3, 2],
+ ];
+ // The reply to the reorder is held back a few frames, and the track is written down
+ // frame by frame from before the release until the reply has landed, so that every
+ // state it passes through is seen: the release sets the new order at once, with the
+ // carried block let down in the same frame and the playhead at the block's new start,
+ // and the reply moves nothing.
+ const reorderReply = await holdReplies("director.storyboard.reorder");
+ await page.evaluate(`(() => {
+ window.__storyboardTrackFrames = [];
+ // The playhead's time, read in the same frames: one entry per frame of the track.
+ window.__storyboardPlayheadFrames = [];
+ const tick = () => {
+ window.__storyboardTrackFrames.push(${trackBoxesSource});
+ window.__storyboardPlayheadFrames.push(
+ document.querySelector(".cw-stage-playhead-slider")?.value ?? null,
+ );
+ if (window.__storyboardTrackFrames.length < 600) requestAnimationFrame(tick);
+ };
+ requestAnimationFrame(tick);
+ })()`);
+ await passFrames(4);
+ await page.mouse.up();
+ await reorderReply.reached;
+ assert.equal(await markers.count(), 0, "the release takes the line away");
+ await passFrames(4);
+ reorderReply.release();
+ await reorderReply.released;
+ await page.unroute("**/commands");
+ await expectSavedShape(
+ reordered,
+ "an outside release saves the reorder begun on a thumbnail",
+ );
+ // Both are read together: the track is written down until long after.
+ const [trackFrames, playheadFrames] = await page.evaluate(() => [
+ window.__storyboardTrackFrames,
+ window.__storyboardPlayheadFrames,
+ ]);
+ const idsOf = (frame) => frame.map(({ id }) => id);
+ const newOrderFrom = trackFrames.findIndex(
+ (frame) => JSON.stringify(idsOf(frame)) === JSON.stringify([secondId, thirdId, firstId]),
+ );
+ assert.ok(
+ newOrderFrom >= 4,
+ `the track is written down on both sides of the release: ${trackFrames.length} frames, the new order from frame ${newOrderFrom}`,
+ );
+ // Before the release: the old order, with the carried block where it was carried to.
+ const carriedX = trackRight - restingBoxes[0].width;
+ for (const frame of trackFrames.slice(0, newOrderFrom)) {
+ within(frame[0].x, carriedX, "before the release the block is where it was carried");
+ assert.equal(frame[0].lift, "0.9", "before the release the block is carried");
+ }
+ // After it: the new order, at rest, the same in every frame from the first one.
+ const total = startingStage.data.duration;
+ const placed = reordered.map(([id, , start, duration]) => ({
+ id,
+ x: trackBox.x + (start / total) * trackBox.width,
+ width: (duration / total) * trackBox.width,
+ }));
+ for (const [index, { id, x, width }] of placed.entries()) {
+ within(trackFrames[newOrderFrom][index].x, x, `block ${id} stands at its new start at once`);
+ within(trackFrames[newOrderFrom][index].width, width, `block ${id} keeps its length`);
+ assert.equal(
+ trackFrames[newOrderFrom][index].lift,
+ "1",
+ `block ${id} is let down in the frame of the release`,
+ );
+ }
+ for (const [number, frame] of trackFrames.slice(newOrderFrom).entries())
+ assert.deepEqual(
+ frame,
+ trackFrames[newOrderFrom],
+ `frame ${newOrderFrom + number} after the release differs from the first`,
+ );
+ // The playhead goes with the dragged block, and once: it keeps its time to the end
+ // of the drag, and from the first frame of the new order it stands where that block
+ // now starts, through the wait for the reply and after it.
+ assert.equal(playheadFrames.length, trackFrames.length, "the playhead is read in the frames of the track");
+ assert.deepEqual(
+ [...new Set(playheadFrames.slice(0, newOrderFrom))],
+ ["1"],
+ "the playhead keeps its time until the release",
+ );
+ assert.deepEqual(
+ [...new Set(playheadFrames.slice(newOrderFrom))],
+ ["3"],
+ "from the frame of the release on, the playhead is at the dragged block's new start",
+ );
+ assert.deepEqual(
+ await boxLooks(),
+ Array.from({ length: 3 }, () => ["1", "none", "none"]),
+ "after the release no block is carried",
+ );
+ assert.deepEqual(
+ await blocks.evaluateAll((elements) =>
+ elements.map((element) => getComputedStyle(element.parentElement).transitionDuration),
+ ),
+ ["0s", "0s", "0s"],
+ "no block travels to its place",
+ );
+ assert.deepEqual(await trackBoxes(), trackFrames.at(-1), "the reply moves no block");
+ assert.deepEqual(gestureCommands, ["director.storyboard.reorder"]);
+ await blocks.last().and(page.locator('[aria-pressed="true"]')).waitFor();
+ assert.equal(await blocks.last().getAttribute("data-block-id"), firstId);
+ assert.deepEqual(
+ (await blockStates()).map(({ selected }) => selected),
+ ["false", "false", "true"],
+ "only the block that was dragged is selected",
+ );
+ assert.equal((await blockStates())[1].name, draftCameraName, "the unsaved camera name stays in the editor");
+ // The dragged block is last now, and starts three seconds in: the playhead went to
+ // it, so the outline is on it there, where the block that is first now used to be.
+ assert.equal(
+ await playhead(),
+ "3",
+ "a release that changes the order takes the playhead to where the dragged block starts",
+ );
+ assert.equal(
+ await activeBlock().getAttribute("data-block-id"),
+ firstId,
+ "the block under the playhead is the one that was dragged, at its new start",
+ );
+
+ // The last block is carried past the threshold and brought back to where the order
+ // would not change. Let go there, it goes back to its own place at once, and nothing
+ // comes of the drag: no write, the playhead and the selection as they were, and undo
+ // still waiting on the reorder.
+ const docked = await blockBoxes();
+ const savedAfterReorder = readEditedStage(await state());
+ const lastHome = await center(blocks.last());
+ const shortCarry = lastHome.x - 60;
+ const restLook = Array.from({ length: 3 }, () => ["1", "none", "none"]);
+ const carryLast = async () => {
+ await page.mouse.move(lastHome.x, lastHome.y);
+ await page.mouse.down();
+ await moveInFrames(shortCarry, lastHome.y);
+ dragBoxes = await settledBoxes(
+ (shown) => Math.abs(shown[2].x - (docked[2].x - 60)) <= 1,
+ );
+ within(dragBoxes[2].x, docked[2].x - 60, "the last block is carried");
+ assert.equal(
+ await deleteBlock.count(),
+ 0,
+ "no delete button is in the track while a block is carried",
+ );
+ assert.equal(
+ await markers.count(),
+ 0,
+ "no line while a release would keep the order",
+ );
+ };
+ await carryLast();
+ await moveInFrames(lastHome.x, lastHome.y);
+ await page.mouse.up();
+ assert.deepEqual(
+ await blockBoxes(),
+ docked,
+ "a release that keeps the order puts the block back at once",
+ );
+ assert.deepEqual(await boxLooks(), restLook, "the block is let down");
+ assert.equal(await deleteBlock.count(), 3);
+ // From here on the playhead stands where the reorder took it, three seconds in. No
+ // way of ending a drag below, and no resize, is to move it.
+ assert.equal(await playhead(), "3", "a release that keeps the order moves no playhead");
+ assert.deepEqual(
+ (await blockStates()).map(({ selected }) => selected),
+ ["false", "false", "true"],
+ "a release that keeps the order changes no selection",
+ );
+ assert.equal(await stageUndo.isEnabled(), true, "undo still has the reorder to take back");
+
+ // A pointer the browser cancels and a window that loses its focus end the drag the
+ // same way: the block is back at once and let down, and nothing is written.
+ for (const [how, end] of [
+ [
+ "a cancelled pointer",
+ () =>
+ blocks.last().dispatchEvent("pointercancel", {
+ pointerId: 1,
+ pointerType: "mouse",
+ isPrimary: true,
+ }),
+ ],
+ [
+ "a window that loses its focus",
+ () => page.evaluate(() => window.dispatchEvent(new Event("blur"))),
+ ],
+ ]) {
+ await carryLast();
+ await end();
+ assert.deepEqual(await blockBoxes(), docked, `${how} puts the block back at once`);
+ assert.deepEqual(await boxLooks(), restLook, `${how} lets the block down`);
+ await page.mouse.up();
+ }
+ assert.equal(await playhead(), "3", "a cancelled pointer and a lost focus move no playhead");
+ assert.deepEqual(
+ gestureCommands,
+ ["director.storyboard.reorder"],
+ "a release that keeps the order, a cancelled pointer and a lost focus write nothing",
+ );
+ assert.deepEqual(readEditedStage(await state()), savedAfterReorder);
+
+ // The Storyboard is [second, 2 s] [third, 1 s] [first, 2 s]. Wherever the line stands
+ // is the gap the carried block would be let into, whichever way it is carried: before
+ // the block that would then follow it, at the end of the last block when it would be
+ // last, at the start of the track when it would be first. Both ways are read in the
+ // drag itself and then cancelled: nothing moves or is written.
+ // Carried left. Past the centre of the one-second block, the last block would be let in
+ // before it, on the boundary the second and third blocks make already. Past the centre
+ // of the second block too, it would come first of all: the line jumps to the start of
+ // the track, in the same drag.
+ await page.mouse.move(lastHome.x, lastHome.y);
+ await page.mouse.down();
+ await moveInFrames(lastHome.x - unit * 2.25, lastHome.y);
+ const onTheBoundary = await lineAt(
+ 2,
+ "carried left, the line stands where the block would be let in",
+ );
+ within(
+ onTheBoundary,
+ (docked[0].x + docked[0].width + docked[1].x) / 2,
+ "carried left, the line is on the boundary the second and third blocks make",
+ );
+ await moveInFrames(lastHome.x - unit * 3.5, lastHome.y);
+ await lineAt(
+ 0,
+ "carried left past a second block, the line jumps to the start of the track",
+ );
+ await page.keyboard.press("Escape");
+ await page.mouse.up();
+ assert.deepEqual(await blockBoxes(), docked, "Escape puts the last block back at once");
+ assert.equal(await markers.count(), 0, "Escape takes the line away");
+ // Carried right. The one-second block, past the centre of the two-second block after
+ // it, would be let in after that block: last of all. The line stands at the right edge
+ // of that block (3–5 s) as it lies now, the end of the Storyboard and of the track,
+ // and not in the middle of it, where four seconds is.
+ const middleHome = await center(blocks.nth(1));
+ await page.mouse.move(middleHome.x, middleHome.y);
+ await page.mouse.down();
+ await moveInFrames(middleHome.x + unit * 1.75, middleHome.y);
+ const atTheEnd = await lineAt(
+ 5,
+ "carried right past a block, the line stands at the end of the Storyboard, where the block would be let in after the last one",
+ );
+ assert.ok(
+ atTheEnd > docked[2].x + docked[2].width - 6 && atTheEnd <= docked[2].x + docked[2].width,
+ `carried right, the line is at the right edge of the block it passed, kept just inside it: ${atTheEnd} against ${docked[2].x + docked[2].width}`,
+ );
+ assert.ok(
+ atTheEnd > docked[2].x + docked[2].width / 2 + 1,
+ `carried right, the line is not in the middle of the block it passed: ${atTheEnd} against ${docked[2].x + docked[2].width / 2}`,
+ );
+ await page.keyboard.press("Escape");
+ await page.mouse.up();
+ assert.deepEqual(await blockBoxes(), docked, "Escape puts the one-second block back at once");
+ assert.deepEqual(await boxLooks(), restLook, "neither cancelled drag leaves a block carried");
+ assert.equal(await markers.count(), 0, "neither cancelled drag leaves a line");
+ assert.equal(await playhead(), "3", "a cancelled drag moves no playhead");
+ assert.deepEqual(
+ (await blockStates()).map(({ selected }) => selected),
+ ["false", "false", "true"],
+ "a cancelled drag changes no selection",
+ );
+ assert.deepEqual(
+ gestureCommands,
+ ["director.storyboard.reorder"],
+ "the two cancelled drags write nothing",
+ );
+ assert.deepEqual(readEditedStage(await state()), savedAfterReorder);
+
+ await resizeHandle(1, "left").waitFor();
+ const leftEdge = await center(resizeHandle(1, "left"));
+ await page.mouse.move(leftEdge.x, leftEdge.y);
+ await page.mouse.down();
+ await moveInFrames(leftEdge.x - unit / 2, leftEdge.y);
+ assert.deepEqual(gestureCommands, ["director.storyboard.reorder"]);
+ await page.mouse.up();
+ const closeToShape = (document, expected) => {
+ const actual = shape(document);
+ return actual.length === expected.length && actual.every(
+ ([id, cameraId, start, duration], index) => {
+ const [expectedId, expectedCamera, expectedStart, expectedDuration] = expected[index];
+ return id === expectedId && cameraId === expectedCamera &&
+ Math.abs(start - expectedStart) < 0.01 &&
+ Math.abs(duration - expectedDuration) < 0.01;
+ },
+ );
+ };
+ const expectNearSavedShape = async (expected, label) => {
+ const snapshot = await until(
+ (snapshot) => closeToShape(readEditedStage(snapshot), expected),
+ label,
+ );
+ const document = readEditedStage(snapshot);
+ assertOnlyShotsChanged(document);
+ return document;
+ };
+ const resized = [
+ [secondId, secondShot.cameraId, 0, 1.5],
+ [thirdId, lastShot.cameraId, 1.5, 1],
+ [firstId, firstShot.cameraId, 2.5, 2],
+ ];
+ const insideSaved = await expectNearSavedShape(resized, "left handle ripples the blocks to its right");
+
+ await resizeHandle(2, "right").waitFor();
+ const beforeTerminal = await blockStates();
+ const endEdge = await center(resizeHandle(2, "right"));
+ await page.mouse.move(endEdge.x, endEdge.y);
+ await page.mouse.down();
+ await moveInFrames(endEdge.x + unit / 4, endEdge.y);
+ await page.mouse.up();
+ const extended = [...resized.slice(0, 2), [firstId, firstShot.cameraId, 2.5, 2.25]];
+ const endSaved = await expectNearSavedShape(extended, "last edge extends the Storyboard");
+ assert.deepEqual(gestureCommands, [
+ "director.storyboard.reorder", "director.storyboard.resize", "director.storyboard.resize",
+ ]);
+ await resizeHandle(2, "right").waitFor();
+ assert.equal(await playhead(), "3", "a resize moves no playhead");
+ const afterTerminal = await blockStates();
+ await stageUndo.click();
+ assert.deepEqual(await blockStates(), beforeTerminal);
+ // While a block is carried, the controls that would change the Storyboard wait for
+ // it: undo and redo, which each have a step to take here, by their buttons and by
+ // their keys, and every block's delete button. All are back when the drag is over.
+ assert.equal(await deleteBlock.count(), 3, "a block at rest has its delete button");
+ assert.equal(await stageUndo.isEnabled(), true);
+ assert.equal(await stageRedo.isEnabled(), true);
+ const carried = await center(blocks.last());
+ await page.mouse.move(carried.x, carried.y);
+ await page.mouse.down();
+ await moveInFrames(carried.x - 60, carried.y);
+ assert.equal(await stageUndo.isDisabled(), true, "undo waits while a block is carried");
+ assert.equal(await stageRedo.isDisabled(), true, "redo waits while a block is carried");
+ assert.equal(
+ await deleteBlock.count(),
+ 0,
+ "no delete button is in the track while a block is carried",
+ );
+ await page.keyboard.press("Control+z");
+ await page.keyboard.press("Control+Shift+z");
+ assert.deepEqual(
+ await blockStates(),
+ beforeTerminal,
+ "the undo and redo keys do nothing while a block is carried",
+ );
+ await page.keyboard.press("Escape");
+ await page.mouse.up();
+ assert.equal(await stageUndo.isEnabled(), true, "undo is back once the drag is over");
+ assert.equal(await stageRedo.isEnabled(), true, "redo is back once the drag is over");
+ assert.equal(await deleteBlock.count(), 3);
+ // Flat against the left edge of the track, with its centre still to the right of the
+ // first block's centre (0.9 s against 0.75 s), the two-second block is let in first
+ // all the same, and the line stands at the start of the track.
+ const wideHome = await center(blocks.last());
+ await page.mouse.move(wideHome.x, wideHome.y);
+ await page.mouse.down();
+ await moveInFrames(wideHome.x - unit * 2.6, wideHome.y);
+ await settledBoxes((shown) => Math.abs(shown[2].x - markerTrack.x) <= 1);
+ within(
+ (await blockBoxes())[2].x,
+ markerTrack.x,
+ "the two-second block is flat against the left edge of the track",
+ );
+ await lineAt(
+ 0,
+ "flat against the left edge, the block is let in first although its centre is to the right of the first block's centre",
+ );
+ await page.keyboard.press("Escape");
+ await page.mouse.up();
+ assert.deepEqual(await blockStates(), beforeTerminal, "that Escape puts the block back");
+ await stageRedo.click();
+ assert.deepEqual(await blockStates(), afterTerminal);
+ assert.equal(gestureCommands.length, 3, "local undo and redo stay in the draft");
+ page.off("request", observeMoves);
+
+ // A save the server refuses takes the order and the playhead back together. While the
+ // editor is open, the same document is changed through the HTTP command endpoint, as
+ // an Agent would change it. The editor still holds the version from before that
+ // change, so the reorder the next drag ends in is refused as a conflict instead of
+ // overwriting it. The one-second block is carried to the end of the track.
+ const beforeRefusedReorder = director(await state(), itemId).document;
+ assert.equal(
+ (
+ await send(
+ "director.apply",
+ {
+ document: {
+ ...payloadOf(beforeRefusedReorder),
+ data: { ...beforeRefusedReorder.data, duration: 8 },
+ },
+ },
+ [version(beforeRefusedReorder)],
+ )
+ ).status,
+ "applied",
+ );
+ const orderBefore = [secondId, thirdId, firstId];
+ await playheadSlider.fill("1");
+ assert.equal(
+ await activeBlock().getAttribute("data-block-id"),
+ secondId,
+ "the playhead is on the first block before the drag",
+ );
+ gestureCommands.length = 0;
+ page.on("request", observeMoves);
+ // The refused reply is held back, so the track is seen as the release left it: the
+ // new order and the playhead at the dragged block's new start, before the server
+ // has answered.
+ const refusalReply = await holdReplies("director.storyboard.reorder");
+ const oneSecondHome = await center(blocks.nth(1));
+ const endHome = await center(blocks.last());
+ await page.mouse.move(oneSecondHome.x, oneSecondHome.y);
+ await page.mouse.down();
+ await moveInFrames(endHome.x + 8, endHome.y);
+ // Let go here and the one-second block is last: the line stands where the last block
+ // ends, at the lengths the server stored for them, and not at the end of the track,
+ // which lies a quarter of a second further right. The lengths came from drags of the
+ // handles, so they are read and not assumed.
+ const endOfStoryboard = endSaved.data.shots.reduce(
+ (sum, { duration }) => sum + duration,
+ 0,
+ );
+ await lineAt(
+ endOfStoryboard,
+ "carried to the end, the line stands at the end of the last block, not at the end of the track",
+ );
+ assert.equal(await playhead(), "1", "the playhead keeps its time while the block is carried");
+ await page.mouse.up();
+ await refusalReply.reached;
+ assert.deepEqual(
+ (await blockStates()).map(({ id }) => id),
+ [secondId, firstId, thirdId],
+ "the release shows the new order while the save is in flight",
+ );
+ // The playhead went with the dragged block: its line stands on the block's new left
+ // edge, and the outline is on the block there. The slider shows the time only to
+ // the frame, so where the playhead is read from the line it draws.
+ const playheadLineX = () =>
+ timeline.locator(".cw-stage-track-playhead").evaluate((element) => {
+ const { x, width } = element.getBoundingClientRect();
+ return x + width / 2;
+ });
+ within(
+ await playheadLineX(),
+ (await blockBoxes())[2].x,
+ "while the save is in flight, the playhead line stands where the dragged block now starts",
+ );
+ assert.equal(
+ await activeBlock().getAttribute("data-block-id"),
+ thirdId,
+ "the outline is on the dragged block at its new start",
+ );
+ refusalReply.release();
+ await refusalReply.released;
+ await page.unroute("**/commands");
+ await page.locator(".cw-stage-error").filter({ hasText: L.revisionConflict }).waitFor();
+ page.off("request", observeMoves);
+ assert.deepEqual(
+ (await blockStates()).map(({ id }) => id),
+ orderBefore,
+ "the refused save puts the blocks back in the order they had",
+ );
+ assert.equal(
+ await playhead(),
+ "1",
+ "the refused save puts the playhead back where it stood",
+ );
+ assert.equal(
+ await activeBlock().getAttribute("data-block-id"),
+ secondId,
+ "the refused save puts the outline back on the block under that time",
+ );
+ assert.deepEqual(
+ gestureCommands,
+ ["director.storyboard.reorder"],
+ "the refused save was attempted once",
+ );
+ assert.equal(await add.isEnabled(), true, "`+` is usable again after the refusal");
+ const afterRefusal = director(await state(), itemId).document;
+ assert.equal(afterRefusal.data.duration, 8, "the change made outside the editor stays");
+ assert.deepEqual(shape(afterRefusal), shape(endSaved), "the refused save writes nothing");
+
+ await page.getByRole("button", { name: L.closeEditor, exact: true }).click();
+ await page.getByRole("button", { name: L.discardClose, exact: true }).click();
+ await apply.waitFor({ state: "detached" });
+ // The change made outside the editor is the project's latest step, so it is the first
+ // one undo takes back. The Storyboard edits follow it, one step each. What is waited
+ // for is the change itself, the main duration: the Storyboard it left as it was.
+ await toolbarUndo.click();
+ const takenBack = readEditedStage(await until(
+ (snapshot) => readEditedStage(snapshot).data.duration === endSaved.data.duration,
+ "a single undo takes back the change made outside the editor",
+ ));
+ assert.deepEqual(shape(takenBack), shape(endSaved), "that undo leaves the Storyboard as it was");
+ assertOnlyShotsChanged(takenBack);
+ await toolbarUndo.click();
+ await expectSavedShape(shape(insideSaved), "a single undo restores the terminal resize");
+ await toolbarUndo.click();
+ await expectSavedShape(reordered, "a single undo restores all rippled positions");
+ await toolbarUndo.click();
+ await expectSavedShape(shape(startingStage), "a single undo restores the original order");
+ await toolbarRedo.click();
+ await expectSavedShape(reordered, "a single redo reapplies the reorder");
+ await toolbarRedo.click();
+ await expectSavedShape(shape(insideSaved), "a single redo reapplies the ripple");
+ await toolbarRedo.click();
+ await expectSavedShape(shape(endSaved), "a single redo reapplies the terminal resize");
+ await reopenEditor();
+ assert.deepEqual((await blockStates()).map(({ id }) => id), storedIds(endSaved));
+
+ // The shared duration command changes the scale before the next resize.
+ gestureCommands.length = 0;
+ page.on("request", observeMoves);
+ await durationInput.fill("6");
+ await durationInput.press("Tab");
+ // The duration command is asynchronous. Wait for block geometry to reflect
+ // the acknowledged six-second scale before measuring pixels per second.
+ await page.waitForFunction(() => {
+ const block = document.querySelectorAll('[data-testid="director-stage-storyboard-block"]')[1];
+ return block && Math.abs(parseFloat(block.parentElement.style.width) - 100 / 6) < 0.001;
+ });
+
+ // A drag that was cancelled is over: the block is back, let down, and nothing is
+ // written. Until the mouse is let go, though, the press is still the track's own.
+ // The main timeline is now longer than the Storyboard, so the lane has an empty
+ // stretch after its last block: there the pointer is over the lane itself, whose
+ // click moves the playhead. Above it lies the ruler, under the playhead's slider.
+ // After each way of cancelling a drag the pointer goes to the empty stretch, and
+ // then to the ruler, and is let go: the playhead, the block under it, the selection
+ // and the stored document stay as they were, and nothing is written.
+ const laneBox = await surface.boundingBox();
+ const laneResting = await blockBoxes();
+ const laneEmptyFrom = laneResting.at(-1).x + laneResting.at(-1).width;
+ assert.ok(
+ laneBox.x + laneBox.width - laneEmptyFrom > 40,
+ `the lane has an empty stretch after its last block: ${laneBox.x + laneBox.width - laneEmptyFrom}px`,
+ );
+ const emptyLane = {
+ x: (laneEmptyFrom + laneBox.x + laneBox.width) / 2,
+ y: laneResting[0].y + laneResting[0].height / 2,
+ };
+ const rulerBox = await timeline.locator(".cw-stage-track-ruler-scale").boundingBox();
+ const onRuler = { x: emptyLane.x, y: rulerBox.y + rulerBox.height / 2 };
+ // Where the pointer is let go is what it is called here: the lane itself, under no
+ // block; and the ruler, where the pointer meets the playhead's own slider.
+ for (const [where, point, owner] of [
+ ["the empty lane", emptyLane, ".cw-stage-track-lane"],
+ ["the ruler", onRuler, ".cw-stage-playhead-slider"],
+ ])
+ assert.equal(
+ await page.evaluate(
+ ([x, y, owner]) =>
+ !!document.elementFromPoint(x, y)?.closest(owner) &&
+ !document.elementFromPoint(x, y)?.closest('[data-testid="director-stage-storyboard-block"]'),
+ [point.x, point.y, owner],
+ ),
+ true,
+ `where the pointer is let go is ${where}, and no block`,
+ );
+ const beforeCancelledRelease = readEditedStage(await state());
+ await playheadSlider.fill("1");
+ /** What letting go could change, as it is now. */
+ const afterLettingGo = async () => ({
+ playhead: await playhead(),
+ under: (await activeBlock().count())
+ ? await activeBlock().getAttribute("data-block-id")
+ : null,
+ selected: (await blockStates()).map(({ selected }) => selected),
+ sent: [...gestureCommands],
+ });
+ const beforeLettingGo = await afterLettingGo();
+ const carriedHome = await center(blocks.first());
+ // Carried past the one-second block after it: there letting go would change the
+ // order, and the line stands where the block after that one begins, in the gap the
+ // carried block would be let into.
+ const carriedBy = laneBox.width * 0.25;
+ const cancelledWays = [
+ ["Escape", () => page.keyboard.press("Escape")],
+ [
+ "a cancelled pointer",
+ () =>
+ blocks.first().dispatchEvent("pointercancel", {
+ pointerId: 1,
+ pointerType: "mouse",
+ isPrimary: true,
+ }),
+ ],
+ [
+ "a window that loses its focus",
+ () => page.evaluate(() => window.dispatchEvent(new Event("blur"))),
+ ],
+ ];
+ const afterCancelled = [];
+ for (const [how, cancel] of cancelledWays) {
+ for (const [where, point] of [
+ ["the empty lane", emptyLane],
+ ["the ruler", onRuler],
+ ]) {
+ await page.mouse.move(carriedHome.x, carriedHome.y);
+ await page.mouse.down();
+ await moveInFrames(carriedHome.x + carriedBy, carriedHome.y);
+ const carried = await settledBoxes(
+ (shown) => Math.abs(shown[0].x - (laneResting[0].x + carriedBy)) <= 1,
+ );
+ within(carried[0].x, laneResting[0].x + carriedBy, `${how}: the block is carried`);
+ const line = await markers.boundingBox();
+ assert.ok(line, `${how}: a line says where the carried block would be let in`);
+ within(
+ line.x + line.width / 2,
+ laneBox.x + (beforeCancelledRelease.data.shots[2].start / beforeCancelledRelease.data.duration) * laneBox.width,
+ `${how}: letting go here would change the order`,
+ );
+ await cancel();
+ assert.deepEqual(await blockBoxes(), laneResting, `${how} puts the carried block back at once`);
+ assert.deepEqual(await boxLooks(), restLook, `${how} lets the block down`);
+ assert.equal(await markers.count(), 0, `${how} takes the line away`);
+ await moveInFrames(point.x, point.y);
+ await page.mouse.up();
+ afterCancelled.push([how, where, await afterLettingGo()]);
+ // The next drag starts from the same playhead, so each release is read on its own.
+ await playheadSlider.fill("1");
+ }
+ }
+ assert.deepEqual(
+ afterCancelled,
+ cancelledWays.flatMap(([how]) =>
+ ["the empty lane", "the ruler"].map((where) => [how, where, beforeLettingGo])),
+ "after a cancelled drag, letting go on the empty lane or on the ruler moves no playhead, selects nothing and writes nothing",
+ );
+ assert.deepEqual(
+ readEditedStage(await state()),
+ beforeCancelledRelease,
+ "a cancelled drag, let go on the lane or on the ruler, writes nothing",
+ );
+
+ const longerUnit = (await blocks.nth(1).boundingBox()).width;
+ const expectedTerminalDuration = endSaved.data.shots[2].duration + 0.5;
+ const longerEnd = await center(resizeHandle(2, "right"));
+ await page.mouse.move(longerEnd.x, longerEnd.y);
+ await page.mouse.down();
+ await moveInFrames(longerEnd.x + longerUnit / 2, longerEnd.y);
+ await page.mouse.up();
+ const longerSaved = await until(
+ (snapshot) => {
+ const { data } = readEditedStage(snapshot);
+ return data.duration === 6 && Math.abs(data.shots[2].duration - expectedTerminalDuration) < 0.01;
+ },
+ "terminal resize uses the acknowledged timeline duration",
+ );
+ assert.deepEqual(gestureCommands, ["director.duration.set", "director.storyboard.resize"]);
+ assert.deepEqual(
+ storedWithoutShots(readEditedStage(longerSaved)),
+ { ...storedWithoutShots(startingStage), duration: 6 },
+ );
+ page.off("request", observeMoves);
+ await resizeHandle(2, "right").waitFor();
+ await page.getByRole("button", { name: L.closeEditor, exact: true }).click();
+ await apply.waitFor({ state: "detached" });
+ await toolbarUndo.click();
+ await until((snapshot) => {
+ const document = readEditedStage(snapshot);
+ return document.data.duration === 6 && JSON.stringify(shape(document)) === JSON.stringify(shape(endSaved));
+ }, "one undo restores the cut independently of the main duration");
+ await toolbarUndo.click();
+ const restored = await until((snapshot) => {
+ const document = readEditedStage(snapshot);
+ return document.data.duration === endSaved.data.duration &&
+ JSON.stringify(shape(document)) === JSON.stringify(shape(endSaved));
+ }, "a second undo restores the prior main duration");
+ assertOnlyShotsChanged(readEditedStage(restored));
+
+ // ─── The preview source ───
+ // A third Director Stage, stored through the HTTP command endpoint the way an Agent
+ // stores one. Its two cameras are told apart by what they look at: one faces a green
+ // marker; the other stands beside it and faces a magenta marker behind the first
+ // camera's back. Each camera sees one marker and none of the other.
+ const ON_MARKER = "cam-on-marker";
+ const AWAY = "storyboard";
+ const cameraOption = (id) => `camera:${id}`;
+ const previewDocumentId = crypto.randomUUID();
+ const previewItemId = crypto.randomUUID();
+ const rig = (id, name, position, target) => ({
+ id,
+ name,
+ aspectRatio: "16:9",
+ channels: source.data.cameras[0].channels,
+ keyframes: [],
+ pose: { position, target, fov: 45 },
+ });
+ const markerBox = (id, name, color, x, z) => ({
+ id,
+ kind: "box",
+ name,
+ color,
+ visible: true,
+ locked: false,
+ opacity: 1,
+ position: { x, y: 0, z },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 2, y: 2, z: 2 },
+ keyframes: [],
+ motionClips: [],
+ });
+ assert.equal(
+ (
+ await send("editor.create", {
+ document: {
+ ...payloadOf(source),
+ id: previewDocumentId,
+ revision: 1,
+ inputConnections: [],
+ data: {
+ ...source.data,
+ duration: 6,
+ cameraSource: "camera",
+ activeCameraId: ON_MARKER,
+ shots: [],
+ cameras: [
+ rig(ON_MARKER, L.onMarker, { x: 0, y: 1, z: 5 }, { x: 0, y: 1, z: 0 }),
+ rig(AWAY, L.away, { x: 4, y: 1, z: 5 }, { x: 8, y: 1, z: 5 }),
+ ],
+ objects: [
+ markerBox("green", "Green marker", "#00ff00", 0, 0),
+ {
+ ...markerBox("magenta", "Magenta marker", "#ff00ff", 8, 5),
+ keyframes: [4, 6].map((time) => ({
+ id: `magenta-at-${time}`,
+ time,
+ value: {
+ position: { x: 8, y: 0, z: 5 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 2, y: time === 4 ? 2 : 1, z: 2 },
+ },
+ })),
+ },
+ ],
+ // The first apply of a stage pins a poster still, so the document this one
+ // is built from holds one. This stage starts without any still.
+ stills: [],
+ },
+ },
+ })
+ ).status,
+ "applied",
+ );
+ assert.equal(
+ (
+ await send("canvas.show", {
+ item: {
+ id: previewItemId,
+ projectId,
+ kind: "external",
+ title: "Preview stage",
+ position: { x: 1700, y: 262 },
+ width: 340,
+ height: 180,
+ zIndex: 0,
+ locked: false,
+ parentId: null,
+ binding: {
+ role: "editor",
+ objectRef: {
+ objectType: "editor_document",
+ id: previewDocumentId,
+ kind: "director",
+ },
+ },
+ },
+ })
+ ).status,
+ "applied",
+ );
+ await page.reload();
+ await page.getByText(L.saved, { exact: true }).waitFor();
+ const previewNode = page.locator(
+ `.react-flow__node[data-id="${previewItemId}"]`,
+ );
+ const previewDocument = async () =>
+ director(await state(), previewItemId).document;
+ /** The persisted preview stage, once the timeline also shows `count` blocks. */
+ const storedPreview = async (count, label) => {
+ const document = director(
+ await until(
+ (snapshot) =>
+ (director(snapshot, previewItemId).document?.data.shots ?? []).length ===
+ count,
+ label,
+ ),
+ previewItemId,
+ ).document;
+ await blocks.nth(count - 1).waitFor();
+ return document;
+ };
+ const openPreview = async () => {
+ await previewNode.click();
+ await page.getByRole("button", { name: L.openStage, exact: true }).click();
+ await apply.waitFor();
+ await dynamicPreview.click();
+ await timeline.waitFor();
+ };
+ const previewSource = page.getByRole("combobox", {
+ name: L.previewSource,
+ exact: true,
+ });
+ const editCamera = page.getByRole("combobox", {
+ name: L.editCamera,
+ exact: true,
+ });
+ const scene = page.locator(".cw-stage-scene canvas").first();
+ /** What the selectors show. The inspector can hold two, and they agree. */
+ const shownSource = async () => {
+ const values = await previewSource.evaluateAll((elements) =>
+ elements.map((element) => element.value),
+ );
+ assert.ok(
+ values.length === 1 || values.length === 2,
+ `one or two selectors, not ${values.length}`,
+ );
+ assert.equal(new Set(values).size, 1, `the selectors agree: ${values}`);
+ return values[0];
+ };
+ const previewOptions = () =>
+ previewSource.first().evaluate((select) =>
+ [...select.options].map((option) => ({
+ value: option.value,
+ label: option.textContent,
+ disabled: option.disabled,
+ })),
+ );
+ /** Let the viewport draw what the latest state asks for before it is read. */
+ const settle = () =>
+ page.evaluate(
+ () =>
+ new Promise((resolve) =>
+ requestAnimationFrame(() =>
+ requestAnimationFrame(() => requestAnimationFrame(resolve)),
+ ),
+ ),
+ );
+ /** Of a canvas or an image, the pixels between two shares of its width that are each
+ * marker's colour. The stage itself is grey and dark, so it has none of either. */
+ const markerPixels = (locator, fromX = 0, toX = 1) =>
+ locator.evaluate(
+ (element, { fromX, toX }) =>
+ new Promise((resolve, reject) => {
+ const image = new Image();
+ image.onload = () => {
+ const copy = document.createElement("canvas");
+ copy.width = image.naturalWidth;
+ copy.height = image.naturalHeight;
+ const context = copy.getContext("2d");
+ context.drawImage(image, 0, 0);
+ const { data } = context.getImageData(0, 0, copy.width, copy.height);
+ const left = Math.floor(copy.width * fromX);
+ const right = Math.ceil(copy.width * toX);
+ let green = 0;
+ let magenta = 0;
+ for (let y = 0; y < copy.height; y += 1)
+ for (let x = left; x < right; x += 1) {
+ const offset = (y * copy.width + x) * 4;
+ const red = data[offset];
+ const g = data[offset + 1];
+ const b = data[offset + 2];
+ if (g - Math.max(red, b) > 40) green += 1;
+ if (Math.min(red, b) - g > 40) magenta += 1;
+ }
+ resolve({ pixels: (right - left) * copy.height, green, magenta });
+ };
+ image.onerror = () => reject(new Error("the picture did not decode"));
+ image.src = element.toDataURL ? element.toDataURL() : element.src;
+ }),
+ { fromX, toX },
+ );
+ /** Which camera made a picture. A camera is recognized only when its marker fills
+ * more than 5% of the picture and the other marker is absent from it. */
+ const cameraOf = (counts, what) => {
+ if (counts.green / counts.pixels > 0.05 && counts.magenta / counts.pixels < 0.001)
+ return ON_MARKER;
+ if (counts.magenta / counts.pixels > 0.05 && counts.green / counts.pixels < 0.001)
+ return AWAY;
+ return `${what} shows neither marker on its own (green ${counts.green}, magenta ${counts.magenta} of ${counts.pixels} pixels)`;
+ };
+ const viewportShows = async () => {
+ await settle();
+ return cameraOf(await markerPixels(scene), "the viewport");
+ };
+ const scrub = async (value) => {
+ await playheadSlider.fill(value);
+ assert.equal(await playhead(), value);
+ };
+ const scrubLane = timeline
+ .locator('.cw-stage-track-row:not([data-track-kind="shots"]) .cw-stage-track-lane')
+ .first();
+ /** Click a lane that holds no block, so the click only moves the playhead. */
+ const clickLane = async (fraction) => {
+ const bounds = await scrubLane.boundingBox();
+ await page.mouse.click(
+ bounds.x + bounds.width * fraction,
+ bounds.y + bounds.height / 2,
+ );
+ };
+
+ await openPreview();
+
+ // 1. Storyboard comes first, then every camera in stored order, each by its current
+ // name. The selector opens on the source the document stores.
+ assert.deepEqual(
+ (await previewOptions()).map((option) => [option.value, option.label]),
+ [
+ ["storyboard", L.previewStoryboard],
+ [cameraOption(ON_MARKER), L.onMarker],
+ [cameraOption(AWAY), L.away],
+ ],
+ );
+ assert.equal(await shownSource(), cameraOption(ON_MARKER));
+ assert.equal(await viewportShows(), ON_MARKER);
+
+ // 2. With no block the Storyboard cannot be previewed. Its option is disabled, the
+ // selector names the reason where a pointer and assistive technology read it, and
+ // a disabled option is never the selected one.
+ assert.equal((await previewOptions())[0].disabled, true);
+ assert.equal(
+ await previewSource.first().getAttribute("title"),
+ L.storyboardEmpty,
+ );
+ const emptyReasonId = await previewSource
+ .first()
+ .getAttribute("aria-describedby");
+ assert.ok(emptyReasonId, "the selector points at the reason");
+ assert.equal(
+ (await page.locator(`[id="${emptyReasonId}"]`).textContent()).trim(),
+ L.storyboardEmpty,
+ );
+ assert.equal(await shownSource(), cameraOption(ON_MARKER));
+
+ // The export dialog owns its own source, but with no block it opens on the camera the
+ // preview shows, which here is not the one the document stores as active.
+ await previewSource.first().selectOption(cameraOption(AWAY));
+ assert.equal(await shownSource(), cameraOption(AWAY));
+ assert.equal(await viewportShows(), AWAY);
+ await page.getByRole("button", { name: L.renderMp4, exact: true }).click();
+ const exportDialog = page.locator(".cw-stage-export");
+ // The dialog's select is named by its wrapping label, which also holds the option text.
+ const exportSource = exportDialog.getByLabel(L.exportSourceLabel);
+ await exportSource.waitFor();
+ assert.equal(
+ await exportSource.inputValue(),
+ AWAY,
+ "the dialog opens on the camera being previewed",
+ );
+ await exportDialog.getByRole("button", { name: L.exportCancel }).last().click();
+ await exportDialog.waitFor({ state: "detached" });
+
+ // The first add makes the Storyboard previewable and chooses nothing: the preview
+ // stays on the camera it was on, and so does the picture.
+ await previewSource.first().selectOption(cameraOption(ON_MARKER));
+ await openChooser();
+ await chooser.getByRole("button", { name: L.onMarker, exact: true }).click();
+ const previewFirst = await storedPreview(1, "first preview block persisted");
+ assert.deepEqual(storedBlocks(previewFirst), [[ON_MARKER, 0, 2]]);
+ assert.equal((await previewOptions())[0].disabled, false);
+ assert.equal(
+ await previewSource.first().getAttribute("aria-describedby"),
+ null,
+ "nothing is refused once a block exists",
+ );
+ assert.equal(await shownSource(), cameraOption(ON_MARKER));
+ assert.equal(await viewportShows(), ON_MARKER);
+ await openChooser();
+ await chooser.getByRole("button", { name: L.away, exact: true }).click();
+ const previewTwo = await storedPreview(2, "second preview block persisted");
+ // Two blocks of two seconds: the Storyboard ends at four seconds of a six-second timeline.
+ assert.deepEqual(storedBlocks(previewTwo), [
+ [ON_MARKER, 0, 2],
+ [AWAY, 2, 2],
+ ]);
+ assert.equal(await shownSource(), cameraOption(ON_MARKER));
+ assert.equal(await viewportShows(), ON_MARKER);
+
+ // Renaming a camera renames its option: the name is read from the camera, not copied
+ // into the option. The camera is picked through its block, which selects it without
+ // writing anything, and the rename is undone again.
+ await blocks.nth(1).click();
+ assert.equal(await editCamera.inputValue(), AWAY);
+ await cameraNameInput.fill(L.renamedAway);
+ assert.equal((await previewOptions())[2].label, L.renamedAway);
+ assert.equal(await shownSource(), cameraOption(ON_MARKER), "a rename chooses no source");
+ await stageUndo.click();
+ assert.equal((await previewOptions())[2].label, L.away);
+ assert.equal(
+ (await previewDocument()).revision,
+ previewTwo.revision,
+ "a block click, a rename and its undo leave the stored document alone",
+ );
+ // Choosing a camera to edit is not a document edit: neither selector moves.
+ await editCamera.selectOption(ON_MARKER);
+ assert.equal(await shownSource(), cameraOption(ON_MARKER));
+ assert.equal((await previewDocument()).revision, previewTwo.revision);
+
+ // 3. With the Storyboard as the preview, scrubbing shows each block's camera.
+ const sliderMax = await playheadSlider.getAttribute("max");
+ await previewSource.first().selectOption("storyboard");
+ assert.equal(await shownSource(), "storyboard");
+ assert.equal(
+ (await previewDocument()).revision,
+ previewTwo.revision,
+ "switching the preview source is not an edit",
+ );
+ await scrub("1");
+ assert.equal(await viewportShows(), ON_MARKER);
+ await scrub("3");
+ assert.equal(await viewportShows(), AWAY);
+ // The live viewport keeps editing the final block's camera while its scene advances.
+ await scrub("4");
+ assert.equal(await viewportShows(), AWAY);
+ const editingEnd = await markerPixels(scene);
+ await scrub("6");
+ assert.equal(await viewportShows(), AWAY);
+ assert.notEqual((await markerPixels(scene)).magenta, editingEnd.magenta, "the editing scene advances after the cut");
+ const assertHeld = async (read, surface) => {
+ await scrub("4");
+ const endpoint = await read();
+ assert.equal(cameraOf(endpoint, surface), AWAY);
+ await scrub("6");
+ assert.deepEqual(await read(), endpoint, `${surface} holds the exact endpoint frame`);
+ };
+ const tailPipToggle = page.getByRole("button", { name: L.cameraPreview, exact: true });
+ if ((await tailPipToggle.getAttribute("aria-expanded")) === "false") await tailPipToggle.click();
+ await assertHeld(async () => {
+ await settle();
+ return markerPixels(page.locator(".cw-stage-pipcanvas"));
+ }, "picture-in-picture");
+ const tailViewfinder = page.getByRole("button", { name: L.viewfinder, exact: true });
+ await assertHeld(async () => {
+ await tailViewfinder.click();
+ await settle();
+ const frame = await markerPixels(scene);
+ await tailViewfinder.click();
+ return frame;
+ }, "viewfinder");
+ // The marker has shrunk at the live playhead. Click its upper edge as held in
+ // the viewfinder, outside the object that a live-frame raycast would see.
+ await tailViewfinder.click();
+ await settle();
+ const markerPoint = await scene.evaluate((canvas) => {
+ const copy = document.createElement("canvas");
+ copy.width = canvas.width;
+ copy.height = canvas.height;
+ const context = copy.getContext("2d");
+ context.drawImage(canvas, 0, 0);
+ const { data } = context.getImageData(0, 0, copy.width, copy.height);
+ for (let y = 0; y < copy.height; y++) {
+ let left = copy.width;
+ let right = 0;
+ for (let x = 0; x < copy.width; x++) {
+ const i = (y * copy.width + x) * 4;
+ if (Math.min(data[i], data[i + 2]) - data[i + 1] > 40) {
+ left = Math.min(left, x);
+ right = x;
+ }
+ }
+ if (right - left > copy.width * 0.06) {
+ const rect = canvas.getBoundingClientRect();
+ return {
+ x: rect.left + ((left + right) / 2 / copy.width) * rect.width,
+ y: rect.top + ((y + 6) / copy.height) * rect.height,
+ };
+ }
+ }
+ return null;
+ });
+ assert.ok(markerPoint, "the held viewfinder shows a selectable marker");
+ await page.mouse.click(markerPoint.x, markerPoint.y);
+ await tailViewfinder.click();
+ assert.equal(
+ await page.locator(".cw-stage-right-tree").getByRole("button", {
+ name: "Magenta marker", exact: true,
+ }).getAttribute("aria-selected"),
+ "true",
+ "viewfinder selection uses the held scene and camera",
+ );
+ // A camera selection keeps the object's green transform handle out of pixel checks.
+ await blocks.nth(0).click();
+ await previewSource.first().selectOption(cameraOption(ON_MARKER));
+ await page.getByRole("tab", { name: L.camerasTab, exact: true }).click();
+ await page.getByRole("button", { name: text(L.splitPreview, { name: L.onMarker }), exact: true }).click();
+ await page.locator(".cw-stage-split-tabs")
+ .getByRole("tab", { name: L.exportSourceStoryboard, exact: true }).click();
+ await assertHeld(async () => {
+ await settle();
+ return markerPixels(scene, 0.55, 1);
+ }, "split Storyboard tab");
+ await page.getByRole("button", { name: L.splitExit, exact: true }).click();
+ await tailPipToggle.click();
+ await previewSource.first().selectOption("storyboard");
+ await assertHeld(async () => {
+ await page.getByRole("button", { name: L.screenshot, exact: true }).click();
+ await page.getByRole("button", { name: L.shotMaterials, exact: true }).click();
+ const image = page.locator(".cw-stage-drawer-list img").first();
+ await image.waitFor();
+ const result = await markerPixels(image);
+ await page.locator(".cw-stage-drawer-toolbar").getByRole("checkbox").check();
+ await page.getByRole("button", { name: L.deleteSelectedStills, exact: true }).click();
+ await page.getByText(L.stillEmpty, { exact: true }).waitFor();
+ await page.getByRole("button", { name: L.closeDrawer, exact: true }).click();
+ return result;
+ }, "captured still");
+ // The main timeline is not the preview's to change.
+ assert.equal(await playheadSlider.getAttribute("max"), sliderMax);
+ assert.equal(await durationInput.inputValue(), "6");
+ assert.equal(sliderMax, "6");
+
+ // 4. Pinned to one camera, the preview ignores the Storyboard: not the block under the
+ // playhead, not a block the user selects, not the playhead, not a block being added.
+ await previewSource.first().selectOption(cameraOption(ON_MARKER));
+ assert.equal(await shownSource(), cameraOption(ON_MARKER));
+ assert.equal(
+ await viewportShows(),
+ ON_MARKER,
+ "the block under the playhead names the other camera",
+ );
+ await blocks.nth(1).click();
+ assert.equal(await editCamera.inputValue(), AWAY);
+ assert.equal(await shownSource(), cameraOption(ON_MARKER));
+ assert.equal(await viewportShows(), ON_MARKER);
+ for (const at of ["0.5", "1", "2", "3", "4", "5.5"]) {
+ await scrub(at);
+ assert.equal(await shownSource(), cameraOption(ON_MARKER), `the selector at ${at} s`);
+ assert.equal(await viewportShows(), ON_MARKER, `the picture at ${at} s`);
+ }
+ await openChooser();
+ await chooser.getByRole("button", { name: L.onMarker, exact: true }).click();
+ const previewThree = await storedPreview(3, "third preview block persisted");
+ assert.deepEqual(storedBlocks(previewThree), [
+ [ON_MARKER, 0, 2],
+ [AWAY, 2, 2],
+ [ON_MARKER, 4, 2],
+ ]);
+ assert.equal(await shownSource(), cameraOption(ON_MARKER), "an added block chooses no source");
+ assert.equal(await viewportShows(), ON_MARKER);
+ assert.equal(await add.isEnabled(), false, "the track is now full");
+
+ // 5. Moving or playing the playhead changes neither the selected block, nor the
+ // selected camera in the scene tree and the inspector, nor what has focus.
+ await previewSource.first().selectOption("storyboard");
+ await blocks.nth(0).click();
+ const selection = async () => ({
+ blocks: (await blockStates()).map((block) => block.selected),
+ tree: await page
+ .locator(".cw-stage-right-tree [aria-selected]")
+ .evaluateAll((elements) =>
+ elements
+ .filter((element) => element.getAttribute("aria-selected") === "true")
+ .map((element) => element.textContent.trim()),
+ ),
+ inspector: await inspectorCamera(),
+ editCamera: await editCamera.inputValue(),
+ });
+ const focused = () =>
+ page.evaluate(() =>
+ document.activeElement?.getAttribute("aria-label"),
+ );
+ const kept = { blocks: ["true", "false", "false"], tree: [L.onMarker], inspector: L.onMarker, editCamera: ON_MARKER };
+ assert.deepEqual(await selection(), kept, "the starting point: block one and its camera");
+ // By pointer: clicks on a lane that holds no block move the playhead across every
+ // block and back.
+ for (const fraction of [0.95, 0.5, 0.05, 0.7]) {
+ await clickLane(fraction);
+ assert.deepEqual(await selection(), kept, `after a lane click at ${fraction}`);
+ }
+ // By playback: the playhead advances on its own while an inspector input has focus.
+ await scrub("0");
+ await page.getByRole("button", { name: L.playAction, exact: true }).click();
+ await cameraNameInput.click();
+ assert.equal(await focused(), L.cameraName);
+ await page.waitForFunction(
+ () =>
+ Number(document.querySelector(".cw-stage-playhead-slider")?.value) > 4.3,
+ null,
+ { polling: 50 },
+ );
+ assert.deepEqual(await selection(), kept, "while the playhead crosses two cuts");
+ assert.equal(
+ await focused(),
+ L.cameraName,
+ "the inspector input keeps focus while the playhead moves",
+ );
+ // Playback runs to the main duration and stops there, whatever the preview source.
+ await page.waitForFunction(
+ () => document.querySelector(".cw-stage-playhead-slider")?.value === "6",
+ null,
+ { polling: 50 },
+ );
+ await settle();
+ assert.equal(await playhead(), "6");
+ assert.deepEqual(await selection(), kept, "when playback ends");
+ assert.equal(await focused(), L.cameraName);
+
+ // 6. None of that was an edit. The stored document is what the last add left, the
+ // local history holds nothing on top of that add, and the draft is still the saved
+ // document: the editor closes without asking to apply anything.
+ const settled = JSON.stringify(await previewDocument());
+ assert.equal(settled, JSON.stringify(previewThree));
+ await stageUndo.click();
+ await blocks.nth(2).waitFor({ state: "detached" });
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.id),
+ storedIds(previewTwo),
+ "one undo removes exactly the last added block",
+ );
+ await stageRedo.click();
+ await blocks.nth(2).waitFor();
+ assert.equal(
+ JSON.stringify(await previewDocument()),
+ settled,
+ "an undo and a redo inside the editor write nothing",
+ );
+ await page.getByRole("button", { name: L.shotMaterials, exact: true }).click();
+ assert.equal(
+ (await page.locator(".cw-stage-drawer-count").textContent()).trim(),
+ "0",
+ "no still was captured",
+ );
+ await page.getByRole("button", { name: L.closeDrawer, exact: true }).click();
+ await page.getByRole("button", { name: L.closeEditor, exact: true }).click();
+ await apply.waitFor({ state: "detached" });
+ assert.equal(
+ JSON.stringify(await previewDocument()),
+ settled,
+ "the stored document is unchanged from the last add on",
+ );
+
+ // ─── Every camera surface and every pose commit follows the preview source ───
+ await openPreview();
+
+ // ─── A camera list keeps moving the preview ───
+ // A click in either camera list keeps everything it did: the selection where the list
+ // makes one, the write of the stored active camera, and the marks that report both. It
+ // also moves the preview to the clicked camera while the preview shows a camera. While
+ // the preview is the Storyboard the click leaves it there, as it did before the preview
+ // source became view state.
+ const cameraTabRow = (name) =>
+ page
+ .locator(".cw-stage-camera-list")
+ .getByRole("button", { name, exact: true });
+ const treeCameraRow = (name) =>
+ page
+ .locator(".cw-stage-right-tree")
+ .getByRole("button", { name, exact: true });
+ /** The camera marked as the preview source. */
+ const markedPreviewCamera = async () => {
+ const marks = await Promise.all(
+ [L.onMarker, L.away].map(async (name) => [
+ name,
+ await cameraTabRow(name).getAttribute("aria-pressed"),
+ ]),
+ );
+ return marks.find(([, pressed]) => pressed === "true")?.[0] ?? null;
+ };
+ await page.getByRole("tab", { name: L.camerasTab, exact: true }).click();
+ assert.equal(
+ await markedPreviewCamera(),
+ L.onMarker,
+ "the stored active camera is the one the document came with",
+ );
+ assert.equal(
+ await stageUndo.isEnabled(),
+ false,
+ "the reopened editor holds no local history",
+ );
+ for (const [list, row, selects] of [
+ ["the scene tree", treeCameraRow, true],
+ ["the Cameras tab", cameraTabRow, false],
+ ]) {
+ // (a) The preview shows one camera. Clicking the other camera shows that one.
+ await previewSource.first().selectOption(cameraOption(ON_MARKER));
+ assert.equal(await shownSource(), cameraOption(ON_MARKER));
+ assert.equal(await viewportShows(), ON_MARKER);
+ if (!selects) {
+ // Put the selection on the other camera, so a row that selects nothing is told
+ // apart from one that selects the camera it names.
+ await blocks.nth(0).click();
+ assert.equal(await editCamera.inputValue(), ON_MARKER);
+ }
+ await row(L.away).click();
+ assert.equal(
+ await shownSource(),
+ cameraOption(AWAY),
+ `${list}: the selector shows the clicked camera`,
+ );
+ assert.equal(
+ await viewportShows(),
+ AWAY,
+ `${list}: the picture moves to the clicked camera`,
+ );
+ // What the row did before is kept: its own selection, and the stored active
+ // camera, written as one edit.
+ assert.equal(
+ selects ? await treeCameraRow(L.away).getAttribute("aria-selected") : await editCamera.inputValue(),
+ selects ? "true" : ON_MARKER,
+ `${list}: the row's selection is as it was`,
+ );
+ assert.equal(
+ await markedPreviewCamera(),
+ L.away,
+ `${list}: the row marks the new preview camera`,
+ );
+ assert.equal(
+ await stageUndo.isEnabled(),
+ true,
+ `${list}: that write is still an edit`,
+ );
+ await stageUndo.click();
+ assert.equal(
+ await markedPreviewCamera(),
+ L.away,
+ `${list}: undo does not change the preview selection`,
+ );
+ assert.equal(
+ await stageUndo.isEnabled(),
+ false,
+ `${list}: nothing else was written`,
+ );
+
+ // (b) The preview is the Storyboard. The same click leaves picture and selector
+ // alone, and still writes the stored active camera.
+ await previewSource.first().selectOption("storyboard");
+ await scrub("1");
+ assert.equal(await shownSource(), "storyboard");
+ assert.equal(await viewportShows(), ON_MARKER, "the block under the playhead");
+ await row(L.away).click();
+ assert.equal(
+ await shownSource(),
+ "storyboard",
+ `${list}: the selector stays on the Storyboard`,
+ );
+ assert.equal(
+ await viewportShows(),
+ ON_MARKER,
+ `${list}: the picture stays on the Storyboard`,
+ );
+ assert.equal(
+ await markedPreviewCamera(),
+ null,
+ `${list}: no camera is marked while the preview is the Storyboard`,
+ );
+ await stageUndo.click();
+ assert.equal(await markedPreviewCamera(), null);
+ assert.equal(
+ await stageUndo.isEnabled(),
+ false,
+ `${list}: one undo takes the write back`,
+ );
+ }
+ const viewfinderButton = page.getByRole("button", {
+ name: L.viewfinder,
+ exact: true,
+ });
+ const previewToggleButton = page.getByRole("button", {
+ name: L.cameraPreview,
+ exact: true,
+ });
+ // The viewfinder and the camera preview show the preview source's camera. The
+ // viewfinder is a mode of its own without the timeline, so the playhead is set
+ // before each look through it.
+ await previewSource.first().selectOption("storyboard");
+ for (const [at, camera] of [["1", ON_MARKER], ["3", AWAY]]) {
+ await scrub(at);
+ await viewfinderButton.click();
+ assert.equal(await viewportShows(), camera, `the viewfinder at ${at} s`);
+ await viewfinderButton.click();
+ }
+ // The preview toggle collapses and expands the preview in place.
+ assert.equal(await previewToggleButton.getAttribute("aria-expanded"), "true");
+ await scrub("1");
+ assert.equal(
+ cameraOf(await markerPixels(page.locator(".cw-stage-pipcanvas")), "the camera preview"),
+ ON_MARKER,
+ );
+ await scrub("3");
+ assert.equal(
+ cameraOf(await markerPixels(page.locator(".cw-stage-pipcanvas")), "the camera preview"),
+ AWAY,
+ );
+ await previewToggleButton.click();
+ // The split view's Storyboard tab samples the Storyboard itself, beside a working
+ // view that is pinned to one camera: the two panes show two different cameras.
+ await previewSource.first().selectOption(cameraOption(ON_MARKER));
+ await page.getByRole("tab", { name: L.camerasTab, exact: true }).click();
+ await page
+ .getByRole("button", { name: text(L.splitPreview, { name: L.onMarker }), exact: true })
+ .click();
+ const splitTabs = page.locator(".cw-stage-split-tabs");
+ await splitTabs.getByRole("tab", { name: L.exportSourceStoryboard, exact: true }).click();
+ for (const [at, right] of [["1", ON_MARKER], ["3", AWAY]]) {
+ await scrub(at);
+ await settle();
+ assert.equal(
+ cameraOf(await markerPixels(scene, 0, 0.45), "the working view"),
+ ON_MARKER,
+ `the working view keeps its own camera at ${at} s`,
+ );
+ assert.equal(
+ cameraOf(await markerPixels(scene, 0.55, 1), "the split pane"),
+ right,
+ `the Storyboard tab shows the block's camera at ${at} s`,
+ );
+ }
+ await page.getByRole("button", { name: L.splitExit, exact: true }).click();
+
+ // A pose committed from the viewport lands on the camera the preview shows and on no
+ // other. Each camera's pose is read back from the inspector.
+ const poseOf = async (cameraId) => {
+ await editCamera.selectOption(cameraId);
+ const labels = [
+ ...["X", "Y", "Z"].map((axis) => `${L.cameraShort} ${axis}`),
+ ...["X", "Y", "Z"].map((axis) => `${L.target} ${axis}`),
+ L.focal,
+ ];
+ return Object.fromEntries(
+ await Promise.all(
+ labels.map(async (label) => [
+ label,
+ await page.getByLabel(label, { exact: true }).inputValue(),
+ ]),
+ ),
+ );
+ };
+ await blocks.nth(1).click();
+ await previewSource.first().selectOption(cameraOption(AWAY));
+ await scrub("0");
+ const posesBefore = {
+ [ON_MARKER]: await poseOf(ON_MARKER),
+ [AWAY]: await poseOf(AWAY),
+ };
+ const sceneBox = await scene.boundingBox();
+ await page.mouse.move(sceneBox.x + 700, sceneBox.y + 400);
+ await page.mouse.down();
+ await page.mouse.move(sceneBox.x + 800, sceneBox.y + 460, { steps: 12 });
+ await page.mouse.up();
+ assert.notDeepEqual(
+ await poseOf(AWAY),
+ posesBefore[AWAY],
+ "an orbit edits the camera the preview shows",
+ );
+ assert.deepEqual(
+ await poseOf(ON_MARKER),
+ posesBefore[ON_MARKER],
+ "an orbit leaves every other camera alone",
+ );
+ await stageUndo.click();
+ assert.deepEqual(await poseOf(AWAY), posesBefore[AWAY], "one undo restores the orbit");
+ await page.getByRole("tab", { name: L.camerasTab, exact: true }).click();
+ await page.getByRole("button", { name: L.presetOverhead, exact: true }).click();
+ assert.notDeepEqual(
+ await poseOf(AWAY),
+ posesBefore[AWAY],
+ "a camera preset is applied to the camera the preview shows",
+ );
+ assert.deepEqual(await poseOf(ON_MARKER), posesBefore[ON_MARKER]);
+ await stageUndo.click();
+ assert.deepEqual(await poseOf(AWAY), posesBefore[AWAY], "one undo restores the preset");
+ await viewfinderButton.click();
+ const viewfinderFov = page.getByLabel(L.viewfinderFov, { exact: true });
+ assert.equal(
+ await viewfinderFov.inputValue(),
+ "45",
+ "the viewfinder opens on the preview camera's field of view",
+ );
+ await viewfinderFov.focus();
+ await viewfinderFov.press("ArrowRight");
+ // The viewfinder hides the inspector, so the pose is read after leaving it.
+ await viewfinderButton.click();
+ assert.notEqual(
+ (await poseOf(AWAY))[L.focal],
+ posesBefore[AWAY][L.focal],
+ "the viewfinder's field of view is committed to the camera the preview shows",
+ );
+ assert.deepEqual(await poseOf(ON_MARKER), posesBefore[ON_MARKER]);
+ await stageUndo.click();
+ assert.deepEqual(await poseOf(AWAY), posesBefore[AWAY], "one undo restores the field of view");
+
+ // A still is captured through the preview source as well.
+ await previewSource.first().selectOption("storyboard");
+ await scrub("3");
+ await page.getByRole("button", { name: L.screenshot, exact: true }).click();
+ await page.getByRole("button", { name: L.shotMaterials, exact: true }).click();
+ const stillImage = page.locator(".cw-stage-drawer-list img").first();
+ await stillImage.waitFor();
+ assert.equal(
+ cameraOf(await markerPixels(stillImage), "the captured still"),
+ AWAY,
+ );
+ await page.locator(".cw-stage-drawer-toolbar").getByRole("checkbox").check();
+ await page.getByRole("button", { name: L.deleteSelectedStills, exact: true }).click();
+ await page.getByText(L.stillEmpty, { exact: true }).waitFor();
+ await page.getByRole("button", { name: L.closeDrawer, exact: true }).click();
+
+ // A project-history undo while the editor is open, which is how an Agent would undo,
+ // changes the stored document and does not reach the open draft: the editor still
+ // shows the block that was removed and the selection the user made.
+ await previewSource.first().selectOption("storyboard");
+ await blocks.nth(0).click();
+ const historyResponse = await fetch(
+ `${api}/api/creation/projects/${projectId}/history`,
+ { headers: { ...headers, "X-OpenDirector-Session": browserSession } },
+ );
+ assert.ok(historyResponse.ok, `history: ${historyResponse.status}`);
+ const lastApplied = (await historyResponse.json()).find(
+ (entry) => entry.state === "applied",
+ );
+ assert.ok(lastApplied, "the project history holds an applied command");
+ assert.equal(
+ (
+ await send("history.undo", { targetCommandId: lastApplied.commandId }, [
+ version(await previewDocument()),
+ ])
+ ).status,
+ "applied",
+ );
+ const undonePreview = await until(
+ (snapshot) =>
+ (director(snapshot, previewItemId).document?.data.shots ?? []).length === 2,
+ "the stored project lost the third block",
+ );
+ // That the third block is the one that went proves the undone command was its add.
+ assert.deepEqual(
+ storedBlocks(director(undonePreview, previewItemId).document),
+ storedBlocks(previewTwo),
+ );
+ assert.deepEqual(
+ (await blockStates()).map((block) => [block.id, block.selected]),
+ storedIds(previewThree).map((id, index) => [id, index === 0 ? "true" : "false"]),
+ "the open editor still holds the draft it opened with, selection included",
+ );
+ assert.equal(await editCamera.inputValue(), ON_MARKER);
+ await page.getByRole("button", { name: L.closeEditor, exact: true }).click();
+ await apply.waitFor({ state: "detached" });
+
+ // ─── Block presentation ───
+ // The same stage, read again from the project: two blocks. The page is reloaded
+ // first, because a change that arrives from outside while the editor is open
+ // reaches the canvas only after it has been notified and has read the project.
+ // Idle time is held from the start, so the blocks are seen before any thumbnail is made.
+ await page.addInitScript(() => {
+ window.__storyboardHoldIdle = true;
+ });
+ await page.reload();
+ await page.getByText(L.saved, { exact: true }).waitFor();
+ await openPreview();
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.id),
+ storedIds(previewTwo),
+ );
+
+ // The Storyboard row is taller than an ordinary track row, so a thumbnail is
+ // recognizable in it. One constant sizes the row and the surface together: the
+ // surface still holds every row without scrolling, the playhead lane and the
+ // grid lines span all of them, every other row keeps its height, and `+` stays
+ // centered where the chooser anchors to it.
+ const height = (locator) =>
+ locator.evaluate((element) => element.getBoundingClientRect().height);
+ const ordinaryHeight = await height(
+ timeline
+ .locator('.cw-stage-track-row[data-track-kind="camera-channel"]')
+ .first(),
+ );
+ const storyboardHeight = await height(shotsRow);
+ assert.ok(
+ ordinaryHeight > 0 && storyboardHeight >= 28,
+ `room for a 24px thumbnail inside a block: the Storyboard row is ${storyboardHeight}px, an ordinary row ${ordinaryHeight}px`,
+ );
+ const laidOut = await timeline.evaluate((surface) => {
+ const box = (element) => element.getBoundingClientRect();
+ const rows = [...surface.querySelectorAll(".cw-stage-track-row")];
+ return {
+ scrolling: surface.scrollHeight > surface.clientHeight,
+ bottom: box(surface).bottom,
+ top: box(surface).top,
+ lastRow: box(rows.at(-1)).bottom,
+ lane: box(surface.querySelector(".cw-stage-track-playhead-lane")),
+ grid: box(surface.querySelector(".cw-stage-track-grid")),
+ rulerBottom: box(surface.querySelector(".cw-stage-track-ruler")).bottom,
+ others: rows
+ .filter((row) => row.dataset.trackKind !== "shots")
+ .map((row) => box(row).height),
+ };
+ });
+ assert.equal(laidOut.scrolling, false, "the surface holds every row without scrolling");
+ assert.ok(
+ Math.abs(laidOut.lastRow - laidOut.bottom) <= 1,
+ `the last row ends at the surface's bottom: ${laidOut.lastRow} vs ${laidOut.bottom}`,
+ );
+ for (const [what, band, top] of [
+ ["the playhead lane", laidOut.lane, laidOut.top],
+ ["the grid lines", laidOut.grid, laidOut.rulerBottom],
+ ])
+ assert.ok(
+ Math.abs(band.top - top) <= 1 && Math.abs(band.bottom - laidOut.bottom) <= 1,
+ `${what} span every row: ${band.top}-${band.bottom} vs ${top}-${laidOut.bottom}`,
+ );
+ assert.ok(
+ laidOut.others.length > 0 &&
+ laidOut.others.every((row) => Math.abs(row - ordinaryHeight) <= 0.5),
+ `every other row keeps its height: ${laidOut.others}`,
+ );
+ const anchored = await shotsRow.evaluate((row) => {
+ const center = (element) => {
+ const box = element.getBoundingClientRect();
+ return box.top + box.height / 2;
+ };
+ return {
+ label: center(row.querySelector(".cw-stage-track-label")),
+ add: center(row.querySelector(".cw-stage-storyboard-add")),
+ };
+ });
+ assert.ok(
+ Math.abs(anchored.label - anchored.add) <= 1,
+ "`+` stays centered in the Storyboard label",
+ );
+
+ // 9. A block's thumbnail is made in idle time, after the editor has drawn and
+ // never on the way. While idle callbacks are held back, every block waits: it
+ // names its state and shows no picture.
+ const thumbnailStates = () =>
+ blocks.evaluateAll((elements) =>
+ elements.map((element) => ({
+ state: element.dataset.thumbnailState,
+ image: element.querySelector("img")?.getAttribute("src") ?? null,
+ })),
+ );
+ const waiting = await thumbnailStates();
+ assert.deepEqual(
+ waiting.map((thumbnail) => thumbnail.state),
+ ["pending", "pending"],
+ "no thumbnail is made without idle time",
+ );
+ assert.deepEqual(
+ waiting.map((thumbnail) => thumbnail.image),
+ [null, null],
+ "a waiting block shows no picture",
+ );
+
+ // ─── Selected fill and playhead outline ───
+ /** An element's box as plain numbers. */
+ const rect = (locator) =>
+ locator.evaluate((element) => {
+ const { x, y, width, height } = element.getBoundingClientRect();
+ return { x, y, width, height };
+ });
+ /** An element's computed background colour as [red, green, blue]. */
+ const background = (locator) =>
+ locator
+ .evaluate((element) => getComputedStyle(element).backgroundColor)
+ .then((value) => value.match(/[\d.]+/g).slice(0, 3).map(Number));
+ const apart = (one, other) =>
+ Math.hypot(one[0] - other[0], one[1] - other[1], one[2] - other[2]);
+ /** Park the pointer away from the timeline and let what it left behind settle. */
+ const pointerAway = async () => {
+ await page.mouse.move(40, 40);
+ await settle();
+ };
+
+ // 7. A selected block carries a fill of its own, inside its box. It is shown
+ // without a hover, it moves no edge, and the blocks that are not selected keep
+ // the ordinary fill. The playhead is on the second block, so the first block
+ // is the selected one and nothing else.
+ await scrub("3");
+ await pointerAway();
+ const ordinary = await background(blocks.nth(0));
+ const boxes = await Promise.all([0, 1].map((index) => rect(blocks.nth(index))));
+ await blocks.nth(0).click();
+ await pointerAway();
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.selected),
+ ["true", "false"],
+ );
+ const filled = await background(blocks.nth(0));
+ assert.ok(
+ apart(filled, ordinary) >= 60,
+ `the selected fill stands out from the ordinary one: ${filled} against ${ordinary}`,
+ );
+ assert.deepEqual(
+ await rect(blocks.nth(0)),
+ boxes[0],
+ "the selected fill changes no geometry",
+ );
+ assert.deepEqual(
+ await background(blocks.nth(1)),
+ ordinary,
+ "a block that is not selected keeps the ordinary fill",
+ );
+
+ /** The outline the browser reports for a block, or null when it has none. */
+ const outline = (locator) =>
+ locator.evaluate((element) => {
+ const style = getComputedStyle(element);
+ if (style.outlineStyle === "none" || style.outlineWidth === "0px")
+ return null;
+ return {
+ style: style.outlineStyle,
+ width: parseFloat(style.outlineWidth),
+ colour: style.outlineColor.match(/[\d.]+/g).slice(0, 3).map(Number),
+ };
+ });
+ const assertWhiteRing = (ring, what) => {
+ assert.equal(ring?.style, "solid", `${what}: it is a solid outline`);
+ assert.ok(ring.width >= 2, `${what}: the ring is ${ring.width}px wide`);
+ assert.ok(
+ ring.colour.every((channel) => channel >= 250),
+ `${what}: the ring is white, not ${ring.colour}`,
+ );
+ };
+
+ // The playhead sits on the second block, which is not selected, so its white
+ // outline is alone: the first block has its fill alone. The outline is a ring
+ // outside the box, so it adds no fill and moves no edge.
+ assertWhiteRing(await outline(blocks.nth(1)), "the block under the playhead");
+ assert.equal(await blocks.nth(1).getAttribute("aria-current"), "time");
+ assert.deepEqual(
+ await outline(blocks.nth(0)),
+ null,
+ "a block away from the playhead has no outline",
+ );
+ assert.equal(await blocks.nth(0).getAttribute("aria-current"), null);
+ assert.deepEqual(
+ await rect(blocks.nth(1)),
+ boxes[1],
+ "the outline moves no edge",
+ );
+ assert.deepEqual(
+ await background(blocks.nth(1)),
+ ordinary,
+ "an outline alone adds no fill",
+ );
+
+ // Both on one block, each still its own. Selecting this block unselects the
+ // other, as one selection does, so that one is ordinary again.
+ await blocks.nth(1).click();
+ await pointerAway();
+ assertWhiteRing(
+ await outline(blocks.nth(1)),
+ "the selected block under the playhead",
+ );
+ assert.ok(
+ apart(await background(blocks.nth(1)), ordinary) >= 60,
+ "the fill shows under the outline",
+ );
+ assert.deepEqual(
+ await outline(blocks.nth(0)),
+ null,
+ "the other block carries no outline",
+ );
+ assert.deepEqual(
+ await background(blocks.nth(0)),
+ ordinary,
+ "the block that lost the selection is ordinary again",
+ );
+
+ // The ring is painted over the block beside it, so a neighbour cannot cover it.
+ // At the height of the lane, the column just right of the first block's edge
+ // belongs to the second block: it is white while the first block is under the
+ // playhead, and the second block's fill otherwise.
+ const edge = boxes[0].x + boxes[0].width;
+ const laneHeight = Math.floor(boxes[0].y + boxes[0].height / 2);
+ const overTheNeighbour = async () => {
+ const [strip] = await pixels({
+ x: Math.floor(edge) - 4,
+ y: laneHeight,
+ width: 8,
+ height: 1,
+ });
+ return strip[5];
+ };
+ await scrub("1");
+ const ringColumn = await overTheNeighbour();
+ assert.ok(
+ ringColumn.every((channel) => channel >= 240),
+ `the ring is painted over the next block: ${ringColumn}`,
+ );
+ await scrub("3");
+ const fillColumn = await overTheNeighbour();
+ assert.ok(
+ apart(fillColumn, ringColumn) >= 100,
+ `without the playhead the same column is the next block's fill: ${fillColumn}`,
+ );
+
+ // The body on either side of a shared resize boundary selects its own block
+ // without moving the playhead.
+ await scrub("1");
+ const edges = await Promise.all(
+ [0, 1].map(async (index) => {
+ const { x, width } = await rect(blocks.nth(index));
+ return index === 0 ? x + width - 12 : x + 12;
+ }),
+ );
+ for (const [index, at] of [[0, edges[0]], [1, edges[1]]]) {
+ await page.mouse.click(at, laneHeight);
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.selected),
+ index === 0 ? ["true", "false"] : ["false", "true"],
+ `a click inside the edge selects block ${index + 1}`,
+ );
+ assert.equal(
+ await playhead(),
+ "1",
+ `the click inside block ${index + 1} moves no playhead`,
+ );
+ }
+ await pointerAway();
+
+ // 8. Exactly at a shared boundary the block on its right has the outline. Exactly
+ // at the Storyboard's endpoint the last block still has it; beyond it no block
+ // does. The playhead picks no block on the way.
+ const [onMarkerBlock, awayBlock] = storedIds(previewTwo);
+ const playheadBlocks = () =>
+ blocks.evaluateAll((elements) =>
+ elements
+ .filter((element) => element.getAttribute("aria-current") === "time")
+ .map((element) => element.dataset.blockId),
+ );
+ for (const [at, under] of [
+ ["2", [awayBlock]],
+ ["4", [awayBlock]],
+ ["5", []],
+ ["1", [onMarkerBlock]],
+ ]) {
+ await scrub(at);
+ assert.deepEqual(
+ await playheadBlocks(),
+ under,
+ `the blocks under the playhead at ${at} s`,
+ );
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.selected),
+ ["false", "true"],
+ `the playhead at ${at} s changes no selection`,
+ );
+ }
+
+ // Keyboard focus keeps a ring of its own, outside the one the playhead draws.
+ await add.focus();
+ await page.keyboard.press("Tab");
+ assert.equal(
+ await page.evaluate(() => document.activeElement?.dataset.blockId),
+ onMarkerBlock,
+ "Tab from `+` reaches the first block",
+ );
+ assertWhiteRing(
+ await outline(blocks.nth(0)),
+ "the block under the playhead, holding keyboard focus",
+ );
+ const focusRing = await blocks.nth(0).evaluate((element) => {
+ const { boxShadow, outlineOffset } = getComputedStyle(element);
+ return { boxShadow, outlineOffset };
+ });
+ assert.notEqual(focusRing.boxShadow, "none", "keyboard focus is still shown");
+ assert.equal(focusRing.outlineOffset, "0px", "the playhead's ring stays on the edge");
+ await page.evaluate(() => document.activeElement?.blur());
+
+ // Idle time is let in. Each block then shows a real picture of its own camera at
+ // the block's start, inside its box and at least 24px high. The cameras look at
+ // different markers, so the two pictures differ. A block's box does not move when
+ // its picture arrives.
+ const waitingBoxes = await Promise.all(
+ [0, 1].map((index) => rect(blocks.nth(index))),
+ );
+ await page.evaluate(() => window.__storyboardReleaseIdle());
+ await page.waitForFunction(
+ () =>
+ [
+ ...document.querySelectorAll(
+ '[data-testid="director-stage-storyboard-block"]',
+ ),
+ ].every(
+ (element) =>
+ element.dataset.thumbnailState === "ready" &&
+ element.querySelector("img")?.naturalWidth > 0,
+ ),
+ null,
+ { polling: 50 },
+ );
+ assert.deepEqual(
+ await Promise.all([0, 1].map((index) => rect(blocks.nth(index)))),
+ waitingBoxes,
+ "a block's box does not move when its picture arrives",
+ );
+ const picture = (index) =>
+ blocks
+ .nth(index)
+ .locator("img")
+ .evaluate((element) => {
+ const { x, y, width, height } = element.getBoundingClientRect();
+ return {
+ naturalWidth: element.naturalWidth,
+ naturalHeight: element.naturalHeight,
+ box: { x, y, width, height },
+ alt: element.alt,
+ src: element.src,
+ };
+ });
+ const pictures = [await picture(0), await picture(1)];
+ for (const [index, { naturalWidth, box, alt }] of pictures.entries()) {
+ assert.ok(naturalWidth > 0, `block ${index + 1} shows a real image`);
+ assert.ok(
+ box.height >= 24,
+ `block ${index + 1}'s thumbnail is ${box.height}px high`,
+ );
+ const block = waitingBoxes[index];
+ assert.ok(
+ box.x >= block.x &&
+ box.y >= block.y &&
+ box.x + box.width <= block.x + block.width &&
+ box.y + box.height <= block.y + block.height,
+ `block ${index + 1}'s thumbnail lies inside its box: ${JSON.stringify(box)} in ${JSON.stringify(block)}`,
+ );
+ assert.equal(alt, "", "the picture is decoration; the block names its camera");
+ }
+ assert.notEqual(pictures[0].src, pictures[1].src, "two cameras, two pictures");
+ assert.equal(
+ cameraOf(await markerPixels(blocks.nth(0).locator("img")), "the first block's thumbnail"),
+ ON_MARKER,
+ );
+ assert.equal(
+ cameraOf(await markerPixels(blocks.nth(1).locator("img")), "the second block's thumbnail"),
+ AWAY,
+ );
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.name),
+ [L.onMarker, L.away],
+ "the picture replaces nothing: the block still shows its camera's name",
+ );
+
+ // ─── What a picture follows and what it keeps ───
+ const pictureSources = () =>
+ blocks.evaluateAll((elements) =>
+ elements.map(
+ (element) => element.querySelector("img")?.getAttribute("src") ?? null,
+ ),
+ );
+ /** Waits until every block holds a picture made for what it shows now. */
+ const picturesSettled = () =>
+ page.waitForFunction(
+ () => {
+ const elements = [
+ ...document.querySelectorAll(
+ '[data-testid="director-stage-storyboard-block"]',
+ ),
+ ];
+ return (
+ elements.length > 0 &&
+ elements.every((element) => element.dataset.thumbnailState === "ready")
+ );
+ },
+ null,
+ { polling: 50 },
+ );
+ /** The share of a picture that is each marker's colour. */
+ const markerShares = async (locator) => {
+ const { pixels, green, magenta } = await markerPixels(locator);
+ return { green: green / pixels, magenta: magenta / pixels };
+ };
+ const originals = await pictureSources();
+
+ // A picture is of the camera and the scene at the block's start, and of nothing
+ // else. The playhead, the selection and the preview source are not part of it.
+ for (const at of ["0", "2.5", "4", "5.5"]) await scrub(at);
+ await blocks.nth(0).click();
+ for (const source of ["storyboard", cameraOption(AWAY), cameraOption(ON_MARKER)])
+ await previewSource.first().selectOption(source);
+ assert.deepEqual(
+ await pictureSources(),
+ originals,
+ "the playhead, the selection and the preview source leave every picture as it was",
+ );
+
+ // Nor is a camera's name. Renaming a camera renames its block and no picture.
+ await blocks.nth(1).click();
+ await cameraNameInput.fill(L.renamedAway);
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.name),
+ [L.onMarker, L.renamedAway],
+ "the block shows the camera's new name",
+ );
+ assert.deepEqual(
+ await pictureSources(),
+ originals,
+ "a rename changes no picture",
+ );
+ await stageUndo.click();
+ assert.equal((await blockStates())[1].name, L.away);
+
+ // The camera is. Turn the second camera away from the marker it looks at: its
+ // block waits for a new picture and then shows one without that marker, while the
+ // first camera's block keeps the very image it had.
+ const awayTarget = page.getByLabel(`${L.target} X`, { exact: true });
+ await page.evaluate(() => {
+ window.__storyboardHoldIdle = true;
+ });
+ await awayTarget.fill("-4");
+ await awayTarget.press("Enter");
+ await settle();
+ assert.deepEqual(
+ await thumbnailStates(),
+ [
+ { state: "ready", image: originals[0] },
+ { state: "pending", image: null },
+ ],
+ "the block of the camera that changed waits; the other keeps its image",
+ );
+ await page.evaluate(() => window.__storyboardReleaseIdle());
+ await picturesSettled();
+ const turned = await pictureSources();
+ assert.notEqual(
+ turned[1],
+ originals[1],
+ "the camera that turned gives its block a new picture",
+ );
+ assert.equal(turned[0], originals[0], "the other block keeps its image");
+ assert.ok(
+ (await markerShares(blocks.nth(1).locator("img"))).magenta < 0.05,
+ "the marker it looked at has left the second camera's picture",
+ );
+ await stageUndo.click();
+ await picturesSettled();
+ assert.deepEqual(
+ await pictureSources(),
+ originals,
+ "one undo puts the picture back, as the same image",
+ );
+
+ // An animation change reaches it the same way. A keyframe is recorded on the
+ // second camera at its block's start, and the same field now edits that keyframe.
+ await previewSource.first().selectOption(cameraOption(AWAY));
+ await scrub("2");
+ await page
+ .getByRole("button", { name: L.recordKeyframe, exact: true })
+ .click();
+ await picturesSettled();
+ assert.deepEqual(
+ await pictureSources(),
+ originals,
+ "a keyframe that moves nothing changes no picture",
+ );
+ await awayTarget.fill("-4");
+ await awayTarget.press("Enter");
+ await picturesSettled();
+ assert.notEqual(
+ (await pictureSources())[1],
+ originals[1],
+ "an edited keyframe gives the block a new picture",
+ );
+ assert.equal(
+ (await pictureSources())[0],
+ originals[0],
+ "a keyframe of another camera changes no picture of it",
+ );
+ await stageUndo.click();
+ await stageUndo.click();
+ await picturesSettled();
+ assert.deepEqual(
+ await pictureSources(),
+ originals,
+ "undoing the keyframe and the record puts every picture back",
+ );
+
+ // Scene content at the block's start is part of its picture. The first camera's
+ // marker is moved out of its view. Made at two seconds, the edit writes a keyframe
+ // there and keeps the opening pose, so the block that starts at zero keeps its
+ // picture; made at zero, the same edit changes that block's picture and no other.
+ const greenRow = page
+ .locator(".cw-stage-right-tree")
+ .getByRole("button", { name: "Green marker", exact: true });
+ await greenRow.click();
+ const positionX = page.getByLabel(`${L.position} X`, { exact: true });
+ // The playhead is still at two seconds, from the keyframe above.
+ await positionX.fill("6");
+ await positionX.press("Enter");
+ await picturesSettled();
+ assert.deepEqual(
+ await pictureSources(),
+ originals,
+ "a change made after a block's start leaves its picture as it was",
+ );
+ await stageUndo.click();
+ await picturesSettled();
+ await scrub("0");
+ await positionX.fill("6");
+ await positionX.press("Enter");
+ await picturesSettled();
+ assert.notEqual(
+ (await pictureSources())[0],
+ originals[0],
+ "the block whose camera saw the marker gets a new picture",
+ );
+ assert.equal(
+ (await pictureSources())[1],
+ originals[1],
+ "the block of a camera that does not see it keeps its image",
+ );
+ assert.ok(
+ (await markerShares(blocks.nth(0).locator("img"))).green < 0.05,
+ "the marker has left the first camera's picture",
+ );
+ await stageUndo.click();
+ await picturesSettled();
+ assert.deepEqual(
+ await pictureSources(),
+ originals,
+ "one undo puts the picture back, as the same image",
+ );
+
+ // A picture is of the scene, not of what the viewport marks in it. The marker is
+ // still selected: it glows and the gizmo stands on it. The track is closed and
+ // opened again, so every picture is made anew, and comes out the identical image.
+ const shotsToggle = timeline
+ .locator(".cw-stage-track-group-toggle")
+ .first();
+ await page.evaluate(() => {
+ window.__storyboardHoldIdle = true;
+ });
+ await shotsToggle.click();
+ await blocks.first().waitFor({ state: "detached" });
+ await shotsToggle.click();
+ await blocks.first().waitFor();
+ assert.deepEqual(
+ await thumbnailStates(),
+ [
+ { state: "pending", image: null },
+ { state: "pending", image: null },
+ ],
+ "a track shown again makes its pictures again",
+ );
+ await page.evaluate(() => window.__storyboardReleaseIdle());
+ await picturesSettled();
+ assert.deepEqual(
+ await pictureSources(),
+ originals,
+ "a selected object leaves no mark on the pictures",
+ );
+
+ // ─── Narrow blocks ───
+ // 10. A fourth Director Stage, stored through the HTTP command endpoint. Its main
+ // timeline is twelve seconds, so a block of less than a second is a few dozen
+ // pixels wide: one block of ordinary width, one narrow, one very narrow. Both
+ // narrow blocks show a camera whose name neither could hold.
+ await page.getByRole("button", { name: L.closeEditor, exact: true }).click();
+ await apply.waitFor({ state: "detached" });
+ const NARROW = "cam-long-name";
+ const LONG_NAME = "A camera whose name no narrow block could show";
+ const narrowDocumentId = crypto.randomUUID();
+ const narrowItemId = crypto.randomUUID();
+ const markerStage = await previewDocument();
+ const narrowShots = [
+ { id: "wide", cameraId: ON_MARKER, start: 0, duration: 4 },
+ { id: "narrow", cameraId: NARROW, start: 4, duration: 0.7 },
+ { id: "short", cameraId: NARROW, start: 4.7, duration: 0.3 },
+ ];
+ const createdNarrow = await send("editor.create", {
+ document: {
+ ...payloadOf(markerStage),
+ id: narrowDocumentId,
+ revision: 1,
+ inputConnections: [],
+ data: {
+ ...markerStage.data,
+ duration: 12,
+ // Centred in the first camera's view at one second and at three, and out
+ // of it at two. Every block starts where the marker is centred.
+ objects: markerStage.data.objects.map((object) =>
+ object.id === "green"
+ ? {
+ ...object,
+ keyframes: [1, 2, 3].map((time, index) => ({
+ id: `green-at-${time}`,
+ time,
+ value: {
+ position: { x: index === 1 ? 6 : 0, y: 0, z: 0 },
+ rotation: object.rotation,
+ scale: object.scale,
+ },
+ })),
+ }
+ : object,
+ ),
+ shots: narrowShots,
+ cameras: [
+ ...markerStage.data.cameras,
+ { ...markerStage.data.cameras[0], id: NARROW, name: LONG_NAME },
+ ],
+ },
+ },
+ });
+ assert.equal(createdNarrow.status, "applied", JSON.stringify(createdNarrow));
+ const shownNarrow = await send("canvas.show", {
+ item: {
+ id: narrowItemId,
+ projectId,
+ kind: "external",
+ title: "Narrow stage",
+ position: { x: 2040, y: 262 },
+ width: 340,
+ height: 180,
+ zIndex: 0,
+ locked: false,
+ parentId: null,
+ binding: {
+ role: "editor",
+ objectRef: {
+ objectType: "editor_document",
+ id: narrowDocumentId,
+ kind: "director",
+ },
+ },
+ },
+ });
+ assert.equal(shownNarrow.status, "applied", JSON.stringify(shownNarrow));
+ const narrowNode = page.locator(
+ `.react-flow__node[data-id="${narrowItemId}"]`,
+ );
+ // The canvas is notified of a change made while no editor is open and reads the
+ // project by itself; nothing has to be reloaded.
+ await narrowNode.waitFor();
+ await narrowNode.click();
+ await page.getByRole("button", { name: L.openStage, exact: true }).click();
+ await apply.waitFor();
+ await dynamicPreview.click();
+ await timeline.waitFor();
+ await blocks.nth(2).waitFor();
+ await picturesSettled();
+ await pointerAway();
+ // Pictures for a visual check, when a directory is named for them. Nothing is
+ // selected and the playhead is on the first block: the outline is alone. Past the
+ // Storyboard's end no block has it, and the track is seen as it is. The first block
+ // selected there shows the fill alone; back under the playhead, both together.
+ await shootTimeline("outline-alone");
+ if (screenshotDir) {
+ await scrub("6");
+ await shootTimeline("ordinary-and-narrow");
+ await blocks.nth(0).click();
+ await pointerAway();
+ await shootTimeline("fill-alone");
+ await scrub("1");
+ await shootTimeline("both");
+ await shootWindow("window");
+ await scrub("0");
+ }
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.label),
+ [
+ text(L.storyboardBlock, { name: L.onMarker, start: "0.00", end: "4.00" }),
+ text(L.storyboardBlock, { name: LONG_NAME, start: "4.00", end: "4.70" }),
+ text(L.storyboardBlock, { name: LONG_NAME, start: "4.70", end: "5.00" }),
+ ],
+ "every block still names its camera and its times in full",
+ );
+
+ const narrowImagesBeforeRename = await pictureSources();
+ await blocks.nth(1).click();
+ await cameraNameInput.fill(L.renamedCamera);
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.label),
+ [
+ text(L.storyboardBlock, { name: L.onMarker, start: "0.00", end: "4.00" }),
+ text(L.storyboardBlock, { name: L.renamedCamera, start: "4.00", end: "4.70" }),
+ text(L.storyboardBlock, { name: L.renamedCamera, start: "4.70", end: "5.00" }),
+ ],
+ "one rename updates every block using the camera",
+ );
+ assert.equal(await blocks.nth(1).getAttribute("title"), L.renamedCamera);
+ assert.equal(await blocks.nth(2).getAttribute("title"), L.renamedCamera);
+ assert.deepEqual(await pictureSources(), narrowImagesBeforeRename);
+ await stageUndo.click();
+
+ // Real widths, and what each block gives up at its own width: the name first,
+ // then the picture. The block itself stays whole at every width.
+ const narrowBoxes = await Promise.all(
+ [0, 1, 2].map((index) => rect(blocks.nth(index))),
+ );
+ const widths = narrowBoxes.map((box) => box.width);
+ assert.ok(widths[0] >= 140, `an ordinary block is ${widths[0]}px wide`);
+ assert.ok(
+ widths[1] >= 70 && widths[1] <= 128,
+ `a narrow block is ${widths[1]}px wide`,
+ );
+ assert.ok(widths[2] < 64, `a very narrow block is ${widths[2]}px wide`);
+ /** Whether a block's child is laid out, and how big its box is. */
+ const childBox = (locator) =>
+ locator.evaluate((element) => {
+ const { width, height } = element.getBoundingClientRect();
+ return {
+ shown: getComputedStyle(element).display !== "none" && width > 0,
+ width,
+ height,
+ };
+ });
+ const pictureBox = (index) =>
+ childBox(blocks.nth(index).locator(".cw-stage-storyboard-block-thumbnail"));
+ const nameBox = (index) =>
+ childBox(blocks.nth(index).locator(".cw-stage-storyboard-block-name"));
+ assert.ok(
+ (await pictureBox(0)).shown && (await nameBox(0)).shown,
+ "an ordinary block shows its picture and its name",
+ );
+ const narrowPicture = await pictureBox(1);
+ assert.equal(
+ (await nameBox(1)).shown,
+ false,
+ "a narrow block hides its name",
+ );
+ assert.ok(
+ narrowPicture.shown && narrowPicture.height >= 24,
+ `a narrow block keeps its picture, ${narrowPicture.height}px high`,
+ );
+ assert.ok(
+ narrowPicture.width <= widths[1],
+ "and the picture lies inside the narrow block",
+ );
+ assert.ok(
+ (await markerShares(blocks.nth(1).locator("img"))).green > 0.05,
+ "and it is a picture of the camera's view",
+ );
+ assert.equal(
+ (await pictureBox(2)).shown,
+ false,
+ "a very narrow block hides its picture too",
+ );
+ assert.equal(
+ (await nameBox(2)).shown,
+ false,
+ "and its name",
+ );
+ assert.deepEqual(
+ await Promise.all(
+ [0, 1, 2].map((index) => blocks.nth(index).getAttribute("title")),
+ ),
+ [L.onMarker, LONG_NAME, LONG_NAME],
+ "a block names its camera in full in `title`, whatever it can show",
+ );
+
+ // A narrow block still leaves a body target that selects it and its camera
+ // without moving the playhead.
+ const narrowLaneHeight = Math.floor(
+ narrowBoxes[2].y + narrowBoxes[2].height / 2,
+ );
+ for (const [index, fromLeft] of [
+ [1, widths[1] / 2],
+ [2, widths[2] / 2],
+ ]) {
+ await page.mouse.click(narrowBoxes[index].x + fromLeft, narrowLaneHeight);
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.selected),
+ index === 1 ? ["false", "true", "false"] : ["false", "false", "true"],
+ `a click on block ${index + 1} selects it`,
+ );
+ assert.equal(await editCamera.inputValue(), NARROW, "and its camera");
+ assert.equal(
+ await playhead(),
+ "0",
+ `the click on block ${index + 1} moves no playhead`,
+ );
+ }
+ await pointerAway();
+
+ // ─── Pictures made while the playhead runs ───
+ // 11. Every picture is made with the green marker centred, because every block
+ // starts there. While the playhead crosses the second in which the marker is
+ // out of view, pictures are made again: a fourth block on the second camera is
+ // added, and the scene is changed so that every picture waits. The viewport must
+ // show the marker where the playhead has it, never where a picture does, and a
+ // click on a block must still be answered at once.
+ await page.evaluate(() => {
+ window.__storyboardHoldIdle = true;
+ });
+ await openChooser();
+ await chooser.getByRole("button", { name: L.away, exact: true }).click();
+ await blocks.nth(3).waitFor();
+ await page
+ .locator(".cw-stage-right-tree")
+ .getByRole("button", { name: "Magenta marker", exact: true })
+ .click();
+ const magentaX = page.getByLabel(`${L.position} X`, { exact: true });
+ await magentaX.fill("7");
+ await magentaX.press("Enter");
+ await settle();
+ assert.deepEqual(
+ (await thumbnailStates()).map((thumbnail) => thumbnail.state),
+ ["pending", "pending", "pending", "pending"],
+ "every picture waits while idle time is held",
+ );
+ await scrub("0");
+ await page.getByRole("button", { name: L.playAction, exact: true }).click();
+ // The viewport is watched from this side for as long as the playhead needs to cross
+ // the gap: the share of the middle of the picture that is each marker's colour, on
+ // every frame and between frames.
+ const watching = page.evaluate(async (ms) => {
+ const canvas = document.querySelector(".cw-stage-scene canvas");
+ const copy = document.createElement("canvas");
+ copy.width = 32;
+ copy.height = 18;
+ const context = copy.getContext("2d", { willReadFrequently: true });
+ const sample = () => {
+ context.drawImage(canvas, 0, 0, 32, 18);
+ const { data } = context.getImageData(0, 0, 32, 18);
+ let green = 0;
+ let magenta = 0;
+ for (let y = 4; y < 14; y += 1)
+ for (let x = 8; x < 24; x += 1) {
+ const offset = (y * 32 + x) * 4;
+ const red = data[offset];
+ const g = data[offset + 1];
+ const b = data[offset + 2];
+ if (g - Math.max(red, b) > 40) green += 1;
+ if (Math.min(red, b) - g > 40) magenta += 1;
+ }
+ context.drawImage(canvas, 0, canvas.height - 72, 128, 72, 0, 0, 32, 18);
+ const corner = context.getImageData(8, 4, 16, 10).data;
+ let cornerMarker = 0;
+ for (let offset = 0; offset < corner.length; offset += 4) {
+ const [r, g, b] = corner.subarray(offset, offset + 3);
+ if (g - Math.max(r, b) > 40 || Math.min(r, b) - g > 40) cornerMarker += 1;
+ }
+ return { green: green / 160, magenta: magenta / 160, cornerMarker };
+ };
+ const samples = [];
+ const statesSeen = new Set();
+ // How many pictures became ready together. Mutations made in one task are
+ // delivered together, so this counts the pictures one task made. It goes on
+ // past the window: how many pictures fit in it is the machine's speed, while
+ // one picture per task is the rule.
+ const readyPerTask = [];
+ const observer = new MutationObserver((records) => {
+ const ready = records.filter(
+ (record) =>
+ record.target.dataset.thumbnailState === "ready" &&
+ record.oldValue !== "ready",
+ ).length;
+ if (ready) readyPerTask.push(ready);
+ });
+ for (const element of document.querySelectorAll(
+ '[data-testid="director-stage-storyboard-block"]',
+ ))
+ observer.observe(element, {
+ attributes: true,
+ attributeOldValue: true,
+ attributeFilter: ["data-thumbnail-state"],
+ });
+ // The journey reads the count, and stops it, once every picture is ready.
+ window.__storyboardPictureTasks = {
+ count: () => readyPerTask.slice(),
+ stop: () => observer.disconnect(),
+ };
+ let stop = false;
+ const look = () => {
+ for (const element of document.querySelectorAll(
+ '[data-testid="director-stage-storyboard-block"]',
+ ))
+ statesSeen.add(element.dataset.thumbnailState);
+ };
+ const frame = () => {
+ if (stop) return;
+ samples.push(sample());
+ look();
+ requestAnimationFrame(frame);
+ };
+ const tick = () => {
+ if (stop) return;
+ samples.push(sample());
+ setTimeout(tick, 0);
+ };
+ requestAnimationFrame(frame);
+ setTimeout(tick, 0);
+ await new Promise((done) => setTimeout(done, ms));
+ stop = true;
+ return {
+ samples,
+ statesSeen: [...statesSeen],
+ readyPerTask: readyPerTask.slice(),
+ };
+ }, 3600);
+ await page.evaluate(() => window.__storyboardReleaseIdle());
+ // Eight clicks on the timeline, each timed from here: from sending the click to the
+ // page having handled it, which includes any wait for the main thread.
+ const clickBoxes = await Promise.all(
+ [0, 1].map((index) => blocks.nth(index).boundingBox()),
+ );
+ const answeredIn = [];
+ for (let round = 0; round < 8; round += 1) {
+ const box = clickBoxes[round % 2];
+ const started = performance.now();
+ await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);
+ answeredIn.push(Math.round(performance.now() - started));
+ }
+ const { samples, statesSeen, readyPerTask } = await watching;
+ await page.getByRole("button", { name: L.pause, exact: true }).click();
+ await picturesSettled();
+ await pointerAway();
+ // The canvas can trail the transport by a frame, so the samples are judged against
+ // each other, not against the playhead's time. Out of the view the marker is gone
+ // for a while. A frame left posed for a picture would show it at rest: in that
+ // while, or for a single frame on its way.
+ const green = samples.map((sample) => sample.green);
+ const shares = (list) => [...new Set(list.map((share) => share.toFixed(2)))];
+ assert.ok(
+ samples.every((sample) => sample.magenta < 0.02),
+ "the viewport never shows the other camera's marker",
+ );
+ assert.ok(
+ samples.every((sample) => sample.cornerMarker < 4),
+ "no thumbnail marker leaks into the viewport's bottom-left corner",
+ );
+ assert.ok(
+ green.slice(0, 3).every((share) => share > 0.5),
+ `the viewport opens on the marker in view: ${shares(green.slice(0, 6))}`,
+ );
+ assert.ok(
+ green.slice(-3).every((share) => share > 0.5),
+ `and closes on it back in view: ${shares(green.slice(-6))}`,
+ );
+ const firstGone = green.indexOf(0);
+ const lastGone = green.lastIndexOf(0);
+ assert.ok(
+ firstGone >= 0 && lastGone - firstGone >= 3,
+ `the marker was watched out of view: ${lastGone - firstGone + 1} samples of ${samples.length}`,
+ );
+ assert.deepEqual(
+ [...new Set(green.slice(firstGone, lastGone + 1))],
+ [0],
+ "while the marker is out of view, no frame brings it back",
+ );
+ // A frame left posed for a picture shows the marker at rest. On its way back the
+ // marker covers a share that rises above its share at rest before it settles, so
+ // the samples are not asked to rise or fall evenly. What does not happen on its
+ // own is one sample at the share at rest with both its neighbours well below it.
+ const atRest = (share) => Math.abs(share - green.at(-1)) <= 0.03;
+ const spike = green.findIndex(
+ (share, index) =>
+ index > 0 &&
+ index < green.length - 1 &&
+ atRest(share) &&
+ green[index - 1] <= share - 0.15 &&
+ green[index + 1] <= share - 0.15,
+ );
+ assert.equal(
+ spike,
+ -1,
+ `one frame shows the marker at rest between frames that do not: sample ${spike} of ${green.length}, ${shares(green.slice(Math.max(0, spike - 3), spike + 4))}`,
+ );
+ assert.ok(statesSeen.includes("pending"), "pictures waited while the playhead ran");
+ assert.deepEqual(
+ (await thumbnailStates()).map((thumbnail) => thumbnail.state),
+ ["ready", "ready", "ready", "ready"],
+ "and were all made by the end of it",
+ );
+ assert.equal(answeredIn.length, 8, "every click was sent");
+ const slowestClick = Math.max(...answeredIn);
+ // A picture costs the main thread little; how long a click waits is mostly a frame.
+ // The line says only that the page never stood still.
+ assert.ok(
+ slowestClick < 1000,
+ `the slowest of eight clicks took ${slowestClick} ms: ${answeredIn.join(", ")} ms`,
+ );
+ // How many pictures fit in the window is the machine's speed. That pictures are
+ // made in it, while the playhead runs, is what the window is for.
+ assert.ok(
+ readyPerTask.length >= 1,
+ `pictures became ready while the playhead ran: ${readyPerTask.length} tasks`,
+ );
+ // Every picture was made by now, so every task that made one has been counted.
+ const pictureTasks = await page.evaluate(() => {
+ const { count, stop } = window.__storyboardPictureTasks;
+ stop();
+ return count();
+ });
+ assert.ok(
+ pictureTasks.length >= 4,
+ `pictures were made in ${pictureTasks.length} tasks`,
+ );
+ assert.deepEqual(
+ [...new Set(pictureTasks)],
+ [1],
+ "a task makes at most one picture",
+ );
+
+ // ─── What a load puts into the scene ───
+ // 12. A fifth Director Stage, stored through the HTTP command endpoint, holds an
+ // imported model: a real GLB, registered as a project asset the way the stage's
+ // own import registers one. It is a red square that fills the view of the camera
+ // that faces it; the other camera faces away. The document cannot say whether
+ // the model has loaded, nor whether a background image's texture has arrived. A
+ // picture made before either lands would stand until the document changed. The
+ // viewport counts each landing, and every picture is made again.
+ await stageUndo.click();
+ await page.getByRole("button", { name: L.closeEditor, exact: true }).click();
+ await apply.waitFor({ state: "detached" });
+
+ // Run the load captures at 2× so the pixel check also covers the source crop
+ // on a high-density display.
+ const highDensity = await page.context().newCDPSession(page);
+ await highDensity.send("Emulation.setDeviceMetricsOverride", {
+ ...page.viewportSize(),
+ deviceScaleFactor: 2,
+ mobile: false,
+ });
+
+ const MODEL = "panel";
+ const MODEL_NAME = "Panel";
+ const MODEL_VIEW = "cam-on-model";
+ const modelDocumentId = crypto.randomUUID();
+ const modelItemId = crypto.randomUUID();
+ const modelUpload = crypto.randomUUID();
+ const upload = await fetch(
+ `${api}/api/creation/projects/${projectId}/uploads/${modelUpload}`,
+ {
+ method: "PUT",
+ headers: {
+ ...headers,
+ "X-OpenDirector-Session": browserSession,
+ "Content-Type": "application/octet-stream",
+ "X-Asset-Name": encodeURIComponent("panel.glb"),
+ "X-Asset-Kind": "file",
+ },
+ body: makePanelGlb(),
+ },
+ );
+ assert.ok(upload.ok, `the model's upload: ${upload.status}`);
+ assert.equal(
+ (
+ await send("asset.import", {
+ uploadHandle: modelUpload,
+ name: "panel.glb",
+ expectedKind: "file",
+ })
+ ).status,
+ "applied",
+ );
+ const modelAsset = (await state()).assets.find(
+ (asset) => asset.name === "panel.glb",
+ );
+ assert.ok(modelAsset, "the model is registered as a project asset");
+ assert.equal(
+ (
+ await send("editor.create", {
+ document: {
+ ...payloadOf(markerStage),
+ id: modelDocumentId,
+ revision: 1,
+ inputConnections: [],
+ data: {
+ ...markerStage.data,
+ duration: 6,
+ // The stage's own stored camera must be one of its cameras.
+ activeCameraId: MODEL_VIEW,
+ cameras: [
+ rig(MODEL_VIEW, L.onModel, { x: 0, y: 1, z: 5 }, { x: 0, y: 1, z: 0 }),
+ rig(AWAY, L.away, { x: 4, y: 1, z: 5 }, { x: 8, y: 1, z: 5 }),
+ ],
+ shots: [
+ { id: "model", cameraId: MODEL_VIEW, start: 0, duration: 2 },
+ { id: "away", cameraId: AWAY, start: 2, duration: 2 },
+ ],
+ objects: [
+ {
+ id: MODEL,
+ kind: "gltf",
+ name: MODEL_NAME,
+ // The placeholder's own colour: a plain grey, neither of the two below.
+ color: "#808080",
+ visible: true,
+ locked: false,
+ opacity: 1,
+ position: { x: 0, y: 1, z: 0 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ keyframes: [],
+ motionClips: [],
+ asset: {
+ assetId: modelAsset.id,
+ revision: modelAsset.revision,
+ fingerprint: modelAsset.fingerprint,
+ kind: modelAsset.kind,
+ },
+ role: "scene",
+ format: "glb",
+ animationNames: [],
+ hasAnimation: false,
+ },
+ ],
+ stills: [],
+ },
+ },
+ })
+ ).status,
+ "applied",
+ );
+ assert.equal(
+ (
+ await send("canvas.show", {
+ item: {
+ id: modelItemId,
+ projectId,
+ kind: "external",
+ title: "Model stage",
+ position: { x: 2380, y: 262 },
+ width: 340,
+ height: 180,
+ zIndex: 0,
+ locked: false,
+ parentId: null,
+ binding: {
+ role: "editor",
+ objectRef: {
+ objectType: "editor_document",
+ id: modelDocumentId,
+ kind: "director",
+ },
+ },
+ },
+ })
+ ).status,
+ "applied",
+ );
+ const modelNode = page.locator(
+ `.react-flow__node[data-id="${modelItemId}"]`,
+ );
+ const openModel = async () => {
+ await modelNode.click();
+ await page.getByRole("button", { name: L.openStage, exact: true }).click();
+ await apply.waitFor();
+ await dynamicPreview.click();
+ await timeline.waitFor();
+ await blocks.nth(1).waitFor();
+ await page.waitForFunction(() => {
+ const canvas = document.querySelector(".cw-stage-scene canvas");
+ return canvas?.width > canvas?.clientWidth * 1.9;
+ });
+ };
+ /** The share of a picture that is the model's red and the share that is the
+ * background image's orange. The two are told apart by their green, of which the red
+ * has almost none. A grey of the stage leads with neither. */
+ const modelShares = (locator) =>
+ locator.evaluate(
+ (element) =>
+ new Promise((resolve, reject) => {
+ const image = new Image();
+ image.onload = () => {
+ const copy = document.createElement("canvas");
+ copy.width = image.naturalWidth;
+ copy.height = image.naturalHeight;
+ const context = copy.getContext("2d");
+ context.drawImage(image, 0, 0);
+ const { data } = context.getImageData(0, 0, copy.width, copy.height);
+ const found = { pixels: copy.width * copy.height, red: 0, orange: 0 };
+ for (let offset = 0; offset < data.length; offset += 4) {
+ const [red, green, blue] = [
+ data[offset],
+ data[offset + 1],
+ data[offset + 2],
+ ];
+ if (
+ red > 120 &&
+ green < 90 &&
+ blue < 90 &&
+ red - Math.max(green, blue) > 60
+ )
+ found.red += 1;
+ if (
+ red > 150 &&
+ green > 80 &&
+ green < 200 &&
+ blue < 80 &&
+ red - green > 60 &&
+ green - blue > 50
+ )
+ found.orange += 1;
+ }
+ resolve({
+ red: found.red / found.pixels,
+ orange: found.orange / found.pixels,
+ });
+ };
+ image.onerror = () => reject(new Error("the picture did not decode"));
+ image.src = element.src;
+ }),
+ );
+ const bothShares = () =>
+ Promise.all([0, 1].map((index) => modelShares(blocks.nth(index).locator("img"))));
+ const thumbnailStatesList = () =>
+ blocks.evaluateAll((elements) =>
+ elements.map((element) => element.dataset.thumbnailState),
+ );
+ /** Waits until block `index` is ready with a picture other than `before`. */
+ const pictureChanged = (index, before) =>
+ page.waitForFunction(
+ ({ index, before }) => {
+ const element = document.querySelectorAll(
+ '[data-testid="director-stage-storyboard-block"]',
+ )[index];
+ return (
+ element?.dataset.thumbnailState === "ready" &&
+ (element.querySelector("img")?.getAttribute("src") ?? null) !== before
+ );
+ },
+ { index, before },
+ { polling: 50 },
+ );
+ const modelDocument = JSON.stringify(director(await state(), modelItemId).document);
+
+ // The model's read is held from before the editor opens. Each block then shows the
+ // model's placeholder and settles ready: a picture is not kept waiting for a model.
+ await page.evaluate(() => {
+ window.__storyboardHoldModel = true;
+ });
+ await openModel();
+ await picturesSettled();
+ assert.ok(
+ (await page.evaluate(() => window.__storyboardModelReads)) >= 1,
+ "the model's read is held",
+ );
+ const placeholderPictures = await pictureSources();
+ const placeholderShares = await bothShares();
+ assert.deepEqual(
+ placeholderShares.map((share) => share.red < 0.01),
+ [true, true],
+ `a picture made of the placeholder shows no model: ${JSON.stringify(placeholderShares)}`,
+ );
+ // The editor is open and contentAnswers while the model is outstanding.
+ await blocks.nth(1).click();
+ assert.deepEqual(
+ (await blockStates()).map((block) => block.selected),
+ ["false", "true"],
+ "a block is selected while the model's read is held",
+ );
+ await pointerAway();
+
+ // The read is let in: the model loads, and the picture is made again and now shows
+ // it. The camera facing away gets a new picture too, and it still shows no model.
+ await page.evaluate(() => window.__storyboardReleaseModel());
+ await pictureChanged(0, placeholderPictures[0]);
+ await picturesSettled();
+ const loadedShares = await bothShares();
+ assert.ok(
+ loadedShares[0].red > 0.15,
+ `the block's new picture shows the loaded model: ${JSON.stringify(loadedShares[0])}`,
+ );
+ assert.ok(
+ loadedShares[1].red < 0.01,
+ `the camera facing away still shows none: ${JSON.stringify(loadedShares[1])}`,
+ );
+
+ // A background image is a texture the scene loads after the document names it. Its
+ // request is held back, as the append's reply was held: the blocks settle ready on
+ // the plain background colour, and are made again when the texture arrives.
+ const contentRoute = /\/assets\/[0-9a-f-]{36}\/content$/;
+ let contentAnswer = "pass";
+ const heldContent = [];
+ let reportContentHeld;
+ const contentRequestHeld = () =>
+ new Promise((resolve) => {
+ reportContentHeld = resolve;
+ });
+ await page.route(contentRoute, (route) => {
+ // Only the background's request is ever held; the model's is not asked for again.
+ if (contentAnswer === "pass" || route.request().url().includes(modelAsset.id))
+ return route.continue();
+ if (contentAnswer === "fail") return route.abort("failed");
+ return new Promise((done) => {
+ reportContentHeld?.();
+ heldContent.push({ route, done });
+ });
+ });
+ /** Answers every held request as `next` says, and returns once each is contentAnswered. */
+ const contentAnswerContent = async (next) => {
+ contentAnswer = next;
+ for (const { route, done } of heldContent.splice(0)) {
+ await (next === "fail" ? route.abort("failed") : route.continue());
+ done();
+ }
+ };
+ const ORANGE = "orange.png";
+ await page.getByRole("tab", { name: L.backgroundTab, exact: true }).click();
+ const orangeHeld = contentRequestHeld();
+ contentAnswer = "hold";
+ await page
+ .getByLabel(L.backgroundAdd, { exact: true })
+ .setInputFiles({
+ name: ORANGE,
+ mimeType: "image/png",
+ buffer: makePng(8, 8, [255, 128, 0]),
+ });
+ await orangeHeld;
+ await page
+ .getByText(text(L.backgroundImported, { name: ORANGE }), { exact: true })
+ .waitFor();
+ await picturesSettled();
+ const flatShares = await bothShares();
+ assert.deepEqual(
+ flatShares.map((share) => share.orange < 0.01),
+ [true, true],
+ `while the image's request is held, the pictures show the plain colour: ${JSON.stringify(flatShares)}`,
+ );
+ const flatPictures = await pictureSources();
+ await contentAnswerContent("pass");
+ await Promise.all(
+ [0, 1].map((index) => pictureChanged(index, flatPictures[index])),
+ );
+ await picturesSettled();
+ const textureShares = await bothShares();
+ assert.deepEqual(
+ textureShares.map((share) => share.orange > 0.2),
+ [true, true],
+ `once the texture arrives, every new picture shows it: ${JSON.stringify(textureShares)}`,
+ );
+ assert.equal(
+ await page.getByLabel(L.backgroundAsset, { exact: true }).inputValue(),
+ (await state()).assets.find((asset) => asset.name === ORANGE).id,
+ "and the stage names the image as its background",
+ );
+
+ // A background that cannot be loaded is the other way a load lands. The second
+ // image's request is held and then refused. The pictures made meanwhile are made
+ // again once the refusal is known, with nothing left waiting.
+ const BLUE = "missing.png";
+ const blueHeld = contentRequestHeld();
+ contentAnswer = "hold";
+ await page
+ .getByLabel(L.backgroundAdd, { exact: true })
+ .setInputFiles({
+ name: BLUE,
+ mimeType: "image/png",
+ buffer: makePng(8, 8, [0, 128, 255]),
+ });
+ await blueHeld;
+ // The held request can be the Background tab's own preview of the new asset,
+ // asked for as soon as the asset is in the project and before the stage names
+ // it as its background. Until the stage has, every block still shows the
+ // picture it made for the orange texture, ready, and a wait for settled
+ // pictures returns on those at once. The import's notice comes with the edit.
+ await page
+ .getByText(text(L.backgroundImported, { name: BLUE }), { exact: true })
+ .waitFor();
+ await picturesSettled();
+ const beforeRefusal = await pictureSources();
+ await page.evaluate(() => {
+ window.__storyboardHoldIdle = true;
+ });
+ await contentAnswerContent("fail");
+ await page.waitForFunction(
+ () =>
+ [
+ ...document.querySelectorAll(
+ '[data-testid="director-stage-storyboard-block"]',
+ ),
+ ].every((element) => element.dataset.thumbnailState === "pending"),
+ null,
+ { polling: 50 },
+ );
+ // The refusal is reported where the stage reports a load that could not be made.
+ await page.getByRole("tab", { name: L.objectsTab, exact: true }).click();
+ await page.getByText(L.backgroundUnavailable, { exact: true }).waitFor();
+ await page.evaluate(() => window.__storyboardReleaseIdle());
+ await picturesSettled();
+ const refusedShares = await bothShares();
+ assert.deepEqual(
+ refusedShares.map((share) => share.orange < 0.01),
+ [true, true],
+ `the pictures made after the refusal show the plain colour: ${JSON.stringify(refusedShares)}`,
+ );
+ assert.deepEqual(
+ await thumbnailStatesList(),
+ ["ready", "ready"],
+ "no block is left pending",
+ );
+ assert.deepEqual(
+ await pictureSources(),
+ beforeRefusal,
+ "and each is the same picture that was made while the request was held",
+ );
+ contentAnswer = "pass";
+ await page.unroute(contentRoute);
+ assert.equal(
+ JSON.stringify(director(await state(), modelItemId).document),
+ modelDocument,
+ "none of that reached the stored document",
+ );
+ // The two backgrounds were the only edits: undone, the editor closes without asking
+ // to apply anything.
+ await stageUndo.click();
+ await stageUndo.click();
+ assert.equal(
+ await page.getByLabel(L.backgroundAsset, { exact: true }).inputValue(),
+ "",
+ "two undos take the stage back to no background image",
+ );
+ await page.getByRole("button", { name: L.closeEditor, exact: true }).click();
+ await apply.waitFor({ state: "detached" });
+
+ // The model's load can fail too. Opened again with the read made to fail, the
+ // placeholder's picture is made as before; once the failure is known every picture
+ // is made again and settles ready, and the failure is reported and writes nothing.
+ await page.evaluate(() => {
+ window.__storyboardHoldModel = true;
+ window.__storyboardFailModel = true;
+ });
+ await openModel();
+ await picturesSettled();
+ assert.ok(
+ (await page.evaluate(() => window.__storyboardModelReads)) >= 2,
+ "the model's read is held again",
+ );
+ assert.deepEqual(
+ await pictureSources(),
+ placeholderPictures,
+ "the placeholder gives the same pictures it did before",
+ );
+ await page.evaluate(() => {
+ window.__storyboardHoldIdle = true;
+ });
+ await page.evaluate(() => window.__storyboardReleaseModel());
+ await page
+ .getByRole("alert")
+ .filter({ hasText: text(L.modelLoadFailed, { name: MODEL_NAME }) })
+ .waitFor();
+ await page.waitForFunction(
+ () =>
+ [
+ ...document.querySelectorAll(
+ '[data-testid="director-stage-storyboard-block"]',
+ ),
+ ].every((element) => element.dataset.thumbnailState === "pending"),
+ null,
+ { polling: 50 },
+ );
+ await page.evaluate(() => window.__storyboardReleaseIdle());
+ await picturesSettled();
+ assert.deepEqual(
+ await thumbnailStatesList(),
+ ["ready", "ready"],
+ "after the failed load no block is left pending",
+ );
+ assert.deepEqual(
+ await pictureSources(),
+ placeholderPictures,
+ "and each shows the placeholder, as the scene still does",
+ );
+ assert.equal(
+ JSON.stringify(director(await state(), modelItemId).document),
+ modelDocument,
+ "a failed load writes nothing either",
+ );
+ await page.getByRole("button", { name: L.closeEditor, exact: true }).click();
+ await apply.waitFor({ state: "detached" });
+
+ // Deleting a block uses its own pointer target and ripples the rest of the track.
+ await openPreview();
+ await openChooser();
+ await chooser.getByRole("button", { name: L.away, exact: true }).click();
+ const repeating = await storedPreview(3, "repeated camera block persisted");
+ const [head, middle, tail] = repeating.data.shots;
+ const blockById = (id) => blocks.and(shotsRow.locator(`[data-block-id="${id}"]`));
+ const trash = (id) =>
+ shotsRow
+ .getByTestId("director-stage-storyboard-delete-block")
+ .and(shotsRow.locator(`[data-block-id="${id}"]`));
+ const removeBlock = async (index, block) => {
+ await blocks.nth(index).hover();
+ assert.equal(await trash(block.id).getAttribute("aria-label"), L.deleteBlock);
+ await trash(block.id).click();
+ await blockById(block.id).waitFor({ state: "detached" });
+ };
+ await blocks.nth(1).click();
+ await previewSource.first().selectOption("storyboard");
+ await scrub("3");
+ const beforeDeleteTime = await playhead();
+ await previewSource.first().hover();
+ assert.deepEqual(await trash(middle.id).evaluate((element) => {
+ const { opacity, pointerEvents } = getComputedStyle(element);
+ return [opacity, pointerEvents];
+ }), ["0", "none"], "trash is hidden and cannot intercept pointers off hover");
+ await blocks.nth(1).hover();
+ const trashBounds = await trash(middle.id).boundingBox();
+ assert.ok(trashBounds && trashBounds.width <= 22 && trashBounds.height <= 22);
+ await removeBlock(1, middle);
+ const rippled = await storedPreview(2, "middle deletion persisted");
+ assert.deepEqual(rippled.data.shots, [head, { ...tail, start: 2 }]);
+ assert.deepEqual((await blockStates()).map((block) => block.selected), ["false", "false"]);
+ assert.equal(await playhead(), beforeDeleteTime);
+ assert.equal(await blocks.nth(1).getAttribute("aria-current"), "time");
+ assert.equal(await shownSource(), "storyboard");
+ await stageUndo.click();
+ assert.deepEqual((await blockStates()).map((block) => block.id), storedIds(repeating));
+
+ await blocks.nth(2).click();
+ await previewSource.first().selectOption("storyboard");
+ await deleteCamera.click();
+ await blockById(tail.id).waitFor({ state: "detached" });
+ const cascaded = await storedPreview(1, "camera cascade persisted");
+ assert.deepEqual(cascaded.data.cameras.map((camera) => camera.id), [ON_MARKER]);
+ assert.deepEqual(cascaded.data.shots, [head]);
+ assert.equal((await blockStates())[0].selected, "false");
+ assert.equal(await shownSource(), "storyboard");
+ assert.equal(await deleteCamera.isEnabled(), false, "the last camera is protected");
+ await stageUndo.click();
+ assert.deepEqual((await blockStates()).map((block) => block.id), storedIds(repeating));
+ assert.deepEqual((await previewOptions()).map((option) => option.value), [
+ "storyboard", cameraOption(ON_MARKER), cameraOption(AWAY),
+ ]);
+ assert.equal(await shownSource(), "storyboard");
+
+ let exportedMp4;
+ if (verifyMp4) {
+ // Reload the exact document edited above. Change only transient presentation
+ // before exporting, and check the authoritative revision accepted for rendering.
+ await apply.click();
+ await apply.waitFor({ state: "detached" });
+ await page.reload();
+ await page.getByText(L.saved, { exact: true }).waitFor();
+ await openPreview();
+ assert.deepEqual((await blockStates()).map(({ id }) => id), storedIds(repeating));
+ const beforeExport = await previewDocument();
+ const existingAssets = new Set((await state()).assets.map(({ id }) => id));
+ await blocks.first().click();
+ await blocks.last().hover();
+ await scrub("3");
+ await previewSource.first().selectOption(cameraOption(ON_MARKER));
+ assert.deepEqual(await previewDocument(), beforeExport);
+ await page.getByRole("button", { name: L.renderMp4, exact: true }).click();
+ const dialog = page.getByRole("dialog", { name: L.exportVideo });
+ await dialog.getByLabel(L.exportSourceLabel).selectOption({ label: L.exportSourceStoryboard });
+ await dialog.getByLabel(L.exportFps).selectOption("24");
+ assert.ok((await dialog.innerText()).includes(L.exportNote));
+ await dialog.getByRole("button", { name: L.exportConfirm, exact: true }).click();
+ const downloadButton = page.getByRole("button", { name: L.downloadMp4, exact: true });
+ await downloadButton.waitFor({ timeout: 180000 });
+ const downloaded = page.waitForEvent("download");
+ await downloadButton.click();
+ const evidenceDir = await mkdtemp(join(tmpdir(), "director-storyboard-acceptance-"));
+ try {
+ const mp4 = join(evidenceDir, "storyboard.mp4");
+ await (await downloaded).saveAs(mp4);
+ const { duration, stream, colors } = probeMp4(mp4);
+ assert.equal(stream.codec_name, "h264");
+ assert.equal(duration, 6);
+ assert.equal(stream.r_frame_rate, "24/1");
+ assert.equal(Number(stream.nb_read_frames), 144);
+ assert.equal(colors.length, 144);
+ for (const index of [0, 47, 48, 95, 96, 143]) {
+ const [red, green, blue] = colors[index];
+ assert.ok(index < 48 ? green > red && green > blue : red > green && blue > green,
+ `wrong camera at frame ${index}: ${colors[index]}`);
+ }
+ exportedMp4 = { duration, frameRate: stream.r_frame_rate, frames: colors.length };
+ } finally {
+ await rm(evidenceDir, { recursive: true, force: true });
+ }
+ await page.getByRole("button", { name: L.publishMp4, exact: true }).click();
+ const publishedVideo = (snapshot) => snapshot.assets.find(
+ (asset) => !existingAssets.has(asset.id) &&
+ asset.kind === "video" && asset.provenance.source === "rendered",
+ );
+ const published = await until(publishedVideo, "Storyboard MP4 published");
+ const { provenance } = publishedVideo(published);
+ assert.equal(provenance.directorRender.sourceEditorId, previewDocumentId);
+ assert.equal(provenance.directorRender.sourceEditorRevision, beforeExport.revision);
+ assert.equal(provenance.directorRender.plan.cameraSource, "storyboard");
+ assert.equal(provenance.directorRender.plan.durationSeconds, 6);
+ assert.equal(provenance.directorRender.plan.frameRate, 24);
+ assert.deepEqual(
+ published.editorDocuments.find(({ id }) => id === provenance.editorDocumentId).data.shots,
+ beforeExport.data.shots,
+ );
+ assert.deepEqual(await previewDocument(), beforeExport);
+ }
+
+ await previewSource.first().selectOption(cameraOption(AWAY));
+ await blocks.nth(2).click();
+ await deleteCamera.click();
+ await blockById(tail.id).waitFor({ state: "detached" });
+ await storedPreview(1, "concrete preview camera deleted");
+ assert.equal(await shownSource(), cameraOption(ON_MARKER));
+ await previewSource.first().selectOption("storyboard");
+ await removeBlock(0, head);
+ const emptyStage = director(
+ await until(
+ (snapshot) => director(snapshot, previewItemId).document?.data.shots.length === 0,
+ "last block deletion persisted",
+ ),
+ previewItemId,
+ ).document;
+ await blocks.first().waitFor({ state: "detached" });
+ assert.equal(await shownSource(), cameraOption(ON_MARKER));
+ assert.equal((await previewOptions())[0].disabled, true);
+ assert.deepEqual(emptyStage.data.cameras.map((camera) => camera.id), [ON_MARKER]);
+ await stageUndo.click();
+ assert.deepEqual((await blockStates()).map((block) => block.id), [head.id]);
+ assert.equal(await shownSource(), "storyboard");
+ await stageRedo.click();
+ await blocks.first().waitFor({ state: "detached" });
+ await openChooser();
+ await chooser.getByRole("button", { name: L.onMarker, exact: true }).click();
+ const appendedAfterFallback = await storedPreview(1, "append after preview fallback");
+ assert.equal(await shownSource(), cameraOption(ON_MARKER));
+ await removeBlock(0, appendedAfterFallback.data.shots[0]);
+ await blocks.first().waitFor({ state: "detached" });
+ await page.getByRole("button", { name: L.closeEditor, exact: true }).click();
+ await apply.waitFor({ state: "detached" });
+ await page.reload();
+ await page.getByText(L.saved, { exact: true }).waitFor();
+ await openPreview();
+ assert.equal(await blocks.count(), 0);
+ assert.equal((await previewOptions())[0].disabled, true);
+ assert.equal(await shownSource(), cameraOption(ON_MARKER));
+
+ assert.deepEqual(errors, []);
+ await highDensity.detach();
+ console.log(
+ JSON.stringify({
+ passed: true,
+ projectId,
+ itemId,
+ documentId,
+ agentDocumentId,
+ exportedMp4,
+ firstDragFeedbackMs,
+ playback: {
+ samples: samples.length,
+ slowestClickMs: slowestClick,
+ clickMs: answeredIn,
+ readyPerTask,
+ },
+ // The shares of each picture that are the model's red and the background
+ // image's orange, block by block, at every state of the loads.
+ loads: {
+ placeholder: placeholderShares,
+ loaded: loadedShares,
+ backgroundHeld: flatShares,
+ texture: textureShares,
+ textureRefused: refusedShares,
+ },
+ checks: [
+ "chooser geometry, list, search and every way it closes",
+ "first add through the shared command without Apply edits",
+ "the same camera again is a new block identity",
+ "a command in flight disables `+` and names why",
+ "two-second default and the tail fill",
+ "disabled `+` names its reason",
+ "new block selected, playhead at its start, camera selected, preview source untouched",
+ "ordinary block click selects block and camera only",
+ "a conflicting add is refused with its reason and writes nothing",
+ "a dirty draft is committed before the add",
+ "one local undo step and one project history step, with redo",
+ "save and reopen",
+ "stage JSON with gaps is refused and leaves the draft",
+ "the same inputs through the HTTP command endpoint and the Storyboard query",
+ "a stored discontinuous track is refused on open while the canvas stays usable",
+ "preview source: Storyboard first, then the cameras; a rename renames its option",
+ "an empty Storyboard cannot be previewed and the selector names why",
+ "Storyboard preview and still capture hold the last sampled camera and scene while the editing viewport advances",
+ "a pinned preview ignores block selection, the playhead and an added block",
+ "moving or playing the playhead changes no selection and takes no focus",
+ "the preview source, selection and the playhead never dirty the draft or the stored document",
+ "viewfinder, camera preview, split Storyboard tab and still capture follow the preview source",
+ "orbit, camera preset and viewfinder field of view edit the camera the preview shows",
+ "camera deletion stays refused against the preview",
+ "a camera-list click moves a camera preview to that camera and leaves a Storyboard preview alone, still writing the stored active camera",
+ "a project-history undo while the editor is open does not reach the open draft",
+ "the Storyboard row is taller than an ordinary row, and one constant keeps the surface, the playhead lane, the grid and `+` aligned with it",
+ "a selected block carries a fill of its own without a hover and without moving an edge, while other blocks keep the ordinary fill",
+ "the block under the playhead carries a white outline, alone and on a selected block, painted over the block beside it, and keyboard focus keeps its own ring",
+ "a body click beside either side of a shared boundary selects its own block and moves no playhead",
+ "a block waits for idle time before its thumbnail is made, then shows a real picture of its own camera at the block's start, inside its box, without moving it",
+ "a picture stays the identical image through the playhead, the selection, the preview source and a camera rename",
+ "a picture is made again after its camera's pose, an edited keyframe of it, or scene content at the block's start changes; other cameras' blocks keep their image; undo restores the same image",
+ "a picture made while an object is selected is the identical image: the viewport's marks are not in it",
+ "narrow blocks give up the name first and the picture after, at their measured widths; each keeps a selectable body and names its camera in full in `title`",
+ "while the playhead runs and pictures are made again, the viewport shows the marker where the playhead has it, never where a picture does, and every click is answered",
+ "a picture made of an imported model's placeholder settles ready without the model, and is made again when the model's load lands: it then shows the loaded model, read from the picture itself",
+ "a picture made before a background image's texture arrives settles ready on the plain colour, and is made again when the texture arrives and shows it",
+ "a background that cannot be loaded and a model whose load fails each make every picture again; each settles ready, nothing stays pending, and the failure writes nothing",
+ "at a shared boundary the block on the right has the outline, at the endpoint the last block, beyond it none, and the playhead picks no block",
+ "an editable block body offers a grab and a read-only block keeps the pointer; a boundary handle keeps its resize cursor",
+ "from the press on the pointer is a closed hand, in the block and in the surface that owns the pointer, outside the track too; a boundary being resized keeps its cursor from the surface",
+ "past the threshold the pressed block alone follows the pointer 1:1 and sideways only; the other blocks, the playhead and the block under it stay, and nothing is written and no text is selected",
+ "a carried block is lifted over the others, with a shadow and a little see-through, at its own size, and stops inside either edge of the track",
+ "where a release would change the order, one line stands in the gap the carried block would be let into: 3px thick, in the accent colour, through the whole track, with a chevron at either end pointing to the line's centre, over every block and under the playhead, and taking no pointer; it jumps from gap to gap as the block is carried past its neighbours, stands before the block that would follow it, at the end of the last block when it would be last and at the start of the track when it would be first, kept just inside the track, and is gone while the order would hold, on Escape and after the release; flat against either edge of the track a block is let in last or first although its centre has not passed its neighbour's; a resize has no line",
+ "a drag from a thumbnail carries the block and an outside release saves the reorder; from the first frame after the release every block is where the new order puts it, none is carried, and the reply moves nothing",
+ "a release that changes the order takes the playhead with the dragged block, once and in the frame of the release, to where the block now starts, and the outline is on it there; a save the server refuses puts the order and the playhead back together, names the reason and attempts one write",
+ "while a block is carried `+`, the main duration, camera deletion, undo and redo wait, and no delete button is in the track",
+ "Escape, a cancelled pointer and a lost focus put the carried block back at once; a release that keeps the order puts it back too; none of them writes or moves the playhead",
+ "after each of those cancellations, letting go on an empty stretch of the lane or on the ruler moves no playhead, selects nothing and writes nothing",
+ "a block carried while it is in keyboard focus, as after an Escape, is painted as it is carried without it: no ring and no fill of keyboard focus; once the drag is over the ring is back",
+ "resize cancellation and zero-length and overflowing resizes write nothing; persisted ripple timing, and one-step undo and redo",
+ "no page errors",
+ ],
+ }),
+ );
+} catch (error) {
+ console.error((await page.locator("body").innerText()).slice(-2500));
+ throw error;
+} finally {
+ await browser.close();
+}
diff --git a/tests/browser/director_stage_storyboard_acceptance.mjs b/tests/browser/director_stage_storyboard_acceptance.mjs
new file mode 100644
index 000000000..079aee705
--- /dev/null
+++ b/tests/browser/director_stage_storyboard_acceptance.mjs
@@ -0,0 +1,11 @@
+/** Exercise the same Storyboard journey in both languages on the production build. */
+import { execFileSync } from "node:child_process";
+import { fileURLToPath } from "node:url";
+
+const journey = fileURLToPath(new URL("./director_stage_storyboard.mjs", import.meta.url));
+for (const locale of ["en-US", "zh-CN"]) {
+ execFileSync(process.execPath, [journey, "--verify-mp4"], {
+ env: { ...process.env, DIRECTOR_STAGE_LOCALE: locale },
+ stdio: "inherit",
+ });
+}
diff --git a/tests/browser/director_stage_storyboard_mp4.mjs b/tests/browser/director_stage_storyboard_mp4.mjs
new file mode 100644
index 000000000..91f287f35
--- /dev/null
+++ b/tests/browser/director_stage_storyboard_mp4.mjs
@@ -0,0 +1,246 @@
+/** Decode the actual Storyboard MP4 and check cut timing and frozen provenance. */
+import assert from "node:assert/strict";
+import { probeMp4 } from "./director_stage_fixture.mjs";
+import { mkdtemp, rm } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE ?? "playwright-core"
+);
+const api = process.env.CREATION_API_URL ?? "http://127.0.0.1:8019";
+const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5179";
+const pid = crypto.randomUUID(),
+ did = crypto.randomUUID(),
+ item = crypto.randomUUID(),
+ session = crypto.randomUUID();
+const root = "/api/creation/projects/" + pid;
+const headers = {
+ "X-OpenDirector-Request": "1",
+ "Content-Type": "application/json",
+};
+async function call(path, body, useSession = false) {
+ const r = await fetch(api + path, {
+ headers: {
+ ...headers,
+ ...(useSession ? { "X-OpenDirector-Session": session } : {}),
+ },
+ ...(body ? { method: "POST", body: JSON.stringify(body) } : {}),
+ });
+ assert.ok(r.ok, await r.clone().text());
+ return r.json();
+}
+async function send(type, payload, useSession = true) {
+ const result = await call(
+ root + "/commands",
+ { projectId: pid, commandId: crypto.randomUUID(), type, payload },
+ useSession,
+ );
+ assert.equal(result.status, "applied", JSON.stringify(result));
+}
+const vector = (x, y, z) => ({ x, y, z });
+const rig = (id, position, target) => ({
+ id,
+ name: id,
+ aspectRatio: "16:9",
+ pose: { position, target, fov: 45 },
+ keyframes: [],
+});
+const box = (id, color, x, z) => ({
+ id,
+ name: id,
+ kind: "box",
+ color,
+ visible: true,
+ locked: false,
+ opacity: 1,
+ position: vector(x, 0, z),
+ rotation: vector(0, 0, 0),
+ scale: vector(2, 2, 2),
+ keyframes: [],
+ motionClips: [],
+});
+const cameras = [
+ rig("green", vector(0, 1, 5), vector(0, 1, 0)),
+ rig("magenta", vector(4, 1, 5), vector(8, 1, 5)),
+];
+const shots = [
+ { id: "green-first", cameraId: "green", start: 0, duration: 0.201 },
+ { id: "magenta-middle", cameraId: "magenta", start: 0.201, duration: 0.301 },
+ { id: "green-return", cameraId: "green", start: 0.502, duration: 0.211 },
+];
+assert.equal((await call("/api/creation-test-health")).isolated, true);
+await send(
+ "project.create",
+ { name: "Ticket 06 MP4 " + pid.slice(0, 8) },
+ false,
+);
+await call(root + "/open", {}, true);
+await send("creation.batch", {
+ operations: [
+ {
+ type: "editor.create",
+ payload: {
+ document: {
+ id: did,
+ projectId: pid,
+ revision: 1,
+ kind: "director",
+ inputConnections: [],
+ data: {
+ background: "#151923",
+ grid: false,
+ duration: 2,
+ fps: 30,
+ aspectRatio: "16:9",
+ cameraSource: "camera",
+ activeCameraId: "magenta",
+ cameras,
+ shots,
+ objects: [
+ box("green-marker", "#00ff00", 0, 0),
+ box("magenta-marker", "#ff00ff", 8, 5),
+ ],
+ },
+ },
+ },
+ },
+ {
+ type: "canvas.show",
+ payload: {
+ item: {
+ id: item,
+ projectId: pid,
+ kind: "external",
+ title: "Cut verification",
+ position: { x: 0, y: 0 },
+ width: 340,
+ height: 180,
+ zIndex: 0,
+ locked: false,
+ parentId: null,
+ binding: {
+ role: "editor",
+ objectRef: {
+ objectType: "editor_document",
+ id: did,
+ kind: "director",
+ },
+ },
+ },
+ },
+ },
+ ],
+});
+assert.ok(
+ (
+ await fetch(api + "/api/creation/sessions/" + session, {
+ method: "DELETE",
+ headers,
+ })
+ ).ok,
+);
+const browser = await chromium.launch({
+ headless: true,
+ executablePath: process.env.CHROMIUM_PATH,
+ args: ["--no-sandbox", "--enable-unsafe-swiftshader"],
+});
+const evidence = await mkdtemp(join(tmpdir(), "director-storyboard-mp4-"));
+try {
+ const page = await browser.newPage({
+ locale: "en-US",
+ viewport: { width: 1700, height: 1100 },
+ });
+ page.on("pageerror", (e) => console.error(e.message));
+ await page.addInitScript(() => {
+ localStorage.setItem("opendirector.modelSetup.v1", "dismissed");
+ localStorage.setItem("opendirector.locale.v1", "en-US");
+ });
+ const open = async () => {
+ await page.getByText("Saved on this device", { exact: true }).waitFor();
+ await page.locator('.react-flow__node[data-id="' + item + '"]').click();
+ await page
+ .getByRole("button", { name: "Open Director Stage", exact: true })
+ .click();
+ };
+ await page.goto(base + "/ai-tool/ai-canvas/" + pid + "?creation=unified");
+ await open();
+ await page.getByRole("button", { name: "Dynamic", exact: true }).click();
+ await page
+ .getByRole("button", { name: "Render preview MP4", exact: true })
+ .click();
+ const dialog = page.getByRole("dialog", { name: "Export video" });
+ await dialog
+ .getByLabel("Camera source")
+ .selectOption({ label: "Storyboard" });
+ await dialog.getByLabel("Frame rate").selectOption("25");
+ await dialog.getByRole("button", { name: "Export", exact: true }).click();
+ const downloadButton = page.getByRole("button", {
+ name: "Download preview MP4",
+ exact: true,
+ });
+ await downloadButton.waitFor({ timeout: 180000 });
+ const download = page.waitForEvent("download");
+ await downloadButton.click();
+ const path = join(evidence, "storyboard.mp4");
+ await (await download).saveAs(path);
+ const { duration, stream, colors } = probeMp4(path);
+ console.log({
+ duration,
+ streamDuration: stream.duration,
+ fps: stream.r_frame_rate,
+ average: stream.avg_frame_rate,
+ frames: stream.nb_read_frames,
+ colors,
+ });
+ assert.ok(Math.abs(duration - 0.713) < 0.00002);
+ assert.equal(stream.r_frame_rate, "25/1");
+ assert.equal(Number(stream.nb_read_frames), 18);
+ assert.equal(colors.length, 18);
+ for (const [index, [r, g, b]] of colors.entries()) {
+ assert.ok(
+ index < 6 || index >= 13 ? g > r && g > b : r > g && b > g,
+ "wrong camera at frame " + index,
+ );
+ }
+ await page
+ .getByRole("button", { name: "Add preview video to canvas", exact: true })
+ .click();
+ let snapshot;
+ for (let i = 0; i < 100; i++) {
+ snapshot = await call(root);
+ if (
+ snapshot.assets.some(
+ (a) => a.kind === "video" && a.provenance.source === "rendered",
+ )
+ )
+ break;
+ await new Promise((resolve) => setTimeout(resolve, 100));
+ }
+ const asset = snapshot.assets.find(
+ (a) => a.kind === "video" && a.provenance.source === "rendered",
+ );
+ assert.ok(asset, "the browser publishes a rendered video asset");
+ const render = asset.provenance.directorRender;
+ assert.equal(render.sourceEditorId, did);
+ assert.ok(render.acceptedProjectCursor < snapshot.eventCursor);
+ const editable = snapshot.editorDocuments.find((d) => d.id === did);
+ assert.equal(render.sourceEditorRevision, editable.revision);
+ assert.equal(render.plan.cameraSource, "storyboard");
+ assert.equal(render.plan.frameRate, 25);
+ assert.equal(render.plan.durationSeconds, 0.713);
+ const execution = snapshot.editorDocuments.find(
+ (d) => d.id === asset.provenance.editorDocumentId,
+ );
+ assert.deepEqual(execution.data.shots, shots);
+ assert.deepEqual(editable.data.shots, shots);
+ assert.equal(editable.data.duration, 2);
+ await page.reload();
+ await open();
+ assert.deepEqual(
+ (await call(root)).editorDocuments.find((d) => d.id === did).data.shots,
+ shots,
+ );
+} finally {
+ await browser.close();
+ await rm(evidence, { recursive: true, force: true });
+}
diff --git a/tests/browser/director_stage_visual_v1.mjs b/tests/browser/director_stage_visual_v1.mjs
new file mode 100644
index 000000000..678328d34
--- /dev/null
+++ b/tests/browser/director_stage_visual_v1.mjs
@@ -0,0 +1,401 @@
+/**
+ * V1 visual-alignment evidence for the Director Stage workbench shell.
+ *
+ * The assertions intentionally cover geometry and computed surface colors,
+ * while the PNG is the human comparison artifact against the local Jiemeng
+ * screenshots.
+ */
+import assert from "node:assert/strict";
+import fs from "node:fs";
+import path from "node:path";
+
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE ?? "playwright-core"
+);
+
+const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5179";
+const api = process.env.CREATION_API_URL ?? "http://127.0.0.1:8019";
+const headers = {
+ "X-OpenDirector-Request": "1",
+ "Content-Type": "application/json",
+};
+
+async function call(pathname, body) {
+ const response = await fetch(api + pathname, {
+ headers,
+ ...(body ? { method: "POST", body: JSON.stringify(body) } : {}),
+ });
+ assert.ok(response.ok, `${response.status}: ${await response.clone().text()}`);
+ return response.json();
+}
+
+assert.equal((await call("/api/creation-test-health")).isolated, true);
+
+const projectId = crypto.randomUUID();
+await call(`/api/creation/projects/${projectId}/commands`, {
+ commandId: crypto.randomUUID(),
+ projectId,
+ type: "project.create",
+ payload: { name: `Stage visual ${projectId.slice(0, 8)}` },
+});
+
+const browser = await chromium.launch({
+ headless: true,
+ ...(process.env.CHROMIUM_PATH
+ ? { executablePath: process.env.CHROMIUM_PATH }
+ : {}),
+ args: ["--no-sandbox", "--enable-unsafe-swiftshader"],
+});
+const viewportWidth = Number(process.env.VISUAL_WIDTH ?? 1700);
+const viewportHeight = Number(process.env.VISUAL_HEIGHT ?? 1100);
+const page = await browser.newPage({
+ locale: "en-US",
+ viewport: { width: viewportWidth, height: viewportHeight },
+});
+page.setDefaultTimeout(20000);
+await page.addInitScript(() => {
+ localStorage.setItem("opendirector.locale.v1", "en-US");
+ localStorage.setItem("opendirector.modelSetup.v1", "dismissed");
+});
+
+const outputDirectory = path.resolve("artifacts/director-stage/visual");
+fs.mkdirSync(outputDirectory, { recursive: true });
+const screenshotPath = path.join(
+ outputDirectory,
+ `v1-stage-shell-${viewportWidth}x${viewportHeight}.png`,
+);
+const dynamicScreenshotPath = path.join(
+ outputDirectory,
+ `v2-stage-dynamic-${viewportWidth}x${viewportHeight}.png`,
+);
+const viewSettingsScreenshotPath = path.join(
+ outputDirectory,
+ `v5-stage-view-settings-${viewportWidth}x${viewportHeight}.png`,
+);
+const pipScreenshotPath = path.join(
+ outputDirectory,
+ `v5-stage-pip-${viewportWidth}x${viewportHeight}.png`,
+);
+const viewfinderScreenshotPath = path.join(
+ outputDirectory,
+ `v5-stage-shoot-${viewportWidth}x${viewportHeight}.png`,
+);
+
+try {
+ await page.goto(`${base}/ai-tool/ai-canvas/${projectId}?creation=unified`);
+ await page.getByText("Saved on this device", { exact: true }).waitFor();
+ await page
+ .getByRole("button", { name: "Add Director Stage", exact: true })
+ .click();
+ await page.getByRole("button", { name: "Apply edits", exact: true }).click();
+ await page
+ .getByRole("button", { name: "Apply edits", exact: true })
+ .waitFor({ state: "detached" });
+ await page
+ .getByRole("button", { name: "Open Director Stage", exact: true })
+ .click();
+ await page.getByRole("button", { name: "Apply edits", exact: true }).waitFor();
+ await page
+ .locator('.cw-stage-object-grid button[data-stage-placement-kind="person"]')
+ .first()
+ .click();
+ await page.locator(".cw-stage-placehint").waitFor();
+ const scene = page.locator(".cw-stage-scene");
+ const sceneBox = await scene.boundingBox();
+ assert.ok(sceneBox);
+ await page.mouse.click(
+ sceneBox.x + sceneBox.width * 0.62,
+ sceneBox.y + sceneBox.height * 0.55,
+ );
+ const help = page.getByRole("dialog", { name: "Director console controls" });
+ if (await help.count()) {
+ await help.getByRole("button", { name: "Close help", exact: true }).click();
+ }
+
+ const shell = page.locator(".cw-stage-console");
+ const topbar = page.locator(".cw-stage-topbar");
+ const left = page.locator(".cw-stage-left");
+ const right = page.locator(".cw-stage-right");
+ const bottom = page.locator(".cw-stage-bottom");
+ const staticMode = page.getByRole("button", { name: "Static", exact: true });
+ const dynamicMode = page.getByRole("button", { name: "Dynamic", exact: true });
+ const brand = page.locator(".cw-stage-identity h2");
+ const assetSearch = page.locator(".cw-stage-asset-search input");
+ const objectGrid = page.locator(".cw-stage-object-grid");
+ await shell.waitFor();
+
+ const [shellBox, topbarBox, leftBox, rightBox] = await Promise.all(
+ [shell, topbar, left, right].map((locator) => locator.boundingBox()),
+ );
+ assert.ok(shellBox && topbarBox && leftBox && rightBox);
+ assert.equal(shellBox.x, 0);
+ assert.equal(shellBox.y, 0);
+ assert.equal(shellBox.width, viewportWidth);
+ assert.equal(shellBox.height, viewportHeight);
+ assert.ok(Math.abs(topbarBox.height - 38) <= 1);
+ assert.equal(leftBox.x, 0);
+ assert.ok(Math.abs(leftBox.width - 196) <= 1);
+ assert.ok(Math.abs(leftBox.y - 38) <= 1);
+ assert.equal(rightBox.x + rightBox.width, viewportWidth);
+ assert.ok(Math.abs(rightBox.width - 232) <= 1);
+ assert.ok(Math.abs(rightBox.y - 38) <= 1);
+ assert.equal(
+ await topbar.getByRole("button", { name: "View settings", exact: true }).count(),
+ 0,
+ );
+ const rightTree = page.locator(".cw-stage-right-tree-panel");
+ const treeSearch = rightTree.locator(".cw-stage-tree-search input");
+ const inspector = page.locator(".cw-stage-inspector");
+ const inspectorScroll = inspector.locator(".cw-stage-inspector-scroll");
+ await Promise.all([rightTree.waitFor(), treeSearch.waitFor(), inspector.waitFor()]);
+ const [rightTreeBox, inspectorBox, inspectorScrollBox] = await Promise.all([
+ rightTree.boundingBox(),
+ inspector.boundingBox(),
+ inspectorScroll.boundingBox(),
+ ]);
+ assert.ok(rightTreeBox && inspectorBox && inspectorScrollBox);
+ assert.ok(Math.abs(rightTreeBox.x - (rightBox.x + 1)) <= 1);
+ assert.ok(
+ Math.abs(rightTreeBox.x + rightTreeBox.width - (rightBox.x + rightBox.width)) <= 1,
+ );
+ assert.ok(rightTreeBox.height <= Math.ceil(rightBox.height * 0.42));
+ assert.ok(rightTreeBox.height < rightBox.height);
+ assert.ok(Math.abs(inspectorBox.y - (rightTreeBox.y + rightTreeBox.height)) <= 1);
+ assert.ok(
+ Math.abs(inspectorBox.height - (rightBox.height - rightTreeBox.height)) <= 1,
+ );
+ assert.equal(
+ await right.evaluate((element) => getComputedStyle(element).overflowY),
+ "hidden",
+ );
+ assert.equal(
+ await inspectorScroll.evaluate((element) => getComputedStyle(element).overflowY),
+ "auto",
+ );
+ await treeSearch.fill("Person 1");
+ const filteredRows = rightTree.locator(".cw-stage-tree-row");
+ assert.ok((await filteredRows.count()) >= 1);
+ assert.equal(
+ await filteredRows.filter({ hasText: "Person 1" }).count(),
+ await filteredRows.count(),
+ );
+ await treeSearch.fill("");
+ assert.equal(await staticMode.getAttribute("aria-pressed"), "true");
+ assert.equal(await dynamicMode.getAttribute("aria-pressed"), "false");
+ assert.equal(await bottom.count(), 0);
+ const viewInfo = page.locator(".cw-stage-viewinfo");
+ await viewInfo.waitFor();
+ const staticSceneBox = await scene.boundingBox();
+ const staticViewInfoBox = await viewInfo.boundingBox();
+ assert.ok(staticSceneBox && staticViewInfoBox);
+ assert.equal(await shell.getAttribute("data-preview-mode"), "static");
+ assert.ok(
+ Math.abs(
+ staticViewInfoBox.y +
+ staticViewInfoBox.height -
+ (staticSceneBox.y + staticSceneBox.height - 12),
+ ) <= 1,
+ );
+ await dynamicMode.click();
+ await bottom.waitFor();
+ const timeOutput = bottom.locator(".cw-stage-transport > output").first();
+ await timeOutput.waitFor();
+ const timeAtModeSwitch = await timeOutput.textContent();
+ await page.waitForTimeout(350);
+ assert.equal(
+ await timeOutput.textContent(),
+ timeAtModeSwitch,
+ "switching to dynamic mode must not start playback",
+ );
+ const bottomBox = await bottom.boundingBox();
+ assert.ok(bottomBox);
+ assert.equal(bottomBox.x, 0);
+ assert.equal(bottomBox.width, viewportWidth);
+ assert.ok(Math.abs(bottomBox.height - 176) <= 1);
+ const dynamicViewInfoBox = await viewInfo.boundingBox();
+ assert.ok(dynamicViewInfoBox);
+ assert.equal(await shell.getAttribute("data-preview-mode"), "dynamic");
+ assert.ok(
+ Math.abs(
+ dynamicViewInfoBox.y +
+ dynamicViewInfoBox.height -
+ (bottomBox.y - 12),
+ ) <= 1,
+ );
+ assert.equal(await dynamicMode.getAttribute("aria-pressed"), "true");
+ assert.equal(await staticMode.getAttribute("aria-pressed"), "false");
+ await page.screenshot({ path: dynamicScreenshotPath, fullPage: false });
+ const gizmoRail = page.locator(".cw-stage-gizmo");
+ const gizmoBox = await gizmoRail.boundingBox();
+ assert.ok(gizmoBox);
+ assert.ok(Math.abs(gizmoBox.x - 208) <= 1);
+ assert.ok(Math.abs(gizmoBox.width - 34) <= 1);
+ assert.ok(Math.abs(gizmoBox.y - 50) <= 1);
+
+ const viewSettingsButton = gizmoRail.getByRole("button", {
+ name: "View settings overlay",
+ exact: true,
+ });
+ await viewSettingsButton.click();
+ const viewMenu = page.getByRole("dialog", {
+ name: "View settings",
+ exact: true,
+ });
+ await viewMenu.waitFor();
+ const viewMenuBox = await viewMenu.boundingBox();
+ const viewSettingsButtonBox = await viewSettingsButton.boundingBox();
+ assert.ok(viewMenuBox);
+ assert.ok(viewSettingsButtonBox);
+ const viewButtonCenterY =
+ viewSettingsButtonBox.y + viewSettingsButtonBox.height / 2;
+ const viewMenuCenterY = viewMenuBox.y + viewMenuBox.height / 2;
+ assert.ok(
+ Math.abs(viewMenuCenterY - viewButtonCenterY) <= 1,
+ `view settings menu is centered on its button (${viewMenuCenterY} vs ${viewButtonCenterY})`,
+ );
+ assert.ok(
+ viewMenuBox.x >= viewSettingsButtonBox.x + viewSettingsButtonBox.width - 1,
+ `view settings menu opens beside its button (${viewMenuBox.x} vs ${viewSettingsButtonBox.x + viewSettingsButtonBox.width})`,
+ );
+ assert.ok(viewMenuBox.width >= 200);
+ await page.screenshot({ path: viewSettingsScreenshotPath, fullPage: false });
+ await viewSettingsButton.click();
+ await viewMenu.waitFor({ state: "detached" });
+ await viewSettingsButton.click();
+ await viewMenu.waitFor();
+ const sceneForDismiss = await page.locator(".cw-stage-scene").boundingBox();
+ assert.ok(sceneForDismiss);
+ await page.mouse.click(
+ sceneForDismiss.x + sceneForDismiss.width / 2,
+ sceneForDismiss.y + sceneForDismiss.height / 2,
+ );
+ await viewMenu.waitFor({ state: "detached" });
+
+ const cameraPreviewButton = page.getByRole("button", {
+ name: "Camera preview",
+ exact: true,
+ });
+ assert.equal(await cameraPreviewButton.getAttribute("aria-expanded"), "true");
+ const pipFrame = page.locator(".cw-stage-pipframe");
+ const pipCanvas = page.locator(".cw-stage-pipcanvas");
+ await pipFrame.waitFor();
+ await pipCanvas.waitFor({ state: "visible" });
+ const pipBox = await pipFrame.boundingBox();
+ const pipCanvasBox = await pipCanvas.boundingBox();
+ assert.ok(pipBox && pipCanvasBox);
+ assert.ok(Math.abs(pipBox.x + pipBox.width - (viewportWidth - 248)) <= 1);
+ assert.ok(Math.abs(pipBox.y - 54) <= 1);
+ assert.ok(Math.abs(pipBox.width - 264) <= 1);
+ assert.ok(Math.abs(pipCanvasBox.x - pipBox.x) <= 1);
+ assert.ok(Math.abs(pipCanvasBox.y - pipBox.y) <= 1);
+ assert.ok(Math.abs(pipCanvasBox.width - pipBox.width) <= 1);
+ assert.ok(Math.abs(pipCanvasBox.height - pipBox.height) <= 1);
+ await page.waitForTimeout(250);
+ await page.screenshot({ path: pipScreenshotPath, fullPage: false });
+
+ const previewHandle = pipFrame.getByRole("button", { name: "Move camera preview" });
+ const handleBox = await previewHandle.boundingBox();
+ assert.ok(handleBox);
+ await page.mouse.move(handleBox.x + handleBox.width / 2, handleBox.y + handleBox.height / 2);
+ await page.mouse.down();
+ await page.mouse.move(0, viewportHeight, { steps: 8 });
+ await page.mouse.up();
+ const movedFrame = await pipFrame.boundingBox();
+ assert.ok(movedFrame);
+ assert.ok(movedFrame.x >= leftBox.x + leftBox.width);
+ assert.ok(movedFrame.y + movedFrame.height <= bottomBox.y);
+ assert.ok(movedFrame.x < pipBox.x && movedFrame.y > pipBox.y);
+ const expandedToggle = await cameraPreviewButton.boundingBox();
+ assert.ok(expandedToggle);
+ await cameraPreviewButton.click();
+ await pipCanvas.waitFor({ state: "hidden" });
+ await pipFrame.getByText("Camera preview", { exact: true }).waitFor();
+ const collapsedToggle = await cameraPreviewButton.boundingBox();
+ assert.ok(collapsedToggle);
+ assert.equal(collapsedToggle.x, expandedToggle.x);
+ assert.equal(collapsedToggle.y, expandedToggle.y);
+ await cameraPreviewButton.press("Enter");
+ await pipCanvas.waitFor({ state: "visible" });
+
+ const viewfinderButton = page.getByRole("button", {
+ name: "Viewfinder",
+ exact: true,
+ });
+ await viewfinderButton.click();
+ await page.locator(".cw-stage-fovbar").waitFor();
+ assert.equal(await left.isVisible(), false);
+ assert.equal(await right.isVisible(), false);
+ assert.equal(await bottom.isVisible(), false);
+ const sceneFrameBorder = await scene.evaluate(
+ (element) => getComputedStyle(element, "::after").borderTopWidth,
+ );
+ assert.equal(sceneFrameBorder, "1px");
+ await page.screenshot({ path: viewfinderScreenshotPath, fullPage: false });
+ await viewfinderButton.click();
+ await page.locator(".cw-stage-fovbar").waitFor({ state: "detached" });
+ await cameraPreviewButton.click();
+ await pipCanvas.waitFor({ state: "hidden" });
+ assert.equal(await cameraPreviewButton.getAttribute("aria-expanded"), "false");
+ await cameraPreviewButton.press("Enter");
+ await pipCanvas.waitFor({ state: "visible" });
+ await staticMode.click();
+ await bottom.waitFor({ state: "detached" });
+ assert.equal(await brand.textContent(), "3D Director Stage");
+ assert.equal(
+ await assetSearch.getAttribute("placeholder"),
+ "Search assets",
+ );
+ assert.equal(await objectGrid.evaluate((element) => getComputedStyle(element).display), "grid");
+ assert.equal(
+ await objectGrid.evaluate((element) => getComputedStyle(element).gridTemplateColumns.split(" ").length),
+ 2,
+ );
+ const objectCards = objectGrid.locator("button");
+ const objectPreviews = objectGrid.locator(".cw-stage-object-preview");
+ assert.equal(await objectPreviews.count(), await objectCards.count());
+ const firstPreview = objectPreviews.first();
+ await firstPreview.locator("img").waitFor({ state: "visible" });
+ assert.equal(await firstPreview.getAttribute("data-thumbnail-state"), "ready");
+ const thumbnail = firstPreview.locator("img");
+ assert.equal(await thumbnail.count(), 1);
+ // Builtin template previews render to data URLs; imported models keep
+ // their blob: preview URLs. Both must be real, loadable sources.
+ assert.match(await thumbnail.getAttribute("src"), /^(blob|data):/);
+ assert.ok(await thumbnail.evaluate((element) => element.naturalWidth > 0 && element.naturalHeight > 0));
+ assert.equal(
+ await firstPreview.getAttribute("data-stage-object-kind"),
+ "person",
+ );
+
+ const [consoleBackground, leftBackground, rightBackground] =
+ await Promise.all(
+ [shell, left, right].map((locator) =>
+ locator.evaluate((element) => getComputedStyle(element).backgroundColor),
+ ),
+ );
+ assert.equal(consoleBackground, "rgb(11, 11, 11)");
+ assert.equal(leftBackground, "rgb(26, 26, 26)");
+ assert.equal(rightBackground, "rgb(26, 26, 26)");
+
+ await page.screenshot({ path: screenshotPath, fullPage: false });
+} finally {
+ await browser.close();
+}
+
+console.log(
+ JSON.stringify({
+ passed: true,
+ screenshot: screenshotPath,
+ checks: [
+ "fullscreen shell bounds",
+ "38px top bar",
+ "196px left rail",
+ "232px right rail",
+ "static mode hides the timeline",
+ "dynamic mode shows a 176px bottom timeline",
+ "viewport tool rail, view settings, PiP, and shoot overlays are anchored",
+ "neutral dark workbench surfaces",
+ "right rail object-tree search and independent inspector scroll",
+ ],
+ }),
+);
diff --git a/tests/browser/manifest.json b/tests/browser/manifest.json
index ea78287e6..a6c70ac8f 100644
--- a/tests/browser/manifest.json
+++ b/tests/browser/manifest.json
@@ -3,22 +3,32 @@
{
"file": "image_quality_test.mjs",
"previewSafe": true,
- "lanes": ["extended", "production"]
+ "lanes": [
+ "extended",
+ "production"
+ ]
},
{
"file": "heif_upload_recovery.mjs",
- "lanes": ["extended", "production"],
+ "lanes": [
+ "extended",
+ "production"
+ ],
"previewSafe": true,
"note": "HEIF upload, drop, fresh-node/reference save acknowledgement, preview failure and reload in both languages. Optional HEIF_REVIEW_FILE supplies a local camera sample."
},
{
"file": "heif_import.mjs",
- "lanes": ["extended"],
+ "lanes": [
+ "extended"
+ ],
"note": "Real HEIC/HEIF import, orientation, reload, bilingual errors and original export; fixture generation. Imports /src through Vite."
},
{
"file": "kling_video.mjs",
- "lanes": ["extendedFixture"],
+ "lanes": [
+ "extendedFixture"
+ ],
"note": "Uses isolated creation fixtures for bilingual Kling configuration, default preservation and image-based generation."
},
{
@@ -114,7 +124,9 @@
},
{
"file": "canvas_text_markdown.mjs",
- "lanes": ["gate"],
+ "lanes": [
+ "gate"
+ ],
"note": "Markdown blocks, native inline composition, fullscreen selection/scroll handoff and resize commits. Uses /src through Vite."
},
{
@@ -178,7 +190,10 @@
{
"file": "creation_history.mjs",
"previewSafe": true,
- "lanes": ["extended", "production"]
+ "lanes": [
+ "extended",
+ "production"
+ ]
},
{
"file": "creation_journey.mjs",
@@ -197,7 +212,107 @@
{
"file": "default_entry.mjs",
"previewSafe": true,
- "lanes": ["extended", "production"]
+ "lanes": [
+ "extended",
+ "production"
+ ]
+ },
+ {
+ "file": "director_stage_entry.mjs",
+ "lanes": [
+ "gate"
+ ],
+ "note": "Second-phase Director Stage acceptance: create, import GLB, edit, reopen, undo and redo. DIRECTOR_STAGE_LOCALE reruns the flow in another UI language."
+ },
+ {
+ "file": "director_stage_layout.mjs",
+ "lanes": [
+ "manual"
+ ],
+ "note": "First-phase Director Stage acceptance: left and right panel separators plus the dynamic timeline top edge resize by pointer and keyboard, with session-only layout state."
+ },
+ {
+ "file": "director_stage_fixture.mjs",
+ "helper": true,
+ "note": "GLB and animated-GLB fixture builders for the Director Stage browser checks."
+ },
+ {
+ "file": "director_stage_gizmo.mjs",
+ "lanes": [
+ "gate"
+ ],
+ "note": "Director Stage placement gizmo acceptance: preview dragging repositions a subject through base transforms without authoring keyframes, with one undo per drag. DIRECTOR_STAGE_LOCALE reruns the flow in another UI language."
+ },
+ {
+ "file": "director_stage_pointer_alignment.mjs",
+ "lanes": [
+ "gate"
+ ],
+ "note": "Director Stage pointer alignment acceptance: fractional ground placement, selection, gizmo rendering and DPR-scaled viewport projection stay aligned."
+ },
+ {
+ "file": "director_stage_storyboard.mjs",
+ "lanes": [
+ "gate"
+ ],
+ "note": "Director Stage Storyboard acceptance: the camera chooser above the timeline `+`, the add through the shared append command, selection and playhead, undo and redo, save and reopen, the same inputs through the HTTP command endpoint, a stored discontinuous track refused on open, and the preview source: the selector, a Storyboard preview that holds the last frame after the Storyboard end and distinguishes a camera whose ID is storyboard, a pinned camera that ignores the Storyboard, the viewfinder, camera preview, split tab and still that follow the preview, pose commits that land on the previewed camera, camera-list clicks that move a camera preview to the clicked camera and leave a Storyboard preview alone, and that none of it dirties the draft. Block presentation: the selected fill and the playhead's white outline, alone and together; thumbnails made in idle time and what makes them anew; narrow blocks; pictures made during playback that leave the viewport alone; and what a load puts into the scene: a picture made of an imported model's placeholder is made again when the model's load lands, a picture made before a background image's texture arrives is made again when it arrives, and a load that fails makes every picture again too. The load phase checks the thumbnail crop at 2x device scale. Drag feedback: the grab and grabbing cursors; only the dragged block following the pointer, the thumbnail included; the line that stands in the gap the block would be let into, at the end of the last block when it would be last; the other blocks, the playhead and the outline still, and nothing written, while it is dragged; the playhead on the dragged block's new start from the frame it is let go; the order and the playhead back together when the save is refused; a release on an empty part of the lane or on the ruler after a cancelled drag, which moves no playhead; and a carried block that shows no ring of keyboard focus. Isolated: its own project on an isolated creation server with real project storage and model stubs; the GLB and the background images are built by director_stage_fixture.mjs, and no real model or MP4 is needed. DIRECTOR_STAGE_LOCALE reruns the flow in another UI language."
+ },
+ {
+ "file": "director_stage_storyboard_acceptance.mjs",
+ "lanes": [
+ "production"
+ ],
+ "previewSafe": true,
+ "note": "Runs both languages against the production preview, isolated creation API, real project storage and model stubs. Uses the shared Director Stage fixtures, Chromium WebCodecs, ffmpeg and ffprobe for the interactive edit-to-published-MP4 journey."
+ },
+ {
+ "file": "director_stage_storyboard_mp4.mjs",
+ "lanes": [
+ "perf"
+ ],
+ "note": "Requires the isolated creation API, Chromium WebCodecs, ffmpeg and ffprobe. Decodes a Storyboard MP4 to verify hard cuts and the partial final frame, then checks published provenance and reopening."
+ },
+ {
+ "file": "director_stage_animation.mjs",
+ "lanes": [
+ "manual"
+ ],
+ "note": "Third-phase Director Stage acceptance: an animated GLB follows the stage timeline into the same sampled MP4; run against an isolated creation server."
+ },
+ {
+ "file": "director_stage_output.mjs",
+ "lanes": [
+ "manual"
+ ],
+ "note": "Fourth-phase Director Stage acceptance: captured stills and preview MP4s become tracked project assets the timeline can reference."
+ },
+ {
+ "file": "director_stage_console.mjs",
+ "lanes": [
+ "manual"
+ ],
+ "note": "Console-phase acceptance: the controls cheat-sheet opens once on the first object add and from the top bar, transform sliders pair with exact inputs, and camera rows open the split live preview with tab switching, keyboard ratio nudges and exit."
+ },
+ {
+ "file": "director_stage_visual_v1.mjs",
+ "lanes": [
+ "manual"
+ ],
+ "note": "Visual-alignment V1: captures the Director Stage shell and asserts the reference workbench geometry at 1700x1100 or 1920x1080."
+ },
+ {
+ "file": "director_stage_interaction.mjs",
+ "lanes": [
+ "manual"
+ ],
+ "note": "Batch-5 acceptance: view-settings toggles, the grouped scene tree with focus and collapse, two-step ground placement with the first-time help, the anchored action bar, and default WASD/QE camera movement."
+ },
+ {
+ "file": "director_stage_delivery.mjs",
+ "lanes": [
+ "manual"
+ ],
+ "note": "A definitively refused editor delivery must not replay forever: the Director Stage recovers on the next attempt."
},
{
"file": "double_shift_chat.mjs",
@@ -225,7 +340,10 @@
{
"file": "first_last_frame_connections.mjs",
"previewSafe": true,
- "lanes": ["extended", "production"]
+ "lanes": [
+ "extended",
+ "production"
+ ]
},
{
"file": "generation_feedback.mjs",
@@ -344,7 +462,10 @@
{
"file": "paste_undo.mjs",
"previewSafe": true,
- "lanes": ["extended", "production"]
+ "lanes": [
+ "extended",
+ "production"
+ ]
},
{
"file": "project_list_overflow.mjs",
diff --git a/tests/browser/structured_editors.mjs b/tests/browser/structured_editors.mjs
index dddbec9a2..f241750a0 100644
--- a/tests/browser/structured_editors.mjs
+++ b/tests/browser/structured_editors.mjs
@@ -99,6 +99,16 @@ try {
.click();
await page.getByRole("button", { name: "Apply edits", exact: true }).waitFor();
}
+ /** The camera section only renders for a selected camera row. */
+ async function selectStageCamera() {
+ await page
+ .locator(".cw-stage-right-tree [role=group]")
+ .last()
+ .locator('[role="treeitem"] button')
+ .first()
+ .click();
+ await page.getByLabel("Camera name", { exact: true }).waitFor();
+ }
await page.goto(url);
await saved();
for (const kind of ["tool", "stack", "stage"]) {
@@ -109,23 +119,29 @@ try {
await page
.getByRole("button", { name: "Next stacked item", exact: true })
.click();
- if (kind === "stage")
+ if (kind === "stage") {
+ await selectStageCamera();
await page.getByLabel("Camera name", { exact: true }).fill("Saved camera");
+ }
const before = await state();
let blocked = true;
- const route = async (r) => {
- const body = r.request().postDataJSON();
- if (
- blocked &&
- body.payload?.operations?.some((op) => op.type === "editor.save")
+ const route = async (r) => {
+ const body = r.request().postDataJSON();
+ // Text-like editors save through editor.save; the stage board reaches
+ // its saved form through a single director.apply operation.
+ if (
+ blocked &&
+ body.payload?.operations?.some((op) =>
+ ["editor.save", "editor.create", "director.apply"].includes(op.type),
)
- return r.fulfill({
- status: 422,
- contentType: "application/json",
- body: JSON.stringify({ detail: "fixture: structured save rejected" }),
- });
- return r.continue();
- };
+ )
+ return r.fulfill({
+ status: 422,
+ contentType: "application/json",
+ body: JSON.stringify({ detail: "fixture: structured save rejected" }),
+ });
+ return r.continue();
+ };
await page.route("**/commands", route);
await page.getByRole("button", { name: "Apply edits", exact: true }).click();
await page
@@ -158,11 +174,13 @@ try {
.activeIndex,
1,
);
- if (kind === "stage")
+ if (kind === "stage") {
+ await selectStageCamera();
assert.equal(
await page.getByLabel("Camera name", { exact: true }).inputValue(),
"Saved camera",
);
+ }
assert.deepEqual(
(await state()).editorDocuments,
committed.editorDocuments,
@@ -263,10 +281,19 @@ try {
client.install(injected);
}, { id: f.id, stageId: f.stage });
await page.waitForFunction(() => window.__stageProjection.held() === 1);
+ // The console opens in static mode; the timeline transport with the stage
+ // duration lives in dynamic mode.
+ await page.getByRole("button", { name: "Dynamic", exact: true }).click();
await page.getByLabel("Stage duration", { exact: true }).fill("0.5");
+ await page.getByLabel("Stage duration", { exact: true }).press("Enter");
await page
.getByRole("button", { name: "Render preview MP4", exact: true })
.click();
+ // The render button opens the export dialog; the render starts on Export.
+ await page
+ .getByRole("dialog", { name: "Export video" })
+ .getByRole("button", { name: "Export", exact: true })
+ .click();
await page
.getByRole("button", { name: "Add preview video to canvas", exact: true })
.waitFor({ timeout: 60000 });
diff --git a/tests/canvasCapabilities.test.ts b/tests/canvasCapabilities.test.ts
index 9e0d21958..6f9fdac54 100644
--- a/tests/canvasCapabilities.test.ts
+++ b/tests/canvasCapabilities.test.ts
@@ -12,6 +12,7 @@ import {
nodePorts,
referenceIssue,
connectedCreationKinds,
+ UNANCHORED_KINDS,
} from "../src/canvas/connectionPolicy.ts";
import {
copySelection,
@@ -51,6 +52,7 @@ test("interactive reference policy enforces ports and source capabilities while
assert.deepEqual(nodePorts("subject"), { source: true, target: true });
assert.deepEqual(nodePorts("tool"), { source: true, target: false });
assert.deepEqual(nodePorts("stack"), { source: false, target: false });
+ assert.deepEqual(nodePorts("external"), { source: false, target: false });
for (const [a, b] of [
[image, stack],
[stack, image],
@@ -74,6 +76,16 @@ test("interactive reference policy enforces ports and source capabilities while
assert.equal(canAddReference(doc, image!.id, video!.id), true);
});
+test("node frames keep both edge anchors for every kind but the Director Stage node and group", () => {
+ // Deliberately wider than `nodePorts`: a timeline is no reference source and a stack
+ // is neither, yet the `timeline-pending:` and `publication:` edges start at a
+ // timeline and projectCanvasStacks redraws a folded member's edges to its stack.
+ // Deriving the anchors from the reference policy dropped all of those edges.
+ assert.deepEqual(UNANCHORED_KINDS, ["group", "external"]);
+ assert.equal(nodePorts("timeline").source, false);
+ assert.deepEqual(nodePorts("stack"), { source: false, target: false });
+});
+
test("reference capacity counts inputs but never charges provenance against the target", () => {
const sources = Array.from({ length: 8 }, () =>
createNode("image", undefined, { src: "data:image/fixture" }),
diff --git a/tests/canvasDomains.test.ts b/tests/canvasDomains.test.ts
index fa2c7d62b..42727332f 100644
--- a/tests/canvasDomains.test.ts
+++ b/tests/canvasDomains.test.ts
@@ -281,7 +281,7 @@ test("new domains participate in no-op detection and one-step undo/redo without
assert.equal(history.past.length, 0);
const next = structuredClone(document);
next.nodes[1]!.data.timeline!.tracks[0]!.clips[0]!.outPoint = 3;
- next.nodes[4]!.data.localStage!.objects[0]!.position.x = 5;
+ next.nodes[4]!.data.localStage!.background = "#102030";
next.nodes[0]!.data.taskDraft!.parameters.aspect = "16:9";
next.nodes[0]!.data.layers!.layers[0]!.opacity = 0.4;
history = recordChange(history, next);
diff --git a/tests/canvasStage.test.ts b/tests/canvasStage.test.ts
index 3813e25e0..e8b84a892 100644
--- a/tests/canvasStage.test.ts
+++ b/tests/canvasStage.test.ts
@@ -4,22 +4,60 @@ import {
createLocalStage,
defaultStageCamera,
parseLocalStageValue,
+ parseImportedStageValue,
sameLocalStage,
sampleStage,
+ sampleStagePreview,
+ sampleStageEditingViewport,
sampleStageCamera,
editStageObjectAt,
+ editStageObjectPlacement,
editStageCameraAt,
- captureStageFrame,
+ captureStagePreviewFrame,
removeStageFrame,
stageOutputSize,
+ stageStoryboardBlockAt,
+ stagePreviewCameraId,
+ resolveStagePreviewSource,
+ storedStagePreviewSource,
+ STAGE_FPS,
STAGE_RATIOS,
+ type LocalStageDocument,
+ type StageCameraChannels,
+ type StageShot,
} from "../src/canvas/stageDocument.ts";
-import { sampleJointPose } from "../src/canvas/stageMotion.ts";
+import { readFileSync } from "node:fs";
+import type { Translate } from "../src/i18n/I18nProvider.tsx";
+import type { MessageDescriptor, MessageKey, MessageParams } from "../src/i18n/types.ts";
+import { translate, translateDescriptor } from "../src/i18n/messages.ts";
+import {
+ STAGE_STORYBOARD_ISSUES,
+ assertStageStoryboard,
+ stageExportPlan,
+ mergeStageStoryboardBlock,
+ normalizeStoryboardTime,
+ packStageStoryboard,
+ readStageStoryboard,
+ stageStoryboardIssue,
+ stageStoryboardIssueMessageKey,
+ type StageStoryboardIssue,
+} from "../src/canvas/stageStoryboard.ts";
+import {
+ sampleJointPose,
+ selectStageAnimation,
+ STAGE_ANIMATION_HINTS,
+ STAGE_MOTIONS,
+} from "../src/canvas/stageMotion.ts";
import {
createStageHistory,
commitStageHistory,
navigateStageHistory,
} from "../src/canvas/stageHistory.ts";
+import {
+ groundObject,
+ groundedPositionY,
+} from "../src/canvas/stageGrounding.ts";
+import * as THREE from "three";
function oldStage() {
const camera = defaultStageCamera();
@@ -63,11 +101,67 @@ function oldStage() {
};
}
+/** Stages start empty; the object-edit behaviors below seed one subject. */
+function stageWithPerson(): LocalStageDocument {
+ return {
+ ...createLocalStage(),
+ objects: [
+ {
+ id: "person",
+ kind: "person" as const,
+ name: "默认人物",
+ color: "#a09af9",
+ position: { x: 0, y: 0, z: 0 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ visible: true,
+ locked: false,
+ opacity: 1,
+ keyframes: [],
+ motionClips: [],
+ },
+ ],
+ };
+}
+
+test("grounding uses the rendered object's bottom instead of its origin", () => {
+ const object = new THREE.Group();
+ const mesh = new THREE.Mesh(
+ new THREE.BoxGeometry(1, 1, 1),
+ new THREE.MeshBasicMaterial(),
+ );
+ mesh.position.y = 0.6;
+ object.add(mesh);
+ object.position.y = 0;
+
+ assert.ok(Math.abs(groundedPositionY(object, 0) + 0.1) < 1e-6);
+
+ object.position.y = groundedPositionY(object, 0);
+ groundObject(object, 0);
+ const bounds = new THREE.Box3().setFromObject(object);
+ assert.ok(Math.abs(bounds.min.y) < 1e-6);
+
+ object.position.y = 0;
+ object.scale.y = 2;
+ assert.ok(Math.abs(groundedPositionY(object, 0) + 0.2) < 1e-6);
+ groundObject(object, 0);
+ const scaledBounds = new THREE.Box3().setFromObject(object);
+ assert.ok(Math.abs(scaledBounds.min.y) < 1e-6);
+
+ object.traverse((child) => {
+ if (child instanceof THREE.Mesh) {
+ child.geometry.dispose();
+ child.material.dispose();
+ }
+ });
+});
+
test("V1 migrates once to independent tracks without changing camera, object or motion sampling", () => {
const raw = oldStage(),
stage = parseLocalStageValue(raw),
pose = sampleStage(stage, 3);
assert.equal(stage.version, 2);
+ assert.equal(stage.fps, 30);
assert.deepEqual(pose.objects[0]!.position, { x: 3, y: 3, z: 0 });
assert.equal(pose.camera.position.x, 8);
assert.equal(pose.objects[0]!.motion?.preset, "walk");
@@ -82,6 +176,153 @@ test("V1 migrates once to independent tracks without changing camera, object or
assert.equal(sameLocalStage(stage, parseLocalStageValue(raw)), false);
});
+test("stage FPS defaults, round-trips, and participates in sameLocalStage without changing sampling", () => {
+ const stage = createLocalStage();
+ assert.deepEqual(STAGE_FPS, [24, 25, 30, 50, 60]);
+ assert.equal(stage.fps, 30);
+ const legacyV2 = JSON.parse(JSON.stringify(stage));
+ delete legacyV2.fps;
+ assert.equal(parseLocalStageValue(legacyV2).fps, 30);
+ const explicit = parseLocalStageValue({ ...stage, fps: 60 });
+ assert.equal(explicit.fps, 60);
+ assert.deepEqual(parseLocalStageValue(JSON.parse(JSON.stringify(explicit))), explicit);
+ assert.equal(sameLocalStage(stage, explicit), false);
+ assert.deepEqual(sampleStage(stage, 3), sampleStage(explicit, 3));
+});
+
+test("stage FPS parser rejects values outside the export contract", () => {
+ const stage = createLocalStage();
+ for (const fps of [0, 23, 29, 61, true, 24.5]) {
+ assert.throws(() => parseLocalStageValue({ ...stage, fps }), /无效|invalid/i);
+ }
+});
+
+test("object state defaults, migrates, round-trips, and locked objects stay unchanged", () => {
+ const stage = stageWithPerson();
+ const legacy = JSON.parse(JSON.stringify(stage));
+ delete legacy.objects[0].visible;
+ delete legacy.objects[0].locked;
+ delete legacy.objects[0].opacity;
+ const migrated = parseLocalStageValue(legacy);
+ assert.equal(migrated.objects[0]!.visible, true);
+ assert.equal(migrated.objects[0]!.locked, false);
+ assert.equal(migrated.objects[0]!.opacity, 1);
+ const explicit = parseLocalStageValue({
+ ...stage,
+ objects: [{ ...stage.objects[0]!, visible: false, locked: true, opacity: 0.35 }],
+ });
+ assert.deepEqual(parseLocalStageValue(JSON.parse(JSON.stringify(explicit))), explicit);
+ assert.equal(sameLocalStage(stage, explicit), false);
+ assert.deepEqual(sampleStage(stage, 3).objects[0]!.position, sampleStage(explicit, 3).objects[0]!.position);
+ assert.deepEqual(editStageObjectAt(explicit, explicit.objects[0]!.id, 2, { name: "blocked" }), explicit);
+ assert.deepEqual(editStageObjectPlacement(explicit, explicit.objects[0]!.id, {
+ position: { x: 5, y: 0, z: 0 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ }), explicit);
+ assert.deepEqual(
+ captureStagePreviewFrame(explicit, storedStagePreviewSource(explicit), 2).objects[0]!.keyframes,
+ explicit.objects[0]!.keyframes,
+ );
+ for (const patch of [{ visible: 1 }, { locked: 0 }, { opacity: -0.1 }, { opacity: 1.1 }])
+ assert.throws(() => parseLocalStageValue({ ...stage, objects: [{ ...stage.objects[0]!, ...patch }] }), /无效|invalid/i);
+});
+test("environment and lights default, migrate, round-trip, and reject invalid configuration", () => {
+ const stage = createLocalStage();
+ assert.deepEqual(stage.environment, { preset: "studio", groundColor: "#181818", groundVisible: true, exposure: 1, backgroundAsset: null });
+ assert.deepEqual(stage.lights.map(({ id, intensity, position, castShadow }) => ({ id, intensity, position, castShadow })), [
+ { id: "hemisphere", intensity: 2.4, position: { x: 0, y: 1, z: 0 }, castShadow: false },
+ { id: "key", intensity: 3.5, position: { x: 5, y: 10, z: 6 }, castShadow: true },
+ { id: "fill", intensity: 1.6, position: { x: -6, y: 5, z: -5 }, castShadow: false },
+ ]);
+ const legacy = JSON.parse(JSON.stringify(stage));
+ delete legacy.environment;
+ delete legacy.lights;
+ const migrated = parseLocalStageValue(legacy);
+ assert.deepEqual(migrated.environment, stage.environment);
+ assert.deepEqual(migrated.lights, stage.lights);
+ const explicit = parseLocalStageValue({
+ ...stage,
+ environment: { preset: "studio", groundColor: "#202020", groundVisible: false, exposure: 2.25, backgroundAsset: null },
+ lights: stage.lights.map((light) => light.id === "key" ? { ...light, intensity: 4.2 } : light),
+ });
+ assert.deepEqual(parseLocalStageValue(JSON.parse(JSON.stringify(explicit))), explicit);
+ const oldEnvironment = { ...explicit, environment: { preset: "studio", groundColor: "#202020", groundVisible: false } };
+ assert.equal(parseLocalStageValue(oldEnvironment).environment.exposure, 1);
+ assert.equal(sameLocalStage(stage, explicit), false);
+ assert.deepEqual(sampleStage(stage, 3), sampleStage(explicit, 3));
+ for (const invalid of [
+ { environment: { ...stage.environment, preset: "sunset" } },
+ { environment: { ...stage.environment, groundColor: "#fff" } },
+ { environment: { ...stage.environment, exposure: -0.1 } },
+ { environment: { ...stage.environment, exposure: 4.1 } },
+ { environment: { ...stage.environment, backgroundAsset: {
+ assetId: "00000000-0000-0000-0000-000000000001",
+ revision: 1,
+ fingerprint: `sha256:${"0".repeat(64)}`,
+ kind: "file",
+ } } },
+ { lights: stage.lights.slice(0, 2) },
+ { lights: stage.lights.map((light) => light.id === "key" ? { ...light, intensity: 11 } : light) },
+ { lights: stage.lights.map((light) => light.id === "key" ? { ...light, color: "#fff" } : light) },
+ { lights: stage.lights.map((light) => light.id === "key" ? { ...light, position: { x: 0, y: 0 } } : light) },
+ ]) assert.throws(() => parseLocalStageValue({ ...stage, ...invalid }), /无效|invalid/i);
+});
+test("camera channels round-trip independently and a position edit does not touch target or focal length", () => {
+ const stage = createLocalStage();
+ const camera = stage.cameras[0]!;
+ const explicit = parseLocalStageValue({
+ ...stage,
+ cameras: [{
+ ...camera,
+ channels: {
+ position: [{ id: "p", time: 2, value: { x: 8, y: 4, z: 6 } }],
+ target: [{ id: "t", time: 2, value: { x: 1, y: 2, z: 0 } }],
+ up: [{ id: "u", time: 2, value: { x: 0, y: 1, z: 0 } }],
+ focalLength: [{ id: "f", time: 2, value: 55 }],
+ },
+ }],
+ });
+ const roundTrip = parseLocalStageValue(JSON.parse(JSON.stringify(explicit)));
+ assert.deepEqual(roundTrip.cameras[0]!.channels, explicit.cameras[0]!.channels);
+ const edited = editStageCameraAt(explicit, "camera-1", 2, {
+ position: { x: 10, y: 4, z: 6 },
+ });
+ const channels = edited.cameras[0]!.channels!;
+ assert.equal(channels.position.at(-1)!.value.x, 10);
+ assert.deepEqual(channels.target, explicit.cameras[0]!.channels!.target);
+ assert.deepEqual(channels.up, explicit.cameras[0]!.channels!.up);
+ assert.deepEqual(channels.focalLength, explicit.cameras[0]!.channels!.focalLength);
+});
+
+test("camera channels reject malformed values and old keyframes keep their sampled result", () => {
+ const legacy = parseLocalStageValue(oldStage());
+ assert.equal(legacy.cameras[0]!.aspectRatio, "16:9");
+ assert.equal(legacy.cameras[0]!.channels!.position.length, 2);
+ assert.equal(sampleStage(legacy, 3).camera.position.x, 8);
+ const oldV2 = createLocalStage();
+ delete (oldV2.cameras[0] as { channels?: StageCameraChannels }).channels;
+ const migratedV2 = parseLocalStageValue(oldV2);
+ assert.deepEqual(migratedV2.cameras[0]!.channels, {
+ position: [],
+ target: [],
+ up: [],
+ focalLength: [],
+ });
+ assert.equal(migratedV2.cameras[0]!.aspectRatio, "16:9");
+ assert.throws(() => parseLocalStageValue({
+ ...createLocalStage(),
+ cameras: [{
+ ...createLocalStage().cameras[0]!,
+ channels: {
+ position: [{ id: "p", time: 2, value: { x: 1, y: 2, z: 3 } }],
+ target: [],
+ up: [],
+ focalLength: [{ id: "f", time: 2, value: 0 }],
+ },
+ }],
+ }), /摄像机|camera/i);
+});
test("legacy malformed references and duplicate frame times remain rejected during migration", () => {
const raw = oldStage();
assert.throws(
@@ -161,7 +402,7 @@ test("editing one axis at the playhead preserves the other sampled axes and unto
});
test("the first edit away from zero anchors the opening pose; unchanged orbit commits create no undo step", () => {
- const stage = createLocalStage(),
+ const stage = stageWithPerson(),
id = stage.objects[0]!.id;
const moved = editStageObjectAt(stage, id, 4, {
position: { x: 4, y: 2, z: 0 },
@@ -194,10 +435,119 @@ test("the first edit away from zero anchors the opening pose; unchanged orbit co
assert.deepEqual(renamed.objects[0]!.keyframes, moved.objects[0]!.keyframes);
});
+test("an orbit end within renderer float noise commits no camera edit", () => {
+ const stage = createLocalStage();
+ // setCamera round-trips the pose through the renderer's spherical camera
+ // math, so an unchanged camera can read back one ulp away; that must stay
+ // a no-op instead of authoring an epsilon pose with a keyframe.
+ const camera = sampleStage(stage, 0).camera;
+ const drifted = {
+ ...camera,
+ position: {
+ x: camera.position.x + 1e-15,
+ y: camera.position.y,
+ z: camera.position.z,
+ },
+ };
+ const history = createStageHistory(stage);
+ assert.equal(
+ commitStageHistory(
+ history,
+ editStageCameraAt(stage, stage.activeCameraId, 3, drifted),
+ ),
+ history,
+ );
+ // A real camera move still commits and anchors the opening pose.
+ const moved = editStageCameraAt(stage, stage.activeCameraId, 3, {
+ ...camera,
+ position: { x: 6, y: camera.position.y, z: camera.position.z },
+ });
+ assert.notEqual(moved, stage);
+ assert.equal(moved.cameras[0]!.keyframes.length, 2);
+});
+
+test("placement dragging rewrites the base transform without authoring keyframes", () => {
+ const stage = stageWithPerson(),
+ id = stage.objects[0]!.id;
+ const placed = editStageObjectPlacement(stage, id, {
+ position: { x: 3, y: 1, z: -2 },
+ rotation: { x: 0, y: 1.2, z: 0 },
+ scale: { x: 2, y: 2, z: 2 },
+ });
+ // Unlike a playhead edit, no anchor frame appears at t=0.
+ assert.deepEqual(placed.objects[0]!.keyframes, []);
+ assert.deepEqual(placed.objects[0]!.position, { x: 3, y: 1, z: -2 });
+ assert.deepEqual(placed.objects[0]!.rotation, { x: 0, y: 1.2, z: 0 });
+ assert.deepEqual(placed.objects[0]!.scale, { x: 2, y: 2, z: 2 });
+ for (const at of [0, 2, stage.duration])
+ assert.deepEqual(sampleStage(placed, at).objects[0]!.position, {
+ x: 3,
+ y: 1,
+ z: -2,
+ });
+ assert.equal(
+ editStageObjectPlacement(stage, "missing", {
+ position: { x: 1, y: 1, z: 1 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ }),
+ stage,
+ );
+ assert.throws(
+ () =>
+ editStageObjectPlacement(stage, id, {
+ position: { x: 1, y: 1, z: 1 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 0, y: 1, z: 1 },
+ }),
+ /无效/,
+ );
+});
+
+test("placement on keyframed subjects changes only their base transform", () => {
+ const stage = parseLocalStageValue(oldStage());
+ stage.objects.push({
+ id: "box",
+ kind: "box",
+ name: "木箱",
+ color: "#80c9c0",
+ position: { x: 2, y: 0, z: 0 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ visible: true,
+ locked: false,
+ opacity: 1,
+ keyframes: [],
+ motionClips: [],
+ });
+ const parsed = parseLocalStageValue(stage);
+ const placed = editStageObjectPlacement(parsed, "person", {
+ position: { x: 9, y: 1, z: 2 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ });
+ assert.deepEqual(placed.objects[0]!.keyframes, parsed.objects[0]!.keyframes);
+ assert.deepEqual(placed.objects[0]!.position, { x: 9, y: 1, z: 2 });
+ // The keyframed track still owns sampling; the base write stays UI-gated.
+ assert.deepEqual(sampleStage(placed, 3).objects[0]!.position, {
+ x: 3,
+ y: 3,
+ z: 0,
+ });
+ const other = editStageObjectPlacement(placed, "box", {
+ position: { x: -1, y: 0, z: 4 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ });
+ assert.deepEqual(other.objects[0]!.keyframes, parsed.objects[0]!.keyframes);
+ assert.deepEqual(other.objects[1]!.keyframes, []);
+ assert.deepEqual(other.objects[1]!.position, { x: -1, y: 0, z: 4 });
+});
+
test("current-frame capture and removal affect every sampled track, while history restores deleted objects and clips", () => {
const stage = parseLocalStageValue(oldStage());
let history = createStageHistory(stage);
- history = commitStageHistory(history, captureStageFrame(stage, 3));
+ history = commitStageHistory(history, captureStagePreviewFrame(stage, storedStagePreviewSource(stage), 3));
assert.equal(history.present.objects[0]!.keyframes.length, 3);
history = commitStageHistory(history, { ...history.present, objects: [] });
const restored = navigateStageHistory(history, "undo");
@@ -221,7 +571,7 @@ test("current-frame capture and removal affect every sampled track, while histor
});
test("consecutive action clips switch exactly at boundaries, restart phase and leave gaps idle", () => {
- const stage = createLocalStage();
+ const stage = stageWithPerson();
stage.objects[0]!.motionClips = [
{
id: "walk",
@@ -252,8 +602,8 @@ test("consecutive action clips switch exactly at boundaries, restart phase and l
assert.equal(sameLocalStage(parsed, changed), false);
});
-test("clips reject overlaps, invalid rates, out-of-bounds times and non-character owners", () => {
- const stage = createLocalStage();
+test("clips reject overlaps, invalid rates, negative times and non-character owners", () => {
+ const stage = stageWithPerson();
const clip = {
id: "a",
start: 0,
@@ -262,7 +612,6 @@ test("clips reject overlaps, invalid rates, out-of-bounds times and non-characte
};
for (const clips of [
[clip, { ...clip, id: "b", start: 1 }],
- [{ ...clip, start: 5 }],
[{ ...clip, start: -1 }],
[{ ...clip, duration: 0 }],
[{ ...clip, motion: { ...clip.motion, speed: 0 } }],
@@ -381,7 +730,9 @@ test("supported preview and output frames have one exact aspect with even encode
for (const ratio of STAGE_RATIOS) {
const { width, height } = stageOutputSize(ratio),
[w, h] = ratio.split(":").map(Number);
- assert.equal(width / height, w! / h!);
+ // Even encoder dimensions cannot express every ratio exactly
+ // (2.39:1 lands on 1280x536); keep the aspect within one percent.
+ assert.ok(Math.abs(width / height - w! / h!) < 0.01);
assert.equal(width % 2, 0);
assert.equal(height % 2, 0);
assert.equal(Math.max(width, height), 1280);
@@ -396,6 +747,28 @@ test("supported preview and output frames have one exact aspect with even encode
);
});
+test("motion presets pick imported clips by contained name hints, clip order first", () => {
+ assert.deepEqual(
+ Object.keys(STAGE_ANIMATION_HINTS).sort(),
+ Object.keys(STAGE_MOTIONS).sort(),
+ );
+ const clips = [
+ { name: "mixamo.com" },
+ { name: "Standing_Idle" },
+ { name: "Walk Forward" },
+ ];
+ assert.equal(selectStageAnimation(clips, "walk")!.name, "Walk Forward");
+ assert.equal(selectStageAnimation(clips, "idle")!.name, "Standing_Idle");
+ assert.equal(selectStageAnimation([{ name: "WALK" }], "walk")!.name, "WALK");
+ assert.equal(selectStageAnimation(clips, "run")!.name, "mixamo.com");
+ assert.equal(selectStageAnimation([], "walk"), undefined);
+ const ordered = [{ name: "Walking_slow" }, { name: "Walk_fast" }];
+ assert.equal(
+ selectStageAnimation(ordered, "walk")!.name,
+ "Walking_slow",
+ );
+});
+
test("the production canvas boundary persists the full edited stage and its changes participate in canvas undo", async () => {
const { createDocument, createNode } = await import("../src/canvas/model.ts");
const { serializeDocument, parseDocument } =
@@ -407,7 +780,9 @@ test("the production canvas boundary persists the full edited stage and its chan
stage.cameras.push({
id: "second",
name: "侧面",
+ aspectRatio: "16:9",
pose: { ...defaultStageCamera(), position: { x: -5, y: 4, z: 0 } },
+ channels: { position: [], target: [], up: [], focalLength: [] },
keyframes: [],
});
stage.cameraSource = "storyboard";
@@ -437,3 +812,785 @@ test("the production canvas boundary persists the full edited stage and its chan
if (legacy.ok)
assert.equal(legacy.value.nodes[0]!.data.localStage!.version, 2);
});
+
+test("Storyboard export uses absolute time for arbitrary cuts and stops at the last block", () => {
+ const base = parseLocalStageValue({
+ ...createLocalStage(),
+ duration: 8,
+ activeCameraId: "b",
+ cameras: [
+ {
+ id: "camera-1",
+ name: "Camera 1",
+ pose: defaultStageCamera(),
+ keyframes: [],
+ },
+ {
+ id: "b",
+ name: "Camera B",
+ pose: defaultStageCamera(),
+ keyframes: [],
+ },
+ ],
+ shots: [
+ { id: "first", cameraId: "camera-1", start: 0, duration: 1.667 },
+ { id: "middle", cameraId: "b", start: 1.667, duration: 0.418 },
+ { id: "last", cameraId: "camera-1", start: 2.085, duration: 1.116 },
+ ],
+ });
+ const opening = editStageCameraAt(base, "camera-1", 0, { position: { x: 1, y: 3.5, z: 7 } });
+ const stage = editStageCameraAt(opening, "camera-1", 4, { position: { x: 5, y: 3.5, z: 7 } });
+ const plan = stageExportPlan(stage, "storyboard");
+ assert.equal(plan.duration, 3.201);
+ for (const [fps, firstCut, secondCut] of [
+ [24, 41, 51], [25, 42, 53], [30, 51, 63], [50, 84, 105], [60, 101, 126],
+ ]) {
+ const cameraAt = (frame: number) => plan.sampleAt(frame / fps).cameraId;
+ assert.equal(cameraAt(firstCut - 1), "camera-1", `first cut at ${fps} fps`);
+ assert.equal(cameraAt(firstCut), "b");
+ assert.equal(cameraAt(secondCut - 1), "b");
+ assert.equal(cameraAt(secondCut), "camera-1");
+ }
+ assert.equal(plan.sampleAt(1.667).cameraId, "b");
+ assert.equal(plan.sampleAt(3.201).cameraId, "camera-1");
+ assert.equal(plan.sampleAt(2.5).camera.position.x, 3.5,
+ "the repeated camera keeps advancing through its original animation");
+ assert.equal(plan.sampleAt(8).cameraId, "camera-1");
+ assert.equal(stage.cameraSource, "camera");
+ assert.deepEqual(stage.shots.map((shot) => shot.start), [0, 1.667, 2.085]);
+ assert.throws(
+ () => stageExportPlan({ ...stage, shots: [stage.shots[1]!] }, "storyboard"),
+ /start at 0|留空/,
+ );
+});
+
+test("export plans pin one camera for the whole document and validate the source", () => {
+ const stage = parseLocalStageValue({
+ ...createLocalStage(),
+ duration: 5,
+ cameras: [
+ {
+ id: "camera-1",
+ name: "Camera 1",
+ pose: defaultStageCamera(),
+ keyframes: [],
+ },
+ {
+ id: "b",
+ name: "Camera B",
+ pose: defaultStageCamera(),
+ keyframes: [],
+ },
+ ],
+ cameraSource: "storyboard",
+ shots: [{ id: "only", cameraId: "b", start: 0, duration: 5 }],
+ });
+ const plan = stageExportPlan(stage, "camera-1");
+ assert.equal(plan.duration, 5);
+ assert.equal(plan.sampleAt(4.2).cameraId, "camera-1");
+ assert.throws(() => stageExportPlan(stage, "nope"), /camera|摄像机/);
+ assert.throws(
+ () =>
+ stageExportPlan(parseLocalStageValue(createLocalStage()), "storyboard"),
+ /shot|分镜/,
+ );
+});
+
+test("capturing a keyframe normalizes legacy unkeyed frames instead of dropping them", () => {
+ const stage = parseLocalStageValue(oldStage());
+ const frames = stage.objects[0]!.keyframes;
+ assert.ok(frames.length >= 2, "the migrated document keeps legacy frames");
+ assert.ok(frames.every((frame) => !frame.keyedChannels));
+ const captured = captureStagePreviewFrame(stage, storedStagePreviewSource(stage), 3);
+ const mixed = captured.objects[0]!.keyframes;
+ assert.equal(mixed.length, frames.length + 1);
+ assert.ok(
+ mixed.every(
+ (frame) =>
+ frame.keyedChannels?.includes("position") &&
+ frame.keyedChannels?.includes("rotation") &&
+ frame.keyedChannels?.includes("scale"),
+ ),
+ "mixed legacy frames are stamped fully keyed",
+ );
+ // The legacy end frame must still drive sampling after the capture; a
+ // dropped legacy frame would collapse the animation to the capture pose.
+ assert.deepEqual(
+ sampleStage(captured, 6).objects[0]!.position,
+ sampleStage(stage, 6).objects[0]!.position,
+ );
+});
+
+// --- Continuous Storyboard: the stored parser stays lenient; one explicit validator guards writes ---
+
+const CAMERA = "camera-1";
+
+function block(id: string, start: number, duration: number, cameraId = CAMERA): StageShot {
+ return { id, cameraId, start, duration };
+}
+
+/** A stage as the domain layer holds it, bypassing the stored parser's own shot checks. */
+function stageOf(shots: StageShot[], duration = 6): LocalStageDocument {
+ return { ...createLocalStage(), duration, shots };
+}
+
+test("the stored stage parser keeps sparse shots exactly as they were stored", () => {
+ // Written before the continuity rule. Reading neither compacts, fills or rewrites the
+ // gaps, nor normalizes the sub-millisecond times; only a write decides about them.
+ const shots = [block("a", 1, 1), block("b", 4, 0.000412)];
+ const sparse = parseLocalStageValue({ ...createLocalStage(), duration: 4.000412, shots });
+ assert.deepEqual(sparse.shots, shots);
+ assert.equal(sparse.duration, 4.000412);
+ assert.deepEqual(
+ parseLocalStageValue(JSON.parse(JSON.stringify(sparse))).shots,
+ shots,
+ "a save and reopen round trip leaves the stored values alone",
+ );
+ // The continuity rule is a separate, explicit check that a write boundary calls.
+ assert.equal(stageStoryboardIssue(sparse), "storyboard_leading_gap");
+});
+
+test("the storyboard read model lists stored blocks, the end and why no block can follow", () => {
+ const two = [block("block-a", 0, 2), block("block-b", 2, 2)];
+ assert.deepEqual(readStageStoryboard(stageOf([])), {
+ blocks: [],
+ end: 0,
+ canAppend: true,
+ cannotAppendReason: null,
+ });
+ assert.deepEqual(readStageStoryboard(stageOf(two, 5)), {
+ blocks: [
+ { id: "block-a", cameraId: CAMERA, order: 0, start: 0, duration: 2 },
+ { id: "block-b", cameraId: CAMERA, order: 1, start: 2, duration: 2 },
+ ],
+ end: 4,
+ canAppend: true,
+ cannotAppendReason: null,
+ });
+ // The track reaches the main duration, so no positive time remains.
+ assert.deepEqual(readStageStoryboard(stageOf([...two, block("block-c", 4, 1)], 5)), {
+ blocks: [
+ { id: "block-a", cameraId: CAMERA, order: 0, start: 0, duration: 2 },
+ { id: "block-b", cameraId: CAMERA, order: 1, start: 2, duration: 2 },
+ { id: "block-c", cameraId: CAMERA, order: 2, start: 4, duration: 1 },
+ ],
+ end: 5,
+ canAppend: false,
+ cannotAppendReason: "storyboard_exhausted",
+ });
+ // A stored track that is not continuous is reported as it is, with the stable reason.
+ assert.deepEqual(readStageStoryboard(stageOf([block("a", 1, 1), block("b", 4, 0.000412)])), {
+ blocks: [
+ { id: "a", cameraId: CAMERA, order: 0, start: 1, duration: 1 },
+ { id: "b", cameraId: CAMERA, order: 1, start: 4, duration: 0.000412 },
+ ],
+ end: 4,
+ canAppend: false,
+ cannotAppendReason: "storyboard_leading_gap",
+ });
+ assert.doesNotThrow(() => readStageStoryboard(stageOf(two)));
+});
+
+test("the strict storyboard validator names the violation and explains it through the catalog", () => {
+ // Resolving a key to itself keeps the assertion independent of the interface language.
+ const keys: Translate = ((key: string) => key) as Translate;
+ const continuous = stageOf([block("a", 0, 2), block("b", 2, 1.5)]);
+ assert.equal(stageStoryboardIssue(continuous), null);
+ assert.doesNotThrow(() => assertStageStoryboard(continuous, keys));
+ for (const [shots, duration, issue] of [
+ // Zero start; stored order is the edit order.
+ [[block("a", 0.5, 2)], 6, "storyboard_leading_gap"],
+ [[block("b", 2, 1), block("a", 0, 2)], 6, "storyboard_leading_gap"],
+ // No gaps.
+ [[block("a", 0, 1), block("b", 2, 1)], 6, "storyboard_internal_gap"],
+ // No overlap.
+ [[block("a", 0, 2), block("b", 1, 1)], 6, "storyboard_overlap"],
+ // The end stays within the main duration.
+ [[block("a", 0, 3), block("b", 3, 3)], 5, "storyboard_exceeds_duration"],
+ // Every block references an existing camera and owns its identity.
+ [[block("a", 0, 1, "camera-9")], 6, "storyboard_camera_unknown"],
+ [[block("a", 0, 1), block("a", 1, 1)], 6, "storyboard_block_exists"],
+ // Times are judged after millisecond normalization: 0.6 ms does not start at zero.
+ [[block("a", 0.0006, 2)], 6, "storyboard_leading_gap"],
+ ] as const) {
+ const stage = stageOf([...shots], duration);
+ assert.equal(stageStoryboardIssue(stage), issue);
+ assert.throws(() => assertStageStoryboard(stage, keys), {
+ message: stageStoryboardIssueMessageKey(issue),
+ });
+ }
+ // Sub-millisecond input that normalizes to a continuous track passes.
+ assert.equal(
+ stageStoryboardIssue(stageOf([block("a", 0.0004, 1.2346), block("b", 1.235, 1)])),
+ null,
+ );
+});
+
+test("every stable storyboard reason is explained in both interface languages", () => {
+ // Stable codes are business values and stay untranslated; only the catalog text changes.
+ assert.ok(STAGE_STORYBOARD_ISSUES.includes("storyboard_exhausted"));
+ for (const issue of STAGE_STORYBOARD_ISSUES) {
+ const key = stageStoryboardIssueMessageKey(issue);
+ const zh = translate("zh-CN", key);
+ const en = translate("en-US", key);
+ assert.notEqual(zh, key, `${issue} has no zh-CN catalog entry`);
+ assert.notEqual(en, key, `${issue} has no en-US catalog entry`);
+ assert.ok(!/[A-Za-z]{2,}/.test(zh), `${issue}: ${zh}`);
+ assert.ok(!/[\u3400-\u9fff]/.test(en), `${issue}: ${en}`);
+ }
+});
+
+/** The `storyboard_*` issue codes the generated TypeScript contract publishes. */
+function contractStoryboardIssueCodes(): string[] {
+ const source = readFileSync(
+ new URL("../src/contracts/generated.ts", import.meta.url),
+ "utf8",
+ );
+ const declaration = source.match(
+ /^export interface ContractIssue\b[^{\n]*\{[\s\S]*?^\}/m,
+ )?.[0];
+ assert.ok(declaration, "generated.ts declares the ContractIssue interface");
+ const codes = declaration.match(/\bcode: ([^;]+);/)?.[1];
+ assert.ok(codes, "ContractIssue lists its issue codes");
+ return [...codes.matchAll(/"([^"]+)"/g)]
+ .map((match) => match[1]!)
+ .filter((code) => code.startsWith("storyboard_"));
+}
+
+test("the frontend storyboard reasons are exactly the storyboard codes of the generated contract", () => {
+ // The generated contract is the source of truth. A backend code the frontend
+ // list lacks, or a list entry the backend does not know, fails here and the build.
+ assert.deepEqual(
+ [...STAGE_STORYBOARD_ISSUES].sort(),
+ contractStoryboardIssueCodes().sort(),
+ );
+});
+
+// --- Merging a block the server already stored into the latest draft ---
+
+const keyOnly: Translate = ((key: string) => key) as Translate;
+
+test("a block the server stored merges into the latest draft exactly as it was stored", () => {
+ // The server computed the start and the duration; the draft only receives them.
+ const draft = parseLocalStageValue({
+ ...createLocalStage(),
+ shots: [block("a", 0, 2), block("b", 2, 2)],
+ });
+ const stored = block("c", 4, 1.5);
+ const merged = mergeStageStoryboardBlock(draft, stored);
+ assert.deepEqual(merged.shots, [...draft.shots, stored]);
+ // A repeated camera is another block, never a merge with the earlier one.
+ assert.deepEqual(
+ mergeStageStoryboardBlock(draft, block("again", 4, 1)).shots.map(
+ (shot) => shot.id,
+ ),
+ ["a", "b", "again"],
+ );
+ // The draft that was handed in stays as it was.
+ assert.deepEqual(draft.shots, [block("a", 0, 2), block("b", 2, 2)]);
+ assert.equal(stageStoryboardIssue(merged), null);
+});
+
+test("a stored block merges onto the draft as it is now, not as it was when the command was sent", () => {
+ // The user kept editing after the add was sent: the stage is longer and its
+ // background changed. Those edits survive and the block still lands at the tail.
+ const draft = stageOf([block("a", 0, 2)], 6);
+ const latest = { ...draft, duration: 9, background: "#101010" };
+ const merged = mergeStageStoryboardBlock(latest, block("b", 2, 2));
+ assert.deepEqual(merged.shots, [block("a", 0, 2), block("b", 2, 2)]);
+ assert.equal(merged.duration, 9);
+ assert.equal(merged.background, "#101010");
+ assert.deepEqual(draft.shots, [block("a", 0, 2)]);
+});
+
+test("a merge that would leave the draft invalid is refused with the reason and merges nothing", () => {
+ const draft = stageOf([block("a", 0, 2)]);
+ const refusals: [LocalStageDocument, StageShot, StageStoryboardIssue][] = [
+ // The main timeline was shortened below the block's end while the command was in flight.
+ [{ ...draft, duration: 3 }, block("b", 2, 2), "storyboard_exceeds_duration"],
+ // The draft gained a block of the same identity, or a block over the same time.
+ [
+ { ...draft, shots: [...draft.shots, block("b", 2, 1)] },
+ block("b", 3, 2),
+ "storyboard_block_exists",
+ ],
+ [
+ { ...draft, shots: [...draft.shots, block("c", 2, 1)] },
+ block("b", 2, 2),
+ "storyboard_overlap",
+ ],
+ // The referenced camera no longer exists in the draft.
+ [draft, block("b", 2, 2, "camera-removed"), "storyboard_camera_unknown"],
+ ];
+ for (const [latest, stored, issue] of refusals) {
+ const before = structuredClone(latest);
+ assert.throws(
+ () => mergeStageStoryboardBlock(latest, stored, keyOnly),
+ { message: stageStoryboardIssueMessageKey(issue) },
+ issue,
+ );
+ // A refused merge leaves the draft it was handed exactly as it was.
+ assert.deepEqual(latest, before, issue);
+ }
+});
+
+test("blocks laid out in another order start from zero, each where the one before it ends", () => {
+ // A lasts two seconds, B one and C two. Carried behind C, B is let in third, four
+ // seconds in; every block keeps its camera and its length.
+ const shots = [block("a", 0, 2), block("b", 2, 1, "camera-2"), block("c", 3, 2)];
+ const laid = packStageStoryboard(shots, ["a", "c", "b"]).map(
+ ({ id, cameraId, start, duration }) => [id, cameraId, start, duration],
+ );
+ assert.deepEqual(laid, [
+ ["a", CAMERA, 0, 2],
+ ["c", CAMERA, 2, 2],
+ ["b", "camera-2", 4, 1],
+ ]);
+});
+
+test("the order the Storyboard already has leaves every block where it was", () => {
+ // Let go where the order would not change: the blocks keep the starts they store.
+ const shots = [block("a", 0, 2), block("b", 2, 1, "camera-2"), block("c", 3, 2)];
+ assert.deepEqual(packStageStoryboard(shots, ["a", "b", "c"]), shots);
+ // The Storyboard handed in is read, never rewritten.
+ assert.deepEqual(shots.map(({ start }) => start), [0, 2, 3]);
+});
+
+test("storyboard times and verdicts match the Python service case for case", () => {
+ // The same fixture drives tests/test_creation_director.py. Expected values follow from
+ // the written rule (JavaScript Math.round semantics on value * 1000); they were not
+ // recorded from either implementation.
+ const fixture = JSON.parse(
+ readFileSync(new URL("./fixtures/director-storyboard.json", import.meta.url), "utf8"),
+ ) as {
+ times: { value: number; normalized: number }[];
+ tracks: {
+ name: string;
+ duration: number;
+ shots: [string, string, number, number][];
+ issue: string | null;
+ end: number;
+ canAppend: boolean;
+ cannotAppendReason: string | null;
+ }[];
+ };
+ for (const { value, normalized } of fixture.times) {
+ assert.equal(normalizeStoryboardTime(value), normalized, `normalize ${value}`);
+ }
+ for (const track of fixture.tracks) {
+ const stage = stageOf(
+ track.shots.map(([id, cameraId, start, duration]) => ({ id, cameraId, start, duration })),
+ track.duration,
+ );
+ assert.equal(stageStoryboardIssue(stage), track.issue, track.name);
+ assert.deepEqual(readStageStoryboard(stage), {
+ blocks: track.shots.map(([id, cameraId, start, duration], order) => ({
+ id,
+ cameraId,
+ order,
+ start,
+ duration,
+ })),
+ end: track.end,
+ canAppend: track.canAppend,
+ cannotAppendReason: track.cannotAppendReason,
+ }, track.name);
+ }
+});
+
+test("blocks laid out in another order match the Python service case for case", () => {
+ // The same fixture drives tests/test_creation_director.py, where the shared command
+ // is also made to store each case. Expected values follow from the written rule,
+ // each start being the millisecond-normalized sum of the lengths before it; they
+ // were not recorded from either implementation.
+ const fixture = JSON.parse(
+ readFileSync(new URL("./fixtures/director-storyboard.json", import.meta.url), "utf8"),
+ ) as {
+ reorders: {
+ name: string;
+ duration: number;
+ shots: [string, string, number, number][];
+ order: string[];
+ laid: [string, string, number, number][];
+ end: number;
+ }[];
+ };
+ for (const { name, duration, shots, order, laid, end } of fixture.reorders) {
+ const packed = packStageStoryboard(
+ shots.map(([id, cameraId, start, span]) => ({ id, cameraId, start, duration: span })),
+ order,
+ );
+ // Every block keeps its identity, its camera and its length, and starts where the
+ // one before it ends.
+ assert.deepEqual(
+ packed.map(({ id, cameraId, start, duration: span }) => [id, cameraId, start, span]),
+ laid,
+ name,
+ );
+ const stage = stageOf(packed, duration);
+ assert.equal(stageStoryboardIssue(stage), null, `${name}: laid out, the track is continuous`);
+ assert.equal(readStageStoryboard(stage).end, end, `${name}: where the last block ends`);
+ }
+});
+
+// --- Preview source: which block owns a time, independent of what the stage stores ---
+
+test("the block under a time: a shared boundary belongs to the block on its right", () => {
+ const stage = stageOf([block("a", 0, 2), block("b", 2, 2)]);
+ assert.equal(stageStoryboardBlockAt(stage, 0)?.id, "a");
+ assert.equal(stageStoryboardBlockAt(stage, 1.5)?.id, "a");
+ assert.equal(stageStoryboardBlockAt(stage, 2 - 1 / 30)?.id, "a");
+ assert.equal(stageStoryboardBlockAt(stage, 2)?.id, "b");
+ assert.equal(stageStoryboardBlockAt(stage, 3.5)?.id, "b");
+});
+
+test("the exact final Storyboard endpoint belongs to the last block", () => {
+ const stage = stageOf([block("a", 0, 2), block("b", 2, 2)], 6);
+ assert.equal(stageStoryboardBlockAt(stage, 4 - 1 / 30)?.id, "b");
+ assert.equal(stageStoryboardBlockAt(stage, 4)?.id, "b");
+});
+
+test("no block owns a time before zero, after the Storyboard endpoint, or on an empty track", () => {
+ const stage = stageOf([block("a", 0, 2), block("b", 2, 2)], 6);
+ assert.equal(stageStoryboardBlockAt(stage, 4.001), null);
+ assert.equal(
+ stageStoryboardBlockAt(stage, 6),
+ null,
+ "the main duration is not the Storyboard endpoint",
+ );
+ assert.equal(stageStoryboardBlockAt(stage, -1), null);
+ for (const at of [0, 2, 4, 6])
+ assert.equal(stageStoryboardBlockAt(stageOf([]), at), null, `empty track at ${at}`);
+});
+
+test("a stored track that is not continuous answers with the block that contains the time", () => {
+ // Written before the continuity rule. Reading it neither throws nor repairs the gaps.
+ const shots = [block("a", 1, 1), block("b", 4, 0.5)];
+ const sparse = parseLocalStageValue({ ...createLocalStage(), duration: 6, shots });
+ assert.equal(stageStoryboardBlockAt(sparse, 0.5), null, "before the first block");
+ assert.equal(stageStoryboardBlockAt(sparse, 1)?.id, "a");
+ assert.equal(stageStoryboardBlockAt(sparse, 1.5)?.id, "a");
+ assert.equal(stageStoryboardBlockAt(sparse, 2), null, "the gap between the blocks");
+ assert.equal(stageStoryboardBlockAt(sparse, 3.9), null);
+ assert.equal(stageStoryboardBlockAt(sparse, 4)?.id, "b");
+ assert.equal(stageStoryboardBlockAt(sparse, 4.5)?.id, "b", "the final endpoint");
+ assert.equal(stageStoryboardBlockAt(sparse, 5), null);
+ assert.deepEqual(sparse.shots, shots, "nothing was repaired");
+});
+
+test("block ownership normalizes saved boundaries and keeps sample timestamps exact", () => {
+ // Raw, the first block ends at 1.2346 and the next starts at 1.235; a millisecond track
+ // has them meet at 1.235, so nothing falls between them.
+ const stage = stageOf([block("a", 0, 1.2346), block("b", 1.235, 1)]);
+ assert.equal(stageStoryboardBlockAt(stage, 1.2344)?.id, "a");
+ assert.equal(
+ stageStoryboardBlockAt(stage, 1.2349)?.id,
+ "a",
+ "1.2349 s is before the saved cut at 1.235",
+ );
+});
+
+// --- What a preview shows: the camera follows the preview source, the scene follows the time ---
+
+const WIDE = "wide";
+const TIGHT = "tight";
+const STORYBOARD = { kind: "storyboard" } as const;
+
+/** Two cameras told apart by their field of view, and a two-block Storyboard over them. */
+function previewStage(
+ shots: StageShot[] = [block("a", 0, 2, WIDE), block("b", 2, 2, TIGHT)],
+ duration = 6,
+): LocalStageDocument {
+ const rig = (id: string, name: string, fov: number) => ({
+ id,
+ name,
+ aspectRatio: "16:9" as const,
+ pose: { ...defaultStageCamera(), fov },
+ keyframes: [],
+ });
+ return {
+ ...stageOf(shots, duration),
+ cameras: [rig(WIDE, "Wide", 70), rig(TIGHT, "Tight", 20)],
+ activeCameraId: TIGHT,
+ cameraSource: "camera",
+ };
+}
+
+/** A person that walks from x = 0 to x = 6 over the six-second main timeline. */
+function withWalker(stage: LocalStageDocument): LocalStageDocument {
+ const pose = (x: number) => ({
+ position: { x, y: 0, z: 0 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ });
+ return {
+ ...stage,
+ objects: [
+ {
+ id: "walker",
+ kind: "person",
+ name: "Walker",
+ color: "#a09af9",
+ ...pose(0),
+ visible: true,
+ locked: false,
+ opacity: 1,
+ motionClips: [],
+ keyframes: [
+ { id: "k0", time: 0, value: pose(0) },
+ { id: "k6", time: 6, value: pose(6) },
+ ],
+ },
+ ],
+ };
+}
+
+test("a Storyboard preview shows the camera of the block that owns the playhead", () => {
+ const stage = previewStage();
+ assert.equal(stagePreviewCameraId(stage, STORYBOARD, 0), WIDE);
+ assert.equal(stagePreviewCameraId(stage, STORYBOARD, 1.5), WIDE);
+ assert.equal(
+ stagePreviewCameraId(stage, STORYBOARD, 2),
+ TIGHT,
+ "a shared boundary belongs to the block on its right",
+ );
+ assert.equal(stagePreviewCameraId(stage, STORYBOARD, 3.5), TIGHT);
+});
+
+test("after the Storyboard end a Storyboard preview stays on the last block's camera", () => {
+ const stage = previewStage();
+ assert.equal(stagePreviewCameraId(stage, STORYBOARD, 4), TIGHT, "the exact endpoint");
+ assert.equal(stagePreviewCameraId(stage, STORYBOARD, 5.5), TIGHT, "beyond the endpoint");
+ assert.equal(stagePreviewCameraId(stage, STORYBOARD, 6), TIGHT, "at the main duration");
+});
+
+test("after the Storyboard end the editing viewport continues to sample the live scene", () => {
+ const tightening = editStageCameraAt(previewStage(), TIGHT, 0, { fov: 20 });
+ const stage = withWalker(editStageCameraAt(tightening, TIGHT, 6, { fov: 50 }));
+ const live = sampleStageEditingViewport(stage, STORYBOARD, 5.5);
+ assert.equal(live.cameraId, TIGHT);
+ assert.equal(live.camera.fov, 47.5);
+ assert.equal(live.objects[0]!.position.x, 5.5);
+});
+
+test("a preview pinned to a camera shows that camera at every time", () => {
+ const stage = previewStage();
+ const pinned = { kind: "camera", cameraId: WIDE } as const;
+ for (const at of [0, 1.5, 2, 3.5, 4, 5.5, 6])
+ assert.equal(stagePreviewCameraId(stage, pinned, at), WIDE, `at ${at}`);
+ // A camera that no longer exists uses the selector fallback.
+ assert.equal(
+ stagePreviewCameraId(stage, { kind: "camera", cameraId: "removed" }, 1),
+ WIDE,
+ );
+ // Nor does a block whose camera is gone.
+ assert.equal(
+ stagePreviewCameraId(previewStage([block("a", 0, 2, "removed")]), STORYBOARD, 1),
+ null,
+ );
+});
+
+test("a preview source that names nothing resolves to the first existing camera", () => {
+ // A Storyboard with no blocks has no camera to show.
+ assert.deepEqual(resolveStagePreviewSource(previewStage([]), STORYBOARD), {
+ kind: "camera",
+ cameraId: WIDE,
+ });
+ // Nor does a camera that no longer exists.
+ assert.deepEqual(
+ resolveStagePreviewSource(previewStage(), { kind: "camera", cameraId: "removed" }),
+ { kind: "camera", cameraId: WIDE },
+ );
+ // A source that names a camera is kept exactly as it was chosen.
+ assert.equal(resolveStagePreviewSource(previewStage(), STORYBOARD), STORYBOARD);
+ assert.equal(
+ resolveStagePreviewSource(previewStage(), { kind: "camera", cameraId: TIGHT })?.kind,
+ "camera",
+ );
+});
+
+test("the fallback is not sticky: a choice applies again by itself once it names something", () => {
+ const choice = { kind: "camera", cameraId: TIGHT } as const;
+ const wideOnly = { ...previewStage([]), cameras: previewStage().cameras.slice(0, 1) };
+ // The chosen camera is gone, so the preview resolves to the first camera.
+ assert.deepEqual(resolveStagePreviewSource(wideOnly, choice), {
+ kind: "camera",
+ cameraId: WIDE,
+ });
+ // An undo brings the camera back, and with it the choice: the same source, not a copy.
+ assert.equal(resolveStagePreviewSource(previewStage([]), choice), choice);
+ // The same when the Storyboard loses and regains its last block.
+ assert.deepEqual(resolveStagePreviewSource(previewStage([]), STORYBOARD), {
+ kind: "camera",
+ cameraId: WIDE,
+ });
+ assert.equal(resolveStagePreviewSource(previewStage(), STORYBOARD), STORYBOARD);
+ // A stage without a camera has nothing to resolve to, so nothing is invented.
+ const noCameras = { ...previewStage([]), cameras: [] };
+ assert.equal(resolveStagePreviewSource(noCameras, choice), choice);
+ assert.equal(resolveStagePreviewSource(noCameras, STORYBOARD), STORYBOARD);
+});
+
+test("a Storyboard preview samples the camera of the block under the playhead", () => {
+ const stage = previewStage();
+ const at = (time: number) => sampleStagePreview(stage, STORYBOARD, time);
+ assert.equal(at(1.5).cameraId, WIDE);
+ assert.equal(at(3).cameraId, TIGHT);
+ // With the pose that camera has at the playhead.
+ assert.deepEqual(at(1.5).camera, sampleStageCamera(stage, WIDE, 1.5));
+ assert.deepEqual(at(3).camera, sampleStageCamera(stage, TIGHT, 3));
+ assert.equal(at(1.5).camera.fov, 70);
+ assert.equal(at(3).camera.fov, 20);
+});
+
+test("after the Storyboard end the preview holds the last sampled camera and scene", () => {
+ const tightening = editStageCameraAt(previewStage(), TIGHT, 0, { fov: 20 });
+ const stage = withWalker(editStageCameraAt(tightening, TIGHT, 6, { fov: 50 }));
+ const endpoint = sampleStagePreview(stage, STORYBOARD, 4);
+ assert.equal(endpoint.cameraId, TIGHT);
+ assert.equal(endpoint.camera.fov, 40);
+ assert.equal(endpoint.objects[0]!.position.x, 4);
+ for (const at of [4.25, 5.5, 6])
+ assert.deepEqual(sampleStagePreview(stage, STORYBOARD, at), endpoint);
+});
+
+test("a preview pinned to a camera ignores the Storyboard and shows the scene at the playhead", () => {
+ const stage = withWalker(previewStage());
+ const pinned = { kind: "camera", cameraId: WIDE } as const;
+ // Under both blocks, at the Storyboard end and past it.
+ for (const at of [1.5, 3, 4, 5.5]) {
+ const sample = sampleStagePreview(stage, pinned, at);
+ assert.equal(sample.cameraId, WIDE, `the camera at ${at}`);
+ assert.deepEqual(sample.camera, sampleStageCamera(stage, WIDE, at));
+ assert.equal(sample.objects[0]!.position.x, at, `the scene at ${at}`);
+ }
+});
+
+test("the preview scene is the scene the stored sampler draws at the same time", () => {
+ const stage = withWalker(previewStage());
+ for (const source of [STORYBOARD, { kind: "camera", cameraId: WIDE } as const])
+ for (const at of [0, 1.5, 3, 4])
+ assert.deepEqual(
+ sampleStagePreview(stage, source, at).objects,
+ sampleStage(stage, at).objects,
+ `${source.kind} at ${at}`,
+ );
+});
+
+test("a preview source that names nothing shows the first existing camera", () => {
+ assert.equal(
+ sampleStagePreview(previewStage([]), STORYBOARD, 1).cameraId,
+ WIDE,
+ "a Storyboard with no blocks",
+ );
+ assert.equal(
+ sampleStagePreview(previewStage(), { kind: "camera", cameraId: "removed" }, 3).cameraId,
+ WIDE,
+ "a camera that no longer exists",
+ );
+});
+
+test("the preview never reads the source the stage stores", () => {
+ const stage = withWalker(previewStage());
+ const blind = {
+ ...stage,
+ get cameraSource(): never {
+ throw new Error("read the stored cameraSource");
+ },
+ get activeCameraId(): never {
+ throw new Error("read the stored activeCameraId");
+ },
+ };
+ for (const source of [
+ STORYBOARD,
+ { kind: "camera", cameraId: WIDE } as const,
+ { kind: "camera", cameraId: "removed" } as const,
+ ])
+ for (const at of [0, 1.5, 2, 3, 4, 5.5, 6])
+ assert.doesNotThrow(() => sampleStagePreview(blind, source, at));
+ // The stored sampler does read them, which shows the trap is live.
+ assert.throws(() => sampleStage(blind, 1.5), /stored cameraSource/);
+});
+
+test("the preview a stage opens with is read from what the document stores", () => {
+ // A stored camera source opens on the stored active camera.
+ assert.deepEqual(storedStagePreviewSource(previewStage()), {
+ kind: "camera",
+ cameraId: TIGHT,
+ });
+ assert.deepEqual(
+ storedStagePreviewSource({ ...previewStage(), activeCameraId: WIDE }),
+ { kind: "camera", cameraId: WIDE },
+ );
+ // A stored Storyboard source opens on the Storyboard.
+ assert.deepEqual(
+ storedStagePreviewSource({ ...previewStage(), cameraSource: "storyboard" }),
+ STORYBOARD,
+ );
+ // Reading it leaves the document as it is.
+ const stage = previewStage();
+ storedStagePreviewSource(stage);
+ assert.equal(stage.cameraSource, "camera");
+ assert.equal(stage.activeCameraId, TIGHT);
+});
+
+test("a captured frame keys the camera the preview shows, not the one the stage stores", () => {
+ /** Times at which a camera's position channel holds a key. */
+ const positionKeys = (stage: LocalStageDocument, cameraId: string) =>
+ stage.cameras.find((camera) => camera.id === cameraId)!.channels!.position.map(
+ (frame) => frame.time,
+ );
+ const stage = withWalker(previewStage());
+ // Pinned to Wide while the stage's own source is Tight.
+ const pinned = captureStagePreviewFrame(stage, { kind: "camera", cameraId: WIDE } as const, 3);
+ assert.deepEqual(positionKeys(pinned, WIDE), [3]);
+ assert.deepEqual(positionKeys(pinned, TIGHT), [], "the stored camera gains no key");
+ // Under the Storyboard the keyed camera is the one of the block under the playhead.
+ const cut = captureStagePreviewFrame(stage, STORYBOARD, 3);
+ assert.deepEqual(positionKeys(cut, TIGHT), [3]);
+ assert.deepEqual(positionKeys(cut, WIDE), []);
+ // Naming another camera changes nothing the stage stores as its source.
+ for (const captured of [pinned, cut]) {
+ assert.equal(captured.cameraSource, "camera");
+ assert.equal(captured.activeCameraId, TIGHT);
+ }
+ // The objects are captured as before, and so is the stored sampler's own camera. A
+ // capture mints a key identity for each new key, so the keys are compared without them.
+ const keys = (frames: unknown) =>
+ JSON.stringify(frames, (key, value) => (key === "id" ? undefined : value));
+ assert.equal(
+ keys(pinned.objects[0]!.keyframes),
+ keys(captureStagePreviewFrame(stage, storedStagePreviewSource(stage), 3).objects[0]!.keyframes),
+ );
+ const stored = captureStagePreviewFrame(stage, storedStagePreviewSource(stage), 3);
+ assert.deepEqual(positionKeys(stored, TIGHT), [3]);
+ assert.deepEqual(positionKeys(stored, WIDE), []);
+});
+
+test("import preserves the supplied block order and explains invalid Storyboards in both languages", () => {
+ const inverted = [block("b", 2, 1), block("a", 0, 2)];
+ assert.deepEqual(parseLocalStageValue(stageOf(inverted)).shots, inverted);
+ const cases: [StageShot[], StageStoryboardIssue][] = [
+ [inverted, "storyboard_leading_gap"],
+ [[block("a", 0, 2), block("b", 1, 2)], "storyboard_overlap"],
+ [[block("a", 0, 7)], "storyboard_exceeds_duration"],
+ [[block("a", 0, 1), block("a", 1, 1)], "storyboard_block_exists"],
+ ];
+ for (const language of ["zh-CN", "en-US"] as const) {
+ const t: Translate = (input: MessageKey | MessageDescriptor, values?: MessageParams) => typeof input === "string"
+ ? translate(language, input, values) : translateDescriptor(language, input);
+ for (const [shots, issue] of cases) {
+ assert.throws(() => parseImportedStageValue(stageOf(shots), t), {
+ message: t(stageStoryboardIssueMessageKey(issue)),
+ });
+ }
+ }
+});
+
+test("a legacy sub-millisecond tail merges the acknowledged block at the effective cut", () => {
+ const stage = stageOf([block("a", 0, 1.0004), block("b", 1.0004, 1.0004)]);
+ assert.equal(readStageStoryboard(stage).end, 2);
+ const next = mergeStageStoryboardBlock(stage, block("c", 2, 2));
+ assert.deepEqual(next.shots, [...stage.shots, block("c", 2, 2)]);
+ assert.equal(stageStoryboardBlockAt(next, 2)?.id, "c");
+});
diff --git a/tests/canvasWorkspaceEntry.test.ts b/tests/canvasWorkspaceEntry.test.ts
index 234dc20ce..f559a63c5 100644
--- a/tests/canvasWorkspaceEntry.test.ts
+++ b/tests/canvasWorkspaceEntry.test.ts
@@ -10,6 +10,7 @@ import {
import { createNode } from "../src/canvas/model.ts";
import { generationDefaults } from "../src/canvas/generationCatalog.ts";
import { generationEditIdentity } from "../src/canvas/generationSettings.ts";
+import { CANVAS_CREATION_TOOLS } from "../src/canvas/creationTools.ts";
import {
generationPrepareBlock,
importedNodeIds,
@@ -87,6 +88,12 @@ test("video references ignore irrelevant slot initialization but retain explicit
settings: { ...firstLast.data.settings, frameSlotsInitialized: true } } }, firstLast), false);
});
+test("director stage is enabled in the shared creation entry list", () => {
+ const stage = CANVAS_CREATION_TOOLS.find((tool) => tool.kind === "external");
+ assert.ok(stage);
+ assert.equal(stage.unavailable, undefined);
+});
+
test("upload picker blocks locked, generation output, and running nodes", () => {
assert.deepEqual(
uploadPickerPlan({
diff --git a/tests/creationClient.test.ts b/tests/creationClient.test.ts
index bf764cec4..902b5076b 100644
--- a/tests/creationClient.test.ts
+++ b/tests/creationClient.test.ts
@@ -851,6 +851,8 @@ test("reference replacement and hiding preserve the intended project relationshi
hasAudio: null,
sampleRate: null,
channels: null,
+ selfContained: null,
+ animationNames: null,
},
provenance: {
source: "manual",
diff --git a/tests/creationEditorSession.test.ts b/tests/creationEditorSession.test.ts
index ffb6f8bd4..0692c9a05 100644
--- a/tests/creationEditorSession.test.ts
+++ b/tests/creationEditorSession.test.ts
@@ -1,6 +1,7 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
+import { ApiError } from "../src/backend/api.ts";
import {
CreationClient,
CreationCommandError,
@@ -182,6 +183,71 @@ test("a lost delivery survives a new editor session and resolves before a change
assert.equal(saved.size, 0);
});
+test("a definitively refused stored delivery is replanned, never replayed forever", async (t) => {
+ const original = Object.getOwnPropertyDescriptor(
+ globalThis,
+ "sessionStorage",
+ );
+ const saved = new Map();
+ Object.defineProperty(globalThis, "sessionStorage", {
+ configurable: true,
+ value: {
+ getItem: (k: string) => saved.get(k) ?? null,
+ setItem: (k: string, v: string) => saved.set(k, v),
+ removeItem: (k: string) => saved.delete(k),
+ },
+ });
+ t.after(() => {
+ if (original) Object.defineProperty(globalThis, "sessionStorage", original);
+ else Reflect.deleteProperty(globalThis, "sessionStorage");
+ });
+ const { client, document, item } = await fixture();
+ const timeline = structuredClone(
+ document.nodes.find((n) => n.id === item.id)!.data.timeline!,
+ );
+ timeline.width += 2;
+ // A delivery stored by an older schema: its prepared operations carry a
+ // field the backend now refuses at the HTTP boundary (422 invalid_input).
+ saved.set(
+ `opendirector.editor.delivery:${client.id}:${item.id}`,
+ JSON.stringify({
+ id: crypto.randomUUID(),
+ key: JSON.stringify({ timeline }),
+ data: { timeline },
+ plan: {
+ operations: [
+ {
+ type: "editor.save",
+ payload: { document: { id: item.id, projectId: client.id, kind: "timeline", data: { legacyJunk: true } } },
+ },
+ ],
+ versions: [],
+ },
+ }),
+ );
+ const posts: { junk: boolean }[] = [];
+ client.command = async (_type, payload) => {
+ const junk = JSON.stringify(payload).includes("legacyJunk");
+ posts.push({ junk });
+ if (junk)
+ throw new ApiError(
+ "The request is invalid. Check the required fields and their formats.",
+ 422,
+ "invalid_input",
+ );
+ return { status: "applied" } as CommandReceipt;
+ };
+ const session = new CreationEditorSession(client, document, item.id);
+ // The stored refusal replays once, exactly like the stuck editor session.
+ await assert.rejects(session.apply({ timeline }), /invalid/i);
+ assert.deepEqual(posts, [{ junk: true }]);
+ // The refusal is definitive, so the next attempt must replan with current
+ // code instead of replaying the poisoned operations forever.
+ await session.apply({ timeline });
+ assert.deepEqual(posts, [{ junk: true }, { junk: false }]);
+ assert.equal(saved.size, 0);
+});
+
test("dissolving a stack prepares one atomic edit and keeps its draft after rejection", async () => {
const { client, document, snapshot } = await fixture();
const item = snapshot.canvasItems.find((i) => i.kind === "stack")!;
diff --git a/tests/directorStageAssets.test.ts b/tests/directorStageAssets.test.ts
new file mode 100644
index 000000000..436f42104
--- /dev/null
+++ b/tests/directorStageAssets.test.ts
@@ -0,0 +1,701 @@
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import test from "node:test";
+import {
+ createLocalStage,
+ normalizeLegacyDefaultPersonName,
+ parseLocalStageValue,
+ probeStageAsset,
+ sameLocalStage,
+ unregisteredStageAssets,
+} from "../src/canvas/stageDocument.ts";
+import {
+ CreationProjection,
+ stageUploadTitle,
+} from "../src/backend/creationProjection.ts";
+import { CreationClient } from "../src/backend/creationClient.ts";
+import { createDocument, createNode } from "../src/canvas/model.ts";
+import type { ProjectSnapshot } from "../src/contracts/generated.ts";
+import type { AssetRef } from "../src/contracts/generated.ts";
+
+const asset = {
+ assetId: "asset-gltf",
+ revision: 2,
+ fingerprint: `sha256:${"a".repeat(64)}`,
+ kind: "file" as const,
+};
+const thumbnailAsset = {
+ assetId: "asset-thumbnail",
+ revision: 1,
+ fingerprint: `sha256:${"b".repeat(64)}`,
+ kind: "image" as const,
+};
+
+/** Stages start empty; the object tests below seed one subject. */
+function stageWithPerson() {
+ return {
+ ...createLocalStage(),
+ objects: [
+ {
+ id: "person",
+ kind: "person" as const,
+ name: "默认人物",
+ color: "#a09af9",
+ position: { x: 0, y: 0, z: 0 },
+ rotation: { x: 0, y: 0, z: 0 },
+ scale: { x: 1, y: 1, z: 1 },
+ visible: true,
+ locked: false,
+ opacity: 1,
+ keyframes: [],
+ motionClips: [],
+ },
+ ],
+ };
+}
+
+test("legacy generated default person names follow the current display label", () => {
+ const stage = stageWithPerson();
+ const legacy = {
+ ...stage,
+ objects: [
+ { ...stage.objects[0]!, name: "人物 1" },
+ { ...stage.objects[0]!, id: "renamed-person", name: "人物 1" },
+ ],
+ };
+ const normalized = normalizeLegacyDefaultPersonName(legacy, "默认人物");
+ assert.equal(normalized.objects[0]!.name, "默认人物");
+ assert.equal(normalized.objects[1]!.name, "人物 1");
+ assert.equal(normalizeLegacyDefaultPersonName(stage, "默认人物"), stage);
+ // A subject placed from the generic template carries the template color:
+ // reusing a generated legacy name must not trigger the label migration.
+ const placed = {
+ ...stage,
+ objects: [{ ...stage.objects[0]!, color: "#d0d0d0", name: "Person 1" }],
+ };
+ assert.equal(normalizeLegacyDefaultPersonName(placed, "默认人物"), placed);
+});
+
+test("stage object thumbnails accept nullable projections and retain image asset identity", () => {
+ const stage = stageWithPerson();
+ const [person] = stage.objects;
+ const projected = parseLocalStageValue({
+ ...stage,
+ objects: [{ ...person, thumbnailAsset: null }],
+ });
+ assert.equal(projected.objects[0]!.thumbnailAsset, undefined);
+
+ const pinned = parseLocalStageValue({
+ ...stage,
+ objects: [{ ...person, thumbnailAsset }],
+ });
+ assert.deepEqual(pinned.objects[0]!.thumbnailAsset, thumbnailAsset);
+ assert.deepEqual(
+ parseLocalStageValue(JSON.parse(JSON.stringify(pinned))).objects[0]!
+ .thumbnailAsset,
+ thumbnailAsset,
+ );
+});
+
+test("GLB/GLTF stage objects accept transient previews and retain stable asset identity", () => {
+ const stage = stageWithPerson();
+ const [person] = stage.objects;
+ const imported = parseLocalStageValue({
+ ...stage,
+ objects: [
+ {
+ ...person,
+ kind: "gltf",
+ role: "character",
+ format: "glb",
+ source: "blob:director-preview",
+ asset,
+ animationNames: ["Walk"],
+ hasAnimation: true,
+ motionClips: [],
+ },
+ ],
+ });
+ assert.equal(imported.objects[0]!.asset?.assetId, "asset-gltf");
+ assert.equal(imported.objects[0]!.source, "blob:director-preview");
+ assert.deepEqual(
+ parseLocalStageValue(JSON.parse(JSON.stringify(imported))),
+ imported,
+ );
+ assert.equal(
+ sameLocalStage(
+ imported,
+ parseLocalStageValue({
+ ...imported,
+ objects: [{ ...imported.objects[0]!, source: "blob:reloaded" }],
+ }),
+ ),
+ true,
+ );
+});
+
+test("a new local imported object may be previewed before its first project save", () => {
+ const stage = stageWithPerson();
+ const [person] = stage.objects;
+ const parsed = parseLocalStageValue({
+ ...stage,
+ objects: [
+ {
+ ...person,
+ kind: "gltf",
+ role: "scene",
+ format: "gltf",
+ source: "blob:unsaved-scene",
+ animationNames: [],
+ hasAnimation: false,
+ motionClips: [],
+ },
+ ],
+ });
+ assert.equal(parsed.objects[0]!.asset, undefined);
+ assert.equal(parsed.objects[0]!.role, "scene");
+});
+
+test("imported asset validation rejects missing identity, scene motion and absent animation data", () => {
+ const stage = stageWithPerson();
+ const [person] = stage.objects;
+ const base = {
+ ...person,
+ kind: "gltf",
+ role: "character",
+ format: "glb",
+ asset,
+ animationNames: [],
+ hasAnimation: false,
+ motionClips: [],
+ };
+ assert.throws(
+ () =>
+ parseLocalStageValue({
+ ...stage,
+ objects: [{ ...base, asset: undefined }],
+ }),
+ /舞台对象/,
+ );
+ assert.throws(
+ () =>
+ parseLocalStageValue({
+ ...stage,
+ objects: [
+ {
+ ...base,
+ role: "scene",
+ motionClips: [
+ {
+ id: "scene-motion",
+ start: 0,
+ duration: 1,
+ motion: { preset: "idle", speed: 1, amount: 1 },
+ },
+ ],
+ },
+ ],
+ }),
+ /场景素材/,
+ );
+ assert.throws(
+ () =>
+ parseLocalStageValue({
+ ...stage,
+ objects: [
+ {
+ ...base,
+ motionClips: [
+ {
+ id: "missing-animation",
+ start: 0,
+ duration: 1,
+ motion: { preset: "walk", speed: 1, amount: 1 },
+ },
+ ],
+ },
+ ],
+ }),
+ /没有动画/,
+ );
+});
+
+test("stage upload titles stay path-free whatever the object is named", () => {
+ assert.equal(stageUploadTitle("hero/v2", "glb"), "hero_v2.glb");
+ assert.equal(stageUploadTitle("a\\b\u0007c", "gltf"), "a_b_c.gltf");
+ assert.equal(stageUploadTitle(" ", "glb"), "导入模型.glb");
+ assert.equal(
+ stageUploadTitle("长".repeat(300), "gltf").length <= 255,
+ true,
+ );
+ assert.equal(stageUploadTitle("长".repeat(300), "gltf").endsWith(".gltf"), true);
+ // The limit cuts code points, never splitting a surrogate pair: a cut
+ // title must round-trip through UTF-8 without replacement characters.
+ const emoji = stageUploadTitle("a".repeat(249) + "😀", "glb");
+ assert.ok(emoji.includes("😀"));
+ assert.equal(Buffer.from(emoji, "utf8").toString("utf8"), emoji);
+});
+
+test("stage JSON imports flag imported objects the project has not registered", () => {
+ const stage = stageWithPerson();
+ const [person] = stage.objects;
+ const unregisteredThumbnail = { ...thumbnailAsset };
+ const foreign = parseLocalStageValue({
+ ...stage,
+ objects: [
+ person,
+ {
+ ...person,
+ id: "foreign-actor",
+ kind: "gltf",
+ name: "Foreign actor",
+ role: "character",
+ format: "glb",
+ asset,
+ animationNames: ["Walk"],
+ hasAnimation: true,
+ motionClips: [],
+ },
+ {
+ ...person,
+ id: "local-preview",
+ kind: "gltf",
+ name: "Unsaved import",
+ role: "scene",
+ format: "gltf",
+ source: "blob:unsaved",
+ animationNames: [],
+ hasAnimation: false,
+ motionClips: [],
+ },
+ {
+ ...person,
+ id: "foreign-thumbnail",
+ thumbnailAsset: unregisteredThumbnail,
+ },
+ ],
+ });
+ const registered = (ref: AssetRef) =>
+ ref.assetId !== "asset-gltf" &&
+ ref.assetId !== "asset-thumbnail" &&
+ ref.revision <= 5;
+ const flagged = unregisteredStageAssets(foreign, registered);
+ assert.deepEqual(
+ flagged.map((object) => object.id),
+ ["foreign-actor", "foreign-thumbnail"],
+ );
+ // A pinned asset at an older revision than the registered one still resolves.
+ assert.deepEqual(
+ unregisteredStageAssets(foreign, () => true),
+ [],
+ );
+});
+
+function glbBuffer(payload: string): ArrayBuffer {
+ const padded = payload + " ".repeat((4 - (payload.length % 4)) % 4);
+ const body = new Uint8Array(12 + 8 + padded.length);
+ const view = new DataView(body.buffer);
+ body.set([0x67, 0x6c, 0x54, 0x46], 0);
+ view.setUint32(4, 2, true);
+ view.setUint32(8, body.length, true);
+ view.setUint32(12, padded.length, true);
+ body.set([0x4a, 0x53, 0x4f, 0x4e], 16);
+ body.set(new TextEncoder().encode(padded), 20);
+ return body.buffer;
+}
+
+test("stage asset probing distinguishes models, external resources and corruption", () => {
+ const gltf = (document: unknown) =>
+ new TextEncoder().encode(JSON.stringify(document)).buffer as ArrayBuffer;
+ assert.deepEqual(
+ probeStageAsset(glbBuffer(JSON.stringify({ asset: { version: "2.0" } }))),
+ { format: "glb", external: false },
+ );
+ assert.deepEqual(
+ probeStageAsset(
+ glbBuffer(
+ JSON.stringify({
+ asset: { version: "2.0" },
+ buffers: [{ uri: "scene.bin", byteLength: 4 }],
+ }),
+ ),
+ ),
+ { format: "glb", external: true },
+ );
+ assert.deepEqual(
+ probeStageAsset(gltf({ asset: { version: "2.0" } })),
+ { format: "gltf", external: false },
+ );
+ // Valid magic but truncated: the declared length exceeds the bytes present.
+ const truncated = new Uint8Array(12);
+ truncated.set([0x67, 0x6c, 0x54, 0x46], 0);
+ new DataView(truncated.buffer).setUint32(8, 4096, true);
+ assert.equal(probeStageAsset(truncated.buffer), undefined);
+ // Valid container, unusable embedded JSON.
+ assert.equal(probeStageAsset(glbBuffer("{not json")), "corrupt");
+ assert.equal(probeStageAsset(glbBuffer("[1, 2, 3]")), "corrupt");
+ assert.equal(probeStageAsset(gltf({ no: "document" })), undefined);
+ assert.equal(probeStageAsset(gltf({ asset: { version: "2.0" } }).slice(0, 4)), undefined);
+});
+
+test("director stage reads keep pinned identity when media bytes are unavailable", async () => {
+ const source = JSON.parse(
+ readFileSync(
+ new URL("./fixtures/creation-project.json", import.meta.url),
+ "utf8",
+ ),
+ ) as ProjectSnapshot;
+ const client = new CreationClient(source.project.id);
+ client.install(source);
+ const unavailable = "00000000-0000-0000-0000-00000000000e";
+ client.mediaUrl = async (id) => {
+ if (id === unavailable) throw new Error("asset content gone");
+ return `blob:${id}`;
+ };
+ client.view = async () => ({
+ projectId: client.id,
+ clientId: crypto.randomUUID(),
+ viewport: { x: 0, y: 0, zoom: 1 },
+ selectedItemIds: [],
+ activeEditorId: null,
+ playheads: [],
+ generationCounts: {},
+ });
+ const document = await new CreationProjection(client).read();
+ const stage = document.nodes
+ .map((node) => node.data.localStage)
+ .find((value) => value?.objects.some((object) => object.kind === "gltf"));
+ assert.ok(stage, "director stage node missing from projection");
+ const imported = stage.objects.find((object) => object.kind === "gltf")!;
+ assert.equal(imported.asset?.assetId, unavailable);
+ assert.equal(imported.source, undefined);
+ // The document stays valid without the preview URL; the editor shows the
+ // unavailable-asset notice instead of failing to reopen.
+ assert.deepEqual(
+ parseLocalStageValue(JSON.parse(JSON.stringify(stage))).objects.find(
+ (object) => object.kind === "gltf",
+ )!.asset,
+ imported.asset,
+ );
+});
+
+/** The projection's save path for a director node, isolated from canvas state. */
+function directorWrite(node: {
+ id: string;
+ title?: string;
+ localStage?: unknown;
+ stills?: { asset?: AssetRef; src?: string; capture?: string }[];
+}) {
+ const source = JSON.parse(
+ readFileSync(
+ new URL("./fixtures/creation-project.json", import.meta.url),
+ "utf8",
+ ),
+ ) as ProjectSnapshot;
+ const client = new CreationClient(source.project.id);
+ client.install(source);
+ const imported: { name: string; kind: string }[] = [];
+ client.importBlob = async (blob, name, kind) => {
+ imported.push({ name, kind });
+ void blob;
+ return {
+ assetId: `imported-${imported.length}`,
+ revision: 1,
+ // Distinct per import so fingerprint-based dedupe stays honest.
+ fingerprint: `sha256:${String(imported.length).padStart(64, "0")}`,
+ kind,
+ };
+ };
+ const projection = new CreationProjection(client);
+ return {
+ imported,
+ document: (projection as unknown as {
+ editorInput: (
+ node: unknown,
+ kind: "director",
+ ) => Promise<{ kind: string; data: Record }>;
+ }).editorInput(
+ {
+ id: node.id,
+ type: "external",
+ position: { x: 0, y: 0 },
+ data: {
+ title: node.title,
+ localStage: node.localStage,
+ stills: node.stills,
+ },
+ },
+ "director",
+ ),
+ };
+}
+
+test("director saves materialize object thumbnail captures as image assets", async () => {
+ const base = stageWithPerson();
+ const stage = parseLocalStageValue({
+ ...base,
+ objects: [
+ {
+ ...base.objects[0]!,
+ thumbnailCapture: "data:image/png;base64,aVBoTkc=",
+ },
+ ],
+ });
+ const write = directorWrite({
+ id: "director-node",
+ title: "Stage board",
+ localStage: stage,
+ });
+ const document = await write.document;
+ const data = document.data as unknown as { objects: readonly unknown[] };
+ const object = data.objects[0] as {
+ thumbnailAsset?: { assetId: string; kind: string };
+ thumbnailCapture?: string;
+ };
+ assert.deepEqual(object.thumbnailAsset, {
+ assetId: "imported-1",
+ revision: 1,
+ fingerprint: `sha256:${"1".padStart(64, "0")}`,
+ kind: "image",
+ });
+ assert.equal(object.thumbnailCapture, undefined);
+ assert.deepEqual(write.imported, [
+ { name: "Stage board-默认人物-thumbnail.png", kind: "image" },
+ ]);
+});
+test("director projection emits director.apply for an existing Director Stage save", async () => {
+ const source = JSON.parse(
+ readFileSync(
+ new URL("./fixtures/creation-project.json", import.meta.url),
+ "utf8",
+ ),
+ ) as ProjectSnapshot;
+ const client = new CreationClient(source.project.id);
+ const projection = new CreationProjection(client);
+ const item = source.canvasItems.find((candidate) => candidate.kind === "external")!;
+ const node = createNode("external");
+ node.id = String(item.id);
+ node.data.title = item.title;
+ node.data.localStage = createLocalStage();
+ const document = await (projection as unknown as {
+ editorInput: (node: unknown, kind: "director") => Promise;
+ }).editorInput(node, "director");
+ const basis = {
+ ...source,
+ canvasItems: [{ ...item, binding: { role: "editor", objectRef: {
+ objectType: "editor_document", id: (document as { id: string }).id, kind: "director",
+ } } }],
+ editorDocuments: [document],
+ } as ProjectSnapshot;
+ client.install(basis);
+ const baseline = createDocument("Director Stage");
+ baseline.id = source.project.id;
+ baseline.nodes = [node];
+ const next = structuredClone(baseline);
+ const nextNode = next.nodes[0]!;
+ const stage = nextNode.data.localStage as { cameras: { name: string }[] };
+ stage.cameras[0]!.name = "Shared command stage";
+ projection.baseline = baseline;
+ projection.basis = basis;
+ const plan = await projection.prepare(next);
+ assert.ok(
+ plan.operations.some(
+ (operation) =>
+ operation.type === "director.apply" &&
+ operation.payload.document.kind === "director",
+ ),
+ );
+ assert.equal(
+ plan.operations.some((operation) => operation.type === "editor.save"),
+ false,
+ );
+});
+
+test("the projection refuses a Director Stage write with a discontinuous Storyboard and leaves an untouched one alone", async () => {
+ // Building the editor.create or director.apply command is the frontend write boundary for
+ // a Director Stage: a discontinuous Storyboard is refused before a command exists, and
+ // the backend validates the same rule again. A stage that is merely on the canvas is not
+ // written, so it never blocks a save of something else.
+ const source = JSON.parse(
+ readFileSync(
+ new URL("./fixtures/creation-project.json", import.meta.url),
+ "utf8",
+ ),
+ ) as ProjectSnapshot;
+ const client = new CreationClient(source.project.id);
+ const projection = new CreationProjection(client);
+ const item = source.canvasItems.find((candidate) => candidate.kind === "external")!;
+ const node = createNode("external");
+ node.id = String(item.id);
+ node.data.title = item.title;
+ node.data.localStage = parseLocalStageValue({
+ ...createLocalStage(),
+ duration: 6,
+ shots: [
+ { id: "a", cameraId: "camera-1", start: 1, duration: 1 },
+ { id: "b", cameraId: "camera-1", start: 4, duration: 1 },
+ ],
+ });
+ const document = await (projection as unknown as {
+ editorInput: (node: unknown, kind: "director") => Promise;
+ }).editorInput(node, "director");
+ const basis = {
+ ...source,
+ canvasItems: [{ ...item, binding: { role: "editor", objectRef: {
+ objectType: "editor_document", id: (document as { id: string }).id, kind: "director",
+ } } }],
+ editorDocuments: [document],
+ } as ProjectSnapshot;
+ client.install(basis);
+ const baseline = createDocument("Director Stage");
+ baseline.id = source.project.id;
+ baseline.nodes = [node];
+ projection.baseline = baseline;
+ projection.basis = basis;
+
+ // Another change on the same canvas: the stored stage is not written, so nothing is refused.
+ const moved = structuredClone(baseline);
+ moved.nodes[0]!.position = { x: 40, y: 0 };
+ const plan = await projection.prepare(moved);
+ const stageWrite = (operation: { type: string }) =>
+ ["director.apply", "editor.create", "editor.save"].includes(operation.type);
+ assert.equal(plan.operations.some(stageWrite), false);
+
+ // Editing that stage produces its write, which is refused with the localized reason.
+ const edited = structuredClone(baseline);
+ const stage = edited.nodes[0]!.data.localStage as { cameras: { name: string }[] };
+ stage.cameras[0]!.name = "Renamed camera";
+ await assert.rejects(
+ projection.prepare(edited),
+ /分镜必须从 0 秒开始|Storyboard must start at 0/,
+ );
+});
+test("director saves register unsaved model bytes and captured stills as project assets", async () => {
+ const base = stageWithPerson();
+ const stage = parseLocalStageValue({
+ ...base,
+ objects: [
+ ...base.objects,
+ {
+ ...base.objects[0]!,
+ id: "walker",
+ kind: "gltf",
+ name: "Walker",
+ role: "character",
+ format: "glb",
+ source: "data:application/octet-stream;base64,R0xGQg==",
+ animationNames: ["Walk"],
+ hasAnimation: true,
+ motionClips: [],
+ },
+ ],
+ });
+ const write = directorWrite({
+ id: "director-node",
+ title: "Stage board",
+ localStage: stage,
+ stills: [
+ { capture: "data:image/png;base64,aVBoTkc=" },
+ { capture: "data:image/png;base64,aVBoTkc1" },
+ ],
+ });
+ const document = await write.document;
+ assert.equal(document.kind, "director");
+ const objects = document.data.objects as {
+ kind: string;
+ asset?: { assetId: string };
+ source?: string;
+ }[];
+ const walker = objects.find((object) => object.kind === "gltf")!;
+ assert.equal(walker.asset?.assetId, "imported-1");
+ // Browser-only preview URLs never reach the contract.
+ assert.equal(walker.source, undefined);
+ // Captures import in list order so the drawer keeps its sequence.
+ assert.deepEqual(
+ (document.data.stills as { assetId: string }[]).map(
+ (still) => still.assetId,
+ ),
+ ["imported-2", "imported-3"],
+ );
+ assert.deepEqual(write.imported, [
+ { name: stageUploadTitle("Walker", "glb"), kind: "file" },
+ { name: "Stage board.png", kind: "image" },
+ { name: "Stage board.png", kind: "image" },
+ ]);
+});
+
+test("director saves keep pinned stills and import only fresh captures", async () => {
+ const still = {
+ assetId: "still-1",
+ revision: 1,
+ fingerprint: `sha256:${"e".repeat(64)}`,
+ kind: "image" as const,
+ };
+ const write = directorWrite({
+ id: "director-node",
+ title: "Stage board",
+ localStage: createLocalStage(),
+ stills: [
+ { asset: still, src: "blob:preview" },
+ { capture: "data:image/png;base64,aVBoTkc=" },
+ ],
+ });
+ const document = await write.document;
+ // View-only media URLs stay out of the contract; the pinned identity and
+ // the fresh capture keep their drawer order.
+ assert.deepEqual(document.data.stills, [
+ still,
+ { assetId: "imported-1", revision: 1, fingerprint: `sha256:${"1".padStart(64, "0")}`, kind: "image" },
+ ]);
+ assert.deepEqual(write.imported, [{ name: "Stage board.png", kind: "image" }]);
+});
+
+test("director saves fail loudly when imported model bytes cannot be read", async () => {
+ const base = stageWithPerson();
+ const stage = parseLocalStageValue({
+ ...base,
+ objects: [
+ {
+ ...base.objects[0]!,
+ id: "walker",
+ kind: "gltf",
+ name: "Walker",
+ role: "character",
+ format: "glb",
+ // A blob URL that died with the page that created it.
+ source: "blob:revoked-session",
+ animationNames: [],
+ hasAnimation: false,
+ motionClips: [],
+ },
+ ],
+ });
+ await assert.rejects(directorWrite({ id: "director-node", localStage: stage }).document);
+});
+
+test("byte-identical captures pin one asset, not duplicates", async () => {
+ const still = {
+ assetId: "still-1",
+ revision: 1,
+ fingerprint: `sha256:${"e".repeat(64)}`,
+ kind: "image" as const,
+ };
+ const capture = "data:image/png;base64,aVBoTkc=";
+ const write = directorWrite({
+ id: "director-node",
+ title: "Stage board",
+ localStage: createLocalStage(),
+ stills: [
+ { asset: still },
+ { capture },
+ // A second capture of the same frame produces the same bytes.
+ { capture },
+ ],
+ });
+ const document = await write.document;
+ assert.deepEqual(document.data.stills, [
+ still,
+ { assetId: "imported-1", revision: 1, fingerprint: `sha256:${"1".padStart(64, "0")}`, kind: "image" },
+ ]);
+ assert.deepEqual(write.imported, [{ name: "Stage board.png", kind: "image" }]);
+});
diff --git a/tests/directorStageViewState.test.ts b/tests/directorStageViewState.test.ts
new file mode 100644
index 000000000..9d6e9b32b
--- /dev/null
+++ b/tests/directorStageViewState.test.ts
@@ -0,0 +1,361 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+import {
+ createDirectorStageViewState,
+ directorStageViewReducer,
+} from "../src/canvas/directorStageViewState.ts";
+
+/** What a stage with one camera opens with: that camera. */
+const CAMERA_1 = { kind: "camera", cameraId: "camera-1" } as const;
+
+function reduce(
+ state: ReturnType,
+ ...actions: Parameters[1][]
+) {
+ return actions.reduce(directorStageViewReducer, state);
+}
+
+test("initial view state contains only ephemeral stage-session concerns", () => {
+ const state = createDirectorStageViewState("person", CAMERA_1);
+
+ assert.deepEqual(state.selection, { kind: "object", objectId: "person" });
+ assert.equal(state.interactionMode.kind, "edit");
+ assert.equal(state.cameraPreview, true);
+ assert.equal(state.previewMode, "static");
+ assert.deepEqual(state.splitView, { kind: "closed", ratio: 0.5 });
+ assert.equal(state.drawerOpen, false);
+ assert.equal(state.helpOpen, false);
+ assert.deepEqual(state.selectedStillIds, new Set());
+ assert.deepEqual(state.exportDialog, {
+ kind: "closed",
+ source: "",
+ clarity: 1280,
+ fps: 30,
+ });
+ assert.deepEqual(state.layout, {
+ leftWidth: 196,
+ rightWidth: 232,
+ timelineHeight: 176,
+ });
+ assert.equal("objects" in state, false);
+ assert.equal("cameras" in state, false);
+ assert.equal("duration" in state, false);
+});
+
+test("viewfinder remains an exclusive interaction mode", () => {
+ const initial = createDirectorStageViewState(null, CAMERA_1);
+ const viewfinder = reduce(initial, { type: "toggleViewfinder" });
+
+ assert.deepEqual(viewfinder.interactionMode, { kind: "viewfinder" });
+ assert.equal(viewfinder.cameraPreview, true);
+ const collapsed = reduce(initial, { type: "toggleCameraPreview" });
+ assert.equal(collapsed.cameraPreview, false);
+ assert.equal(
+ reduce(collapsed, { type: "toggleViewfinder" }, { type: "toggleViewfinder" }).cameraPreview,
+ false,
+ );
+ assert.equal(viewfinder.viewFlags.aspectMask, true);
+ assert.deepEqual(
+ reduce(viewfinder, { type: "toggleViewfinder" }).interactionMode,
+ { kind: "edit" },
+ );
+});
+
+test("placement is a cancellable two-step interaction mode", () => {
+ const initial = createDirectorStageViewState(null, CAMERA_1);
+ const armed = reduce(initial, {
+ type: "armPlacement",
+ objectKind: "person",
+ sourceObjectId: null,
+ });
+
+ assert.deepEqual(armed.interactionMode, {
+ kind: "placement",
+ objectKind: "person",
+ sourceObjectId: null,
+ });
+ const cancelled = reduce(armed, { type: "cancelPlacement" });
+ assert.deepEqual(cancelled.interactionMode, { kind: "edit" });
+ assert.deepEqual(
+ reduce(initial, { type: "cancelPlacement" }),
+ initial,
+ );
+});
+
+test("placement can retain the preview object's source identity", () => {
+ const armed = reduce(createDirectorStageViewState(null, CAMERA_1), {
+ type: "armPlacement",
+ objectKind: "gltf",
+ sourceObjectId: "imported-character",
+ });
+
+ assert.deepEqual(armed.interactionMode, {
+ kind: "placement",
+ objectKind: "gltf",
+ sourceObjectId: "imported-character",
+ });
+});
+test("split view owns its ratio and camera without changing selection", () => {
+ const initial = createDirectorStageViewState("person", CAMERA_1);
+ const split = reduce(initial, {
+ type: "openSplit",
+ cameraId: "camera-2",
+ ratio: 1.2,
+ });
+
+ assert.deepEqual(split.splitView, {
+ kind: "open",
+ cameraId: "camera-2",
+ ratio: 0.8,
+ });
+ assert.deepEqual(split.selection, { kind: "object", objectId: "person" });
+ assert.deepEqual(
+ reduce(split, { type: "setSplitCamera", cameraId: null }).splitView,
+ { kind: "open", cameraId: null, ratio: 0.8 },
+ );
+ assert.deepEqual(
+ reduce(split, { type: "setSplitRatio", ratio: 0.1 }).splitView,
+ { kind: "open", cameraId: "camera-2", ratio: 0.2 },
+ );
+ const closed = reduce(split, { type: "closeSplit" });
+ assert.deepEqual(closed.splitView, { kind: "closed", ratio: 0.8 });
+ assert.deepEqual(
+ reduce(closed, { type: "setSplitRatio", ratio: 0.4 }),
+ { ...closed, splitView: { kind: "closed", ratio: 0.4 } },
+ );
+});
+
+test("view flags, focus, panels, drawer selection, export, and gizmo mode reduce explicitly", () => {
+ const state = reduce(
+ createDirectorStageViewState(null, CAMERA_1),
+ { type: "focusSurface", surface: "drawer" },
+ { type: "toggleViewFlag", flag: "motionPaths" },
+ { type: "setViewFlag", flag: "ground", enabled: false },
+ { type: "toggleViewMenu" },
+ { type: "setLeftTab", tab: "cameras" },
+ { type: "setAssetRole", role: "scene" },
+ { type: "toggleTreeGroup", group: "characters" },
+ { type: "toggleHelp" },
+ { type: "toggleDrawer" },
+ { type: "toggleStillSelection", stillId: "still-1" },
+ { type: "toggleStillSelection", stillId: "still-2" },
+ { type: "setPreviewStill", stillId: "still-1" },
+ { type: "setGizmo", gizmo: "select" },
+ { type: "openExport", source: "camera-1", clarity: 1920, fps: 60 },
+ { type: "setExportSource", source: "storyboard" },
+ { type: "setExportClarity", clarity: 1280 },
+ { type: "setExportFps", fps: 30 },
+ );
+
+ assert.equal(state.focusedSurface, "drawer");
+ assert.equal(state.viewFlags.motionPaths, true);
+ assert.equal(state.viewFlags.ground, false);
+ assert.equal(state.viewMenuOpen, true);
+ assert.equal(state.leftTab, "cameras");
+ assert.equal(state.assetRole, "scene");
+ assert.equal(state.treeGroups.characters, false);
+ assert.equal(state.helpOpen, true);
+ assert.equal(state.drawerOpen, true);
+ assert.deepEqual(state.selectedStillIds, new Set(["still-1", "still-2"]));
+ assert.equal(state.previewStillId, "still-1");
+ assert.equal(state.activeGizmo, "select");
+ assert.deepEqual(state.exportDialog, {
+ kind: "open",
+ source: "storyboard",
+ clarity: 1280,
+ fps: 30,
+ });
+
+ const cleared = reduce(state, { type: "clearStillSelection" });
+ assert.deepEqual(cleared.selectedStillIds, new Set());
+ assert.equal(cleared.previewStillId, null);
+ assert.deepEqual(
+ reduce(cleared, { type: "closeExport" }).exportDialog,
+ {
+ kind: "closed",
+ source: "storyboard",
+ clarity: 1280,
+ fps: 30,
+ },
+ );
+});
+
+test("explicit setters cover the remaining session boundaries", () => {
+ const state = reduce(
+ createDirectorStageViewState(null, CAMERA_1),
+ { type: "selectObject", objectId: "object-1" },
+ { type: "focusSurface", surface: "inspector" },
+ { type: "setCameraPreview", enabled: true },
+ { type: "setViewMenu", open: true },
+ { type: "setTreeGroup", group: "objects", expanded: false },
+ { type: "setHelp", open: true },
+ { type: "setDrawer", open: true },
+ { type: "setPreviewStill", stillId: "still-1" },
+ );
+
+ assert.deepEqual(state.selection, { kind: "object", objectId: "object-1" });
+ assert.equal(state.focusedSurface, "inspector");
+ assert.equal(state.cameraPreview, true);
+ assert.equal(state.viewMenuOpen, true);
+ assert.equal(state.treeGroups.objects, false);
+ assert.equal(state.helpOpen, true);
+ assert.equal(state.drawerOpen, true);
+ assert.equal(state.previewStillId, "still-1");
+});
+
+test("preview mode is ephemeral and preserves the current selection", () => {
+ const initial = createDirectorStageViewState("object-1", CAMERA_1);
+ const dynamic = directorStageViewReducer(initial, {
+ type: "setPreviewMode",
+ mode: "dynamic",
+ });
+
+ assert.equal(dynamic.previewMode, "dynamic");
+ assert.deepEqual(dynamic.selection, { kind: "object", objectId: "object-1" });
+});
+
+test("object and camera selection are mutually exclusive", () => {
+ const initial = createDirectorStageViewState("object-1", CAMERA_1);
+ const camera = directorStageViewReducer(initial, {
+ type: "selectCamera",
+ cameraId: "camera-1",
+ });
+
+ assert.deepEqual(camera.selection, { kind: "camera", cameraId: "camera-1" });
+ assert.deepEqual(
+ directorStageViewReducer(camera, {
+ type: "setGizmo",
+ gizmo: "rotate",
+ }).selection,
+ camera.selection,
+ );
+ assert.deepEqual(
+ directorStageViewReducer(camera, {
+ type: "selectObject",
+ objectId: "object-2",
+ }).selection,
+ { kind: "object", objectId: "object-2" },
+ );
+ assert.equal(
+ directorStageViewReducer(camera, {
+ type: "selectCamera",
+ cameraId: null,
+ }).selection,
+ null,
+ );
+});
+
+test("a Storyboard block is selected on its own, apart from the camera it references", () => {
+ const initial = createDirectorStageViewState(null, CAMERA_1);
+ assert.equal(initial.selectedStoryboardBlockId, null);
+
+ const selected = reduce(
+ initial,
+ { type: "selectCamera", cameraId: "camera-1" },
+ { type: "selectStoryboardBlock", blockId: "block-a" },
+ );
+ assert.equal(selected.selectedStoryboardBlockId, "block-a");
+ // Selecting a block is its own decision: it writes no camera, object or preview choice.
+ assert.deepEqual(selected.selection, { kind: "camera", cameraId: "camera-1" });
+ assert.equal(selected.cameraPreview, initial.cameraPreview);
+ assert.equal(selected.previewMode, "static");
+
+ // Moving between cameras, objects and preview modes leaves the selected block alone.
+ for (const action of [
+ { type: "selectCamera", cameraId: "camera-2" },
+ { type: "selectObject", objectId: "person" },
+ { type: "setPreviewMode", mode: "dynamic" },
+ ] as const) {
+ assert.equal(
+ reduce(selected, action).selectedStoryboardBlockId,
+ "block-a",
+ action.type,
+ );
+ }
+ assert.equal(
+ reduce(selected, { type: "selectStoryboardBlock", blockId: "block-b" })
+ .selectedStoryboardBlockId,
+ "block-b",
+ );
+ assert.equal(
+ reduce(selected, { type: "selectStoryboardBlock", blockId: null })
+ .selectedStoryboardBlockId,
+ null,
+ );
+});
+
+test("layout resizing clamps each surface without changing the others", () => {
+ const initial = createDirectorStageViewState(null, CAMERA_1);
+ const resized = reduce(
+ initial,
+ { type: "setLayoutSize", target: "left", value: 999 },
+ { type: "setLayoutSize", target: "right", value: 1 },
+ { type: "setLayoutSize", target: "timeline", value: Number.NaN },
+ );
+
+ assert.deepEqual(resized.layout, {
+ leftWidth: 420,
+ rightWidth: 220,
+ timelineHeight: 176,
+ });
+ assert.deepEqual(initial.layout, {
+ leftWidth: 196,
+ rightWidth: 232,
+ timelineHeight: 176,
+ });
+});
+
+test("the preview source is view state: choosing one changes that field and nothing else", () => {
+ const pinned = { kind: "camera", cameraId: "camera-2" } as const;
+ const initial = createDirectorStageViewState("person", pinned);
+ assert.deepEqual(initial.previewSource, pinned);
+
+ const storyboard = directorStageViewReducer(initial, {
+ type: "setPreviewSource",
+ source: { kind: "storyboard" },
+ });
+ assert.deepEqual(storyboard.previewSource, { kind: "storyboard" });
+ const { previewSource, ...rest } = storyboard;
+ const { previewSource: before, ...beforeRest } = initial;
+ assert.deepEqual(rest, beforeRest);
+});
+
+test("selecting a block leaves the preview source as it was chosen", () => {
+ const pinned = { kind: "camera", cameraId: "camera-2" } as const;
+ const selected = reduce(
+ createDirectorStageViewState("person", pinned),
+ { type: "selectStoryboardBlock", blockId: "block-a" },
+ { type: "selectCamera", cameraId: "camera-1" },
+ );
+ assert.equal(selected.selectedStoryboardBlockId, "block-a");
+ assert.deepEqual(selected.selection, { kind: "camera", cameraId: "camera-1" });
+ assert.deepEqual(selected.previewSource, pinned);
+ // Choosing the preview source selects and deselects nothing either.
+ const switched = reduce(selected, {
+ type: "setPreviewSource",
+ source: { kind: "storyboard" },
+ });
+ assert.deepEqual(switched.selection, { kind: "camera", cameraId: "camera-1" });
+ assert.equal(switched.selectedStoryboardBlockId, "block-a");
+});
+
+test("no action of the preview puts a document into the view state", () => {
+ const state = reduce(
+ createDirectorStageViewState(null, CAMERA_1),
+ { type: "setPreviewSource", source: { kind: "storyboard" } },
+ { type: "selectStoryboardBlock", blockId: "block-a" },
+ { type: "selectCamera", cameraId: "camera-1" },
+ { type: "setPreviewSource", source: { kind: "camera", cameraId: "camera-2" } },
+ );
+ for (const key of [
+ "objects",
+ "cameras",
+ "shots",
+ "duration",
+ "activeCameraId",
+ "cameraSource",
+ ])
+ assert.equal(key in state, false, key);
+ // A pinned source names a camera by identity and carries nothing of the camera.
+ assert.deepEqual(Object.keys(state.previewSource).sort(), ["cameraId", "kind"]);
+});
diff --git a/tests/fixtures/creation-project.json b/tests/fixtures/creation-project.json
index a040daa0c..fef0207cf 100644
--- a/tests/fixtures/creation-project.json
+++ b/tests/fixtures/creation-project.json
@@ -24,7 +24,9 @@
"frameRate": null,
"hasAudio": null,
"sampleRate": null,
- "channels": null
+ "channels": null,
+ "selfContained": null,
+ "animationNames": null
},
"provenance": {
"source": "upload",
@@ -59,7 +61,9 @@
"frameRate": null,
"hasAudio": null,
"sampleRate": null,
- "channels": null
+ "channels": null,
+ "selfContained": null,
+ "animationNames": null
},
"provenance": {
"source": "upload",
@@ -94,7 +98,9 @@
"frameRate": null,
"hasAudio": null,
"sampleRate": null,
- "channels": null
+ "channels": null,
+ "selfContained": null,
+ "animationNames": null
},
"provenance": {
"source": "upload",
@@ -129,7 +135,9 @@
"frameRate": null,
"hasAudio": null,
"sampleRate": null,
- "channels": null
+ "channels": null,
+ "selfContained": null,
+ "animationNames": null
},
"provenance": {
"source": "upload",
@@ -156,7 +164,7 @@
"fingerprint": "sha256:000000000000000000000000000000000000000000000000000000000000000e",
"path": "assets/00000000-0000-0000-0000-00000000000e",
"metadata": {
- "mimeType": "application/pdf",
+ "mimeType": "model/gltf-binary",
"size": 100,
"width": null,
"height": null,
@@ -164,7 +172,9 @@
"frameRate": null,
"hasAudio": null,
"sampleRate": null,
- "channels": null
+ "channels": null,
+ "selfContained": true,
+ "animationNames": null
},
"provenance": {
"source": "upload",
@@ -199,7 +209,9 @@
"frameRate": null,
"hasAudio": null,
"sampleRate": null,
- "channels": null
+ "channels": null,
+ "selfContained": null,
+ "animationNames": null
},
"provenance": {
"source": "generated",
@@ -798,11 +810,13 @@
"background": "#ffffff",
"grid": true,
"duration": 5.0,
+ "fps": 30,
"aspectRatio": "16:9",
"cameras": [
{
"id": "camera",
"name": "Camera",
+ "aspectRatio": "16:9",
"pose": {
"position": {
"x": 0.0,
@@ -814,7 +828,54 @@
"y": 0.0,
"z": 0.0
},
- "fov": 50.0
+ "fov": 50.0,
+ "roll": 0.0
+ },
+ "channels": {
+ "position": [
+ {
+ "id": "key",
+ "time": 0.0,
+ "value": {
+ "x": 0.0,
+ "y": 1.0,
+ "z": 5.0
+ },
+ "transition": null
+ }
+ ],
+ "target": [
+ {
+ "id": "key",
+ "time": 0.0,
+ "value": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "transition": null
+ }
+ ],
+ "up": [
+ {
+ "id": "key",
+ "time": 0.0,
+ "value": {
+ "x": 0.0,
+ "y": 1.0,
+ "z": 0.0
+ },
+ "transition": null
+ }
+ ],
+ "focalLength": [
+ {
+ "id": "key",
+ "time": 0.0,
+ "value": 50.0,
+ "transition": null
+ }
+ ]
},
"keyframes": [
{
@@ -831,7 +892,8 @@
"y": 0.0,
"z": 0.0
},
- "fov": 50.0
+ "fov": 50.0,
+ "roll": 0.0
}
}
]
@@ -868,6 +930,9 @@
"kind": "person",
"name": "Actor",
"color": "#ff0000",
+ "visible": true,
+ "locked": false,
+ "opacity": 1.0,
"keyframes": [],
"motionClips": [
{
@@ -880,7 +945,81 @@
"amount": 1.0
}
}
- ]
+ ],
+ "asset": null,
+ "role": null,
+ "format": null,
+ "animationNames": [],
+ "hasAnimation": false,
+ "thumbnailAsset": null
+ },
+ {
+ "position": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "rotation": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "scale": {
+ "x": 1.0,
+ "y": 1.0,
+ "z": 1.0
+ },
+ "id": "prop",
+ "kind": "gltf",
+ "name": "Prop",
+ "color": "#b8c5ff",
+ "visible": true,
+ "locked": false,
+ "opacity": 1.0,
+ "keyframes": [],
+ "motionClips": [],
+ "asset": {
+ "assetId": "00000000-0000-0000-0000-00000000000e",
+ "revision": 1,
+ "fingerprint": "sha256:000000000000000000000000000000000000000000000000000000000000000e",
+ "kind": "file"
+ },
+ "role": "scene",
+ "format": "glb",
+ "animationNames": [],
+ "hasAnimation": false,
+ "thumbnailAsset": null
+ }
+ ],
+ "stills": [],
+ "environment": {
+ "preset": "studio",
+ "groundColor": "#181818",
+ "groundVisible": true,
+ "exposure": 1.0,
+ "backgroundAsset": null
+ },
+ "lights": [
+ {
+ "id": "hemisphere",
+ "color": "#ffffff",
+ "intensity": 2.4,
+ "position": { "x": 0.0, "y": 1.0, "z": 0.0 },
+ "castShadow": false
+ },
+ {
+ "id": "key",
+ "color": "#ffffff",
+ "intensity": 3.5,
+ "position": { "x": 5.0, "y": 10.0, "z": 6.0 },
+ "castShadow": true
+ },
+ {
+ "id": "fill",
+ "color": "#ffffff",
+ "intensity": 1.6,
+ "position": { "x": -6.0, "y": 5.0, "z": -5.0 },
+ "castShadow": false
}
]
}
diff --git a/tests/fixtures/director-storyboard.json b/tests/fixtures/director-storyboard.json
new file mode 100644
index 000000000..70e664265
--- /dev/null
+++ b/tests/fixtures/director-storyboard.json
@@ -0,0 +1,323 @@
+{
+ "times": [
+ { "value": 2, "normalized": 2.0 },
+ { "value": 1.2346, "normalized": 1.235 },
+ { "value": 1.2344, "normalized": 1.234 },
+ { "value": 0.0004, "normalized": 0.0 },
+ { "value": 0.0005, "normalized": 0.001 },
+ { "value": 1.0005, "normalized": 1.001 },
+ { "value": 3.0005, "normalized": 3.001 },
+ { "value": 1.2345, "normalized": 1.235 },
+ { "value": 7.0005, "normalized": 7.001 },
+ { "value": 4.0005, "normalized": 4.0 },
+ { "value": 0.30000000000000004, "normalized": 0.3 },
+ { "value": 0.0015, "normalized": 0.002 },
+ { "value": 2.0015, "normalized": 2.002 },
+ { "value": 0.0006, "normalized": 0.001 },
+ { "value": 0.3456, "normalized": 0.346 },
+ { "value": 1.9996, "normalized": 2.0 },
+ { "value": 123.456789, "normalized": 123.457 }
+ ],
+ "tracks": [
+ {
+ "name": "empty track",
+ "duration": 6,
+ "shots": [],
+ "issue": null,
+ "issueIndex": null,
+ "end": 0.0,
+ "canAppend": true,
+ "cannotAppendReason": null,
+ "next": [0.0, 2.0]
+ },
+ {
+ "name": "one block",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 2]],
+ "issue": null,
+ "issueIndex": null,
+ "end": 2.0,
+ "canAppend": true,
+ "cannotAppendReason": null,
+ "next": [2.0, 2.0]
+ },
+ {
+ "name": "same camera reused, ends short of the main duration",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 2], ["b", "camera-1", 2, 1.5]],
+ "issue": null,
+ "issueIndex": null,
+ "end": 3.5,
+ "canAppend": true,
+ "cannotAppendReason": null,
+ "next": [3.5, 2.0]
+ },
+ {
+ "name": "ends exactly on the main duration",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 2], ["b", "camera-1", 2, 2], ["c", "camera-1", 4, 2]],
+ "issue": null,
+ "issueIndex": null,
+ "end": 6.0,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_exhausted",
+ "next": null
+ },
+ {
+ "name": "a one second tail remains",
+ "duration": 5,
+ "shots": [["a", "camera-1", 0, 2], ["b", "camera-1", 2, 2]],
+ "issue": null,
+ "issueIndex": null,
+ "end": 4.0,
+ "canAppend": true,
+ "cannotAppendReason": null,
+ "next": [4.0, 1.0]
+ },
+ {
+ "name": "leading gap",
+ "duration": 6,
+ "shots": [["a", "camera-1", 1, 2]],
+ "issue": "storyboard_leading_gap",
+ "issueIndex": 0,
+ "end": 3.0,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_leading_gap",
+ "next": null
+ },
+ {
+ "name": "internal gap",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 1], ["b", "camera-1", 2, 1]],
+ "issue": "storyboard_internal_gap",
+ "issueIndex": 1,
+ "end": 3.0,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_internal_gap",
+ "next": null
+ },
+ {
+ "name": "overlap",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 2], ["b", "camera-1", 1, 1]],
+ "issue": "storyboard_overlap",
+ "issueIndex": 1,
+ "end": 2.0,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_overlap",
+ "next": null
+ },
+ {
+ "name": "end beyond the main duration",
+ "duration": 5,
+ "shots": [["a", "camera-1", 0, 3], ["b", "camera-1", 3, 3]],
+ "issue": "storyboard_exceeds_duration",
+ "issueIndex": 1,
+ "end": 6.0,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_exceeds_duration",
+ "next": null
+ },
+ {
+ "name": "camera that does not exist",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 1], ["b", "camera-9", 1, 1]],
+ "issue": "storyboard_camera_unknown",
+ "issueIndex": 1,
+ "end": 2.0,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_camera_unknown",
+ "next": null
+ },
+ {
+ "name": "duplicate identity",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 1], ["a", "camera-1", 1, 1]],
+ "issue": "storyboard_block_exists",
+ "issueIndex": 1,
+ "end": 2.0,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_block_exists",
+ "next": null
+ },
+ {
+ "name": "sub-millisecond input is continuous once normalized",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0.0004, 1.2346], ["b", "camera-1", 1.235, 1]],
+ "issue": null,
+ "issueIndex": null,
+ "end": 2.235,
+ "canAppend": true,
+ "cannotAppendReason": null,
+ "next": [2.235, 2.0]
+ },
+ {
+ "name": "sub-millisecond remainder gives a millisecond back",
+ "duration": 4.3456,
+ "shots": [["a", "camera-1", 0, 2], ["b", "camera-1", 2, 2]],
+ "issue": null,
+ "issueIndex": null,
+ "end": 4.0,
+ "canAppend": true,
+ "cannotAppendReason": null,
+ "next": [4.0, 0.345]
+ },
+ {
+ "name": "a millisecond would pass a sub-millisecond main duration",
+ "duration": 2.0006,
+ "shots": [["a", "camera-1", 0, 2]],
+ "issue": null,
+ "issueIndex": null,
+ "end": 2.0,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_exhausted",
+ "next": null
+ },
+ {
+ "name": "less than half a millisecond remains",
+ "duration": 2.0004,
+ "shots": [["a", "camera-1", 0, 2]],
+ "issue": null,
+ "issueIndex": null,
+ "end": 2.0,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_exhausted",
+ "next": null
+ },
+ {
+ "name": "float noise at adjacent boundaries",
+ "duration": 0.30000000000000004,
+ "shots": [["a", "camera-1", 0, 0.1], ["b", "camera-1", 0.1, 0.2]],
+ "issue": null,
+ "issueIndex": null,
+ "end": 0.3,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_exhausted",
+ "next": null
+ },
+ {
+ "name": "unsorted stored order is a leading gap",
+ "duration": 6,
+ "shots": [["b", "camera-1", 2, 1], ["a", "camera-1", 0, 2]],
+ "issue": "storyboard_leading_gap",
+ "issueIndex": 0,
+ "end": 2.0,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_leading_gap",
+ "next": null
+ },
+ {
+ "name": "a sub-millisecond gap is a gap once normalized",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 1], ["b", "camera-1", 1.0006, 1]],
+ "issue": "storyboard_internal_gap",
+ "issueIndex": 1,
+ "end": 2.001,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_internal_gap",
+ "next": null
+ },
+ {
+ "name": "a block that rounds to nothing",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 0.0004]],
+ "issue": "storyboard_duration_invalid",
+ "issueIndex": 0,
+ "end": 0.0,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_duration_invalid",
+ "next": null
+ },
+ {
+ "name": "a sub-millisecond main duration still bounds the end",
+ "duration": 6.0004,
+ "shots": [["a", "camera-1", 0, 3], ["b", "camera-1", 3, 3.0006]],
+ "issue": "storyboard_exceeds_duration",
+ "issueIndex": 1,
+ "end": 6.001,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_exceeds_duration",
+ "next": null
+ },
+ {
+ "name": "a one-millisecond block",
+ "duration": 0.0015,
+ "shots": [],
+ "issue": null,
+ "issueIndex": null,
+ "end": 0.0,
+ "canAppend": true,
+ "cannotAppendReason": null,
+ "next": [0.0, 0.001]
+ },
+ {
+ "name": "a legacy sparse track with sub-millisecond values",
+ "duration": 6,
+ "shots": [["a", "camera-1", 1, 1], ["b", "camera-1", 4, 0.000412]],
+ "issue": "storyboard_leading_gap",
+ "issueIndex": 0,
+ "end": 4.0,
+ "canAppend": false,
+ "cannotAppendReason": "storyboard_leading_gap",
+ "next": null
+ }
+ ],
+ "reorders": [
+ {
+ "name": "carried behind the last block",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 2], ["b", "camera-1", 2, 1], ["c", "camera-1", 3, 2]],
+ "order": ["a", "c", "b"],
+ "laid": [["a", "camera-1", 0, 2], ["c", "camera-1", 2, 2], ["b", "camera-1", 4, 1]],
+ "end": 5
+ },
+ {
+ "name": "carried to the front",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 2], ["b", "camera-1", 2, 1], ["c", "camera-1", 3, 2]],
+ "order": ["c", "b", "a"],
+ "laid": [["c", "camera-1", 0, 2], ["b", "camera-1", 2, 1], ["a", "camera-1", 3, 2]],
+ "end": 5
+ },
+ {
+ "name": "the order it already has",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 2], ["b", "camera-1", 2, 1], ["c", "camera-1", 3, 2]],
+ "order": ["a", "b", "c"],
+ "laid": [["a", "camera-1", 0, 2], ["b", "camera-1", 2, 1], ["c", "camera-1", 3, 2]],
+ "end": 5
+ },
+ {
+ "name": "the last of four carried to the second place",
+ "duration": 10,
+ "shots": [["a", "camera-1", 0, 2], ["b", "camera-1", 2, 1.25], ["c", "camera-1", 3.25, 2], ["d", "camera-1", 5.25, 0.75]],
+ "order": ["a", "d", "b", "c"],
+ "laid": [["a", "camera-1", 0, 2], ["d", "camera-1", 2, 0.75], ["b", "camera-1", 2.75, 1.25], ["c", "camera-1", 4, 2]],
+ "end": 6
+ },
+ {
+ "name": "sub-millisecond lengths, carried to the front",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 1.0005], ["b", "camera-1", 1.001, 1.2346], ["c", "camera-1", 2.236, 0.7654]],
+ "order": ["c", "a", "b"],
+ "laid": [["c", "camera-1", 0, 0.7654], ["a", "camera-1", 0.765, 1.0005], ["b", "camera-1", 1.766, 1.2346]],
+ "end": 3.001
+ },
+ {
+ "name": "a length on a half millisecond, with a block after it",
+ "duration": 6,
+ "shots": [["a", "camera-1", 0, 1.0005], ["b", "camera-1", 1.001, 1.2346], ["c", "camera-1", 2.236, 0.7654]],
+ "order": ["a", "c", "b"],
+ "laid": [["a", "camera-1", 0, 1.0005], ["c", "camera-1", 1.001, 0.7654], ["b", "camera-1", 1.766, 1.2346]],
+ "end": 3.001
+ },
+ {
+ "name": "float noise where two boundaries meet",
+ "duration": 0.30000000000000004,
+ "shots": [["a", "camera-1", 0, 0.1], ["b", "camera-1", 0.1, 0.2]],
+ "order": ["b", "a"],
+ "laid": [["b", "camera-1", 0, 0.2], ["a", "camera-1", 0.2, 0.1]],
+ "end": 0.3
+ }
+ ]
+}
diff --git a/tests/mediaPublication.test.ts b/tests/mediaPublication.test.ts
index 543e437d0..9c2738915 100644
--- a/tests/mediaPublication.test.ts
+++ b/tests/mediaPublication.test.ts
@@ -145,6 +145,53 @@ test("failed output preparation retains successful imports and retries the same
);
});
+test("reloading during output preparation resumes only the unfinished slot", async (t) => {
+ const original = Object.getOwnPropertyDescriptor(
+ globalThis,
+ "sessionStorage",
+ );
+ const saved = new Map();
+ Object.defineProperty(globalThis, "sessionStorage", {
+ configurable: true,
+ value: {
+ getItem: (k: string) => saved.get(k) ?? null,
+ setItem: (k: string, v: string) => saved.set(k, v),
+ removeItem: (k: string) => saved.delete(k),
+ },
+ });
+ t.after(() => {
+ if (original) Object.defineProperty(globalThis, "sessionStorage", original);
+ else Reflect.deleteProperty(globalThis, "sessionStorage");
+ });
+ const { client, snapshot, item } = setup(t);
+ t.mock.restoreAll();
+ const handles: string[] = [];
+ const reference = assetReference(
+ snapshot.assets.find((candidate) => candidate.kind === "image")!,
+ );
+ client.importBlob = async (_blob, _name, _kind, handle) => {
+ handles.push(handle!);
+ if (handles.length === 2) throw Error("lost import reply");
+ return { ...reference, assetId: crypto.randomUUID() };
+ };
+ const outputs = [...output, { ...output[0], title: "Second" }];
+ const first = new MediaPublication(client, snapshot, item.id);
+ await assert.rejects(first.publish(outputs), /lost import reply/);
+ assert.equal(saved.size, 1);
+
+ const calls: unknown[][] = [];
+ client.command = async (...args) => {
+ calls.push(structuredClone(args));
+ return { status: "applied" } as CommandReceipt;
+ };
+ const reopened = new MediaPublication(client, snapshot, item.id);
+ await reopened.publish(outputs);
+ assert.equal(handles.length, 3, "the completed first slot is not uploaded again");
+ assert.equal(handles[1], handles[2], "the unfinished slot keeps its handle");
+ assert.equal((calls[0]![1] as { outputs: unknown[] }).outputs.length, 2);
+ assert.equal(saved.size, 0);
+});
+
test("new local results retain normal node dimensions and avoid earlier published results", async (t) => {
const { client, snapshot, item } = setup(t);
const occupied = {
@@ -206,3 +253,43 @@ test("reopening a refused publication reuses prepared assets instead of importin
assert.notEqual(calls[0]![4], calls[1]![4]);
assert.equal(saved.size, 0);
});
+test("a director stage publication freezes the director document as its source", async (t) => {
+ const snapshot = JSON.parse(
+ readFileSync(
+ new URL("./fixtures/creation-project.json", import.meta.url),
+ "utf8",
+ ),
+ ) as ProjectSnapshot;
+ const document = snapshot.editorDocuments.find(
+ (candidate) => candidate.kind === "director",
+ )!;
+ const item = snapshot.canvasItems.find(
+ (candidate) => candidate.kind === "external",
+ )!;
+ const client = new CreationClient(snapshot.project.id);
+ client.install(snapshot);
+ t.mock.method(CreationProjection.prototype, "importResource", async () => ({
+ ...assetReference(
+ snapshot.assets.find((asset) => asset.kind === "image")!,
+ ),
+ assetId: crypto.randomUUID(),
+ }));
+ const calls: unknown[][] = [];
+ client.command = async (...args) => {
+ calls.push(structuredClone(args));
+ return { status: "applied" } as CommandReceipt;
+ };
+ const publication = new MediaPublication(client, snapshot, item.id);
+ const ids = await publication.publish(output);
+ assert.equal(ids.length, 1);
+ const payload = calls[0]![1]! as {
+ source: unknown;
+ sourceEditorId: string;
+ document: { id: string; kind: string; data: typeof document.data };
+ };
+ assert.equal(payload.source, null);
+ assert.equal(payload.sourceEditorId, document.id);
+ assert.equal(payload.document.kind, "director");
+ assert.notEqual(payload.document.id, document.id);
+ assert.deepEqual(payload.document.data, document.data);
+});
diff --git a/tests/stageElevation.test.ts b/tests/stageElevation.test.ts
new file mode 100644
index 000000000..8bd4c2122
--- /dev/null
+++ b/tests/stageElevation.test.ts
@@ -0,0 +1,292 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+import * as THREE from "three";
+import {
+ formatStageElevation,
+ layoutStageElevation,
+ stageElevationHeight,
+ stageElevationRingPath,
+ stageElevationRingRadius,
+ stageElevationScreenPoint,
+ STAGE_ELEVATION_MIN,
+ STAGE_ELEVATION_RING_DIAMETER,
+} from "../src/canvas/stageElevation.ts";
+import {
+ groundObject,
+ groundedPositionY,
+} from "../src/canvas/stageGrounding.ts";
+
+const label = { width: 40, height: 14 };
+const viewport = { width: 800, height: 600 };
+
+test("a subject shows its height only while it stands above the ground", () => {
+ assert.equal(stageElevationHeight(1.31), 1.31);
+ assert.equal(stageElevationHeight(STAGE_ELEVATION_MIN), STAGE_ELEVATION_MIN);
+ // On the ground, the noise a grounding leaves, and below it: no readout.
+ assert.equal(stageElevationHeight(0), null);
+ assert.equal(stageElevationHeight(1e-12), null);
+ assert.equal(stageElevationHeight(-0.5), null);
+ assert.equal(stageElevationHeight(Number.NaN), null);
+ assert.equal(stageElevationHeight(Number.POSITIVE_INFINITY), null);
+ // The ground is the business plane, not wherever the mesh was drawn.
+ assert.equal(stageElevationHeight(2.5, 1), 1.5);
+ assert.equal(stageElevationHeight(1.5, 1), 0.5);
+});
+
+test("the readout agrees with drop-to-ground on what counts as lifted", () => {
+ const object = new THREE.Group();
+ const mesh = new THREE.Mesh(
+ new THREE.BoxGeometry(1, 2, 1),
+ new THREE.MeshBasicMaterial(),
+ );
+ // The model's origin sits 0.4 below its lowest point.
+ mesh.position.y = 1.4;
+ object.add(mesh);
+
+ object.position.y = 1.31 - 0.4;
+ const lifted = new THREE.Box3().setFromObject(object);
+ assert.equal(stageElevationHeight(lifted.min.y), 1.31);
+
+ // However the subject is turned or scaled, a grounded one reads nothing and
+ // the one drop-to-ground leaves behind reads nothing either.
+ object.rotation.z = 0.6;
+ object.scale.set(1.5, 0.75, 2);
+ object.updateMatrixWorld(true);
+ const turned = new THREE.Box3().setFromObject(object);
+ assert.notEqual(stageElevationHeight(turned.min.y), null);
+ groundObject(object);
+ const dropped = new THREE.Box3().setFromObject(object);
+ assert.equal(stageElevationHeight(dropped.min.y), null);
+
+ // The asset cards place a subject through this same function.
+ object.position.y = groundedPositionY(object, 0);
+ const placed = new THREE.Box3().setFromObject(object);
+ assert.equal(stageElevationHeight(placed.min.y), null);
+});
+
+test("the value keeps two decimals like the position fields", () => {
+ assert.equal(formatStageElevation(1.31), "1.31");
+ assert.equal(formatStageElevation(1.3), "1.30");
+ assert.equal(formatStageElevation(12), "12.00");
+});
+
+test("a long line frames its value in a gap at the middle", () => {
+ const foot = { x: 100, y: 400 };
+ const bottom = { x: 100, y: 100 };
+ const layout = layoutStageElevation(foot, bottom, label, viewport);
+ // 14 of value and 3 of air above and below it.
+ assert.deepEqual(layout.segments, [
+ [
+ { x: 100, y: 400 },
+ { x: 100, y: 260 },
+ ],
+ [
+ { x: 100, y: 240 },
+ { x: 100, y: 100 },
+ ],
+ ]);
+ assert.deepEqual(layout.label, { x: 80, y: 243 });
+});
+
+test("the gap follows a slanted line", () => {
+ // A view from the side puts the landing point beside, not under, the subject.
+ const foot = { x: 0, y: 300 };
+ const bottom = { x: 300, y: 0 };
+ const { segments, label: value } = layoutStageElevation(
+ foot,
+ bottom,
+ label,
+ viewport,
+ );
+ const along = (from: typeof foot, to: typeof foot) =>
+ Math.hypot(to.x - from.x, to.y - from.y);
+ // The whole line is 300 * sqrt(2) long and the gap takes 20 of it.
+ assert.ok(
+ Math.abs(along(foot, segments[0][1]) - (150 * Math.SQRT2 - 10)) < 1e-9,
+ );
+ assert.ok(
+ Math.abs(along(segments[1][0], bottom) - (150 * Math.SQRT2 - 10)) < 1e-9,
+ );
+ assert.ok(Math.abs(along(segments[0][1], segments[1][0]) - 20) < 1e-9);
+ assert.ok(Math.abs(value.x + label.width / 2 - 150) < 1e-9);
+ assert.ok(Math.abs(value.y + label.height / 2 - 150) < 1e-9);
+});
+
+test("a short line stands its value beside it", () => {
+ // 30 pixels cannot hold 20 of value and still read as a line on both sides.
+ const foot = { x: 200, y: 315 };
+ const bottom = { x: 200, y: 285 };
+ const layout = layoutStageElevation(foot, bottom, label, viewport);
+ assert.deepEqual(layout.segments, [[foot, bottom]]);
+ // Six pixels to the right of the line, centred on its middle.
+ assert.deepEqual(layout.label, { x: 206, y: 293 });
+});
+
+test("a value with no room on the right stands on the left", () => {
+ const foot = { x: 790, y: 315 };
+ const bottom = { x: 790, y: 285 };
+ const layout = layoutStageElevation(foot, bottom, label, viewport);
+ assert.deepEqual(layout.label, { x: 790 - 6 - 40, y: 293 });
+});
+
+test("a value with no room on either side stays on the right", () => {
+ const narrow = { width: 20, height: 600 };
+ const foot = { x: 10, y: 315 };
+ const bottom = { x: 10, y: 285 };
+ const layout = layoutStageElevation(foot, bottom, label, narrow);
+ assert.deepEqual(layout.label, { x: 16, y: 293 });
+});
+
+test("a long line whose value would cross an edge stands it beside instead", () => {
+ const foot = { x: 10, y: 400 };
+ const bottom = { x: 10, y: 100 };
+ const { segments, label: value } = layoutStageElevation(
+ foot,
+ bottom,
+ label,
+ viewport,
+ );
+ assert.deepEqual(segments, [[foot, bottom]]);
+ // The left half of a centred value would be off screen.
+ assert.deepEqual(value, { x: 16, y: 243 });
+});
+
+test("a line of no length has no geometry that is not a number", () => {
+ const point = { x: 50, y: 50 };
+ const layout = layoutStageElevation(point, point, label, viewport);
+ for (const [from, to] of layout.segments)
+ for (const coordinate of [from.x, from.y, to.x, to.y])
+ assert.ok(Number.isFinite(coordinate));
+ assert.ok(Number.isFinite(layout.label.x));
+ assert.ok(Number.isFinite(layout.label.y));
+});
+
+test("the ring keeps one screen diameter however far the camera stands", () => {
+ const camera = new THREE.PerspectiveCamera(45, 800 / 600, 0.05, 1000);
+ const viewportHeight = 600;
+ for (const distance of [2, 9, 40]) {
+ camera.position.set(0, distance * 0.35, distance);
+ camera.lookAt(0, 0, 0);
+ camera.updateMatrixWorld();
+ const depth = -new THREE.Vector3().applyMatrix4(camera.matrixWorldInverse)
+ .z;
+ const radius = stageElevationRingRadius(depth, camera.fov, viewportHeight);
+ // The ring's east and west points lie across the view axis at one depth,
+ // so perspective leaves their on-screen span exactly the diameter.
+ const west = new THREE.Vector3(-radius, 0, 0).project(camera).x;
+ const east = new THREE.Vector3(radius, 0, 0).project(camera).x;
+ assert.ok(
+ Math.abs((east - west) * 400 - STAGE_ELEVATION_RING_DIAMETER) < 1e-9,
+ `${distance} m`,
+ );
+ }
+ assert.equal(stageElevationRingRadius(0, 45, 600), 0);
+ assert.equal(stageElevationRingRadius(-3, 45, 600), 0);
+ assert.equal(stageElevationRingRadius(9, 45, 0), 0);
+});
+
+test("the ring is a closed circle on the ground plane", () => {
+ const centre = new THREE.Vector3(3, 0, -2);
+ const radius = 8;
+ // Seen from straight above, the ground plane is the screen.
+ const path = stageElevationRingPath(centre, radius, (point) => ({
+ x: point.x,
+ y: point.z,
+ }));
+ assert.ok(path.endsWith("Z"), path);
+ // The circle lies on the ground at the centre's own height and starts on
+ // its east side.
+ assert.ok(
+ path.startsWith(
+ `M${(centre.x + radius).toFixed(1)} ${centre.z.toFixed(1)}L`,
+ ),
+ path,
+ );
+ const points = path
+ .slice(1, -1)
+ .split("L")
+ .map((step) => {
+ const [x, y] = step.split(" ").map(Number);
+ assert.ok(Number.isFinite(x) && Number.isFinite(y), step);
+ return { x, y };
+ });
+ // Forty points to a ring a few pixels wide leave no corner showing.
+ assert.equal(points.length, 40);
+ for (const { x, y } of points)
+ // Each coordinate is kept to a tenth of a pixel.
+ assert.ok(Math.abs(Math.hypot(x - centre.x, y - centre.z) - radius) < 0.08);
+ assert.deepEqual(centre, new THREE.Vector3(3, 0, -2));
+});
+
+test("a ring the camera stands inside is not drawn", () => {
+ let projected = 0;
+ const path = stageElevationRingPath(new THREE.Vector3(), 1, () =>
+ (projected += 17) === 17 ? { x: 0, y: 0 } : null,
+ );
+ assert.equal(path, "");
+});
+
+test("a point behind the camera has no place on screen", () => {
+ const camera = new THREE.PerspectiveCamera(45, 16 / 9, 0.05, 1000);
+ camera.position.set(5, 3.5, 7);
+ camera.lookAt(0, 1, 0);
+ camera.updateMatrixWorld();
+ const viewportWidth = 1600;
+ const viewportHeight = 900;
+ // Normalised device coordinates to viewport pixels, as the viewport does it.
+ const toViewport = (ndc: { x: number; y: number }) => ({
+ x: ((ndc.x + 1) / 2) * viewportWidth,
+ y: ((1 - ndc.y) / 2) * viewportHeight,
+ });
+ const world = new THREE.Vector3(0, 0, 0);
+
+ const ground = stageElevationScreenPoint(world, camera, toViewport);
+ assert.ok(ground);
+ const expected = world.clone().project(camera);
+ assert.ok(Math.abs(ground.x - ((expected.x + 1) / 2) * viewportWidth) < 1e-9);
+ assert.ok(
+ Math.abs(ground.y - ((1 - expected.y) / 2) * viewportHeight) < 1e-9,
+ );
+ // Depth runs along the view axis, which meets (0, 1, 0), not the origin.
+ assert.ok(Math.abs(ground.depth - 82.75 / Math.sqrt(80.25)) < 1e-9);
+ // The world point stays a world point: the caller draws more from it.
+ assert.deepEqual(world, new THREE.Vector3(0, 0, 0));
+
+ // Behind the camera a projection does not leave the frame: a point on the
+ // view axis lands in its very centre, mirrored, which is why the depth is
+ // checked before any projection.
+ const behind = camera.position
+ .clone()
+ .addScaledVector(camera.getWorldDirection(new THREE.Vector3()), -3);
+ const mirrored = behind.clone().project(camera);
+ assert.ok(Math.abs(mirrored.x) < 1e-9 && Math.abs(mirrored.y) < 1e-9);
+ assert.equal(stageElevationScreenPoint(behind, camera, toViewport), null);
+ assert.equal(
+ stageElevationScreenPoint(camera.position.clone(), camera, toViewport),
+ null,
+ );
+});
+
+test("the projection follows a camera that moved since its last update", () => {
+ const camera = new THREE.PerspectiveCamera(45, 16 / 9, 0.05, 1000);
+ camera.position.set(5, 3.5, 7);
+ camera.lookAt(0, 1, 0);
+ camera.updateMatrixWorld();
+ const toViewport = (ndc: { x: number; y: number }) => ndc;
+ const world = new THREE.Vector3(0, 0, 0);
+ const before = stageElevationScreenPoint(world, camera, toViewport);
+ assert.ok(before);
+ assert.ok(Math.abs(before.depth - 82.75 / Math.sqrt(80.25)) < 1e-9);
+
+ // OrbitControls moves the camera between frames. lookAt refreshes the
+ // camera's matrices before it turns the camera, so the inverse it leaves
+ // behind still holds the direction the camera had before the turn.
+ camera.position.set(-2, 3.5, 12);
+ camera.lookAt(0, 1, 0);
+ const stale = stageElevationScreenPoint(world, camera, toViewport);
+ camera.updateMatrixWorld();
+ const moved = stageElevationScreenPoint(world, camera, toViewport);
+ assert.ok(stale && moved);
+ assert.ok(Math.abs(moved.depth - 156.75 / Math.sqrt(154.25)) < 1e-9);
+ assert.notEqual(stale.depth, moved.depth);
+});
diff --git a/tests/stageEnvironment.test.ts b/tests/stageEnvironment.test.ts
new file mode 100644
index 000000000..6b222cbfe
--- /dev/null
+++ b/tests/stageEnvironment.test.ts
@@ -0,0 +1,66 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+import { createLocalStage } from "../src/canvas/stageDocument.ts";
+import {
+ projectStageEnvironment,
+ STAGE_ENVIRONMENT_PRESETS,
+ STAGE_GROUND_NAME,
+ STAGE_GRID_NAME,
+ STAGE_LIGHT_NAMES,
+} from "../src/canvas/stageEnvironment.ts";
+
+test("environment preset catalog is bounded and uses valid ordinary values", () => {
+ assert.deepEqual(STAGE_ENVIRONMENT_PRESETS.map((preset) => preset.preset), ["studio", "warm-sunset", "moonlit"]);
+ for (const preset of STAGE_ENVIRONMENT_PRESETS) {
+ assert.match(preset.background, /^#[0-9a-f]{6}$/i);
+ assert.match(preset.groundColor, /^#[0-9a-f]{6}$/i);
+ assert.ok(preset.exposure >= 0 && preset.exposure <= 4);
+ assert.deepEqual(Object.keys(preset.lights).sort(), ["fill", "hemisphere", "key"]);
+ }
+});
+
+test("projects persisted environment facts into deterministic scene roles", () => {
+ const stage = createLocalStage();
+ stage.background = "#102030";
+ stage.environment = {
+ preset: "studio",
+ groundColor: "#405060",
+ groundVisible: false,
+ exposure: 2.25,
+ backgroundAsset: null,
+ };
+ stage.lights = [...stage.lights].reverse().map((light) =>
+ light.id === "key"
+ ? { ...light, color: "#ffccaa", intensity: 4, position: { x: 1, y: 2, z: 3 }, castShadow: false }
+ : light,
+ );
+
+ const descriptor = projectStageEnvironment(stage);
+
+ assert.equal(descriptor.backgroundColor, "#102030");
+ assert.equal(descriptor.backgroundAsset, null);
+ assert.equal(descriptor.exposure, 2.25);
+ assert.deepEqual(descriptor.ground, { color: "#405060", visible: false });
+ assert.deepEqual(descriptor.lights.key, {
+ id: "key",
+ color: "#ffccaa",
+ intensity: 4,
+ position: { x: 1, y: 2, z: 3 },
+ castShadow: false,
+ });
+ assert.deepEqual(Object.keys(descriptor.lights).sort(), ["fill", "hemisphere", "key"]);
+ assert.equal(STAGE_GROUND_NAME, "stage-ground");
+ assert.equal(STAGE_GRID_NAME, "stage-grid");
+ assert.deepEqual(STAGE_LIGHT_NAMES, {
+ hemisphere: "stage-light-hemisphere",
+ key: "stage-light-key",
+ fill: "stage-light-fill",
+ });
+});
+
+test("projection copies vector data instead of retaining persisted references", () => {
+ const stage = createLocalStage();
+ const descriptor = projectStageEnvironment(stage);
+ stage.lights[0]!.position.x = 99;
+ assert.equal(descriptor.lights.hemisphere.position.x, 0);
+});
diff --git a/tests/stageGroundFade.test.ts b/tests/stageGroundFade.test.ts
new file mode 100644
index 000000000..735093f96
--- /dev/null
+++ b/tests/stageGroundFade.test.ts
@@ -0,0 +1,84 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+import * as THREE from "three";
+import {
+ patchStageGroundFragmentShader,
+ STAGE_GROUND_FADE_END,
+ STAGE_GROUND_FADE_START,
+ updateStageGroundFade,
+} from "../src/canvas/stageGroundFade.ts";
+
+test("ground fade is injected before tone mapping", () => {
+ const patched = patchStageGroundFragmentShader(
+ "void main() {\n#include