Surface / foldkit-surface

Applications

Surface.application({ Model, Message }) returns an Application: the schemas (App.Model, App.Message), the reference tree (App.model, with App.fields a deprecated alias), the identity token (App.owner), and App.surface. No transition, so a consumer that only inspects the Model needs nothing more.

Surface.application({ Model, Message, initial, update }) adds App.initial and App.update and returns a RunnableApplication, which a replicator needs to derive the initial shared value and replay. update's Commands may carry resources; the resource set is threaded through the returned type.

When the update is built from what is made over the references (a Remote domain over App.model.remote, a placed Bundle), it cannot be given when they are made. App.runnable({ initial, update }) adds it afterwards and returns a RunnableApplication with the same references and the same owner. A second Surface.application for the update would be another application, whose references Projection.pick refuses to mix with the first's:

ts
const Made = Surface.application({ Model, Message })
// …what the update needs, built over Made.model…
const App = Made.runnable({ initial, update })
// App.model is Made.model: one application.