0.5 缩减重构
This commit is contained in:
@@ -385,4 +385,65 @@ export default defineSchema({
|
||||
.index("by_workspace_user", ["workspace_id", "user_id"])
|
||||
.index("by_user_document", ["user_id", "document_id"])
|
||||
.index("by_workspace_document_user", ["workspace_id", "document_id", "user_id"]),
|
||||
|
||||
// === 新领域模型表(Action Execution System)===
|
||||
|
||||
// Pages 表 - 对应域模型 Page
|
||||
pages: defineTable({
|
||||
id: v.string(),
|
||||
workspace_id: v.string(),
|
||||
parent_id: v.union(v.string(), v.null()),
|
||||
title: v.string(),
|
||||
access_scope: v.union(v.literal("private"), v.literal("shared"), v.literal("public")),
|
||||
block_ids: v.array(v.string()),
|
||||
child_page_ids: v.array(v.string()),
|
||||
asset_ids: v.array(v.string()),
|
||||
created_by: v.string(),
|
||||
created_at: v.string(),
|
||||
updated_at: v.string(),
|
||||
deleted_at: v.union(v.string(), v.null()),
|
||||
})
|
||||
.index("by_page_id", ["id"])
|
||||
.index("by_workspace", ["workspace_id"])
|
||||
.index("by_workspace_parent", ["workspace_id", "parent_id"])
|
||||
.index("by_workspace_deleted", ["workspace_id", "deleted_at"]),
|
||||
|
||||
// Blocks 表 - 对应域模型 Block
|
||||
blocks: defineTable({
|
||||
id: v.string(),
|
||||
workspace_id: v.string(),
|
||||
page_id: v.string(),
|
||||
parent_block_id: v.union(v.string(), v.null()),
|
||||
type: v.string(),
|
||||
props: v.optional(v.any()),
|
||||
content: v.optional(v.any()),
|
||||
child_block_ids: v.array(v.string()),
|
||||
created_by: v.string(),
|
||||
created_at: v.string(),
|
||||
updated_at: v.string(),
|
||||
})
|
||||
.index("by_block_id", ["id"])
|
||||
.index("by_workspace", ["workspace_id"])
|
||||
.index("by_page", ["page_id"])
|
||||
.index("by_page_parent", ["page_id", "parent_block_id"]),
|
||||
|
||||
// Agent Actions 表 - 对应域模型 AgentAction(持久化日志)
|
||||
agent_actions: defineTable({
|
||||
id: v.string(),
|
||||
workspace_id: v.string(),
|
||||
session_id: v.string(),
|
||||
action_type: v.string(),
|
||||
status: v.union(v.literal("planned"), v.literal("running"), v.literal("succeeded"), v.literal("failed"), v.literal("cancelled")),
|
||||
actor: v.union(v.literal("human"), v.literal("agent"), v.literal("automation")),
|
||||
input: v.any(),
|
||||
output: v.optional(v.any()),
|
||||
error: v.optional(v.string()),
|
||||
started_at: v.string(),
|
||||
finished_at: v.optional(v.string()),
|
||||
})
|
||||
.index("by_action_id", ["id"])
|
||||
.index("by_workspace", ["workspace_id"])
|
||||
.index("by_workspace_session", ["workspace_id", "session_id"])
|
||||
.index("by_session", ["session_id"])
|
||||
.index("by_workspace_status", ["workspace_id", "status"]),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user