Skip to content

implement CEP-6 public server announcements (full lifecycle) #76

@harsh04044

Description

@harsh04044

This issue tracks closing the gap with the TS SDK's CEP-6 implementation, using the spec and TS SDK AnnouncementManager as the reference.

Supersedes #59 which had a higher-level plan.

1. Core data structures (foundation)

  • Event kind constants: SERVER_ANNOUNCEMENT_KIND (11316), TOOLS_LIST_KIND (11317), RESOURCES_LIST_KIND (11318), RESOURCETEMPLATES_LIST_KIND (11319), PROMPTS_LIST_KIND
    (11320) in src/core/constants.rs
  • Tag name constants: NAME, ABOUT, WEBSITE, PICTURE, SUPPORT_ENCRYPTION, SUPPORT_ENCRYPTION_EPHEMERAL in src/core/constants.rs
  • DEFAULT_BOOTSTRAP_RELAY_URLS constant (6 relay URLs for CEP-17 discoverability) in src/core/constants.rs
  • UNENCRYPTED_KINDS array containing all 5 announcement kinds in src/core/constants.rs
  • ServerInfo struct with builder pattern (name, version, picture, website, about) in src/core/types.rs
  • ServerAnnouncement struct for client-side parsing (pubkey, server_info, event_id, created_at) in src/discovery/mod.rs
  • is_announced_server: bool config flag in NostrServerTransportConfig
  • ProfileMetadata struct with name, about, picture, banner, website, nip05, lud16 + #[serde(flatten)] extra for custom fields (CEP-23) (feat: add ProfileMetadata type and update ServerAnnouncement parsing (CEP-6) #77)
  • ServerAnnouncementContent struct - not needed. We serialize rmcp's raw InitializeResult directly as kind 11316 content, same as the TS SDK.

2. Server-side announcement publishing

  • announce() → kind 11316 with ServerInfo content + common tags
  • publish_tools(Vec<serde_json::Value>) → kind 11317
  • publish_resources(Vec<serde_json::Value>) → kind 11318
  • publish_prompts(Vec<serde_json::Value>) → kind 11320
  • publish_resource_templates(Vec<serde_json::Value>) → kind 11319
  • delete_announcements(reason) → NIP-09 kind 5 for all announcement kinds
  • RMCP-typed publish variants: publish_tools_typed(), publish_resources_typed(), publish_prompts_typed(), publish_resource_templates_typed()
  • extra_common_tags and pricing_tags setters on transport
  • Add d tag to all replaceable events — not needed. Kinds 11316–11320 are standard replaceable (10000–19999 per NIP-01), replaced by pubkey+kind only. TS SDK doesn't add one either.
  • Publish full InitializeResult as kind 11316 content (protocol_version, capabilities, server_info, instructions) instead of ServerInfo only (feat: auto-publish server announcements on start (CEP-6) #78 )

3. Client-side discovery

  • discover_servers() → fetches kind 11316, returns Vec<ServerAnnouncement>
  • discover_tools() → fetches kind 11317
  • discover_resources() → fetches kind 11318
  • discover_prompts() → fetches kind 11320
  • discover_resource_templates() → fetches kind 11319
  • RMCP-typed discovery variants: discover_tools_typed(), discover_resources_typed(), discover_prompts_typed(), discover_resource_templates_typed()
  • Update ServerAnnouncement parsing to handle ServerAnnouncementContent (extract protocol_version, capabilities alongside server_info) (feat: add ProfileMetadata type and update ServerAnnouncement parsing (CEP-6) #77 )

4. Discovery tag emission & learning (done via CEP-35)

5. AnnouncementManager orchestrator

6. Relay list & profile metadata publishing

7. Tests

Reference

  • CEP-6 spec: contextvm-docs/src/content/docs/spec/ceps/cep-6.md
  • TS SDK AnnouncementManager: sdk/src/transport/nostr-server/announcement-manager.ts (721 LOC, 17 tests)
  • TS SDK SessionStore: sdk/src/transport/nostr-server/session-store.ts (hasSentCommonTags tracking)
  • TS SDK constants: sdk/src/core/constants.ts (event kinds 11316–11320)
  • rs-sdk existing implementation: src/transport/server/mod.rs:669-897 (publish methods + tag helpers)
  • rs-sdk discovery: src/discovery/mod.rs (client-side discovery API)
  • rs-sdk constants: src/core/constants.rs (kinds + tags)
  • rs-sdk types: src/core/types.rs (ServerInfo, ClientSession)

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