feat(db): add project personas and skills tables
CI / build-and-test (push) Failing after 1m52s

* Introduce project_personas table with foreign keys to projects and agent_personas
* Add project_skills table with foreign key to projects and agent_skills
* Include override boolean field in agent_persona_skills and project_skills
* Update schema and migration files to reflect new tables and fields
* Enhance CORS handling to reflect request origin
This commit is contained in:
2026-07-04 23:45:51 +02:00
parent 1adf50e3db
commit c179e014ad
69 changed files with 1329 additions and 184 deletions
+10 -6
View File
@@ -234,6 +234,7 @@ func (db *DB) GetPersona(ctx context.Context, name string, detail bool, override
Name: s.Name,
Description: s.Description,
Tags: s.Tags,
Override: s.Override,
}
if detail {
entry.Content = s.Content
@@ -341,6 +342,7 @@ func (db *DB) GetPersonaManifest(ctx context.Context, name string) (ext.PersonaM
ID: s.ID,
Name: s.Name,
Description: s.Description,
Override: s.Override,
})
}
for _, g := range guardrails {
@@ -567,11 +569,12 @@ func (db *DB) RemovePersonaPart(ctx context.Context, personaName, partName strin
// Persona-Skill links
// ──────────────────────────────────────────────
func (db *DB) AddPersonaSkill(ctx context.Context, personaID, skillID int64) error {
func (db *DB) AddPersonaSkill(ctx context.Context, personaID, skillID int64, override bool) error {
_, err := db.pool.Exec(ctx, `
insert into agent_persona_skills (persona_id, skill_id)
values ($1, $2) on conflict do nothing
`, personaID, skillID)
insert into agent_persona_skills (persona_id, skill_id, override)
values ($1, $2, $3)
on conflict (persona_id, skill_id) do update set override = excluded.override
`, personaID, skillID, override)
if err != nil {
return fmt.Errorf("add persona skill: %w", err)
}
@@ -1058,7 +1061,7 @@ func (db *DB) fetchPartsByNames(ctx context.Context, names []string) ([]rawPart,
func (db *DB) listPersonaSkills(ctx context.Context, personaID int64) ([]AgentSkillRow, error) {
rows, err := db.pool.Query(ctx, `
select s.id, s.name, s.description, s.content, s.tags::text[]
select s.id, s.name, s.description, s.content, s.tags::text[], aps.override
from agent_skills s
join agent_persona_skills aps on aps.skill_id = s.id
where aps.persona_id = $1
@@ -1073,7 +1076,7 @@ func (db *DB) listPersonaSkills(ctx context.Context, personaID int64) ([]AgentSk
for rows.Next() {
var s AgentSkillRow
var tags []string
if err := rows.Scan(&s.ID, &s.Name, &s.Description, &s.Content, &tags); err != nil {
if err := rows.Scan(&s.ID, &s.Name, &s.Description, &s.Content, &tags, &s.Override); err != nil {
return nil, fmt.Errorf("scan persona skill: %w", err)
}
s.Tags = nilToEmptyStrings(tags)
@@ -1139,6 +1142,7 @@ type AgentSkillRow struct {
Description string
Content string
Tags []string
Override bool
}
type AgentGuardrailRow struct {