feat(broker+api+cli): topic message reply-to threading (v0.3.1)
Adds a reply_to_id column (self-FK on topic_message) plus end-to-end plumbing so a message can mark itself as a reply to a previous one in the same topic. - Schema: 0027_topic_message_reply_to.sql adds reply_to_id with ON DELETE SET NULL + index for backlink lookup. - Broker: appendTopicMessage validates parent shares the topic, writes reply_to_id; topicHistory + topic_history_response surface it; WS push envelope now carries senderMemberId, senderName, topic name, reply_to_id, and message_id so recipients have everything they need to reply without a follow-up query. - REST: POST /v1/messages accepts replyToId (validated server-side); GET /messages and SSE /stream emit it per row. - CLI: \`topic post --reply-to <id|prefix>\` resolves prefixes against recent history; \`topic tail\` renders an "↳ in reply to <name>: <snippet>" line above replies and shows a copyable #shortid tag on every row. - MCP push pipe: channel attributes now include from_pubkey, from_member_id, message_id, topic, reply_to_id — the recipient can thread a reply directly from the inbound notification. - Skill + identity prompt updated to teach Claude how to use the new attributes for replies. Bumped CLI to 1.9.0.
This commit is contained in:
@@ -101,6 +101,14 @@ export interface InboundPush {
|
||||
messageId: string;
|
||||
meshId: string;
|
||||
senderPubkey: string;
|
||||
/** Stable mesh.member id of the sender — preferred id for replies. */
|
||||
senderMemberId?: string;
|
||||
/** Sender's current display name (a join from the broker). */
|
||||
senderName?: string;
|
||||
/** Topic name when the push originated from a topic post (vs DM). */
|
||||
topic?: string;
|
||||
/** Server-side id of the parent message when this push is a reply. */
|
||||
replyToId?: string;
|
||||
priority: Priority;
|
||||
nonce: string;
|
||||
ciphertext: string;
|
||||
@@ -2028,6 +2036,10 @@ export class BrokerClient {
|
||||
messageId: String(msg.messageId ?? ""),
|
||||
meshId: String(msg.meshId ?? ""),
|
||||
senderPubkey,
|
||||
...(msg.senderMemberId ? { senderMemberId: String(msg.senderMemberId) } : {}),
|
||||
...(msg.senderName ? { senderName: String(msg.senderName) } : {}),
|
||||
...(msg.topic ? { topic: String(msg.topic) } : {}),
|
||||
...(msg.replyToId ? { replyToId: String(msg.replyToId) } : {}),
|
||||
priority: (msg.priority as Priority) ?? "next",
|
||||
nonce,
|
||||
ciphertext,
|
||||
|
||||
Reference in New Issue
Block a user