[2/2] feat: generate image, video and audio assets from prompts via a host-registered handler - #153
Open
dazzatronus wants to merge 1 commit into
Open
Conversation
…registered handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An image, video or audio asset can carry a
promptinstead of asrc, and those clips render as an inert placeholder. This lets a host fill them.The host supplies one async callback and the SDK owns everything else: pending, generating and failed states, the canvas and timeline treatments, and writing the returned URL back through the normal edit path so the change is undoable and autosaves. A rejection's message shows as-is beside a retry. Models, pricing and error semantics stay with the host, which is why the only new integration point is
registerAssetGenerator.The feature is inert until a host registers a handler — no generate control appears anywhere without one. That is the gate, which is why there is no flag as well.
Declared unsplittable at 1204 lines. It does not divide into independently revertible pieces: the lifecycle, the states it drives and the controls that trigger it are one decision, and a core-only PR would ship an API nothing calls. What was separable has been separated into #152, which this targets.
Reading order:
src/core/generation/asset-generator.tsthensrc/core/edit-session.ts— the lifecycle and the host contract. These two carry the design.src/core/ui/media-toolbar.ts— prompt and generate folded into the existing toolbar, so generative clips keep every clip-level property. An earlier attempt used a separate toolbar and lost them.src/components/canvas/players/*andsrc/components/timeline/*— state plumbing, churn.smoketest.*andsrc/templates/generation-smoketest.json— a dev-only harness, 327 lines, not shipped. Skip.One thing a reviewer would otherwise flag: the abort on clip deletion sits in
deleteClip, not the by-id wrapper, because the toolbar trash and the Delete key call the former directly.Verify:
npx jest && npx tsc --noEmit && npx eslint src tests. Manually,npm run devand open/smoketest.html; a fake generator covers success, failure and slow-for-abort, and?nogenshows the editor with no handler registered.Risk: additive. Existing templates without prompts are untouched, and an unregistered host sees today's behaviour.