Skip to main content

Module threads

Module threads 

Source
Expand description

V2-30: asking on a selection — a question anchored to a range of a note, answered in a thread beside it by a person or an agent (the owner, 2026-11-02: “I want to have the ability to highlight a line in a doc and ask a question … these docs are really important and will be key locations for paired work.”).

The anchor follows the text. A thread’s range is two Yjs relative positions in the note’s CRDT (yrs::StickyIndex, the browser’s Y.RelativePosition byte for byte): the start sticks to the character after it, the end to the character before it, so every hand’s edit — around the range, inside it — moves them with the text. Resolved now, they are the range’s offsets in characters (from, to); a range whose text was deleted whole resolves to nothing and the thread is detached (kept, listed at the end). The browser resolves the same positions in its own copy (anchor, base64), so the margin is exact.

Stored in the notes file: doc_threads (a row per question: its anchor, the text it quoted, the question, to whom, who and when, and when it was resolved) and doc_replies (a row per answer). Said on the channel for watch: asked, replied, resolved, each with the thread whole.

Structs§

Hand
Who asked or answered.

Constants§

TABLES
The tables.

Functions§

anchor_bytes
A thread’s anchor from base64 — for a client resolving it itself.