githubnext/chopinPublic

Let's compose rich plans together

Leave the agent's cursor where its edit finished

At the end of the last block it touched, not the start. An anchor names a
block from its start, which is the stable end of one to point at, so the
cursor was inheriting a position chosen for a different job — and a caret
at the top of a paragraph the agent has just written points at the first
thing the reader already knows and reads as though it is about to type
there. `room.endOf` is its own function for that reason rather than a
flag on `anchorAt`.

Proven through Lexical's own resolver rather than by inspecting the Yjs
position, since the only question worth asking is where a browser would
draw it. A decorator block is a map and not a sequence, so it has no
inside to be at the end of; nought is the only position it has.

The label stays up ten seconds too. A person's caret is one of several
and its owner is watching it, so a second is enough to say who moved
where. The agent's turns up unannounced in a document somebody else is
reading, and saying what put it there is the whole reason it is drawn —
naming it for a second and going quiet answers a question nobody had time
to ask. Read from awareness rather than matched on the name, because
`github.com/ai` is a real account and somebody signing in as that should
not inherit the agent's chrome.
KCKrzysztof Cieslak authored
fdd3102Patch
Parent3eb7c91
6 files changed+169-12
StackedSplit
agents.md+10 −0
apps/server/src/plan/anchors.test.ts+84 −0
apps/server/src/plan/room.ts+31 −0
apps/server/src/plan/service.ts+16 −8
packages/editor/src/collaboration.tsx+1 −1
packages/editor/src/labels.ts+27 −3