Repository navigation
Todo
Labels
area:assetsAssets, library and reference inputsarea:desktopDesktop integration / 桌面集成help wantedExtra attention is neededtype:featNew capability or behaviour
Description
Related: Desktop RFC #362 and canvas roadmap #262.
Example scenario
A travel vlogger returns with dozens of camera and drone clips stored on an external drive or a mounted NAS share. Individual clips can be as large as 10 GB. Copying the entire batch into each project takes time and consumes extra disk space. The editor selects Reference in place for the batch, then browses, seeks, and cuts the clips directly from their existing storage.
Goal and scope
Let desktop users import large local media without duplicating the source file. Offer Copy into project and Reference in place when importing a local file. Keep copying as the default and retain the browser upload flow.
User flow and rules
- The desktop host obtains read-only access to the file selected by the user. Keep its location and content fingerprint in host-managed storage. The canvas, timeline, and Agent use the same project asset ID.
- If the file moves or a drive disconnects, show the asset as offline and retain its timeline edits and references. Let the user relink a matching file by SHA-256 without changing the asset ID. If the bytes differ, require an explicit replacement and preserve earlier execution records.
- Read the linked source for preview, editing, generation, and export through shared media services. Apply the existing model input limits when submitting generation.
- Let users copy linked media into the project for portable archives. Identify offline files before creating a self-contained archive. Removing a linked asset leaves the original file on disk.
Proposed reference structure
- Project asset. Keep the existing asset ID, immutable fingerprint, verified media metadata and provenance. Canvas nodes, timeline clips and Agent operations keep referencing the same project asset. Today the Asset schema requires a project-relative
assets/{id}path. Extend the storage contract to distinguish managed bytes from a desktop link, and resolve both through the shared media service. - Desktop file binding. Store the authorized file location in a Host-local record keyed by project and asset ID. An authorized root plus a relative path can support batch relinking when a drive letter, mount point or NAS share changes. Keep machine-specific paths and grants out of portable archives. A project opened elsewhere can retain its asset records and ask the user to bind the files again.
- Availability and identity. Derive availability from the current binding and access checks. Distinguish an unavailable source from a source whose bytes changed. Use filename, size and folder layout to find candidates. Verify SHA-256 before accepting a candidate as the same asset. Relinking changes the binding only. Replacing different bytes requires explicit adoption of a new immutable asset and preserves existing execution records.
- Read and export. Resolve by asset ID under the current project authorization and stream or seek through the Host. Verify source identity at the execution boundary. Operations that require durable inputs, such as accepted generation jobs, need a validated snapshot or must report that the source cannot be safely used. An explicit portable archive copies verified bytes into managed storage and reports unavailable assets before export.
References and trade-offs
- Final Cut Pro informs the import choice and the workflow for reconnecting source media. Apple media management guide
- Adobe Premiere informs one-file and batch relinking when the folder structure is intact. Use these matches to find candidates and verify their content before reconnecting. Adobe relinking guide
- OpenTimelineIO separates a clip's media reference from its available time range. OpenDirector also needs Host-local authorization and immutable content identity. OpenTimelineIO schema
Decisions to confirm
- For large batches, propose registering links with an explicit verification state and computing full SHA-256 in the background with bounded concurrency. Decide when unverified files may be previewed and how generation and export wait for verification. Measure first-preview latency and NAS reads using the 10 GB case.
- Start with file selection and an explicit folder selection for batch relinking. Confirm which platform access grants survive restart and how the app requests access again.
Acceptance criteria
- Import a batch of dozens of clips by reference from an external drive and repeat on a mounted NAS share. Include a 10 GB clip in each run. Verify that the project creates no full-size copies of the source clips. Reopen the project, seek in the large clip, add it to the timeline, and reference it from the Agent.
- Move the file or disconnect its drive. Verify the offline state, then relink an identical file and confirm the asset ID, nodes, and timeline edits survive.
- Change the contents at the original path. Verify that the project requires explicit replacement before using the new bytes.
- Export a timeline that uses linked media. Copy the media into the project, archive it, and verify playback on another machine without access to the source path.
- Remove a linked asset and verify the source file remains intact. Verify import and recovery flows in English and Chinese.
Metadata
Metadata
Assignees
Labels
area:assetsAssets, library and reference inputsarea:desktopDesktop integration / 桌面集成help wantedExtra attention is neededtype:featNew capability or behaviour
Activity
[-][feat] desktop: Import media by reference[/-][+][feat] assets: Import media by reference[/+]Hniii98 commentedon Nov 25, 2026
Hi @FayeSpica , I’d like to work on this feature. I have access to a Synology NAS and can test with a mounted network share.
FayeSpica commentedon Nov 26, 2026
@Hniii98 Assigned, thanks! If you spot any potential bias, let’s discuss how best to address it.
Hniii98 commentedon Nov 26, 2026
I'll implement both the external-drive and the mounted-NAS paths. Below are my plan.
Hniii98 commentedon Nov 27, 2026
Blow are my draft design summary
Model: three layers. Logical asset (immutable content identity) → storage kind (managed / linked) → host-local binding (which machine, which root, relative path).
Assetwithstorage: ManagedStorage | LinkedStorage(see decision [bugfix] Windows 重命名撞名返回 409 + 清理生成轮询的 abort 监听器 #2 below on whether to keeppath: str | Nonealongsidestorageor replacepathwith a format version bump).LinkedStorageholds only machine-independent hints (original name, relative path hint). Linked assets never produceAssetFileWrite/Delete.SourceRoot (rootId, provider, config, credentialRef)+(projectId, assetId) → (rootId, relativePath)+ verification record, stored in Host SQLite underworkspace/state, outside the project and outside archives. Root + relative path enables batch relinking when a drive letter, mount point, or NAS share changes. Bothasset.removeandasset.consolidatesoft-delete bindings until history cleanup so Undo remains intact.MediaSourceProviderport. Phase 1 shipsmanagedandlocal_fs.local_fscovers local disks, external drives, and any OS-mounted NAS (SMB/NFS). The port has no write methods, so "removing a linked asset never deletes the source" is enforced by the type. Remote providers (WebDAV, Synology File Station) are out of scope for this issue.online | offline | changed | unbound | unauthorized, with bilingual error codes, pushed through the existing change channel.(changeToken, size, fingerprint)record means an unchanged file is not fully re-hashed on every Host start. Execution boundaries (job snapshot, consolidate, archive) hash while reading. Accepted generation jobs copy a verified, job-private snapshot.open_mediakeeps its signature but resolves through the provider. Filestat/openmove outside the catalog lock, run with a timeout, and use a per-root circuit breaker, so a stalled SMB mount cannot hang the backend. Video preview stops copying the whole file to a temp directory.source.root.register,link.import,link.status,link.relink,link.relinkBatch,link.locateCandidates,asset.replaceSource(new Asset ID, earlier execution records preserved),asset.consolidate(same Asset ID and fingerprint, becomes managed),asset.remove(unbind only),archive.preflight. The Agent works only within roots the user has authorized, using(rootId, relativePath), and never sees absolute host paths.apps/desktop/src/main.mjs. The browser keeps the existing upload flow.Issues found in the current code that must be fixed for the 10 GB / NAS case:
open_mediaopens files inside the SQLite transaction lock. A stalled SMB mount would block the whole backend.open_mediacallers (library add, tool byte reads) read the whole file into memory.Phasing:
managed/local_fs, Windows + POSIX), binding registry, resolver with out-of-lock open + timeout, preview without full copy, fix OOM whole-file readslink.importwith staged/background hashing, availability + notifications, bilingual UI, Agent toolsreplaceSource, soft-delete unbind on removeconsolidate(soft-delete unbind),archive.preflight, job snapshots, verify-while-reading exportHniii98 commentedon Nov 27, 2026
Decisions I'd like confirmed:
(I can already start on the decision-independent P0 infrastructure—read-only provider port, moving
open_mediafile opens out of the SQLite transaction lock with timeouts, removing full-file temp copies inpreview(), and fixing whole-filestream.read()callers—while waiting for your input.)Blocking P0/P1 domain contracts:
LinkedImportstaging record first; allow preview/seek during background SHA-256 hashing, and create theAssetonly after hashing completes. Keeps theAssetRef.fingerprintinvariant untouched, but users must wait for full hashing before adding a 10 GB clip to the timeline or referencing it from the Agent.Assetimmediately with an explicitverification: pendingstate so users can preview and edit on the timeline right away, and gate generation / consolidate / portable archive on verification completion. Better UX for 10 GB batches, but requires relaxingAsset.fingerprint/AssetRefinvariants in P0.Asset.pathcontract transition:path: str | None(assets/{id}for managed,Nonefor linked) and addstorage: ManagedStorage | LinkedStorage(defaulting tomanaged), so existing project event logs replay cleanly without a hidden migration path.pathwithstorageoutright and bump the project format version, explicitly rejecting older formats perAGENTS.md.Needed for P1–P3 (can be confirmed together):
open_mediatrust an unchanged(changeToken, size)signature indefinitely until it changes, or add a more conservative re-hash policy for mounts like SMB where onlysize + mtimemay be reliable?AssetProvenance.source, is adding'linked'preferred? (Note that'imported'is already reserved for canvas archive imports and requiresimportedFrom.)