feat(server): add brand kit management and project binding

Add a brand kit domain with memory and postgres stores, a BrandKitService
for CRUD and resolution, and REST endpoints to list, upsert, and delete
brand kits. Projects can bind a brand kit whose resolved context and
reference images feed into the agent's long-term memory and design prompts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-10 20:58:55 +08:00
parent 3653474355
commit 789f51b29e
38 changed files with 2165 additions and 135 deletions
@@ -11,15 +11,20 @@ import (
)
type Querier interface {
ClearDefaultBrandKits(ctx context.Context, arg ClearDefaultBrandKitsParams) error
CreateCanvasSnapshot(ctx context.Context, arg CreateCanvasSnapshotParams) error
CreateConnection(ctx context.Context, arg CreateConnectionParams) error
CreateMessage(ctx context.Context, arg CreateMessageParams) error
DeleteBrandKit(ctx context.Context, arg DeleteBrandKitParams) (string, error)
DeleteConnectionsByProject(ctx context.Context, arg DeleteConnectionsByProjectParams) error
DeleteMessagesByProject(ctx context.Context, arg DeleteMessagesByProjectParams) error
DeleteNodesByProject(ctx context.Context, arg DeleteNodesByProjectParams) error
DeleteProject(ctx context.Context, arg DeleteProjectParams) error
GetBrandKit(ctx context.Context, arg GetBrandKitParams) (BrandKit, error)
GetCanvasSnapshot(ctx context.Context, arg GetCanvasSnapshotParams) (CanvasSnapshot, error)
GetDefaultBrandKit(ctx context.Context, userID pgtype.UUID) (BrandKit, error)
GetProject(ctx context.Context, arg GetProjectParams) (Project, error)
ListBrandKits(ctx context.Context, userID pgtype.UUID) ([]BrandKit, error)
ListConnectionsByProject(ctx context.Context, arg ListConnectionsByProjectParams) ([]CanvasConnection, error)
ListMessagesByProject(ctx context.Context, arg ListMessagesByProjectParams) ([]AgentMessage, error)
ListNodesByProject(ctx context.Context, arg ListNodesByProjectParams) ([]CanvasNode, error)
@@ -27,6 +32,7 @@ type Querier interface {
ListProjectsPage(ctx context.Context, arg ListProjectsPageParams) ([]ListProjectsPageRow, error)
LockProject(ctx context.Context, arg LockProjectParams) (LockProjectRow, error)
UpdateProjectCanvasSnapshot(ctx context.Context, arg UpdateProjectCanvasSnapshotParams) error
UpsertBrandKit(ctx context.Context, arg UpsertBrandKitParams) (BrandKit, error)
UpsertCanvasNode(ctx context.Context, arg UpsertCanvasNodeParams) error
UpsertProject(ctx context.Context, arg UpsertProjectParams) error
}