forked from vhaudiquet/rhema-claw
feat: chips travel as span records, not mark embeds
The claw's wire carried chips only as U+FFFC-payload-U+FFFC marks written into the text — the very encoding 0.4.0's fold migrated at the provider seam. Now the record rhema-core defined is the wire's own: a message's pasted payloads ride the POST body's `pastes` array beside the plain draft, the fold composes the plain form and measures each chip's PasteSpan, and the `user_message` echo carries text plus `pastes` — the session annotation's own shape — while the turn's question carries the span note into the checkpoint, shifted by the exact bytes any framing prefix adds. The web client mints and renders the new record: the composer sends draft and payloads separately, the optimistic row composes the same plain text and spans the fold will record (so the echo dedupes), and the render slices the text at the record's byte offsets. Rows recorded before spans arrived still parse the mark form — as does every arrival that still mints it, including every surface the shim or an older client feeds. The phone is one of those: it parses chips by scanning marks, and kotlinx ignores the new field, so it reads spans-less rows exactly as before; adopting span records for its own rows is a follow-up.
This commit is contained in:
1 parent
df260fd9a8
commit
c5bf168eed
12 files changed
+484
-108
No files matched your search
+10
-5
@@ -97,10 +97,14 @@ Two consequences worth knowing before changing this code:
|
||||
folds those other events; only the render ignores them.
|
||||
- **Long pastes travel as chips.** A paste over three lines (the TUI's
|
||||
`PASTE_INLINE_LINES`) never lands in the composer; it stages as a
|
||||
droppable chip (`▣1 42L`) and embeds into the sent text as
|
||||
U+FFFC-payload-U+FFFC — the same record `rhema-core`'s
|
||||
`paste::embed` keeps — so the transcript renders each embed back as
|
||||
a chip in place of the payload. An unpaired mark is literal text.
|
||||
droppable chip (`▣1 42L`) and rides the body's `pastes` array beside
|
||||
the plain draft — the claw composes the record (the payload in
|
||||
place, the span note beside it) — so no mark ever crosses the wire.
|
||||
The `user_message` echo names each chip as the byte span it stands
|
||||
for (the session record's own shape, `paste::PasteSpan`), and the
|
||||
transcript renders from that. Rows recorded before spans rode the
|
||||
stream carry the legacy mark form in the text instead; the render
|
||||
still scans for those, and an unpaired mark stays literal.
|
||||
- **The agent can ask.** A `consent_request` event renders as an
|
||||
inline card: kind `secret` gets a password input plus submit, kind
|
||||
`phone` gets Approve/Deny, and both carry a deny link
|
||||
@@ -198,7 +202,8 @@ app/
|
||||
composables/
|
||||
useClaw.ts the typed API client + fetch-based SSE
|
||||
useTranscript.ts folds TurnEvents into renderable turn
|
||||
blocks; owns the paste-embed text form
|
||||
blocks; owns the paste span record (and
|
||||
the legacy mark form old rows carry)
|
||||
server/
|
||||
middleware/claw-proxy.ts dev-only same-origin proxy to a running claw
|
||||
```
|
||||
Reference in new issue
Block a user