Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: complete fastn-p2p streaming API and remote shell functionality#2206

Closed
amitu wants to merge 0 commit into
main from
feature/fastn-p2p-streaming
Closed

feat: complete fastn-p2p streaming API and remote shell functionality #2206
amitu wants to merge 0 commit into
main from
feature/fastn-p2p-streaming

Conversation

@amitu

@amitu amitu commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

Summary

Complete implementation of fastn-p2p streaming API and remote shell functionality (rshell/rexec). This is the main tracking PR that implements the complete plan originally outlined in PR #2202, building on the fastn-context foundation from PR #2203.

🎯 Complete Implementation Plan

Phase 1: Basic fastn-context (Minimal) βœ… Completed

Phase 2: fastn-p2p Streaming API πŸ”„ In Progress

  • Add client module with connect() function
  • Implement client::Session with stdin/stdout streams
  • Add basic open_uni()/accept_uni() for stderr-like streams
  • Add server::Session with protocol negotiation and context integration
  • Add Session -> Request conversion (into_request())
  • Preserve existing Request methods (get_input, handle)
  • Basic context integration (sessions get context)
  • Current: PR feat: implement fastn-p2p streaming API foundation for remote shell functionality #2205 ⏳ (API foundation β†’ this feature branch)

Phase 3: Test and Validate ⏳ Next

  • Fill in TODO implementations with actual iroh streaming
  • Update fastn-p2p-test sender/receiver to use new API
  • Test both RPC (Session->Request) and streaming patterns
  • Validate iroh connection reuse works correctly
  • Scope: End-to-end P2P streaming validation

Phase 4: Remote Shell Integration ⏳ Final

  • Update fastn-remote to use fastn-p2p streaming API
  • Implement rshell using client::connect() -> Session
  • Implement server-side rshell using Session streams
  • Add stderr handling via open_uni()/accept_uni()
  • Test fastn rshell and fastn rexec commands work
  • Scope: Working remote shell over P2P

πŸ”— Related PRs

🎯 Success Criteria

  1. βœ… fastn-context integrated - Hierarchical contexts for debugging (PR feat: create fastn-context crate with hierarchical context system for debugging and operations #2203 )
  2. πŸ”„ Streaming API complete - Client/server Session types (PR feat: implement fastn-p2p streaming API foundation for remote shell functionality #2205 )
  3. ⏳ fastn-p2p-test passes - New streaming API validated (Phase 3)
  4. ⏳ fastn rshell works - Interactive shell over P2P (Phase 4)
  5. ⏳ fastn rexec works - Command execution with separate stderr (Phase 4)
  6. βœ… No regressions - Existing fastn-p2p call() functionality preserved

πŸ”§ API Overview

New Streaming API

// Client side streaming
let session = fastn_p2p::client::connect(our_key, target, protocol).await?;
session.stdin // Send to server
session.stdout // Receive from server
let stderr = session.accept_uni().await?; // Additional streams
// Server side with context
fn handle_session(session: fastn_p2p::server::Session<Protocol>) {
 let ctx = session.context(); // fastn-context integration
 let request = session.into_request(); // RPC compatibility
}

Minimal Breaking Changes

  • Add client::connect() function (new)
  • Add client::Session type (new)
  • Add server::Session type (new)
  • Add Session::into_request() method (new)
  • Keep all existing Request

    methods intact βœ…

πŸ“‹ Development Strategy

This feature branch allows us to:

  • Build incrementally through focused, reviewable PRs
  • Test continuously as each phase completes
  • Maintain compatibility throughout development
  • Review in chunks rather than one massive change

Goal: Working remote shell over P2P with minimal API surface for immediate use.

The comprehensive monitoring and ecosystem migration will come in follow-up PRs once the core streaming foundation is proven.

πŸ€– Generated with Claude Code

@amitu amitu closed this Sep 17, 2025
@amitu amitu force-pushed the feature/fastn-p2p-streaming branch from 505f5ca to 1762de3 Compare September 17, 2025 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /