Expand description
The editor roundtrip contract.
ragrig-gpui does not own an editor. It owns the protocol an editor and a
RAG co-writer share: versioned context containers, guarded write-back, and
the traits a host implements for its concrete editor component.
A host implements EditorSurface for its document type and
RoundtripHost for the state that owns the active editor, then hands the
agent a Roundtrip. Swapping the editor backend (zorite, gpuikit, …)
leaves the protocol and the agent untouched.
Structs§
- Context
Note - What the transcript needs to note an attached context.
- Editor
Buffer - The editor facts a
RoundtripContextis built from. - Editor
Snapshot - An owned snapshot of one editor document.
- Replacement
- The result half of the protocol: one replacement an answer asked for.
- Replacement
Target - Where a guarded replacement should land.
- Roundtrip
- The roundtrip façade the agent holds.
- Roundtrip
Context - One region of the editor attached to a query.
- Selection
Context - A captured selection together with the document it belongs to.
- Selection
Snapshot - A marked passage in one editor document.
Enums§
- Replacement
Outcome - The result of trying to write an agent replacement into an editor.
- Roundtrip
Kind - Which region of the editor a context came from.
Constants§
- MARKERS
- Every marker the protocol defines, in prompt order.
- MARKER_
CONTEXT - Container for one block of context.
- MARKER_
DOCUMENT - Container for one document inside a context block.
- MARKER_
LIBRARY - Container for the author’s bibliography.
- MARKER_
REPLACE - Info string of the result-side replacement block.
- MARKER_
SELECTION - Container for a passage the author marked for a question.
- MARKER_
TRUNCATED - Marks where a truncated context was cut.
- MAX_
CONTEXT_ CHARS - One attached context carries at most this many characters.
- PROTOCOL
- Protocol version prefix shared by every marker.
Traits§
- Editor
Surface - The minimal editor surface the roundtrip needs.
- Roundtrip
Host - The host side of the roundtrip: the active editor and its write-back.
Functions§
- bibtex_
entry_ offset - The character offset of the entry whose key matches
key. - byte_
to_ char_ index - The char index of a byte offset.
- char_
index_ for_ line_ column - The char index of a 0-based
(line, column)incontent. - char_
range_ to_ bytes - The byte range of a char range, clamped to
text. - context_
note - The note a transcript shows for an attached context.
- digest
- A short, stable identity for one version of a text.
- missing_
markers - The markers
promptdoes not mention. - replace_
at - Replace the character range
rangeofcontentwithreplacement. - verified_
bytes - The byte range of a marked passage, but only when its digest still
matches
guard.