feat(desktop+gateway): remote-gateway file attachments via file.attach#42634
Merged
Conversation
@file: attachments now work when the desktop is connected to a remote gateway. Previously a referenced file resolved to a client-disk path the gateway couldn't see, so context_references rejected it with "path is outside the allowed workspace" and the agent never saw the file. Adds a file.attach RPC (sibling to the existing image.attach_bytes / pdf.attach byte-upload pipeline): the desktop uploads the file bytes, the gateway stages them into <workspace>/.hermes/desktop-attachments/ and returns a workspace-relative @file: ref that resolves cleanly. Local mode passes the path directly; a gateway-visible file outside the workspace is copied in; an in-workspace file is referenced as-is with no copy. Consolidates the file-sync design from #38615 (LeonSGP43) and the host-file-staging idea from #33455 (Carry00), rebased onto the image/PDF remote-media helpers already on main. Co-authored-by: LeonSGP43 <cine.dreamer.one@gmail.com>
Contributor
🔎 Lint report:
|
GodsBoy
added a commit
to GodsBoy/hermes-agent
that referenced
this pull request
Jun 9, 2026
Resolve gateway/run.py conflict with NousResearch#42634, which split the terminal fenced block into a full (verbose) and a single-line capped (non-verbose) variant. Keep the terminal_progress knob gate on the build condition so compact still falls through to the truncated preview in both modes, and adopt the _code_block_full / _code_block_short variables for rendering. Update test_terminal_progress_explicit_code_block_still_renders to assert the capped first-line fence in non-verbose mode rather than the full command.
14 tasks
6 tasks
Zkh-dot
added a commit
to Zkh-dot/hermes-agent
that referenced
this pull request
Jun 11, 2026
Upstream NousResearch#42634 (not in v0.14.0) made markdown-capable gateways render terminal commands as a two-line fenced code block in the tool-progress bubble. Next to the other one-line entries it reads as broken output, so drop the special case: terminal uses the same compact 'terminal: "cmd..."' preview as every other tool, in all modes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Desktop file attachments (
@file:CSVs, PDFs-as-text, logs, etc.) now work when connected to a remote gateway. Before, a referenced file resolved to a path on the client's disk that the gateway couldn't see, socontext_referencesrejected it with "path is outside the allowed workspace" and the agent never read the file — the #1 friction point for remote desktop users.Changes
tui_gateway/server.py— newfile.attachRPC, sibling to the existingimage.attach_bytes/pdf.attachbyte-upload pipeline. Stages a non-image file into<workspace>/.hermes/desktop-attachments/and returns a workspace-relative@file:ref that resolves cleanly. Three cases:data_urlbytes_stage_session_file_attachment,_decode_attachment_data_url(any-mime, unlike the image-only decoder),_attachment_ref_path,_format_ref_value(backtick-quotes refs with spaces), sanitization + unique-naming.DESKTOP_BACKEND_CONTRACT1 → 2.apps/desktop—syncImageAttachmentsForSubmit→syncAttachmentsForSubmit: keeps the image path (localimage.attach, remoteimage.attach_bytes) and adds afilebranch that uploads bytes viafile.attachin remote mode / passes the path in local mode, then rewrites the prompt's@file:ref to the gateway-relative path beforeprompt.submit. NewFileAttachResponsetype;REQUIRED_BACKEND_CONTRACT1 → 2.Validation
@file:CSV/textpath is outside the allowed workspace, agent blind@file:file.attach, no copy)13 passedon the attach/contract subset.@file:.hermes/desktop-attachments/...→expanded=True, warnings=[], CSV rows injected; negative control (raw/Users/...path) still reproduces the originalpath is outside the allowed workspacewarning.Consolidation & credit
Consolidates the competing remote-file-attach PRs onto current
main(which already carries the image/PDF byte-upload helpers):file.attach+ workspace staging + ref rewrite). Preserved viaCo-authored-by.Both originals will be closed pointing here.
Out of scope
@folder:) attachments on remote gateways — a directory tree isn't a single byte upload; left as a follow-up (passes through unchanged today). Image/PDF remote attach already landed separately onmain.Infographic