Status: Accepted (2026-11-27)
Everything (browser, MCP, scripts, future integrations) must go through one API that validates every op on the server. There must be no side path into the database or a document.
/v1:
shared/src/api.ts. Realtime frames: shared/src/messages.ts + codec.ts.tools/gen-openapi.mjs -> docs/api/openapi.json, CI fails if stale). The schemas are built with shared/src/schema.ts, which also yields TS types (Static<>) and the runtime validator. One source, no hand-kept duplicates. The binary protocol is single-sourced in codec.ts + PROP_INFO. tools/gen-wire-spec.mjs emits a language-neutral description for any future non-TS peer.POST /v1/files/:fileId/pages/:pageId/ops (JSON or application/vnd.linora.ops binary) go through the same stages: authenticate, authorize, decode + validate, sequence, journal, broadcast. HTTP batches are converted to binary by the API service and submitted over an internal realtime connection as the calling user, so they hit the same gateway code. Responses carry per-op verdicts with hints; clients roll back rejected optimistic changes.minSeq gives read-your-writes after an edit./v1; breaking changes = /v2 alongside. Realtime: PROTOCOL_VERSION + DOC_RULES_VERSION in hello.Every feature ships as an API route or protocol message first; the UI and MCP consume it like any client. The API is documented by construction.