0bcf16e77f
Reusable agent definitions authored as AGENTS.md (YAML frontmatter + a Markdown body that becomes the agent's operating guide). Mirrors the skill library, including its review hardening. - AgentProfile entity (OrgBoard): org-scoped + versioned by (OrganizationId, ProfileKey, Version), NULLS NOT DISTINCT unique index; Origin Builtin|Authored|Installed; ProfileVisibility + ProfileStatus with the Public⟹Published invariant enforced in Apply()/SetVisibility(). AGENTS.md parser (YamlDotNet). AgentProfileWriter is the single upsert path (insert-only mode for install). - Free builtins: AgentProfileSeeder seeds Aria (PO), Quill (QA), Edison (backend) on startup via a new IStartupSeeder + SeederRunner (runs after migrations). Idempotent, null-org, visible to all. - Endpoints (/api/orgboard/agent-profiles): upload, list (resolvable-winner order), get versions, publish/unpublish, fork, marketplace (per-(key,version) AlreadyInLibrary), install (insert-only → clean 409, no clobber). ConfigureAgents to author/manage; ViewBoard to browse; audited. - Persona: Agent gains Persona; ConfigureAgent stores it; AgentRunContext carries it; PromptAssembler injects it as "# Operating guide" (data, not instructions) so an applied profile shapes the run. - Client: Agent profiles page (library + marketplace tabs, upload editor, publish/unlist/fork/install), routed + in the nav. Verified: ArchitectureTests 8/8, IntegrationTests 55/55 (new AgentProfilesTests: builtins seeded, upload + validation, publish, cross-org marketplace list→install→private copy, duplicate 409, per- version flag, Member 403; persona renders as the operating guide), client build green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
80 lines
3.7 KiB
C#
80 lines
3.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace TeamUp.Modules.OrgBoard.Persistence.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddAgentProfiles : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Persona",
|
|
schema: "orgboard",
|
|
table: "agents",
|
|
type: "text",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "agent_profiles",
|
|
schema: "orgboard",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
OrganizationId = table.Column<Guid>(type: "uuid", nullable: true),
|
|
Origin = table.Column<int>(type: "integer", nullable: false),
|
|
AuthoredByMemberId = table.Column<Guid>(type: "uuid", nullable: true),
|
|
ProfileKey = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
|
Name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
|
|
Version = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
|
Summary = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
|
|
Roles = table.Column<List<string>>(type: "text[]", nullable: false),
|
|
Monogram = table.Column<string>(type: "character varying(8)", maxLength: 8, nullable: true),
|
|
RecommendedAutonomy = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
|
SkillKeys = table.Column<List<string>>(type: "text[]", nullable: false),
|
|
Body = table.Column<string>(type: "text", nullable: false),
|
|
Visibility = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
|
Status = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
|
ContentHash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
|
CreatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
UpdatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_agent_profiles", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_agent_profiles_OrganizationId",
|
|
schema: "orgboard",
|
|
table: "agent_profiles",
|
|
column: "OrganizationId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_agent_profiles_OrganizationId_ProfileKey_Version",
|
|
schema: "orgboard",
|
|
table: "agent_profiles",
|
|
columns: new[] { "OrganizationId", "ProfileKey", "Version" },
|
|
unique: true)
|
|
.Annotation("Npgsql:NullsDistinct", false);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "agent_profiles",
|
|
schema: "orgboard");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Persona",
|
|
schema: "orgboard",
|
|
table: "agents");
|
|
}
|
|
}
|
|
}
|