Major feature additions across backend and frontend: Backend: - Unix domain socket admin server with JSON-RPC protocol - CLI subcommands: user/agent management, audit, backup, messages, channels - Managed API keys (sb_ prefix) with permissions, channel limits, expiry - Thread/reply support in messaging core (reply_to column) - Context-based trace owner_id propagation for proper audit filtering - Two-step auth middleware supporting both agent keys and managed API keys Frontend: - Complete Slack-like dark theme redesign with custom CSS properties - Sidebar with Channels, Direct Messages, and Admin sections - Thread panel (slide-in) for viewing message replies - API key management page with create form, key display, and ready-to-use MCP/Claude Code config snippets with copy-to-clipboard - All pages restyled: login, dashboard, agents, conversations, settings E2E Tests: - Fixed test runner binary path resolution - Added pyproject.toml for test dependencies Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 lines
1.7 KiB
Go
52 lines
1.7 KiB
Go
// Package messaging provides core messaging types and services for SynapBus.
|
|
package messaging
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
// Message status constants.
|
|
const (
|
|
StatusPending = "pending"
|
|
StatusProcessing = "processing"
|
|
StatusDone = "done"
|
|
StatusFailed = "failed"
|
|
)
|
|
|
|
// Message represents a single message in the system.
|
|
type Message struct {
|
|
ID int64 `json:"id"`
|
|
ConversationID int64 `json:"conversation_id"`
|
|
FromAgent string `json:"from_agent"`
|
|
ToAgent string `json:"to_agent,omitempty"`
|
|
ChannelID *int64 `json:"channel_id,omitempty"`
|
|
ReplyTo *int64 `json:"reply_to,omitempty"`
|
|
Body string `json:"body"`
|
|
Priority int `json:"priority"`
|
|
Status string `json:"status"`
|
|
Metadata json.RawMessage `json:"metadata"`
|
|
ClaimedBy string `json:"claimed_by,omitempty"`
|
|
ClaimedAt *time.Time `json:"claimed_at,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// Conversation groups related messages into a thread.
|
|
type Conversation struct {
|
|
ID int64 `json:"id"`
|
|
Subject string `json:"subject"`
|
|
CreatedBy string `json:"created_by"`
|
|
ChannelID *int64 `json:"channel_id,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// InboxState tracks per-agent, per-conversation read position.
|
|
type InboxState struct {
|
|
AgentName string `json:"agent_name"`
|
|
ConversationID int64 `json:"conversation_id"`
|
|
LastReadMessageID int64 `json:"last_read_message_id"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|