Repository navigation
Conversation
zeron.write_file(path, data, { base64 }) with a new "files.write"
permission: a relative path lands in ~/Documents/<plugin name>/, a whole
one must be inside one of this device's chats' or projects' folders.
Folders on the way are made; .., links out and links at the file are
refused. Tool calls also carry the chat's folder (call.cwd) when the
plugin has sessions.read, so an agent's export can go where its work is.
Contributor
Author
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.
A plugin's service can't write a file. An agent asking a design plugin to export its screens gets PNGs and HTML back as base64 in the tool result, and then has to save them itself. A 50-screen export doesn't fit in a result at all.
Now a service has
zeron.write_file(path, data, { base64 }), behind a newfiles.writepermission:~/Documents/<plugin name>/…, where the person can find it.zeron.folders()gives..., a folder that is a link leading out, and a file that is a link are refused. 64 MB at most per file. The result is{ path, bytes }.Tool calls also carry the chat's folder as
call.cwdwhen the plugin hassessions.readand the chat is on this device, so an agent's export can go into the project it's working in.The Allow sheet shows the new permission as "Save files in its Documents folder and your projects".
Testing
cargo test -p zeron-engine --lib plugins::servicepasses (36 tests).files::testscovers relative paths into Documents, whole paths inside and outside a chat's folder,.., a folder as the target, bad base64, and on Unix a link out and a link at the file.a_service_writes_files_only_in_a_chats_folder_with_files_writeruns a real service: it writes a PNG from base64, is refused outside the chat folders, and is refused without the permission.a_tool_call_says_its_chats_folder_with_sessions_readchecks thatcall.cwdis set for a chat on this device, absent for a chat on another device, and absent withoutsessions.read.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.