Skip to content

CEP 6 step wise implementation #59

@kushagra0902

Description

@kushagra0902

CEP-6 Announcement Lifecycle Orchestrator

Overview

Currently, the ContextVM Rust SDK requires manual calls to announce(), publish_tools(), etc., lacking a unified lifecycle orchestrator. This epic implements the AnnouncementManager module for the server side, fully automating capability discovery, payload synthesis, and structured publishing to Nostr relays.


PR 1: Core Data Structures & Helpers

Goal: Establish the correct data shapes and helper functions required for CEP-6, ensuring strict schema compliance before touching the transport lifecycle.

  • Define ServerAnnouncementContent struct in src/core/types.rs matching the CEP-6 schema (nested protocolVersion, capabilities, serverInfo, instructions).
  • Create tag builder helpers and use existent ones(get_common_tags(), set_extra_tags(), set_pricing_tags()).
  • Update client-side parsing in src/discovery/mod.rs to handle the new ServerAnnouncementContent safely.
  • Test: Schema to Kind mapping (ensure kinds 11316-11320 serialize exactly as specified).

PR 2: AnnouncementManager Engine

Goal: Build the standalone orchestrator that manages the announcement lifecycle, fetching capabilities automatically.

  • Create new module: src/transport/server/announcement_manager.rs.
  • Implement publish_public_announcement(): Acts as the bootstrap point. Triggers synthetic initialize requests to the local MCP handler to fetch tools/list, resources/list, resourceTemplates/list, and prompts/list.
  • Implement publish_relay_list() (CEP-17 integration, will be hard coded for now at the required places and will be updated once cep 17 is done).
  • Implement publish_to_relay() to handle structured Nostr serialization.
  • Implement the background lifecycle loop to manage periodic republishing and connection state.
  • Test: Init timeout (verify graceful failure if no response from local MCP handler).

PR 3: Transport Integration & Cleanup

Goal: Wire the AnnouncementManager into the NostrServerTransport, enable it via configuration, and remove deprecated legacy code.

  • Add announce: bool to NostrServerTransportConfig.
  • Modify NostrServerTransport::start() to spawn the AnnouncementManager background task if config.announce == true.
  • Pass the local MCP channel to the manager so it can send its synthetic requests.
  • Clean up: Remove duplicate/legacy manual announcement functions from NostrServerTransport.
  • Test: Announcement manager publishes on start if announce: true is set.
  • Test: Start/stop lifecycle for the announcement manager.
  • Test: Verify bootstrap relays successfully receive discoverability events.

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