Learn / Wiring
How the assembly routes Messages and builds the runtime config
From a list of wirings and bundle placements, Page.assemble produces an assembly value that derives each runtime piece in order:
- Claimed vs. shared tags: Each claimed tag routes to its single wiring via
route(which returnsOption.somewhen handled andOption.noneotherwise), and falls through toownfor everything else. Asharedtag—such asUrlChangedorMirrorRestored—is folded by every wiring sharing it in list order, then passed toown. - Startup commands:
wiring.initialruns placementinitsteps (shallowest first), then each wiring'sinitstep in list order. A key-value mirror'srestorecommand is returned as a normal Foldkit command. - Subscriptions and resources: Subscription entries and managed resources merge by key, throwing on duplicate keys and combining all Effect service requirements into the runtime type.
- URL handling:
wiring.urlruns every wiring'sonUrlon the initial URL and builds theonUrlChangedispatcher for navigation messages. - Module contracts:
wiring.modulecollects every placement contract (owning its Model path) and every wiring contract into one list forModule.validate.
Who owns state when using an assembly
Joining integrations in one list leaves state ownership unchanged: each package keeps the exact responsibilities it had when wired by hand.
- Remote owns the normalized server cache slice through
Data.reduce. - Mirror observes local fields in your
Model; yourupdateremains the owner of those fields. - Sync owns replication through
Sync.mount, contributing only its contract to the assembly. - Agent dispatches Messages from your union, which
updatehandles as usual. - Placements own their slice of the parent
Modelvia wrapped child Messages.