feat(frontend): organize project and assessment graphs around relationships

This commit is contained in:
Sycun 2026-11-20 14:57:00 +08:00
parent cabc5546f3
commit 5129c3fe8a
62 changed files with 553 additions and 542 deletions

View File

@ -0,0 +1,119 @@
.graph-node-layer {
position: absolute;
inset: 0;
pointer-events: none;
direction: ltr;
}
.graph-node {
position: absolute;
box-sizing: border-box;
border: 1px solid var(--semi-color-border);
border-radius: 8px;
padding: 0;
background: var(--semi-color-bg-1);
box-shadow: 0 1px 3px rgba(20, 31, 53, .10);
color: var(--semi-color-text-0);
font-family: inherit;
font-size: 14px;
font-weight: 500;
line-height: 1.2;
text-align: start;
cursor: pointer;
pointer-events: auto;
}
.graph-node:hover, .graph-node:focus-visible, .graph-node[aria-pressed="true"] {
border-color: var(--graph-node-color);
background: color-mix(in srgb, var(--graph-node-color) 5%, var(--semi-color-bg-1));
}
.graph-node[aria-pressed="true"] {
box-shadow: 0 0 0 2px color-mix(in srgb, var(--graph-node-color) 19%, transparent), 0 3px 9px rgba(20, 31, 53, .13);
}
.graph-node-content {
display: flex;
align-items: center;
height: 100%;
min-width: 0;
padding-inline: 5px;
overflow: hidden;
}
.graph-node--compact { border-radius: 5px; box-shadow: 0 1px 3px rgba(20, 31, 53, .08); }
.graph-node--compact .graph-node-content { gap: 4px; }
.graph-node--compact .graph-node-content::before {
content: "";
flex: 0 0 3px;
height: 11px;
border-radius: 2px;
background: var(--graph-node-color);
}
.graph-node--standard .graph-node-content {
flex-direction: column;
align-items: flex-start;
justify-content: center;
gap: 2px;
}
.graph-node--standard .graph-node-icon { width: 13px; height: 13px; }
.graph-node-kind {
display: inline-flex;
align-items: center;
gap: 5px;
flex-shrink: 0;
color: var(--semi-color-text-1);
font-size: calc(12px * var(--graph-node-text-scale, 1));
font-weight: 650;
}
.graph-node-icon {
display: inline-grid;
place-items: center;
flex: 0 0 auto;
width: 16px;
height: 16px;
border-radius: 5px;
color: color-mix(in srgb, var(--graph-node-color) 75%, var(--semi-color-text-0));
background: color-mix(in srgb, var(--graph-node-color) 13%, var(--semi-color-bg-1));
}
.graph-node-title, .graph-node-keyline {
display: block;
width: 100%;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.graph-node--detail { font-size: calc(15px * var(--graph-node-text-scale)); }
.graph-node:where([data-root="true"]) {
border-color: color-mix(in srgb, var(--graph-node-color) 31%, var(--semi-color-border));
background: color-mix(in srgb, var(--graph-node-color) 5%, var(--semi-color-bg-1));
}
.graph-node[data-boundary="true"] { border-style: dashed; }
.graph-node--detail .graph-node-content {
flex-direction: column;
justify-content: center;
align-items: flex-start;
gap: 3px;
padding: 5px 10px;
}
.graph-node--standard .graph-node-title { line-height: 16px; }
.graph-node--detail .graph-node-title,
.graph-node--standard[data-wrap="true"] .graph-node-title {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
white-space: normal;
overflow-wrap: anywhere;
}
.graph-node-keyline {
color: var(--semi-color-text-2);
font: calc(12px * var(--graph-node-text-scale))/1.2 "SFMono-Regular", Consolas, monospace;
}
.graph-node-port {
position: absolute;
top: 50%;
width: 6px;
height: 6px;
transform: translateY(-50%);
border: 1px solid var(--semi-color-bg-1);
border-radius: 50%;
background: var(--graph-node-color);
}
.graph-node-port.is-left { left: -4px; }
.graph-node-port.is-right { right: -4px; }

View File

@ -0,0 +1,98 @@
import {
IconAlertTriangle, IconBolt, IconBranch, IconFile, IconFlag, IconGlobe,
IconHelpCircle, IconKey, IconLayers, IconSearch, IconServer, IconTickCircle
} from '@douyinfe/semi-icons';
import './graph-card.css';
export const CARD_WIDTH = 216;
export const CARD_HEIGHT = 98;
const NODE_ICONS = {
target: IconGlobe, infra: IconServer, auth: IconKey, finding: IconSearch, chain: IconBranch,
exploit: IconBolt, poc: IconTickCircle, vulnerability: IconAlertTriangle, missing: IconHelpCircle,
goal: IconFlag, step: IconBranch, fact: IconFile, receipt: IconTickCircle, observation: IconSearch,
memory: IconLayers, digest: IconFile, guidance: IconBolt
};
export function GraphNodeIcon({ type }) {
const Icon = NODE_ICONS[type] || IconFile;
return <span className="graph-node-icon" aria-hidden="true"><Icon size="small" /></span>;
}
export function GraphNodeCard({ id, title, type, category, color, factKey, boundary, ports = [], selected, card, onSelect }) {
const { density, box } = card;
const detail = density === 'detail';
const textScale = Math.min(Math.max(box.width / CARD_WIDTH, 1), 1.6);
return (
<button
type="button"
className={`graph-node graph-node--${density}`}
title={title}
aria-label={title}
aria-pressed={selected}
data-root={type === 'goal' || type === 'target' || undefined}
data-boundary={boundary || undefined}
data-wrap={density === 'standard' && box.height >= 50 || undefined}
style={{ ...box, '--graph-node-color': color, '--graph-node-text-scale': textScale }}
onClick={() => onSelect(id)}
>
<span className="graph-node-content">
{density !== 'compact' && (
<span className="graph-node-kind">
<GraphNodeIcon type={type} />
<span>{category}</span>
</span>
)}
<span className="graph-node-title" dir="auto">{title}</span>
{detail && box.height >= 84 && factKey && title !== factKey && (
<span className="graph-node-keyline" dir="auto">{factKey}</span>
)}
</span>
{detail && [...ports].map(side => (
<span key={side} className={`graph-node-port is-${side}`} aria-hidden="true" />
))}
</button>
);
}
export function visibleGraphCards(cy, { anchorId, allowCompact = () => true } = {}) {
const width = cy.width();
const height = cy.height();
const cardWidth = CARD_WIDTH * cy.zoom();
const cardHeight = CARD_HEIGHT * cy.zoom();
const density = cardHeight >= 68 ? 'detail' : cardHeight >= 36 ? 'standard' : 'compact';
const cards = [];
for (const node of cy.nodes(':visible')) {
const id = node.id();
if (node.hasClass('dim')) continue;
if (density === 'compact' && id !== anchorId && (cardWidth < 49 || !allowCompact(node))) continue;
const { x, y } = node.renderedPosition();
const left = x - cardWidth / 2;
const top = y - cardHeight / 2;
if (left + cardWidth <= 0 || left >= width || top + cardHeight <= 0 || top >= height) continue;
let box = { left, top, width: cardWidth, height: cardHeight };
// Keep the assessment goal readable in very small fitted overviews.
if (id === anchorId && cardWidth < 49) {
box = { left: Math.max(3, left), top: y - 13, width: Math.min(108, width - Math.max(3, left)), height: 26 };
}
cards.push({ id, density, box });
}
return cards;
}
export function zoomGraph(cy, factor, renderedPosition = { x: cy.width() / 2, y: cy.height() / 2 }) {
cy.zoom({ level: cy.zoom() * factor, renderedPosition });
}
export function bindGraphCardWheel(layer, cy) {
const wheel = event => {
if (!event.deltaY) return;
event.preventDefault();
const { left, top, height } = layer.getBoundingClientRect();
const units = event.deltaMode === 1 ? 33 : event.deltaMode === 2 ? height : 1;
zoomGraph(cy, 10 ** (-event.deltaY * units / 1250), { x: event.clientX - left, y: event.clientY - top });
};
// Card buttons sit above the renderer. Keep pointer-centered zoom on either surface.
layer.addEventListener('wheel', wheel, { passive: false });
return () => layer.removeEventListener('wheel', wheel);
}

View File

@ -0,0 +1,14 @@
// Pick a layout parent for each node. Edges outside this forest remain in the graph.
export function graphParents(orderedEdges, isRoot) {
const parents = new Map();
const parentEdges = new Set();
for (const edge of orderedEdges) {
if (isRoot(edge.target) || parents.has(edge.target)) continue;
let ancestor = edge.source;
while (ancestor && ancestor !== edge.target) ancestor = parents.get(ancestor);
if (ancestor === edge.target) continue;
parents.set(edge.target, edge.source);
parentEdges.add(edge);
}
return { parents, parentEdges };
}

View File

@ -1,32 +1,40 @@
import { Fragment, useEffect, useRef, useState } from 'react';
import { useEffect, useRef, useState } from 'react';
import { toastError } from '../../components/ui';
import { GRAPH_KIND_COLOR } from './labels';
import { bindGraphCardWheel, CARD_HEIGHT, CARD_WIDTH, GraphNodeCard, visibleGraphCards, zoomGraph } from '../../components/graph-card';
import { useT } from '../../lib/i18n';
import { GRAPH_KIND_COLOR, kindText } from './labels';
import { GRAPH_COLUMN_GAP, graphPositions, updatedGraphPositions } from './graphLayout';
const STYLE = [
{
selector: 'node',
style: {
'background-color': 'data(color)',
width: 23, height: 23,
'border-width': 2, 'border-color': '#ffffff'
shape: 'round-rectangle', width: CARD_WIDTH, height: CARD_HEIGHT,
'background-color': 'data(color)', 'background-opacity': 0.13,
'border-color': 'data(color)', 'border-opacity': 0.42, 'border-width': 1.2
}
},
{ selector: 'node[kind = "goal"]', style: { width: 31, height: 31 } },
{ selector: 'node[boundary = 1]', style: { shape: 'round-rectangle', width: 17, height: 17 } },
{ selector: 'node.current', style: { 'border-color': '#0066ff', 'border-width': 4 } },
{ selector: 'node.current', style: { 'background-opacity': 0.78 } },
{
selector: 'edge',
style: {
width: 1.8,
width: 2.1,
'line-color': 'data(color)',
'target-arrow-color': 'data(color)',
'target-arrow-shape': 'triangle',
'arrow-scale': 0.8,
'curve-style': 'bezier',
opacity: 0.74
opacity: 0.66
}
},
{
selector: 'edge.forward',
style: { 'source-endpoint': '50% 0px', 'target-endpoint': '-50% 0px' }
},
{
selector: 'edge.backward',
style: { 'source-endpoint': '-50% 0px', 'target-endpoint': '50% 0px' }
},
{
selector: 'edge.flow',
style: { 'curve-style': 'round-taxi', 'taxi-direction': 'rightward', 'taxi-radius': 16 }
@ -40,6 +48,7 @@ const STYLE = [
},
{ selector: 'edge[projection = "archive"]', style: { 'line-style': 'dashed' } },
{ selector: 'edge[projection = "details"]', style: { 'line-style': 'dotted' } },
{ selector: 'edge.cross-link', style: { opacity: 0.31 } },
{ selector: 'node.dim', style: { opacity: 0.32 } },
{ selector: 'edge.dim', style: { opacity: 0.12 } },
{
@ -49,70 +58,7 @@ const STYLE = [
{ selector: '.hidden', style: { display: 'none' } }
];
const LABEL_WIDTH = 148;
const LABEL_HEIGHT = 22;
const LABEL_PADDING = 7;
const LABEL_PRIORITY = { goal: 0, finding: 1, step: 2, guidance: 3, fact: 4, digest: 5 };
const overlaps = (a, b) => a.x < b.x + b.width && a.x + a.width > b.x
&& a.y < b.y + b.height && a.y + a.height > b.y;
function visibleLabels(cy, model, selected, hovered, measure) {
const width = cy.width();
const height = cy.height();
const zoom = cy.zoom();
const items = cy.nodes(':visible').map(node => {
const item = model.nodes.get(node.id());
const { x, y } = node.renderedPosition();
const radius = node.renderedOuterWidth() / 2 + 2;
const priority = node === selected ? -2 : node === hovered ? -1
: (LABEL_PRIORITY[item.kind] ?? 6) + (item.boundary ? 8 : 0);
return { node, item, x, y, radius, priority };
}).filter(({ x, y, radius }) => x >= -radius && x <= width + radius && y >= -radius && y <= height + radius);
const occupied = items.map(({ x, y, radius }) => ({
x: x - radius, y: y - radius, width: radius * 2, height: radius * 2
}));
const labels = [];
items.sort((a, b) => a.priority - b.priority);
for (const { node, item, x, y, radius, priority } of items) {
if (zoom < 0.64 && priority > 3) continue;
if (node.hasClass('dim') && priority >= 0) continue;
const title = (item.title || item.id).replace(/\s+/g, ' ').trim() || item.id;
const labelWidth = Math.min(LABEL_WIDTH, Math.ceil(measure(title)) + LABEL_PADDING * 2);
const left = Math.max(4, Math.min(x - labelWidth / 2, width - labelWidth - 4));
const top = y + radius + 4;
const candidates = [{ x: left, y: top, width: labelWidth, height: LABEL_HEIGHT }];
if (priority <= 3) {
candidates.push(
{ ...candidates[0], y: y - radius - LABEL_HEIGHT - 4 },
{ ...candidates[0], x: x + radius + 5, y: y - LABEL_HEIGHT / 2 },
{ ...candidates[0], x: x - radius - labelWidth - 5, y: y - LABEL_HEIGHT / 2 }
);
}
if (priority <= 0) {
// A fitted overview can leave only a few pixels between nodes on a phone.
for (const offset of [28, 54, 80, 106, 132]) {
candidates.push(
{ ...candidates[0], y: top + offset, displaced: true },
{ ...candidates[0], y: y - radius - LABEL_HEIGHT - 4 - offset, displaced: true }
);
}
}
const box = candidates.find(rect => rect.x >= 3 && rect.x + rect.width <= width - 3
&& rect.y >= 3 && rect.y + rect.height <= height - 3
&& !occupied.some(other => overlaps(rect, other)));
if (!box) continue;
occupied.push({ x: box.x - 3, y: box.y - 2, width: box.width + 6, height: LABEL_HEIGHT + 4 });
const below = box.y > y;
const leader = box.displaced ? {
left: x,
top: below ? y + radius : box.y + LABEL_HEIGHT,
height: below ? box.y - y - radius : y - radius - box.y - LABEL_HEIGHT
} : null;
labels.push({ id: item.id, title, box, leader, selected: priority === -2 });
}
return labels;
}
const COMPACT_KINDS = new Set(['goal', 'step', 'finding', 'guidance']);
function fitGraph(cy) {
const nodes = cy.nodes(':visible');
@ -121,18 +67,11 @@ function fitGraph(cy) {
if (cy.zoom() > 1) cy.zoom(1).center(nodes);
}
function zoomGraph(cy, factor) {
cy.zoom({
level: cy.zoom() * factor,
renderedPosition: { x: cy.width() / 2, y: cy.height() / 2 }
});
}
function graphElements(model, positions) {
return [
...[...model.nodes.values()].map(node => ({
data: {
id: node.id, kind: node.kind, boundary: Number(Boolean(node.boundary)),
id: node.id, kind: node.kind,
color: GRAPH_KIND_COLOR[node.kind] || '#86909c'
},
position: positions.get(node.id)
@ -141,22 +80,27 @@ function graphElements(model, positions) {
const source = positions.get(edge.source);
const target = positions.get(edge.target);
const dx = target.x - source.x;
const route = dx > GRAPH_COLUMN_GAP * 1.5 ? 'long-flow' : 'flow';
const classes = [];
if (dx !== 0) classes.push(dx > 0 ? 'forward' : 'backward');
if (dx > 0 && model.layoutEdges.has(edge.id)) classes.push(dx > GRAPH_COLUMN_GAP * 1.5 ? 'long-flow' : 'flow');
if (!model.layoutEdges.has(edge.id)) classes.push('cross-link');
return {
data: {
...edge, projection: edge.projection || '',
bend: target.y < source.y ? -28 : 28
},
classes: dx > 0 && model.layoutEdges.has(edge.id) ? route : ''
classes: classes.join(' ')
};
})
];
}
export default function GraphCanvas({ model, graphKey, selectedId, showAll, locate, onSelect, chartRef }) {
const t = useT();
const containerRef = useRef(null);
const layerRef = useRef(null);
const controlsRef = useRef({ model, selectedId, showAll, locate, onSelect });
const [labels, setLabels] = useState([]);
const [cards, setCards] = useState([]);
useEffect(() => {
controlsRef.current = { model, selectedId, showAll, locate, onSelect };
@ -165,20 +109,22 @@ export default function GraphCanvas({ model, graphKey, selectedId, showAll, loca
useEffect(() => {
const container = containerRef.current;
const layer = layerRef.current;
if (!graphKey) {
setLabels([]);
setCards([]);
return undefined;
}
let disposed = false;
let cy;
let frame;
let resize;
let hovered;
let unbindWheel;
let anchorId;
let appliedModel;
let centeredRequest;
let previousSelection;
let previousShowAll = controlsRef.current.showAll;
setLabels([]);
setCards([]);
import('cytoscape').then(({ default: cytoscape }) => {
if (disposed) return;
@ -189,17 +135,14 @@ export default function GraphCanvas({ model, graphKey, selectedId, showAll, loca
boxSelectionEnabled: false,
autounselectify: true
});
const measurement = document.createElement('canvas').getContext('2d');
measurement.font = `12px ${getComputedStyle(container).fontFamily}`;
const widths = new Map();
const measure = title => {
if (!widths.has(title)) widths.set(title, measurement.measureText(title).width);
return widths.get(title);
};
unbindWheel = bindGraphCardWheel(layer, cy);
const selectedNode = () => cy.$id(controlsRef.current.selectedId)[0];
const updateLabels = () => {
const updateCards = () => {
cancelAnimationFrame(frame);
frame = requestAnimationFrame(() => setLabels(visibleLabels(cy, appliedModel, selectedNode(), hovered, measure)));
frame = requestAnimationFrame(() => setCards(visibleGraphCards(cy, {
anchorId,
allowCompact: element => COMPACT_KINDS.has(element.data('kind'))
})));
};
const syncSelection = () => {
const { model, selectedId, showAll, locate } = controlsRef.current;
@ -232,7 +175,7 @@ export default function GraphCanvas({ model, graphKey, selectedId, showAll, loca
}
previousSelection = selected;
previousShowAll = showAll;
updateLabels();
updateCards();
};
const sync = (reset = false) => {
const { model } = controlsRef.current;
@ -242,6 +185,7 @@ export default function GraphCanvas({ model, graphKey, selectedId, showAll, loca
model, new Map(cy.nodes().map(node => [node.id(), node.position()]))
);
appliedModel = model;
anchorId = [...model.nodes.values()].find(node => node.kind === 'goal')?.id;
cy.json({ elements: graphElements(model, positions) });
}
syncSelection();
@ -254,13 +198,12 @@ export default function GraphCanvas({ model, graphKey, selectedId, showAll, loca
resetLayout: () => sync(true)
};
sync();
cy.on('pan zoom position', updateLabels);
cy.on('pan zoom position', updateCards);
cy.on('tap', event => {
if (event.target === cy) controlsRef.current.onSelect('');
else if (event.target.isNode()) controlsRef.current.onSelect(event.target.id());
});
cy.on('mouseover', 'node', event => { hovered = event.target; updateLabels(); });
cy.on('mouseout', 'node', () => { hovered = undefined; updateLabels(); });
let width = cy.width();
let height = cy.height();
@ -281,7 +224,7 @@ export default function GraphCanvas({ model, graphKey, selectedId, showAll, loca
} else if (!selected && (nextWidth < previousWidth || nextHeight < previousHeight)) {
fitGraph(cy);
}
updateLabels();
updateCards();
});
resize.observe(container);
}).catch(error => { if (!disposed) toastError(error, '图谱渲染失败'); });
@ -290,6 +233,7 @@ export default function GraphCanvas({ model, graphKey, selectedId, showAll, loca
disposed = true;
cancelAnimationFrame(frame);
resize?.disconnect();
unbindWheel?.();
cy?.destroy();
chartRef.current = null;
};
@ -298,23 +242,27 @@ export default function GraphCanvas({ model, graphKey, selectedId, showAll, loca
return (
<div className="assessment-graph-viewport" role="group" aria-label="探索图">
<div ref={containerRef} className="assessment-graph-canvas" />
<div className="assessment-graph-labels">
{labels.map(({ id, title, box, leader, selected }) => (
<Fragment key={id}>
{leader ? <span aria-hidden="true" className="assessment-graph-label-leader" style={leader} /> : null}
<button
type="button"
className="assessment-graph-label"
aria-pressed={selected}
style={{ left: box.x, top: box.y, width: box.width }}
<div ref={layerRef} className="graph-node-layer">
{cards.map(card => {
const node = model.nodes.get(card.id);
if (!node) return null;
const title = (node.title || node.id).replace(/\s+/g, ' ').trim() || node.id;
return (
<GraphNodeCard
card={card}
key={node.id}
id={node.id}
title={title}
dir="auto"
onClick={() => onSelect(id)}
>
{title}
</button>
</Fragment>
))}
type={node.kind}
category={kindText(t, node.kind)}
color={GRAPH_KIND_COLOR[node.kind] || '#86909c'}
factKey={node.id}
boundary={node.boundary}
selected={node.id === selectedId}
onSelect={onSelect}
/>
);
})}
</div>
</div>
);

View File

@ -6,7 +6,8 @@ import { useT } from '../../lib/i18n';
import { useInterval, useResource } from '../../components/hooks';
import { SectionCard, ErrorBanner, JsonViewer, KeyValueList, toastError } from '../../components/ui';
import { formatDateTime } from '../../lib/format';
import { kindText, stateText, truncateText } from './labels';
import { GraphNodeIcon } from '../../components/graph-card';
import { GRAPH_KIND_COLOR, kindText, stateText, truncateText } from './labels';
import GraphCanvas from './GraphCanvas';
import GraphBrief from './GraphBrief';
import { prepareGraph } from './graphLayout';
@ -152,7 +153,7 @@ export default function GraphTab({
<div className="assessment-tab">
<SectionCard
title={t('deepAssessments.graph', null, '探索图')}
description="点击节点查看原文与直接关联,放大可查看更多节点名称。"
description="点击节点查看原文与直接关联,放大可查看更多卡片内容。"
extra={headExtra}
>
<ErrorBanner error={resource.error} onRetry={() => refresh()} />
@ -210,30 +211,6 @@ export default function GraphTab({
/>
) : (
<>
<div className="assessment-graph-tools">
<Space wrap>
<Button size="small" aria-label="缩小图谱" disabled={!nodes.length} onClick={() => chartRef.current?.zoom(0.8)}>−</Button>
<Button size="small" aria-label="放大图谱" disabled={!nodes.length} onClick={() => chartRef.current?.zoom(1.25)}>+</Button>
<Button size="small" disabled={!nodes.length} onClick={() => chartRef.current?.fit()}>适应画布</Button>
<Button size="small" disabled={!nodes.length} onClick={() => chartRef.current?.resetLayout()}>重置布局</Button>
</Space>
{canExpand ? (
<Space wrap>
<Text size="small" type="tertiary">
{showAll ? `全部 ${model.edges.length} 条连线` : `主干 ${model.backbone.size} / ${model.edges.length} 条连线`}
{!showAll && collapsedNodes > 0 ? ` · 收起 ${collapsedNodes} 个明细节点` : null}
</Text>
<Button size="small" onClick={() => setShowAll(value => !value)}>{showAll ? '仅看主干' : '显示全部节点与连线'}</Button>
</Space>
) : null}
</div>
{model.legend.length ? (
<div className="assessment-graph-legend" role="group" aria-label="连线图例">
{model.legend.map(({ label, color }) => (
<span key={label}><i aria-hidden="true" style={{ backgroundColor: color }} />{label}</span>
))}
</div>
) : null}
<div className={`assessment-graph-layout${selectedId ? ' with-details' : ''}`}>
<GraphCanvas model={model} graphKey={resource.data?.key} selectedId={selectedId} showAll={showAll} locate={locate} onSelect={selectNode} chartRef={chartRef} />
{selectedId ? (
@ -322,6 +299,39 @@ export default function GraphTab({
</div>
) : null}
</div>
<div className="assessment-graph-tools">
<Space wrap>
<Button size="small" aria-label="缩小图谱" disabled={!nodes.length} onClick={() => chartRef.current?.zoom(0.8)}>−</Button>
<Button size="small" aria-label="放大图谱" disabled={!nodes.length} onClick={() => chartRef.current?.zoom(1.25)}>+</Button>
<Button size="small" disabled={!nodes.length} onClick={() => chartRef.current?.fit()}>适应画布</Button>
<Button size="small" disabled={!nodes.length} onClick={() => chartRef.current?.resetLayout()}>重置布局</Button>
</Space>
{canExpand ? (
<Space wrap>
<Text size="small" type="tertiary">
{showAll ? `全部 ${model.edges.length} 条连线` : `主干 ${model.backbone.size} / ${model.edges.length} 条连线`}
{!showAll && collapsedNodes > 0 ? ` · 收起 ${collapsedNodes} 个明细节点` : null}
</Text>
<Button size="small" onClick={() => setShowAll(value => !value)}>{showAll ? '仅看主干' : '显示全部节点与连线'}</Button>
</Space>
) : null}
</div>
{nodes.length ? (
<div className="assessment-graph-legend" role="group" aria-label="节点图例">
{[...new Set(nodes.map(node => node.kind))].map(kind => (
<span key={kind} style={{ '--graph-node-color': GRAPH_KIND_COLOR[kind] || '#86909c' }}>
<GraphNodeIcon type={kind} />{kindText(t, kind)}
</span>
))}
</div>
) : null}
{model.legend.length ? (
<div className="assessment-graph-legend" role="group" aria-label="连线图例">
{model.legend.map(({ label, color }) => (
<span key={label}><i aria-hidden="true" style={{ backgroundColor: color }} />{label}</span>
))}
</div>
) : null}
</>
)}
</SectionCard>

View File

@ -1,3 +1,5 @@
import { graphParents } from '../../components/graph-parents.js';
const RELATION_STYLES = [
{ label: '规划与依赖', color: '#548df0', relations: ['plans', 'depends_on'] },
{ label: '产出与证据', color: '#24aa94', relations: ['produces', 'supports', 'derives', 'reviews'] },
@ -46,27 +48,17 @@ export function prepareGraph(graph) {
edgeOccurrences.set(key, occurrence + 1);
return { ...edge, id: `edge:${key}:${occurrence}`, color: style.color };
});
const parents = new Map();
const ordered = edges.map(edge => ({ edge, priority: edgePriority(edge, nodes) }));
ordered.sort((a, b) => a.priority - b.priority
|| Number(Boolean(nodes.get(a.edge.source).boundary)) - Number(Boolean(nodes.get(b.edge.source).boundary))
|| a.edge.source.localeCompare(b.edge.source)
|| a.edge.target.localeCompare(b.edge.target)
|| (a.edge.relation || '').localeCompare(b.edge.relation || ''));
const layoutEdges = new Set();
const backbone = new Set();
for (const { edge } of ordered) {
const target = nodes.get(edge.target);
if (target.kind === 'goal' || parents.has(edge.target)) continue;
let ancestor = edge.source;
while (ancestor && ancestor !== edge.target) ancestor = parents.get(ancestor);
if (ancestor === edge.target) continue;
parents.set(edge.target, edge.source);
layoutEdges.add(edge.id);
if (!isDetail(target)) backbone.add(edge.id);
}
const chosen = graphParents(ordered.map(item => item.edge), id => nodes.get(id).kind === 'goal');
const layoutEdges = new Set([...chosen.parentEdges].map(edge => edge.id));
const backbone = new Set([...chosen.parentEdges].filter(edge => !isDetail(nodes.get(edge.target))).map(edge => edge.id));
const upstream = new Map([...nodes.keys()].map(id => [id, new Set()]));
for (const [target, source] of parents) upstream.get(target).add(source);
for (const [target, source] of chosen.parents) upstream.get(target).add(source);
for (const { edge } of ordered) {
if (edge.relation !== 'depends_on' || edge.projection || layoutEdges.has(edge.id)) continue;
if (nodes.get(edge.target).kind === 'goal' || hasUpstream(upstream, edge.source, edge.target)) continue;
@ -94,9 +86,9 @@ export function prepareGraph(graph) {
};
}
export const GRAPH_COLUMN_GAP = 168;
const GRAPH_LEVEL_GAP = 36;
const GRAPH_ROW_GAP = 76;
export const GRAPH_COLUMN_GAP = 266;
const GRAPH_LEVEL_GAP = 27;
const GRAPH_ROW_GAP = 118;
export function graphPositions({ nodes, upstream }) {
const depths = new Map();

View File

@ -284,6 +284,8 @@
margin-bottom: 8px;
}
.assessment-graph-tools { margin-top: 8px; }
.assessment-graph-legend {
display: flex;
flex-wrap: wrap;
@ -327,53 +329,12 @@
overflow: hidden;
border: 1px solid var(--semi-color-border);
border-radius: var(--semi-border-radius-medium);
background: var(--semi-color-bg-2);
background-image: radial-gradient(var(--semi-color-border) 1px, transparent 1px);
background-size: 20px 20px;
background:
radial-gradient(circle, color-mix(in srgb, var(--semi-color-text-2) 17%, transparent) .8px, transparent 1px) 0 0 / 20px 20px,
color-mix(in srgb, var(--semi-color-bg-1) 96%, #537cba);
}
.assessment-graph-canvas,
.assessment-graph-labels {
position: absolute;
inset: 0;
direction: ltr;
}
.assessment-graph-labels {
pointer-events: none;
}
.assessment-graph-label-leader {
position: absolute;
width: 1px;
background: var(--semi-color-text-2);
opacity: 0.55;
}
.assessment-graph-label {
position: absolute;
height: 22px;
padding: 0 6px;
border: 1px solid var(--semi-color-border);
border-radius: var(--semi-border-radius-small);
background: var(--semi-color-bg-1);
color: var(--semi-color-text-0);
font-family: inherit;
font-size: 12px;
line-height: 20px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
pointer-events: auto;
cursor: pointer;
}
.assessment-graph-label:hover,
.assessment-graph-label:focus-visible,
.assessment-graph-label[aria-pressed="true"] {
border-color: var(--semi-color-primary);
color: var(--semi-color-primary);
}
.assessment-graph-canvas { position: absolute; inset: 0; direction: ltr; }
.assessment-node-panel {
height: var(--assessment-graph-height);

View File

@ -1,95 +1,24 @@
import { useEffect, useRef, useState } from 'react';
import {
IconAlertTriangle, IconBolt, IconBranch, IconFile, IconGlobe,
IconHelpCircle, IconKey, IconSearch, IconServer, IconTickCircle
} from '@douyinfe/semi-icons';
import { useEffect, useMemo, useRef, useState } from 'react';
import { bindGraphCardWheel, CARD_HEIGHT, CARD_WIDTH, GraphNodeCard, visibleGraphCards, zoomGraph } from '../../components/graph-card';
import { NODE_COLORS } from './helpers';
const STAGE = { target: 0, infra: 1, auth: 1, finding: 2, chain: 3, exploit: 3, poc: 3, vulnerability: 4 };
const CARD_WIDTH = 216;
const CARD_HEIGHT = 98;
const COLUMN_GAP = 64;
const ROW_GAP = 16;
const NODE_ICONS = {
target: IconGlobe, infra: IconServer, auth: IconKey, finding: IconSearch, chain: IconBranch,
exploit: IconBolt, poc: IconTickCircle, vulnerability: IconAlertTriangle, note: IconFile, missing: IconHelpCircle
};
export function GraphNodeIcon({ type }) {
const Icon = NODE_ICONS[type] || IconFile;
return <span className="project-graph-node-icon" aria-hidden="true"><Icon size="small" /></span>;
}
function graphPositions(nodes, edges, selectedId) {
const adjacent = new Map(nodes.map(node => [node.id, new Set()]));
const outgoing = new Set();
for (const edge of edges) {
adjacent.get(edge.source).add(edge.target);
adjacent.get(edge.target).add(edge.source);
if (edge.source === selectedId) outgoing.add(edge.target);
}
const stageOf = node => STAGE[node.type] ?? 5;
const stage = node => {
if (!selectedId) return stageOf(node);
if (node.id === selectedId) return 1;
return outgoing.has(node.id) ? 2 : 0;
};
const sorted = [...nodes].sort((a, b) => stageOf(a) - stageOf(b) || a.id.localeCompare(b.id));
const byId = new Map(sorted.map(node => [node.id, node]));
const groups = new Map();
const visited = new Set();
// Keep related branches in the same order across the stage columns.
for (const node of sorted) {
if (visited.has(node.id)) continue;
const queue = [node.id];
visited.add(node.id);
for (const id of queue) {
const key = stage(byId.get(id));
if (!groups.has(key)) groups.set(key, []);
groups.get(key).push(id);
for (const neighbor of [...adjacent.get(id)].sort()) {
if (visited.has(neighbor)) continue;
visited.add(neighbor);
queue.push(neighbor);
}
}
}
const positions = new Map();
const rows = Math.max(5, Math.min(32, Math.ceil(Math.sqrt(nodes.length) * 1.25)));
let x = 0;
for (const key of [...groups.keys()].sort((a, b) => a - b)) {
const group = groups.get(key);
const columnSize = Math.ceil(group.length / Math.ceil(group.length / rows));
for (let start = 0; start < group.length; start += columnSize) {
const column = group.slice(start, start + columnSize);
column.forEach((id, index) => positions.set(id, {
x, y: (index - (column.length - 1) / 2) * (CARD_HEIGHT + ROW_GAP)
}));
x += CARD_WIDTH + COLUMN_GAP;
}
x += 24;
}
return positions;
}
import { projectGraphLayout } from './fact-graph-layout';
const STYLE = [
{
selector: 'node',
style: {
shape: 'round-rectangle', width: CARD_WIDTH, height: CARD_HEIGHT,
'background-color': 'data(color)', 'background-opacity': 0.44
'background-color': 'data(color)', 'background-opacity': 0.13,
'border-color': 'data(color)', 'border-opacity': 0.42, 'border-width': 1.2
}
},
{ selector: 'node.current', style: { 'background-opacity': 0.85 } },
{
selector: 'edge',
style: {
width: 1.9, 'line-color': '#748fbb', 'target-arrow-color': '#748fbb',
width: 2.15, 'line-color': '#8197b6', 'target-arrow-color': '#8197b6',
'target-arrow-shape': 'triangle', 'arrow-scale': 0.85,
'curve-style': 'bezier', opacity: 0.59
'curve-style': 'bezier', opacity: 0.73
}
},
{
@ -107,13 +36,14 @@ const STYLE = [
'control-point-weights': '0.30 0.70', 'control-point-distances': 'data(bend)'
}
},
{ selector: 'edge.cross-link', style: { opacity: 0.28 } },
{ selector: 'edge.focused', style: { width: 2.3, opacity: 0.96 } },
{ selector: 'edge[type = "links_vuln"]', style: { 'line-color': '#c96b81', 'target-arrow-color': '#c96b81' } },
{ selector: 'edge[confidence = "tentative"]', style: { 'line-style': 'dashed', 'line-dash-pattern': [5, 4] } }
];
function graphElements(nodes, edges, selectedId) {
const positions = graphPositions(nodes, edges, selectedId);
const { positions, parentEdges } = projectGraphLayout(nodes, edges, selectedId, CARD_WIDTH, CARD_HEIGHT);
const ports = new Map(nodes.map(node => [node.id, new Set()]));
// Preserve Cytoscape's normal separation for parallel links.
const pairKey = edge => JSON.stringify([edge.source, edge.target].sort());
@ -129,6 +59,7 @@ function graphElements(nodes, edges, selectedId) {
const dy = target.y - source.y;
const classes = [];
if (selectedId) classes.push('focused');
else if (!parentEdges.has(edge)) classes.push('cross-link');
if (dx !== 0) {
const forward = dx > 0;
classes.push(forward ? 'forward' : 'backward');
@ -147,7 +78,7 @@ function graphElements(nodes, edges, selectedId) {
elements: [
...nodes.map(node => ({
group: 'nodes',
data: { id: node.id, color: NODE_COLORS[node.type] || NODE_COLORS.missing },
data: { id: node.id, type: node.type || 'note', color: NODE_COLORS[node.type] || NODE_COLORS.missing },
position: positions.get(node.id),
classes: node.id === selectedId ? 'current' : ''
})),
@ -156,68 +87,12 @@ function graphElements(nodes, edges, selectedId) {
};
}
function visibleCards(cy, byId, ports) {
const width = cy.width();
const height = cy.height();
const cardWidth = CARD_WIDTH * cy.zoom();
const cardHeight = CARD_HEIGHT * cy.zoom();
// Below this scale Cytoscape's tiles preserve the overall shape of the graph.
if (cardWidth < 49) return [];
const density = cardHeight >= 68 ? 'detail' : cardHeight >= 36 ? 'standard' : 'compact';
return cy.nodes().map(element => {
const { x, y } = element.renderedPosition();
const id = element.id();
return {
node: byId.get(id), ports: ports.get(id), density,
box: { left: x - cardWidth / 2, top: y - cardHeight / 2, width: cardWidth, height: cardHeight }
};
}).filter(({ box }) => box.left + box.width > 0 && box.left < width
&& box.top + box.height > 0 && box.top < height);
}
function GraphNodeCard({ card, selected, typeLabel, onSelect }) {
const { node, ports, density, box } = card;
const detail = density === 'detail';
const key = node.fact_key || node.id;
const title = (node.summary || (node.label !== '—' && node.label) || key).replace(/\s+/g, ' ').trim() || key;
const category = typeLabel(node.type || 'note');
const textScale = Math.min(Math.max(box.width / CARD_WIDTH, 1), 1.6);
return (
<button
type="button"
className={`project-graph-node project-graph-node--${density}`}
title={title}
aria-label={title}
aria-pressed={selected}
style={{
...box,
'--graph-node-color': NODE_COLORS[node.type] || NODE_COLORS.missing,
'--graph-node-text-scale': textScale
}}
onClick={() => onSelect(node.id)}
>
<span className="project-graph-node-content">
{density !== 'compact' && (
<span className="project-graph-node-kind">
<GraphNodeIcon type={node.type} />
<span>{category}</span>
</span>
)}
<span className="project-graph-node-title" dir="auto">{title}</span>
{detail && box.height >= 84 && title !== key && <span className="project-graph-node-keyline" dir="auto">{key}</span>}
</span>
{detail && [...ports].map(side => (
<span key={side} className={`project-graph-node-port is-${side}`} aria-hidden="true" />
))}
</button>
);
}
export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, chartRef, label, errorText, typeLabel }) {
const canvas = useRef(null);
const nodeLayer = useRef(null);
const [cards, setCards] = useState([]);
const [failed, setFailed] = useState(false);
const nodeMap = useMemo(() => new Map(nodes.map(node => [node.id, node])), [nodes]);
useEffect(() => {
const container = canvas.current;
@ -226,7 +101,7 @@ export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, ch
let cy;
let resize;
let frame;
let onCardWheel;
let unbindWheel;
let fitted = true;
let fitting = false;
setCards([]);
@ -234,7 +109,6 @@ export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, ch
import('cytoscape').then(({ default: cytoscape }) => {
if (disposed) return;
const byId = new Map(nodes.map(node => [node.id, node]));
const { ports, elements } = graphElements(nodes, edges, selectedId);
cy = cytoscape({
container,
@ -246,7 +120,13 @@ export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, ch
});
const place = () => {
cancelAnimationFrame(frame);
frame = requestAnimationFrame(() => setCards(visibleCards(cy, byId, ports)));
frame = requestAnimationFrame(() => {
const visible = visibleGraphCards(cy, {
allowCompact: element => selectedId || nodes.length <= 24
|| ['target', 'chain'].includes(element.data('type'))
});
setCards(visible.map(card => ({ ...card, ports: ports.get(card.id) })));
});
};
const fit = () => {
fitting = true;
@ -256,19 +136,8 @@ export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, ch
fitting = false;
place();
};
const zoom = (factor, renderedPosition = { x: cy.width() / 2, y: cy.height() / 2 }) => {
cy.zoom({ level: cy.zoom() * factor, renderedPosition });
};
chartRef.current = { fit, zoom };
// Card buttons sit above the canvas, so mirror its wheel zoom at the pointer.
onCardWheel = event => {
if (!event.deltaY) return;
event.preventDefault();
const { left, top, height } = container.getBoundingClientRect();
const units = event.deltaMode === 1 ? 33 : event.deltaMode === 2 ? height : 1;
zoom(10 ** (-event.deltaY * units / 1250), { x: event.clientX - left, y: event.clientY - top });
};
layer.addEventListener('wheel', onCardWheel, { passive: false });
chartRef.current = { fit, zoom: factor => zoomGraph(cy, factor) };
unbindWheel = bindGraphCardWheel(layer, cy);
cy.on('viewport', () => {
if (!fitting) fitted = false;
place();
@ -295,7 +164,7 @@ export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, ch
disposed = true;
cancelAnimationFrame(frame);
resize?.disconnect();
if (onCardWheel) layer.removeEventListener('wheel', onCardWheel);
unbindWheel?.();
cy?.destroy();
chartRef.current = null;
};
@ -304,16 +173,28 @@ export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, ch
return (
<div className="project-graph-canvas-wrap" role="group" aria-label={label}>
<div ref={canvas} className="project-graph-canvas" />
<div ref={nodeLayer} className="project-graph-nodes">
{cards.map(card => (
<GraphNodeCard
card={card}
key={card.node.id}
selected={card.node.id === selectedId}
typeLabel={typeLabel}
onSelect={onSelect}
/>
))}
<div ref={nodeLayer} className="graph-node-layer">
{cards.map(card => {
const node = nodeMap.get(card.id);
if (!node) return null;
const key = node.fact_key || node.id;
const title = (node.summary || (node.label !== '—' && node.label) || key).replace(/\s+/g, ' ').trim() || key;
return (
<GraphNodeCard
card={card}
key={node.id}
id={node.id}
title={title}
type={node.type}
category={typeLabel(node.type || 'note')}
color={NODE_COLORS[node.type] || NODE_COLORS.missing}
factKey={key}
ports={card.ports}
selected={node.id === selectedId}
onSelect={onSelect}
/>
);
})}
</div>
{failed && <div className="project-graph-overlay" role="alert">{errorText}</div>}
</div>

View File

@ -0,0 +1,62 @@
import { graphParents } from '../../components/graph-parents.js';
const CATEGORY_ORDER = { target: 0, infra: 1, auth: 1, finding: 2, chain: 3, exploit: 3, poc: 3, vulnerability: 4 };
export function projectGraphLayout(nodes, edges, selectedId, cardWidth, cardHeight) {
const categoryOrder = node => CATEGORY_ORDER[node.type] ?? 5;
const byId = new Map(nodes.map(node => [node.id, node]));
const connected = new Set(edges.flatMap(edge => [edge.source, edge.target]));
const sorted = [...nodes].sort((a, b) => Number(connected.has(b.id)) - Number(connected.has(a.id))
|| categoryOrder(a) - categoryOrder(b) || a.id.localeCompare(b.id));
let levels;
let parentEdges;
if (selectedId) {
const outgoing = new Set(edges.filter(edge => edge.source === selectedId).map(edge => edge.target));
levels = [
sorted.filter(node => node.id !== selectedId && !outgoing.has(node.id)),
[byId.get(selectedId)],
sorted.filter(node => node.id !== selectedId && outgoing.has(node.id))
];
parentEdges = new Set(edges);
} else {
const priority = edge => {
const source = categoryOrder(byId.get(edge.source));
const target = categoryOrder(byId.get(edge.target));
return 4 * Number(source > target) + 2 * Number(source !== 0) + Number(edge.confidence === 'tentative');
};
const ordered = [...edges].sort((a, b) => priority(a) - priority(b)
|| a.source.localeCompare(b.source) || a.target.localeCompare(b.target)
|| (a.type || '').localeCompare(b.type || '') || (a.id || '').localeCompare(b.id || ''));
const layout = graphParents(ordered, id => byId.get(id).type === 'target');
parentEdges = layout.parentEdges;
const children = new Map(nodes.map(node => [node.id, []]));
for (const node of sorted) {
const parent = layout.parents.get(node.id);
if (parent) children.get(parent).push(node);
}
// Parents determine depth and sibling order; the remaining edges keep their stored directions.
levels = [sorted.filter(node => !layout.parents.has(node.id))];
for (const level of levels) {
const next = level.flatMap(node => children.get(node.id));
if (next.length) levels.push(next);
}
}
const positions = new Map();
const maxRows = Math.max(5, Math.min(23, Math.ceil(Math.sqrt(nodes.length) * 1.18)));
let x = 0;
for (const level of levels) {
if (!level.length) continue;
const columnSize = Math.ceil(level.length / Math.ceil(level.length / maxRows));
for (let start = 0; start < level.length; start += columnSize) {
const column = level.slice(start, start + columnSize);
column.forEach((node, index) => positions.set(node.id, {
x, y: (index - (column.length - 1) / 2) * (cardHeight + 23)
}));
x += cardWidth + 62;
}
x += 22;
}
return { positions, parentEdges };
}

View File

@ -6,7 +6,8 @@ import { useT } from '../../lib/i18n';
import { useResource } from '../../components/hooks';
import { ErrorBanner, SectionCard, confirmAction, toastError, toastSuccess } from '../../components/ui';
import { CONFIDENCE_META, NODE_COLORS, NODE_TYPE_LABEL, errorProp, errText } from './helpers';
import FactGraphCanvas, { GraphNodeIcon } from './fact-graph-canvas';
import { GraphNodeIcon } from '../../components/graph-card';
import FactGraphCanvas from './fact-graph-canvas';
const { Text } = Typography;
const EMPTY = [];

View File

@ -217,116 +217,10 @@
overflow: hidden;
}
.project-graph-canvas { width: 100%; height: 100%; }
.project-graph-overlay, .project-graph-nodes { position: absolute; inset: 0; }
.project-graph-overlay { position: absolute; inset: 0; }
.project-graph-overlay, .project-graph-loading { display: grid; place-items: center; }
.project-graph-overlay { padding: 16px; color: var(--semi-color-danger); background: var(--semi-color-bg-1); }
.project-graph-loading { min-height: 180px; }
.project-graph-nodes { pointer-events: none; }
.project-graph-node {
position: absolute;
box-sizing: border-box;
--graph-node-border: color-mix(in srgb, var(--graph-node-color) 24%, var(--semi-color-border));
border: 1px solid var(--graph-node-border);
border-inline-start: 3px solid var(--graph-node-color);
border-radius: 8px;
padding: 0;
background: var(--semi-color-bg-1);
box-shadow: 0 2px 5px rgba(20, 31, 53, .12);
color: var(--semi-color-text-0);
font-family: inherit;
font-size: 14px;
font-weight: 500;
line-height: 1.2;
text-align: start;
cursor: pointer;
pointer-events: auto;
}
.project-graph-node:hover, .project-graph-node:focus-visible, .project-graph-node[aria-pressed="true"] {
border-color: var(--graph-node-color);
background: color-mix(in srgb, var(--graph-node-color) 5%, var(--semi-color-bg-1));
}
.project-graph-node[aria-pressed="true"] {
box-shadow: 0 0 0 3px color-mix(in srgb, var(--graph-node-color) 22%, transparent), 0 3px 9px rgba(20, 31, 53, .13);
}
.project-graph-node-content {
display: flex;
align-items: center;
height: 100%;
min-width: 0;
padding-inline: 5px;
overflow: hidden;
}
.project-graph-node--compact { border-radius: 5px; box-shadow: 0 1px 3px rgba(20, 31, 53, .08); }
.project-graph-node--compact .project-graph-node-content { padding-inline: 4px; }
.project-graph-node--standard .project-graph-node-content {
flex-direction: column;
align-items: flex-start;
justify-content: center;
gap: 2px;
}
.project-graph-node--standard .project-graph-node-icon { width: 13px; height: 13px; }
.project-graph-node-kind {
display: inline-flex;
align-items: center;
gap: 5px;
flex-shrink: 0;
color: var(--semi-color-text-1);
font-size: calc(12px * var(--graph-node-text-scale, 1));
font-weight: 650;
}
.project-graph-node-icon {
display: inline-grid;
place-items: center;
flex: 0 0 auto;
width: 16px;
height: 16px;
border-radius: 5px;
color: color-mix(in srgb, var(--graph-node-color) 75%, var(--semi-color-text-0));
background: color-mix(in srgb, var(--graph-node-color) 13%, var(--semi-color-bg-1));
}
.project-graph-node-title, .project-graph-node-keyline {
display: block;
width: 100%;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.project-graph-node--detail {
font-size: calc(15px * var(--graph-node-text-scale));
background: linear-gradient(150deg, color-mix(in srgb, var(--graph-node-color) 5%, var(--semi-color-bg-1)), var(--semi-color-bg-1) 68%);
}
.project-graph-node--detail .project-graph-node-content {
flex-direction: column;
justify-content: center;
align-items: flex-start;
gap: 3px;
padding: 5px 10px;
}
.project-graph-node--detail .project-graph-node-title {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
white-space: normal;
overflow-wrap: anywhere;
line-height: 1.2;
}
.project-graph-node-keyline {
color: var(--semi-color-text-2);
font: calc(12px * var(--graph-node-text-scale))/1.2 "SFMono-Regular", Consolas, monospace;
}
.project-graph-node-port {
position: absolute;
top: 50%;
width: 6px;
height: 6px;
transform: translateY(-50%);
border: 1px solid var(--semi-color-bg-1);
border-radius: 50%;
background: var(--graph-node-color);
}
.project-graph-node-port.is-left { left: -4px; }
.project-graph-node-port.is-right { right: -4px; }
.project-graph-footer {
display: flex;
flex-wrap: wrap;

View File

@ -0,0 +1,24 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { projectGraphLayout } from '../src/pages/projects/fact-graph-layout.js';
test('project graph follows saved links while retaining targets and handling cycles', () => {
const nodes = [
{ id: 'target', type: 'target' }, { id: 'finding', type: 'finding' }, { id: 'vulnerability', type: 'vulnerability' },
{ id: 'chain-a', type: 'chain' }, { id: 'chain-b', type: 'chain' }, { id: 'isolated', type: 'note' }
];
const edge = (source, target) => ({ id: `${source}-${target}`, source, target });
const discovery = edge('target', 'finding');
const evidence = edge('finding', 'vulnerability');
const feedback = edge('finding', 'target');
const cycle = [edge('chain-a', 'chain-b'), edge('chain-b', 'chain-a')];
const edges = [feedback, cycle[1], evidence, discovery, cycle[0]];
const { positions, parentEdges } = projectGraphLayout(nodes, edges, '', 216, 98);
assert.equal(positions.size, nodes.length);
assert.ok(positions.get('target').x < positions.get('finding').x);
assert.ok(positions.get('finding').x < positions.get('vulnerability').x);
assert.deepEqual(parentEdges, new Set([discovery, evidence, cycle[0]]));
const reversed = projectGraphLayout([...nodes].reverse(), [...edges].reverse(), '', 216, 98);
assert.deepEqual(reversed.positions, positions);
});

View File

@ -49,7 +49,7 @@ test('project graph: dense overview keeps labels legible and search follows the
}));
expect(boxes.length).toBeGreaterThan(4);
expect(boxes.length).toBeLessThanOrEqual(graph.nodes.length);
await expect(canvas.locator('.project-graph-node--compact').first()).toBeVisible();
await expect(canvas.locator('.graph-node--compact').first()).toBeVisible();
for (const [index, box] of boxes.entries()) {
expect(box.fontSize).toBe('14px');
for (const other of boxes.slice(index + 1)) {

View File

@ -1118,7 +1118,7 @@ test('deep assessment: dense graph keeps labels readable and locates a cross-pag
return { left, top, right, bottom, size: getComputedStyle(item).fontSize };
}));
for (const [i, box] of bounds.entries()) {
expect(box.size).toBe('12px');
expect(box.size).toBe('14px');
for (const other of bounds.slice(i + 1)) {
expect(box.left < other.right && box.right > other.left && box.top < other.bottom && box.bottom > other.top).toBe(false);
}
@ -1146,11 +1146,15 @@ test('deep assessment: dense graph keeps labels readable and locates a cross-pag
await expect(selected).toBeVisible();
await expect(graph.getByRole('button', { name: goal.title, exact: true })).toHaveCount(0);
expect(new URLSearchParams(mockApi.calls('GET', `${path}/graph/node`).at(-1).query).get('node_id')).toBe(receipt.id);
const position = await selected.boundingBox();
const positionInCanvas = async () => {
const [card, canvas] = await Promise.all([selected.boundingBox(), graph.boundingBox()]);
return card && canvas ? { x: card.x - canvas.x, y: card.y - canvas.y } : null;
};
const position = await positionInCanvas();
await main.locator('.cs-section-card').getByRole('button', { name: '刷新', exact: true }).click();
await expect.poll(() => mockApi.calls('GET', `${path}/graph`).length).toBe(reads + 1);
await expect.poll(async () => {
const restored = await selected.boundingBox();
const restored = await positionInCanvas();
return restored ? Math.hypot(restored.x - position.x, restored.y - position.y) : Infinity;
}).toBeLessThan(1);
await screenshot(page, testInfo, 'assessment-graph-dense-selection');
@ -1229,6 +1233,7 @@ test('deep assessment: graph polls saved progress without moving the selection o
await page.mouse.down();
await page.mouse.move(bounds.x + bounds.width * 0.65 + 48, bounds.y + 132, { steps: 4 });
await page.mouse.up();
await page.clock.runFor(50);
const canvas = graph.locator('canvas').first();
await canvas.evaluate(element => { element.dataset.viewportCheck = 'kept'; });
const coordinates = async () => {

View File

@ -1 +1 @@
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{Et as r,F as i,H as a,L as o,M as s,W as c,i as l,kt as u,lt as d,ot as f,st as p}from"./semi-CDAktpYA.js";import{F as m,I as h,P as g,a as _,b as v,c as y,d as b,f as x,l as S,m as C,p as w,s as T,u as E,x as D,y as O}from"./index-DVHtb0hB.js";var k=e(t(),1),A=e(n(),1),{Text:j}=c;function M(){let e=g(),{hasPermission:t}=m(),n=t(`agents:write`),c=t(`agents:delete`),[M,N]=(0,k.useState)(``),[P,F]=(0,k.useState)(null),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)(!1),B=_(()=>h.get(`/multi-agent/markdown-agents`),[]),V=(Array.isArray(B.data?.agents)?B.data.agents:[]).filter(e=>{if(!M)return!0;let t=M.toLowerCase();return[e.name,e.id,e.filename,e.description].some(e=>String(e||``).toLowerCase().includes(t))}),H=async e=>{try{F(await h.get(`/multi-agent/markdown-agents/${encodeURIComponent(e.filename)}`))}catch(e){v(e,`读取智能体失败`)}},U=async()=>{let e=await I.form.validate();z(!0);try{await h.post(`/multi-agent/markdown-agents`,{filename:e.filename?.trim()||``,name:e.name.trim(),description:e.description?.trim()||``,instruction:e.instruction,kind:e.kind||`sub`,tools:String(e.tools||``).split(`,`).map(e=>e.trim()).filter(Boolean)}),D(`智能体已保存`),L(null),B.reload()}catch(e){v(e,`保存智能体失败`)}finally{z(!1)}},W=e=>O({title:`删除智能体「${e.name||e.filename}」?`,onOk:async()=>{await h.del(`/multi-agent/markdown-agents/${encodeURIComponent(e.filename)}`),D(`已删除`),B.reload()}});return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(w,{title:e(`agents.title`,null,`智能体管理`),description:B.data?.dir?`目录:${B.data.dir}`:`以 Markdown 文件定义的子智能体与编排器。`,extra:(0,A.jsxs)(i,{children:[(0,A.jsx)(o,{icon:(0,A.jsx)(p,{}),onClick:()=>B.reload(),loading:B.loading,children:`刷新`}),n&&(0,A.jsx)(o,{theme:`solid`,type:`primary`,icon:(0,A.jsx)(d,{}),onClick:()=>L({record:null,form:{}}),children:`新建智能体`})]})}),B.data?.error&&(0,A.jsx)(S,{error:B.data.error}),(0,A.jsxs)(C,{title:`智能体(${V.length})`,children:[(0,A.jsx)(S,{error:B.error,onRetry:()=>B.reload()}),(0,A.jsx)(T,{columns:[{title:`智能体`,dataIndex:`name`,render:(e,t)=>(0,A.jsxs)(i,{vertical:!0,spacing:0,align:`start`,children:[(0,A.jsxs)(i,{children:[(0,A.jsx)(j,{strong:!0,children:e||t.id}),t.is_orchestrator&&(0,A.jsx)(s,{size:`small`,color:`purple`,children:`编排器`})]}),(0,A.jsx)(j,{type:`tertiary`,children:t.filename})]})},{title:`类型`,dataIndex:`kind`,width:110,render:e=>(0,A.jsx)(s,{size:`small`,children:e||`sub`})},{title:`描述`,dataIndex:`description`,render:e=>(0,A.jsx)(j,{type:`tertiary`,ellipsis:{showTooltip:!0},style:{maxWidth:460},children:e||`—`})},{title:`操作`,width:180,render:(e,t)=>(0,A.jsxs)(i,{children:[(0,A.jsx)(o,{size:`small`,theme:`borderless`,onClick:()=>H(t),children:`详情`}),n&&(0,A.jsx)(o,{size:`small`,theme:`borderless`,icon:(0,A.jsx)(r,{}),onClick:()=>L({record:t,form:{}})}),c&&(0,A.jsx)(o,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,A.jsx)(u,{}),onClick:()=>W(t)})]})}],dataSource:V,rowKey:`filename`,loading:B.loading,pagination:{pageSize:20},toolbar:(0,A.jsx)(a,{prefix:(0,A.jsx)(f,{}),value:M,onChange:N,placeholder:`搜索名称或文件名`,style:{width:280}})})]}),(0,A.jsx)(y,{title:I?.record?`编辑智能体`:`新建智能体`,visible:!!I,onCancel:()=>L(null),onOk:U,confirmLoading:R,width:760,children:(0,A.jsxs)(l,{getFormApi:e=>L(t=>t&&{...t,form:e}),initValues:I?.record?{filename:I.record.filename,name:I.record.name,description:I.record.description,kind:I.record.kind||`sub`}:{kind:`sub`},children:[(0,A.jsx)(l.Input,{field:`filename`,label:`文件名(留空自动生成)`,placeholder:`例如 recon.md`}),(0,A.jsx)(l.Input,{field:`name`,label:`名称`,rules:[{required:!0,message:`请输入名称`}]}),(0,A.jsx)(l.Input,{field:`description`,label:`描述`}),(0,A.jsx)(l.Select,{field:`kind`,label:`类型`,optionList:[{value:`sub`,label:`子智能体`},{value:`orchestrator`,label:`编排器`},{value:`plan_execute`,label:`计划执行`}]}),(0,A.jsx)(l.Input,{field:`tools`,label:`工具(逗号分隔)`,placeholder:`toolName, mcp::tool`}),(0,A.jsx)(l.TextArea,{field:`instruction`,label:`指令(Markdown)`,autosize:{minRows:8,maxRows:20}})]})},I?.record?.filename||`new-agent`),(0,A.jsx)(y,{title:P?.name||`智能体详情`,visible:!!P,onCancel:()=>F(null),width:720,children:P&&(0,A.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,A.jsx)(b,{items:[{label:`文件名`,value:P.filename},{label:`ID`,value:P.id},{label:`类型`,value:P.kind},{label:`绑定角色`,value:P.bind_role||`—`},{label:`最大迭代`,value:P.max_iterations??`—`},{label:`工具`,value:Array.isArray(P.tools)&&P.tools.length?P.tools.join(`、`):`—`}]}),(0,A.jsx)(x,{content:P.instruction||P.raw||``}),(0,A.jsx)(E,{value:P.raw||P,title:`原始 Markdown`,collapsed:!0})]})})]})}export{M as default};
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{At as r,Dt as i,F as a,H as o,L as s,M as c,W as l,i as u,lt as d,ot as f,st as p}from"./semi-BxhBcqdj.js";import{F as m,I as h,P as g,a as _,b as v,c as y,d as b,f as x,l as S,m as C,p as w,s as T,u as E,x as D,y as O}from"./index-Du_eCXFg.js";var k=e(t(),1),A=e(n(),1),{Text:j}=l;function M(){let e=g(),{hasPermission:t}=m(),n=t(`agents:write`),l=t(`agents:delete`),[M,N]=(0,k.useState)(``),[P,F]=(0,k.useState)(null),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)(!1),B=_(()=>h.get(`/multi-agent/markdown-agents`),[]),V=(Array.isArray(B.data?.agents)?B.data.agents:[]).filter(e=>{if(!M)return!0;let t=M.toLowerCase();return[e.name,e.id,e.filename,e.description].some(e=>String(e||``).toLowerCase().includes(t))}),H=async e=>{try{F(await h.get(`/multi-agent/markdown-agents/${encodeURIComponent(e.filename)}`))}catch(e){v(e,`读取智能体失败`)}},U=async()=>{let e=await I.form.validate();z(!0);try{await h.post(`/multi-agent/markdown-agents`,{filename:e.filename?.trim()||``,name:e.name.trim(),description:e.description?.trim()||``,instruction:e.instruction,kind:e.kind||`sub`,tools:String(e.tools||``).split(`,`).map(e=>e.trim()).filter(Boolean)}),D(`智能体已保存`),L(null),B.reload()}catch(e){v(e,`保存智能体失败`)}finally{z(!1)}},W=e=>O({title:`删除智能体「${e.name||e.filename}」?`,onOk:async()=>{await h.del(`/multi-agent/markdown-agents/${encodeURIComponent(e.filename)}`),D(`已删除`),B.reload()}});return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(w,{title:e(`agents.title`,null,`智能体管理`),description:B.data?.dir?`目录:${B.data.dir}`:`以 Markdown 文件定义的子智能体与编排器。`,extra:(0,A.jsxs)(a,{children:[(0,A.jsx)(s,{icon:(0,A.jsx)(p,{}),onClick:()=>B.reload(),loading:B.loading,children:`刷新`}),n&&(0,A.jsx)(s,{theme:`solid`,type:`primary`,icon:(0,A.jsx)(d,{}),onClick:()=>L({record:null,form:{}}),children:`新建智能体`})]})}),B.data?.error&&(0,A.jsx)(S,{error:B.data.error}),(0,A.jsxs)(C,{title:`智能体(${V.length})`,children:[(0,A.jsx)(S,{error:B.error,onRetry:()=>B.reload()}),(0,A.jsx)(T,{columns:[{title:`智能体`,dataIndex:`name`,render:(e,t)=>(0,A.jsxs)(a,{vertical:!0,spacing:0,align:`start`,children:[(0,A.jsxs)(a,{children:[(0,A.jsx)(j,{strong:!0,children:e||t.id}),t.is_orchestrator&&(0,A.jsx)(c,{size:`small`,color:`purple`,children:`编排器`})]}),(0,A.jsx)(j,{type:`tertiary`,children:t.filename})]})},{title:`类型`,dataIndex:`kind`,width:110,render:e=>(0,A.jsx)(c,{size:`small`,children:e||`sub`})},{title:`描述`,dataIndex:`description`,render:e=>(0,A.jsx)(j,{type:`tertiary`,ellipsis:{showTooltip:!0},style:{maxWidth:460},children:e||`—`})},{title:`操作`,width:180,render:(e,t)=>(0,A.jsxs)(a,{children:[(0,A.jsx)(s,{size:`small`,theme:`borderless`,onClick:()=>H(t),children:`详情`}),n&&(0,A.jsx)(s,{size:`small`,theme:`borderless`,icon:(0,A.jsx)(i,{}),onClick:()=>L({record:t,form:{}})}),l&&(0,A.jsx)(s,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,A.jsx)(r,{}),onClick:()=>W(t)})]})}],dataSource:V,rowKey:`filename`,loading:B.loading,pagination:{pageSize:20},toolbar:(0,A.jsx)(o,{prefix:(0,A.jsx)(f,{}),value:M,onChange:N,placeholder:`搜索名称或文件名`,style:{width:280}})})]}),(0,A.jsx)(y,{title:I?.record?`编辑智能体`:`新建智能体`,visible:!!I,onCancel:()=>L(null),onOk:U,confirmLoading:R,width:760,children:(0,A.jsxs)(u,{getFormApi:e=>L(t=>t&&{...t,form:e}),initValues:I?.record?{filename:I.record.filename,name:I.record.name,description:I.record.description,kind:I.record.kind||`sub`}:{kind:`sub`},children:[(0,A.jsx)(u.Input,{field:`filename`,label:`文件名(留空自动生成)`,placeholder:`例如 recon.md`}),(0,A.jsx)(u.Input,{field:`name`,label:`名称`,rules:[{required:!0,message:`请输入名称`}]}),(0,A.jsx)(u.Input,{field:`description`,label:`描述`}),(0,A.jsx)(u.Select,{field:`kind`,label:`类型`,optionList:[{value:`sub`,label:`子智能体`},{value:`orchestrator`,label:`编排器`},{value:`plan_execute`,label:`计划执行`}]}),(0,A.jsx)(u.Input,{field:`tools`,label:`工具(逗号分隔)`,placeholder:`toolName, mcp::tool`}),(0,A.jsx)(u.TextArea,{field:`instruction`,label:`指令(Markdown)`,autosize:{minRows:8,maxRows:20}})]})},I?.record?.filename||`new-agent`),(0,A.jsx)(y,{title:P?.name||`智能体详情`,visible:!!P,onCancel:()=>F(null),width:720,children:P&&(0,A.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,A.jsx)(b,{items:[{label:`文件名`,value:P.filename},{label:`ID`,value:P.id},{label:`类型`,value:P.kind},{label:`绑定角色`,value:P.bind_role||`—`},{label:`最大迭代`,value:P.max_iterations??`—`},{label:`工具`,value:Array.isArray(P.tools)&&P.tools.length?P.tools.join(`、`):`—`}]}),(0,A.jsx)(x,{content:P.instruction||P.raw||``}),(0,A.jsx)(E,{value:P.raw||P,title:`原始 Markdown`,collapsed:!0})]})})]})}export{M as default};

View File

@ -1 +1 @@
import{I as e,L as t}from"./index-DVHtb0hB.js";var n=encodeURIComponent,r=t=>e.get(`/c2/listeners`,t),i=t=>e.post(`/c2/listeners`,t),a=(t,r)=>e.put(`/c2/listeners/${n(t)}`,r),o=t=>e.del(`/c2/listeners/${n(t)}`),s=t=>e.post(`/c2/listeners/${n(t)}/start`,{}),c=t=>e.post(`/c2/listeners/${n(t)}/stop`,{}),l=t=>e.get(`/c2/sessions`,t),u=t=>e.get(`/c2/sessions/${n(t)}`),d=t=>e.del(`/c2/sessions/${n(t)}`),f=t=>e.del(`/c2/sessions`,{body:{ids:t}}),p=(t,{sleepSeconds:r,jitterPercent:i})=>e.put(`/c2/sessions/${n(t)}/sleep`,{sleep_seconds:r,jitter_percent:i}),m=(t,r)=>e.put(`/c2/sessions/${n(t)}/note`,{note:r}),h=t=>e.get(`/c2/tasks`,t),g=t=>e.get(`/c2/tasks/${n(t)}`),_=t=>e.post(`/c2/tasks`,t),v=(t,r)=>e.post(`/c2/sessions/${n(t)}/tasks`,r),y=t=>e.post(`/c2/tasks/${n(t)}/cancel`,{}),b=(t,r=30)=>e.get(`/c2/tasks/${n(t)}/wait`,{timeout:r},{timeout:(r+10)*1e3}),x=t=>e.del(`/c2/tasks`,{body:{ids:t}}),S=(e,r)=>t(`/c2/tasks/${n(e)}/result-file`,{filename:r}),C=t=>e.post(`/c2/payloads/oneliner`,t),w=t=>e.post(`/c2/payloads/build`,t),T=(e,r)=>t(`/c2/payloads/${n(e)}/download`,{filename:r}),E=t=>e.get(`/c2/events`,t),D=t=>e.del(`/c2/events`,{body:{ids:t}}),O=()=>e.get(`/c2/profiles`),k=t=>e.post(`/c2/profiles`,t),A=(t,r)=>e.put(`/c2/profiles/${n(t)}`,r),j=t=>e.del(`/c2/profiles/${n(t)}`);async function M(){try{let t=await e.get(`/projects`,{limit:200});return Array.isArray(t?.projects)?t.projects:[]}catch{return[]}}export{b as A,h as C,c as D,s as E,a as O,l as S,p as T,g as _,k as a,O as b,D as c,d,f,u as g,S as h,i,A as k,o as l,T as m,w as n,v as o,x as p,y as r,_ as s,C as t,j as u,E as v,m as w,M as x,r as y};
import{I as e,L as t}from"./index-Du_eCXFg.js";var n=encodeURIComponent,r=t=>e.get(`/c2/listeners`,t),i=t=>e.post(`/c2/listeners`,t),a=(t,r)=>e.put(`/c2/listeners/${n(t)}`,r),o=t=>e.del(`/c2/listeners/${n(t)}`),s=t=>e.post(`/c2/listeners/${n(t)}/start`,{}),c=t=>e.post(`/c2/listeners/${n(t)}/stop`,{}),l=t=>e.get(`/c2/sessions`,t),u=t=>e.get(`/c2/sessions/${n(t)}`),d=t=>e.del(`/c2/sessions/${n(t)}`),f=t=>e.del(`/c2/sessions`,{body:{ids:t}}),p=(t,{sleepSeconds:r,jitterPercent:i})=>e.put(`/c2/sessions/${n(t)}/sleep`,{sleep_seconds:r,jitter_percent:i}),m=(t,r)=>e.put(`/c2/sessions/${n(t)}/note`,{note:r}),h=t=>e.get(`/c2/tasks`,t),g=t=>e.get(`/c2/tasks/${n(t)}`),_=t=>e.post(`/c2/tasks`,t),v=(t,r)=>e.post(`/c2/sessions/${n(t)}/tasks`,r),y=t=>e.post(`/c2/tasks/${n(t)}/cancel`,{}),b=(t,r=30)=>e.get(`/c2/tasks/${n(t)}/wait`,{timeout:r},{timeout:(r+10)*1e3}),x=t=>e.del(`/c2/tasks`,{body:{ids:t}}),S=(e,r)=>t(`/c2/tasks/${n(e)}/result-file`,{filename:r}),C=t=>e.post(`/c2/payloads/oneliner`,t),w=t=>e.post(`/c2/payloads/build`,t),T=(e,r)=>t(`/c2/payloads/${n(e)}/download`,{filename:r}),E=t=>e.get(`/c2/events`,t),D=t=>e.del(`/c2/events`,{body:{ids:t}}),O=()=>e.get(`/c2/profiles`),k=t=>e.post(`/c2/profiles`,t),A=(t,r)=>e.put(`/c2/profiles/${n(t)}`,r),j=t=>e.del(`/c2/profiles/${n(t)}`);async function M(){try{let t=await e.get(`/projects`,{limit:200});return Array.isArray(t?.projects)?t.projects:[]}catch{return[]}}export{b as A,h as C,c as D,s as E,a as O,l as S,p as T,g as _,k as a,O as b,D as c,d,f,u as g,S as h,i,A as k,o as l,T as m,w as n,v as o,x as p,y as r,_ as s,C as t,j as u,E as v,m as w,M as x,r as y};

View File

@ -1 +1 @@
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{F as t,L as n,W as r}from"./semi-CDAktpYA.js";import{E as i,P as a,k as o}from"./index-DVHtb0hB.js";import"./c2-shared-CBMfSMfk.js";import{t as s}from"./react-QV7DAAIx.js";var c=e(s(),1),{Text:l}=r,u=[{value:`http_beacon`,label:`HTTP Beacon`},{value:`https_beacon`,label:`HTTPS Beacon`},{value:`tcp_reverse`,label:`TCP 反向`},{value:`websocket`,label:`WebSocket`}],d={running:`运行中`,stopped:`已停止`,error:`异常`},f={tcp_reverse:[{value:`bash`,label:`Bash (/dev/tcp)`},{value:`nc`,label:`Netcat (-e)`},{value:`nc_mkfifo`,label:`Netcat (mkfifo)`},{value:`python`,label:`Python`},{value:`perl`,label:`Perl`},{value:`powershell`,label:`PowerShell`}],http_beacon:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}],https_beacon:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}],websocket:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}]},p=[{value:`shell`,label:`shell`},{value:`exec`,label:`exec`},{value:`ls`,label:`ls`},{value:`pwd`,label:`pwd`},{value:`cd`,label:`cd`},{value:`ps`,label:`ps`},{value:`kill_proc`,label:`kill_proc`},{value:`download`,label:`download`},{value:`upload`,label:`upload`},{value:`screenshot`,label:`screenshot`},{value:`sleep`,label:`sleep`},{value:`exit`,label:`exit`},{value:`self_delete`,label:`self_delete`},{value:`port_fwd`,label:`port_fwd`},{value:`socks_start`,label:`socks_start`},{value:`socks_stop`,label:`socks_stop`},{value:`load_assembly`,label:`load_assembly`},{value:`persist`,label:`persist`}],m=[{value:`queued`,label:`队列中`},{value:`sent`,label:`已发送`},{value:`running`,label:`执行中`},{value:`success`,label:`成功`},{value:`failed`,label:`失败`},{value:`cancelled`,label:`已取消`}],h=[{value:`info`,label:`信息`},{value:`warn`,label:`警告`},{value:`critical`,label:`严重`}],g=[{value:`listener`,label:`监听器`},{value:`session`,label:`会话`},{value:`task`,label:`任务`},{value:`payload`,label:`Payload`},{value:`opsec`,label:`OPSEC`}],_=[{value:`active`,label:`活跃`},{value:`sleeping`,label:`休眠`},{value:`dead`,label:`离线`},{value:`killed`,label:`已终止`}],v=[{value:`15m`,label:`最近15分钟`,ms:9e5},{value:`1h`,label:`最近1小时`,ms:36e5},{value:`24h`,label:`最近24小时`,ms:864e5},{value:`7d`,label:`最近7天`,ms:6048e5},{value:`all`,label:`全部`,ms:0}];function y(e){let t=v.find(t=>t.value===e);return!t||!t.ms?``:new Date(Date.now()-t.ms).toISOString()}function b({value:e,onChange:r,ns:i=`tasks`}){let o=a();return(0,c.jsxs)(t,{spacing:6,wrap:!0,className:`c2-time-presets`,children:[(0,c.jsx)(l,{type:`tertiary`,size:`small`,children:o(`c2.tasks.timePresets`,null,`快捷`)}),v.map(t=>(0,c.jsx)(n,{size:`small`,theme:t.value===e?`solid`:`borderless`,type:t.value===e?`primary`:`tertiary`,onClick:()=>r(t.value),children:o(`c2.${i}.preset${t.value===`all`?`All`:t.value}`,null,t.label)},t.value))]})}function x(e){let t=Number(e);return!Number.isFinite(t)||t<=0?`—`:t<1e3?`${Math.round(t)}ms`:t<6e4?`${(t/1e3).toFixed(1)}秒`:`${Math.round(t/6e4)}分钟`}function S({value:e}){let t=a();return e?(0,c.jsx)(`span`,{className:`c2-time-text`,title:i(e),children:o(e,t)}):(0,c.jsx)(l,{type:`tertiary`,children:`—`})}var C={running:`green`,stopped:`grey`,error:`red`},w={queued:`amber`,sent:`blue`,running:`blue`,success:`green`,failed:`red`,cancelled:`grey`},T={active:`green`,sleeping:`amber`,dead:`grey`,killed:`red`},E={info:`blue`,warn:`amber`,critical:`red`};export{d as a,T as c,m as d,p as f,y as g,x as h,C as i,_ as l,S as m,E as n,u as o,b as p,h as r,f as s,g as t,w as u};
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{F as t,L as n,W as r}from"./semi-BxhBcqdj.js";import{E as i,P as a,k as o}from"./index-Du_eCXFg.js";import"./c2-shared-BvpuXQ_S.js";import{t as s}from"./react-QV7DAAIx.js";var c=e(s(),1),{Text:l}=r,u=[{value:`http_beacon`,label:`HTTP Beacon`},{value:`https_beacon`,label:`HTTPS Beacon`},{value:`tcp_reverse`,label:`TCP 反向`},{value:`websocket`,label:`WebSocket`}],d={running:`运行中`,stopped:`已停止`,error:`异常`},f={tcp_reverse:[{value:`bash`,label:`Bash (/dev/tcp)`},{value:`nc`,label:`Netcat (-e)`},{value:`nc_mkfifo`,label:`Netcat (mkfifo)`},{value:`python`,label:`Python`},{value:`perl`,label:`Perl`},{value:`powershell`,label:`PowerShell`}],http_beacon:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}],https_beacon:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}],websocket:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}]},p=[{value:`shell`,label:`shell`},{value:`exec`,label:`exec`},{value:`ls`,label:`ls`},{value:`pwd`,label:`pwd`},{value:`cd`,label:`cd`},{value:`ps`,label:`ps`},{value:`kill_proc`,label:`kill_proc`},{value:`download`,label:`download`},{value:`upload`,label:`upload`},{value:`screenshot`,label:`screenshot`},{value:`sleep`,label:`sleep`},{value:`exit`,label:`exit`},{value:`self_delete`,label:`self_delete`},{value:`port_fwd`,label:`port_fwd`},{value:`socks_start`,label:`socks_start`},{value:`socks_stop`,label:`socks_stop`},{value:`load_assembly`,label:`load_assembly`},{value:`persist`,label:`persist`}],m=[{value:`queued`,label:`队列中`},{value:`sent`,label:`已发送`},{value:`running`,label:`执行中`},{value:`success`,label:`成功`},{value:`failed`,label:`失败`},{value:`cancelled`,label:`已取消`}],h=[{value:`info`,label:`信息`},{value:`warn`,label:`警告`},{value:`critical`,label:`严重`}],g=[{value:`listener`,label:`监听器`},{value:`session`,label:`会话`},{value:`task`,label:`任务`},{value:`payload`,label:`Payload`},{value:`opsec`,label:`OPSEC`}],_=[{value:`active`,label:`活跃`},{value:`sleeping`,label:`休眠`},{value:`dead`,label:`离线`},{value:`killed`,label:`已终止`}],v=[{value:`15m`,label:`最近15分钟`,ms:9e5},{value:`1h`,label:`最近1小时`,ms:36e5},{value:`24h`,label:`最近24小时`,ms:864e5},{value:`7d`,label:`最近7天`,ms:6048e5},{value:`all`,label:`全部`,ms:0}];function y(e){let t=v.find(t=>t.value===e);return!t||!t.ms?``:new Date(Date.now()-t.ms).toISOString()}function b({value:e,onChange:r,ns:i=`tasks`}){let o=a();return(0,c.jsxs)(t,{spacing:6,wrap:!0,className:`c2-time-presets`,children:[(0,c.jsx)(l,{type:`tertiary`,size:`small`,children:o(`c2.tasks.timePresets`,null,`快捷`)}),v.map(t=>(0,c.jsx)(n,{size:`small`,theme:t.value===e?`solid`:`borderless`,type:t.value===e?`primary`:`tertiary`,onClick:()=>r(t.value),children:o(`c2.${i}.preset${t.value===`all`?`All`:t.value}`,null,t.label)},t.value))]})}function x(e){let t=Number(e);return!Number.isFinite(t)||t<=0?`—`:t<1e3?`${Math.round(t)}ms`:t<6e4?`${(t/1e3).toFixed(1)}秒`:`${Math.round(t/6e4)}分钟`}function S({value:e}){let t=a();return e?(0,c.jsx)(`span`,{className:`c2-time-text`,title:i(e),children:o(e,t)}):(0,c.jsx)(l,{type:`tertiary`,children:`—`})}var C={running:`green`,stopped:`grey`,error:`red`},w={queued:`amber`,sent:`blue`,running:`blue`,success:`green`,failed:`red`,cancelled:`grey`},T={active:`green`,sleeping:`amber`,dead:`grey`,killed:`red`},E={info:`blue`,warn:`amber`,critical:`red`};export{d as a,T as c,m as d,p as f,y as g,x as h,C as i,_ as l,S as m,E as n,u as o,b as p,h as r,f as s,g as t,w as u};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{t}from"./react-QV7DAAIx.js";import{Ht as n,St as r,Tt as i,Wt as a,X as o,Xt as s,_t as c,ht as l,it as u,ot as d,wt as f,xt as p}from"./semi-BxhBcqdj.js";var m=e(t(),1),h={target:r,infra:u,auth:c,finding:d,chain:n,exploit:a,poc:o,vulnerability:s,missing:p,goal:f,step:n,fact:i,receipt:o,observation:d,memory:l,digest:i,guidance:a};function g({type:e}){let t=h[e]||i;return(0,m.jsx)(`span`,{className:`graph-node-icon`,"aria-hidden":`true`,children:(0,m.jsx)(t,{size:`small`})})}function _({id:e,title:t,type:n,category:r,color:i,factKey:a,boundary:o,ports:s=[],selected:c,card:l,onSelect:u}){let{density:d,box:f}=l,p=d===`detail`,h=Math.min(Math.max(f.width/216,1),1.6);return(0,m.jsxs)(`button`,{type:`button`,className:`graph-node graph-node--${d}`,title:t,"aria-label":t,"aria-pressed":c,"data-root":n===`goal`||n===`target`||void 0,"data-boundary":o||void 0,"data-wrap":d===`standard`&&f.height>=50||void 0,style:{...f,"--graph-node-color":i,"--graph-node-text-scale":h},onClick:()=>u(e),children:[(0,m.jsxs)(`span`,{className:`graph-node-content`,children:[d!==`compact`&&(0,m.jsxs)(`span`,{className:`graph-node-kind`,children:[(0,m.jsx)(g,{type:n}),(0,m.jsx)(`span`,{children:r})]}),(0,m.jsx)(`span`,{className:`graph-node-title`,dir:`auto`,children:t}),p&&f.height>=84&&a&&t!==a&&(0,m.jsx)(`span`,{className:`graph-node-keyline`,dir:`auto`,children:a})]}),p&&[...s].map(e=>(0,m.jsx)(`span`,{className:`graph-node-port is-${e}`,"aria-hidden":`true`},e))]})}function v(e,{anchorId:t,allowCompact:n=()=>!0}={}){let r=e.width(),i=e.height(),a=216*e.zoom(),o=98*e.zoom(),s=o>=68?`detail`:o>=36?`standard`:`compact`,c=[];for(let l of e.nodes(`:visible`)){let e=l.id();if(l.hasClass(`dim`)||s===`compact`&&e!==t&&(a<49||!n(l)))continue;let{x:u,y:d}=l.renderedPosition(),f=u-a/2,p=d-o/2;if(f+a<=0||f>=r||p+o<=0||p>=i)continue;let m={left:f,top:p,width:a,height:o};e===t&&a<49&&(m={left:Math.max(3,f),top:d-13,width:Math.min(108,r-Math.max(3,f)),height:26}),c.push({id:e,density:s,box:m})}return c}function y(e,t,n={x:e.width()/2,y:e.height()/2}){e.zoom({level:e.zoom()*t,renderedPosition:n})}function b(e,t){let n=n=>{if(!n.deltaY)return;n.preventDefault();let{left:r,top:i,height:a}=e.getBoundingClientRect(),o=n.deltaMode===1?33:n.deltaMode===2?a:1;y(t,10**(-n.deltaY*o/1250),{x:n.clientX-r,y:n.clientY-i})};return e.addEventListener(`wheel`,n,{passive:!1}),()=>e.removeEventListener(`wheel`,n)}function x(e,t){let n=new Map,r=new Set;for(let i of e){if(t(i.target)||n.has(i.target))continue;let e=i.source;for(;e&&e!==i.target;)e=n.get(e);e!==i.target&&(n.set(i.target,i.source),r.add(i))}return{parents:n,parentEdges:r}}export{v as a,b as i,_ as n,y as o,g as r,x as t};

View File

@ -0,0 +1 @@
.graph-node-layer{pointer-events:none;direction:ltr;position:absolute;top:0;bottom:0;left:0;right:0}.graph-node{box-sizing:border-box;border:1px solid var(--semi-color-border);background:var(--semi-color-bg-1);color:var(--semi-color-text-0);text-align:start;cursor:pointer;pointer-events:auto;border-radius:8px;padding:0;font-family:inherit;font-size:14px;font-weight:500;line-height:1.2;position:absolute;box-shadow:0 1px 3px #141f351a}.graph-node:hover,.graph-node[aria-pressed=true]{border-color:var(--graph-node-color);background:color-mix(in srgb, var(--graph-node-color) 5%, var(--semi-color-bg-1))}.graph-node:focus-visible{border-color:var(--graph-node-color);background:color-mix(in srgb, var(--graph-node-color) 5%, var(--semi-color-bg-1))}.graph-node[aria-pressed=true]{box-shadow:0 0 0 2px color-mix(in srgb, var(--graph-node-color) 19%, transparent), 0 3px 9px #141f3521}.graph-node-content{align-items:center;min-width:0;height:100%;padding-inline-start:5px;padding-inline-end:5px;display:flex;overflow:hidden}.graph-node--compact{border-radius:5px;box-shadow:0 1px 3px #141f3514}.graph-node--compact .graph-node-content{gap:4px}.graph-node--compact .graph-node-content:before{content:"";background:var(--graph-node-color);border-radius:2px;flex:0 0 3px;height:11px}.graph-node--standard .graph-node-content{flex-direction:column;justify-content:center;align-items:flex-start;gap:2px}.graph-node--standard .graph-node-icon{width:13px;height:13px}.graph-node-kind{color:var(--semi-color-text-1);font-size:calc(12px * var(--graph-node-text-scale,1));flex-shrink:0;align-items:center;gap:5px;font-weight:650;display:inline-flex}.graph-node-icon{width:16px;height:16px;color:color-mix(in srgb, var(--graph-node-color) 75%, var(--semi-color-text-0));background:color-mix(in srgb, var(--graph-node-color) 13%, var(--semi-color-bg-1));border-radius:5px;flex:none;place-items:center;display:inline-grid}.graph-node-title,.graph-node-keyline{text-overflow:ellipsis;white-space:nowrap;width:100%;min-width:0;display:block;overflow:hidden}.graph-node--detail{font-size:calc(15px * var(--graph-node-text-scale))}.graph-node:where([data-root=true]){border-color:color-mix(in srgb, var(--graph-node-color) 31%, var(--semi-color-border));background:color-mix(in srgb, var(--graph-node-color) 5%, var(--semi-color-bg-1))}.graph-node[data-boundary=true]{border-style:dashed}.graph-node--detail .graph-node-content{flex-direction:column;justify-content:center;align-items:flex-start;gap:3px;padding:5px 10px}.graph-node--standard .graph-node-title{line-height:16px}.graph-node--detail .graph-node-title,.graph-node--standard[data-wrap=true] .graph-node-title{-webkit-line-clamp:2;white-space:normal;overflow-wrap:anywhere;-webkit-box-orient:vertical;display:-webkit-box}.graph-node-keyline{color:var(--semi-color-text-2);font:calc(12px * var(--graph-node-text-scale))/1.2 "SFMono-Regular", Consolas, monospace}.graph-node-port{border:1px solid var(--semi-color-bg-1);background:var(--graph-node-color);border-radius:50%;width:6px;height:6px;position:absolute;top:50%;transform:translateY(-50%)}.graph-node-port.is-left{left:-4px}.graph-node-port.is-right{right:-4px}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{F as r,H as i,L as a,M as o,W as s,kt as c,ot as l,st as u}from"./semi-CDAktpYA.js";import{E as d,F as f,I as p,P as m,a as h,c as g,d as _,l as v,m as y,p as b,s as x,u as S,x as C,y as w}from"./index-DVHtb0hB.js";var T=e(t(),1),E=e(n(),1),{Text:D}=s;function O(){let e=m(),{hasPermission:t}=f(),n=t(`knowledge:delete`),[s,O]=(0,T.useState)(``),[k,A]=(0,T.useState)(50),[j,M]=(0,T.useState)(null),N=h(()=>p.get(`/knowledge/retrieval-logs`,{conversationId:s||void 0,limit:k}),[s,k]),P=Array.isArray(N.data?.logs)?N.data.logs:[],F=e=>w({title:`删除该检索日志?`,content:e.query||e.id,onOk:async()=>{await p.del(`/knowledge/retrieval-logs/${encodeURIComponent(e.id)}`),C(`已删除`),N.reload()}});return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(b,{title:e(`knowledge.retrievalLogsTitle`,null,`检索历史`),description:`记录智能体每次知识库检索的语句、命中项与会话,用于回溯回答依据。`,extra:(0,E.jsx)(a,{icon:(0,E.jsx)(u,{}),onClick:()=>N.reload(),loading:N.loading,children:`刷新`})}),(0,E.jsxs)(y,{title:`检索记录(${P.length})`,children:[(0,E.jsx)(v,{error:N.error,onRetry:()=>N.reload()}),(0,E.jsx)(x,{columns:[{title:`检索语句`,dataIndex:`query`,render:(e,t)=>(0,E.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>M(t),style:{background:`none`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`,color:`var(--semi-color-primary)`},children:e||`—`})},{title:`风险类型`,dataIndex:`riskType`,width:140,render:e=>e?(0,E.jsx)(o,{size:`small`,children:e}):`—`},{title:`命中知识项`,dataIndex:`retrievedItems`,width:120,render:e=>(0,E.jsxs)(D,{type:`tertiary`,children:[Array.isArray(e)?e.length:0,` 条`]})},{title:`会话`,dataIndex:`conversationId`,width:200,render:e=>(0,E.jsx)(D,{type:`tertiary`,ellipsis:{showTooltip:!0},children:e||`—`})},{title:`时间`,dataIndex:`createdAt`,width:180,render:e=>d(e)},{title:`操作`,width:110,render:(e,t)=>(0,E.jsxs)(r,{children:[(0,E.jsx)(a,{size:`small`,theme:`borderless`,onClick:()=>M(t),children:`详情`}),n&&(0,E.jsx)(a,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,E.jsx)(c,{}),onClick:()=>F(t)})]})}],dataSource:P,rowKey:`id`,loading:N.loading,pagination:!1,toolbar:(0,E.jsxs)(r,{children:[(0,E.jsx)(i,{prefix:(0,E.jsx)(l,{}),placeholder:`按会话 ID 过滤`,value:s,onChange:O,style:{width:260}}),(0,E.jsx)(i,{placeholder:`条数`,value:String(k),onChange:e=>A(Math.min(Math.max(Number(e)||50,1),500)),style:{width:100},suffix:(0,E.jsx)(D,{type:`tertiary`,children:`条`})})]})})]}),(0,E.jsx)(g,{title:`检索日志详情`,visible:!!j,onCancel:()=>M(null),width:560,children:j&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,E.jsx)(_,{items:[{label:`日志 ID`,value:j.id},{label:`检索语句`,value:j.query},{label:`风险类型`,value:j.riskType||`—`},{label:`会话 ID`,value:j.conversationId||`—`},{label:`消息 ID`,value:j.messageId||`—`},{label:`时间`,value:d(j.createdAt)}]}),(0,E.jsx)(S,{value:j.retrievedItems||[],title:`命中知识项`})]})})]})}export{O as default};
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{At as r,F as i,H as a,L as o,M as s,W as c,ot as l,st as u}from"./semi-BxhBcqdj.js";import{E as d,F as f,I as p,P as m,a as h,c as g,d as _,l as v,m as y,p as b,s as x,u as S,x as C,y as w}from"./index-Du_eCXFg.js";var T=e(t(),1),E=e(n(),1),{Text:D}=c;function O(){let e=m(),{hasPermission:t}=f(),n=t(`knowledge:delete`),[c,O]=(0,T.useState)(``),[k,A]=(0,T.useState)(50),[j,M]=(0,T.useState)(null),N=h(()=>p.get(`/knowledge/retrieval-logs`,{conversationId:c||void 0,limit:k}),[c,k]),P=Array.isArray(N.data?.logs)?N.data.logs:[],F=e=>w({title:`删除该检索日志?`,content:e.query||e.id,onOk:async()=>{await p.del(`/knowledge/retrieval-logs/${encodeURIComponent(e.id)}`),C(`已删除`),N.reload()}});return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(b,{title:e(`knowledge.retrievalLogsTitle`,null,`检索历史`),description:`记录智能体每次知识库检索的语句、命中项与会话,用于回溯回答依据。`,extra:(0,E.jsx)(o,{icon:(0,E.jsx)(u,{}),onClick:()=>N.reload(),loading:N.loading,children:`刷新`})}),(0,E.jsxs)(y,{title:`检索记录(${P.length})`,children:[(0,E.jsx)(v,{error:N.error,onRetry:()=>N.reload()}),(0,E.jsx)(x,{columns:[{title:`检索语句`,dataIndex:`query`,render:(e,t)=>(0,E.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>M(t),style:{background:`none`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`,color:`var(--semi-color-primary)`},children:e||`—`})},{title:`风险类型`,dataIndex:`riskType`,width:140,render:e=>e?(0,E.jsx)(s,{size:`small`,children:e}):`—`},{title:`命中知识项`,dataIndex:`retrievedItems`,width:120,render:e=>(0,E.jsxs)(D,{type:`tertiary`,children:[Array.isArray(e)?e.length:0,` 条`]})},{title:`会话`,dataIndex:`conversationId`,width:200,render:e=>(0,E.jsx)(D,{type:`tertiary`,ellipsis:{showTooltip:!0},children:e||`—`})},{title:`时间`,dataIndex:`createdAt`,width:180,render:e=>d(e)},{title:`操作`,width:110,render:(e,t)=>(0,E.jsxs)(i,{children:[(0,E.jsx)(o,{size:`small`,theme:`borderless`,onClick:()=>M(t),children:`详情`}),n&&(0,E.jsx)(o,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,E.jsx)(r,{}),onClick:()=>F(t)})]})}],dataSource:P,rowKey:`id`,loading:N.loading,pagination:!1,toolbar:(0,E.jsxs)(i,{children:[(0,E.jsx)(a,{prefix:(0,E.jsx)(l,{}),placeholder:`按会话 ID 过滤`,value:c,onChange:O,style:{width:260}}),(0,E.jsx)(a,{placeholder:`条数`,value:String(k),onChange:e=>A(Math.min(Math.max(Number(e)||50,1),500)),style:{width:100},suffix:(0,E.jsx)(D,{type:`tertiary`,children:`条`})})]})})]}),(0,E.jsx)(g,{title:`检索日志详情`,visible:!!j,onCancel:()=>M(null),width:560,children:j&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,E.jsx)(_,{items:[{label:`日志 ID`,value:j.id},{label:`检索语句`,value:j.query},{label:`风险类型`,value:j.riskType||`—`},{label:`会话 ID`,value:j.conversationId||`—`},{label:`消息 ID`,value:j.messageId||`—`},{label:`时间`,value:d(j.createdAt)}]}),(0,E.jsx)(S,{value:j.retrievedItems||[],title:`命中知识项`})]})})]})}export{O as default};

View File

@ -1 +1 @@
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{W as r,i}from"./semi-CDAktpYA.js";import{I as a,P as o,c as s,l as c,x as l}from"./index-DVHtb0hB.js";var u=e(t(),1),d=e(n(),1),{Text:f}=r,p=120,m=4e3;function h({visible:e,project:t,onCancel:n,onSaved:r}){let h=o(),g=(0,u.useId)(),[_,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(null),x=!!t?.id;return(0,u.useEffect)(()=>{b(null)},[e,t?.id]),(0,d.jsxs)(s,{visible:e,width:560,closable:!_,closeOnEsc:!_,onCancel:n,cancelButtonProps:{disabled:_},title:x?h(`projects.modalEditTitle`,null,`编辑项目`):h(`projects.modalNewTitle`,null,`新建项目`),formId:g,okText:x?h(`projects.saveChanges`,null,`保存修改`):h(`projects.createProject`,null,`创建项目`),confirmLoading:_,children:[(0,d.jsx)(f,{type:`tertiary`,size:`small`,children:x?h(`projects.modalEditSubtitle`,null,`修改项目名称与描述`):h(`projects.modalNewSubtitle`,null,`创建后可绑定对话,跨会话共享事实黑板`)}),(0,d.jsxs)(i,{id:g,onSubmit:async e=>{if(!_){v(!0),b(null);try{let n={name:e.name.trim(),description:(e.description||``).slice(0,m)},i=x?await a.put(`/projects/${t.id}`,n):await a.post(`/projects`,n);l(x?h(`projects.saved`,null,`已保存`):h(`projects.createProject`,null,`创建项目`)),r?.(i)}catch(e){b(e)}finally{v(!1)}}},initValues:{name:t?.name||``,description:t?.description||``},children:[(0,d.jsx)(i.Input,{id:`${g}-name`,field:`name`,maxLength:p,label:h(`projects.projectName`,null,`项目名称`),placeholder:h(`projects.projectNamePlaceholder`,null,`例如:某客户 Web 渗透`),rules:[{required:!0,whitespace:!0,message:h(`projects.enterProjectName`,null,`请输入项目名称`)}]}),(0,d.jsx)(i.TextArea,{id:`${g}-description`,field:`description`,rows:4,maxCount:m,label:h(`projects.projectDescription`,null,`项目描述`),placeholder:h(`projects.projectDescriptionPlaceholder`,null,`客户/任务备注、协作说明…`),extraText:h(`projects.descriptionLengthHint`,null,`仅供团队成员查阅,Agent 不会读取;需让 Agent 知晓的内容请写入事实黑板`)}),(0,d.jsx)(c,{error:y})]},`${e}-${t?.id||`new`}`)]})}export{h as t};
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{W as r,i}from"./semi-BxhBcqdj.js";import{I as a,P as o,c as s,l as c,x as l}from"./index-Du_eCXFg.js";var u=e(t(),1),d=e(n(),1),{Text:f}=r,p=120,m=4e3;function h({visible:e,project:t,onCancel:n,onSaved:r}){let h=o(),g=(0,u.useId)(),[_,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(null),x=!!t?.id;return(0,u.useEffect)(()=>{b(null)},[e,t?.id]),(0,d.jsxs)(s,{visible:e,width:560,closable:!_,closeOnEsc:!_,onCancel:n,cancelButtonProps:{disabled:_},title:x?h(`projects.modalEditTitle`,null,`编辑项目`):h(`projects.modalNewTitle`,null,`新建项目`),formId:g,okText:x?h(`projects.saveChanges`,null,`保存修改`):h(`projects.createProject`,null,`创建项目`),confirmLoading:_,children:[(0,d.jsx)(f,{type:`tertiary`,size:`small`,children:x?h(`projects.modalEditSubtitle`,null,`修改项目名称与描述`):h(`projects.modalNewSubtitle`,null,`创建后可绑定对话,跨会话共享事实黑板`)}),(0,d.jsxs)(i,{id:g,onSubmit:async e=>{if(!_){v(!0),b(null);try{let n={name:e.name.trim(),description:(e.description||``).slice(0,m)},i=x?await a.put(`/projects/${t.id}`,n):await a.post(`/projects`,n);l(x?h(`projects.saved`,null,`已保存`):h(`projects.createProject`,null,`创建项目`)),r?.(i)}catch(e){b(e)}finally{v(!1)}}},initValues:{name:t?.name||``,description:t?.description||``},children:[(0,d.jsx)(i.Input,{id:`${g}-name`,field:`name`,maxLength:p,label:h(`projects.projectName`,null,`项目名称`),placeholder:h(`projects.projectNamePlaceholder`,null,`例如:某客户 Web 渗透`),rules:[{required:!0,whitespace:!0,message:h(`projects.enterProjectName`,null,`请输入项目名称`)}]}),(0,d.jsx)(i.TextArea,{id:`${g}-description`,field:`description`,rows:4,maxCount:m,label:h(`projects.projectDescription`,null,`项目描述`),placeholder:h(`projects.projectDescriptionPlaceholder`,null,`客户/任务备注、协作说明…`),extraText:h(`projects.descriptionLengthHint`,null,`仅供团队成员查阅,Agent 不会读取;需让 Agent 知晓的内容请写入事实黑板`)}),(0,d.jsx)(c,{error:y})]},`${e}-${t?.id||`new`}`)]})}export{h as t};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{Et as r,F as i,H as a,L as o,M as s,W as c,i as l,kt as u,lt as d,ot as f,st as p}from"./semi-CDAktpYA.js";import{F as m,I as h,P as g,a as _,b as v,c as y,l as b,m as x,p as S,s as C,x as w,y as T}from"./index-DVHtb0hB.js";var E=e(t(),1),D=e(n(),1),{Text:O}=c;function k(){let e=g(),{hasPermission:t}=m(),n=t(`roles:write`),c=t(`roles:delete`),[k,A]=(0,E.useState)(``),[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)(!1),F=_(()=>h.get(`/roles`),[]),I=(Array.isArray(F.data?.roles)?F.data.roles:[]).filter(e=>{if(!k)return!0;let t=k.toLowerCase();return[e.name,e.description].some(e=>String(e||``).toLowerCase().includes(t))}),L=async()=>{let e=await j.form.validate();P(!0);try{let t={name:e.name.trim(),description:e.description?.trim()||``,user_prompt:e.user_prompt||``,tools:String(e.tools||``).split(`,`).map(e=>e.trim()).filter(Boolean),enabled:e.enabled!==!1},n=j.role?.name;n&&n!==t.name?(await h.post(`/roles`,t),await h.del(`/roles/${encodeURIComponent(n)}`)):n?await h.put(`/roles/${encodeURIComponent(n)}`,t):await h.post(`/roles`,t),w(`角色已保存`),M(null),F.reload()}catch(e){v(e,`保存角色失败`)}finally{P(!1)}},R=e=>T({title:`删除角色「${e.name}」?`,content:`已绑定该角色的对话将失去对应提示词与工具配置。`,onOk:async()=>{await h.del(`/roles/${encodeURIComponent(e.name)}`),w(`已删除`),F.reload()}});return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(S,{title:e(`roles.title`,null,`角色管理`),description:`角色定义对话的系统提示词、可用工具与绑定工作流。`,extra:(0,D.jsxs)(i,{children:[(0,D.jsx)(o,{icon:(0,D.jsx)(p,{}),onClick:()=>F.reload(),loading:F.loading,children:`刷新`}),n&&(0,D.jsx)(o,{theme:`solid`,type:`primary`,icon:(0,D.jsx)(d,{}),onClick:()=>M({role:null,form:{}}),children:`新建角色`})]})}),(0,D.jsxs)(x,{title:`角色(${I.length})`,children:[(0,D.jsx)(b,{error:F.error,onRetry:()=>F.reload()}),(0,D.jsx)(C,{columns:[{title:`角色`,dataIndex:`name`,render:(e,t)=>(0,D.jsxs)(i,{vertical:!0,spacing:0,align:`start`,children:[(0,D.jsxs)(i,{children:[(0,D.jsx)(O,{strong:!0,children:e}),t.enabled===!1&&(0,D.jsx)(s,{size:`small`,color:`grey`,children:`已停用`})]}),(0,D.jsx)(O,{type:`tertiary`,ellipsis:{showTooltip:!0},style:{maxWidth:460},children:t.description||`—`})]})},{title:`工具`,dataIndex:`tools`,width:260,render:e=>Array.isArray(e)&&e.length?(0,D.jsxs)(i,{wrap:!0,spacing:4,children:[e.slice(0,4).map(e=>(0,D.jsx)(s,{size:`small`,children:e},e)),e.length>4&&(0,D.jsxs)(O,{type:`tertiary`,children:[`+`,e.length-4]})]}):(0,D.jsx)(O,{type:`tertiary`,children:`未绑定`})},{title:`工作流`,dataIndex:`workflow_id`,width:160,render:e=>e||`—`},{title:`操作`,width:150,render:(e,t)=>(0,D.jsxs)(i,{children:[n&&(0,D.jsx)(o,{size:`small`,theme:`borderless`,icon:(0,D.jsx)(r,{}),onClick:()=>M({role:t,form:{}}),children:`编辑`}),c&&(0,D.jsx)(o,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,D.jsx)(u,{}),onClick:()=>R(t)})]})}],dataSource:I,rowKey:`name`,loading:F.loading,pagination:{pageSize:20},toolbar:(0,D.jsx)(a,{prefix:(0,D.jsx)(f,{}),value:k,onChange:A,placeholder:`搜索角色名称`,style:{width:260}})})]}),(0,D.jsx)(y,{title:j?.role?`编辑角色`:`新建角色`,visible:!!j,onCancel:()=>M(null),onOk:L,confirmLoading:N,width:760,children:(0,D.jsxs)(l,{getFormApi:e=>M(t=>t&&{...t,form:e}),initValues:j?.role?{name:j.role.name,description:j.role.description,user_prompt:j.role.user_prompt,tools:Array.isArray(j.role.tools)?j.role.tools.join(`, `):``,enabled:j.role.enabled!==!1}:{enabled:!0},children:[(0,D.jsx)(l.Input,{field:`name`,label:`角色名称`,rules:[{required:!0,message:`请输入角色名称`}]}),(0,D.jsx)(l.Input,{field:`description`,label:`描述`}),(0,D.jsx)(l.Input,{field:`tools`,label:`工具(逗号分隔)`,placeholder:`toolName, mcp::toolName`}),(0,D.jsx)(l.TextArea,{field:`user_prompt`,label:`用户提示词(追加到用户消息前)`,autosize:{minRows:6,maxRows:18}}),(0,D.jsx)(l.Slot,{label:`启用`,children:(0,D.jsx)(l.Switch,{field:`enabled`})})]})},j?.role?.name||`new-role`)]})}export{k as default};
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{At as r,Dt as i,F as a,H as o,L as s,M as c,W as l,i as u,lt as d,ot as f,st as p}from"./semi-BxhBcqdj.js";import{F as m,I as h,P as g,a as _,b as v,c as y,l as b,m as x,p as S,s as C,x as w,y as T}from"./index-Du_eCXFg.js";var E=e(t(),1),D=e(n(),1),{Text:O}=l;function k(){let e=g(),{hasPermission:t}=m(),n=t(`roles:write`),l=t(`roles:delete`),[k,A]=(0,E.useState)(``),[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)(!1),F=_(()=>h.get(`/roles`),[]),I=(Array.isArray(F.data?.roles)?F.data.roles:[]).filter(e=>{if(!k)return!0;let t=k.toLowerCase();return[e.name,e.description].some(e=>String(e||``).toLowerCase().includes(t))}),L=async()=>{let e=await j.form.validate();P(!0);try{let t={name:e.name.trim(),description:e.description?.trim()||``,user_prompt:e.user_prompt||``,tools:String(e.tools||``).split(`,`).map(e=>e.trim()).filter(Boolean),enabled:e.enabled!==!1},n=j.role?.name;n&&n!==t.name?(await h.post(`/roles`,t),await h.del(`/roles/${encodeURIComponent(n)}`)):n?await h.put(`/roles/${encodeURIComponent(n)}`,t):await h.post(`/roles`,t),w(`角色已保存`),M(null),F.reload()}catch(e){v(e,`保存角色失败`)}finally{P(!1)}},R=e=>T({title:`删除角色「${e.name}」?`,content:`已绑定该角色的对话将失去对应提示词与工具配置。`,onOk:async()=>{await h.del(`/roles/${encodeURIComponent(e.name)}`),w(`已删除`),F.reload()}});return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(S,{title:e(`roles.title`,null,`角色管理`),description:`角色定义对话的系统提示词、可用工具与绑定工作流。`,extra:(0,D.jsxs)(a,{children:[(0,D.jsx)(s,{icon:(0,D.jsx)(p,{}),onClick:()=>F.reload(),loading:F.loading,children:`刷新`}),n&&(0,D.jsx)(s,{theme:`solid`,type:`primary`,icon:(0,D.jsx)(d,{}),onClick:()=>M({role:null,form:{}}),children:`新建角色`})]})}),(0,D.jsxs)(x,{title:`角色(${I.length})`,children:[(0,D.jsx)(b,{error:F.error,onRetry:()=>F.reload()}),(0,D.jsx)(C,{columns:[{title:`角色`,dataIndex:`name`,render:(e,t)=>(0,D.jsxs)(a,{vertical:!0,spacing:0,align:`start`,children:[(0,D.jsxs)(a,{children:[(0,D.jsx)(O,{strong:!0,children:e}),t.enabled===!1&&(0,D.jsx)(c,{size:`small`,color:`grey`,children:`已停用`})]}),(0,D.jsx)(O,{type:`tertiary`,ellipsis:{showTooltip:!0},style:{maxWidth:460},children:t.description||`—`})]})},{title:`工具`,dataIndex:`tools`,width:260,render:e=>Array.isArray(e)&&e.length?(0,D.jsxs)(a,{wrap:!0,spacing:4,children:[e.slice(0,4).map(e=>(0,D.jsx)(c,{size:`small`,children:e},e)),e.length>4&&(0,D.jsxs)(O,{type:`tertiary`,children:[`+`,e.length-4]})]}):(0,D.jsx)(O,{type:`tertiary`,children:`未绑定`})},{title:`工作流`,dataIndex:`workflow_id`,width:160,render:e=>e||`—`},{title:`操作`,width:150,render:(e,t)=>(0,D.jsxs)(a,{children:[n&&(0,D.jsx)(s,{size:`small`,theme:`borderless`,icon:(0,D.jsx)(i,{}),onClick:()=>M({role:t,form:{}}),children:`编辑`}),l&&(0,D.jsx)(s,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,D.jsx)(r,{}),onClick:()=>R(t)})]})}],dataSource:I,rowKey:`name`,loading:F.loading,pagination:{pageSize:20},toolbar:(0,D.jsx)(o,{prefix:(0,D.jsx)(f,{}),value:k,onChange:A,placeholder:`搜索角色名称`,style:{width:260}})})]}),(0,D.jsx)(y,{title:j?.role?`编辑角色`:`新建角色`,visible:!!j,onCancel:()=>M(null),onOk:L,confirmLoading:N,width:760,children:(0,D.jsxs)(u,{getFormApi:e=>M(t=>t&&{...t,form:e}),initValues:j?.role?{name:j.role.name,description:j.role.description,user_prompt:j.role.user_prompt,tools:Array.isArray(j.role.tools)?j.role.tools.join(`, `):``,enabled:j.role.enabled!==!1}:{enabled:!0},children:[(0,D.jsx)(u.Input,{field:`name`,label:`角色名称`,rules:[{required:!0,message:`请输入角色名称`}]}),(0,D.jsx)(u.Input,{field:`description`,label:`描述`}),(0,D.jsx)(u.Input,{field:`tools`,label:`工具(逗号分隔)`,placeholder:`toolName, mcp::toolName`}),(0,D.jsx)(u.TextArea,{field:`user_prompt`,label:`用户提示词(追加到用户消息前)`,autosize:{minRows:6,maxRows:18}}),(0,D.jsx)(u.Slot,{label:`启用`,children:(0,D.jsx)(u.Switch,{field:`enabled`})})]})},j?.role?.name||`new-role`)]})}export{k as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{F as t,L as n,W as r,kt as i,st as a}from"./semi-CDAktpYA.js";import{D as o,F as s,I as c,O as l,P as u,_ as d,a as f,l as p,m,p as h,s as g,x as _,y as v}from"./index-DVHtb0hB.js";import{t as y}from"./react-QV7DAAIx.js";var b=e(y(),1),{Text:x}=r;function S(){let e=u(),{hasPermission:r}=s(),y=r(`skills:delete`),S=f(()=>c.get(`/skills/stats`),[]),C=Array.isArray(S.data?.stats)?S.data.stats:[],w=Number(S.data?.total_calls||0),T=Number(S.data?.total_success||0),E=w>0?T/w:null,D=()=>v({title:`清空所有技能调用统计?`,content:`只影响统计计数,不删除技能文件。`,onOk:async()=>{await c.del(`/skills/stats`),_(`统计已清空`),S.reload()}}),O=e=>v({title:`清空「${e}」的统计?`,onOk:async()=>{await c.del(`/skills/${encodeURIComponent(e)}/stats`),_(`已清空`),S.reload()}});return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(h,{title:e(`skills.monitorTitle`,null,`技能状态`),description:S.data?.skills_dir?`技能目录:${S.data.skills_dir}`:`统计技能被调用的次数、成功率与最近使用时间。`,extra:(0,b.jsxs)(t,{children:[(0,b.jsx)(n,{icon:(0,b.jsx)(a,{}),onClick:()=>S.reload(),loading:S.loading,children:`刷新`}),y&&(0,b.jsx)(n,{type:`danger`,theme:`light`,onClick:D,children:`清空全部统计`})]})}),(0,b.jsx)(d,{columns:4,metrics:[{id:`skills`,label:`技能总数`,value:o(S.data?.total_skills||0),loading:S.loading},{id:`calls`,label:`调用总数`,value:o(w),loading:S.loading},{id:`success`,label:`成功次数`,value:o(T),loading:S.loading},{id:`rate`,label:`成功率`,value:E===null?`—`:l(E),tone:E!==null&&E<.8?`warning`:`success`,loading:S.loading}]}),(0,b.jsxs)(m,{title:`按技能统计`,children:[(0,b.jsx)(p,{error:S.error,onRetry:()=>S.reload()}),(0,b.jsx)(g,{columns:[{title:`技能`,dataIndex:`skill_name`,render:e=>(0,b.jsx)(x,{strong:!0,children:e})},{title:`调用次数`,dataIndex:`total_calls`,width:120,render:e=>o(e||0)},{title:`成功`,dataIndex:`success_calls`,width:100,render:e=>o(e||0)},{title:`失败`,dataIndex:`failed_calls`,width:100,render:e=>Number(e)>0?(0,b.jsx)(x,{type:`danger`,children:o(e)}):`0`},{title:`最后调用`,dataIndex:`last_call_time`,width:180,render:e=>e||`—`},{title:`操作`,width:110,render:(e,t)=>y&&Number(t.total_calls)>0?(0,b.jsx)(n,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,b.jsx)(i,{}),onClick:()=>O(t.skill_name),children:`清空`}):null}],dataSource:C,rowKey:`skill_name`,loading:S.loading,pagination:{pageSize:20}})]})]})}export{S as default};
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{At as t,F as n,L as r,W as i,st as a}from"./semi-BxhBcqdj.js";import{D as o,F as s,I as c,O as l,P as u,_ as d,a as f,l as p,m,p as h,s as g,x as _,y as v}from"./index-Du_eCXFg.js";import{t as y}from"./react-QV7DAAIx.js";var b=e(y(),1),{Text:x}=i;function S(){let e=u(),{hasPermission:i}=s(),y=i(`skills:delete`),S=f(()=>c.get(`/skills/stats`),[]),C=Array.isArray(S.data?.stats)?S.data.stats:[],w=Number(S.data?.total_calls||0),T=Number(S.data?.total_success||0),E=w>0?T/w:null,D=()=>v({title:`清空所有技能调用统计?`,content:`只影响统计计数,不删除技能文件。`,onOk:async()=>{await c.del(`/skills/stats`),_(`统计已清空`),S.reload()}}),O=e=>v({title:`清空「${e}」的统计?`,onOk:async()=>{await c.del(`/skills/${encodeURIComponent(e)}/stats`),_(`已清空`),S.reload()}});return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(h,{title:e(`skills.monitorTitle`,null,`技能状态`),description:S.data?.skills_dir?`技能目录:${S.data.skills_dir}`:`统计技能被调用的次数、成功率与最近使用时间。`,extra:(0,b.jsxs)(n,{children:[(0,b.jsx)(r,{icon:(0,b.jsx)(a,{}),onClick:()=>S.reload(),loading:S.loading,children:`刷新`}),y&&(0,b.jsx)(r,{type:`danger`,theme:`light`,onClick:D,children:`清空全部统计`})]})}),(0,b.jsx)(d,{columns:4,metrics:[{id:`skills`,label:`技能总数`,value:o(S.data?.total_skills||0),loading:S.loading},{id:`calls`,label:`调用总数`,value:o(w),loading:S.loading},{id:`success`,label:`成功次数`,value:o(T),loading:S.loading},{id:`rate`,label:`成功率`,value:E===null?`—`:l(E),tone:E!==null&&E<.8?`warning`:`success`,loading:S.loading}]}),(0,b.jsxs)(m,{title:`按技能统计`,children:[(0,b.jsx)(p,{error:S.error,onRetry:()=>S.reload()}),(0,b.jsx)(g,{columns:[{title:`技能`,dataIndex:`skill_name`,render:e=>(0,b.jsx)(x,{strong:!0,children:e})},{title:`调用次数`,dataIndex:`total_calls`,width:120,render:e=>o(e||0)},{title:`成功`,dataIndex:`success_calls`,width:100,render:e=>o(e||0)},{title:`失败`,dataIndex:`failed_calls`,width:100,render:e=>Number(e)>0?(0,b.jsx)(x,{type:`danger`,children:o(e)}):`0`},{title:`最后调用`,dataIndex:`last_call_time`,width:180,render:e=>e||`—`},{title:`操作`,width:110,render:(e,n)=>y&&Number(n.total_calls)>0?(0,b.jsx)(r,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,b.jsx)(t,{}),onClick:()=>O(n.skill_name),children:`清空`}):null}],dataSource:C,rowKey:`skill_name`,loading:S.loading,pagination:{pageSize:20}})]})]})}export{S as default};

File diff suppressed because one or more lines are too long

View File

@ -18,10 +18,10 @@
} catch (error) { /* first paint fallback */ }
})();
</script>
<script type="module" crossorigin src="/static/app/assets/index-DVHtb0hB.js"></script>
<script type="module" crossorigin src="/static/app/assets/index-Du_eCXFg.js"></script>
<link rel="modulepreload" crossorigin href="/static/app/assets/rolldown-runtime-WkwZ5CU-.js">
<link rel="modulepreload" crossorigin href="/static/app/assets/react-QV7DAAIx.js">
<link rel="modulepreload" crossorigin href="/static/app/assets/semi-CDAktpYA.js">
<link rel="modulepreload" crossorigin href="/static/app/assets/semi-BxhBcqdj.js">
<link rel="stylesheet" crossorigin href="/static/app/assets/semi-BUXPdXzR.css">
<link rel="stylesheet" crossorigin href="/static/app/assets/index-BwdEm4YK.css">
</head>