Skip to main content

Module editing

Module editing 

Source
Expand description

CRDT-based collaborative file editing.

Provides a shared document model using automerge for collaborative editing of files within worktrees. Multiple clients can edit the same file via separate fids, sharing a single AutoCommit document.

§Session lifecycle

  1. editOpen — Read file, hash it, initialize automerge doc, create session
  2. editState — Serialize current automerge doc state to text (TOML/JSON/etc.)
  3. editApply — Apply automerge changes from a client
  4. flush — Write automerge state back to disk (atomic, checks file_hash)
  5. editClose — Close this client’s session (decrements client_count)

Structs§

EditingTable
Table of active CRDT editing sessions.
SharedDoc
Shared CRDT document for a file, accessed by multiple clients.

Functions§

normalize_path
Normalize a path: no leading ./, no trailing /, POSIX separators.
sha256_hash
SHA-256 hash of bytes.

Type Aliases§

DocKey
Canonical key for a shared document: (repo_id, worktree_name, normalized_path).