Release / Build darwin/amd64 (push) Canceled after 0s
Release / Build linux/amd64 (push) Canceled after 0s
Release / Build darwin/arm64 (push) Canceled after 0s
Release / Build linux/arm64 (push) Canceled after 0s
Release / Generate Homebrew Formula (push) Canceled after 0s
Release / GitHub Release (push) Canceled after 0s
Release / Docker Image (push) Canceled after 0s
- Add `my_status` MCP tool: single call returns agent identity, pending DMs, channel mentions, system notifications, channel summaries, and stats with truncation for large inboxes - Add embeddings CLI: `synapbus embeddings status|reindex|clear` for managing vectors when switching embedding providers - Add automatic message retention worker with configurable period (--message-retention, default 12m), warning notifications 1 month before deletion, cascade cleanup, and incremental vacuum - Add manual purge: `synapbus messages purge --older-than --agent --channel` and `synapbus db vacuum` for on-demand cleanup - Add `synapbus retention status` CLI for admin visibility - Create system agent at startup for sending retention warnings - Filter system agent from discover_agents results Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
65 lines
1.9 KiB
Go
65 lines
1.9 KiB
Go
// Package admin provides a Unix domain socket server for local administration.
|
|
package admin
|
|
|
|
import (
|
|
"database/sql"
|
|
"log/slog"
|
|
"net"
|
|
|
|
"github.com/synapbus/synapbus/internal/agents"
|
|
"github.com/synapbus/synapbus/internal/attachments"
|
|
"github.com/synapbus/synapbus/internal/auth"
|
|
"github.com/synapbus/synapbus/internal/channels"
|
|
"github.com/synapbus/synapbus/internal/messaging"
|
|
"github.com/synapbus/synapbus/internal/search"
|
|
"github.com/synapbus/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
|
|
EmbeddingStore *search.EmbeddingStore
|
|
VectorIndex *search.VectorIndex
|
|
SearchService *search.Service
|
|
AttachmentService *attachments.Service
|
|
DataDir string
|
|
RetentionWorker RetentionStatusProvider
|
|
}
|
|
|
|
// RetentionStatusProvider provides retention status information.
|
|
type RetentionStatusProvider interface {
|
|
Status() map[string]interface{}
|
|
}
|
|
|
|
// 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
|
|
}
|