Repository navigation
feat(remote-threads): a paired device can send documents with a thread message and read them back - #2505
Merged
Conversation
…d message and read them back
… thread send that carries files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A paired phone or computer could send only pictures into a thread on this computer. Any other file was refused, because a file attached here goes to the agent as a path on this computer, and nothing carried another device's file onto it. The phone app therefore can't attach a PDF, a text file or an Office document to a thread, and it can't open such a file it sees in a transcript.
Change
routed.orchestrator.send(version 11) androuted.queue.enqueue(version 4) takefiles: [{ name, data }](datais base64), inline or staged as one value onrouted.send.open, the same resumable bulk lane pictures use. Needs chat access, as any send does; a read-only device is refused before anything is written.src/mms/bridge/routed/threadFiles.ts): at most 10 files and 18 MiB together (as base64 JSON that stays inside one 25 MiB staged value). Each name is made safe (no folders, no reserved Windows names). Its extension must be on the list insrc/shared/bridge/threadFiles.ts, and its first bytes must match:%PDF-for PDF, a ZIP header for docx/xlsx/pptx/odt/epub/zip, an OLE header for doc/xls/ppt, gzip/7z/tar headers, and UTF-8 or UTF-16-with-BOM text with no zero bytes for text, data and code. Programs, installers, Windows script files, macro-enabled Office files and SVG are refused, as is anything whose bytes don't match its name.wx(never over another file) and mode 600 into<temp>/mousse-attachments/<threadId>/<unique>-<name>. That is the folder where a file pasted into the composer already goes, with the same one-week cleanup. The message text gets the usual[Attached files: name (path)]line, so every provider reads the file as a local attachment. Nothing opens or runs it. A refused message deletes its files. The ledger's request id keeps a retried send from writing them twice.routed.thread.attachedFile{ threadId, path, offset? }. It returns 40 KiB pages shaped likebots.chat.file, but only for a file directly in that thread's attachment folder, reached by real path, not through a link or hard link, and never SVG.net.infonow carriesthreadFiles: { v: 1, maxFiles, maxBytes, extensions }. A phone that checks it never sends files to an older desktop. The spec is updated in docs(app-session): a thread send may carry files where the host advertises threadFiles mousse-net#61 (merged, docs and one vector), and the vendored vectors now come from that merge.bots.send.open,bots.chat.file); they are unchanged too.Verification
Tier 5 (networking and security).
node scripts/verify.mjsat a605e11, recorded as current:npx vitest run tests/net/bridge/routed/threadFiles.test.ts tests/net/bridge/routed/threadFilesSend.test.ts tests/net/bridge/routed/table.test.ts tests/net/bridge/routed/owner.test.ts tests/net/bridge/routed/access.test.ts tests/net/bridge/routed/accessClasses.test.ts tests/net/bridge/routed/sendManifest.test.ts tests/net/bridge/routed/ids.test.ts tests/gitAccessTable.test.ts tests/mmsProtocolServer.test.ts tests/netEngine/allowlist.test.ts tests/netEngine/appSessionVectors.test.ts tests/fileDrag.test.ts tests/bots/botChatAttachments.test.ts tests/net/connectedHere.test.tstsc --noEmit -p tsconfig.node.jsonandtsc --noEmit -p tsconfig.web.jsonWhat observes each part:
.., a relative path, a hard link, SVG):threadFiles.test.ts(33 rows).threadFilesSend.test.ts. The same file covers a queued message, a disallowed type, an.exenamed.pdf, a refused send leaving no file, files over 18 MiB on the bulk lane, a read-only device refused on both the send andsend.open, and a dropped bulk upload resumed from the saved offset and then sent twice under one request id (one send, three files).thread send carries files:appSessionVectors.test.ts.Not checked by these runs:
filesyet.tests/net/bridge/routed/staging.test.ts(untouched code) timed out on this PC while other work held the CPU at 100%. It fails the same way on unchanged master in the same conditions.Notes
A desktop composer sending documents to a thread on another computer still refuses them ("threads on another computer take images only"); it can use this owner side in a follow-up. Files the user picked from elsewhere on disk (not pasted) are not served by
thread.attachedFile.No issue