← Craft adatlapja
AgentCraft
Közös dokumentumszerkesztés
Közös állapotmodellel, saját visszavonással és jogosított újracsatlakozással integrál párhuzamos szerkesztést teljes dokumentumfelülírás helyett.
collaborative-editing-integration
Nézd meg, miben segítMikor hasznos?
Akkor használd, ha párhuzamos szerkesztéseknek mások munkájának felülírása nélkül kell összeolvadniuk.
Miben segít neked?
- Bevált együttműködési modellt kapcsol a szerkesztő támogatott integrációjához.
- Elkülöníti a tartós tartalmat az átmeneti kurzortól és jelenléttől.
- A visszavonást saját módosításra korlátozza, újracsatlakozáskor ellenőrzi a jogosultságot.
Például ezt kérheted
Tervezz egyidejű bekezdésszerkesztést offline visszatéréssel és csak a saját módosítást érintő visszavonással. Két felhasználó szomszédos szöveget szerkesszen, egyikük szakítsa meg a kapcsolatot. Visszatérés után mindkét munka maradjon meg, a visszavonás csak saját módosítást érintsen.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
Collaborative Editing Integration
Use this skill when real-time multi-user editing, live cursors/presence, or concurrent conflict-free document synchronization is explicitly required.
Core Collaborative Architecture Principles
- Do Not Bolt Real-Time Sync Onto an Ad-Hoc State Model:
- Never attempt multi-user real-time editing by broadcasting full JSON snapshots over WebSockets—concurrent edits will overwrite each other and reset peers' cursors.
- Use a proven collaborative model matched to the editor engine:
- CRDTs (
Yjs,Automerge) with official editor bindings (y-prosemirror,@tiptap/extension-collaboration,@lexical/yjs). - Operational Transformation / Authority Step Stream (
prosemirror-collab) where a central authority orders steps and clients rebase unconfirmed local steps.
- CRDTs (
- Strictly Separate Shared Document CRDT from Ephemeral Awareness:
- Shared Document (
Y.Doc/Y.XmlFragment/Y.Map): Stores persistent blocks, text, marks, and canvas shapes. - Ephemeral Presence (
Awarenessprotocol): Stores live cursor coordinates, text selection ranges, active user name/color, and viewport focus. Never write cursor movements or hover states into the persistent CRDT document, which would bloat history and storage permanently.
- Shared Document (
Local-Scoped Undo/Redo & Relative Cursors
- User-Scoped Collaborative UndoManager:
- In collaborative sessions, disable the single-user history plugin and use the CRDT's local-origin
UndoManager(trackedOrigins) so pressingCmd/Ctrl+Zundoes only the local user's own operations, never reverting a teammate's concurrent edits.
- In collaborative sessions, disable the single-user history plugin and use the CRDT's local-origin
- Relative Positions for Selections and Anchors:
- Represent comments, annotations, and remote cursors using CRDT Relative Positions (
Y.RelativePosition) rather than raw integer indices so anchors stay attached to the intended text/block when remote peers insert or delete content above them.
- Represent comments, annotations, and remote cursors using CRDT Relative Positions (
- Reconnection, Initial Sync & Authorization:
- Gate document room access and write vs. read/comment-only permissions on the server before accepting CRDT updates, and handle offline buffering and reconnection merge cleanly without duplicating initial template content.
Checklist
- Is real-time sync backed by a proper CRDT/OT binding rather than whole-document WebSocket overwrites?
- Are live cursors and selections broadcast via ephemeral
Awarenessrather than persisted in the document CRDT? - Is
UndoManagerscoped to local user origins soUndonever reverts another collaborator's edits? - Are initial template seeding and reconnect merges idempotent so two users opening a new doc do not duplicate initial blocks?
Csomagban lévő fájlok 1
SKILL.md
