githubnext/chopinPublic

Let's compose rich plans together

Mark the agent's changes once the reader has reached them

The agent writes wherever it likes, including several screens from
whoever is reading, so a mark that spent its ten seconds off screen would
have told nobody anything. Nothing starts counting down until it has been
in the viewport, which turns a flash into an unread marker — and unread
markers do not expire on a clock, so an unseen one waits indefinitely and
the set is bounded by a cap instead.

Once seen the clock runs whether or not the mark is still in view. Two
states and one timer, so nothing can go dark and light up again on a
later scroll, which would read as a second edit that never happened.

Everything is drawn in box-shadow on blocks that already exist. An agent
editing below the fold must not shift the sentence somebody is in the
middle of typing, and a mark expiring later must not shift it back, so
nothing may take space and nothing may add an element. What was removed
has no element at all, which is why a hole is drawn on the edge of the
block still beside it, and why what it was can only be read in the list
behind the chips.

The lifetime is kept in `trail.ts` with no document in it, because the
test runtime has none: no happy-dom, no preload, `document` undefined.
Separating the two is what makes any of this testable at all.
KCKrzysztof Cieslak authored committed by Krzysztof Cieślak
21f4af9Patch
Parente140486
9 files changed+1202-7
StackedSplit
packages/editor/src/changes-chip.tsx+142 −0
packages/editor/src/changes-observer.tsx+34 −0
packages/editor/src/changes.ts+487 −0
packages/editor/src/plan-editor.tsx+51 −7
packages/editor/src/provider.ts+11 −0
packages/editor/src/styles.css+217 −0
packages/editor/src/trail.test.ts+131 −0
packages/editor/src/trail.ts+121 −0
packages/editor/src/widgets-plugin.tsx+8 −0