The VS Code of video editing, built for agents.
TypeScript
Enhance asset handling and documentation for symlink support
konstantin-pauluse6838d4abdb2
diff --git a/apps/desktop/src/projects.ts b/apps/desktop/src/projects.tsindex 92fd24ac..f055e852 100644--- a/apps/desktop/src/projects.ts+++ b/apps/desktop/src/projects.ts@@ -1126,10 +1126,13 @@ export async function listEntries(dir: string, source: string): Promise<FsEntry[return [];}const entries = await Promise.all(names.map(async (entry): Promise<FsEntry | null> => {- if (!entry.isFile() && !entry.isDirectory()) return null;+ // Symlinks count as whatever they point at, so media linked into `assets/`+ // is listed like a file that sits there. A broken link stats away to null.+ if (!entry.isFile() && !entry.isDirectory() && !entry.isSymbolicLink()) return null;try {const info = await stat(join(path, entry.name));- return { name: entry.name, kind: entry.isDirectory() ? "directory" : "file", size: info.size, mtime: info.mtimeMs };+ if (!info.isFile() && !info.isDirectory()) return null;+ return { name: entry.name, kind: info.isDirectory() ? "directory" : "file", size: info.size, mtime: info.mtimeMs };} catch {return null;}diff --git a/reference/jsx/media.md b/reference/jsx/media.mdindex 181c28bd..a2af9afe 100644--- a/reference/jsx/media.md+++ b/reference/jsx/media.md@@ -44,20 +44,20 @@ Modifiers compose with declarations: `<image src={generate.image({ prompt: "a re## The library-A project's assets are recorded in `assets.yml` next to its entry file: for each asset, its library `path`, where its bytes are (`source`: the absolute path of a file imported from disk — imports never move or copy files — or a project-relative path under `assets/` for files the app produced), and what it was found to be. Folders are listed too, so an empty one survives a reload. Renaming or moving an asset in the panel rewrites the `src` props that named it.+A project's assets are recorded in `assets.yml` next to its entry file: for each asset, its library `path`, where its bytes are (`source`: the absolute path of a file imported from disk — imports never move or copy files — or a project-relative path under `assets/`, whether the app wrote the bytes there or a symlink points at them), and what it was found to be. Folders are listed too, so an empty one survives a reload. Renaming or moving an asset in the panel rewrites the `src` props that named it.## Adding an asset-Put the file under the project's `assets/` folder and it is in the library. The app is watching, so it lands while the project is open; a project that is closed takes it in on the next open. Its library path is where it sits under `assets/` — folder and name, so `assets/b-roll/drone.mp4` is `"b-roll/drone.mp4"` and `assets/logo.png` is `"logo.png"`.+Symlink the file into the project's `assets/` folder and it is in the library. The app is watching, so it lands while the project is open; a project that is closed takes it in on the next open. Its library path is where the link sits under `assets/` — folder and name, so `assets/b-roll/drone.mp4` is `"b-roll/drone.mp4"` and `assets/logo.png` is `"logo.png"`.```sh-mkdir -p assets/b-roll && cp ~/Movies/drone.mp4 assets/b-roll/+mkdir -p assets/b-roll && ln -s ~/Movies/drone.mp4 assets/b-roll/``````tsx<video src="b-roll/drone.mp4" width={1920} height={1080} />```-A directory of numbered frames is taken in whole, as one [image sequence](#image-sequences), rather than as a file each. [`dapi fetch`](../fetch.md) writes to disk and nothing else, so `-o assets/b-roll/` is how a download becomes an asset; `generate.*` results arrive under `assets/generated/` on their own.+Link rather than copy: the bytes stay where they are, the project holds nothing but a name for them, and the library still gets a portable path to reach them by. Give `ln -s` an absolute target — a relative link is read against the folder the link sits in, so it breaks as soon as the project moves. A directory of numbered frames is taken in whole, as one [image sequence](#image-sequences), rather than as a file each, and a link to that directory does the same. [`dapi fetch`](../fetch.md) writes to disk and nothing else, so `-o assets/b-roll/` is how a download becomes an asset; `generate.*` results arrive under `assets/generated/` on their own.-This is the way in from outside the app: there is no command that adds an asset, and `assets.yml` is not an entry point — a record carries the content hash the app computes for it, and a malformed one is dropped on load. Importing *through* the app is what leaves a file where it lies: the asset panel links it rather than copying it, which no amount of writing to the folder can do. A file that should not move and does not need a library path is named by its absolute path in `src` instead, at the cost of the portability a library path has.+This is the way in from outside the app: there is no command that adds an asset, and `assets.yml` is not an entry point — a record carries the content hash the app computes for it, and a malformed one is dropped on load. The asset panel does the same thing from inside the app: an imported file is linked where it lies, recorded by its absolute path, never copied. A file that should not move and does not need a library path is named by its absolute path in `src` instead, at the cost of the portability a library path has.diff --git a/reference/jsx/module.md b/reference/jsx/module.mdindex 079c438d..27f89273 100644--- a/reference/jsx/module.md+++ b/reference/jsx/module.md@@ -26,7 +26,7 @@ The component receives no props. [`dapi open <dir>`](../open.md) opens the folde| `package.json` | The project record: `projectId` (its identity, kept across renames), `displayName`, `main`, and the dapi commands as scripts. || `tsconfig.json` | Types for the composition tags, through `jsxImportSource`. || `assets.yml` | The asset library (see [media.md](./media.md#the-library)). |-| `assets/` | Files the app produced itself, generations under `assets/generated/`. Media imported from elsewhere on disk is linked where it lies, never copied. |+| `assets/` | The library's files: symlinks to media brought in from elsewhere, plus what the app produced itself, generations under `assets/generated/`. Media imported through the app is linked where it lies, never copied. || `cache/` | Derived data (thumbnails, waveforms). Disposable. || `AGENTS.md` | The agent entry point: what to read in `.diffusion/docs/`. || `.diffusion/docs/` | App-owned copy of this reference and the examples, stamped with the app version and regenerated when it changes. Read it, never edit it. |