wishforge-ide/scripts/generate-architecture-svgs.mjs
eust-w da1cfcea13 🔥 Remove the cloud IDE
The cluster never ran Theia or the IDE gateway, so every workspace stayed
"未配置" forever. The feature is gone instead of half-present:

- API: workspace, launch and lifecycle endpoints, the gateway identity and
  its internal routes, the dispatcher's workspace provisioning and the
  lifecycle worker. Migration 003 deletes stored workspaces and settles
  their pending outbox items.
- Provisioner: workspace provisioning and lifecycle for both backends.
- Web: the 云 IDE panel, the launch route, the start-branch picker that
  listed IDE branches, and the workspace count on usage.
- apps/ide, infra/oct, dev:ide and the CI job; IDE parts of local k3s,
  network policies, RBAC, docs and the architecture diagram.

A wish can still start from a pushed branch through the API (sourceBranch).
Plan files and stored entitlements may still carry maxWorkspaces; it is
accepted and ignored.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-04 12:43:02 +08:00

345 lines
22 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import fs from 'node:fs';
const archSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1100 780" width="100%" height="100%">
<defs>
<style>
.bg { fill: #f8fafc; }
.box { rx: 10px; ry: 10px; stroke-width: 1.5px; filter: drop-shadow(0 4px 12px rgba(15,23,42,0.06)); }
.client-box { fill: #ffffff; stroke: #cbd5e1; }
.ctrl-box { fill: #ffffff; stroke: #0284c7; }
.exec-box { fill: #ffffff; stroke: #0d9488; }
.target-box { fill: #ffffff; stroke: #6366f1; }
.data-box { fill: #ffffff; stroke: #f59e0b; }
.title { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif; font-weight: 700; fill: #0f172a; }
.subtitle { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif; font-size: 13px; fill: #64748b; }
.badge { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 11px; font-weight: 600; text-anchor: middle; }
.item-title { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif; font-size: 14px; font-weight: 600; fill: #1e293b; }
.item-desc { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif; font-size: 12px; fill: #64748b; line-height: 1.4; }
.arrow { stroke: #64748b; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.arrow-dashed { stroke: #0d9488; stroke-width: 1.8; stroke-dasharray: 5 4; fill: none; }
.arrow-accent { stroke: #0284c7; stroke-width: 2; fill: none; }
</style>
<marker id="arrowhead" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#64748b" />
</marker>
<marker id="arrowhead-accent" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#0284c7" />
</marker>
<marker id="arrowhead-teal" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#0d9488" />
</marker>
</defs>
<!-- Background -->
<rect width="100%" height="100%" fill="#f8fafc" />
<!-- Main Banner -->
<text x="40" y="45" class="title" font-size="24">WishForge 总体系统架构设计全景图</text>
<text x="40" y="70" class="subtitle">端到端交付流水线 · 控制面唯一事实来源 · 执行与物理验证解耦 · 驻地 Runner 安全交付</text>
<!-- 1. 接入层 (Client Layer) -->
<g transform="translate(40, 95)">
<rect width="1020" height="110" rx="12" fill="#f1f5f9" stroke="#e2e8f0" stroke-width="1.5" />
<text x="24" y="28" class="title" font-size="14" fill="#334155">1. 接入层 (CLIENT ENTRY)</text>
<!-- Item 1: Web -->
<rect x="24" y="40" width="310" height="56" class="box client-box" />
<circle cx="48" cy="68" r="14" fill="#e0f2fe" />
<path d="M42 68 h12 M48 62 v12" stroke="#0284c7" stroke-width="2" stroke-linecap="round"/>
<text x="72" y="62" class="item-title">Web 控制台 (Next.js 16)</text>
<text x="72" y="80" class="item-desc">BFF 架构 / OIDC 单点登录 / 仪表盘与运行详情</text>
<!-- Item 2: MCP -->
<rect x="354" y="40" width="640" height="56" class="box client-box" />
<circle cx="378" cy="68" r="14" fill="#ccfbf1" />
<text x="378" y="73" fill="#0d9488" font-size="12" font-weight="bold" text-anchor="middle">M</text>
<text x="402" y="62" class="item-title">MCP 客户端集成</text>
<text x="402" y="80" class="item-desc">Codex / WorkBuddy 直接许愿与进度追踪</text>
</g>
<!-- Connectors from Clients to Control Plane -->
<path d="M 195 205 L 195 245" class="arrow-accent" marker-end="url(#arrowhead-accent)" />
<path d="M 510 205 L 510 245" class="arrow" marker-end="url(#arrowhead)" />
<!-- 2. 控制面 (Control Plane) -->
<g transform="translate(40, 245)">
<rect width="640" height="230" rx="12" fill="#f0f9ff" stroke="#bae6fd" stroke-width="1.5" />
<text x="24" y="28" class="title" font-size="14" fill="#0369a1">2. 控制面集群 (CONTROL PLANE - 单一事实来源)</text>
<!-- API Core -->
<rect x="24" y="44" width="280" height="80" class="box ctrl-box" />
<text x="40" y="70" class="item-title">API 网关核心 (NestJS)</text>
<text x="40" y="90" class="item-desc">REST /v1 · 内部契约 /internal</text>
<text x="40" y="108" class="item-desc">状态机裁决 · RBAC · 配额与租约控制</text>
<!-- Model Proxy -->
<rect x="330" y="44" width="280" height="80" class="box ctrl-box" />
<text x="346" y="70" class="item-title">模型网关与优化代理</text>
<text x="346" y="90" class="item-desc">地瓜网关 (Anthropic 协议)</text>
<text x="346" y="108" class="item-desc">Flash/Pro 双模型兜底 · 凭据隔离脱敏</text>
<!-- Outbox Dispatcher & Git -->
<rect x="24" y="136" width="280" height="74" class="box ctrl-box" />
<text x="40" y="162" class="item-title">Outbox 派发与生命周期</text>
<text x="40" y="180" class="item-desc">事务级 Outbox (SKIP LOCKED)</text>
<text x="40" y="196" class="item-desc">代次隔离 (Generation) · 租约续期</text>
<rect x="330" y="136" width="280" height="74" class="box ctrl-box" />
<text x="346" y="162" class="item-title">平台 Git 服务 (Smart HTTP)</text>
<text x="346" y="180" class="item-desc">短期 Token 权限隔离 · 目标分支保护</text>
<text x="346" y="196" class="item-desc">Gitea 部署密钥同步 · 代码审核门禁</text>
</g>
<!-- 3. 数据与编排持久层 -->
<g transform="translate(710, 245)">
<rect width="350" height="230" rx="12" fill="#fffbeb" stroke="#fde68a" stroke-width="1.5" />
<text x="24" y="28" class="title" font-size="14" fill="#b45309">3. 持久化与编排底层</text>
<rect x="24" y="44" width="300" height="52" class="box data-box" />
<text x="40" y="68" class="item-title">PostgreSQL 17 (RLS 租户隔离)</text>
<text x="40" y="86" class="item-desc">运行状态表、证据链、审计日志、不可篡改存证</text>
<rect x="24" y="104" width="300" height="52" class="box data-box" />
<text x="40" y="128" class="item-title">Temporal 分布式编排引擎</text>
<text x="40" y="146" class="item-desc">长流程调度、超时重试、状态断点持久化恢复</text>
<rect x="24" y="164" width="300" height="52" class="box data-box" />
<text x="40" y="188" class="item-title">S3 / MinIO 检查点对象存储</text>
<text x="40" y="206" class="item-desc">代码 Bundle 增量快照、测试日志、制品元数据</text>
</g>
<!-- Connection: API to Temporal/PG -->
<path d="M 680 340 L 710 340" class="arrow" marker-end="url(#arrowhead)" />
<!-- 4. 执行面与隔离沙箱 -->
<g transform="translate(40, 505)">
<rect width="640" height="235" rx="12" fill="#f0fdfa" stroke="#99f6e4" stroke-width="1.5" />
<text x="24" y="26" class="title" font-size="14" fill="#0f766e">4. 隔离执行面 (EXECUTION &amp; VERIFICATION)</text>
<!-- Temporal Worker Set -->
<rect x="24" y="40" width="280" height="175" rx="8" fill="#ffffff" stroke="#0d9488" stroke-width="1.2" />
<text x="36" y="62" class="item-title" fill="#0f766e">Temporal Workers 矩阵</text>
<text x="36" y="82" class="item-desc">• <tspan font-weight="600">Coordinator</tspan>: 状态机编排与心跳</text>
<text x="36" y="104" class="item-desc">• <tspan font-weight="600">Executor</tspan>: 调起编码 Agent CLI</text>
<text x="36" y="126" class="item-desc">• <tspan font-weight="600">Verifier</tspan>: 调度沙箱独立验证</text>
<text x="36" y="148" class="item-desc">• <tspan font-weight="600">Deployer</tspan>: 签名生成不可篡改发布任务</text>
<text x="36" y="170" class="item-desc">• 自动自修复闭环 (Auto-Repair Loop)</text>
<text x="36" y="192" class="item-desc">• 检查点 Commit 状态精准断点恢复</text>
<!-- Sandbox Check Pods -->
<rect x="330" y="40" width="280" height="175" rx="8" fill="#ffffff" stroke="#0d9488" stroke-width="1.2" />
<text x="344" y="62" class="item-title" fill="#0f766e">受保护验证沙箱 (Check Pods)</text>
<text x="344" y="82" class="item-desc">• 运行于独立命名空间 wishforge-checks</text>
<text x="344" y="104" class="item-desc">• 只读挂载 .git,严防 Agent 篡改测试</text>
<text x="344" y="126" class="item-desc">• 独立运行: TS类型、单元测试、构建</text>
<text x="344" y="148" class="item-desc">• 不挂载 Kubernetes 令牌与集群 Secret</text>
<text x="344" y="170" class="item-desc">• 物理证据裁决 (物理通过 vs 模型声称)</text>
<text x="344" y="192" class="item-desc">• 失败自动捕获错误尾部流交还 Agent</text>
</g>
<!-- Connect API to Execution Plane -->
<path d="M 200 475 L 200 505" class="arrow" marker-end="url(#arrowhead)" />
<path d="M 480 505 L 480 475" class="arrow-dashed" marker-end="url(#arrowhead-teal)" />
<text x="486" y="492" font-size="10" fill="#0d9488" font-family="sans-serif">回传执行证据/检查点</text>
<!-- 5. 目标交付与 Runner -->
<g transform="translate(710, 505)">
<rect width="350" height="235" rx="12" fill="#eef2ff" stroke="#c7d2fe" stroke-width="1.5" />
<text x="24" y="26" class="title" font-size="14" fill="#4338ca">5. 目标集群与驻地交付 (DELIVERY)</text>
<!-- Runner -->
<rect x="24" y="40" width="300" height="78" class="box target-box" />
<text x="40" y="66" class="item-title">驻地 Runner (Pull-based 架构)</text>
<text x="40" y="86" class="item-desc">单向轮询控制面 · 零入站端口暴露</text>
<text x="40" y="104" class="item-desc">Ed25519 签名验签 · 防未授权提权部署</text>
<!-- Target Clusters -->
<rect x="24" y="128" width="300" height="87" class="box target-box" />
<text x="40" y="152" class="item-title">多环境目标集群</text>
<text x="40" y="172" class="item-desc">• <tspan font-weight="600">POC 集群</tspan>: droboticflow (poc 分支)</text>
<text x="40" y="192" class="item-desc">• <tspan font-weight="600">繁羽生产</tspan>: droboticflow-fanyu (dev 分支)</text>
<text x="40" y="208" class="item-desc">• 蓝绿部署 / 滚动金丝雀 / 自动探针验收</text>
</g>
<!-- Connection: Control Plane to Runner -->
<path d="M 680 610 L 710 610" class="arrow" marker-end="url(#arrowhead)" />
</svg>`;
const lifecycleSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1100 680" width="100%" height="100%">
<defs>
<style>
.title { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif; font-weight: 700; fill: #0f172a; }
.subtitle { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif; font-size: 13px; fill: #64748b; }
.stage-card { rx: 8px; ry: 8px; stroke-width: 1.5px; filter: drop-shadow(0 4px 8px rgba(15,23,42,0.05)); }
.card-title { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif; font-size: 14px; font-weight: 700; }
.card-actor { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.card-text { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif; font-size: 12px; fill: #475569; line-height: 1.45; }
.pipeline-line { stroke: #cbd5e1; stroke-width: 3; fill: none; }
.arrow-main { stroke: #0284c7; stroke-width: 2.2; fill: none; }
.arrow-repair { stroke: #ef4444; stroke-width: 2; stroke-dasharray: 6 4; fill: none; }
.arrow-audit { stroke: #f59e0b; stroke-width: 2; stroke-dasharray: 5 4; fill: none; }
.badge-repair { fill: #fef2f2; stroke: #f87171; stroke-width: 1; rx: 4; }
</style>
<marker id="arrowhead-flow" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#0284c7" />
</marker>
<marker id="arrowhead-red" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#ef4444" />
</marker>
<marker id="arrowhead-amber" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#f59e0b" />
</marker>
</defs>
<rect width="100%" height="100%" fill="#f8fafc" />
<!-- Banner -->
<text x="40" y="45" class="title" font-size="22">WishForge 八阶段严密交付流水线与自修复状态机</text>
<text x="40" y="70" class="subtitle">物理隔离验证 · 外部证据仲裁 · 严格拒绝 Agent 自审自决 · 异常出口完备</text>
<!-- STAGE 1: CLARIFY -->
<g transform="translate(40, 110)">
<rect width="230" height="150" class="stage-card" fill="#ffffff" stroke="#94a3b8" />
<rect x="0" y="0" width="230" height="6" rx="4" fill="#64748b" />
<text x="16" y="30" class="card-actor" fill="#64748b">STAGE 01 · EXECUTOR</text>
<text x="16" y="52" class="card-title" fill="#0f172a">01. 澄清 (Clarify)</text>
<text x="16" y="76" class="card-text">• 锁定用户核心需求与验收项</text>
<text x="16" y="98" class="card-text">• 调用 Flash/Pro 优化提示词</text>
<text x="16" y="120" class="card-text">• 歧义过大时进入 clarification 等待</text>
<circle cx="210" cy="30" r="10" fill="#f1f5f9" />
<text x="210" y="34" font-size="11" font-weight="bold" fill="#64748b" text-anchor="middle">1</text>
</g>
<!-- Arrow 1 -> 2 -->
<path d="M 270 185 L 305 185" class="arrow-main" marker-end="url(#arrowhead-flow)" />
<!-- STAGE 2: PLAN -->
<g transform="translate(305, 110)">
<rect width="230" height="150" class="stage-card" fill="#ffffff" stroke="#94a3b8" />
<rect x="0" y="0" width="230" height="6" rx="4" fill="#0284c7" />
<text x="16" y="30" class="card-actor" fill="#0284c7">STAGE 02 · EXECUTOR</text>
<text x="16" y="52" class="card-title" fill="#0f172a">02. 规划 (Plan)</text>
<text x="16" y="76" class="card-text">• 从目标分支切出独立任务分支</text>
<text x="16" y="98" class="card-text">• 生成结构化实现步骤事件流</text>
<text x="16" y="120" class="card-text">• 划定前后端代码触碰范围</text>
<circle cx="210" cy="30" r="10" fill="#e0f2fe" />
<text x="210" y="34" font-size="11" font-weight="bold" fill="#0284c7" text-anchor="middle">2</text>
</g>
<!-- Arrow 2 -> 3 -->
<path d="M 535 185 L 570 185" class="arrow-main" marker-end="url(#arrowhead-flow)" />
<!-- STAGE 3: IMPLEMENT -->
<g transform="translate(570, 110)">
<rect width="230" height="150" class="stage-card" fill="#ffffff" stroke="#0d9488" stroke-width="2" />
<rect x="0" y="0" width="230" height="6" rx="4" fill="#0d9488" />
<text x="16" y="30" class="card-actor" fill="#0d9488">STAGE 03 · AGENT WORKER</text>
<text x="16" y="52" class="card-title" fill="#0f172a">03. 实现 (Implement)</text>
<text x="16" y="76" class="card-text">• Claude CLI / CodeBuddy 编码</text>
<text x="16" y="98" class="card-text">• 256 MiB 流式输出防死循环限额</text>
<text x="16" y="120" class="card-text">• 生成检查点 Commit 与增量包</text>
<circle cx="210" cy="30" r="10" fill="#ccfbf1" />
<text x="210" y="34" font-size="11" font-weight="bold" fill="#0d9488" text-anchor="middle">3</text>
</g>
<!-- Arrow 3 -> 4 -->
<path d="M 800 185 L 835 185" class="arrow-main" marker-end="url(#arrowhead-flow)" />
<!-- STAGE 4: VERIFY (Core Anchor) -->
<g transform="translate(835, 110)">
<rect width="230" height="150" class="stage-card" fill="#f0fdfa" stroke="#0d9488" stroke-width="2" />
<rect x="0" y="0" width="230" height="6" rx="4" fill="#0f766e" />
<text x="16" y="30" class="card-actor" fill="#0f766e">STAGE 04 · VERIFIER (沙箱隔离)</text>
<text x="16" y="52" class="card-title" fill="#042f2e">04. 独立验证 (Verify)</text>
<text x="16" y="76" class="card-text" font-weight="600">• 启动全新 Check Pod 独立拉取</text>
<text x="16" y="98" class="card-text">• 运行只读受保护命令 (Test/Lint)</text>
<text x="16" y="120" class="card-text">• 拒绝 Agent 口头保证,物理验证</text>
<circle cx="210" cy="30" r="10" fill="#99f6e4" />
<text x="210" y="34" font-size="11" font-weight="bold" fill="#0f766e" text-anchor="middle">4</text>
</g>
<!-- REPAIR LOOP (From 4 back to 3) -->
<path d="M 950 260 L 950 310 L 685 310 L 685 268" class="arrow-repair" marker-end="url(#arrowhead-red)" />
<rect x="740" y="296" width="160" height="26" class="badge-repair" />
<text x="820" y="313" font-size="11" font-weight="bold" fill="#b91c1c" text-anchor="middle">测试失败: 携带报错自修复</text>
<!-- TURN DOWN from Stage 4 to Stage 5 -->
<path d="M 1030 260 L 1030 380 L 1000 380" class="arrow-main" marker-end="url(#arrowhead-flow)" />
<text x="965" y="372" font-size="11" font-weight="600" fill="#0284c7">验证通过</text>
<!-- ROW 2: STAGE 5, 6, 7, 8 (Right to Left flow for continuity) -->
<!-- STAGE 5: INTEGRATE -->
<g transform="translate(835, 410)">
<rect width="230" height="150" class="stage-card" fill="#ffffff" stroke="#94a3b8" />
<rect x="0" y="0" width="230" height="6" rx="4" fill="#6366f1" />
<text x="16" y="30" class="card-actor" fill="#6366f1">STAGE 05 · VERIFIER</text>
<text x="16" y="52" class="card-title" fill="#0f172a">05. 代码合入 (Integrate)</text>
<text x="16" y="76" class="card-text">• 合入目标分支 (poc / dev)</text>
<text x="16" y="98" class="card-text">• 后端改动拦截进入 code_review</text>
<text x="16" y="120" class="card-text">• Deploy Key 专用写权限推送</text>
<circle cx="210" cy="30" r="10" fill="#e0e7ff" />
<text x="210" y="34" font-size="11" font-weight="bold" fill="#6366f1" text-anchor="middle">5</text>
</g>
<!-- Arrow 5 -> 6 -->
<path d="M 835 485 L 800 485" class="arrow-main" marker-end="url(#arrowhead-flow)" />
<!-- STAGE 6: BUILD -->
<g transform="translate(570, 410)">
<rect width="230" height="150" class="stage-card" fill="#ffffff" stroke="#94a3b8" />
<rect x="0" y="0" width="230" height="6" rx="4" fill="#0284c7" />
<text x="16" y="30" class="card-actor" fill="#0284c7">STAGE 06 · BUILD POD</text>
<text x="16" y="52" class="card-title" fill="#0f172a">06. 制品构建 (Build)</text>
<text x="16" y="76" class="card-text">• Kaniko 容器安全无特权构建</text>
<text x="16" y="98" class="card-text">• 产物哈希固定 (Immutable Digest)</text>
<text x="16" y="120" class="card-text">• 多组件 (api/worker/coord) 对齐</text>
<circle cx="210" cy="30" r="10" fill="#e0f2fe" />
<text x="210" y="34" font-size="11" font-weight="bold" fill="#0284c7" text-anchor="middle">6</text>
</g>
<!-- Arrow 6 -> 7 -->
<path d="M 570 485 L 535 485" class="arrow-main" marker-end="url(#arrowhead-flow)" />
<!-- STAGE 7: RELEASE -->
<g transform="translate(305, 410)">
<rect width="230" height="150" class="stage-card" fill="#ffffff" stroke="#f59e0b" stroke-width="1.8" />
<rect x="0" y="0" width="230" height="6" rx="4" fill="#f59e0b" />
<text x="16" y="30" class="card-actor" fill="#d97706">STAGE 07 · RUNNER &amp; AUDIT</text>
<text x="16" y="52" class="card-title" fill="#0f172a">07. 签名发布 (Release)</text>
<text x="16" y="76" class="card-text">• Ed25519 签名发布防伪造</text>
<text x="16" y="98" class="card-text">• 高危变更触发人工 approval 审批</text>
<text x="16" y="120" class="card-text">• Runner 主动拉取与蓝绿 Rollout</text>
<circle cx="210" cy="30" r="10" fill="#fef3c7" />
<text x="210" y="34" font-size="11" font-weight="bold" fill="#d97706" text-anchor="middle">7</text>
</g>
<!-- Arrow 7 -> 8 -->
<path d="M 305 485 L 270 485" class="arrow-main" marker-end="url(#arrowhead-flow)" />
<!-- STAGE 8: ACCEPT -->
<g transform="translate(40, 410)">
<rect width="230" height="150" class="stage-card" fill="#f8fafc" stroke="#10b981" stroke-width="2" />
<rect x="0" y="0" width="230" height="6" rx="4" fill="#10b981" />
<text x="16" y="30" class="card-actor" fill="#059669">STAGE 08 · CONTROL PLANE</text>
<text x="16" y="52" class="card-title" fill="#065f46">08. 探针验收 (Accept)</text>
<text x="16" y="76" class="card-text">• 业务级 HTTP 冒烟检查与探针</text>
<text x="16" y="98" class="card-text">• 失败触发一键平滑回滚</text>
<text x="16" y="120" class="card-text">• 成功完成端到端闭环并存证</text>
<circle cx="210" cy="30" r="10" fill="#d1fae5" />
<text x="210" y="34" font-size="11" font-weight="bold" fill="#059669" text-anchor="middle">8</text>
</g>
<!-- Bottom Legend / Philosophy callout -->
<g transform="translate(40, 590)">
<rect width="1020" height="65" rx="8" fill="#ffffff" stroke="#e2e8f0" />
<text x="20" y="26" font-size="12" font-weight="700" fill="#334155">【架构设计原则】</text>
<text x="140" y="26" font-size="12" fill="#475569">① 会规划不等于会执行,会执行不等于会验收(各司其职) ② 多一个模型验收不等于多一份独立判断(必须依赖 Check Pod 物理证据)</text>
<text x="140" y="48" font-size="12" fill="#475569">③ 区分认知补偿与物理约束(模型升级可吸纳任务拆解,但吸纳不了权限、审计、一致性与回滚等不可妥协的工程系统)</text>
</g>
</svg>`;
fs.writeFileSync('docs/images/architecture-overview.svg', archSvg);
fs.writeFileSync('docs/images/eight-stages-lifecycle.svg', lifecycleSvg);
console.log('SVGs generated successfully.');