addNode

fun addNode(replica: ReplicaId, ts: Long, parent: String, value: V): AddNodeResult<V>

Add a fresh node under parent, tagging the op with (replica, ts).

The caller is responsible for choosing a ts that is monotonically increasing per replica and unique per (replica, ts) pair. A practical choice is a Lamport clock incremented on every local operation.

Return

an AddNodeResult carrying the updated tree, the newly minted node id ("<value>:<replica>:<ts>"), and a Patch suitable for delta-propagation to peers via Quilted.piece. Mirrors move's Patch-returning shape so addNode composes with Quilter.apply() without further bookkeeping.

Throws

if replica's seq is already at Long.MAX_VALUE, as a decoded move-log can leave it (#3417). The next seq would wrap to Long.MIN_VALUE.