Repository navigation
Upload any file from the key bar beside the image button - #65
Merged
Merged
Conversation
Agents can read more than images: logs, PDFs, archives and source files are just as useful in a prompt, but the key bar could only send pictures. A new paperclip button next to the image button sends any file up to 3 MB as is, and the host saves it under its UUID plus a sanitized name and pastes the path back, exactly like an image. Files travel as paste_file with MIME application/octet-stream and a name. The relay and the host both sanitize the name so it can never act as a path and needs no shell quoting. Hosts announce paste_any_file; the relay refuses files for older hosts up front instead of letting them fail after upload.
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.
What
A paperclip button next to the key bar's image upload button sends any file (up to 3 MB) to the workstation. The host saves it and the path is pasted into the terminal, just like an image upload.
How
paste_filenow also acceptsmime: "application/octet-stream"with aname. New sharedPASTE_FILE_MIMEandsanitizePasteFileName(no directories, no leading dots, only letters/digits/._-, at most 120 chars, extension kept). New capabilitypaste_any_file.paste_file_host_outdatedwhen the host doesn't advertisepaste_any_file, so the whole payload isn't sent to a host that would reject it.<uuid>-<sanitized name>(0600, same pinned dir, size cap and pruning). The name is sanitized again on the host.UploadButton(image / file kinds), a hidden picker that accepts any type, anduploadFilein the upload hook. Files over the limit are refused before reading. Only the button that started an upload shows the percentage.docs/protocol.md, README (en/zh).Tests
npm run checkandnpm testpass.