Documentation
¶
Overview ¶
Package server is the PostgreSQL composition root. It is deliberately kept below internal/platform so the local composition never imports this package or any network-backed adapter.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Operations ¶
type Operations interface {
AuthorizeAdminManage(context.Context) error
SaveObservation(context.Context, *domain.Observation) error
SaveObservationWithEffect(context.Context, *domain.Observation) (domain.SaveEffect, error)
ExecuteHandoff(context.Context, domain.HandoffRequest) (domain.ObservationWriteResult, error)
GetObservationByID(context.Context, int64) (*domain.Observation, error)
GetAgentObservationByID(context.Context, string, string, int64) (*domain.Observation, error)
GetObservationByPublicID(context.Context, string) (*domain.Observation, error)
UpdateObservation(context.Context, *domain.Observation) error
DeleteObservation(context.Context, int64) error
CreateSession(context.Context, *domain.Session) error
ListSessions(context.Context, string) ([]*domain.Session, error)
GetServerStats(context.Context) (*domain.ServerStats, error)
ListAuditEvents(context.Context, int) ([]*domain.AuditEntry, error)
ListProjects(context.Context) ([]string, error)
// ListAgentProjects returns public project IDs mapped to server-owned
// labels after capability and corpus filtering.
ListAgentProjects(context.Context) (map[string]string, error)
ListObservations(context.Context, domain.ObservationFilter) ([]*domain.Observation, error)
SearchObservations(context.Context, string, domain.SearchOptions) ([]*domain.SearchResult, error)
SearchAgentObservations(context.Context, string, string, string, domain.SearchOptions) ([]*domain.SearchResult, error)
CreateGraphEdge(context.Context, *domain.Edge) error
GetGraphEdgeByPublicID(context.Context, string) (*domain.Edge, error)
GetRelatedObservations(context.Context, int64, int) ([]*domain.Observation, error)
GetGraphSubgraph(context.Context, string, int, int) (*domain.GraphSubgraph, error)
DeleteGraphEdge(context.Context, int64) error
GetImportanceScore(context.Context, int64) (*domain.ImportanceScore, error)
CreateUser(context.Context, identity.UserCreate) (identity.UserRecord, error)
ListUsers(context.Context) ([]identity.UserRecord, error)
GetUserProfile(context.Context, string) (*identity.UserRecord, error)
SetUserActive(context.Context, string, bool) error
IssueToken(context.Context, identity.TokenIssue) (identity.IssuedToken, error)
ListTokens(context.Context) ([]identity.TokenRecord, error)
RevokeToken(context.Context, string) error
RotateToken(context.Context, string) (identity.IssuedToken, error)
PushSync(context.Context, *domain.SyncBatch) (*domain.SyncResult, error)
PullSync(context.Context, int64, int) (*domain.SyncPage, error)
GetProjectContext(context.Context, string) (*domain.ProjectContext, error)
ListProjectSkills(context.Context, string) ([]*domain.ProjectSkill, error)
GetProjectSkill(context.Context, string, string) (*domain.ProjectSkill, error)
SaveProjectArtifact(context.Context, domain.SaveProjectArtifactInput) (*domain.ProjectArtifactItem, error)
ListProjectArtifacts(context.Context, string, string) ([]*domain.ProjectArtifactItem, error)
DeleteProjectArtifact(context.Context, string, string) error
GetProjectDuplicates(context.Context) ([]domain.ProjectDuplicateGroup, error)
MergeProject(context.Context, string, string) (*domain.ProjectMergeResult, error)
ListCodeSymbols(context.Context, code.SymbolFilter) ([]code.Symbol, error)
GetCodeGraph(context.Context, string) (*code.CodeGraph, error)
SaveCodeGraph(context.Context, *code.CodeGraph) error
GetRAGStats(context.Context, string) (*domain.RAGStats, error)
}
Operations is the operation-only server boundary implemented by postgres.AuthorizedStore. It deliberately contains no repository accessors.
type ReindexJob ¶ added in v2.3.0
type ReindexJob struct {
// contains filtered or unexported fields
}
ReindexJob is the bounded server-mode composition for an administrative vector rebuild. It intentionally exposes neither HTTP/MCP transports nor background lifecycle services.
func OpenReindexJob ¶ added in v2.3.0
OpenReindexJob reuses the authenticated PostgreSQL store, authorization, audit, embedding, and vector composition without constructing server transports, agent providers, sync workers, or archival lifecycle services.
func (*ReindexJob) Close ¶ added in v2.3.0
func (j *ReindexJob) Close() error
Close releases the vector client, embedding transport, and PostgreSQL pool. It is idempotent through Runtime.Close.
func (*ReindexJob) ReindexProject ¶ added in v2.3.0
func (j *ReindexJob) ReindexProject(ctx context.Context, projectID string) (*ReindexResult, error)
type ReindexResult ¶ added in v2.3.0
type ReindexResult struct {
TenantID string
WorkspaceID string
Total int
Upserted int
ReEmbedded int
Skipped int
Batches int
}
ReindexResult is the server-platform outcome exposed to composition callers. It deliberately mirrors only the stable counters required by operators so cmd/cortex does not depend on the server implementation package.
type Runtime ¶
type Runtime struct {
Config *config.Config
Pool *pgxpool.Pool
Vectors domain.VectorIndex
Embeddings embedding.Service
Lifecycle *lifecycle.ArchivalService
// contains filtered or unexported fields
}
Runtime owns every resource created by Open. Close is idempotent and follows the dependency order: HTTP transport, background lifecycle, vector client, SQL pool, then migration handle.
func Open ¶
Open validates server-only configuration, applies the PostgreSQL migration, and constructs tenant-scoped repositories. It performs no work for local mode; callers select this root explicitly.
func (*Runtime) Close ¶
Close gracefully shuts down background work before closing database handles.
func (*Runtime) ReindexProject ¶ added in v2.3.0
ReindexProject executes the bounded administrative job synchronously. It intentionally has no HTTP handler: operators invoke it through the server mode CLI and cancellation is inherited from the process context.