docs: add HWLAB Agent workflow canvas

This commit is contained in:
Codex
2026-07-10 19:10:55 +02:00
parent b5aed0e05b
commit 09171c4b1d
3 changed files with 1236 additions and 402 deletions
File diff suppressed because it is too large Load Diff
@@ -135,32 +135,56 @@
</article>
</section>
<nav class="agent-loop" aria-label="Agent 工作循环">
<button type="button" data-loop="observe"><i>01</i><span>观察</span><small>Observe</small></button>
<button type="button" data-loop="hypothesize"><i>02</i><span>假设</span><small>Hypothesize</small></button>
<button type="button" data-loop="plan"><i>03</i><span>计划</span><small>Plan</small></button>
<button type="button" data-loop="act"><i>04</i><span>行动</span><small>Act</small></button>
<button type="button" data-loop="verify"><i>05</i><span>验证</span><small>Verify</small></button>
<button type="button" data-loop="reflect"><i>06</i><span>反思</span><small>Reflect</small></button>
</nav>
<div class="agent-workbench">
<section class="timeline-pane" aria-labelledby="timeline-title">
<header class="pane-header">
<section class="workflow-workbench" aria-label="AGENT 工作流执行图">
<section class="workflow-canvas-panel">
<header class="workflow-toolbar">
<div>
<span class="section-kicker">LIVE AGENT TRACE</span>
<h2 id="timeline-title">行动时间线</h2>
<span class="section-kicker">AGENT EXECUTION GRAPH</span>
<h2>任务到物理证据的执行画布</h2>
</div>
<div class="graph-runtime">
<span id="graphProgress">0 / 14 NODES</span>
<strong id="canvasStage">READY</strong>
</div>
<div class="canvas-controls" aria-label="画布缩放控制">
<button id="zoomOutButton" type="button" title="缩小画布" aria-label="缩小画布"></button>
<button id="fitGraphButton" type="button" title="适配画布">FIT</button>
<button id="zoomInButton" type="button" title="放大画布" aria-label="放大画布"></button>
</div>
<span id="eventCounter">01 EVENT</span>
</header>
<ol class="agent-timeline" id="agentTimeline" aria-live="polite"></ol>
<div
class="workflow-viewport"
id="workflowViewport"
tabindex="0"
aria-label="可拖动与缩放的 AGENT 工作流画布"
>
<div class="workflow-board" id="workflowBoard">
<svg
class="workflow-edges"
id="workflowEdges"
viewBox="0 0 840 375"
aria-hidden="true"
></svg>
<div class="workflow-nodes" id="workflowNodes"></div>
</div>
</div>
<div class="canvas-legend" aria-label="节点与路径图例">
<span><i class="legend-agent"></i>AGENT 决策</span>
<span><i class="legend-tool"></i>工具调用</span>
<span><i class="legend-hardware"></i>真实硬件</span>
<span><i class="legend-gate"></i>控制 / 裁决</span>
<span><i class="legend-loop"></i>重新诊断回环</span>
<small>拖动画布 · 点击节点检查输入输出</small>
</div>
</section>
<section class="inspector-pane" aria-labelledby="inspector-title">
<aside class="node-inspector" aria-labelledby="inspector-title">
<header class="inspector-header">
<div>
<span class="section-kicker">ACTION INSPECTOR</span>
<h2 id="inspector-title">AGENT 决策摘要</h2>
<span class="section-kicker" id="selectedNodeKind">TRIGGER NODE</span>
<h2 id="inspector-title">任务接管</h2>
</div>
<div class="inspector-tabs" role="tablist" aria-label="行动详情视图">
<button class="is-active" type="button" role="tab" aria-selected="true" data-tab="decision">决策</button>
@@ -204,8 +228,8 @@
<pre class="tool-output" id="toolOutput"><span>$ agent.run --task freq-1khz-accuracy</span>
waiting for authorized execution...</pre>
</div>
</section>
</div>
</aside>
</section>
</section>
<aside class="hwpod-stage" aria-labelledby="hwpod-title">
@@ -348,7 +348,7 @@ input:focus-visible,
.agent-stage {
display: grid;
grid-template-rows: 48px 54px 74px 43px minmax(0, 1fr);
grid-template-rows: 48px 54px 74px minmax(0, 1fr);
padding: 0 12px 9px;
background: var(--paper);
}
@@ -666,6 +666,455 @@ input:focus-visible,
font-size: 7px;
}
.workflow-workbench {
display: grid;
grid-template-columns: minmax(0, 1fr) 330px;
min-width: 0;
min-height: 0;
overflow: hidden;
border: 1px solid var(--line-strong);
background: var(--surface);
}
.workflow-canvas-panel {
display: grid;
min-width: 0;
min-height: 0;
grid-template-rows: 40px minmax(0, 1fr) 27px;
border-right: 1px solid var(--line);
}
.workflow-toolbar {
display: flex;
min-width: 0;
align-items: center;
gap: 10px;
padding: 0 8px 0 10px;
border-bottom: 1px solid var(--line);
background: var(--surface-2);
}
.workflow-toolbar > div:first-child {
min-width: 0;
}
.workflow-toolbar h2 {
overflow: hidden;
margin: 2px 0 0;
font-size: 10px;
line-height: 1;
text-overflow: ellipsis;
white-space: nowrap;
}
.graph-runtime {
display: grid;
gap: 2px;
margin-left: auto;
text-align: right;
}
.graph-runtime span,
.graph-runtime strong {
font-family: var(--mono);
font-size: 7px;
}
.graph-runtime span {
color: #7b898e;
}
.graph-runtime strong {
color: var(--cyan-dark);
}
.canvas-controls {
display: flex;
height: 25px;
border: 1px solid var(--line-strong);
}
.canvas-controls button {
min-width: 27px;
padding: 0 6px;
border: 0;
border-left: 1px solid var(--line);
background: var(--surface);
color: #53646a;
font-family: var(--mono);
font-size: 8px;
cursor: pointer;
}
.canvas-controls button:first-child {
border-left: 0;
}
.canvas-controls button:hover {
background: var(--cyan-pale);
color: var(--cyan-dark);
}
.workflow-viewport {
position: relative;
min-width: 0;
min-height: 0;
overflow: hidden;
background-color: #f6f9f9;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='1' cy='1' r='0.7' fill='%23bfcbce'/%3E%3C/svg%3E");
cursor: grab;
touch-action: none;
user-select: none;
}
.workflow-viewport.is-dragging {
cursor: grabbing;
}
.workflow-board {
position: absolute;
top: 0;
left: 0;
width: 840px;
height: 375px;
transform-origin: 0 0;
will-change: transform;
}
.workflow-edges,
.workflow-nodes {
position: absolute;
inset: 0;
width: 840px;
height: 375px;
}
.flow-edge {
fill: none;
stroke: #aebbc0;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.5;
vector-effect: non-scaling-stroke;
transition: stroke 160ms ease, opacity 160ms ease, stroke-width 160ms ease;
}
.flow-edge[data-status="active"] {
stroke: var(--amber);
stroke-dasharray: 6 5;
stroke-width: 2.3;
animation: edge-flow 650ms linear infinite;
}
.flow-edge[data-status="passed"] {
stroke: var(--green);
stroke-width: 2;
}
.flow-edge[data-status="failed"],
.flow-edge[data-status="blocked"] {
stroke: var(--red);
stroke-width: 2.3;
}
.flow-edge[data-status="skipped"] {
stroke: #aeb8bc;
stroke-dasharray: 3 5;
opacity: 0.32;
}
.flow-edge.is-loop {
stroke: var(--cyan);
stroke-dasharray: 5 5;
}
.flow-edge.is-loop[data-status="active"] {
stroke: var(--cyan);
animation: edge-flow 650ms linear infinite;
}
@keyframes edge-flow {
to { stroke-dashoffset: -22; }
}
.edge-label {
fill: #77878c;
font-family: var(--mono);
font-size: 7px;
font-weight: 700;
letter-spacing: 0.08em;
paint-order: stroke;
stroke: #f6f9f9;
stroke-width: 3px;
}
.edge-label.is-pass {
fill: var(--green);
}
.edge-label.is-fail {
fill: var(--red);
}
.edge-label.is-loop {
fill: var(--cyan-dark);
}
.workflow-nodes {
pointer-events: none;
}
.flow-node {
position: absolute;
display: grid;
width: 120px;
height: 56px;
grid-template-columns: 25px minmax(0, 1fr);
grid-template-rows: 20px 17px 13px;
gap: 0 6px;
align-items: center;
padding: 5px 7px;
border: 1px solid var(--line-strong);
background: var(--surface);
box-shadow: 0 2px 6px rgb(29 52 59 / 7%);
cursor: pointer;
pointer-events: auto;
text-align: left;
transition: border-color 150ms ease, box-shadow 150ms ease, opacity 150ms ease, transform 150ms ease;
}
.flow-node::before,
.flow-node::after {
position: absolute;
top: 50%;
width: 6px;
height: 6px;
transform: translateY(-50%);
border: 1px solid #8fa0a6;
border-radius: 50%;
background: #f8fbfb;
content: "";
}
.flow-node::before {
left: -4px;
}
.flow-node::after {
right: -4px;
}
.node-icon {
display: grid;
grid-row: 1 / 4;
width: 24px;
height: 24px;
place-items: center;
border: 1px solid var(--line-strong);
background: var(--surface-2);
color: var(--ink-2);
font-family: var(--mono);
font-size: 7px;
font-style: normal;
font-weight: 800;
}
.node-topline {
display: flex;
min-width: 0;
align-items: center;
justify-content: space-between;
gap: 4px;
color: #78878d;
font-family: var(--mono);
font-size: 6px;
}
.node-topline span:first-child {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.node-state {
flex: 0 0 auto;
width: 6px;
height: 6px;
border: 1px solid #9eacb1;
border-radius: 50%;
background: white;
}
.node-title,
.node-summary {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.node-title {
font-size: 8px;
font-weight: 750;
}
.node-summary {
color: #6f7e83;
font-size: 6px;
}
.flow-node.node-agent {
border-color: #85bdc1;
}
.flow-node.node-agent .node-icon {
border-color: var(--cyan);
background: var(--cyan-pale);
color: var(--cyan-dark);
}
.flow-node.node-tool .node-icon {
background: #26343a;
color: #d9e6e8;
}
.flow-node.node-hardware {
border-color: #74959d;
background: #f2f7f7;
}
.flow-node.node-hardware .node-icon {
border-color: #294249;
background: #13262c;
color: #70e0e2;
}
.flow-node.node-gate {
border-color: #c49a55;
background: #fffaf0;
}
.flow-node.node-gate .node-icon {
transform: rotate(45deg);
border-color: var(--amber);
background: var(--amber-pale);
color: #875000;
}
.flow-node.node-gate .node-icon span {
transform: rotate(-45deg);
}
.flow-node.node-evidence .node-icon {
border-color: var(--green);
background: var(--green-pale);
color: var(--green);
}
.flow-node:hover,
.flow-node.is-selected {
transform: translateY(-1px);
border-color: var(--cyan);
box-shadow: 0 0 0 2px rgb(5 142 153 / 12%), 0 5px 12px rgb(24 55 62 / 11%);
}
.flow-node[data-status="active"] {
border-color: var(--amber);
box-shadow: 0 0 0 3px rgb(182 109 0 / 13%), 0 5px 13px rgb(39 44 24 / 13%);
}
.flow-node[data-status="active"] .node-state {
border-color: var(--amber);
background: var(--amber);
animation: agent-pulse 850ms ease-in-out infinite alternate;
}
.flow-node[data-status="passed"] {
border-color: var(--green);
box-shadow: inset 0 -2px 0 var(--green);
}
.flow-node[data-status="passed"] .node-state {
border-color: var(--green);
background: var(--green);
box-shadow: inset 0 0 0 1px white;
}
.flow-node[data-status="failed"],
.flow-node[data-status="blocked"] {
border-color: var(--red);
background: var(--red-pale);
box-shadow: inset 0 -2px 0 var(--red);
}
.flow-node[data-status="failed"] .node-state,
.flow-node[data-status="blocked"] .node-state {
border-color: var(--red);
background: var(--red);
}
.flow-node[data-status="skipped"] {
opacity: 0.34;
border-style: dashed;
box-shadow: none;
}
.canvas-legend {
display: flex;
min-width: 0;
align-items: center;
gap: 10px;
padding: 0 8px;
overflow: hidden;
border-top: 1px solid var(--line);
background: #f8fafa;
}
.canvas-legend span {
display: inline-flex;
align-items: center;
gap: 4px;
color: #5f6f75;
font-size: 6px;
white-space: nowrap;
}
.canvas-legend i {
width: 8px;
height: 8px;
border: 1px solid var(--line-strong);
background: white;
}
.canvas-legend .legend-agent { border-color: var(--cyan); background: var(--cyan-pale); }
.canvas-legend .legend-tool { border-color: #26343a; background: #26343a; }
.canvas-legend .legend-hardware { border-color: #294249; background: #163039; }
.canvas-legend .legend-gate { transform: rotate(45deg); border-color: var(--amber); background: var(--amber-pale); }
.canvas-legend .legend-loop { width: 13px; height: 0; border: 0; border-top: 1px dashed var(--cyan); }
.canvas-legend small {
margin-left: auto;
overflow: hidden;
color: #849298;
font-family: var(--mono);
font-size: 6px;
text-overflow: ellipsis;
white-space: nowrap;
}
.node-inspector {
display: grid;
min-width: 0;
min-height: 0;
grid-template-rows: 39px minmax(0, 1fr);
overflow: hidden;
background: var(--surface);
}
.node-inspector .inspector-view {
min-height: 0;
}
.agent-loop {
position: relative;
display: grid;
@@ -1691,6 +2140,7 @@ input:focus-visible,
}
.agent-stage {
grid-template-rows: 44px 50px 58px minmax(0, 1fr);
padding-right: 8px;
padding-left: 8px;
}
@@ -1738,6 +2188,43 @@ input:focus-visible,
grid-template-columns: minmax(210px, 0.8fr) minmax(270px, 1.2fr);
}
.workflow-workbench {
position: relative;
grid-template-columns: minmax(0, 1fr);
}
.workflow-canvas-panel {
border-right: 0;
}
.node-inspector {
position: absolute;
z-index: 5;
right: 7px;
bottom: 32px;
width: 255px;
height: 145px;
border: 1px solid var(--line-strong);
box-shadow: 0 8px 20px rgb(23 45 52 / 16%);
}
.node-inspector .decision-statement {
padding: 8px 9px;
}
.node-inspector .decision-statement p {
display: none;
}
.node-inspector .action-facts {
display: none;
}
.canvas-legend span:nth-child(4),
.canvas-legend span:nth-child(5) {
display: none;
}
.action-facts div {
min-height: 61px;
padding: 7px 8px;
@@ -1943,6 +2430,65 @@ input:focus-visible,
overflow: visible;
}
.workflow-workbench {
display: block;
overflow: visible;
}
.workflow-canvas-panel {
display: grid;
height: 455px;
grid-template-rows: 42px minmax(0, 1fr) 30px;
border-right: 0;
border-bottom: 1px solid var(--line);
}
.workflow-toolbar {
padding-right: 5px;
padding-left: 7px;
}
.workflow-toolbar h2 {
max-width: 145px;
}
.graph-runtime {
display: none;
}
.canvas-controls button {
min-width: 26px;
}
.canvas-legend {
gap: 8px;
overflow-x: auto;
}
.canvas-legend small {
display: none;
}
.node-inspector {
position: static;
width: auto;
height: 350px;
border: 0;
box-shadow: none;
}
.node-inspector .decision-statement {
padding: 11px 12px 10px;
}
.node-inspector .decision-statement p {
display: block;
}
.node-inspector .action-facts {
display: grid;
}
.timeline-pane,
.inspector-pane {
min-height: 320px;