feat(asset): record and display agent provenance on assets and audit logs (#380)

* feat(asset): record and display agent provenance on assets and audit logs

* style(webui): apply 30% translucent frosted glass background to bot badges

* style(webui): match bot icon badge style to thumbnail media overlay (bg-black/60 text-white)

* style(webui): use "AI" text badge with pdf overlay style instead of bot icon
This commit is contained in:
Yiling-J
2026-09-04 11:27:52 +08:00
committed by GitHub
parent 52330869a2
commit dd0ea05a88
39 changed files with 1699 additions and 108 deletions
@@ -0,0 +1,17 @@
-- AlterTable
ALTER TABLE "assets" ADD COLUMN "agent_id" TEXT;
-- AlterTable
ALTER TABLE "audit_logs" ADD COLUMN "agent_id" TEXT;
-- CreateIndex
CREATE INDEX "assets_agent_id_idx" ON "assets"("agent_id");
-- CreateIndex
CREATE INDEX "audit_logs_agent_id_idx" ON "audit_logs"("agent_id");
-- AddForeignKey
ALTER TABLE "assets" ADD CONSTRAINT "assets_agent_id_fkey" FOREIGN KEY ("agent_id") REFERENCES "agents"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "audit_logs" ADD CONSTRAINT "audit_logs_agent_id_fkey" FOREIGN KEY ("agent_id") REFERENCES "agents"("id") ON DELETE SET NULL ON UPDATE CASCADE;
+9
View File
@@ -546,6 +546,9 @@ model Asset {
creatorId String? @map("creator_id")
creator User? @relation("UserToAsset", fields: [creatorId], references: [id])
agentId String? @map("agent_id")
agent Agent? @relation("AgentToAsset", fields: [agentId], references: [id], onDelete: SetNull)
taskId String? @map("task_id")
task Task? @relation("TaskToAsset", fields: [taskId], references: [id])
@@ -576,6 +579,7 @@ model Asset {
@@index([sortIndex])
@@index([isDeleted])
@@index([deletedAt])
@@index([agentId])
@@index([name], name: "assets_name_idx")
@@index([nameNgram], type: Gin)
@@unique([parentId, targetId], name: "parentIdTargetId")
@@ -848,6 +852,8 @@ model Agent {
agentSessions AgentSession[]
skills AgentSkill[]
mcpServers AgentMcpServer[]
assets Asset[] @relation("AgentToAsset")
auditLogs AuditLog[] @relation("AgentToAuditLog")
@@map("agents")
}
@@ -1083,16 +1089,19 @@ model AuditLog {
action String
teamId String @map("team_id")
userId String? @map("user_id")
agentId String? @map("agent_id")
projectId String? @map("project_id")
itemId String? @map("item_id")
createdAt DateTime @default(now()) @map("created_at")
team Team @relation("TeamToAuditLog", fields: [teamId], references: [id], onDelete: Cascade)
user User? @relation("UserToAuditLog", fields: [userId], references: [id], onDelete: SetNull)
agent Agent? @relation("AgentToAuditLog", fields: [agentId], references: [id], onDelete: SetNull)
project Project? @relation("ProjectToAuditLog", fields: [projectId], references: [id], onDelete: SetNull)
@@index([teamId, id(sort: Desc)])
@@index([userId])
@@index([agentId])
@@index([action])
@@index([itemId])
@@map("audit_logs")