Skip to main content

Module editor

Module editor 

Source
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§

ContextNote
What the transcript needs to note an attached context.
EditorBuffer
The editor facts a RoundtripContext is built from.
EditorSnapshot
An owned snapshot of one editor document.
Replacement
The result half of the protocol: one replacement an answer asked for.
ReplacementTarget
Where a guarded replacement should land.
Roundtrip
The roundtrip façade the agent holds.
RoundtripContext
One region of the editor attached to a query.
SelectionContext
A captured selection together with the document it belongs to.
SelectionSnapshot
A marked passage in one editor document.

Enums§

ReplacementOutcome
The result of trying to write an agent replacement into an editor.
RoundtripKind
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§

EditorSurface
The minimal editor surface the roundtrip needs.
RoundtripHost
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) in content.
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 prompt does not mention.
replace_at
Replace the character range range of content with replacement.
verified_bytes
The byte range of a marked passage, but only when its digest still matches guard.