From 3deca8ec56146669cecd66566ffc28c98d8d853b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 28 Jan 2026 19:23:11 +0000 Subject: [PATCH] chore: remove NIP-C7 references from docs and code - Remove nip-c7 from ChatProtocol type - Remove commented NIP-C7 adapter imports and switch cases - Update comments to reference NIP-29 instead of NIP-C7 - Update kind 9 renderer docs to reference NIP-29 - Clean up chat-parser docs and error messages https://claude.ai/code/session_01Jy51Ayk57fzaFuuFFm1j1K --- src/components/ChatViewer.tsx | 3 --- src/components/DynamicWindowTitle.tsx | 3 --- src/components/nostr/kinds/ChatMessageRenderer.tsx | 4 ++-- src/components/nostr/kinds/index.tsx | 2 +- src/lib/chat-parser.test.ts | 2 +- src/lib/chat-parser.ts | 9 +++------ src/lib/chat/adapters/nip-29-adapter.ts | 6 +++--- src/types/chat.ts | 12 +++--------- 8 files changed, 13 insertions(+), 28 deletions(-) diff --git a/src/components/ChatViewer.tsx b/src/components/ChatViewer.tsx index c5737db..efd7d23 100644 --- a/src/components/ChatViewer.tsx +++ b/src/components/ChatViewer.tsx @@ -26,7 +26,6 @@ import type { LiveActivityMetadata, } from "@/types/chat"; import { CHAT_KINDS } from "@/types/chat"; -// import { NipC7Adapter } from "@/lib/chat/adapters/nip-c7-adapter"; // Coming soon import { Nip10Adapter } from "@/lib/chat/adapters/nip-10-adapter"; import { Nip29Adapter } from "@/lib/chat/adapters/nip-29-adapter"; import { Nip53Adapter } from "@/lib/chat/adapters/nip-53-adapter"; @@ -1243,8 +1242,6 @@ function getAdapter(protocol: ChatProtocol): ChatProtocolAdapter { switch (protocol) { case "nip-10": return new Nip10Adapter(); - // case "nip-c7": // Phase 1 - Simple chat (coming soon) - // return new NipC7Adapter(); case "nip-29": return new Nip29Adapter(); // case "nip-17": // Phase 2 - Encrypted DMs (coming soon) diff --git a/src/components/DynamicWindowTitle.tsx b/src/components/DynamicWindowTitle.tsx index 0ab9d65..a3575ee 100644 --- a/src/components/DynamicWindowTitle.tsx +++ b/src/components/DynamicWindowTitle.tsx @@ -24,7 +24,6 @@ import { getEventDisplayTitle } from "@/lib/event-title"; import { UserName } from "./nostr/UserName"; import { getTagValues } from "@/lib/nostr-utils"; import { getSemanticAuthor } from "@/lib/semantic-author"; -// import { NipC7Adapter } from "@/lib/chat/adapters/nip-c7-adapter"; // Coming soon import { Nip29Adapter } from "@/lib/chat/adapters/nip-29-adapter"; import type { ChatProtocol, ProtocolIdentifier } from "@/types/chat"; import { useState, useEffect } from "react"; @@ -742,8 +741,6 @@ function useDynamicTitle(window: WindowInstance): WindowTitleData { // Currently only NIP-29 is supported const getAdapter = () => { switch (protocol) { - // case "nip-c7": // Coming soon - // return new NipC7Adapter(); case "nip-29": return new Nip29Adapter(); default: diff --git a/src/components/nostr/kinds/ChatMessageRenderer.tsx b/src/components/nostr/kinds/ChatMessageRenderer.tsx index b39e358..bf7c70f 100644 --- a/src/components/nostr/kinds/ChatMessageRenderer.tsx +++ b/src/components/nostr/kinds/ChatMessageRenderer.tsx @@ -9,13 +9,13 @@ import { isValidHexEventId } from "@/lib/nostr-validation"; import { InlineReplySkeleton } from "@/components/ui/skeleton"; /** - * Renderer for Kind 9 - Chat Message (NIP-C7) + * Renderer for Kind 9 - Chat Message (NIP-29) * Displays chat messages with optional quoted parent message */ export function Kind9Renderer({ event, depth = 0 }: BaseEventProps) { const { addWindow } = useGrimoire(); - // Parse 'q' tag for quoted parent message (NIP-C7 reply format) + // Parse 'q' tag for quoted parent message const quotedEventIds = getTagValues(event, "q"); const quotedEventId = quotedEventIds[0]; // First q tag diff --git a/src/components/nostr/kinds/index.tsx b/src/components/nostr/kinds/index.tsx index 8add925..4d38bc8 100644 --- a/src/components/nostr/kinds/index.tsx +++ b/src/components/nostr/kinds/index.tsx @@ -172,7 +172,7 @@ const kindRenderers: Record> = { 6: RepostRenderer, // Repost 7: Kind7Renderer, // Reaction 8: BadgeAwardRenderer, // Badge Award (NIP-58) - 9: Kind9Renderer, // Chat Message (NIP-C7) + 9: Kind9Renderer, // Chat Message (NIP-29) 11: Kind1Renderer, // Public Thread Reply (NIP-10) 16: RepostRenderer, // Generic Repost 17: Kind7Renderer, // Reaction (NIP-25) diff --git a/src/lib/chat-parser.test.ts b/src/lib/chat-parser.test.ts index d0f430c..80f010d 100644 --- a/src/lib/chat-parser.test.ts +++ b/src/lib/chat-parser.test.ts @@ -89,7 +89,7 @@ describe("parseChatCommand", () => { ); }); - it("should throw error for npub (NIP-C7 disabled)", () => { + it("should throw error for npub (DMs not yet supported)", () => { expect(() => parseChatCommand(["npub1xyz"])).toThrow( /Unable to determine chat protocol/, ); diff --git a/src/lib/chat-parser.ts b/src/lib/chat-parser.ts index a393740..3ddf3f9 100644 --- a/src/lib/chat-parser.ts +++ b/src/lib/chat-parser.ts @@ -1,5 +1,4 @@ import type { ChatCommandResult, GroupListIdentifier } from "@/types/chat"; -// import { NipC7Adapter } from "./chat/adapters/nip-c7-adapter"; import { Nip10Adapter } from "./chat/adapters/nip-10-adapter"; import { Nip29Adapter } from "./chat/adapters/nip-29-adapter"; import { Nip53Adapter } from "./chat/adapters/nip-53-adapter"; @@ -17,7 +16,6 @@ import { nip19 } from "nostr-tools"; * 3. NIP-28 (channels) - specific event format (kind 40) * 4. NIP-29 (groups) - specific group ID format * 5. NIP-53 (live chat) - specific addressable format (kind 30311) - * 6. NIP-C7 (simple chat) - fallback for generic pubkeys * * @param args - Command arguments (first arg is the identifier) * @returns Parsed result with protocol and identifier @@ -67,9 +65,8 @@ export function parseChatCommand(args: string[]): ChatCommandResult { new Nip10Adapter(), // NIP-10 - Thread chat (nevent/note) // new Nip17Adapter(), // Phase 2 // new Nip28Adapter(), // Phase 3 - new Nip29Adapter(), // Phase 4 - Relay groups - new Nip53Adapter(), // Phase 5 - Live activity chat - // new NipC7Adapter(), // Phase 1 - Simple chat (disabled for now) + new Nip29Adapter(), // NIP-29 - Relay groups + new Nip53Adapter(), // NIP-53 - Live activity chat ]; for (const adapter of adapters) { @@ -106,6 +103,6 @@ Currently supported formats: chat naddr1... (group list address) More formats coming soon: - - npub/nprofile/hex pubkey (NIP-C7/NIP-17 direct messages)`, + - npub/nprofile/hex pubkey (NIP-17 direct messages)`, ); } diff --git a/src/lib/chat/adapters/nip-29-adapter.ts b/src/lib/chat/adapters/nip-29-adapter.ts index 79c7601..4cb4646 100644 --- a/src/lib/chat/adapters/nip-29-adapter.ts +++ b/src/lib/chat/adapters/nip-29-adapter.ts @@ -459,7 +459,7 @@ export class Nip29Adapter extends ChatProtocolAdapter { }, ); - // Add q-tag for replies (per NIP-C7 quote tag format) + // Add q-tag for replies (quote tag format) // Format: ["q", eventId, relayUrl, pubkey] if (options?.replyTo) { // Look up the event to get the author's pubkey for the q-tag @@ -554,7 +554,7 @@ export class Nip29Adapter extends ChatProtocolAdapter { getCapabilities(): ChatCapabilities { return { supportsEncryption: false, // kind 9 messages are public - supportsThreading: true, // q-tag replies (NIP-C7 style) + supportsThreading: true, // q-tag replies supportsModeration: true, // kind 9005/9006 for delete/ban supportsRoles: true, // admin, moderator, member supportsGroupManagement: true, // join/leave via kind 9021 @@ -1117,7 +1117,7 @@ export class Nip29Adapter extends ChatProtocolAdapter { } // Regular chat message (kind 9) - // Look for reply q-tags (NIP-29 uses q-tags like NIP-C7) + // Look for reply q-tags // Use getQuotePointer to extract full EventPointer with relay hints const replyTo = getQuotePointer(event); diff --git a/src/types/chat.ts b/src/types/chat.ts index 39228f2..cdab266 100644 --- a/src/types/chat.ts +++ b/src/types/chat.ts @@ -15,13 +15,7 @@ export const CHAT_KINDS = [ /** * Chat protocol identifier */ -export type ChatProtocol = - | "nip-c7" - | "nip-17" - | "nip-28" - | "nip-29" - | "nip-53" - | "nip-10"; +export type ChatProtocol = "nip-17" | "nip-28" | "nip-29" | "nip-53" | "nip-10"; /** * Conversation type @@ -171,7 +165,7 @@ export interface LiveActivityIdentifier { } /** - * NIP-C7/NIP-17 direct message identifier (resolved pubkey) + * NIP-17 direct message identifier (resolved pubkey) */ export interface DMIdentifier { type: "dm-recipient" | "chat-partner"; @@ -182,7 +176,7 @@ export interface DMIdentifier { } /** - * NIP-C7 NIP-05 identifier (needs resolution) + * NIP-05 identifier for DMs (needs resolution) */ export interface NIP05Identifier { type: "chat-partner-nip05";