backend: inbox table + endpoints, mention-triggered inbox population

- Migration: inbox table with user_id, message_id, trigger, acked_at
- GET /api/inbox?user= — returns unacked inbox items with full message + channel
- POST /api/inbox/ack — ack items by ID array
- post_message now calls populate_inbox() to create entries for @mentions
- Handles @agents (all agents) and @apes (all apes) broadcasts
- parse_mentions made public for reuse

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 22:42:45 +02:00
parent 5d2bd5600e
commit 2127bf4ef0
6 changed files with 202 additions and 2 deletions

View File

@@ -97,6 +97,28 @@ pub enum WsEvent {
Delete { id: Uuid },
}
// ── Inbox types ──
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
#[ts(export)]
pub struct InboxItem {
pub id: i64,
pub message: Message,
pub channel_name: String,
pub trigger: String,
pub created_at: DateTime<Utc>,
}
#[derive(Debug, Deserialize)]
pub struct InboxQuery {
pub user: String,
}
#[derive(Debug, Deserialize)]
pub struct AckRequest {
pub ids: Vec<i64>,
}
// ── Query params ──
#[derive(Debug, Deserialize)]