Skip to content

The VS Code of video editing, built for agents.

TypeScript

Refactor asset management and enhance inspector functionality

konstantin-paulusa498cb2192cf
diff --git a/apps/web/src/components/sidebar-left/asset-item.tsx b/apps/web/src/components/sidebar-left/asset-item.tsx
index 82be83b9..4dd24361 100644
--- a/apps/web/src/components/sidebar-left/asset-item.tsx
+++ b/apps/web/src/components/sidebar-left/asset-item.tsx
@@ -6,7 +6,7 @@ import { createSignal, onMount, onCleanup, Show, createMemo } from "solid-js";
import { toast } from "somoto";
import { useWorld } from "@diffusionstudio/koota-solid";
import { assetName } from "@diffusionstudio/assets";
-import { pickFiles, saveAssetAs } from "@/engine/asset-actions";
+import { insertAssetAtPlayhead, replaceAssetSource, saveAssetAs } from "@/engine/asset-actions";
import {
ContextMenu,
ContextMenuContent,
@@ -19,7 +19,6 @@ import {
import { AssetThumbnail } from "../ui/asset-thumbnail";
import { formatAssetDuration } from "@/utils";
import { useLibrary } from "@/engine/library";
-import { insertAsset } from "@/engine/insert-asset";
import { ASSET_DRAG_TYPE } from "./folder-item";
import type { Asset } from "@diffusionstudio/assets";
@@ -94,25 +93,13 @@ export function LazyAssetItem(props: LazyAssetItemProps) {
});
};
- /** Points the asset at another file; the JSX keeps naming it by path. */
const handleReplaceMedia = async () => {
const lib = library();
- const [file] = await pickFiles({ multiple: false });
- const path = file && lib ? lib.fs.pathOf?.(file) : null;
- if (!lib || !path) return;
- try {
- await lib.relink(props.asset, path);
- } catch (e) {
- toast.error("Failed to replace", { description: (e as Error).message });
- }
+ if (lib) await replaceAssetSource(lib, props.asset);
};
const handleSaveAs = () => saveAssetAs(props.asset);
- const handleInsertToTimeline = () => {
- if (!insertAsset(world, props.asset)) {
- toast("Nothing to insert into", { description: "Open a project first." });
- }
- };
+ const handleInsertToTimeline = () => insertAssetAtPlayhead(world, props.asset);
return (
<ContextMenu>
diff --git a/apps/web/src/components/sidebar-left/assets.tsx b/apps/web/src/components/sidebar-left/assets.tsx
index 60af0026..f62a2fb4 100644
--- a/apps/web/src/components/sidebar-left/assets.tsx
+++ b/apps/web/src/components/sidebar-left/assets.tsx
@@ -29,6 +29,7 @@ import {
import { LazyAssetItem } from "./asset-item";
import { FolderItem, handleFolderDrop, isAssetOrFolderDrag, ASSET_DRAG_TYPE, FOLDER_DRAG_TYPE } from "./folder-item";
import { useLibrary } from "@/engine/library";
+import { useAssetSelection } from "@/engine/hooks";
import { droppedFiles, importFiles, pickAndImport } from "@/engine/asset-actions";
import type { AssetLibrary } from "@diffusionstudio/assets";
@@ -45,12 +46,12 @@ export function Assets() {
let dragCounter = 0;
const library = useLibrary();
+ const { id: selectedAssetId, select: setSelectedAssetId } = useAssetSelection();
const { openPromptInput } = usePromptInput();
const [query, setQuery] = createSignal("");
const [assetFilter, setAssetFilter] = createSignal<AssetFilter>("ALL");
const [isDragging, setIsDragging] = createSignal(false);
const [renamingFolder, setRenamingFolder] = createSignal<string | null>(null);
- const [selectedAssetId, setSelectedAssetId] = createSignal<string | null>(null);
const [currentFolder, setCurrentFolder] = createSignal("");
const allAssets = createMemo(() => library()?.list().filter((asset) => asset.type !== "SCRIPT") ?? []);
@@ -120,11 +121,6 @@ export function Assets() {
setCurrentFolder(folder);
});
- createEffect(() => {
- const selected = selectedAssetId();
- if (selected && !library()?.get(selected)) setSelectedAssetId(null);
- });
-
const withLibrary = (run: (library: AssetLibrary) => void | Promise<void>) => {
const lib = library();
if (!lib) {
diff --git a/apps/web/src/components/sidebar-right/inspector/asset-info-preview.tsx b/apps/web/src/components/sidebar-right/inspector/asset-info-preview.tsx
index 1ae1b10a..f9b73f2e 100644
--- a/apps/web/src/components/sidebar-right/inspector/asset-info-preview.tsx
+++ b/apps/web/src/components/sidebar-right/inspector/asset-info-preview.tsx
@@ -8,21 +8,23 @@ import { Button } from "@/components/ui/button";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { Icon } from "@/components/ui/icon";
import { formatDuration } from "@/utils/formatters";
-import { getAudioPeaksAsync } from "@/components/engine/decoders/audio-peaks";
-import { useEngine } from "@/context/engine";
-import { assetsVersion, getAssetFile } from "@/components/engine";
+import { getAssetFile } from "@diffusionstudio/runtime";
+import { derivePeaks, assetName } from "@diffusionstudio/assets";
+import { useLibrary } from "@/engine/library";
-import type { Asset, AudioAsset, VideoAsset } from '@/components/engine/db';
+import type { Asset } from '@diffusionstudio/assets';
-type VisualAsset = Extract<Asset, { type: 'IMAGE' | 'VIDEO' }>;
+type VisualAsset = Extract<Asset, { type: 'IMAGE' | 'VIDEO' | 'SEQUENCE' }>;
+
+const keyOf = (asset: Asset): string => `${asset.id}:${asset.stat?.mtime ?? ''}`;
export function AssetInfoPreview(props: { asset: Asset }) {
- const engine = useEngine();
+ const library = useLibrary();
let mediaRef: HTMLMediaElement | undefined;
let prevObjectUrl: string | undefined;
const [objectUrl] = createResource(
- () => `${props.asset.id}:${assetsVersion(engine.world)}`,
+ () => keyOf(props.asset),
async () => {
if (prevObjectUrl) {
URL.revokeObjectURL(prevObjectUrl);
@@ -40,23 +42,25 @@ export function AssetInfoPreview(props: { asset: Asset }) {
);
const [peaks] = createResource(
- () => props.asset.type === 'AUDIO'
- ? `${props.asset.id}:${assetsVersion(engine.world)}`
- : null,
- () => getAudioPeaksAsync(props.asset as AudioAsset | VideoAsset),
+ () => props.asset.type === 'AUDIO' ? keyOf(props.asset) : null,
+ async () => {
+ const cache = library()?.cache;
+ if (cache) return cache.peaks(props.asset);
+ return derivePeaks(await getAssetFile(props.asset));
+ },
);
const [duration, setDuration] = createSignal(0);
const [currentTime, setCurrentTime] = createSignal(0);
const [playing, setPlaying] = createSignal(false);
- const isImage = createMemo(() => props.asset.type === 'IMAGE');
+ const isImage = createMemo(() => props.asset.type === 'IMAGE' || props.asset.type === 'SEQUENCE');
const isVideo = createMemo(() => props.asset.type === 'VIDEO');
const isAudio = createMemo(() => props.asset.type === 'AUDIO');
const isTranscript = createMemo(() => props.asset.type === 'TRANSCRIPT');
const canPlay = createMemo(() => isVideo() || isAudio());
- const showProgress = createMemo(() => props.asset.type !== 'IMAGE' && !isTranscript());
+ const showProgress = createMemo(() => canPlay());
const progress = createMemo(() => {
const mediaDuration = duration();
@@ -169,7 +173,7 @@ export function AssetInfoPreview(props: { asset: Asset }) {
/>
</Show>
<Show when={isImage()}>
- <img class="size-full object-cover" src={url()} alt={props.asset.name} />
+ <img class="size-full object-cover" src={url()} alt={assetName(props.asset)} />
</Show>
</>
)}
diff --git a/apps/web/src/components/sidebar-right/inspector/asset-info.tsx b/apps/web/src/components/sidebar-right/inspector/asset-info.tsx
index 3cbbe954..21f177c6 100644
--- a/apps/web/src/components/sidebar-right/inspector/asset-info.tsx
+++ b/apps/web/src/components/sidebar-right/inspector/asset-info.tsx
@@ -15,43 +15,44 @@ import {
import { AssetInfoPreview } from "./asset-info-preview";
import { supabase } from "@/lib/supabase";
import { toClientConfig } from "@/components/genai/use-generation-records";
-import { insertAssetInTimeline, replaceAssetHandle, useAssets } from "@/components/engine";
-import { useEngine } from "@/context/engine";
-
-import type { Asset } from "@/components/engine/db";
+import { useWorld } from "@diffusionstudio/koota-solid";
+import { assetName } from "@diffusionstudio/assets";
+import { useLibrary } from "@/engine/library";
+import { useAssetSelection } from "@/engine/hooks";
+import { insertAssetAtPlayhead, replaceAssetSource } from "@/engine/asset-actions";
+import type { Asset } from "@diffusionstudio/assets";
+/** Information about the library asset picked in the assets panel. */
export function AssetInfoPanel() {
- const { world } = useEngine();
- const assets = useAssets(world);
+ const world = useWorld();
+ const library = useLibrary();
+ const selection = useAssetSelection();
const [nameExpanded, setNameExpanded] = createSignal(false);
- const selectedAsset = () => assets.selected().values().next().value;
-
- const handleReplace = () => {
- const asset = selectedAsset();
- if (!asset) return;
- replaceAssetHandle(world, asset);
+ const handleReplace = async () => {
+ const lib = library();
+ const asset = selection.asset();
+ if (!lib || !asset) return;
+ // A relink mints a new id; keep the panel on the asset.
+ const next = await replaceAssetSource(lib, asset);
+ if (next) selection.select(next);
};
const handleInsert = () => {
- const asset = selectedAsset();
- if (!asset) return;
- insertAssetInTimeline(world, asset, 'playhead');
+ const asset = selection.asset();
+ if (asset) insertAssetAtPlayhead(world, asset);
};
- const metadataRows = useAssetMetadataRows(selectedAsset);
+ const metadataRows = useAssetMetadataRows(selection.asset);
return (
<div class="flex flex-col w-full px-4 border-t border-border">
<div class="h-12 flex items-center justify-between">
<span class="text-base font-strong">Information</span>
- {/* <Button class="text-muted-foreground" size="icon" variant="ghost">
- <Icon name="more-three-dots-small" />
- </Button> */}
</div>
- <Show when={selectedAsset()}>
+ <Show when={selection.asset()}>
{asset => <AssetInfoPreview asset={asset()} />}
</Show>
@@ -76,7 +77,7 @@ export function AssetInfoPanel() {
"break-all": nameExpanded(),
}}
>
- {selectedAsset()?.name ?? 'Untitled'}
+ {selection.asset() ? assetName(selection.asset()!) : 'Untitled'}
</span>
</button>
<div class="flex flex-col gap-1 my-2">
@@ -98,7 +99,7 @@ export function AssetInfoPanel() {
<span class="w-20 shrink-0 overflow-hidden text-ellipsis whitespace-nowrap">
{row.label}
</span>
- <span class="min-w-0 flex-1 text-right overflow-hidden text-ellipsis whitespace-nowrap">
+ <span class="min-w-0 flex-1 text-right overflow-hidden text-ellipsis whitespace-nowrap" title={row.value ?? undefined}>
{row.value}
</span>
</div>
@@ -112,7 +113,7 @@ export function AssetInfoPanel() {
}
export function useAssetMetadataRows(asset: Accessor<Asset | undefined>) {
- const generationId = createMemo(() => asset()?.generationId ?? null);
+ const generationId = createMemo(() => asset()?.generation?.id ?? null);
const [config] = createResource(() => generationId(), async (id) => {
if (!id || !supabase) return undefined;
@@ -132,31 +133,25 @@ export function useAssetMetadataRows(asset: Accessor<Asset | undefined>) {
const a = asset();
if (!a) return [];
- const dimensions =
- a.type === "IMAGE" || a.type === "VIDEO"
- ? `${a.width}\u00D7${a.height}`
- : null;
- const resolution = a.type === "VIDEO" ? `${a.height}p` : null;
- const aspectRatio =
- a.type === "IMAGE" || a.type === "VIDEO"
- ? formatAspectRatio(a.width, a.height)
- : null;
+ const visual = a.type === "IMAGE" || a.type === "VIDEO" || a.type === "SEQUENCE";
+ const timed = a.type === "VIDEO" || a.type === "AUDIO" || a.type === "SEQUENCE";
+
+ const dimensions = visual ? `${a.width}×${a.height}` : null;
+ const resolution = a.type === "VIDEO" || a.type === "SEQUENCE" ? `${a.height}p` : null;
+ const aspectRatio = visual ? formatAspectRatio(a.width, a.height) : null;
const frameRate =
- a.type === "VIDEO"
+ a.type === "VIDEO" || a.type === "SEQUENCE"
? `${Math.round(a.frameRate)} FPS`
: null;
- const duration =
- a.type === "VIDEO" || a.type === "AUDIO"
- ? formatDuration(a.duration)
- : null;
- const fileSize = a.size != null ? formatBytes(a.size) : null;
+ const duration = timed ? formatDuration(a.duration) : null;
+ const fileSize = a.stat ? formatBytes(a.stat.size) : null;
const format = formatMimeTypeLabel(a.mimeType);
const channels =
a.type === "AUDIO" || a.type === "VIDEO"
? formatChannels(a.channels)
: null;
const imported = formatAssetDate(a.createdAt);
- const created = formatAssetDate(a.lastModified);
+ const modified = a.stat ? formatAssetDate(a.stat.mtime) : null;
const c = config();
const prompt = c?.prompt ?? null;
const model = c?.model ?? null;
@@ -171,7 +166,8 @@ export function useAssetMetadataRows(asset: Accessor<Asset | undefined>) {
{ label: "Format", value: format },
{ label: "Channels", value: channels },
{ label: "Imported", value: imported },
- { label: "Created", value: created },
+ { label: "Modified", value: modified },
+ { label: "Source", value: a.source },
{ label: "Prompt", value: prompt },
{ label: "Model", value: model },
];
diff --git a/apps/web/src/components/sidebar-right/inspector/inspector.tsx b/apps/web/src/components/sidebar-right/inspector/inspector.tsx
index c4e948da..ae8e3bba 100644
--- a/apps/web/src/components/sidebar-right/inspector/inspector.tsx
+++ b/apps/web/src/components/sidebar-right/inspector/inspector.tsx
@@ -17,10 +17,11 @@ import {
isShape,
isText,
} from "@diffusionstudio/runtime";
-import { useSelection, useTool } from "@/engine/hooks";
+import { useAssetSelection, useSelection, useTool } from "@/engine/hooks";
import { InspectorHeader } from "./inspector-header";
import { BackgroundSettings } from "./background";
import { SceneTemplatePanel } from "./scene-template";
+import { AssetInfoPanel } from "./asset-info";
// import { Alignment } from "./alignment";
// import { ExportPanel } from "./export";
// import { TimeSettings } from "./time";
@@ -37,18 +38,10 @@ import { SceneTemplatePanel } from "./scene-template";
// import { TransitionSettings } from "./transition";
// import { MasksSettings } from "./masks";
// import { AudioSettings } from "./audio";
-// import { AssetInfoPanel } from "./asset-info";
// import { InterpolationSettings } from "./interpolation";
import type { Entity } from "koota";
-/**
- * What the inspector is looking at. Decided by the armed tool first, then the
- * selection: keyframes win over nodes, then a selected library asset (not
- * wired yet: asset selection is local to the assets panel), a single node is classified by its
- * traits (order matters: a scene is also RECT + ClipsContent), and anything
- * else falls back to the stage.
- */
export type SelectionTarget =
| "scene-tool"
| "keyframe"
@@ -82,6 +75,7 @@ function classifyNode(entity: Entity): SelectionTarget {
export function Inspector() {
const tool = useTool();
const { nodes, keyframes, first } = useSelection();
+ const { asset } = useAssetSelection();
// For ExportPanel (root scenes only) and TransitionSettings (sequence items).
// const parent = createMemo(() => getParentNode(first()));
@@ -94,6 +88,7 @@ export function Inspector() {
const selectionTarget = createMemo<SelectionTarget>(() => {
if (tool() === ToolType.SCENE) return "scene-tool";
if (keyframes().length > 0) return "keyframe";
+ if (asset()) return "asset";
const entity = first();
if (nodes().length === 1 && entity) return classifyNode(entity);
return "stage";
@@ -102,7 +97,7 @@ export function Inspector() {
// Remounts the panels when the selection changes, so per-panel local state
// (open pickers, text fields mid-edit) never carries over to another entity.
const selectionHash = createMemo(() => {
- return [...nodes(), ...keyframes()].join(",") + selectionTarget();
+ return [...nodes(), ...keyframes(), asset()?.id ?? ""].join(",") + selectionTarget();
});
const includesTarget = (...targets: SelectionTarget[]) => {
@@ -186,9 +181,9 @@ export function Inspector() {
<AudioSettings selection={nodes()} />
</Show> */}
- {/* <Show when={includesTarget("asset")}>
+ <Show when={includesTarget("asset")}>
<AssetInfoPanel />
- </Show> */}
+ </Show>
{/* <Show when={includesTarget("keyframe")}>
<InterpolationSettings />
diff --git a/apps/web/src/engine/asset-actions.ts b/apps/web/src/engine/asset-actions.ts
index 52d2daab..6de1381d 100644
--- a/apps/web/src/engine/asset-actions.ts
+++ b/apps/web/src/engine/asset-actions.ts
@@ -7,6 +7,9 @@
import { toast } from "somoto";
import { importFiles as importFilesInto, pickFiles, saveAssetAs as saveAs } from "@diffusionstudio/assets";
+import { insertAsset } from "./insert-asset";
+
+import type { World } from "koota";
import type { Asset, AssetLibrary } from "@diffusionstudio/assets";
@@ -38,3 +41,28 @@ export async function importFiles(library: AssetLibrary, files: ReadonlyArray<Fi
export async function pickAndImport(library: AssetLibrary, folder: string): Promise<Asset[]> {
return importFiles(library, await pickFiles(), folder);
}
+
+/**
+ * Lets the user pick another file for `asset` and points it there; the JSX
+ * keeps naming it by path. Returns the relinked asset, or null when the
+ * picker was dismissed, the host cannot tell the file's path, or the relink
+ * failed (reported).
+ */
+export async function replaceAssetSource(library: AssetLibrary, asset: Asset): Promise<Asset | null> {
+ const [file] = await pickFiles({ multiple: false });
+ const path = file ? library.fs.pathOf?.(file) : null;
+ if (!path) return null;
+ try {
+ return await library.relink(asset, path);
+ } catch (error) {
+ toast.error("Failed to replace", { description: (error as Error).message });
+ return null;
+ }
+}
+
+/** Inserts `asset` at the playhead of the active scene; tells the user when there is nowhere to put it. */
+export function insertAssetAtPlayhead(world: World, asset: Asset): void {
+ if (!insertAsset(world, asset)) {
+ toast("Nothing to insert into", { description: "Open a project first." });
+ }
+}
diff --git a/apps/web/src/engine/create-engine.ts b/apps/web/src/engine/create-engine.ts
index 2b5c48c9..172cecc6 100644
--- a/apps/web/src/engine/create-engine.ts
+++ b/apps/web/src/engine/create-engine.ts
@@ -5,7 +5,7 @@
import { renderSystem, transformSystem, playbackSystem, motionSystem, AudioEngine, createRuntimeWorld, RenderSurface, Time, ChildOf, syncInteractiveState } from '@diffusionstudio/runtime';
import { hudSystem } from './hud';
import { createSignal, type Accessor, type Setter } from 'solid-js';
-import { Hud, Keys, Pointer, PointerEvents, SnapLines } from './traits';
+import { AssetSelection, Hud, Keys, Pointer, PointerEvents, SnapLines } from './traits';
import { inputSystem } from './input/input-system';
import { shortcutSystem } from './input/shortcuts';
@@ -39,7 +39,7 @@ class Engine {
public constructor(projectId: string, options: EngineOptions = {}) {
this.world = createRuntimeWorld(projectId);
- this.world.add(Pointer, Keys, SnapLines, Hud, PointerEvents);
+ this.world.add(Pointer, Keys, SnapLines, Hud, PointerEvents, AssetSelection);
this.unsubscribe.push(
this.world.onAdd(ChildOf('*'), () => (this.interactiveDirty = true)),
diff --git a/apps/web/src/engine/hooks/index.ts b/apps/web/src/engine/hooks/index.ts
index 7a75700a..6428870a 100644
--- a/apps/web/src/engine/hooks/index.ts
+++ b/apps/web/src/engine/hooks/index.ts
@@ -7,3 +7,4 @@ export * from './use-camera';
export * from './use-editor';
export * from './use-tool';
export * from './use-selection';
+export * from './use-asset-selection';
diff --git a/apps/web/src/engine/hooks/use-asset-selection.ts b/apps/web/src/engine/hooks/use-asset-selection.ts
new file mode 100644
index 00000000..6f1bee81
--- /dev/null
+++ b/apps/web/src/engine/hooks/use-asset-selection.ts
@@ -0,0 +1,39 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+import { useTrait, useWorld } from '@diffusionstudio/koota-solid';
+import { createMemo } from 'solid-js';
+
+import { AssetSelection } from '../traits';
+import { useLibrary } from '../library';
+
+import type { Asset } from '@diffusionstudio/assets';
+
+/**
+ * Reactive read and write of the AssetSelection trait: the one library asset
+ * the assets panel has picked and the inspector describes. Shared between
+ * the two sidebars, so it lives on the world rather than in either panel.
+ */
+export function useAssetSelection() {
+ const world = useWorld();
+ const library = useLibrary();
+ const selection = useTrait(world, AssetSelection);
+
+ const id = () => selection()?.id ?? null;
+
+ // `list()` is the library's signal, so a removed or relinked asset drops
+ // out here without the panel having to watch for it.
+ const asset = createMemo(() => {
+ const lib = library();
+ const current = id();
+ if (!lib || !current) return undefined;
+ return lib.list().find((entry) => entry.id === current);
+ });
+
+ const select = (next: Asset | string | null) => {
+ world.set(AssetSelection, { id: typeof next === 'string' ? next : (next?.id ?? null) });
+ };
+
+ return { id, asset, select };
+}
diff --git a/apps/web/src/engine/input/interactions.ts b/apps/web/src/engine/input/interactions.ts
index d191c81d..df9f39a9 100644
--- a/apps/web/src/engine/input/interactions.ts
+++ b/apps/web/src/engine/input/interactions.ts
@@ -30,7 +30,7 @@ import {
import { Not, Or } from 'koota';
import { getDocumentEditor } from '../editor';
-import { Hud, Keys, Pointer, SnapLines } from '../traits';
+import { AssetSelection, Hud, Keys, Pointer, SnapLines } from '../traits';
import { updateCursor, type CursorType } from './cursor';
import { mountNameInput } from '../hud/name-input';
import {
@@ -154,6 +154,7 @@ export function handleCanvasInteraction(world: World, event: DispatchedPointerEv
if (Math.hypot(dx, dy) < CLICK_DISTANCE * resolution(world)) {
editor.clearSelection();
+ world.set(AssetSelection, { id: null });
syncInteractiveState(world);
clearHovering(world);
}
diff --git a/apps/web/src/engine/traits.ts b/apps/web/src/engine/traits.ts
index 85d9ca92..ab4a182b 100644
--- a/apps/web/src/engine/traits.ts
+++ b/apps/web/src/engine/traits.ts
@@ -62,3 +62,11 @@ export const Hud = trait({ mode: 'idle' as HudMode });
* Queue of pointer events to be processed by the input system.
*/
export const PointerEvents = trait({ queue: () => [] as CanvasPointerEvent[] });
+
+/**
+ * The library asset picked in the assets panel, by id (null for none). The
+ * inspector shows its information; a click on empty canvas clears it, like
+ * it clears the node selection. Not a document property: which asset is
+ * being looked at is editor state, not something the JSX says.
+ */
+export const AssetSelection = trait({ id: null as string | null });
diff --git a/packages/runtime/MIGRATION.md b/packages/runtime/MIGRATION.md
index 8108ec9a..ff081670 100644
--- a/packages/runtime/MIGRATION.md
+++ b/packages/runtime/MIGRATION.md
@@ -161,7 +161,9 @@ apps/web now depends on `@diffusionstudio/runtime` and `@diffusionstudio/koota-s
**`mask` is a `<rect>` prop** (`RectProps.mask?: boolean` in `@diffusionstudio/jsx`; no new tag). In the engine a mask is nothing but a geometry with the `IsMask` tag, `ChildOf` the node it clips: `rebuildCaches` files it under `Cache.masks` instead of `Cache.children`, `renderNode` skips drawing it and uses `drawRectPath` of it as a `clip()` (several intersect), hit-testing and the timeline index treat it apart, and the transform, visibility and motion systems see an ordinary geometry — so a keyframed mask `width` is a wipe with nothing new. The prop mirrors that one to one: `setProperty('mask')` adds/removes `IsMask` on the rect's entity, and every other prop is the rect's (`fill`/`opacity`/`blendMode`/paint children are accepted by the type but do nothing on a mask, as they do nothing in the engine). A tag (`<mask>`) was tried first and dropped: the recipe was `<rect>` minus a default paint, and a tag would have made "make this rect a mask" a retag instead of a prop flip. Host behaviour: a `<rect mask>` with no `width`/`height` is 500×500 instead of the rect's 100×100 (`setProperty('mask')` resizes only the dimensions not yet authored, so prop order does not matter); sizing to the parent, which the old editor's "Add mask" did, was tried and dropped for a plain default. Runtime changes: `recomputeEntityTimeRange` gives a mask with no `End`/`SourceOut` of its own its parent's `Computed.end` instead of the sourceless 16 s default (a mask silently letting go at 16 s on a 30 s clip is a surprise nobody authored; `Ignorable` gained `IsMask` so a removal can recompute as if the tag were gone), `bubbleTimeRangeUp` re-propagates into a fitted container's masks after recomputing it (they are not in `Cache.children`, so they would otherwise keep the stale end), the transform system's group-bounds union skips `IsMask` children (a mask clips a group's box, it does not extend it), and `world/observers.ts` watches `IsMask` add/remove on an attached geometry — `refileMask` (new in `actions/cache.ts`) moves it between the parent's `children` and `masks` by hand, since koota fires onRemove with the tag still on and the queries cannot be trusted, then the time range is re-derived and bubbled — so `mask` toggles live like any other prop. Not exposed: `hidden` on a mask does not switch it off (`renderNode` skips masks by role before it looks at `Hidden`, and `computed.visibility` is timing only); text-shaped masks are not a runtime feature either (`drawRectPath` is the only mask path).
- **Inspector shell is on the koota world.** `useSelection()` (`apps/web/src/engine/hooks/use-selection.ts`) reads `Selected` via `useQuery` and splits it into `nodes` (Geometry/Group/AdjustmentLayer), `keyframes`, and `first`; selection is written through `useEditor().select/...` only. `sidebar-right/inspector/inspector.tsx` classifies the target with the runtime predicates (`isScene`, `isMask`, ..., `ToolType.SCENE` from `useTool()`) and mounts only the panels already migrated (`InspectorHeader`, `BackgroundSettings`); the rest of the panels are listed in a comment in their previous order and return one at a time, each following `background.tsx`'s pattern (`useTrait` to read, `editor.editProperty` to write). The `asset` target needs a shared asset-selection state first (today it is a signal local to `sidebar-left/assets.tsx`).
+ **Inspector shell is on the koota world.** `useSelection()` (`apps/web/src/engine/hooks/use-selection.ts`) reads `Selected` via `useQuery` and splits it into `nodes` (Geometry/Group/AdjustmentLayer), `keyframes`, and `first`; selection is written through `useEditor().select/...` only. `sidebar-right/inspector/inspector.tsx` classifies the target with the runtime predicates (`isScene`, `isMask`, ..., `ToolType.SCENE` from `useTool()`) and mounts only the panels already migrated (`InspectorHeader`, `BackgroundSettings`); the rest of the panels are listed in a comment in their previous order and return one at a time, each following `background.tsx`'s pattern (`useTrait` to read, `editor.editProperty` to write).
+
+ **AssetInfoPanel is on the koota world.** Asset selection became an app-side world trait, `AssetSelection` (`engine/traits.ts`, `{ id }`, attached by `Engine`), read and written through `useAssetSelection()` (`engine/hooks/use-asset-selection.ts`: `id`, `asset` resolved against the library's reactive list so a removed asset drops out by itself, `select`). The assets panel uses it instead of its local signal, the inspector classifies `asset` from it (after keyframes, before nodes, as before), and a click on empty canvas clears it in `input/interactions.ts` next to `clearSelection`. The panel reads `@diffusionstudio/assets` records (`assetName`, `stat.size/mtime` for size and "Modified", `generation.id` for the supabase prompt/model rows, plus a "Source" row since files are linked, not copied) and previews via `getAssetFile` + the library's `cache.peaks` (shared with the asset bar); SEQUENCE previews by its first frame. "Insert at playhead"/"Replace source" are `insertAssetAtPlayhead`/`replaceAssetSource` in `engine/asset-actions.ts`, shared with the asset item's context menu; a relink mints a new id, so the panel re-selects the returned asset.
**Left stale on purpose** (deferred to a docs/examples pass): all eight `examples/*.tsx` still open with `<rect scene="...">` and no `<stage>`, so `tsc -p examples --noEmit` fails on them; `reference/jsx/{scene,roots}.md` still describes the pre-`<stage>` model where a mount grafts roots into an existing document; and `reference/jsx/{audio-sync,video,audio,elements}.md` still document `key` as the `syncTo` target. Deliberately not half-migrated: `reference/jsx` is stale as a whole, and patching the `key` rows alone would hide that.