Skip to content

feat: editor polish, automatic checkpoints, suggesting mode, live updates that survive restarts - #184

Open
maxsam4 wants to merge 7 commits into
stack/20-reconcilefrom
stack/21-ui-polish
Open

maxsam4 wants to merge 7 commits into
stack/20-reconcilefrom
stack/21-ui-polish

Conversation

@maxsam4

@maxsam4 maxsam4 commented Nov 20, 2026

Copy link
Copy Markdown

Fixes from using the live editor for real, on top of #182.

  • Dark-mode editor chrome. BlockNote's Ariakit components read their own theme variables, not the --bn-colors-* Primer set, so in dark mode the formatting toolbar, menus and comment composer were drawn with stacked inset shadows, an offset frame around Save, and blue focus rings. One stylesheet (apps/web/src/live/editorTheme.css) now restyles Ariakit's shared building blocks from Primer's tokens, in light and dark. It is a polish pass over the whole page: a compact header row, flat panel toggles, and bottom-sheet panels on phones.
  • Automatic checkpoints. Each open live document saves a checkpoint 2 minutes after its last content edit, and at most every 10 minutes during continuous editing, only when the content changed since the last checkpoint. These are marked automatic (migration 0027) and History labels them "auto-saved". Share links keep serving their pinned version.
  • Save checkpoint feedback. The button shows a busy state, then a toast such as "Checkpoint v3 saved" with a link to that version, or an error. If nothing was edited since the last checkpoint, the toast says so.
  • Suggesting mode for people. apply-ops accepts mode: 'suggest' from anyone who can comment. The header gets an Editing | Suggesting switch: edits go into a draft with a banner showing how many blocks changed, plus Discard and Send suggestions.
  • Editors stay live across restarts and proxies.
    • On shutdown the server closes live sockets (code 1012) and event streams.
    • The editor pings over the socket and reconnects (which resyncs) when a proxy leaves the socket half-open.
    • The event stream reopens itself with backoff.
    • The header shows Live, Reconnecting… or Offline.
  • Comments update live behind proxies that hold SSE. Comment, thread and suggestion events are also sent to a document's open editors over its live socket, and the editor refetches on them.

All gates pass locally. Tests cover automatic checkpoints, suggesting, and events reaching editors over the socket. Screenshots were taken in light and dark, at 1512, 1920, 2560 and 390 px.

🤖 Generated with Claude Code

maxsam4 and others added 6 commits November 20, 2026 10:00
People forgot to press "Save checkpoint", so history had gaps. The live
server now schedules a checkpoint per open document on every content edit
by a person or agent: two minutes after the last edit, and at most ten
minutes into continuous editing. It saves only when a stored update after
the latest checkpoint touched a block (comment marks and system writes
don't count), so no-op and annotation-only writes never add history.
Checkpoints made this way carry versions.automatic so history can tell them
from named ones.

A save by hand without a note now answers 200 with the latest checkpoint
and `unchanged: true` when nothing changed since it, instead of adding an
identical version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Suggestions could only come from agents in suggest mode or proposed
branches, so a person had no way to propose a change. `mode: 'suggest'`
stores every op of a batch as a suggestion; anyone who may comment can send
it (people only: agents keep their run-scoped rules), and the owner or an
editor decides as for any suggestion. The editor's Suggesting mode sends
its draft this way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… feedback

Dark mode looked broken because BlockNote's Ariakit UI brings its own
theme: bevelled buttons drawn with stacked inset box-shadows, a toolbar
frame with its own background and drop shadow (nested again inside the
comment popover, around Save) and blue focus rings and menus. Primer only
themed --bn-colors-*, which those primitives don't read. editorTheme.css
restyles the Ariakit primitives once from Primer tokens for light and dark,
so the formatting toolbar, menus, comment popovers, threads and history
match the app.

The editor header gains an Editing | Suggesting switch (Viewing for people
who can't edit). Suggesting opens the tab as a draft; Send stores each
change as a suggestion (ops with mode suggest) and opens the Suggestions
panel. Panel toggles are compact and scroll on a phone, where panels open
as a bottom sheet.

Save checkpoint shows a busy state, then a toast with "Checkpoint vN saved"
or "No changes since checkpoint vN" and a link to it, or the error. History
names automatic checkpoints as auto-saved, in every locale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…thing was edited

Answering an unchanged save with the previous checkpoint skipped what a
checkpoint also freezes besides content (records a page reads, comment
placements, the tab list), which two existing tests caught. A save by hand
now always makes a checkpoint; `unchangedSince` names the previous one when
no one edited the content in between, so the toast can say so. Automatic
checkpoints still skip when the content is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e event stream

After a deploy the owner's page stopped showing an agent's edits and
replies until a reload, and nothing said so. Three causes: a shutting-down
server kept its live sockets (and event streams) open, so browsers stayed
attached to a process that no longer received writes; a socket left
half-open by a proxy is never noticed by the provider; and the edge proxy
holds back the event stream, from which the editor learned of new
comments, and EventSource gives up for good on an error response.

The server now closes live connections (1012) and HTTP connections on
shutdown, and answers a liveness probe the browser sends every 15 s,
reconnecting (which resyncs) after 5 s without an answer, retrying at least
every 5 s. Comment, thread and suggestion events are relayed to the
document's open editors over the socket as a stateless message; the editor
refetches on them, and once more after any reconnect or stream break. The
event stream reopens itself with backoff. The header always shows Live,
Reconnecting… or Offline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maxsam4
maxsam4 added this pull request to stack #183 November 20, 2026 06:41
…ue, not any "999"

The assertion looked for "999" anywhere in the page, and random ids and
nonces in the HTML sometimes contain it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
maxsam4 added a commit to Aiden-HQ/AidenHQ that referenced this pull request Nov 20, 2026
…eckpoints and suggesting (#950)

Builds Primer at 4dc290c: upstream 0xPolygon/primer#184 on the
collaboration stack, with proxy sign-in (#141).

- The dark-mode editor chrome is fixed, with a polish pass.
- Checkpoints save automatically once edits settle, and Save checkpoint
confirms.
- People can suggest through an Editing | Suggesting switch.
- Editors stay live across restarts and through proxies, and comments
arrive over the live socket.

New migration 0027 (versions.automatic), applied by the server on start.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant