Structures · Sequences

SharedText

Merge concurrent typing by grapheme identity, not fragile offsets.

Set the Eagle Creek problem first

Alice and Bob add weather adjectives to the same Eagle Creek field note.

Each person carries a field-note page. When a person makes a change, they copy it onto a text-edit slip with the identity, path, sequence, or acceptance evidence that the rule needs. The demo shows both the local record and the note that travels.

An ordinary local edit names a position or value. That name can become stale while another client works. Watershed's text_kernel uses this structure's rule to produce one shared result.

A SharedText applies this rule to the shared record.

Run the conflict

Alice and Bob act before either receives the other operation. Carol stays connected as the third replica and confirms the converged view.

Three Eagle Creek clients

SharedText authored race

Alice and Bob add weather adjectives to the same Eagle Creek field note.

Watershed ruleEvery grapheme keeps a stable identity and concurrent insertions both survive.

Alice

Field-note page The weir is clear.

Text-edit slip Insert still grapheme identity A:1 · before weir

Bob

Field-note page The weir is clear.

Text-edit slip Insert calm grapheme identity B:1 · before weir

Carol

Field-note page The weir is clear.

Text-edit slip Observe the note No slip in this race

Shared view
  • The weir is clear.

Enable JavaScript to run the race. The expected result remains in the lesson.

Ready: The weir is clear.

Read the result

Both insertions remain, and no edit splits a grapheme.

The demo models the authored race from Watershed's public structure examples. The lesson keeps the conflict rule visible before exposing its metadata or protocol.