Skip to content

Add approved transfers and cross-session Files - #17

Merged
askac merged 6 commits into
mainfrom
feature/external-agent-file-transfer
Sep 1, 2026
Merged

Add approved transfers and cross-session Files#17
askac merged 6 commits into
mainfrom
feature/external-agent-file-transfer

Conversation

@askac

@askac askac commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Release impact

Minor release: v2.9.0

Why

External agents can operate attached terminal streams but have no bounded backend path for copying a file between SSH and Local Shell endpoints. Human operators are limited to an SSH-only SFTP window and cannot copy directly between live tabs; selecting a file can also look like a completed download before the explicit Download action. A running browser copy additionally needs one clear cancellation control and an explicit commit boundary.

What changed

  • Add typed file_copy proposals with two terminal-scoped capabilities, canonical plans, explicit per-copy browser approval, regular-file and conflict checks, and fail-closed endpoint or source mutation handling.
  • Run agent and human transfers through a shared bounded asynchronous transaction with byte progress, immutable terminal outcomes, logical self-copy rejection, duplicate correlation, and atomic publish handling; preserve fresh agent approval even in Full mode.
  • Replace the visible SFTP File Manager with Files on SSH and supported POSIX Local Shell tabs, add an explicit Copy to destination browser, and make file selection visibly distinct from Download.
  • Allow browser copies to cancel before the atomic publish barrier, remove the duplicate destination close icon, and explain when Files must remain open; preserve the non-cancellable committing fallback once publishing starts.
  • Add agent_scp.py, CLI/MCP integration, and a dedicated file-transfer skill; preserve legacy SFTP routes/events and show Files unavailable when a Local Shell platform lacks anchored POSIX operations.

Testing

  • Covered backend authorization, approval, transaction transitions, cancellation serialization, progress, worker bounds, conflicts, duplicate requests, Local/SSH relay, logical self-copy rejection, startup failures, source mutation, and ambiguous SSH publish outcomes.
  • Covered Chromium Files availability, selected-file highlighting, explicit Download, destination browsing, typed cross-tab copy and cancel requests, copy-id event binding, close guidance, commit-barrier UI, cross-tab approval, and unchanged ordinary-command approval scope.
  • Passed the complete headless smoke runner and complete Chromium smoke suite; GitHub required checks pass on the final branch commit.

## Why

External agents can operate visible terminal streams but cannot copy a file directly between attached SSH or Local Shell backends. The terminal-stream rescue path exposes payload bytes and has no dedicated per-operation file approval.

## What changed

- Add typed backend copies with two terminal-scoped tokens and fresh browser approval.
- Stream one regular file between SSH and POSIX Local Shell endpoints with fail-default conflict handling.
- Preserve sources and the terminal-stream rescue fallback while failing closed on endpoint or snapshot changes.
- Add CLI and MCP helpers plus a dedicated file-transfer skill without silently downgrading transports.

## Testing

Backend, boundary, REPL, and browser smoke coverage includes approval, authorization, conflicts, endpoint mutation, source mutation, and ambiguous SSH publish outcomes.
## Why
Approved file copies keep the browser decision handler occupied while a transfer runs, so large uploads delay visible status and duplicate clicks can report a false failure.

## What changed
- Run approved copies as bounded background work and expose throttled byte progress.
- Show file-copy approval across terminal tabs and preserve monotonic action outcomes.
- Keep per-copy browser approval mandatory, including Full mode.
- Preserve typed query and fail-closed rescue fallback behavior.

## Testing
- Backend lifecycle, non-blocking approval, duplicate decisions, progress, worker bounds, SFTP timeouts, and cleanup behavior.
- Browser cross-tab approval, stale progress rejection, decision latching, and ordinary command scope.
- CLI, MCP boundary, rescue helper, and static-site compatibility.
## Why

External Agent bootstrap and token handoff files use the launch directory, which can place transient writes in the checkout. Local Shell processes expose only a generic terminal capability even though the xterm.js frontend supports 24-bit color.

## What changed

- Resolve agentinfo and handoff files under an instance-scoped per-user runtime root, while preserving URL-first discovery and explicit overrides.
- Remove owned runtime artifacts on graceful shutdown and retain token invalidation as the crash fallback.
- Update the published and installable skills to consume runtime-resolved handoff paths.
- Keep TERM=xterm-256color while declaring Local Shell truecolor and StandTerm identity; leave SSH PTY negotiation unchanged.

## Testing

Covers platform path resolution, restrictive runtime files, cleanup ownership, External Agent boundaries and helpers, browser approval flows, skill validation, and Local Shell environment capabilities.
## Why

The browser compares a WSL wall-clock deadline with the Windows clock, so cross-OS clock skew rejects fresh signing requests. The backend also discards the browser's specific rejection detail.

## What changed

- Advertise a bounded relative timeout and validate it with browser monotonic time.
- Enforce the authoritative backend deadline with monotonic time while retaining the wall-clock expiry for diagnostics.
- Surface sanitized, length-limited browser rejection details while preserving SID, profile, key, and challenge binding with no password fallback.

## Testing

Covered browser wall-clock skew, backend wall-clock jumps, fail-closed request handling, browser integration, static-site validation, and external-agent boundaries.
@askac askac added the enhancement New feature or request label Sep 1, 2026
## Why

The file manager is limited to direct SSH tabs and selecting a file can look like a completed download. Human operators cannot browse Local Shell files or copy a file directly between live terminal endpoints.

## What changed

- Expose Files on SSH and supported POSIX Local Shell tabs while preserving the legacy SFTP event and route compatibility.
- Add an explicit Copy to workflow that shares the bounded backend stream and atomic publish path while retaining fresh approval for agent-initiated copies.
- Reject logical self-copies, correlate duplicate requests, and preserve terminal transaction outcomes across late events and startup failures.
- Highlight selection without downloading; retain explicit Download, conflict handling, and unavailable-platform fallbacks.

## Testing

- Backend coverage includes Local Shell file actions, human cross-tab copies, conflicts, duplicate requests, state transitions, startup failure, and same-file rejection.
- Browser coverage includes Files availability, selection semantics, explicit downloads, destination browsing, typed copy requests, and copy-id event binding.
@askac askac changed the title Add approved external-agent file transfers Add approved transfers and cross-session Files Sep 1, 2026
@askac
askac merged commit 468eaf6 into main Sep 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant