Surface / foldkit-surface

Message subsets

A subset selects typed variants of one application's Message union by constructor reference:

ts
import { MessageSet } from 'foldkit-surface'

const TodoChanges = MessageSet.make(App, [Message.CreatedTodo, Message.ToggledTodo])
const SelectionChanges = MessageSet.make(App, [Message.SelectedTodo])
const AllChanges = MessageSet.union(TodoChanges, SelectionChanges)

A subset carries the constructors, a pure codec for exactly those variants, a tags set, and an includes guard. A constructor that is not a variant of the application, a duplicate tag, or a subset from another application throws. Surface does not label a subset durable, agent-visible, or presence; Sync and Agent attach those policies to the same value.