From ff54d6b6100f41e7856ccf2182cc7bf42748fb1a Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Jan 2026 21:29:53 +0000 Subject: [PATCH] fix: reorder chat adapters - specific adapters before NIP-22 fallback NIP-22 should be tried last as it accepts any event kind (except kind 1). More specific adapters (NIP-29 for kind 39000, NIP-53 for kind 30311) must be tried first to ensure proper protocol routing. --- src/lib/chat-parser.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/chat-parser.ts b/src/lib/chat-parser.ts index 740b210..61b97dc 100644 --- a/src/lib/chat-parser.ts +++ b/src/lib/chat-parser.ts @@ -64,13 +64,14 @@ export function parseChatCommand(args: string[]): ChatCommandResult { } // Try each adapter in priority order + // More specific adapters first, NIP-22 last as fallback const adapters = [ new Nip10Adapter(), // NIP-10 - Thread chat (kind 1 notes only) - new Nip22Adapter(), // NIP-22 - Comment threads (any kind except kind 1) // new Nip17Adapter(), // Phase 2 // new Nip28Adapter(), // Phase 3 - new Nip29Adapter(), // Phase 4 - Relay groups - new Nip53Adapter(), // Phase 5 - Live activity chat + new Nip29Adapter(), // Phase 4 - Relay groups (kind 39000) + new Nip53Adapter(), // Phase 5 - Live activity chat (kind 30311) + new Nip22Adapter(), // NIP-22 - Comment threads (fallback for all other kinds) // new NipC7Adapter(), // Phase 1 - Simple chat (disabled for now) ];