Lay groundwork for serialization

Also remove Message/TextLiteral distinction.

Development checkpoint; all tests still pass.