fix: mcp and desktop communication (#18)

This commit is contained in:
Wes
2026-03-10 16:33:48 -04:00
committed by GitHub
parent 69b36d11dd
commit 4fcc4c35cc
4 changed files with 26 additions and 12 deletions
+15 -8
View File
@@ -464,17 +464,24 @@ impl SproutMcpServer {
let channel_tag = match nostr::Tag::parse(&["channel", &p.channel_id]) {
Ok(t) => t,
Err(e) => return format!("Error building tag: {e}"),
Err(e) => return format!("Error building channel tag: {e}"),
};
let event_ref_tag = match nostr::Tag::parse(&["e", &p.channel_id]) {
Ok(t) => t,
Err(e) => return format!("Error building event-ref tag: {e}"),
};
let keys = self.client.keys().clone();
let event =
match nostr::EventBuilder::new(nostr::Kind::Custom(kind), &p.content, [channel_tag])
.sign_with_keys(&keys)
{
Ok(e) => e,
Err(e) => return format!("Error signing event: {e}"),
};
let event = match nostr::EventBuilder::new(
nostr::Kind::Custom(kind),
&p.content,
[channel_tag, event_ref_tag],
)
.sign_with_keys(&keys)
{
Ok(e) => e,
Err(e) => return format!("Error signing event: {e}"),
};
match self.client.send_event(event).await {
Ok(ok) if ok.accepted => format!("Message sent. Event ID: {}", ok.event_id),
-2
View File
@@ -167,7 +167,6 @@ export function AppShell() {
: "No channel selected"
}
isLoading={messagesQuery.isLoading}
key={activeChannel?.id ?? "no-channel"}
messages={timelineMessages}
/>
<MessageComposer
@@ -178,7 +177,6 @@ export function AppShell() {
sendMessageMutation.isPending
}
isSending={sendMessageMutation.isPending}
key={activeChannel?.id ?? "no-channel"}
onSend={async (content) => {
await sendMessageMutation.mutateAsync(content);
}}
+4 -1
View File
@@ -35,7 +35,10 @@ function createOptimisticMessage(
pubkey: identity.pubkey,
created_at: Math.floor(Date.now() / 1_000),
kind: 4_0001,
tags: [["e", channelId]],
tags: [
["channel", channelId],
["e", channelId],
],
content,
sig: "",
pending: true,
+7 -1
View File
@@ -122,7 +122,13 @@ class RelayClient {
const event = await signRelayEvent({
kind: 40001,
content: content.trim(),
tags: [["e", channelId]],
// Include both tags for now:
// - `channel` lets the relay persist and authorize the event as channel-scoped
// - `e` keeps the existing desktop WebSocket history/subscription filters working
tags: [
["channel", channelId],
["e", channelId],
],
});
return new Promise<RelayEvent>((resolve, reject) => {