The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.
TypeScript agent-skillsagentic-aiai-agentsai-videobyokclaude-codecodexdeepseek-harnessdsh-plugingenerative-ailocal-firstmcpmotionmotion-graphicsmultimodalopenmotionreverse-engineeringvideo-editingvideo-generationworkbuddy
export interface OptimisticUpdateOptions<TSnapshot> {
/** Apply the change to local state immediately. Return a snapshot for rollback. */
apply: () => TSnapshot;
/** Persist the change to the server. */
persist: () => Promise<unknown>;
/** Revert local state using the snapshot if persist fails. */
rollback: (snapshot: TSnapshot) => void;
}
export async function executeOptimistic<T>(options: OptimisticUpdateOptions<T>): Promise<void> {
const snapshot = options.apply();
try {
await options.persist();
} catch {
options.rollback(snapshot);
}
}