docs(optimization-plan): ⑤状态机/⑥ER 改自包含 SVG + 补规则13边与新列
- ⑤ 状态机:mermaid → 内联 SVG(圆/椭圆节点,家族配色),含 executing→needs_attention 分歧重评估(规则13) 虚线边;移除 mermaid CDN script + initialize,文档全自包含 - ⑥ 数据库:补本轮已上线但漏登记的列 projects.models / projects.agent_rules / tasks.scope_files;新增「表关系 ER」内联 SVG(5 表主外键 + 基数) - 规则13 状态条目标「✅ 已实现」并补实现说明 - 两张 SVG 经 xmllint 校验 well-formed Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+177
-63
@@ -4,7 +4,6 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Maestro 三类任务执行方法优化方案</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
|
||||
<style>
|
||||
:root {
|
||||
--bg: #0f1117;
|
||||
@@ -776,50 +775,110 @@
|
||||
<span class="arrow">→自动收口原任务</span>
|
||||
</div>
|
||||
|
||||
<h3 style="margin-top:20px">完整 Mermaid 图</h3>
|
||||
<div class="mermaid-wrap">
|
||||
<div class="mermaid">
|
||||
stateDiagram-v2
|
||||
direction LR
|
||||
[*] --> init
|
||||
init --> analyzing : hard
|
||||
init --> speccing : medium
|
||||
init --> ready : easy
|
||||
|
||||
analyzing --> plan_review : 拆解完成
|
||||
analyzing --> needs_attention : 失败超限
|
||||
plan_review --> decomposed : accept
|
||||
plan_review --> analyzing : reject+意见
|
||||
decomposed --> done : 子任务全done
|
||||
decomposed --> analyzing : 重拆
|
||||
|
||||
speccing --> spec_review : 方案完成
|
||||
speccing --> needs_attention : 失败超限
|
||||
spec_review --> ready : accept
|
||||
spec_review --> speccing : reject+意见
|
||||
|
||||
ready --> blocked : 依赖未满足
|
||||
blocked --> ready : 依赖满足
|
||||
ready --> queued : 编排器领取
|
||||
queued --> executing : worker启动
|
||||
queued --> ready : 退回
|
||||
|
||||
executing --> exec_review : 执行完成
|
||||
executing --> failed : 执行失败
|
||||
failed --> queued : 退避重试
|
||||
failed --> needs_attention : 超重试上限
|
||||
|
||||
exec_review --> done : accept合并
|
||||
exec_review --> ready : reject返工
|
||||
|
||||
needs_attention --> ready
|
||||
needs_attention --> queued
|
||||
needs_attention --> analyzing
|
||||
needs_attention --> speccing
|
||||
|
||||
done --> [*]
|
||||
</div>
|
||||
</div>
|
||||
<h3 style="margin-top:20px">完整状态机(自包含 SVG · 圆节点)</h3>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1160 600" style="width:100%;display:block;margin:16px 0">
|
||||
<defs>
|
||||
<marker id="fsm-o" markerWidth="7" markerHeight="6" refX="6" refY="3" orient="auto"><polygon points="0 0,7 3,0 6" fill="#d6783b"/></marker>
|
||||
<marker id="fsm-b" markerWidth="7" markerHeight="6" refX="6" refY="3" orient="auto"><polygon points="0 0,7 3,0 6" fill="#5b8fd6"/></marker>
|
||||
<marker id="fsm-g" markerWidth="7" markerHeight="6" refX="6" refY="3" orient="auto"><polygon points="0 0,7 3,0 6" fill="#82b366"/></marker>
|
||||
<marker id="fsm-p" markerWidth="7" markerHeight="6" refX="6" refY="3" orient="auto"><polygon points="0 0,7 3,0 6" fill="#9673a6"/></marker>
|
||||
<marker id="fsm-r" markerWidth="7" markerHeight="6" refX="6" refY="3" orient="auto"><polygon points="0 0,7 3,0 6" fill="#b85450"/></marker>
|
||||
<marker id="fsm-a" markerWidth="7" markerHeight="6" refX="6" refY="3" orient="auto"><polygon points="0 0,7 3,0 6" fill="#d6b656"/></marker>
|
||||
</defs>
|
||||
<text x="20" y="24" font-family="monospace" font-size="14" font-weight="bold" fill="#e8e8e8">Maestro 任务状态机(据 src/model/status.ts TRANSITIONS)</text>
|
||||
<!-- edges -->
|
||||
<path d="M 80 295 Q 160 190 206 108" stroke="#d6783b" stroke-width="1.5" fill="none" marker-end="url(#fsm-o)"/>
|
||||
<path d="M 92 298 Q 160 245 198 205" stroke="#5b8fd6" stroke-width="1.5" fill="none" marker-end="url(#fsm-b)"/>
|
||||
<path d="M 104 310 Q 160 310 202 310" stroke="#82b366" stroke-width="1.5" fill="none" marker-end="url(#fsm-g)"/>
|
||||
<path d="M 308 90 Q 360 90 386 90" stroke="#d6783b" stroke-width="1.5" fill="none" marker-end="url(#fsm-o)"/>
|
||||
<path d="M 512 90 Q 568 90 594 90" stroke="#d6783b" stroke-width="1.5" fill="none" marker-end="url(#fsm-o)"/>
|
||||
<path d="M 430 73 Q 350 42 272 73" stroke="#b85450" stroke-width="1.5" fill="none" marker-end="url(#fsm-r)"/>
|
||||
<path d="M 718 98 Q 910 180 1010 295" stroke="#d6783b" stroke-width="1.5" fill="none" marker-end="url(#fsm-o)"/>
|
||||
<path d="M 598 80 Q 430 28 262 75" stroke="#d6783b" stroke-width="1.5" fill="none" stroke-dasharray="4,3" marker-end="url(#fsm-o)"/>
|
||||
<path d="M 304 190 Q 360 190 386 190" stroke="#5b8fd6" stroke-width="1.5" fill="none" marker-end="url(#fsm-b)"/>
|
||||
<path d="M 452 208 Q 360 252 282 294" stroke="#5b8fd6" stroke-width="1.5" fill="none" marker-end="url(#fsm-g)"/>
|
||||
<path d="M 430 176 Q 350 150 272 177" stroke="#b85450" stroke-width="1.5" fill="none" marker-end="url(#fsm-r)"/>
|
||||
<path d="M 296 310 Q 360 310 388 310" stroke="#82b366" stroke-width="1.5" fill="none" marker-end="url(#fsm-g)"/>
|
||||
<path d="M 388 326 Q 350 346 308 328" stroke="#82b366" stroke-width="1.5" fill="none" marker-end="url(#fsm-g)"/>
|
||||
<path d="M 470 310 Q 518 310 558 310" stroke="#9673a6" stroke-width="1.5" fill="none" marker-end="url(#fsm-p)"/>
|
||||
<path d="M 658 310 Q 720 310 760 310" stroke="#9673a6" stroke-width="1.5" fill="none" marker-end="url(#fsm-p)"/>
|
||||
<path d="M 874 310 Q 958 310 1012 310" stroke="#9673a6" stroke-width="1.5" fill="none" marker-end="url(#fsm-p)"/>
|
||||
<path d="M 800 328 Q 520 422 288 326" stroke="#b85450" stroke-width="1.5" fill="none" marker-end="url(#fsm-r)"/>
|
||||
<path d="M 250 328 Q 250 382 250 420" stroke="#b85450" stroke-width="1.5" fill="none" marker-end="url(#fsm-r)"/>
|
||||
<path d="M 286 424 Q 326 382 282 328" stroke="#82b366" stroke-width="1.5" fill="none" marker-end="url(#fsm-g)"/>
|
||||
<path d="M 652 326 Q 736 384 788 424" stroke="#b85450" stroke-width="1.5" fill="none" marker-end="url(#fsm-r)"/>
|
||||
<path d="M 578 326 Q 556 392 588 430" stroke="#d6b656" stroke-width="1.5" fill="none" stroke-dasharray="4,3" marker-end="url(#fsm-a)"/>
|
||||
<path d="M 786 432 Q 600 358 470 326" stroke="#d6783b" stroke-width="1.5" fill="none" marker-end="url(#fsm-o)"/>
|
||||
<path d="M 762 448 Q 720 448 678 448" stroke="#b85450" stroke-width="1.5" fill="none" marker-end="url(#fsm-r)"/>
|
||||
<path d="M 558 434 Q 410 378 292 332" stroke="#d6783b" stroke-width="1.5" fill="none" marker-end="url(#fsm-o)"/>
|
||||
<!-- edge labels -->
|
||||
<text x="148" y="198" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#d6783b">hard</text>
|
||||
<text x="150" y="250" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#5b8fd6">medium</text>
|
||||
<text x="156" y="302" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#82b366">easy</text>
|
||||
<text x="350" y="80" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#d6783b">拆解完成</text>
|
||||
<text x="560" y="80" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#d6783b">accept</text>
|
||||
<text x="350" y="50" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#b85450">reject</text>
|
||||
<text x="900" y="172" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#d6783b">子任务全 done</text>
|
||||
<text x="430" y="26" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#d6783b">重拆</text>
|
||||
<text x="350" y="180" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#5b8fd6">方案完成</text>
|
||||
<text x="356" y="256" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#82b366">accept</text>
|
||||
<text x="350" y="150" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#b85450">reject</text>
|
||||
<text x="348" y="302" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#82b366">调度领取</text>
|
||||
<text x="350" y="346" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#82b366">退回</text>
|
||||
<text x="516" y="302" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#9673a6">worker 启动</text>
|
||||
<text x="716" y="302" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#9673a6">执行完成</text>
|
||||
<text x="958" y="302" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#9673a6">accept(合并)</text>
|
||||
<text x="540" y="402" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#b85450">reject(返工)</text>
|
||||
<text x="182" y="386" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#b85450">依赖未满足</text>
|
||||
<text x="330" y="386" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#82b366">依赖满足</text>
|
||||
<text x="772" y="360" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#b85450">执行失败</text>
|
||||
<text x="470" y="396" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#d6b656">分歧重评估(规则13)</text>
|
||||
<text x="624" y="360" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#d6783b">退避重试</text>
|
||||
<text x="712" y="440" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#b85450">超限</text>
|
||||
<text x="430" y="372" text-anchor="middle" font-family="sans-serif" font-size="8.5" fill="#d6783b">人工 requeue</text>
|
||||
<!-- nodes -->
|
||||
<ellipse cx="64" cy="310" rx="40" ry="18" fill="#2a2a2a" stroke="#888888"/>
|
||||
<text x="64" y="314" text-anchor="middle" font-family="monospace" font-size="11" fill="#aaaaaa">init</text>
|
||||
<ellipse cx="250" cy="90" rx="58" ry="18" fill="#2e2014" stroke="#d6783b"/>
|
||||
<text x="250" y="94" text-anchor="middle" font-family="monospace" font-size="11" fill="#f0a060">analyzing</text>
|
||||
<ellipse cx="450" cy="90" rx="62" ry="18" fill="#2e2014" stroke="#d6783b"/>
|
||||
<text x="450" y="94" text-anchor="middle" font-family="monospace" font-size="11" fill="#f0a060">plan_review</text>
|
||||
<ellipse cx="660" cy="90" rx="64" ry="18" fill="#2e2014" stroke="#d6783b"/>
|
||||
<text x="660" y="94" text-anchor="middle" font-family="monospace" font-size="11" fill="#f0a060">decomposed</text>
|
||||
<ellipse cx="250" cy="190" rx="54" ry="18" fill="#14233a" stroke="#5b8fd6"/>
|
||||
<text x="250" y="194" text-anchor="middle" font-family="monospace" font-size="11" fill="#7ab0ff">speccing</text>
|
||||
<ellipse cx="450" cy="190" rx="62" ry="18" fill="#14233a" stroke="#5b8fd6"/>
|
||||
<text x="450" y="194" text-anchor="middle" font-family="monospace" font-size="11" fill="#7ab0ff">spec_review</text>
|
||||
<ellipse cx="250" cy="310" rx="46" ry="18" fill="#1a2e1a" stroke="#82b366"/>
|
||||
<text x="250" y="314" text-anchor="middle" font-family="monospace" font-size="11" fill="#82b366">ready</text>
|
||||
<ellipse cx="420" cy="310" rx="50" ry="18" fill="#1a2e1a" stroke="#82b366"/>
|
||||
<text x="420" y="314" text-anchor="middle" font-family="monospace" font-size="11" fill="#82b366">queued</text>
|
||||
<ellipse cx="600" cy="310" rx="58" ry="18" fill="#221a2e" stroke="#9673a6"/>
|
||||
<text x="600" y="314" text-anchor="middle" font-family="monospace" font-size="11" fill="#c4a8d4">executing</text>
|
||||
<ellipse cx="810" cy="310" rx="64" ry="18" fill="#221a2e" stroke="#9673a6"/>
|
||||
<text x="810" y="314" text-anchor="middle" font-family="monospace" font-size="11" fill="#c4a8d4">exec_review</text>
|
||||
<ellipse cx="1050" cy="310" rx="42" ry="18" fill="#1a472a" stroke="#2d7a40"/>
|
||||
<text x="1050" y="314" text-anchor="middle" font-family="monospace" font-size="11" font-weight="bold" fill="#ffffff">done</text>
|
||||
<ellipse cx="250" cy="440" rx="50" ry="18" fill="#2e1a1a" stroke="#b85450"/>
|
||||
<text x="250" y="444" text-anchor="middle" font-family="monospace" font-size="11" fill="#e07070">blocked</text>
|
||||
<ellipse cx="810" cy="440" rx="46" ry="18" fill="#2e1a1a" stroke="#b85450"/>
|
||||
<text x="810" y="444" text-anchor="middle" font-family="monospace" font-size="11" fill="#e07070">failed</text>
|
||||
<ellipse cx="600" cy="448" rx="76" ry="18" fill="#2e2014" stroke="#d6b656"/>
|
||||
<text x="600" y="452" text-anchor="middle" font-family="monospace" font-size="11" fill="#e6c860">needs_attention</text>
|
||||
<ellipse cx="110" cy="545" rx="48" ry="18" fill="#2e2a14" stroke="#d6b656"/>
|
||||
<text x="110" y="549" text-anchor="middle" font-family="monospace" font-size="11" fill="#d6b656">paused</text>
|
||||
<ellipse cx="300" cy="545" rx="58" ry="18" fill="#2e2e2e" stroke="#555555"/>
|
||||
<text x="300" y="549" text-anchor="middle" font-family="monospace" font-size="11" font-weight="bold" fill="#888888">cancelled</text>
|
||||
<!-- legend -->
|
||||
<rect x="900" y="470" width="240" height="112" fill="#11161f" stroke="#252b36" rx="4"/>
|
||||
<line x1="912" y1="486" x2="934" y2="486" stroke="#d6783b" stroke-width="2"/><text x="942" y="489" font-family="sans-serif" font-size="9" fill="#9aa4b2">Hard 拆解</text>
|
||||
<line x1="912" y1="502" x2="934" y2="502" stroke="#5b8fd6" stroke-width="2"/><text x="942" y="505" font-family="sans-serif" font-size="9" fill="#9aa4b2">Medium 方案</text>
|
||||
<line x1="912" y1="518" x2="934" y2="518" stroke="#82b366" stroke-width="2"/><text x="942" y="521" font-family="sans-serif" font-size="9" fill="#9aa4b2">执行调度</text>
|
||||
<line x1="912" y1="534" x2="934" y2="534" stroke="#9673a6" stroke-width="2"/><text x="942" y="537" font-family="sans-serif" font-size="9" fill="#9aa4b2">Agent 运行</text>
|
||||
<line x1="912" y1="550" x2="934" y2="550" stroke="#b85450" stroke-width="2"/><text x="942" y="553" font-family="sans-serif" font-size="9" fill="#9aa4b2">异常 / 失败</text>
|
||||
<line x1="912" y1="566" x2="934" y2="566" stroke="#d6b656" stroke-width="2" stroke-dasharray="4,3"/><text x="942" y="569" font-family="sans-serif" font-size="9" fill="#9aa4b2">规则13 分歧重评估</text>
|
||||
<text x="20" y="590" font-family="sans-serif" font-size="9" fill="#64748b">注:needs_attention 可回 ready/queued/analyzing/speccing(人工 requeue,图中以单边代表);paused 与所有活跃态双向互通、cancelled 任意态可达(略去以保主干清晰)。</text>
|
||||
</svg>
|
||||
|
||||
<div style="margin-top:12px;color:var(--text2);font-size:12px">
|
||||
⊙ = 人审闸(plan_review / spec_review / exec_review) ·
|
||||
@@ -848,7 +907,9 @@ stateDiagram-v2
|
||||
<div class="db-col"><span class="col-name">max_retries</span><span class="col-type">INTEGER</span><span class="col-note">失败最大重试次数(默认2)</span></div>
|
||||
<div class="db-col"><span class="col-name">timeout_ms</span><span class="col-type">INTEGER</span><span class="col-note">单次执行超时毫秒(默认30min)</span></div>
|
||||
<div class="db-col"><span class="col-name">verify_cmd</span><span class="col-type">TEXT?</span><span class="col-note">验证命令(未配=视为通过)</span></div>
|
||||
<div class="db-col"><span class="col-name">model</span><span class="col-type">TEXT?</span><span class="col-note">项目级模型覆盖(最优先)</span></div>
|
||||
<div class="db-col"><span class="col-name">model</span><span class="col-type">TEXT?</span><span class="col-note">旧·单项目级模型覆盖(仅 exec/planner)</span></div>
|
||||
<div class="db-col highlight"><span class="col-name">models</span><span class="col-type">TEXT?</span><span class="col-note">🆕 按角色×复杂度模型配置 JSON(executor/planner/reviewer/conflict;默认 opus-4.8)</span></div>
|
||||
<div class="db-col highlight"><span class="col-name">agent_rules</span><span class="col-type">TEXT?</span><span class="col-note">🆕 项目级 agent 规范(注入 4 处 prompt,记忆 L2)</span></div>
|
||||
<div class="db-col highlight"><span class="col-name">checks</span><span class="col-type">TEXT?</span><span class="col-note">🆕 分项检查配置 JSON(lint/typecheck/build)</span></div>
|
||||
<div class="db-col highlight"><span class="col-name">auto_approve_plan</span><span class="col-type">INTEGER</span><span class="col-note">🆕 全easy子任务自动放行(0=关)</span></div>
|
||||
<div class="db-col highlight"><span class="col-name">auto_approve_exec</span><span class="col-type">INTEGER</span><span class="col-note">🆕 双approve自动合并(0=关)</span></div>
|
||||
@@ -868,6 +929,7 @@ stateDiagram-v2
|
||||
<div class="db-col"><span class="col-name">status</span><span class="col-type">TEXT</span><span class="col-note">见状态机(16种)</span></div>
|
||||
<div class="db-col"><span class="col-name">priority</span><span class="col-type">INTEGER</span><span class="col-note">P0=最高 / P1=中 / P2=最低;cat1 planner 可直接输出</span></div>
|
||||
<div class="db-col"><span class="col-name">deps</span><span class="col-type">TEXT</span><span class="col-note">JSON ids;cat1 planner 可直接产出,序号→id 二次映射后写入</span></div>
|
||||
<div class="db-col highlight"><span class="col-name">scope_files</span><span class="col-type">TEXT?</span><span class="col-note">🆕 声明改动范围 glob JSON;越界硬闸 + 规则13 分歧重评估据此判定</span></div>
|
||||
<div class="db-col"><span class="col-name">plan</span><span class="col-type">TEXT?</span><span class="col-note">Hard:分析+拆解(decompose 写入)</span></div>
|
||||
<div class="db-col"><span class="col-name">spec</span><span class="col-type">TEXT?</span><span class="col-note">Medium:改动方案(spec 写入)</span></div>
|
||||
<div class="db-col"><span class="col-name">operations</span><span class="col-type">TEXT?</span><span class="col-note">Easy:操作说明</span></div>
|
||||
@@ -916,8 +978,76 @@ stateDiagram-v2
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 style="margin-top:24px">表关系(ER · 主外键)</h3>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 920 440" style="width:100%;display:block;margin:12px 0;max-width:920px">
|
||||
<defs>
|
||||
<marker id="er-fk" markerWidth="8" markerHeight="7" refX="7" refY="3.5" orient="auto"><polygon points="0 0,8 3.5,0 7" fill="#64748b"/></marker>
|
||||
</defs>
|
||||
<!-- 关系连线(projects/tasks 为父,1—N 指向子;tasks 自引用 parent_id)-->
|
||||
<!-- projects 1—N tasks -->
|
||||
<path d="M 150 152 Q 150 230 312 256" stroke="#64748b" stroke-width="1.5" fill="none" marker-end="url(#er-fk)"/>
|
||||
<text x="150" y="210" text-anchor="middle" font-family="sans-serif" font-size="11" fill="#9aa4b2">1</text>
|
||||
<text x="262" y="248" text-anchor="middle" font-family="sans-serif" font-size="11" fill="#9aa4b2">N</text>
|
||||
<!-- tasks 自引用 parent_id -->
|
||||
<path d="M 470 232 Q 540 196 506 232" stroke="#82b366" stroke-width="1.5" fill="none" stroke-dasharray="4,3" marker-end="url(#er-fk)"/>
|
||||
<text x="540" y="200" text-anchor="middle" font-family="sans-serif" font-size="10" fill="#82b366">parent_id (自引用)</text>
|
||||
<!-- tasks 1—N runs -->
|
||||
<path d="M 488 268 Q 640 250 700 168" stroke="#64748b" stroke-width="1.5" fill="none" marker-end="url(#er-fk)"/>
|
||||
<text x="520" y="258" text-anchor="middle" font-family="sans-serif" font-size="11" fill="#9aa4b2">1</text>
|
||||
<text x="676" y="186" text-anchor="middle" font-family="sans-serif" font-size="11" fill="#9aa4b2">N</text>
|
||||
<!-- tasks 1—N approvals -->
|
||||
<path d="M 488 300 Q 640 330 700 326" stroke="#64748b" stroke-width="1.5" fill="none" marker-end="url(#er-fk)"/>
|
||||
<text x="520" y="316" text-anchor="middle" font-family="sans-serif" font-size="11" fill="#9aa4b2">1</text>
|
||||
<text x="676" y="318" text-anchor="middle" font-family="sans-serif" font-size="11" fill="#9aa4b2">N</text>
|
||||
<!-- projects 1—N events / tasks 1—N events -->
|
||||
<path d="M 120 152 Q 90 360 322 392" stroke="#64748b" stroke-width="1.5" fill="none" marker-end="url(#er-fk)"/>
|
||||
<text x="300" y="384" text-anchor="middle" font-family="sans-serif" font-size="11" fill="#9aa4b2">N</text>
|
||||
<path d="M 400 326 Q 400 360 400 372" stroke="#64748b" stroke-width="1.5" fill="none" marker-end="url(#er-fk)"/>
|
||||
<text x="414" y="352" text-anchor="middle" font-family="sans-serif" font-size="11" fill="#9aa4b2">N</text>
|
||||
|
||||
<!-- projects -->
|
||||
<rect x="40" y="40" width="220" height="112" rx="6" fill="#11161f" stroke="#d6b656"/>
|
||||
<rect x="40" y="40" width="220" height="26" rx="6" fill="#2e2a14" stroke="#d6b656"/>
|
||||
<text x="52" y="58" font-family="monospace" font-size="13" font-weight="bold" fill="#d6b656">projects</text>
|
||||
<text x="52" y="86" font-family="monospace" font-size="10.5" fill="#9aa4b2">id (PK) · autonomy · concurrency</text>
|
||||
<text x="52" y="104" font-family="monospace" font-size="10.5" fill="#9aa4b2">verify_cmd · model · checks</text>
|
||||
<text x="52" y="122" font-family="monospace" font-size="10.5" fill="#f0c674">models · agent_rules 🆕</text>
|
||||
<text x="52" y="140" font-family="monospace" font-size="10.5" fill="#f0c674">auto_approve_plan/exec 🆕</text>
|
||||
|
||||
<!-- tasks -->
|
||||
<rect x="312" y="232" width="176" height="98" rx="6" fill="#11161f" stroke="#82b366"/>
|
||||
<rect x="312" y="232" width="176" height="26" rx="6" fill="#1a2e1a" stroke="#82b366"/>
|
||||
<text x="324" y="250" font-family="monospace" font-size="13" font-weight="bold" fill="#82b366">tasks</text>
|
||||
<text x="324" y="278" font-family="monospace" font-size="10.5" fill="#9aa4b2">id (PK) · project_id (FK)</text>
|
||||
<text x="324" y="296" font-family="monospace" font-size="10.5" fill="#9aa4b2">parent_id (FK自) · depth · deps</text>
|
||||
<text x="324" y="314" font-family="monospace" font-size="10.5" fill="#7cc47c">scope_files 🆕 · complexity · status</text>
|
||||
|
||||
<!-- runs -->
|
||||
<rect x="700" y="96" width="180" height="72" rx="6" fill="#11161f" stroke="#9673a6"/>
|
||||
<rect x="700" y="96" width="180" height="26" rx="6" fill="#221a2e" stroke="#9673a6"/>
|
||||
<text x="712" y="114" font-family="monospace" font-size="13" font-weight="bold" fill="#c4a8d4">runs</text>
|
||||
<text x="712" y="142" font-family="monospace" font-size="10.5" fill="#9aa4b2">id (PK) · task_id (FK)</text>
|
||||
<text x="712" y="160" font-family="monospace" font-size="10.5" fill="#9aa4b2">kind(+conflict) · status · last_seq</text>
|
||||
|
||||
<!-- approvals -->
|
||||
<rect x="700" y="288" width="180" height="68" rx="6" fill="#11161f" stroke="#5b8fd6"/>
|
||||
<rect x="700" y="288" width="180" height="26" rx="6" fill="#14233a" stroke="#5b8fd6"/>
|
||||
<text x="712" y="306" font-family="monospace" font-size="13" font-weight="bold" fill="#7ab0ff">approvals</text>
|
||||
<text x="712" y="334" font-family="monospace" font-size="10.5" fill="#9aa4b2">id (PK) · task_id (FK)</text>
|
||||
<text x="712" y="350" font-family="monospace" font-size="10.5" fill="#9aa4b2">gate · action · reason</text>
|
||||
|
||||
<!-- events -->
|
||||
<rect x="300" y="372" width="220" height="56" rx="6" fill="#11161f" stroke="#b85450"/>
|
||||
<rect x="300" y="372" width="220" height="26" rx="6" fill="#2e1a1a" stroke="#b85450"/>
|
||||
<text x="312" y="390" font-family="monospace" font-size="13" font-weight="bold" fill="#e07070">events</text>
|
||||
<text x="312" y="418" font-family="monospace" font-size="10.5" fill="#9aa4b2">project_id (FK) · task_id (FK?) · type · payload</text>
|
||||
</svg>
|
||||
<div style="color:var(--text2);font-size:12px">
|
||||
projects 1—N tasks(项目下多任务)· tasks 自引用 parent_id(Hard 拆解树)· tasks 1—N runs / approvals(每任务多次运行与审批)· projects/tasks 1—N events(审计日志,task_id 可空)。
|
||||
</div>
|
||||
|
||||
<div style="margin-top:16px;color:var(--text2);font-size:12px">
|
||||
🆕 标注的列是本轮优化新增字段(projects 表 schema 需 migration);runs.kind 无 CHECK 约束,加 'conflict' 兼容老数据。
|
||||
🆕 标注的列是本轮优化新增字段(projects/tasks 表 schema 经 ensureColumn 幂等迁移);runs.kind 无 CHECK 约束,加 'conflict' 兼容老数据。
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -947,21 +1077,5 @@ stateDiagram-v2
|
||||
</section>
|
||||
|
||||
</main>
|
||||
|
||||
<script>
|
||||
mermaid.initialize({
|
||||
startOnLoad: true,
|
||||
theme: 'dark',
|
||||
themeVariables: {
|
||||
background: '#1a1d27',
|
||||
primaryColor: '#242736',
|
||||
primaryTextColor: '#e2e4ef',
|
||||
primaryBorderColor: '#2e3148',
|
||||
lineColor: '#6c8aff',
|
||||
secondaryColor: '#1a1d27',
|
||||
tertiaryColor: '#242736',
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user