Skip to content

feat(desktop+gateway): remote-gateway file attachments via file.attach#42634

Merged
teknium1 merged 1 commit into
mainfrom
feat/remote-file-attach
Jun 9, 2026
Merged

feat(desktop+gateway): remote-gateway file attachments via file.attach#42634
teknium1 merged 1 commit into
mainfrom
feat/remote-file-attach

Conversation

@teknium1

@teknium1 teknium1 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

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, so context_references rejected 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 — new file.attach RPC, sibling to the existing image.attach_bytes / pdf.attach byte-upload pipeline. Stages a non-image file into <workspace>/.hermes/desktop-attachments/ and returns a workspace-relative @file: ref that resolves cleanly. Three cases:
    1. file already inside the workspace → ref as-is (no copy)
    2. gateway-visible file outside the workspace → copy in
    3. client-only path (the remote case) → decode uploaded data_url bytes
    • Helpers: _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_CONTRACT 1 → 2.
  • apps/desktopsyncImageAttachmentsForSubmitsyncAttachmentsForSubmit: keeps the image path (local image.attach, remote image.attach_bytes) and adds a file branch that uploads bytes via file.attach in remote mode / passes the path in local mode, then rewrites the prompt's @file: ref to the gateway-relative path before prompt.submit. New FileAttachResponse type; REQUIRED_BACKEND_CONTRACT 1 → 2.

Validation

Before After
Remote @file: CSV/text path is outside the allowed workspace, agent blind bytes uploaded → staged → ref resolves, content injected
Local @file: path passed through unchanged (path passed via file.attach, no copy)
In-workspace file ref as-is ref as-is, no redundant copy
  • 5 new gateway tests + 2 desktop hook tests; existing image/submit/queue tests unchanged. 13 passed on the attach/contract subset.
  • E2E verified the full round-trip through the exact code that errored: staged ref @file:.hermes/desktop-attachments/...expanded=True, warnings=[], CSV rows injected; negative control (raw /Users/... path) still reproduces the original path is outside the allowed workspace warning.

Consolidation & credit

Consolidates the competing remote-file-attach PRs onto current main (which already carries the image/PDF byte-upload helpers):

Both originals will be closed pointing here.

Out of scope

  • Folder (@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 on main.

Infographic

remote-gateway file attachments

@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>
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: feat/remote-file-attach vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10598 on HEAD, 10569 on base (🆕 +29)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5557 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Jun 9, 2026
@teknium1 teknium1 merged commit dbbd1d4 into main Jun 9, 2026
23 checks passed
@teknium1 teknium1 deleted the feat/remote-file-attach branch June 9, 2026 07:03
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.
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants