diff --git a/internal/domain/workflow.go b/internal/domain/workflow.go
index 59175e633..cbef998c3 100644
--- a/internal/domain/workflow.go
+++ b/internal/domain/workflow.go
@@ -77,6 +77,15 @@ type WorkflowNode struct {
MaxReworks int `json:"maxReworks"`
Notifications []NodeNotification `json:"notifications,omitempty"`
Position Position `json:"position"`
+ // Size is the canvas card footprint chosen by the designer. Height is
+ // omitted until the designer fixes it; width falls back to the default.
+ Size *NodeSize `json:"size,omitempty"`
+}
+
+// NodeSize is the designer-adjusted card footprint.
+type NodeSize struct {
+ W float64 `json:"w"`
+ H float64 `json:"h,omitempty"`
}
// ValidateWorkflowMetricStages prevents silently dropping a mistyped stage.
diff --git a/web/app/flow-canvas.css b/web/app/flow-canvas.css
index 32ba62c74..bfade7649 100644
--- a/web/app/flow-canvas.css
+++ b/web/app/flow-canvas.css
@@ -196,15 +196,15 @@ html[data-theme="dark"] #flowView{
#flowView .fd-canvas.check-hidden{display:none}
/* nodes */
-#flowView .flow-node.fd-node{--tint:var(--fd-accent);position:absolute;width:244px;min-height:0;padding:0;border:1px solid var(--fd-line-2);border-radius:12px;background:var(--fd-surface);box-shadow:var(--fd-shadow-sm);color:var(--fd-ink);cursor:grab;user-select:none;transition:box-shadow .15s,border-color .15s}
+#flowView .flow-node.fd-node{--tint:var(--fd-accent);position:absolute;display:flex;flex-direction:column;width:200px;min-height:0;padding:0;border:1px solid var(--fd-line-2);border-radius:12px;background:var(--fd-surface);box-shadow:var(--fd-shadow-sm);color:var(--fd-ink);cursor:grab;user-select:none;transition:box-shadow .15s,border-color .15s}
#flowView .flow-node.fd-node:hover{border-color:rgb(var(--tint) / .55);box-shadow:var(--fd-shadow)}
-#flowView .flow-node.fd-node.sel{border-color:rgb(var(--fd-accent));box-shadow:0 0 0 3px rgb(var(--fd-accent) / .16),var(--fd-shadow)}
+#flowView .flow-node.fd-node.sel{border-color:rgb(var(--fd-accent));box-shadow:0 0 0 1px rgb(var(--fd-accent) / .3),var(--fd-shadow)}
#flowView .flow-node.fd-node.dragging{cursor:grabbing;box-shadow:var(--fd-shadow-lg);z-index:30!important}
#flowView .flow-node.fd-node.connecting{border-color:rgb(var(--fd-accent))}
#flowView .flow-node.fd-node.drop-ok{border-color:rgb(var(--fd-ok));box-shadow:0 0 0 3px rgb(var(--fd-ok) / .2)}
#flowView .flow-node.fd-node.drop-bad{border-color:rgb(var(--fd-rj));box-shadow:0 0 0 3px rgb(var(--fd-rj) / .16);cursor:not-allowed}
#flowView .flow-node.fd-node::before{content:"";position:absolute;left:-1px;top:12px;bottom:12px;width:3px;border-radius:0 3px 3px 0;background:rgb(var(--tint))}
-#flowView .fd-nh{display:flex;align-items:center;gap:10px;padding:11px 10px 8px 13px}
+#flowView .fd-nh{display:flex;align-items:center;gap:10px;padding:11px 10px 8px 13px;flex:none}
#flowView .fd-nt{flex:1;min-width:0}
#flowView .fd-node .node-title{font-size:13.5px;font-weight:600;color:var(--fd-ink);line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#flowView .fd-node .node-subtitle{margin-top:2px;font-size:11.5px;color:var(--fd-ink-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@@ -212,6 +212,20 @@ html[data-theme="dark"] #flowView{
#flowView .fd-more{display:grid;place-items:center;width:24px;height:24px;padding:0;border:0;border-radius:6px;background:none;color:var(--fd-ink-4);cursor:pointer;opacity:0;transition:opacity .12s,background .12s}
#flowView .fd-node:hover .fd-more,#flowView .fd-node.sel .fd-more{opacity:1}
#flowView .fd-more:hover{background:var(--fd-hover);color:var(--fd-ink)}
+/* Resize frame, modelled on MiniMax Design's canvas: a selected card shows
+ four round corner handles and four edge hit strips. Sizes divide by the
+ canvas zoom so the handles keep a constant on-screen size. */
+#flowView .fd-rz{position:absolute;z-index:5;background:transparent}
+#flowView .fd-rz.corner{width:calc(10px / var(--fd-zoom,1));height:calc(10px / var(--fd-zoom,1));border-radius:50%;background:var(--fd-surface);border:calc(1.5px / var(--fd-zoom,1)) solid rgb(var(--fd-accent));box-shadow:0 1px 2px rgba(15,23,42,.18)}
+#flowView .fd-rz.corner.nw{left:0;top:0;transform:translate(-50%,-50%);cursor:nwse-resize}
+#flowView .fd-rz.corner.ne{left:100%;top:0;transform:translate(-50%,-50%);cursor:nesw-resize}
+#flowView .fd-rz.corner.sw{left:0;top:100%;transform:translate(-50%,-50%);cursor:nesw-resize}
+#flowView .fd-rz.corner.se{left:100%;top:100%;transform:translate(-50%,-50%);cursor:nwse-resize}
+#flowView .fd-rz.edge.n{left:calc(12px / var(--fd-zoom,1));right:calc(12px / var(--fd-zoom,1));top:calc(-4px / var(--fd-zoom,1));height:calc(8px / var(--fd-zoom,1));cursor:ns-resize}
+#flowView .fd-rz.edge.s{left:calc(12px / var(--fd-zoom,1));right:calc(12px / var(--fd-zoom,1));bottom:calc(-4px / var(--fd-zoom,1));height:calc(8px / var(--fd-zoom,1));cursor:ns-resize}
+#flowView .fd-rz.edge.w{top:calc(12px / var(--fd-zoom,1));bottom:calc(12px / var(--fd-zoom,1));left:calc(-4px / var(--fd-zoom,1));width:calc(8px / var(--fd-zoom,1));cursor:ew-resize}
+#flowView .fd-rz.edge.e{top:calc(12px / var(--fd-zoom,1));bottom:calc(12px / var(--fd-zoom,1));right:calc(-4px / var(--fd-zoom,1));width:calc(8px / var(--fd-zoom,1));cursor:ew-resize}
+#flowView .flow-node.fd-node.resizing{transition:none}
#flowView .fd-status{flex:none;padding:2px 6px;border-radius:5px;font-size:10.5px;font-weight:600;background:var(--fd-soft);color:var(--fd-ink-3)}
#flowView .fd-status.s-running{background:rgb(var(--fd-accent) / .12);color:rgb(var(--fd-accent))}
#flowView .fd-status.s-succeeded{background:rgb(var(--fd-ok) / .12);color:rgb(var(--fd-ok))}
@@ -219,12 +233,20 @@ html[data-theme="dark"] #flowView{
#flowView .fd-status.s-waiting_approval{background:rgb(var(--fd-warn) / .14);color:rgb(var(--fd-warn))}
#flowView .fd-node.s-running{border-color:rgb(var(--fd-accent) / .7)}
#flowView .fd-node.s-failed{border-color:rgb(var(--fd-rj) / .7)}
-#flowView .fd-nbody{display:flex;flex-wrap:wrap;gap:4px;padding:0 12px 9px 13px}
+#flowView .fd-nbody{display:flex;flex-direction:column;gap:6px;padding:0 12px 9px 13px;flex:1 1 auto;min-height:0;overflow:auto}
+#flowView .fd-tags{display:flex;flex-wrap:wrap;gap:4px;flex:none}
+#flowView .fd-detail{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:6px;color:var(--fd-ink-3);font-size:11.5px;line-height:1.5}
+#flowView .fd-detail-text{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
+#flowView .fd-detail-script{margin:0;padding:6px 8px;border-radius:8px;background:var(--fd-soft);color:var(--fd-ink-2);font:10.5px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:pre-wrap;overflow-wrap:anywhere}
+#flowView .fd-detail-line{display:flex;align-items:baseline;gap:6px;flex-wrap:wrap}
+#flowView .fd-detail-line b{font-weight:600;color:var(--fd-ink-3);flex:none}
+#flowView .fd-detail-line code{font:10.5px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;padding:1px 5px;border-radius:4px;background:var(--fd-soft);color:var(--fd-ink-2);overflow-wrap:anywhere}
+#flowView .fd-detail-steps{margin:0;padding-left:16px;display:flex;flex-direction:column;gap:2px}
#flowView .fd-tag{display:inline-block;max-width:100%;height:20px;padding:0 7px;border-radius:5px;background:var(--fd-soft);color:var(--fd-ink-3);font-size:11px;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#flowView .fd-tag.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10.5px}
#flowView .fd-tag.warn{background:rgb(var(--fd-warn) / .12);color:rgb(var(--fd-warn))}
#flowView .fd-tag.soft{background:transparent;border:1px solid var(--fd-line)}
-#flowView .fd-outs{display:flex;flex-direction:column;border-top:1px solid var(--fd-line)}
+#flowView .fd-outs{display:flex;flex-direction:column;border-top:1px solid var(--fd-line);flex:none;margin-top:auto}
#flowView .fd-out{position:relative;display:flex;align-items:center;justify-content:flex-end;height:24px;padding:0 16px 0 12px;font-size:11px;color:var(--fd-ink-4)}
#flowView .fd-out+.fd-out{border-top:1px dashed var(--fd-line)}
#flowView .fd-out.ok::before,#flowView .fd-out.rj::before{content:"";width:6px;height:6px;border-radius:50%;margin-right:6px}
diff --git a/web/app/flow-palette.js b/web/app/flow-palette.js
index 631a915e0..ab73ddf73 100644
--- a/web/app/flow-palette.js
+++ b/web/app/flow-palette.js
@@ -104,7 +104,7 @@ const flowPalette=(()=>{
e.preventDefault();
let item;try{item=JSON.parse(raw)}catch{return}
const w=flowViewport.toWorld(e.clientX,e.clientY);
- addNode(item.type,{agentId:item.agentId,at:{x:w.x-122,y:w.y-28}});
+ addNode(item.type,{agentId:item.agentId,at:{x:w.x-100,y:w.y-28}});
});
}
function bind(){
diff --git a/web/app/flow-viewport.js b/web/app/flow-viewport.js
index 2be96fef0..8439e89c5 100644
--- a/web/app/flow-viewport.js
+++ b/web/app/flow-viewport.js
@@ -1,7 +1,7 @@
// Pan/zoom viewport for the flow designer canvas. Node positions stay in
// logical canvas coordinates; only #canvasStage is transformed.
const flowViewport=(()=>{
- const MIN=.25,MAX=2,GRID=18,NODE_W=244,NODE_H=132,PAL_W=256,PAL_MINI=48,MINIMAP_KEY='agentflow.flowMinimap';
+ const MIN=.25,MAX=2,GRID=18,NODE_W=200,NODE_H=132,PAL_W=256,PAL_MINI=48,MINIMAP_KEY='agentflow.flowMinimap';
const vp={x:40,y:40,zoom:1};
let fittedId=null,autoCollapsed=false,animTimer=0,bound=false,onBlankClick=null,minimapRaf=0;
const byId=id=>document.getElementById(id);
@@ -12,6 +12,7 @@ const flowViewport=(()=>{
const stage=byId('canvasStage'),c=canvas();if(!stage||!c)return;
stage.classList.toggle('anim',!!anim);
stage.style.transform=`translate(${vp.x}px,${vp.y}px) scale(${vp.zoom})`;
+ c.style.setProperty('--fd-zoom',vp.zoom);
const g=GRID*vp.zoom;c.style.backgroundSize=`${g}px ${g}px`;c.style.backgroundPosition=`${vp.x}px ${vp.y}px`;
const zv=byId('canvasZoomValue');if(zv)zv.textContent=Math.round(vp.zoom*100)+'%';
scheduleMinimap();
diff --git a/web/app/flows.js b/web/app/flows.js
index a52efd57c..db8162af8 100644
--- a/web/app/flows.js
+++ b/web/app/flows.js
@@ -254,17 +254,18 @@ function arrange(){
flowToast('已按依赖层级整理画布',{undo:true});
}
// Layouts saved for the narrower legacy node, or templates on a 240px column
-// pitch, overlap the 244px node: the overlap hides the ports, so no reject
+// pitch, overlap the 200px node: the overlap hides the ports, so no reject
// route can be drawn. Rows/columns that are that crowded are widened
// proportionally in memory; a later save keeps it. Diagonal or far-off
// overlaps are left to the user (and "整理").
-const FLOW_SPREAD={w:244,h:132,pitchW:280,pitchH:160,maxFactor:1.6};
+const FLOW_NODE_W=200,FLOW_NODE_H=132,FLOW_RESIZE_MIN_W=180,FLOW_RESIZE_MAX_W=480,FLOW_RESIZE_MIN_H=96,FLOW_RESIZE_MAX_H=640,FLOW_DETAIL_MIN_H=200;
+const FLOW_SPREAD={w:FLOW_NODE_W,h:FLOW_NODE_H,pitchW:280,pitchH:160,maxFactor:1.6};
function spreadCrowdedNodes(wf){
const nodes=(wf?.nodes||[]).filter(n=>n.position&&Number.isFinite(n.position.x)&&Number.isFinite(n.position.y));
let minDx=Infinity,minDy=Infinity;
for(let i=0;i
${escapeHTML(a.path||a.name)}`).join('')}${escapeHTML(code)}`:'';
+ }
+ if(kind==='sop'){
+ const wf=sopWorkflowChoices().find(w=>w.id===n.sopWorkflowId)||(state.data.workflows||[]).find(w=>w.id===n.sopWorkflowId);
+ const steps=(wf?.nodes||[]).map(step=>step.name||step.id).filter(Boolean);
+ return steps.length?`${escapeHTML(ask)}
`:''} + return ''; +} function flowNodeHTML(n,run,ro){ - const m=nodeMeta(n),kind=m.kind,status=run?.nodes?.[n.id]?.status||''; + const m=nodeMeta(n),kind=m.kind,status=run?.nodes?.[n.id]?.status||'',size=flowNodeSize(n); const agent=kind==='agent'?workflowAgent(n.agentId):null; const tile=agent?escapeHTML(flowPalette.initial(agent.name)):flowPalette.icon(FLOW_NODE_TYPES[kind].icon,16); const title=state.renamingNode===n.id?``:escapeHTML(n.name); const cls=['flow-node','fd-node','t-'+kind,state.selectedNode===n.id?'sel':'',state.connectFrom===n.id?'connecting':'',status?'s-'+status:'',kind==='preview'?'preview-build':''].filter(Boolean).join(' '); const tags=m.tags.map(t=>`${escapeHTML(t.text)}`).join(''); + const detail=size.h&&size.h>=FLOW_DETAIL_MIN_H?flowNodeDetailHTML(n,kind,agent):''; const outs=`