By ninondev (#645). Squashed at the reviewed head 764fbfc.
Changes in packages/chat, 0.1.10 -> 0.1.11:
- Attachments reach the model:
- A .md, .markdown or .txt file, or any text/* file, is sent as UTF-8 text in a 【文档:name】 block. Bad bytes are an error, not mojibake.
- An image's data URL gets its real MIME type, even when the browser said application/octet-stream or gave no type.
- Send waits for every upload still in progress, not only the books.
- A failed upload is dropped with a toast. It no longer goes in as a local copy that skipped the size caps.
- Conversation saves:
- Writes are serialized per conversation id. Once a delete has gone through, any write still queued is skipped.
- A new conversation gets its id on the client up front. A save that finishes after the user has switched conversations no longer takes over the open one.
- Opening one conversation and then another quickly no longer shows the first.
- Tool history:
- The server sends a "round" event each turn of the tool loop, and the history is replayed round by round.
- Tool-call ids are unique across rounds (call_<round>_<i>).
- Each tool result is capped at 60000 chars, the same in the stream and in the history.
- A stop is checked before each tool call and after the MCP read.
- A connection-error card is not replayed to the model.
- epub-reader.test.mjs launches Chromium with --use-mock-keychain.
Run at 764fbfc on mote (macOS), each with HOME=$(mktemp -d):
- `bun test` (whole repo): 4857 pass, 14 skip, 0 fail, across 370 files.
- `bun test packages/chat`: 68 pass, 1 skip, 0 fail.
- `bun scripts/check.mjs`: exits 0.
- The epub browser test with EPUB_TEST_BROWSER set to Playwright's Chromium: 2 of 2 pass.
- A review-only end-to-end run (not committed) in Playwright Chromium and WebKit 1.62, at a 1100px width, with the real chat server and a fake gateway:
- It attaches scene.md (no MIME type) and photo.png (application/octet-stream), types a question and sends.
- It checks that the gateway got the markdown text, an image/png data URL and the typed text.
- It reloads, reopens the conversation from the sidebar and asks a follow-up. The history still has the markdown and the image, and there is exactly one saved conversation.
- All checks pass in both engines. With origin/main's packages/chat the same run fails 8 checks: the markdown and the image never reach the gateway.
Broken by hand:
- Without the per-round tool-call id dedupe, "tool history preserves round order ... repeated IDs" goes red.
- With only the first throwIfAborted removed, the stop tests stay green, because the second check covers it.
Read for harm: no new hosts, no credential or keychain access, no dependencies.
Not tried: a real model or real MCP servers behind magpie's gateway.