first commit

This commit is contained in:
zyl
2026-03-06 03:36:12 +08:00
commit 4e32b3193f
64 changed files with 42394 additions and 0 deletions

View File

@@ -0,0 +1,561 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>sgClaw 系统架构总图</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
background: #0f172a;
color: #f1f5f9;
padding: 40px 20px;
line-height: 1.6;
overflow-x: auto;
}
.container {
max-width: 1800px;
margin: 0 auto;
min-width: 1400px;
}
h1 {
font-size: 2.5rem;
margin-bottom: 10px;
background: linear-gradient(135deg, #38bdf8, #818cf8);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
text-align: center;
}
.subtitle {
color: #94a3b8;
font-size: 1.1rem;
margin-bottom: 40px;
text-align: center;
}
/* 图例 */
.legend {
display: flex;
justify-content: center;
gap: 30px;
margin-bottom: 40px;
padding: 20px;
background: rgba(255,255,255,0.05);
border-radius: 12px;
flex-wrap: wrap;
}
.legend-item {
display: flex;
align-items: center;
gap: 10px;
}
.legend-box {
width: 50px;
height: 30px;
border-radius: 6px;
border: 2px solid;
}
.legend-box.p1a { background: rgba(239,68,68,0.2); border-color: #ef4444; }
.legend-box.p1b { background: rgba(249,115,22,0.2); border-color: #f97316; }
.legend-box.p2 { background: rgba(56,189,248,0.2); border-color: #38bdf8; }
.legend-box.p3 { background: rgba(16,185,129,0.2); border-color: #10b981; }
.legend-box.p4 { background: rgba(129,140,248,0.2); border-color: #818cf8; }
.legend-box.existing { background: rgba(148,163,184,0.2); border-color: #94a3b8; }
.legend-label {
font-size: 0.9rem;
color: #cbd5e1;
}
/* 主架构图 */
.architecture-diagram {
background: rgba(15,23,42,0.8);
border: 2px solid rgba(56,189,248,0.3);
border-radius: 16px;
padding: 50px;
position: relative;
min-height: 900px;
}
/* 层级容器 */
.layer-container {
position: relative;
margin-bottom: 40px;
}
.layer-label {
font-size: 0.9rem;
color: #94a3b8;
font-weight: 700;
text-transform: uppercase;
margin-bottom: 15px;
letter-spacing: 1px;
}
/* 组件盒子 */
.component-box {
background: rgba(30,41,59,0.9);
border: 3px solid;
border-radius: 12px;
padding: 20px;
position: relative;
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.component-box.p1a { border-color: #ef4444; }
.component-box.p1b { border-color: #f97316; }
.component-box.p2 { border-color: #38bdf8; }
.component-box.p3 { border-color: #10b981; }
.component-box.p4 { border-color: #818cf8; }
.component-box.existing { border-color: #94a3b8; border-style: dashed; }
.component-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 15px;
padding-bottom: 10px;
border-bottom: 2px solid rgba(255,255,255,0.1);
}
.component-title {
font-size: 1.3rem;
font-weight: 700;
}
.component-title.p1a { color: #ef4444; }
.component-title.p1b { color: #f97316; }
.component-title.p2 { color: #38bdf8; }
.component-title.p3 { color: #10b981; }
.component-title.p4 { color: #818cf8; }
.component-title.existing { color: #94a3b8; }
.owner-badge {
background: rgba(255,255,255,0.1);
padding: 6px 14px;
border-radius: 20px;
font-size: 0.85rem;
font-weight: 600;
display: flex;
align-items: center;
gap: 6px;
}
.owner-badge.p1a { background: rgba(239,68,68,0.15); color: #fca5a5; }
.owner-badge.p1b { background: rgba(249,115,22,0.15); color: #fdba74; }
.owner-badge.p2 { background: rgba(56,189,248,0.15); color: #7dd3fc; }
.owner-badge.p3 { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.owner-badge.p4 { background: rgba(129,140,248,0.15); color: #a5b4fc; }
.component-content {
font-size: 0.95rem;
color: #cbd5e1;
line-height: 1.7;
}
.module-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 12px;
}
.module-tag {
background: rgba(56,189,248,0.1);
border: 1px solid rgba(56,189,248,0.3);
padding: 6px 12px;
border-radius: 6px;
font-size: 0.85rem;
color: #7dd3fc;
}
/* 布局网格 */
.diagram-grid {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 30px;
margin-bottom: 40px;
}
.full-width {
grid-column: 1 / -1;
}
.two-thirds {
grid-column: span 2;
}
/* 连接线 */
.connection {
position: absolute;
pointer-events: none;
}
.arrow-svg {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events: none;
z-index: 1;
}
/* 关键路径标记 */
.critical-badge {
background: #ef4444;
color: white;
padding: 4px 10px;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 700;
display: inline-block;
margin-left: 10px;
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
/* 数据流箭头 */
.flow-arrow {
display: flex;
align-items: center;
justify-content: center;
margin: 20px 0;
gap: 15px;
}
.flow-line {
flex: 1;
height: 3px;
background: linear-gradient(90deg, #38bdf8, #818cf8);
position: relative;
}
.flow-line::after {
content: '▶';
position: absolute;
right: -10px;
top: -8px;
color: #818cf8;
font-size: 1.2rem;
}
.flow-label {
background: rgba(56,189,248,0.15);
color: #38bdf8;
padding: 6px 14px;
border-radius: 8px;
font-size: 0.85rem;
font-weight: 600;
white-space: nowrap;
}
/* 信息卡片 */
.info-card {
background: rgba(56,189,248,0.1);
border-left: 4px solid #38bdf8;
border-radius: 8px;
padding: 20px;
margin-top: 30px;
}
.info-card h3 {
color: #38bdf8;
font-size: 1.2rem;
margin-bottom: 10px;
}
/* 响应式 */
@media print {
body { background: white; color: black; }
.component-box { border-width: 2px; }
}
</style>
</head>
<body>
<div class="container">
<h1>🏗️ sgClaw 系统架构总图</h1>
<p class="subtitle">完整系统组件 · 层级关系 · 负责人标注 · 数据流向</p>
<!-- 图例 -->
<div class="legend">
<div class="legend-item">
<div class="legend-box p1a"></div>
<div class="legend-label"><strong>P1a</strong> · 核心通信(赵义仑)</div>
</div>
<div class="legend-item">
<div class="legend-box p1b"></div>
<div class="legend-label"><strong>P1b</strong> · 业务支持</div>
</div>
<div class="legend-item">
<div class="legend-box p2"></div>
<div class="legend-label"><strong>P2</strong> · 浏览器对接</div>
</div>
<div class="legend-item">
<div class="legend-box p3"></div>
<div class="legend-label"><strong>P3</strong> · AI 辅助迁移</div>
</div>
<div class="legend-item">
<div class="legend-box p4"></div>
<div class="legend-label"><strong>P4</strong> · 前端发布</div>
</div>
<div class="legend-item">
<div class="legend-box existing"></div>
<div class="legend-label"><strong>已有系统</strong>(复用)</div>
</div>
</div>
<!-- 主架构图 -->
<div class="architecture-diagram">
<!-- 第一层:用户交互层 -->
<div class="layer-container">
<div class="layer-label">🎨 用户交互层</div>
<div class="diagram-grid">
<div class="component-box p4 full-width">
<div class="component-header">
<div class="component-title p4">AI 助手 Side Panel</div>
<div class="owner-badge p4">👤 P4 · 前端工程师</div>
</div>
<div class="component-content">
<strong>功能:</strong>用户输入自然语言指令,查看执行进度,管理 Skill 启用/禁用
<div class="module-list">
<div class="module-tag">AgentControlPanel.vue</div>
<div class="module-tag">SkillManager.vue</div>
<div class="module-tag">IPC 调用</div>
</div>
</div>
</div>
</div>
</div>
<!-- 向下箭头 -->
<div class="flow-arrow">
<div class="flow-line"></div>
<div class="flow-label">用户指令:"导出 ERP 报表"</div>
<div class="flow-line"></div>
</div>
<!-- 第二层:浏览器内核层 -->
<div class="layer-container">
<div class="layer-label">🌐 浏览器内核层SuperRPA Chromium</div>
<div class="diagram-grid">
<!-- P2 负责的新增部分 -->
<div class="component-box p2 two-thirds">
<div class="component-header">
<div class="component-title p2">sgClaw 进程管理器</div>
<div class="owner-badge p2">👤 P2 · C++ 工程师</div>
</div>
<div class="component-content">
<strong>功能:</strong>启动 sgClaw 子进程,监听 STDIO Pipe转发 JSON 指令MAC 白名单检查
<div class="module-list">
<div class="module-tag">SgClawProcessHost.cc (~600 行)</div>
<div class="module-tag">PipeListener.cc</div>
<div class="module-tag">MacWhitelistCheck.cc</div>
</div>
</div>
</div>
<!-- 已有系统 -->
<div class="component-box existing">
<div class="component-header">
<div class="component-title existing">现有浏览器能力</div>
<div class="owner-badge" style="background:rgba(148,163,184,0.15);color:#94a3b8;">已有系统</div>
</div>
<div class="component-content">
<strong>复用:</strong>CommandRouter70+ 命令、CdpBridge、Zombie 模式等
<div class="module-list">
<div class="module-tag" style="border-color:#94a3b8;color:#94a3b8;">CommandRouter</div>
<div class="module-tag" style="border-color:#94a3b8;color:#94a3b8;">CDP 协议</div>
</div>
</div>
</div>
</div>
</div>
<!-- 向下箭头 - 关键路径 -->
<div class="flow-arrow">
<div class="flow-line"></div>
<div class="flow-label" style="background:rgba(239,68,68,0.15);color:#ef4444;">
<strong>⚡ STDIO Pipe 通信</strong> <span class="critical-badge">关键路径</span>
</div>
<div class="flow-line"></div>
</div>
<!-- 第三层sgClaw AI 引擎层 -->
<div class="layer-container">
<div class="layer-label">🧠 sgClaw AI 引擎层Rust 进程)</div>
<div class="diagram-grid">
<!-- P1a 核心通信 -->
<div class="component-box p1a">
<div class="component-header">
<div class="component-title p1a">通信与工具层</div>
<div class="owner-badge p1a">👤 P1a · 赵义仑 <span class="critical-badge">核心</span></div>
</div>
<div class="component-content">
<strong>功能:</strong>Pipe 双向通信JSON 序列化15 个 BrowserActionMAC 策略
<div class="module-list">
<div class="module-tag">PipeReader/Writer (~900 行)</div>
<div class="module-tag">BrowserPipeTool</div>
<div class="module-tag">MacPolicy</div>
</div>
</div>
</div>
<!-- P1b 业务支持 -->
<div class="component-box p1b">
<div class="component-header">
<div class="component-title p1b">AI Runtime 引擎</div>
<div class="owner-badge p1b">👤 P1b · Rust 工程师</div>
</div>
<div class="component-content">
<strong>功能:</strong>ReAct 循环工具调用三层记忆Critic 评估
<div class="module-list">
<div class="module-tag">AgentRuntime (~600 行)</div>
<div class="module-tag">Memory (L0/L1/L2)</div>
<div class="module-tag">Critic 评估器</div>
</div>
</div>
</div>
<!-- P1b Skill 加载器 -->
<div class="component-box p1b">
<div class="component-header">
<div class="component-title p1b">Skill 加载器</div>
<div class="owner-badge p1b">👤 P1b · Rust 工程师</div>
</div>
<div class="component-content">
<strong>功能:</strong>扫描 Skill 目录Ed25519 验签JS 沙箱执行
<div class="module-list">
<div class="module-tag">SkillLoader.rs</div>
<div class="module-tag">SignatureVerifier</div>
<div class="module-tag">JSRuntime (Deno Core)</div>
</div>
</div>
</div>
</div>
</div>
<!-- 横向连接AI 引擎 ↔ 大模型 -->
<div class="flow-arrow">
<div class="flow-line"></div>
<div class="flow-label">推理请求 / 流式响应</div>
<div class="flow-line"></div>
</div>
<!-- 第四层:外部服务 -->
<div class="layer-container">
<div class="layer-label">🤖 外部服务层</div>
<div class="diagram-grid">
<!-- 大模型 -->
<div class="component-box existing two-thirds">
<div class="component-header">
<div class="component-title existing">AI 大模型(内网部署)</div>
<div class="owner-badge" style="background:rgba(148,163,184,0.15);color:#94a3b8;">已有服务</div>
</div>
<div class="component-content">
<strong>功能:</strong>接收自然语言 + 上下文,返回 JSON 格式的操作序列
<div class="module-list">
<div class="module-tag" style="border-color:#94a3b8;color:#94a3b8;">Claude 3.5 / GPT-4</div>
<div class="module-tag" style="border-color:#94a3b8;color:#94a3b8;">本地 Qwen-72B</div>
<div class="module-tag" style="border-color:#94a3b8;color:#94a3b8;">DeepSeek</div>
</div>
</div>
</div>
<!-- Skill 仓库 -->
<div class="component-box p3">
<div class="component-header">
<div class="component-title p3">Skill 技能仓库</div>
<div class="owner-badge p3">👤 P3 · AI + 业务工程</div>
</div>
<div class="component-content">
<strong>功能:</strong>存储 400+ 业务场景的技能包,带签名验证
<div class="module-list">
<div class="module-tag">10-15 黄金样本(手写)</div>
<div class="module-tag">390 AI 生成 Skill</div>
<div class="module-tag">Ed25519 签名</div>
</div>
</div>
</div>
</div>
</div>
<!-- 底部信息卡 -->
<div class="info-card">
<h3>📊 数据流向总结</h3>
<div style="color:#cbd5e1;line-height:1.8;">
<strong>① 用户输入</strong>P4 Vue 界面)→
<strong>② IPC 传递</strong>P2 C++ 层)→
<strong>③ Pipe 通信</strong>P1a Rust 层,<span style="color:#ef4444;font-weight:700;">关键路径</span>)→
<strong>④ AI 推理</strong>P1b Runtime + 大模型)→
<strong>⑤ Skill 查询</strong>P3 仓库)→
<strong>⑥ 操作执行</strong>P2 CommandRouter → 浏览器)→
<strong>⑦ 记忆沉淀</strong>P1b Memory
</div>
</div>
<div class="info-card" style="background:rgba(239,68,68,0.1);border-color:#ef4444;margin-top:20px;">
<h3 style="color:#ef4444;">⚠️ 关键依赖关系</h3>
<div style="color:#cbd5e1;line-height:1.8;">
<strong>1. P1a + P2 必须先联调成功</strong>Day 4-5否则整个系统无法打通。<br>
<strong>2. P1b 依赖 P1a 的 BrowserPipeTool</strong>Day 6 对接),才能让 AI 调用浏览器。<br>
<strong>3. P3 的 Skill 需要 P1b 的加载器</strong>Day 6-7 验证),才能被执行。<br>
<strong>4. P4 的 UI 需要 P2 的 IPC 接口</strong>Day 6 集成),才能控制 sgClaw。
</div>
</div>
</div>
<!-- 技术栈总结 -->
<div style="margin-top:40px;background:rgba(255,255,255,0.05);border-radius:12px;padding:30px;">
<h2 style="color:#38bdf8;margin-bottom:20px;font-size:1.5rem;">🛠️ 技术栈总结</h2>
<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:20px;">
<div style="background:rgba(30,41,59,0.6);padding:20px;border-radius:8px;">
<div style="color:#ef4444;font-weight:700;margin-bottom:10px;">P1a + P1bRust</div>
<div style="color:#cbd5e1;font-size:0.9rem;line-height:1.6;">
• Rust 1.75+<br>
• ZeroClaw 框架<br>
• Tokio 异步运行时<br>
• SQLite (L2 记忆)<br>
• Ed25519 签名<br>
• Deno Core (JS 沙箱)
</div>
</div>
<div style="background:rgba(30,41,59,0.6);padding:20px;border-radius:8px;">
<div style="color:#38bdf8;font-weight:700;margin-bottom:10px;">P2C++ 浏览器)</div>
<div style="color:#cbd5e1;font-size:0.9rem;line-height:1.6;">
• C++17<br>
• Chromium 120+<br>
• STDIO Pipe<br>
• CDP 协议<br>
• 现有 CommandRouter<br>
• JSON 解析RapidJSON
</div>
</div>
<div style="background:rgba(30,41,59,0.6);padding:20px;border-radius:8px;">
<div style="color:#10b981;font-weight:700;margin-bottom:10px;">P3AI + 业务)</div>
<div style="color:#cbd5e1;font-size:0.9rem;line-height:1.6;">
• JavaScript (ES2022)<br>
• Qwen-72B / DeepSeek<br>
• Prompt Engineering<br>
• agent-vue 场景分析<br>
• Ed25519 签名工具
</div>
</div>
</div>
</div>
<!-- 按钮 -->
<div style="position:fixed;bottom:30px;right:30px;display:flex;gap:10px;z-index:100;">
<button onclick="window.print()" style="background:rgba(56,189,248,0.2);border:1px solid rgba(56,189,248,0.5);color:#38bdf8;padding:12px 24px;border-radius:8px;cursor:pointer;font-size:0.9rem;font-weight:600;">
📄 打印 PDF
</button>
<button onclick="window.scrollTo({top:0,behavior:'smooth'})" style="background:rgba(129,140,248,0.2);border:1px solid rgba(129,140,248,0.5);color:#818cf8;padding:12px 24px;border-radius:8px;cursor:pointer;font-size:0.9rem;font-weight:600;">
⬆️ 回到顶部
</button>
</div>
</div>
</body>
</html>