Documentation
¶
Overview ¶
Package personastore persists database-managed persona definitions, independent of the platform assembly. It holds the persona_definitions storage model (Definition), its Store interface, and the PostgreSQL and no-op implementations. Extracted from pkg/platform so the persona storage layer can be reasoned about (and size-budgeted) on its own.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("persona not found")
ErrNotFound is returned when a persona definition does not exist in the database.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct {
Name string `json:"name"`
DisplayName string `json:"display_name"`
Description string `json:"description,omitempty"`
Roles []string `json:"roles"`
ToolsAllow []string `json:"tools_allow"`
ToolsDeny []string `json:"tools_deny"`
ConnsAllow []string `json:"connections_allow,omitempty"`
ConnsDeny []string `json:"connections_deny,omitempty"`
Context persona.ContextOverrides `json:"context"`
Priority int `json:"priority"`
CreatedBy string `json:"created_by"`
UpdatedAt time.Time `json:"updated_at"`
}
Definition represents a database-managed persona.
func DefinitionFromPersona ¶
func DefinitionFromPersona(p *persona.Persona, author string) Definition
DefinitionFromPersona converts a persona.Persona to a Definition.
func (*Definition) ToPersona ¶
func (d *Definition) ToPersona() *persona.Persona
ToPersona converts a Definition to a persona.Persona.
type NoopStore ¶
type NoopStore struct{}
NoopStore is a no-op implementation for when no database is available.
type PostgresStore ¶
type PostgresStore struct {
// contains filtered or unexported fields
}
PostgresStore implements Store backed by PostgreSQL.
func NewPostgresStore ¶
func NewPostgresStore(db *sql.DB) *PostgresStore
NewPostgresStore creates a new PostgreSQL-backed persona store.
func (*PostgresStore) Delete ¶
func (s *PostgresStore) Delete(ctx context.Context, name string) error
Delete removes a persona definition by name.
func (*PostgresStore) Get ¶
func (s *PostgresStore) Get(ctx context.Context, name string) (*Definition, error)
Get returns a single persona definition by name.
func (*PostgresStore) List ¶
func (s *PostgresStore) List(ctx context.Context) ([]Definition, error)
List returns all persona definitions.
func (*PostgresStore) Set ¶
func (s *PostgresStore) Set(ctx context.Context, def Definition) error
Set creates or updates a persona definition.