<mxfile host="Electron" modified="2024-03-05T10:00:00.000Z" agent="Mozilla/5.0" version="24.0.0" type="device">
  <diagram id="sgclaw_arch" name="sgClaw Architecture">
    <mxGraphModel dx="1400" dy="900" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1600" pageHeight="900" background="#F4F7F9" math="0" shadow="0">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />

        <!-- Swimlanes (Subgraphs) -->
        <mxCell id="browser_bg" value="🌐 浏览器侧 (P4+P2)" style="swimlane;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#cbd5e1;strokeWidth=2;fontStyle=1;startSize=36;rounded=1;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="160" y="40" width="280" height="460" as="geometry" />
        </mxCell>
        <mxCell id="sgclaw_bg" value="⚙️ sgClaw AI 引擎进程 (P1a+P1b)" style="swimlane;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#cbd5e1;strokeWidth=2;fontStyle=1;startSize=36;rounded=1;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="580" y="40" width="280" height="560" as="geometry" />
        </mxCell>
        <mxCell id="ext_bg" value="☁️ 远端服务与库 (P3)" style="swimlane;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#cbd5e1;strokeWidth=2;fontStyle=1;startSize=36;dashed=1;rounded=1;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="980" y="40" width="280" height="560" as="geometry" />
        </mxCell>

        <!-- Node: User -->
        <mxCell id="user" value="👤 用户操作" style="ellipse;whiteSpace=wrap;html=1;fillColor=#fef9c3;strokeColor=#eab308;strokeWidth=2;fontStyle=1;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="20" y="100" width="100" height="60" as="geometry" />
        </mxCell>

        <!-- Nodes in BROWSER -->
        <mxCell id="sidepanel" value="UI: AI 面板 (Vue)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#eff6ff;strokeColor=#2563eb;strokeWidth=2;fontStyle=1;" vertex="1" parent="browser_bg">
          <mxGeometry x="40" y="60" width="200" height="60" as="geometry" />
        </mxCell>
        <mxCell id="processhost" value="Host: 进程守护" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#eff6ff;strokeColor=#2563eb;strokeWidth=2;fontStyle=1;" vertex="1" parent="browser_bg">
          <mxGeometry x="40" y="160" width="200" height="60" as="geometry" />
        </mxCell>
        <mxCell id="pipelistener" value="IPC: Pipe 监听" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#eff6ff;strokeColor=#2563eb;strokeWidth=2;fontStyle=1;" vertex="1" parent="browser_bg">
          <mxGeometry x="40" y="260" width="200" height="60" as="geometry" />
        </mxCell>
        <mxCell id="cmd" value="Action: CDP 操纵指令" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#eff6ff;strokeColor=#2563eb;strokeWidth=2;fontStyle=1;" vertex="1" parent="browser_bg">
          <mxGeometry x="40" y="360" width="200" height="60" as="geometry" />
        </mxCell>

        <!-- Nodes in SGCLAW -->
        <mxCell id="runtime" value="Brain: ReAct 核心循环" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff7ed;strokeColor=#ea580c;strokeWidth=2;fontStyle=1;" vertex="1" parent="sgclaw_bg">
          <mxGeometry x="40" y="60" width="200" height="60" as="geometry" />
        </mxCell>
        <mxCell id="browsertool" value="Tool: Action 封装" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff7ed;strokeColor=#ea580c;strokeWidth=2;fontStyle=1;" vertex="1" parent="sgclaw_bg">
          <mxGeometry x="40" y="160" width="200" height="60" as="geometry" />
        </mxCell>
        <mxCell id="piperw" value="Core: Pipe 双向读写" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff7ed;strokeColor=#ea580c;strokeWidth=2;fontStyle=1;" vertex="1" parent="sgclaw_bg">
          <mxGeometry x="40" y="260" width="200" height="60" as="geometry" />
        </mxCell>
        <mxCell id="memory" value="Mem: 记忆层 (SQLite)" style="shape=cylinder3;boundedLbl=1;backgroundOutline=1;size=10;whiteSpace=wrap;html=1;fillColor=#fff7ed;strokeColor=#ea580c;strokeWidth=2;fontStyle=1;" vertex="1" parent="sgclaw_bg">
          <mxGeometry x="40" y="360" width="200" height="60" as="geometry" />
        </mxCell>
        <mxCell id="skillloader" value="Sandbox: 沙箱加载验签" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff7ed;strokeColor=#ea580c;strokeWidth=2;fontStyle=1;" vertex="1" parent="sgclaw_bg">
          <mxGeometry x="40" y="460" width="200" height="60" as="geometry" />
        </mxCell>

        <!-- Nodes in EXT -->
        <mxCell id="llm1" value="LLM: Minimax-M2.5 API" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f0fdf4;strokeColor=#16a34a;strokeWidth=2;fontStyle=1;" vertex="1" parent="ext_bg">
          <mxGeometry x="40" y="60" width="200" height="60" as="geometry" />
        </mxCell>
        <mxCell id="skilldb" value="Skill: 黄金/泛化技能库" style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;fillColor=#f0fdf4;strokeColor=#16a34a;strokeWidth=2;fontStyle=1;size=15;" vertex="1" parent="ext_bg">
          <mxGeometry x="30" y="460" width="220" height="60" as="geometry" />
        </mxCell>

        <!-- Edges -->
        
        <!-- User -> SidePanel -->
        <mxCell id="e_user_ui" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#64748b;strokeWidth=2;" edge="1" parent="1" source="user" target="sidepanel">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- SidePanel <-> ProcessHost -->
        <mxCell id="e_ui_host" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;endArrow=classic;strokeColor=#64748b;strokeWidth=2;" edge="1" parent="1" source="sidepanel" target="processhost">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="e_ui_host_l" value="Window IPC" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fillColor=#ffffff;fontStyle=1;fontColor=#475569;" vertex="1" connectable="0" parent="e_ui_host">
          <mxGeometry x="-0.1" y="0" relative="1" as="geometry">
            <mxPoint as="offset" />
          </mxGeometry>
        </mxCell>

        <!-- ProcessHost -> PipeListener -->
        <mxCell id="e_host_listener" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#64748b;strokeWidth=2;" edge="1" parent="1" source="processhost" target="pipelistener">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- PipeListener -.-> Cmd -->
        <mxCell id="e_listener_cmd" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;strokeColor=#64748b;strokeWidth=2;" edge="1" parent="1" source="pipelistener" target="cmd">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="e_listener_cmd_l" value="复用" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fillColor=#ffffff;fontStyle=1;fontColor=#475569;" vertex="1" connectable="0" parent="e_listener_cmd">
          <mxGeometry x="-0.1" y="0" relative="1" as="geometry">
            <mxPoint as="offset" />
          </mxGeometry>
        </mxCell>

        <!-- Internal SGCLAW Edges -->
        <!-- PipeRW <-> BrowserTool -->
        <mxCell id="e_piperw_tool" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;endArrow=classic;strokeColor=#64748b;strokeWidth=2;" edge="1" parent="1" source="piperw" target="browsertool">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- BrowserTool <-> Runtime -->
        <mxCell id="e_tool_runtime" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;endArrow=classic;strokeColor=#64748b;strokeWidth=2;" edge="1" parent="1" source="browsertool" target="runtime">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- Runtime -> Memory (Routed around left side) -->
        <mxCell id="e_runtime_mem" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#64748b;strokeWidth=2;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="runtime" target="memory">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="600" y="130" />
              <mxPoint x="600" y="430" />
            </Array>
          </mxGeometry>
        </mxCell>

        <!-- Runtime -> SkillLoader (Routed around right side) -->
        <mxCell id="e_runtime_skill" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#64748b;strokeWidth=2;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="runtime" target="skillloader">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="840" y="130" />
              <mxPoint x="840" y="530" />
            </Array>
          </mxGeometry>
        </mxCell>

        <!-- Cross-Boundary Edges -->
        
        <!-- PipeListener == PipeRW (Critical Path) -->
        <mxCell id="e_critical" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;endArrow=none;strokeColor=#ef4444;strokeWidth=4;" edge="1" parent="1" source="pipelistener" target="piperw">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="e_critical_l" value="⚡ 高风险卡点 (STDIO 双工流)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fillColor=#fef2f2;strokeColor=#fca5a5;fontColor=#991b1b;fontStyle=1;spacing=4;rounded=1;" vertex="1" connectable="0" parent="e_critical">
          <mxGeometry x="0" y="0" relative="1" as="geometry">
            <mxPoint y="-15" as="offset" />
          </mxGeometry>
        </mxCell>

        <!-- Runtime <-> LLM1 -->
        <mxCell id="e_runtime_llm" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;endArrow=classic;strokeColor=#64748b;strokeWidth=2;" edge="1" parent="1" source="runtime" target="llm1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="e_runtime_llm_l" value="提示词组装" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fillColor=#ffffff;fontStyle=1;fontColor=#475569;" vertex="1" connectable="0" parent="e_runtime_llm">
          <mxGeometry x="0" y="0" relative="1" as="geometry">
            <mxPoint as="offset" />
          </mxGeometry>
        </mxCell>

        <!-- SkillLoader -> SkillDB -->
        <mxCell id="e_skill_db" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#64748b;strokeWidth=2;" edge="1" parent="1" source="skillloader" target="skilldb">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="e_skill_db_l" value="签名挂载调用" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fillColor=#ffffff;fontStyle=1;fontColor=#475569;" vertex="1" connectable="0" parent="e_skill_db">
          <mxGeometry x="0" y="0" relative="1" as="geometry">
            <mxPoint as="offset" />
          </mxGeometry>
        </mxCell>

        <!-- BrowserTool -.-> PipeListener (Callback) -->
        <mxCell id="e_tool_cb" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;strokeColor=#2563eb;strokeWidth=2;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.25;entryDx=0;entryDy=0;" edge="1" parent="1" source="browsertool" target="pipelistener">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="540" y="230" />
              <mxPoint x="540" y="315" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="e_tool_cb_l" value="执行结果回调" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fillColor=#eff6ff;fontColor=#1e3a8a;fontStyle=1;" vertex="1" connectable="0" parent="e_tool_cb">
          <mxGeometry x="-0.15" y="0" relative="1" as="geometry">
            <mxPoint x="10" y="-12" as="offset" />
          </mxGeometry>
        </mxCell>

      </root>
    </mxGraphModel>
  </diagram>
</mxfile>