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>
53 lines
1.5 KiB
Go
53 lines
1.5 KiB
Go
// Package admin provides a Unix domain socket server for local administration.
|
|
package admin
|
|
|
|
import (
|
|
"database/sql"
|
|
"log/slog"
|
|
"net"
|
|
|
|
"github.com/smart-mcp-proxy/synapbus/internal/agents"
|
|
"github.com/smart-mcp-proxy/synapbus/internal/auth"
|
|
"github.com/smart-mcp-proxy/synapbus/internal/channels"
|
|
"github.com/smart-mcp-proxy/synapbus/internal/messaging"
|
|
"github.com/smart-mcp-proxy/synapbus/internal/trace"
|
|
)
|
|
|
|
// Services holds references to all services the admin socket can control.
|
|
type Services struct {
|
|
Users *auth.SQLiteUserStore
|
|
Sessions auth.SessionStore
|
|
Agents *agents.AgentService
|
|
Messages *messaging.MessagingService
|
|
Channels *channels.Service
|
|
Traces trace.TraceStore
|
|
DataDir string
|
|
}
|
|
|
|
// AdminServer is a Unix domain socket server for local administration.
|
|
type AdminServer struct {
|
|
listener net.Listener
|
|
db *sql.DB
|
|
services *Services
|
|
logger *slog.Logger
|
|
socketPath string
|
|
done chan struct{}
|
|
}
|
|
|
|
// NewServer creates a new admin server bound to a Unix socket at {dataDir}/synapbus.sock.
|
|
// If socketPath is non-empty it overrides the default.
|
|
func NewServer(socketPath string, db *sql.DB, services *Services, logger *slog.Logger) *AdminServer {
|
|
return &AdminServer{
|
|
db: db,
|
|
services: services,
|
|
logger: logger.With("component", "admin"),
|
|
socketPath: socketPath,
|
|
done: make(chan struct{}),
|
|
}
|
|
}
|
|
|
|
// SocketPath returns the path to the Unix socket.
|
|
func (s *AdminServer) SocketPath() string {
|
|
return s.socketPath
|
|
}
|