Skip to content

implement CEP-35 stateless session discovery and capability learning #43

@harsh04044

Description

@harsh04044

CEP-35 has been drafted (contextvm-docs PR ContextVM/contextvm-docs#39) and standardizes the runtime discovery exchange already present in the TS SDK.

Right now the rs-sdk can send and receive encrypted MCP messages and publish static announcements, but it never attaches capability tags to outbound messages, never reads capability tags from inbound messages, and never adapts its behavior based on what the peer supports.

This issue tracks porting the TS SDK's capability learning and discovery tag exchange behavior to the Rust SDK, following the CEP-35 spec as the implementation guide.

1. Discovery tags module (foundation)

2. Session store enhancement

3. Tag composition architecture

4. Client-side discovery tag emission

  • Add get_client_capability_tags(): constructs tags based on encryption mode and gift wrap mode
  • Add get_pending_client_discovery_tags() with one-shot flag (has_sent_discovery_tags)
  • Add build_outbound_client_tags(): composes routing + discovery tags
  • Wire into send(): attach discovery tags on first request, flip flag after send

5. Server-side discovery tag emission

6. Client-side capability learning

  • Add discovered_server_capabilities: PeerCapabilities to NostrClientTransport
  • Add server_initialize_event: Option<Event>: stores first event carrying discovery tags
  • Add learn_server_discovery(event): parses tags, OR-assigns capabilities, stores baseline event
  • Wire into client event loop: call after decryption, before correlation routing
  • Add public accessors: get_server_initialize_event(), discovered_server_capabilities()

7. Server-side capability learning

8. Announcement Manager refactor (deferred, last)

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions