Repository navigation
feat: bots share files as cards in the chat - #125
Merged
Merged
Conversation
The bot passes 1 to 10 paths and each becomes a card in its chat. Only files the files panel could read are accepted (the crew's work folder, the bot's folder, or files it wrote), using the same check as files.read. The bot rules and the tool description ask for it when a file is done and when the owner asks for one again.
The command opens the system Save As dialog itself, so the page can never write anywhere the owner did not choose.
A successful share_file becomes one card per file, with the type icon or an image thumbnail, name, size, Open and Save as. Clicking the file opens its preview in the files panel. A failed call keeps the tool line.
Owner
Author
|
Manual test done in the real Tauri app (pnpm tauri dev, separate data folder, Claude Code 2.1.287, Opus 5.5): asked the lead for a short report saved as a file. It called share_file on its own and the card showed name, MD and size. Clicking the name opened the preview in the files panel. In the narrow chat, Save as showed only its icon and opened the Windows Save As dialog; the saved copy is byte-identical to the bot's file. "Send me that report again" brought a second card without the path in the text. No chat text in the daemon log at debug. |
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
Bots can now show the owner a file they made as a card in the chat, with Open and Save as…, instead of writing its path in the reply.
share_fileMCP tool (crates/botloftd/src/tools/share.rs): 1 to 10 paths. It only accepts files the files panel could already read: the crew's work folder, the bot's own folder, or files the bot wrote. This is the same checkfiles.readuses. Any other path rejects the whole call and tells the bot which file and why. The bot rules and the tool description ask for it when a file is done and when the owner asks for one again.save_file_asTauri command (app/src-tauri/src/save.rs): it opens the system Save As dialog itself and copies the file there, so the page can't write anywhere the owner didn't pick.app/src/features/chat/SharedFiles.tsx): type icon or image thumbnail, name, extension, size, Open and Save as. Clicking the file opens its preview in the files panel, including an older file the panel list leaves out. In a narrow chat, Save shows only its icon. If the call failed or its answer can't be read, the normal tool line stays.No DB or protocol change: the cards are drawn from the tool's answer, which the
toolchat item already stores. Texts are in all three languages. Spec updated in 5.1, 8.4, 10, 15.1, 15.2, 15.3 and 19.Checks
cargo fmt --check,clippy -D warnings,cargo test --workspace,pnpm check(286 tests)share_fileon its own. Then I asked "send me the report again" and it called it again without writing the path. Its first call sent a Windows path with unescaped\, which Claude Code rejects as invalid JSON, and the bot retried correctly. Because of that, the field description now asks for forward slashes. No chat text showed up in the daemon log, even at debug.Manual test