Learn / Wiring

Wiring versus bundles and placements

A bundle packages a child state machine once — Model, Message, init, update, Subscriptions, resources, view — and a Link places it at a Model path, possibly many times. A placement owns its slice: its Messages are wrapped variants of the parent union (GotDarkMessage), routed by wrapper to that slice.

A wiring handles the Messages that must stay flat: facts about the whole application that agents, journals, and DevTools name directly (MirrorRestored, Remote's cases, the URL Message). Wrapping them per owner would just add unwrapping; the handles/shared table is the routing for flat Messages the way the wrapper is the routing for placed ones.

In the assembly they are separate item kinds in one list — placements route by wrapper, wirings route by tag — sharing the key/tag/resource checks, the init ordering, the subscription merge, and the Module. Contract-only wirings (Sync, Agent) contribute nothing but their contract: Sync owns the runtime through mount rather than joining it, and an agent adds no state.

When not to use it

  • A single integration whose hand-wiring is covered by a dispatch-level test. The assembly is process, not safety, at that scale.
  • Anything outside an application with a parent scope. A wiring describes joining; without Page.assemble there is nothing to join.
  • As a Route replacement. wiring.url assumes one URL Message; applications with real routing keep their router and let a mirror read the URL like any other consumer.
  • To skip understanding the integration. The wiring calls the same reduce, restore, and subscriptions the hand-wiring called; it checks the plumbing, not the semantics.