Composed calculations
Compose typed cached calculations into a host tree.
A computation as output
An intent emits host data after resolving its choices. The host can apply later deterministic inputs to that data. A video edit can choose its opening and duration once, then apply local trim offsets without asking Reintent to make those choices again.
Cached composition
useCompute(key, component, props) evaluates a pure subcomputation at a stable key. Its result retains its TypeScript type. Props and the choices or contexts read inside determine when it runs again. Keep component identities stable and pass immutable props. The same rules as intent components apply: no effects, mutation, or asynchronous hooks.
A transcript index can feed a story selection, which feeds a duration fit, which produces a host tree. Changing the duration reruns only the affected computations. A trim slider can then adjust the emitted plan in the host.
Cut Studio shows each computation's run count as you change a choice, an audience or a trim.
Check the host boundary
Create an intent with createIntent({ program }). realize() returns the current host tree; preview(choices) builds a hypothetical tree without changing the intent. The tree contains serializable data for its host to display or use in later deterministic calculations. Keep UI behavior and local adjustments in the host.
Last updated on
Edit on GitHub