mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-10 15:36:53 +02:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ const kindRenderers: Record<number, React.ComponentType<BaseEventProps>> = {
|
||||
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)
|
||||
|
||||
@@ -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/,
|
||||
);
|
||||
|
||||
@@ -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)`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user