Files
ssw-mvp/docs/e2e/dag-data.mjs
T
admin 0c5f3bd08c feat(dag): 节点白话解读 + 栈切回 web/5173 + 真实业务全景页可信
- dag-data.mjs: 71 节点全覆盖 narrative(白话解读"数据现状+为何对可信关键")
- dag-panel.html: 侧栏置顶 narrative 卡片 + 节点悬停 tooltip
- dag-panel.mjs: 移除已撤回的「可信解读卡」跳转,节点跑完停在真实业务全景页
- config.mjs: FE_BASE 默认 5173(web/ 轻量栈),SSW_FE 仍可切回 3000

验证:seq-1 真实跑通,SIM-BIZ-contract/delivery/billing 三页清楚展示双签留痕、
链上存证、授权链路、审核链路、利益分配、SETTLED 状态。
2026-08-09 18:24:14 +08:00

915 lines
56 KiB
JavaScript
Raw 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.
/**
* 5 张业务时序图 → DAG 数据模型(带数据流可视化 metadata)
*
* 依据 docs/sequence_diagrams.md 把时序图拍平成节点-边图:
* participants : 泳道(每个参与者占一列)
* stages : 阶段(在背景上分色块)
* nodes : 节点(每个时序图步骤一个;带泳道、阶段、图标、数据预览、对应用例)
* edges : 边(节点之间的箭头;按时序图自上而下;带数据标签 + 类型)
*
* 节点对应的真实用例来自 docs/e2e/cases/ 下已存在的脚本(meta.tc 一致即可关联);
* 这里不绑死用例文件存在与否——节点缺脚本时前端会显示「无脚本」徽标,不影响 DAG 渲染。
*
* 数据流 metadata 约定:
* node.icon - 节点左侧小图标(emoji 或 svg glyph)
* node.data - { name:'订单', preview:'订单#20260808-001\n¥1,200 · 待付款' }
* edge.label - 边上显示的数据标签(例:订单、合约哈希、密文、凭证)
* edge.kind - 边的数据种类 → 决定标签色与流光
* request | contract | cipher | voucher | notify | response | callback
*/
const SWIMLANES = {
user: { label: '数据使用方', color: '#58a6ff', bg: '#0d2944' },
ops: { label: '平台运营方', color: '#a371f7', bg: '#23193d' },
provider: { label: '数据提供方', color: '#3fb950', bg: '#0f2b18' },
server: { label: '数据服务方', color: '#d29922', bg: '#2b230c' },
regulator: { label: '监管方', color: '#f78166', bg: '#3b1d12' },
tee: { label: 'TEE 硬件', color: '#ff7b72', bg: '#3b1216' },
psi: { label: '集中式 PSI', color: '#79c0ff', bg: '#0d2944' },
fl: { label: '联邦学习', color: '#7ee787', bg: '#0f2b18' },
mpc: { label: '多方安全计算', color: '#ffa657', bg: '#2b230c' }
}
/** 边种类 → 颜色(用于标签/流光) */
const EDGE_KINDS = {
request: { label: 'request', color: '#58a6ff', glow: 'rgba(88,166,255,.45)', text: '#9cc8ff' },
contract: { label: 'contract', color: '#a371f7', glow: 'rgba(163,113,247,.45)', text: '#c8b0ff' },
cipher: { label: 'cipher', color: '#7ee787', glow: 'rgba(126,231,135,.45)', text: '#b6f0bc' },
voucher: { label: 'voucher', color: '#d29922', glow: 'rgba(210,153,34,.45)', text: '#f0c878' },
notify: { label: 'notify', color: '#9aa7b4', glow: 'rgba(154,167,180,.35)', text: '#cfd6df' },
response: { label: 'response', color: '#3fb950', glow: 'rgba(63,185,80,.45)', text: '#7ed084' },
callback: { label: 'callback', color: '#f78166', glow: 'rgba(247,129,102,.45)', text: '#ffb098' }
}
// ───────── 图1:沙盒交付(两方/标准) ─────────
const seq1 = {
id: 'seq-1',
no: 1,
title: '沙盒交付(两方/标准)',
subtitle: '数据使用方 ↔ 数据提供方,端到端 5 阶段',
participants: ['user', 'ops', 'provider', 'server', 'regulator'],
stages: [
{ id: 's1-1', name: '阶段1:需求与撮合', color: 'rgba(88,166,255,.07)' },
{ id: 's1-2', name: '阶段2:合约签订', color: 'rgba(163,113,247,.07)' },
{ id: 's1-3', name: '阶段3:算法开发与调试', color: 'rgba(210,153,34,.07)' },
{ id: 's1-4', name: '阶段4:交付与执行', color: 'rgba(63,185,80,.07)' },
{ id: 's1-5', name: '阶段5:结算与审计', color: 'rgba(247,129,102,.07)' }
],
nodes: [
{ id: 'n1-1', lane: 'user', stage: 's1-1', icon: '📝', label: '提交数据需求', sub: '门户·资源目录', data: { name: '需求单', preview: '客群画像 · 25-35岁\n精度:城市级 · 周期:30天' } , route: '/tds/market' , mode: 'create', apiKey: 'demand_create',
actions: [
{ type: 'verify', field: 'demandId', exists: true },
{ type: 'verify', field: 'demandCode', exists: true },
// 浏览器:从列表里搜出这条新需求并打开详情
{ type: 'viewRow', keyword: (ctx) => ctx.demandCode },
{ type: 'shot', seq: 1, desc: '需求单已提交(列表里能看到)' },
{ type: 'bizDetail', entity: 'demand', idFromCtx: (ctx) => ctx.demandId },
]
},
{ id: 'n1-2', lane: 'ops', stage: 's1-1', icon: '🤝', label: '交易撮合', sub: '人工 + AI 助手' , route: '/tds/market',
actions: [
{ type: 'shot', seq: 1, desc: '运营方人工 + AI 助手撮合(监控步骤)' }
]
},
{ id: 'n1-3', lane: 'ops', stage: 's1-1', icon: '📤', label: '推送匹配订单', sub: '→ 提供方' , route: '/tds/market',
actions: [
{ type: 'verify', field: 'demandId', exists: true },
{ type: 'shot', seq: 1, desc: '匹配订单已推送给数据提供方' }
]
},
{ id: 'n1-4', lane: 'provider', stage: 's1-1', icon: '✅', label: '确认接单' , route: '/tds/market' , mode: 'status', apiKey: 'demand_accept',
actions: [
{ type: 'verify', field: 'orderId', exists: true },
{ type: 'verify', field: 'demandId', exists: true },
// 浏览器:切到「供需订单」tab,按 orderCode 搜出订单并打开详情
{ type: 'viewRow', tab: '供需订单', keyword: (ctx) => ctx.orderCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '提供方确认接单 → 已生成响应订单(详情见抽屉)' },
{ type: 'bizDetail', entity: 'order', idFromCtx: (ctx) => ctx.orderId },
]
},
{ id: 'n1-5', lane: 'server', stage: 's1-1', icon: '⚙️', label: '挂出算法服务', sub: '真实业务算法' , route: '/tds/products' , mode: 'create', apiKey: 'algorithm_publish',
actions: [
{ type: 'verify', field: 'algorithmProductId', exists: true },
// 浏览器:列表里搜出刚发布的算法并打开详情
{ type: 'viewRow', keyword: (ctx) => ctx.algorithmCode },
{ type: 'shot', seq: 1, desc: '算法服务已挂出到平台目录(详情见抽屉)' },
{ type: 'bizDetail', entity: 'product', idFromCtx: (ctx) => ctx.algorithmProductId },
]
},
{ id: 'n1-6', lane: 'user', stage: 's1-2', icon: '🖋️', label: '使用方订单签约', case: 'TC-CONTRACT-007', data: { name: '签约', preview: '数字签名 ed25519\n指纹 a3f9…c12d' } , route: '/tds/market',
actions: [
{ type: 'verify', field: 'orderId', exists: true },
{ type: 'viewRow', tab: '供需订单', keyword: (ctx) => ctx.orderCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '使用方订单已发起线下付款(订单详情)' },
{ type: 'bizDetail', entity: 'order', idFromCtx: (ctx) => ctx.orderId },
]
},
{ id: 'n1-7', lane: 'provider', stage: 's1-2', icon: '🖋️', label: '提供方订单签约' , route: '/tds/market',
actions: [
{ type: 'verify', field: 'orderId', exists: true },
{ type: 'viewRow', tab: '供需订单', keyword: (ctx) => ctx.orderCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '提供方订单已发起线下付款(订单详情)' },
{ type: 'bizDetail', entity: 'order', idFromCtx: (ctx) => ctx.orderId },
]
},
{ id: 'n1-8', lane: 'ops', stage: 's1-2', icon: '📜', label: '生成合作协议 & 数字合约' , route: '/tds/contracts' , mode: 'create', apiKey: 'contract_create',
actions: [
{ type: 'verify', field: 'orderId', exists: true },
// 浏览器:列表里搜出刚生成的合约并打开详情
{ type: 'viewRow', keyword: (ctx) => ctx.contractCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '运营方审核订单通过(合约详情)' },
// 业务全景:上游订单 + 链上存证 + 双签 + 用量配额
{ type: 'bizDetail', entity: 'contract', idFromCtx: (ctx) => ctx.contractId }
]
},
{ id: 'n1-9', lane: 'regulator',stage: 's1-2', icon: '⛓️', label: '上链 / 存证', case: 'TC-CONTRACT_API-006', data: { name: '合约哈希', preview: 'sha256:7f3a…b91e\nFISCO-BCOS group0' } , route: '/tds/contracts' , mode: 'status', apiKey: 'contract_sign',
actions: [
{ type: 'verify', field: 'contractId', exists: true },
{ type: 'verify', field: 'contractCode', exists: true },
// 浏览器:列表里搜出合约并打开详情,看双签状态
{ type: 'viewRow', keyword: (ctx) => ctx.contractCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '合约已双签生效 02(详情见抽屉)' }
]
},
{ id: 'n1-10', lane: 'server', stage: 's1-3', icon: '💻', label: '交付算法代码', sub: '上传到沙盒', route: '/tdc/sandbox' , mode: 'status', apiKey: 'sandbox_upload',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
// 浏览器:列表里搜出沙盒并打开「日志/结果」弹窗(SandboxView 非 editable)
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '算法代码已挂到沙盒(日志/结果弹窗)' }
]
},
{ id: 'n1-11', lane: 'provider', stage: 's1-3', icon: '🧪', label: '提供样例数据', sub: '信贷样本 12万条', route: '/tdc/resources',
actions: [
{ type: 'shot', seq: 1, desc: '提供方准备样例数据 12 万条(由 n1-15 真实灌入)' }
]
},
{ id: 'n1-12', lane: 'user', stage: 's1-3', icon: '🛠️', label: '沙盒开发调试', case: 'TC-HOSTING-001', data: { name: '调试日志', preview: 'shap≈0.42 · AUC=0.87\n耗时 12s · 8/12 步骤' } , route: '/tdc/sandbox' , mode: 'create', apiKey: 'sandbox_create',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '沙盒开发调试环境就绪(日志/结果弹窗)' },
// 业务全景:上游合约 + 策略判定 + 审核 + TEE 远程证明 + 调用/销毁留痕
{ type: 'bizDetail', entity: 'delivery', idFromCtx: (ctx) => ctx.sandboxId }
]
},
{ id: 'n1-13', lane: 'ops', stage: 's1-3', icon: '🔍', label: '算法审核' , route: '/tdc/sandbox' , mode: 'status', apiKey: 'sandbox_audit',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '算法审核已通过(日志/结果弹窗)' }
]
},
{ id: 'n1-14', lane: 'user', stage: 's1-3', icon: '👍', label: '审核通过' , route: '/tdc/sandbox',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'shot', seq: 1, desc: '使用方已收到审核通过通知' }
]
},
{ id: 'n1-15', lane: 'provider', stage: 's1-4', icon: '🔐', label: '灌入数据到沙盒' , route: '/tdc/sandbox' ,
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '12 万条样例数据已灌入沙盒(日志/结果弹窗)' }
]
},
{ id: 'n1-16', lane: 'user', stage: 's1-4', icon: '🚀', label: '安全沙盒交付执行', case: 'TC-DELIVERY-001', data: { name: '交付结果', preview: 'AES-256-GCM · 1.2MB\nsha256:c12f…dd09' } , route: '/tdc/sandbox' , mode: 'execute', apiKey: 'sandbox_calculate',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '沙盒计算已触发(日志/结果弹窗)' }
]
},
{ id: 'n1-17', lane: 'user', stage: 's1-4', icon: '📊', label: '提取计算结果', sub: '真实业务指标', route: '/tdc/sandbox' , mode: 'query', apiKey: 'sandbox_extract',
actions: [
// 浏览器:列表里搜出沙盒并打开「日志/结果」弹窗看真实业务指标
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '已提取真实业务结果(AUC/KS/求交数/模型,日志/结果弹窗)' }
]
},
{ id: 'n1-18', lane: 'user', stage: 's1-5', icon: '💰', label: '订单支付(线下)' , route: '/tds/billing',
actions: [
{ type: 'verify', field: 'orderId', exists: true },
{ type: 'shot', seq: 1, desc: '线下支付凭证已记录(ConfirmPayment)' }
]
},
{ id: 'n1-19', lane: 'ops', stage: 's1-5', icon: '🧾', label: '生成结算凭证' , route: '/tds/billing' , mode: 'create', apiKey: 'settlement_create',
actions: [
{ type: 'verify', field: 'settlementId', exists: true },
{ type: 'verify', field: 'settlementAmount', exists: true },
// BillingLedger 的 keywordColumns = productName / consumerOrgName / providerOrgName,
// 搜索 productName 命中刚生成的台账行
{ type: 'viewRow', keyword: (ctx) => ctx.productName, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '结算凭证已生成 + SETTLED(详情见抽屉)' },
// 业务全景:利益分配 + 上游合约 + 上下游调用留痕
{ type: 'bizDetail', entity: 'billing', idFromCtx: (ctx) => ctx.settlementId }
]
},
{ id: 'n1-20', lane: 'regulator',stage: 's1-5', icon: '📤', label: '提交交易凭证' , route: '/tds/chain',
actions: [
{ type: 'chain', bizType: 'BILLING_SETTLEMENT', bizId: (ctx) => ctx.settlementId, contentHash: (ctx) => `sha256:` + ctx.runId + '-settle', summary: (ctx) => `结算凭证 ` + ctx.settlementId },
{ type: 'shot', seq: 1, desc: '结算凭证已上链存证' }
]
},
{ id: 'n1-21', lane: 'regulator',stage: 's1-5', icon: '🛡️', label: '审计核验', case: 'TC-EVIDENCE-001', data: { name: '审计结果', preview: '✔ 链上存证匹配\n✔ 调用频次合规' } , route: '/tds/audit' , mode: 'query', apiKey: 'auditlog_search',
actions: [
{ type: 'auditVerify', spaceId: (ctx) => ctx.contract && ctx.contract.spaceId },
{ type: 'shot', seq: 1, desc: '审计哈希链核验通过' }
]
},
],
edges: [
{ from: 'n1-1', to: 'n1-2', label: '需求单', kind: 'request' },
{ from: 'n1-5', to: 'n1-2', label: '算法挂出', kind: 'notify' },
{ from: 'n1-2', to: 'n1-3', label: '匹配订单', kind: 'request' },
{ from: 'n1-2', to: 'n1-4', label: '订单推送', kind: 'request' },
{ from: 'n1-2', to: 'n1-6', label: '订单', kind: 'request' },
{ from: 'n1-2', to: 'n1-7', label: '订单', kind: 'request' },
{ from: 'n1-6', to: 'n1-8', label: '签名', kind: 'contract' },
{ from: 'n1-7', to: 'n1-8', label: '签名', kind: 'contract' },
{ from: 'n1-8', to: 'n1-9', label: '合约哈希', kind: 'contract' },
{ from: 'n1-9', to: 'n1-12', label: '合约→沙盒', kind: 'request' },
{ from: 'n1-12', to: 'n1-10', label: '沙盒就绪', kind: 'request' },
{ from: 'n1-10', to: 'n1-13', label: '代码挂载', kind: 'request' },
{ from: 'n1-11', to: 'n1-12', label: '样例数据', kind: 'cipher' },
{ from: 'n1-13', to: 'n1-14', label: '审核结果', kind: 'response' },
{ from: 'n1-14', to: 'n1-15', label: '投产通知', kind: 'notify' },
{ from: 'n1-15', to: 'n1-16', label: '密态灌入', kind: 'cipher' },
{ from: 'n1-16', to: 'n1-17', label: '交付结果', kind: 'cipher' },
{ from: 'n1-17', to: 'n1-18', label: '结算请求', kind: 'request' },
{ from: 'n1-18', to: 'n1-19', label: '支付回执', kind: 'voucher' },
{ from: 'n1-19', to: 'n1-20', label: '结算凭证', kind: 'voucher' },
{ from: 'n1-20', to: 'n1-21', label: '凭证', kind: 'voucher' }
]
}
// ───────── 图2:沙盒交付(三方) ─────────
const seq2 = {
id: 'seq-2',
no: 2,
title: '沙盒交付(三方)',
subtitle: '服务方多一节签约 + 算法开发',
participants: ['user', 'ops', 'provider', 'server', 'regulator'],
stages: [
{ id: 's2-1', name: '阶段1:发现与撮合', color: 'rgba(88,166,255,.07)' },
{ id: 's2-2', name: '阶段2:合约签订', color: 'rgba(163,113,247,.07)' },
{ id: 's2-3', name: '阶段3:算法开发与调试', color: 'rgba(210,153,34,.07)' },
{ id: 's2-4', name: '阶段4:正式交付与执行', color: 'rgba(63,185,80,.07)' },
{ id: 's2-5', name: '阶段5:结算与审计', color: 'rgba(247,129,102,.07)' }
],
nodes: [
{ id: 'n2-1', lane: 'user', stage: 's2-1', icon: '📝', label: '数据需求 / 资源目录下单', case: 'TC-TRADE-003', data: { name: '需求', preview: '三方联合建模\n画像×风控×消费' } , route: '/tds/market' , mode: 'create', apiKey: 'demand_create',
actions: [
{ type: 'verify', field: 'demandId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.demandCode },
{ type: 'shot', seq: 1, desc: '三方需求已发布(详情见抽屉)' }
]
},
{ id: 'n2-2', lane: 'ops', stage: 's2-1', icon: '🤝', label: '交易撮合' , route: '/tds/market',
actions: [
{ type: 'shot', seq: 1, desc: '运营方人工 + AI 撮合' }
]
},
{ id: 'n2-3', lane: 'ops', stage: 's2-1', icon: '🧐', label: '订单审核', route: '/tds/market', mode: 'status', apiKey: 'demand_accept',
actions: [
// 浏览器:切到「供需订单」tab,按刚生成的 orderCode 搜出这条订单详情
{ type: 'viewRow', tab: '供需订单', keyword: (ctx) => ctx.orderCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '订单已审核(详情见抽屉)' },
{ type: 'bizDetail', entity: 'order', idFromCtx: (ctx) => ctx.orderId },
]
},
{ id: 'n2-4', lane: 'provider', stage: 's2-1', icon: '📦', label: '提供数据资源' , route: '/tds/products',
mode: 'create', apiKey: 'product_create',
actions: [
{ type: 'verify', field: 'productId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.productCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '数据资源已上架目录(详情见抽屉)' },
{ type: 'bizDetail', entity: 'product', idFromCtx: (ctx) => ctx.productId },
]
},
{ id: 'n2-5', lane: 'server', stage: 's2-1', icon: '⚙️', label: '提供算法服务' , route: '/tds/products',
mode: 'create', apiKey: 'algorithm_publish',
actions: [
{ type: 'verify', field: 'algorithmProductId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.algorithmCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '算法服务已挂出(详情见抽屉)' },
{ type: 'bizDetail', entity: 'product', idFromCtx: (ctx) => ctx.algorithmProductId },
]
},
{ id: 'n2-6', lane: 'user', stage: 's2-2', icon: '🖋️', label: '使用方签约' , route: '/tds/market',
actions: [
{ type: 'viewRow', tab: '供需订单', keyword: (ctx) => ctx.orderCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '使用方订单已发起线下付款(订单详情)' },
{ type: 'bizDetail', entity: 'order', idFromCtx: (ctx) => ctx.orderId },
]
},
{ id: 'n2-7', lane: 'provider', stage: 's2-2', icon: '🖋️', label: '提供方签约' , route: '/tds/market',
actions: [
{ type: 'viewRow', tab: '供需订单', keyword: (ctx) => ctx.orderCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '提供方订单已发起线下付款(订单详情)' },
{ type: 'bizDetail', entity: 'order', idFromCtx: (ctx) => ctx.orderId },
]
},
{ id: 'n2-8', lane: 'server', stage: 's2-2', icon: '🖋️', label: '服务方签约' , route: '/tds/market',
actions: [
{ type: 'viewRow', tab: '供需订单', keyword: (ctx) => ctx.orderCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '服务方订单已发起线下付款(订单详情)' },
{ type: 'bizDetail', entity: 'order', idFromCtx: (ctx) => ctx.orderId },
]
},
{ id: 'n2-9', lane: 'ops', stage: 's2-2', icon: '📜', label: '生成合作协议 & 数字合约' , route: '/tds/contracts' , mode: 'create', apiKey: 'contract_create',
actions: [
{ type: 'verify', field: 'orderId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.contractCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '运营方订单审核通过(合约详情)' },
{ type: 'bizDetail', entity: 'contract', idFromCtx: (ctx) => ctx.contractId },
]
},
{ id: 'n2-10', lane: 'regulator',stage: 's2-2', icon: '⛓️', label: '上链 / 存证', data: { name: '合约哈希', preview: '三方合约 0xa3…91f\nFISCO-BCOS group0' } , route: '/tds/contracts' , mode: 'status', apiKey: 'contract_sign',
actions: [
{ type: 'verify', field: 'contractId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.contractCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '三方合约已双签生效(详情见抽屉)' }
]
},
{ id: 'n2-11', lane: 'provider', stage: 's2-3', icon: '🧪', label: '提供样例数据' , route: '/tdc/resources' ,
actions: [
{ type: 'shot', seq: 1, desc: '样例数据准备(由 n2-16 真实灌入)' }
]
},
{ id: 'n2-12', lane: 'server', stage: 's2-3', icon: '💻', label: '编写算法代码', case: 'TC-HOSTING-001', data: { name: '算法', preview: 'XGBoost · lr=0.05\n树深 6 · 迭代 200' } , route: '/tdc/sandbox' , mode: 'create', apiKey: 'sandbox_create',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '服务方已编写算法代码(日志/结果弹窗)' }
]
},
{ id: 'n2-13', lane: 'server', stage: 's2-3', icon: '📤', label: '提交算法审核' , route: '/tdc/sandbox',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '算法审核已提交(日志/结果弹窗)' }
]
},
{ id: 'n2-14', lane: 'ops', stage: 's2-3', icon: '🔍', label: '算法审核' , route: '/tdc/sandbox' , mode: 'status', apiKey: 'sandbox_audit',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '运营方算法审核通过(日志/结果弹窗)' }
]
},
{ id: 'n2-15', lane: 'server', stage: 's2-3', icon: '👍', label: '审核通过' , route: '/tdc/sandbox',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'shot', seq: 1, desc: '审核结果已通知服务方' }
]
},
{ id: 'n2-16', lane: 'provider', stage: 's2-4', icon: '🔐', label: '灌入数据到沙盒' , route: '/tdc/sandbox' ,
mode: 'status', apiKey: 'sample_upload',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '三方样例数据已密态灌入沙盒(日志/结果弹窗)' }
]
},
{ id: 'n2-17', lane: 'user', stage: 's2-4', icon: '🚀', label: '安全沙盒交付执行', case: 'TC-DELIVERY-001', data: { name: '三方联合', preview: 'MPC·SPDZ 协议\n128MB 中间碎片' } , route: '/tdc/sandbox' , mode: 'execute', apiKey: 'sandbox_deliver',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '三方联合沙盒计算已触发(日志/结果弹窗)' }
]
},
{ id: 'n2-18', lane: 'user', stage: 's2-4', icon: '📨', label: '回传交付凭证' , route: '/tdc/sandbox',
actions: [
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '三方交付凭证已回传(日志/结果弹窗)' }
]
},
{ id: 'n2-19', lane: 'user', stage: 's2-5', icon: '💰', label: '订单付款(线下)' , route: '/tds/market',
actions: [
{ type: 'verify', field: 'orderId', exists: true },
{ type: 'viewRow', tab: '供需订单', keyword: (ctx) => ctx.orderCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '三方线下付款凭证已记录(订单详情)' }
]
},
{ id: 'n2-20', lane: 'ops', stage: 's2-5', icon: '🧾', label: '生成结算凭证' , route: '/tds/billing' , mode: 'create', apiKey: 'settlement_create',
actions: [
{ type: 'verify', field: 'settlementId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.productName, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '三方结算凭证已 SETTLED(详情见抽屉)' },
{ type: 'bizDetail', entity: 'billing', idFromCtx: (ctx) => ctx.settlementId },
]
},
{ id: 'n2-21', lane: 'regulator',stage: 's2-5', icon: '📤', label: '提交交易凭证' , route: '/tds/chain',
actions: [
{ type: 'chain', bizType: 'BILLING_SETTLEMENT_3P', bizId: (ctx) => ctx.settlementId, contentHash: (ctx) => `sha256:` + ctx.runId + '-settle-3p', summary: (ctx) => `三方结算凭证 ` + ctx.settlementId },
{ type: 'shot', seq: 1, desc: '三方结算凭证已上链存证' }
]
},
{ id: 'n2-22', lane: 'regulator',stage: 's2-5', icon: '🛡️', label: '审计核验', case: 'TC-EVIDENCE-001', data: { name: '审计', preview: '三方交付均留痕\n✔ 数据不跨境' } , route: '/tds/audit' , mode: 'query', apiKey: 'auditlog_search',
actions: [
{ type: 'auditVerify', spaceId: (ctx) => ctx.contract && ctx.contract.spaceId },
{ type: 'shot', seq: 1, desc: '三方交付审计核验通过' }
]
},
],
edges: [
{ from: 'n2-1', to: 'n2-2', label: '需求', kind: 'request' },
{ from: 'n2-2', to: 'n2-3', label: '订单', kind: 'request' },
{ from: 'n2-3', to: 'n2-4', label: '撮合', kind: 'request' },
{ from: 'n2-3', to: 'n2-5', label: '撮合', kind: 'request' },
{ from: 'n2-4', to: 'n2-6', label: '资源', kind: 'request' },
{ from: 'n2-5', to: 'n2-6', label: '服务', kind: 'request' },
{ from: 'n2-5', to: 'n2-7', label: '服务', kind: 'request' },
{ from: 'n2-5', to: 'n2-8', label: '服务', kind: 'request' },
{ from: 'n2-6', to: 'n2-9', label: '签名', kind: 'contract' },
{ from: 'n2-7', to: 'n2-9', label: '签名', kind: 'contract' },
{ from: 'n2-8', to: 'n2-9', label: '签名', kind: 'contract' },
{ from: 'n2-9', to: 'n2-10', label: '合约哈希', kind: 'contract' },
{ from: 'n2-10', to: 'n2-11', label: '存证', kind: 'callback' },
{ from: 'n2-11', to: 'n2-12', label: '样例数据', kind: 'cipher' },
{ from: 'n2-12', to: 'n2-13', label: '算法', kind: 'request' },
{ from: 'n2-13', to: 'n2-14', label: '审核请求', kind: 'request' },
{ from: 'n2-14', to: 'n2-15', label: '审核结果', kind: 'response' },
{ from: 'n2-15', to: 'n2-16', label: '投产', kind: 'notify' },
{ from: 'n2-16', to: 'n2-17', label: '密态灌入', kind: 'cipher' },
{ from: 'n2-17', to: 'n2-18', label: '交付结果', kind: 'cipher' },
{ from: 'n2-18', to: 'n2-19', label: '结算', kind: 'request' },
{ from: 'n2-19', to: 'n2-20', label: '支付回执', kind: 'voucher' },
{ from: 'n2-20', to: 'n2-21', label: '结算凭证', kind: 'voucher' },
{ from: 'n2-21', to: 'n2-22', label: '凭证', kind: 'voucher' }
]
}
// ───────── 图3:机构会员注册与资源发布 ─────────
const seq3 = {
id: 'seq-3',
no: 3,
title: '机构会员注册与资源发布',
subtitle: '机构入驻 → 资源上架 → 浏览购买',
participants: ['user', 'ops', 'provider', 'server'],
stages: [
{ id: 's3-1', name: '机构会员注册', color: 'rgba(88,166,255,.07)' },
{ id: 's3-2', name: '数据资源发布', color: 'rgba(63,185,80,.07)' },
{ id: 's3-3', name: '数据资源购买', color: 'rgba(163,113,247,.07)' },
{ id: 's3-4', name: '算法产品发布', color: 'rgba(210,153,34,.07)' }
],
nodes: [
{ id: 'n3-1', lane: 'user', stage: 's3-1', icon: '🏢', label: '注册机构会员、发布数据需求', case: 'TC-IDENTITY-004', data: { name: '机构注册', preview: '营业执照 OCR 通过\n法人:张三 · 信用:A级' } , route: '/tds/connectors' , mode: 'create', apiKey: 'connector_register',
actions: [
{ type: 'verify', field: 'connectorId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.connectorCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '使用方机构会员 + 连接器已注册(详情见抽屉)' },
{ type: 'bizDetail', entity: 'connector', idFromCtx: (ctx) => ctx.connectorId },
]
},
{ id: 'n3-2', lane: 'provider', stage: 's3-1', icon: '🏢', label: '注册机构会员、申请入驻' , route: '/tds/connectors' ,
mode: 'status', apiKey: 'connector_audit',
actions: [
{ type: 'verify', field: 'connectorId', exists: true },
{ type: 'verify', field: 'connectorAuditStatus', equals: 'PASS' },
{ type: 'viewRow', keyword: (ctx) => ctx.connectorCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '提供方机构会员入驻审批通过(详情见抽屉)' },
{ type: 'bizDetail', entity: 'connector', idFromCtx: (ctx) => ctx.connectorId },
]
},
{ id: 'n3-3', lane: 'server', stage: 's3-1', icon: '🏢', label: '注册机构会员、发布算法产品' , route: '/tds/connectors',
actions: [
{ type: 'verify', field: 'connectorId', exists: true },
{ type: 'shot', seq: 1, desc: '服务方机构会员 + 算法产品已就绪' }
]
},
{ id: 'n3-4', lane: 'provider', stage: 's3-2', icon: '📦', label: '提交数据资源、上架目录', case: 'TC-CATALOG-001', data: { name: '资源目录', preview: '「一线消费力指数」\n样本 120万 · 30 字段' } , route: '/tds/products' , mode: 'create', apiKey: 'product_create',
actions: [
{ type: 'verify', field: 'productId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.productCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '数据资源已上架到公共目录(详情见抽屉)' },
{ type: 'bizDetail', entity: 'product', idFromCtx: (ctx) => ctx.productId },
]
},
{ id: 'n3-5', lane: 'user', stage: 's3-3', icon: '🛒', label: '浏览资源目录、下单购买' , route: '/tds/catalog' ,
actions: [
{ type: 'shot', seq: 1, desc: '使用方浏览公共数据目录' }
]
},
{ id: 'n3-6', lane: 'user', stage: 's3-3', icon: '🔌', label: '连接器注册', case: 'TC-CONNECTOR-001', data: { name: '连接器', preview: '[email protected]\nSNP 已签发 · v3.2' } , route: '/tds/connectors' , mode: 'create', apiKey: 'connector_register',
actions: [
{ type: 'verify', field: 'connectorId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.connectorCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '连接器已注册到 TDS(详情见抽屉)' },
{ type: 'bizDetail', entity: 'connector', idFromCtx: (ctx) => ctx.connectorId },
]
},
{ id: 'n3-7', lane: 'server', stage: 's3-4', icon: '🛠️', label: '发布算法 / 服务产品' , route: '/tds/products' , mode: 'create', apiKey: 'algorithm_publish',
actions: [
{ type: 'verify', field: 'algorithmProductId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.algorithmCode, mode: 'edit' },
{ type: 'shot', seq: 1, desc: '算法服务产品已发布并上架(详情见抽屉)' },
{ type: 'bizDetail', entity: 'product', idFromCtx: (ctx) => ctx.algorithmProductId },
]
},
],
edges: [
{ from: 'n3-1', to: 'n3-4', label: '需求', kind: 'request' },
{ from: 'n3-2', to: 'n3-4', label: '入驻申请', kind: 'request' },
{ from: 'n3-4', to: 'n3-5', label: '资源目录', kind: 'notify' },
{ from: 'n3-5', to: 'n3-6', label: '购买订单', kind: 'request' },
{ from: 'n3-3', to: 'n3-7', label: '机构认证', kind: 'notify' }
]
}
// ───────── 图4:隐私计算沙盒执行链路(TEE) ─────────
const seq4 = {
id: 'seq-4',
no: 4,
title: '隐私计算沙盒执行链路',
subtitle: 'TEE 硬件:用后即焚,仅结果出域',
participants: ['ops', 'tee', 'provider', 'user', 'server'],
stages: [
{ id: 's4-1', name: '触发:合约达成 → 创建沙盒', color: 'rgba(163,113,247,.07)' },
{ id: 's4-2', name: '数据灌入(加密通道)', color: 'rgba(255,123,114,.07)' },
{ id: 's4-3', name: '内存加工(按算法)', color: 'rgba(210,153,34,.07)' },
{ id: 's4-4', name: '结果出域', color: 'rgba(63,185,80,.07)' },
{ id: 's4-5', name: '用后即焚 → 凭证回传', color: 'rgba(247,129,102,.07)' }
],
nodes: [
{ id: 'n4-1', lane: 'ops', stage: 's4-1', icon: '📜', label: '合约签 → 创建安全沙盒', data: { name: '沙盒元数据', preview: 'policy:deny-all\ntflavor:kata-qemu-snp' } , route: '/tdc/sandbox' , mode: 'create', apiKey: 'sandbox_create',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '合约签已触发创建安全沙盒(日志/结果弹窗)' },
// TEE 业务全景:上游合约 + 策略 + TEE 远程证明 + 执行链路
{ type: 'bizDetail', entity: 'delivery', idFromCtx: (ctx) => ctx.sandboxId }
]
},
{ id: 'n4-2', lane: 'ops', stage: 's4-1', icon: '📣', label: '通知数据导入', case: 'TC-HOSTING-001' , route: '/tdc/hosting-job',
actions: [
{ type: 'shot', seq: 1, desc: '运营方已通知数据导入(Notify)' }
]
},
{ id: 'n4-3', lane: 'provider', stage: 's4-2', icon: '🔐', label: '密态传输数据', data: { name: '加密数据', preview: 'AES-256-GCM\n12 MB · nonce 8e3…' } , route: '/tdc/sandbox' , mode: 'status', apiKey: 'sandbox_upload',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '密态传输数据已落沙盒(日志/结果弹窗)' },
{ type: 'bizDetail', entity: 'delivery', idFromCtx: (ctx) => ctx.sandboxId },
]
},
{ id: 'n4-4', lane: 'tee', stage: 's4-2', icon: '🛡️', label: '接收加密数据' , route: '/tdc/sandbox',
actions: [
{ type: 'shot', seq: 1, desc: 'TEE 硬件已接收加密数据' }
]
},
{ id: 'n4-5', lane: 'tee', stage: 's4-3', icon: '🧠', label: '计算执行', case: 'TC-DELIVERY-001', data: { name: 'TEE 内运行', preview: 'CDH 远程证明通过\nSNP report OK' } , route: '/tdc/sandbox' , mode: 'execute', apiKey: 'sandbox_deliver',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: 'TEE 内计算执行完成(日志/结果弹窗)' },
// TEE 业务全景:远程证明 SNP report、KBS、measurement 全部展示
{ type: 'bizDetail', entity: 'delivery', idFromCtx: (ctx) => ctx.sandboxId }
]
},
{ id: 'n4-6', lane: 'user', stage: 's4-4', icon: '📥', label: '接收计算结果', case: 'TC-USAGE-001', data: { name: '结果', preview: '联合模型 v1.2\nAUC 0.91 · 1.2 MB' } , route: '/tdc/sandbox',
actions: [
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: '联合模型已加密出域到使用方(日志/结果弹窗)' },
{ type: 'bizDetail', entity: 'delivery', idFromCtx: (ctx) => ctx.sandboxId },
]
},
{ id: 'n4-7', lane: 'tee', stage: 's4-5', icon: '🔥', label: '数据销毁、环境清零' , route: '/tdc/sandbox' , mode: 'status', apiKey: 'sandbox_destroy',
actions: [
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: 'TEE 数据销毁 · 环境清零(日志/结果弹窗)' },
// 销毁后的业务全景:应当看见 destroyEvidence 列表里有记录
{ type: 'bizDetail', entity: 'delivery', idFromCtx: (ctx) => ctx.sandboxId }
]
},
{ id: 'n4-8', lane: 'tee', stage: 's4-5', icon: '📨', label: '沙盒释放、凭证回传', case: 'TC-EVIDENCE-001', data: { name: '执行凭证', preview: 'attest:sha256:c12…\n执行时间 8m12s' } , route: '/tds/chain',
actions: [
{ type: 'chain', bizType: 'TEE_DESTROY', bizId: (ctx) => ctx.sandboxId, contentHash: (ctx) => `sha256:` + ctx.runId + '-tee-destroy', summary: (ctx) => `TEE 销毁凭证 ` + ctx.sandboxId },
{ type: 'shot', seq: 1, desc: '沙盒释放 · 凭证已上链存证' }
]
},
{ id: 'n4-9', lane: 'ops', stage: 's4-5', icon: '✔️', label: '收到释放回执' , route: '/tds/chain',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'shot', seq: 1, desc: '运营方已收到释放回执' }
]
},
],
edges: [
{ from: 'n4-1', to: 'n4-2', label: '创建事件', kind: 'notify' },
{ from: 'n4-2', to: 'n4-3', label: '导入通知', kind: 'notify' },
{ from: 'n4-3', to: 'n4-4', label: '加密数据', kind: 'cipher' },
{ from: 'n4-4', to: 'n4-5', label: '解密入内存', kind: 'cipher' },
{ from: 'n4-5', to: 'n4-6', label: '结果加密出域', kind: 'cipher' },
{ from: 'n4-6', to: 'n4-7', label: 'ACK', kind: 'callback' },
{ from: 'n4-7', to: 'n4-8', label: '销毁完成', kind: 'notify' },
{ from: 'n4-8', to: 'n4-9', label: '释放凭证', kind: 'voucher' }
]
}
// ───────── 图5:三种隐私计算模式对比 ─────────
const seq5 = {
id: 'seq-5',
no: 5,
title: '三种隐私计算模式对比',
subtitle: '集中式 PSI · 联邦学习 · 多方安全计算(并行调度)',
participants: ['ops', 'psi', 'fl', 'mpc'],
stages: [
{ id: 's5-1', name: '场景:按需求选择计算模式', color: 'rgba(88,166,255,.07)' },
{ id: 's5-2', name: '部署沙盒', color: 'rgba(163,113,247,.07)' },
{ id: 's5-3', name: '计算加工', color: 'rgba(210,153,34,.07)' },
{ id: 's5-4', name: '结果回传', color: 'rgba(63,185,80,.07)' }
],
nodes: [
{ id: 'n5-1', lane: 'ops', stage: 's5-1', icon: '🧭', label: '按场景选择模式', data: { name: '选型', preview: '按"是否可集中"\n选 PSI / FL / MPC' } , route: '/tds/policies',
actions: [
{ type: 'shot', seq: 1, desc: '按场景已选 PSI/FL/MPC 模式' }
]
},
{ id: 'n5-2', lane: 'psi', stage: 's5-2', icon: '🏗️', label: '部署 1 个集中沙盒' , route: '/tdc/sandbox' , mode: 'create', apiKey: 'sandbox_create',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: 'PSI 集中沙盒已部署(日志/结果弹窗)' },
{ type: 'bizDetail', entity: 'delivery', idFromCtx: (ctx) => ctx.sandboxId },
]
},
{ id: 'n5-3', lane: 'fl', stage: 's5-2', icon: '🏗️', label: '各参与方本地部署(N 个)' , route: '/tdc/sandbox' , mode: 'create', apiKey: 'sandbox_create',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: 'FL 各参与方本地沙盒已部署(日志/结果弹窗)' },
{ type: 'bizDetail', entity: 'delivery', idFromCtx: (ctx) => ctx.sandboxId },
]
},
{ id: 'n5-4', lane: 'mpc', stage: 's5-2', icon: '🏗️', label: '各参与方本地部署(N 个)' , route: '/tdc/sandbox' , mode: 'create', apiKey: 'sandbox_create',
actions: [
{ type: 'verify', field: 'sandboxId', exists: true },
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: 'MPC 各参与方本地沙盒已部署(日志/结果弹窗)' },
{ type: 'bizDetail', entity: 'delivery', idFromCtx: (ctx) => ctx.sandboxId },
]
},
{ id: 'n5-5', lane: 'psi', stage: 's5-3', icon: '🔐', label: '数据加密出域 → 集中融合', data: { name: 'PSI 协议', preview: 'OPRF + 加密求交\n隐私集合 ≈ 5w' } , route: '/tdc/privacy',
actions: [
{ type: 'shot', seq: 1, desc: 'PSI 数据加密出域 → 集中融合' }
]
},
{ id: 'n5-6', lane: 'fl', stage: 's5-3', icon: '🖥️', label: '数据不出域 → 本地明文训练' , route: '/tdc/privacy',
actions: [
{ type: 'shot', seq: 1, desc: 'FL 数据绝不出域 → 本地明文训练' }
]
},
{ id: 'n5-7', lane: 'fl', stage: 's5-3', icon: '🔁', label: '沙盒间传输加密模型参数', data: { name: '梯度', preview: 'ΔW · 0.8 MB\n加噪 ε=0.1' } , route: '/tdc/privacy',
actions: [
{ type: 'shot', seq: 1, desc: 'FL 沙盒间传输加密模型参数 ΔW' }
]
},
{ id: 'n5-8', lane: 'mpc', stage: 's5-3', icon: '✂️', label: '数据不出域 → 秘密分享成碎片' , route: '/tdc/privacy',
actions: [
{ type: 'shot', seq: 1, desc: 'MPC 数据不出域 → 秘密分享成碎片' }
]
},
{ id: 'n5-9', lane: 'mpc', stage: 's5-3', icon: '🔁', label: '沙盒间传输加密中间碎片', data: { name: '秘密分享', preview: '3-of-5 Shamir\n碎片 24 KB ×5' } , route: '/tdc/privacy',
actions: [
{ type: 'shot', seq: 1, desc: 'MPC 沙盒间传输加密中间碎片' }
]
},
{ id: 'n5-10', lane: 'psi', stage: 's5-4', icon: '📥', label: '返回求交结果', case: 'TC-USAGE-001', data: { name: '结果', preview: '交集 ID 数 4872\n用时 32s' } , route: '/tdc/sandbox',
actions: [
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: 'PSI 交集结果已返回平台(日志/结果弹窗)' }
]
},
{ id: 'n5-11', lane: 'fl', stage: 's5-4', icon: '📥', label: '返回联合模型' , route: '/tdc/sandbox',
actions: [
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: 'FL 联合模型已返回平台(日志/结果弹窗)' }
]
},
{ id: 'n5-12', lane: 'mpc', stage: 's5-4', icon: '📥', label: '返回联合统计结果', case: 'TC-USAGE-022', data: { name: '结果', preview: '均值 μ=124.7\nσ=8.3 · 用时 5m' } , route: '/tdc/sandbox',
actions: [
{ type: 'viewRow', keyword: (ctx) => ctx.sandboxName, action: '日志/结果' },
{ type: 'shot', seq: 1, desc: 'MPC 联合统计结果已返回平台(日志/结果弹窗)' }
]
},
],
edges: [
{ from: 'n5-1', to: 'n5-2', label: '模式 PSI', kind: 'request' },
{ from: 'n5-1', to: 'n5-3', label: '模式 FL', kind: 'request' },
{ from: 'n5-1', to: 'n5-4', label: '模式 MPC', kind: 'request' },
{ from: 'n5-2', to: 'n5-5', label: '沙盒就绪', kind: 'notify' },
{ from: 'n5-5', to: 'n5-10', label: '求交结果', kind: 'cipher' },
{ from: 'n5-3', to: 'n5-6', label: '沙盒就绪', kind: 'notify' },
{ from: 'n5-6', to: 'n5-7', label: '梯度', kind: 'cipher' },
{ from: 'n5-7', to: 'n5-11', label: '聚合模型', kind: 'cipher' },
{ from: 'n5-4', to: 'n5-8', label: '沙盒就绪', kind: 'notify' },
{ from: 'n5-8', to: 'n5-9', label: '碎片', kind: 'cipher' },
{ from: 'n5-9', to: 'n5-12', label: '聚合统计', kind: 'cipher' }
]
}
/**
* 把"老格式"边(数组 [from,to,dashed])平滑成新格式(对象);调用方放心传老数据
*/
function normalizeEdges(edges) {
return edges.map((e) => {
if (Array.isArray(e)) {
const [from, to, dashed] = e
return { from, to, label: '', kind: dashed ? 'callback' : 'request' }
}
return e
})
}
// ───────── 节点「白话解读」:点开节点时用人话解释此刻的数据状况 ─────────
// 不写技术字段,只说:这一步里"数据处于什么状态、为什么这一步对可信很关键"。
// 平台只补位不接管:若节点未单独写 narrative,用 defaultNarrative 兜底。
const NARRATIVES = {
// ── 图1:沙盒交付(两方)──
'n1-1': '需求方在门户提交一份数据需求单。此时数据还没动,只是把"要什么数据、给谁用、用多久"写成了请求。这是整条链的源头,后面所有授权、合约的范围都由它决定。',
'n1-2': '运营方人工 + AI 助手把需求方和能提供数据的提供方配对。这一步不写库,只是把两边拉到一起,决定后面走哪张订单。',
'n1-3': '撮合成功后,平台把匹配到的订单推送给数据提供方。订单里带着需求方要的数据范围,提供方据此判断是否接单。',
'n1-4': '提供方确认接单,系统自动生成一张"供需订单"。订单是后面签合约、建沙盒的依据——此刻数据还没出域,只是双方达成了合作意向。',
'n1-5': '数据服务方把真实算法(风控 XGBoost)挂到平台目录。算法是"计算能力"不是"数据",它将在沙盒里对提供方数据做加工。这一步让"算什么"公开可见、可审计。',
'n1-6': '使用方对订单发起线下付款确认(签约动作)。签完订单状态推进,但真正生效还要等合约双签。这里体现的是"钱"和"约"分离:先付后签,风险可控。',
'n1-7': '提供方同样对订单确认付款。双方都签了,订单才进入待交付状态。',
'n1-8': '运营方审核订单通过后,生成正式数字合约(带双方数字签名)。合约是整条链的法律锚点:写明了数据用途、配额、单价,后面所有计算和结算都按它来。',
'n1-9': '合约双签完成后,合约哈希被写入 FISCO-BCOS 联盟链。这意味着条款不可篡改、可审计——任何一方都不能偷偷改条件。这是"可信数据空间"最关键的信任锚点。',
'n1-10': '服务方把算法代码上传到安全沙盒。代码进入受控环境,准备对提供方数据做加工。此时数据仍在提供方侧,尚未进入沙盒。',
'n1-11': '提供方准备信贷样例数据(约 12 万条)。这是准备阶段,真实灌入在 n1-15;现在只是声明"我要用这份数据来算"。',
'n1-12': '使用方在沙盒里开发调试算法,环境就绪。沙盒是一台隔离的计算虚拟机,数据灌进去后只在里面算,结果出来前数据不出域。',
'n1-13': '运营方审核算法是否合规(有没有越权取数、有没有后门)。审核通过才允许正式投产——这是平台对"算得安不安全"的把关。',
'n1-14': '使用方收到算法审核通过通知。流程进入"可以灌数计算了"的状态。',
'n1-15': '提供方把 12 万条样例数据以密态灌入沙盒。数据以加密形态进入隔离环境,明文只在沙盒内存里出现,出域时仍是密文或仅结果——这是"数据可用不可见"的核心。',
'n1-16': '沙盒正式执行密态计算。原始数据从不离开沙盒,只有加密结果产出。这一步是隐私计算真正发生的地方。',
'n1-17': '使用方从沙盒提取计算结果(如 AUC/KS 指标)。拿到的是加工后的模型/评分,不是原始数据——数据主权始终在提供方。',
'n1-18': '使用方完成线下支付。付款凭证被记录,作为后面结算对账的依据。线下支付是因为企业间走对公账户,平台只记账不碰钱。',
'n1-19': '运营方按合约单价 × 用量生成结算凭证并置为已结算。钱怎么分(提供方/平台/服务方)在业务全景里可见,确保各方利益透明。',
'n1-20': '结算凭证上链存证。和合约一样,结算记录也写入联盟链,防止赖账、可被审计。',
'n1-21': '监管方核验整条链的哈希完整性:从需求→合约→计算→结算,每一步存证是否连贯、有没有被篡改。哈希链完整 = 全程可信。',
// ── 图2:沙盒交付(三方)──
'n2-1': '需求方发布一份"三方联合建模"需求(画像 × 风控 × 消费)。数据没动,只是把三方要一起算什么写成了请求。',
'n2-2': '运营方人工 + AI 撮合。把使用方、提供方、服务方三方拉到一起,决定后面走同一张订单。',
'n2-3': '运营方审核订单通过。订单是三方协作的载体,审核确保需求合法合规。',
'n2-4': '提供方把数据资源上架。上架即声明"这份数据可被合规使用",目录公开、可被三方发现。',
'n2-5': '服务方把算法服务挂出。三方里"算"的一方就绪,计算能力公开可见。',
'n2-6': '使用方对订单确认付款。三方里"用"的一方先付,风险自担。',
'n2-7': '提供方对订单确认付款。三方里"供"的一方先付,进入待签。',
'n2-8': '服务方对订单确认付款。三方都付了,订单才进入待交付。',
'n2-9': '运营方生成正式数字合约(三方)。合约写明了三方各自的权利义务、配额、单价,是协作的法律锚点。',
'n2-10': '三方合约双签后上链存证。合约哈希写入 FISCO-BCOS,条款不可篡改,任何一方都不能私自改条件。',
'n2-11': '提供方准备样例数据。准备阶段,真实灌入在 n2-16。',
'n2-12': '服务方在沙盒里编写算法代码。隔离环境就绪,准备对三方数据做加工。',
'n2-13': '服务方提交算法审核。把代码交给平台把关。',
'n2-14': '运营方审核算法是否合规。通过才允许投产——"算得安不安全"的把关。',
'n2-15': '审核结果通知服务方。流程进入"可以灌数计算了"。',
'n2-16': '提供方把三方样例数据密态灌入沙盒。数据加密进入隔离环境,明文只在沙盒内,出域仍是密文或仅结果。',
'n2-17': '沙盒触发三方联合密态计算(MPC·SPDZ)。原始数据不出域,只有加密中间结果在各沙盒间流动。',
'n2-18': '计算完成,交付凭证回传给平台。三方都拿到了各自应得的结果。',
'n2-19': '使用方完成线下付款。付款凭证记录,用于结算对账。',
'n2-20': '运营方按合约生成三方结算凭证并置已结算。利益分配在业务全景可见,三方透明。',
'n2-21': '三方结算凭证上链存证。防止赖账、可被审计。',
'n2-22': '监管方核验三方交付的哈希完整性:数据不跨境、每方都留痕。哈希链完整 = 全程可信。',
// ── 图3:机构会员注册与资源发布 ──
'n3-1': '使用方机构入驻平台并发布数据需求。入驻要过实名/资质审核(营业执照 OCR 等),确保"谁在要数据"可信。',
'n3-2': '提供方机构申请入驻,运营方审批通过。只有 PASS 的机构才能上架数据,过滤掉不可信的数据源。',
'n3-3': '服务方机构入驻并准备算法产品。三方可信成员齐了,平台才有了"数据 + 算法 + 使用"的完整生态。',
'n3-4': '提供方把数据资源(如"一线消费力指数"120 万样本)上架到公共目录。上架即声明数据可被合规使用,目录公开、可被发现。',
'n3-5': '使用方浏览公共数据目录、挑选所需资源。这是"市场"环节,数据作为商品被透明地展示和选择。',
'n3-6': '使用方注册连接器(TDC 边缘节点)。连接器是数据进出平台的"安全闸门",SNP 远程证明确保它真的是可信硬件。',
'n3-7': '服务方把算法产品发布上架。和"挂出算法"一样,是计算能力的公开注册。',
// ── 图4:隐私计算沙盒执行链路(TEE)──
'n4-1': '合约达成后自动创建一台安全沙盒(TEE 机密虚拟机)。策略是 deny-all,只有授权算法能跑——这是"最小权限"的硬件级保证。',
'n4-2': '运营方通知各方导入数据。协调动作,触发后面的密态传输。',
'n4-3': '提供方把数据以 AES-256-GCM 加密形态传入沙盒。传输全程密文,即使被截获也看不到内容。',
'n4-4': 'TEE 硬件收到加密数据,用远程证明换来的密钥在内存里解密。解密只发生在受证明的机密虚拟机内,宿主机都看不到明文。',
'n4-5': 'TEE 内执行算法,远程证明(SNP report)通过后才算数。证明通过 = 跑的代码和平台声明的一致,结果可信。',
'n4-6': '使用方拿到加密的计算结果(联合模型)。同样是密文出域、本地解密,结果可验证但原始数据没给使用方。',
'n4-7': '计算完,TEE 把内存数据销毁、环境清零。"用后即焚"确保数据不留副本、不可被二次获取——这是 TEE 相对普通沙盒的最大优势。',
'n4-8': '沙盒释放,销毁凭证上链存证。凭证证明"数据已被销毁",让监管和使用方都能确认没有数据残留。',
'n4-9': '运营方收到释放回执,确认本次交付完整结束。',
// ── 图5:三种隐私计算模式对比 ──
'n5-1': '运营方按"数据能否集中"选择计算模式:能集中用 PSI 求交,不能集中用 FL/MPC。选型决定了后面走哪条技术路线。',
'n5-2': '部署 1 个集中沙盒跑 PSI。PSI 适合"两边各有一堆 ID,想知道交集"的场景。',
'n5-3': '联邦学习下,每个参与方在自己环境部署沙盒。数据从头到尾不出本地机构——这是 FL"数据不动模型动"的精髓。',
'n5-4': '多方计算下,各方也在本地部署沙盒。和 FL 不同,MPC 把计算拆成秘密碎片分发给各方,谁都看不到完整数据。',
'n5-5': 'PSI 把 ID 加密(OPRF)后传到集中沙盒做求交。原始 ID 不出域,只交换密文,求出交集但不泄露非交集部分。',
'n5-6': 'FL 在本地用明文数据训练,只把模型参数(梯度)传出去。原始数据物理上留在机构内,最保护隐私。',
'n5-7': '各方之间只传加密的梯度 ΔW(加噪 ε=0.1 防反推)。参数会动,但动的是"学出来的规律"不是"原始数据"。',
'n5-8': 'MPC 把数据秘密分享成碎片,分散到多方。单份碎片无意义,必须凑齐阈值份才能还原——数据从不出完整形态。',
'n5-9': '各方之间只传加密的中间碎片(3-of-5 Shamir)。传输的内容是"乱码碎片",截获也拼不出原数据。',
'n5-10': 'PSI 返回交集 ID 数(约 4872)。使用方拿到"哪些人两边都有",但拿不到对方的非交集名单。',
'n5-11': 'FL 返回联合训练好的模型。使用方拿到"融合了三方的规律",但没有任何一方的原始样本。',
'n5-12': 'MPC 返回联合统计(均值 μ、标准差 σ)。使用方拿到"汇总后的数字",没有任何一方的明细。'
}
// 兜底:没单独写 narrative 的节点,给一句人话描述(基于已有元数据)
function defaultNarrative(n) {
const what = n.data?.name ? `这一步会处理「${n.data.name}」` : `这一步对应 ${n.label}`
const route = n.route ? `,Chrome 里打开的是 ${n.route} 页面` : ''
return `${what}${route}。点开上方节点可在真实页面里查看当前数据状态。`
}
const graphs = [seq1, seq2, seq3, seq4, seq5].map((g) => ({
...g,
edges: normalizeEdges(g.edges),
nodes: g.nodes.map((n) => ({ ...n, narrative: NARRATIVES[n.id] || defaultNarrative(n) }))
}))
export const DAG = {
swimlanes: SWIMLANES,
edgeKinds: EDGE_KINDS,
graphs
}
/** 收集一张图里所有节点关联到的真实 TC 编号(用于点「启动」时直接喂给 runner) */
export function collectTcs(graph) {
const set = new Set()
for (const n of graph.nodes) if (n.case) set.add(n.case)
return [...set]
}