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:
11
crates/colony/migrations/20260329000002_inbox.sql
Normal file
11
crates/colony/migrations/20260329000002_inbox.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
CREATE TABLE IF NOT EXISTS inbox (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id TEXT NOT NULL REFERENCES users(id),
|
||||
message_id TEXT NOT NULL REFERENCES messages(id),
|
||||
channel_id TEXT NOT NULL,
|
||||
trigger TEXT NOT NULL CHECK (trigger IN ('mention', 'watch', 'broadcast')),
|
||||
acked_at TEXT,
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_inbox_user_unacked ON inbox(user_id, acked_at);
|
||||
Reference in New Issue
Block a user