diff --git a/desktop/src/features/channels/ui/ChannelScreen.tsx b/desktop/src/features/channels/ui/ChannelScreen.tsx index 89e843477..67c4929e4 100644 --- a/desktop/src/features/channels/ui/ChannelScreen.tsx +++ b/desktop/src/features/channels/ui/ChannelScreen.tsx @@ -4,7 +4,10 @@ import { cacheSearchHitEvent } from "@/app/navigation/searchHitEventCache"; import { useAppNavigation } from "@/app/navigation/useAppNavigation"; import { useActiveChannelHeader } from "@/features/channels/useActiveChannelHeader"; import { useChannelPaneHandlers } from "@/features/channels/useChannelPaneHandlers"; -import { buildAgentConversationMarkers } from "@/features/agents/agentConversations"; +import { + buildAgentConversationMarkers, + getHiddenAgentConversationMessageIds, +} from "@/features/agents/agentConversations"; import { useChannelMembersQuery, useJoinChannelMutation, @@ -446,6 +449,19 @@ export function ChannelScreen({ () => buildAgentConversationMarkers(resolvedMessages), [resolvedMessages], ); + const unreadTimelineMessages = React.useMemo(() => { + const hiddenMessageIds = getHiddenAgentConversationMessageIds( + timelineMessages, + agentConversationMarkers, + ); + if (hiddenMessageIds.size === 0) { + return timelineMessages; + } + + return timelineMessages.filter( + (message) => !hiddenMessageIds.has(message.id), + ); + }, [agentConversationMarkers, timelineMessages]); const channelFind = useChannelFind({ channelId: activeChannelId, messages: timelineMessages, @@ -468,7 +484,7 @@ export function ChannelScreen({ unreadCount, } = useChannelUnreadState({ activeChannelId, - timelineMessages, + timelineMessages: unreadTimelineMessages, currentPubkey, openThreadHeadId, threadReplyTargetId, diff --git a/mobile/lib/shared/relay/nostr_models.dart b/mobile/lib/shared/relay/nostr_models.dart index fd45a2133..c2cdcebef 100644 --- a/mobile/lib/shared/relay/nostr_models.dart +++ b/mobile/lib/shared/relay/nostr_models.dart @@ -22,7 +22,10 @@ abstract final class EventKind { static const dmVisibility = 30622; static const streamMessageV2 = 40002; static const streamMessageEdit = 40003; + static const streamMessagePinned = 40004; static const streamMessageDiff = 40008; + static const agentConversation = 40010; + static const agentConversationCompat = streamMessagePinned; static const systemMessage = 40099; static const forumPost = 45001; static const forumComment = 45003; @@ -48,7 +51,9 @@ abstract final class EventKind { ...channelMessageEventKinds, 40001, // legacy pre-migration stream messages streamMessageEdit, // 40003 + agentConversationCompat, // 40004 — staging-compatible task marker streamMessageDiff, // 40008 + agentConversation, // 40010 — task marker systemMessage, // 40099 huddleStarted, // 48100 — visible huddle session row huddleParticipantJoined, // 48101 — huddle lifecycle metadata