Files
ssw-mvp/docs/e2e/dag-data.mjs
T
admin 24dd63e5d6 e2e/dag: 业务全景页面——把每条记录的授权/审核/调用/存证/分配/留痕一屏可见
数据流通平台的核心是「信任」,不是看热闹。
对每条核心业务对象都加 BusinessDetail 接口 + 前端「业务全景」详情页,
并让 e2e 每跑完创建/更新就跳过去,让用户在 DAG 上看到完整链路。

新增接口:
- GET /api/ssw/tdc/DeliveryTask/{id}/BusinessDetail
  把任务本体 + 上游合约 + 上游订单 + 参与方 + 审核 + 策略 + 执行 +
  TEE 远程证明 + 调用留痕 + 销毁存证 串起来(30+ 字段)
- GET /api/ssw/tds/Contract/{id}/BusinessDetail
  合约本体 + 链上存证 + 上游订单 + 下游交付任务 + 用量配额
- GET /api/ssw/tds/BillingLedger/{id}/BusinessDetail
  台账 + 利益分配(提供方/平台/税实比例)+ 上游合约 + 计费明细

新增前端页(views/ssw/views/_biz/{Delivery,Contract,Billing}DetailView.vue):
- 上半 4 张卡:基本/授权/配额/审核
- 中段:执行步骤时间轴(含策略/开始/结果/上报/销毁)+ TEE 证明/KBS/measurementSha256
- 下半:上游订单 + 跨 schema 数据访问 + 政策条款
- 底部:审计留痕(创建人/时间/最后修改人)

路由:
- jweb 在 core.ts 加 tdc/delivery-detail/:id、tds/contract-detail/:id
- web 在 modules/{tdc,tds}.ts 加同样的路径
- 两边都保留即可(互跨栈跳转也不冲突)

dag e2e 加新动作类型 'bizDetail':
- 关掉上一个抽屉/弹窗
- 拼 URL (FE_BASE + /tds-or-tdc/<entity>-detail/<id>)
- 等 networkidle + 标题出现 + 2.5s 缓冲
- 截图 SIM-BIZ-<entity>-<id>.png
- 失败告警 + 持久化 entity/path/cardCount/titleText
- 修复 t.baseURL 不存在的 bug(TestCtx 类没存)

seq-1 / seq-2 验证:
- 21/21 + 22/22 pass
- 业务全景截图:12 张 SIM-BIZ-*.png
- 关键截图 SIM-BIZ-billing-*.png 显示
  利益分配 ¥17,280/¥3,240/¥1,296/实付¥21,600
  上下游调用次数、合约 SHA-256、链上存证全部可点开
2026-08-09 11:17:01 +08:00

769 lines
42 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: '需求单已提交(列表里能看到)' }
]
},
{ 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: '提供方确认接单 → 已生成响应订单(详情见抽屉)' }
]
},
{ 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: '算法服务已挂出到平台目录(详情见抽屉)' }
]
},
{ 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: '使用方订单已发起线下付款(订单详情)' }
]
},
{ 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: '提供方订单已发起线下付款(订单详情)' }
]
},
{ 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: '订单已审核(详情见抽屉)' }
]
},
{ 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: '数据资源已上架目录(详情见抽屉)' }
]
},
{ 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: '算法服务已挂出(详情见抽屉)' }
]
},
{ 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: '使用方订单已发起线下付款(订单详情)' }
]
},
{ 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: '提供方订单已发起线下付款(订单详情)' }
]
},
{ 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: '服务方订单已发起线下付款(订单详情)' }
]
},
{ 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: '运营方订单审核通过(合约详情)' }
]
},
{ 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(详情见抽屉)' }
]
},
{ 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: '使用方机构会员 + 连接器已注册(详情见抽屉)' }
]
},
{ 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: '提供方机构会员入驻审批通过(详情见抽屉)' }
]
},
{ 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: '数据资源已上架到公共目录(详情见抽屉)' }
]
},
{ 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(详情见抽屉)' }
]
},
{ 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: '算法服务产品已发布并上架(详情见抽屉)' }
]
},
],
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: '合约签已触发创建安全沙盒(日志/结果弹窗)' }
]
},
{ 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: '密态传输数据已落沙盒(日志/结果弹窗)' }
]
},
{ 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 内计算执行完成(日志/结果弹窗)' }
]
},
{ 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: '联合模型已加密出域到使用方(日志/结果弹窗)' }
]
},
{ 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 数据销毁 · 环境清零(日志/结果弹窗)' }
]
},
{ 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 集中沙盒已部署(日志/结果弹窗)' }
]
},
{ 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 各参与方本地沙盒已部署(日志/结果弹窗)' }
]
},
{ 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 各参与方本地沙盒已部署(日志/结果弹窗)' }
]
},
{ 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
})
}
const graphs = [seq1, seq2, seq3, seq4, seq5].map((g) => ({
...g,
edges: normalizeEdges(g.edges)
}))
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]
}