# BF32 / TX7 — TeXlyre Source Collaboration Core implementation state

Updated: 2026-08-22 (Australia/Sydney)

## Objective

Make live TeXise collaboration deliberately boring and reliable: one Source editor state, one Y.Text authority and one Yjs Awareness cursor representation. Alice typing must immediately produce the same text in Bob's Source editor with Alice's named caret at the same logical position.

## Final live path

```text
CodeMirror
  ↕
y-codemirror.next
  ↕
Y.Text
  ↕
Y.Doc
  ↕
y-websocket /collab-live
```

`IndexeddbPersistence` keeps the Y.Doc durable/offline. `LatexSourceService` and browser project storage are one-way projections from Y.Text while collaboration is active.

## Implemented BF32 boundaries

- TX7 protocol and `texise-collaboration-v7` persistence namespace.
- Exact collaborative extensions: `.tex`, `.ltx`, `.bib`, `.bst`, `.cls`, `.sty`, `.txt`.
- Direct TeXlyre-derived `yCollab(yText, awareness, { undoManager })` plus `yUndoManagerKeymap`.
- Stable awareness `user` identity; `texiseSession` only for protocol/role/host verification; `cursor` owned by y-codemirror.
- No TeXise custom Source relative-position presence, no collaboration authorship, no Follow/Open, no Visual live projection, no shared review/activity maps.
- Source-only policy: Visual and Track Changes unavailable while the session is active.
- Project structure locked during live collaboration; non-Source/binary assets are join-time snapshot data.
- Link + QR sharing using `/join/<roomId>#<64-hex-secret>` with a 32-byte random secret and SHA-256-derived relay room key.
- Join synchronizes and verifies a compatible live host before browser workspace creation.
- Same-room link reuses the local browser project. Raw secret is local-only and is not placed in SaaS cloud metadata.
- Host Stop writes `sessionStatus=stopped` before disconnect.
- Programmatic existing-Source edits route to Yjs; compile flushes the collaboration projection first.
- TeXlyre 0.10.16 AGPL-3.0-or-later attribution added.

## Dependency stabilization

Pinned in `@learnitive/project-collaboration`:

```text
y-codemirror.next 0.3.5
y-indexeddb        9.0.12
y-protocols        1.0.7
y-websocket        3.0.0
yjs                13.6.30
```

QR:

```text
qrcode        1.5.4
@types/qrcode 1.5.6
```

No CodeMirror core upgrade is part of BF32.

## Verification completed locally

All dependency-free gates available in the extracted source environment pass:

- `node scripts/repair-buildfix32-source.mjs "$PWD"` — PASS.
- `node scripts/verify-pnpm-lock-sync.mjs` — PASS, 69 workspace importers.
- `node scripts/verify-workspace-dependency-versions.mjs` — PASS, 68 workspace packages.
- `node scripts/verify-workspace-public-barrels.mjs` — PASS, 67 public entries across 68 workspace packages.
- `node --test scripts/r14-28-14-regression.test.mjs` — PASS, 22/22.
- `node --test scripts/release-runtime-hardening.test.mjs` — PASS, 101/101.
- `node scripts/texise-release-audit.mjs` — PASS, 350/350 static contracts.
- `node scripts/texise-saas-static-audit.mjs` — PASS, 43/43.
- Global TypeScript `transpileModule` syntax pass — PASS for all 29 modified/untracked TS/TSX files.
- Modified Node script syntax (`node --check`) — PASS.
- Modified shell syntax (`bash -n`) — PASS.
- Changed package JSON parsing — PASS.
- `git diff --check` — PASS.

## Formal release scenarios

The TX7 browser contract includes the exact stale-cursor regression:

```latex
\section{Introduction}
Start writing herfge.
```

Host appends ` I am user.` and Guest must display:

```text
Start writing herfge. I am user.|
```

with Host's y-codemirror cursor label on that logical line. The matrix also covers beginning/middle/end edits, newlines, paste, deletion, concurrent typing, remote edits before a peer caret, local-user-scoped undo, reconnect/offline convergence, same-link reuse, stopped sessions and static full-project bootstrap.

The formal soak is implemented as an opt-in/release-quality Playwright test: two independent browser contexts, exactly 10,000 deterministic Yjs text transactions in 250-edit batches, two offline/reconnect windows, periodic file switching and Yjs undo/redo, checkpoint comparisons of both Y.Text replicas and both one-way LatexSource mirrors, and final CodeMirror tail verification. `TEXISE_RELEASE_QUALITY=1` makes this soak mandatory in formal release quality; `TEXISE_TX7_SOAK=1` can run it directly.

## Environment limits

The extracted working environment has no project `node_modules`, usable `pnpm` or Internet access. Therefore dependency-backed `tsgo`, Biome, Vitest, Vite/production browser build, Playwright execution, production `/collab-live` certification and the 30-minute soak cannot be truthfully marked PASS here. Their test/guard contracts are shipped and they remain mandatory CI/staging release gates.
