Skip to content

Conversation

@amitu
Copy link
Contributor

@amitu amitu commented Sep 17, 2025

Summary

Main Tracking PR: Complete implementation of fastn-p2p streaming API and remote shell functionality (rshell/rexec). This PR tracks 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 APICompleted

  • 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)
  • Completed: PR feat: implement fastn-p2p streaming API foundation for remote shell functionality #2205 ✅ (merged to this feature branch)

Phase 3: Test and ValidateNext

  • 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 IntegrationNext

  • 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

🔧 Current Implementation

This feature branch now contains the complete streaming API foundation:

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
}

🎯 Current Status

Phase 2 is complete with the streaming API foundation in place:

  • Client streaming API: client::connect(), client::Session with stdin/stdout
  • Server streaming API: server::Session with context integration
  • Multi-stream support: uni/bi directional streams for stderr, etc.
  • RPC compatibility: Session::into_request() preserves existing patterns
  • Context integration: Sessions work with fastn-context
  • Zero breaking changes: All existing fastn-p2p APIs preserved
  • 🔧 TODO implementations: Ready for actual iroh streaming logic

🎯 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 foundation - 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

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

🤖 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:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants