feat(web): 播报板节点详情展示上游节点信息与锚定资产

上游/下游节点从只显示 id 改为悬停弹出节点名片(类型/状态/来源/时间/摘要/payload);
展开时顺带展示该节点锚定的资产(类型标签 + 可辨识文本)。

服务端 /exploration/nodes 新增 assets 字段(节点id→资产),读 exploration_anchors
并复用发现列表的资产打标逻辑;同页节点互引时用本页 items 兜底 refs 查找表。
This commit is contained in:
Autumn-27 committed 2026-09-17 11:23:53 -04:00
1 parent 3b60191e86
commit d95f0d002d
6 files changed
+214 -36

No files matched your search

+1
View File
@@ -674,6 +674,7 @@ export const api = {
size: r.size ?? query.size ?? 20,
edges: arr(r.edges),
refs: r.refs ?? {},
assets: r.assets ?? {},
}));
},
activity: (task?: string, opts?: { intent?: string; since?: number; limit?: number }) => {
+74 -16
View File
@@ -3060,8 +3060,17 @@ export const llmConfig = {
// ── Agents ───────────────────────────────────────────────────────────────────
export const agents: Agent[] = [
{
id: "1001", key: "retester", name: "漏洞复测", role: "assistant", builtin: false, enabled: true,
description: "从漏洞详情手动启动,保存独立复测结论", max_turns: 0, mcp_count: 0, skill_count: 0, tool_count: 2,
id: "1001",
key: "retester",
name: "漏洞复测",
role: "assistant",
builtin: false,
enabled: true,
description: "从漏洞详情手动启动,保存独立复测结论",
max_turns: 0,
mcp_count: 0,
skill_count: 0,
tool_count: 2,
},
{
id: "1",
@@ -3478,35 +3487,65 @@ export const interceptHistory: InterceptApprovalRow[] = [
// Approval detail fixtures use harmless report-writing examples.
interceptHistory.unshift({
id: 94, task_id: "t-acme-web", agent_name: "work#1", tool_name: "Write",
id: 94,
task_id: "t-acme-web",
agent_name: "work#1",
tool_name: "Write",
tool_input: { path: "reports/summary.md", content: "# 检查摘要\n\n本轮验证已完成,整理已有证据与后续建议。" },
status: "allowed", decision_source: "model", reason: "[模型] 将已有检查结论写入本地报告,不修改业务数据。",
created_at: T("2026-07-26T08:00:00Z"), decided_at: T("2026-07-26T08:00:02Z"),
conv_title: "", conv_agent_key: "", rule_name: "",
status: "allowed",
decision_source: "model",
reason: "[模型] 将已有检查结论写入本地报告,不修改业务数据。",
created_at: T("2026-07-26T08:00:00Z"),
decided_at: T("2026-07-26T08:00:02Z"),
conv_title: "",
conv_agent_key: "",
rule_name: "",
});
export const interceptDetails: Record<number, InterceptAudit> = {
94: {
run_id: "demo-run-report", tool_use_id: "call-write-report", correlation: "exact",
run_id: "demo-run-report",
tool_use_id: "call-write-report",
correlation: "exact",
input_digest: "a3b458eca3b458eca3b458eca3b458eca3b458eca3b458eca3b458eca3b458ec1234",
user_message: "请整理已经完成的检查,将结论和证据索引写入 reports/summary.md。\n保留待验证项,不修改业务数据。",
context: [
{ kind: "user", text: "汇总本轮已有证据,生成检查摘要。" },
{ kind: "tool_use", tool: "Read", tool_use_id: "call-read-evidence", text: '{"path":"reports/evidence-index.json"}' },
{ kind: "tool_result", tool: "Read", tool_use_id: "call-read-evidence", text: "已读取 3 条证据索引。\n记录包含请求时间、结果摘要和本地文件位置。" },
{
kind: "tool_use",
tool: "Read",
tool_use_id: "call-read-evidence",
text: '{"path":"reports/evidence-index.json"}',
},
{
kind: "tool_result",
tool: "Read",
tool_use_id: "call-read-evidence",
text: "已读取 3 条证据索引。\n记录包含请求时间、结果摘要和本地文件位置。",
},
],
captured_at: T("2026-07-26T08:00:00Z"), initial_action: "allow",
initial_reason: "[模型] 将已有检查结论写入本地报告,不修改业务数据。", effective_action: "allow",
captured_at: T("2026-07-26T08:00:00Z"),
initial_action: "allow",
initial_reason: "[模型] 将已有检查结论写入本地报告,不修改业务数据。",
effective_action: "allow",
config_digest: "b4c569fdb4c569fdb4c569fdb4c569fdb4c569fdb4c569fdb4c569fdb4c569fd1234",
profile_id: 1, execution_status: "succeeded", output: "Successfully wrote reports/summary.md\n共写入 68 个字符。",
profile_id: 1,
execution_status: "succeeded",
output: "Successfully wrote reports/summary.md\n共写入 68 个字符。",
execution_ended_at: T("2026-07-26T08:00:03Z"),
},
93: {
run_id: "demo-run-review", tool_use_id: "call-pending-review", correlation: "exact",
run_id: "demo-run-review",
tool_use_id: "call-pending-review",
correlation: "exact",
input_digest: "c5d670aec5d670aec5d670aec5d670aec5d670aec5d670aec5d670aec5d670ae1234",
user_message: "检查备份表的用途,涉及删除时需要先确认。", context: [],
captured_at: T("2026-07-25T15:14:00Z"), initial_action: "ask",
initial_reason: "[模型] 疑似备份表,无法确定是否生产数据。", profile_id: 1, execution_status: "not_started",
user_message: "检查备份表的用途,涉及删除时需要先确认。",
context: [],
captured_at: T("2026-07-25T15:14:00Z"),
initial_action: "ask",
initial_reason: "[模型] 疑似备份表,无法确定是否生产数据。",
profile_id: 1,
execution_status: "not_started",
},
};
@@ -3897,6 +3936,25 @@ export const coverageGraph = {
};
// ── 资产在本任务关联的意图/事实/发现(/tasks/{id}/asset-refs)──
// 播报板 demo:探索节点 → 其锚定资产。真实后端读 exploration_anchors,mock 里静态给几条。
const NODE_ASSETS: Record<string, number[]> = {
fi1: [3],
fi2: [2, 4],
fi3: [5],
fiRce: [4],
fiPriv: [19],
fiJenkins: [21],
i1: [2],
i7: [4],
};
export function nodeAssetsFor(nodeId: string): FindingAsset[] {
return (NODE_ASSETS[nodeId] ?? []).flatMap((id) => {
const asset = assets.find((candidate) => candidate.id === id);
return asset ? [assetRef(id)] : [];
});
}
export function assetRefsFor(_assetId: number) {
return {
intents: [
+7 -1
View File
@@ -2172,7 +2172,13 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
if (node) refs[id] = node;
}
}
return { items, total: matched.length, page, size, edges, refs };
// 顺带带上本页节点(含邻居)锚定的资产,供展开时展示。
const assets: Record<string, ReturnType<typeof D.nodeAssetsFor>> = {};
for (const id of new Set([...onPage, ...Object.keys(refs)])) {
const anchored = D.nodeAssetsFor(id);
if (anchored.length > 0) assets[id] = anchored;
}
return { items, total: matched.length, page, size, edges, refs, assets };
}
if (path === "/exploration/activity" && seg.length === 2) {
const since = Number(q.get("since") ?? 0);
+2
View File
@@ -429,6 +429,8 @@ export interface ExplorationNodePage {
size: number;
edges: Edge[];
refs: Record<string, TaskNode>;
// 节点 id → 该节点锚定的资产(播报板展开时顺带展示,含本页节点与其邻居)。
assets: Record<string, FindingAsset[]>;
}
export interface ExplorationNodeQuery {