Repairs two commits that I pushed with a failing gate.
64dab45 treated every `streaming: false` plain frame as a new segment.
That is wrong half the time: AstrBot sends both a block that restates
what the delta stream already carried and a block carrying text the
deltas never delivered, sometimes in the same reply — which is exactly
what the frame-trace fixtures in astrbot_client.rs were built to tell
apart, and I had written those fixtures myself. Treating a restatement as
new content would have shown it twice, and completing each block on
arrival left the two R2 sentinels with no open message to finalize, so a
truncated body and a cancellation both reported "stop".
Both the non-streaming plain frames and the complete frame now go through
one `reconcile`: emit only the byte-exact tail beyond what was shown, or
nothing if the text has already been shown allowing for different
whitespace, or open a message of its own if it diverges. Fixes a real
defect this exposed in `adopt_message_id`, which assigned the server's
bare id back over an active id that carried a reopen suffix, merging
blocks that had just been separated.
9b2ec64 added petEntry.test.ts importing node:fs. tsconfig.app.json sets
an explicit `types` array so Node globals are absent, and typecheck and
build both failed. Now imported as raw text through vite, rather than
adding Node's types to the compilation that covers the browser code.
Protocol tests 12 -> 19. Every new assertion was checked against a
deliberate regression, and the two that survived their first check —
dropping the byte-exact prefix case and dropping the whitespace-only
guard — now have tests that fail without them.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>