Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions internal/domain/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
32 changes: 27 additions & 5 deletions web/app/flow-canvas.css
Original file line number Diff line number Diff line change
Expand Up @@ -196,35 +196,57 @@ 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}
#flowView .fd-rename{width:100%;height:24px;margin:-2px 0;padding:0 6px;border:1px solid rgb(var(--fd-accent));border-radius:6px;background:var(--fd-surface);color:var(--fd-ink);font:600 13px inherit;outline:0;box-shadow:0 0 0 3px rgb(var(--fd-accent) / .15)}
#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))}
#flowView .fd-status.s-failed{background:rgb(var(--fd-rj) / .12);color:rgb(var(--fd-rj))}
#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}
Expand Down
2 changes: 1 addition & 1 deletion web/app/flow-palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down
3 changes: 2 additions & 1 deletion web/app/flow-viewport.js
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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();
Expand Down
Loading