归档本轮 P0/P1 bug 修复、设计审查迁移、AI selection scope 收口与 stream contract 调整,并保留当前 05 主线迁移起点。
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { defineSchema, defineTable } from "convex/server";
|
|
import { v } from "convex/values";
|
|
|
|
export default defineSchema({
|
|
acp_runtime_runs: defineTable({
|
|
id: v.string(),
|
|
user_id: v.string(),
|
|
workspace_id: v.union(v.string(), v.null()),
|
|
document_id: v.string(),
|
|
session_id: v.string(),
|
|
run_id: v.string(),
|
|
title: v.union(v.string(), v.null()),
|
|
profile: v.string(),
|
|
acp_runtime: v.string(),
|
|
source: v.literal("acp"),
|
|
status: v.string(),
|
|
trace_id: v.string(),
|
|
runtime: v.any(),
|
|
usage: v.any(),
|
|
payload: v.any(),
|
|
retention: v.any(),
|
|
created_at: v.string(),
|
|
updated_at: v.string(),
|
|
deleted_at: v.union(v.string(), v.null()),
|
|
})
|
|
.index("by_run_id", ["run_id"])
|
|
.index("by_user_workspace_document", ["user_id", "workspace_id", "document_id", "created_at"])
|
|
.index("by_user_workspace_session", ["user_id", "workspace_id", "session_id", "created_at"])
|
|
.index("by_user_created_at", ["user_id", "created_at"]),
|
|
|
|
acp_runtime_events: defineTable({
|
|
id: v.string(),
|
|
user_id: v.string(),
|
|
workspace_id: v.union(v.string(), v.null()),
|
|
document_id: v.string(),
|
|
session_id: v.string(),
|
|
run_id: v.string(),
|
|
profile: v.string(),
|
|
acp_runtime: v.string(),
|
|
source: v.literal("acp"),
|
|
event_type: v.string(),
|
|
payload: v.any(),
|
|
created_at: v.string(),
|
|
})
|
|
.index("by_run_created_at", ["run_id", "created_at"])
|
|
.index("by_user_workspace_session_created_at", [
|
|
"user_id",
|
|
"workspace_id",
|
|
"session_id",
|
|
"created_at",
|
|
]),
|
|
});
|