Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix(graph): close routing and compact focus review
Rahmanf73f4cf95a55
diff --git a/components/shared/graph-canvas.tsx b/components/shared/graph-canvas.tsxindex 8829eb8d..edcdaa28 100644--- a/components/shared/graph-canvas.tsx+++ b/components/shared/graph-canvas.tsx@@ -24,6 +24,7 @@ import {import { Hand, LayoutGrid, Maximize2, MousePointer2, ZoomIn, ZoomOut } from "lucide-react";import { cn } from "@/lib/utils";import { compactGraphViewport } from "./graph-fit";+import { GraphRoutingProvider } from "./graph-routed-edge";export type GraphCanvasMode = "select" | "pan";type MiniMapNodeColor = MiniMapProps["nodeColor"];@@ -93,7 +94,9 @@ function GraphCanvasInner<NodeType extends Node = Node, EdgeType extends Edge =if (key === "+" || key === "=") { event.preventDefault(); void zoomIn({ duration: 160 }); }if (key === "-") { event.preventDefault(); void zoomOut({ duration: 160 }); }};- return <div className="h-full min-h-0 w-full min-w-0 outline-none" tabIndex={0} onKeyDown={keyboard}>+ const routingNodes = props.nodes ?? props.defaultNodes ?? [];+ const routingEdges = props.edges ?? props.defaultEdges ?? [];+ return <GraphRoutingProvider nodes={routingNodes} edges={routingEdges}><div className="h-full min-h-0 w-full min-w-0 outline-none" tabIndex={0} onKeyDown={keyboard}><ReactFlow<NodeType, EdgeType>{...props}id={flowId}@@ -123,5 +126,5 @@ function GraphCanvasInner<NodeType extends Node = Node, EdgeType extends Edge =/> : null}{children}</ReactFlow>- </div>;+ </div></GraphRoutingProvider>;}diff --git a/components/shared/graph-route-cache.ts b/components/shared/graph-route-cache.tsindex 6614908f..57807390 100644--- a/components/shared/graph-route-cache.ts+++ b/components/shared/graph-route-cache.ts@@ -19,8 +19,22 @@ const intersects = (a: RouteRect, b: RouteRect) => a.x <= b.x + b.width && a.x +export function createRoutingScene(nodes: RoutingNode[], edges: RoutingEdge[]): RoutingScene {const rects = new Map(nodes.map((n) => [n.id, { x: n.x - PAD, y: n.y - PAD, width: n.width + PAD * 2, height: n.height + PAD * 2 }]));const outgoing = new Map<string, string[]>(), incoming = new Map<string, string[]>();- for (const e of edges) { outgoing.set(e.source, [...(outgoing.get(e.source) ?? []), e.id]); incoming.set(e.target, [...(incoming.get(e.target) ?? []), e.id]); }- const lanes = new Map(edges.map((e) => [e.id, [...new Set([...(outgoing.get(e.source) ?? []), ...(incoming.get(e.target) ?? [])])].sort().indexOf(e.id)]));+ for (const e of edges) {+ const out = outgoing.get(e.source); if (out) out.push(e.id); else outgoing.set(e.source, [e.id]);+ const into = incoming.get(e.target); if (into) into.push(e.id); else incoming.set(e.target, [e.id]);+ }+ const pairRanks = new Map<string, Map<string, number>>();+ const lanes = new Map<string, number>();+ for (const e of edges) {+ const pair = e.source + "\0" + e.target;+ let ranks = pairRanks.get(pair);+ if (!ranks) {+ const ids = [...new Set([...(outgoing.get(e.source) ?? []), ...(incoming.get(e.target) ?? [])])].sort();+ ranks = new Map(ids.map((id, index) => [id, index]));+ pairRanks.set(pair, ranks);+ }+ lanes.set(e.id, ranks.get(e.id) ?? 0);+ }return { rects, obstacles: [...rects.values()], lanes, changes: new WeakMap() };}function changedRects(before: RoutingScene, after: RoutingScene): RouteRect[] {diff --git a/components/shared/graph-routed-edge.tsx b/components/shared/graph-routed-edge.tsxindex e9a44e48..52af0d1a 100644--- a/components/shared/graph-routed-edge.tsx+++ b/components/shared/graph-routed-edge.tsx@@ -1,28 +1,63 @@"use client";-import { useMemo } from "react";-import { BaseEdge, Position, getSmoothStepPath, useNodes, useEdges, type EdgeProps } from "@xyflow/react";-import { orthogonalRoute, routeLabel, routePath, segmentBlocked, type RoutePoint } from "./graph-route";-const direction = (position: Position) => position === Position.Left ? { x: -1, y: 0 } : position === Position.Right ? { x: 1, y: 0 } : position === Position.Top ? { x: 0, y: -1 } : { x: 0, y: 1 };+import { createContext, useContext, useMemo, useState, type ReactNode } from "react";+import { BaseEdge, Position, getSmoothStepPath, type Edge, type EdgeProps, type Node } from "@xyflow/react";+import {+ createRoutingScene, GraphRouteCache,+ type ConnectorRequest, type RouteSide, type RoutingScene,+} from "./graph-route-cache";-/** Use actual measured cards, including collapsed groups. Only presentation changes. */+type RoutingContext = { scene: RoutingScene; cache: GraphRouteCache; selectedIds: Set<string> };+const GraphRoutingContext = createContext<RoutingContext | null>(null);+const side = (position: Position): RouteSide =>+ position === Position.Left ? "left" : position === Position.Right ? "right" : position === Position.Top ? "top" : "bottom";++/** One shared obstacle scene/cache per canvas update; individual edges never subscribe to the full node array. */+export function GraphRoutingProvider({ nodes, edges, children }: {+ nodes: readonly Node[];+ edges: readonly Edge[];+ children: ReactNode;+}) {+ const scene = useMemo(() => createRoutingScene(+ nodes.filter((node) => !node.hidden).map((node) => ({+ id: node.id,+ x: node.position.x,+ y: node.position.y,+ width: node.measured?.width ?? node.width ?? 240,+ height: node.measured?.height ?? node.height ?? 120,+ })),+ edges.filter((edge) => !edge.hidden).map(({ id, source, target }) => ({ id, source, target })),+ ), [edges, nodes]);+ const [cache] = useState(() => new GraphRouteCache());+ const selectedIds = useMemo(() => new Set(nodes.filter((node) => node.selected).map((node) => node.id)), [nodes]);+ const value = useMemo(() => ({ scene, cache, selectedIds }), [cache, scene, selectedIds]);+ return <GraphRoutingContext.Provider value={value}>{children}</GraphRoutingContext.Provider>;+}++/** Measured, obstacle-aware edge using the canvas-shared scene and bounded route memo. */export function GraphRoutedEdge(props: EdgeProps) {- const nodes = useNodes(), edges = useEdges();+ const routing = useContext(GraphRoutingContext);const { id, source, target, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition } = props;- const siblings = edges.filter((edge) => edge.source === source || edge.target === target).map((edge) => edge.id).sort();- const lane = Math.max(0, siblings.indexOf(id));- const geometry = useMemo(() => {- const a = { x: sourceX, y: sourceY }, b = { x: targetX, y: targetY }, sd = direction(sourcePosition), td = direction(targetPosition), escape = 26 + (lane % 5) * 4;- const start = { x: a.x + sd.x * escape, y: a.y + sd.y * escape }, end = { x: b.x + td.x * escape, y: b.y + td.y * escape };- const obstacles = nodes.filter((node) => !node.hidden).map((node) => ({ x: node.position.x - 10, y: node.position.y - 10, width: (node.measured?.width ?? node.width ?? 240) + 20, height: (node.measured?.height ?? node.height ?? 120) + 20 }));- const ownSource = nodes.findIndex((node) => node.id === source), ownTarget = nodes.findIndex((node) => node.id === target);- const escapes = !segmentBlocked(a, start, obstacles.filter((_, i) => i !== ownSource)) && !segmentBlocked(end, b, obstacles.filter((_, i) => i !== ownTarget));- const middle = escapes ? orthogonalRoute(start, end, obstacles, lane % 7) : null;- if (!middle) { const [path, x, y] = getSmoothStepPath({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, offset: escape }); return { path, label: { x, y }, blocked: true }; }- const points: RoutePoint[] = [a, ...middle, b];- return { path: routePath(points), label: routeLabel(middle), blocked: false };- }, [nodes, source, target, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, lane]);- const anySelected = nodes.some((node) => node.selected), adjacent = nodes.some((node) => node.selected && (node.id === source || node.id === target));- const style = { ...props.style, strokeWidth: adjacent || props.selected ? 3 : 2, opacity: anySelected && !adjacent && !props.selected ? 0.25 : props.style?.opacity ?? 1, ...(geometry.blocked ? { strokeDasharray: "3 5" } : {}), vectorEffect: "non-scaling-stroke" as const };+ const request = useMemo<ConnectorRequest>(() => ({+ id, source, target,+ a: { x: sourceX, y: sourceY },+ b: { x: targetX, y: targetY },+ sourceSide: side(sourcePosition),+ targetSide: side(targetPosition),+ }), [id, source, sourcePosition, sourceX, sourceY, target, targetPosition, targetX, targetY]);+ const fallback = useMemo(() => {+ const [path, x, y] = getSmoothStepPath({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, offset: 26 });+ return { path, label: { x, y }, blocked: true };+ }, [sourcePosition, sourceX, sourceY, targetPosition, targetX, targetY]);+ const geometry = useMemo(() => routing ? routing.cache.resolve(routing.scene, request) : fallback, [fallback, request, routing]);+ const anySelected = Boolean(routing?.selectedIds.size);+ const adjacent = Boolean(routing?.selectedIds.has(source) || routing?.selectedIds.has(target));+ const style = {+ ...props.style,+ strokeWidth: adjacent || props.selected ? 3 : 2,+ opacity: anySelected && !adjacent && !props.selected ? 0.25 : props.style?.opacity ?? 1,+ ...(geometry.blocked ? { strokeDasharray: "3 5" } : {}),+ vectorEffect: "non-scaling-stroke" as const,+ };return <g data-routing-state={geometry.blocked ? "overlap" : "clear"}><title>{geometry.blocked ? "No clear route: move overlapping nodes apart" : `${source} → ${target}`}</title><path d={geometry.path} fill="none" stroke="var(--background)" strokeWidth={7} opacity={style.opacity} vectorEffect="non-scaling-stroke" pointerEvents="none"/>diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 215be8d1..86ecfacb 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -13,6 +13,8 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Fixed**+- `graph` close routing and compact focus review+- `graph` reconcile controlled selection and preserve routing groundwork- `security` restore native dependency update cooldown- `browser` retain private viewer connectivity without server access- `release` align Node support and read-only browser reconnectsdiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 53fa756b..809aeb94 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -1,3 +1,7 @@+## 2026-09-18 — Close graph routing review without changing executable topology++PR review exposed four presentation/runtime issues: clear short facing ports could be mislabeled as overlaps, controlled parent selection could be ignored for existing nodes, each routed edge recomputed against the whole obstacle set during drag, and compact fitting could center arbitrary storage-order nodes instead of workflow triggers. The shared route scene now clamps/direct-routes short clear links, caches route geometry across unrelated movement, and is owned at the canvas boundary. Endpoint sibling ranks are built once per scene instead of rebuilding/sorting an adjacency union for every edge; after warm-up, a 25-run 200-node/400-edge synthetic scene build measured about 0.48 ms median on this host, while repeated unrelated movement reused all 400 cached routes. Controlled selection changes win while transient box/ctrl selections survive data-only updates. Compact focus derives from manual/schedule/webhook or semantic session roots and maps collapsed trigger members to their visible custom-group proxy. Grouping remains presentation metadata; stored nodes, handles, edges and execution semantics are unchanged.+## 2026-09-18 — Restore native dependency update cooldownPR verification caught the isolated node-gyp Dependabot entry missing the existing seven-day version-update cooldown. Reuse the already-reviewed configuration and regression-test delta from the parallel security work; the change adds only the missing cooldown and tests all declared ecosystems. No scanner suppression, dependency replacement, or runtime behavior change is involved.diff --git a/frontend/slices/workflows/components/workflow-canvas.tsx b/frontend/slices/workflows/components/workflow-canvas.tsxindex 5998a644..dc2fc0e9 100644--- a/frontend/slices/workflows/components/workflow-canvas.tsx+++ b/frontend/slices/workflows/components/workflow-canvas.tsx@@ -12,6 +12,7 @@ import { GraphCustomCard } from "@/components/shared/graph-custom-card";import { projectCustomNodes, moveCustomNode, type CustomCanvasNode } from "@/components/shared/graph-custom-projection";import { graphRoutedEdgeTypes } from "@/components/shared/graph-routed-edge";import type { GraphCustomNode } from "@/lib/contracts/graph-custom-nodes";+import { compactWorkflowFocusIds } from "../lib/compact-focus";import { cn } from "@/lib/utils";interface WorkflowNodeData extends Record<string, unknown> { node: WorkflowGraphNode; state?: WorkflowGraphNodeState }@@ -63,7 +64,9 @@ export function WorkflowCanvas({graph,selectedId,onSelect,onMove,onMoveMany,onCuconst changeGroups=(next:GraphCustomNode[])=>{onCustomNodes?.(next);onSelect(null);};const move=(items:CanvasNode[])=>{let next=graph.nodes;for(const item of items){const group=groups.find((g)=>g.id===item.id);next=group?moveCustomNode(next,group,item.position):next.map((n)=>n.id===item.id?{...n,position:item.position}:n);}if(onMoveMany)onMoveMany(next);else for(const item of items)onMove(item.id,item.position);};const connect=(connection:Connection)=>{if(!graph.nodes.some((n)=>n.id===connection.source)||!graph.nodes.some((n)=>n.id===connection.target)||connection.source===connection.target)return;const handle=connection.sourceHandle&&connection.sourceHandle!=="output"?connection.sourceHandle:undefined;onConnect(connection.source!,connection.target!,handle);};- const compactIds=readOnly?nodes.slice(0,9).map((n)=>n.id):nodes.slice(0,2).map((n)=>n.id);+ const visibleIds=useMemo(()=>new Set(nodes.map((node)=>node.id)),[nodes]);+ const rootFocusIds=useMemo(()=>compactWorkflowFocusIds(graph.nodes,groups,visibleIds,readOnly?9:2),[graph.nodes,groups,readOnly,visibleIds]);+ const compactIds=rootFocusIds.length?rootFocusIds:(readOnly?nodes.slice(0,9):nodes.slice(0,2)).map((node)=>node.id);return <div className="flex h-full min-h-0 flex-col">{!readOnly&&onCustomNodes?<GraphCustomControls groups={groups} selectedIds={selectedIds} nodeIds={graph.nodes.map((n)=>n.id)} onChange={changeGroups}/>:null}<div className="min-h-0 flex-1"><GraphCanvas<CanvasNode,FlowEdge> ariaLabel="Workflow canvas" showMinimap={!readOnly} nodes={nodes} edges={edges} nodeTypes={nodeTypes} edgeTypes={graphRoutedEdgeTypes}diff --git a/frontend/slices/workflows/lib/compact-focus.test.ts b/frontend/slices/workflows/lib/compact-focus.test.tsnew file mode 100644index 00000000..2a00bab8--- /dev/null+++ b/frontend/slices/workflows/lib/compact-focus.test.ts@@ -0,0 +1,26 @@+import { describe, expect, it } from "vitest";+import type { WorkflowGraphNode } from "@/lib/contracts/workflow-graph";+import { compactWorkflowFocusIds } from "./compact-focus";++const node = (id: string, type: WorkflowGraphNode["type"], sessionRoot = false): WorkflowGraphNode => ({+ id, name: id, type, position: { x: 0, y: 0 }, config: sessionRoot ? { sessionRoot: true } : {},+});++describe("compact workflow focus", () => {+ it("prefers triggers over arbitrary storage order", () => {+ const nodes = [node("downstream", "tool"), node("start", "manual"), node("later", "output")];+ expect(compactWorkflowFocusIds(nodes, [], new Set(nodes.map((row) => row.id)), 2)).toEqual(["start"]);+ });++ it("maps triggers inside collapsed custom nodes to their visible proxy", () => {+ const nodes = [node("start", "schedule"), node("task", "tool")];+ const groups = [{ id: "custom-entry", name: "Entry", nodeIds: ["start", "task"], collapsed: true }];+ expect(compactWorkflowFocusIds(nodes, groups, new Set(["custom-entry"]), 2)).toEqual(["custom-entry"]);+ });++ it("includes semantic session roots and deduplicates a shared collapsed proxy", () => {+ const nodes = [node("a", "tool", true), node("b", "webhook")];+ const groups = [{ id: "custom-entry", name: "Entry", nodeIds: ["a", "b"], collapsed: true }];+ expect(compactWorkflowFocusIds(nodes, groups, new Set(["custom-entry"]), 9)).toEqual(["custom-entry"]);+ });+});diff --git a/frontend/slices/workflows/lib/compact-focus.ts b/frontend/slices/workflows/lib/compact-focus.tsnew file mode 100644index 00000000..3fe1f6c8--- /dev/null+++ b/frontend/slices/workflows/lib/compact-focus.ts@@ -0,0 +1,20 @@+import type { WorkflowGraphNode } from "@/lib/contracts/workflow-graph";+import type { GraphCustomNode } from "@/lib/contracts/graph-custom-nodes";++const triggerTypes = new Set(["manual", "schedule", "webhook"]);++/** Compact panes should anchor on workflow entry points, even when a trigger is inside a collapsed group. */+export function compactWorkflowFocusIds(+ nodes: WorkflowGraphNode[],+ groups: GraphCustomNode[],+ visibleIds: Set<string>,+ limit: number,+): string[] {+ const owner = new Map<string, string>();+ for (const group of groups) if (group.collapsed) for (const nodeId of group.nodeIds) owner.set(nodeId, group.id);+ const triggers = nodes+ .filter((node) => triggerTypes.has(node.type) || node.config.sessionRoot === true)+ .map((node) => owner.get(node.id) ?? node.id);+ const unique = [...new Set(triggers)].filter((id) => visibleIds.has(id));+ return unique.slice(0, Math.max(1, limit));+}diff --git a/scripts/graph-route-cache.test.ts b/scripts/graph-route-cache.test.tsnew file mode 100644index 00000000..e8d89163--- /dev/null+++ b/scripts/graph-route-cache.test.ts@@ -0,0 +1,76 @@+import { describe, expect, it } from "vitest";+import { computeConnectorRoute, createRoutingScene, GraphRouteCache, type ConnectorRequest } from "../components/shared/graph-route-cache";++const request: ConnectorRequest = {+ id: "edge", source: "source", target: "target",+ a: { x: 100, y: 40 }, b: { x: 121, y: 40 },+ sourceSide: "right", targetSide: "left",+};++describe("shared graph route cache", () => {+ it("keeps a clear short facing connection direct instead of marking a false overlap", () => {+ const scene = createRoutingScene([+ { id: "source", x: 0, y: 0, width: 100, height: 80 },+ { id: "target", x: 121, y: 0, width: 100, height: 80 },+ ], [{ id: "edge", source: "source", target: "target" }]);+ expect(computeConnectorRoute(scene, request)).toMatchObject({+ points: [request.a, request.b], blocked: false,+ });+ });++ it("reuses an unaffected route when an unrelated obstacle moves", () => {+ const edges = [{ id: "edge", source: "source", target: "target" }];+ const sceneA = createRoutingScene([+ { id: "source", x: 0, y: 0, width: 100, height: 80 },+ { id: "target", x: 121, y: 0, width: 100, height: 80 },+ { id: "other", x: 500, y: 300, width: 120, height: 80 },+ ], edges);+ const sceneB = createRoutingScene([+ { id: "source", x: 0, y: 0, width: 100, height: 80 },+ { id: "target", x: 121, y: 0, width: 100, height: 80 },+ { id: "other", x: 650, y: 420, width: 120, height: 80 },+ ], edges);+ const cache = new GraphRouteCache();+ const first = cache.resolve(sceneA, request);+ const second = cache.resolve(sceneB, request);+ expect(second).toBe(first);+ expect(cache.computations).toBe(1);+ expect(cache.hits).toBe(1);+ });++ it("reuses all 400 cached routes for an unrelated node movement at the supported edge limit", () => {+ const edges = Array.from({ length: 400 }, (_, index) => ({ id: `edge-${index}`, source: "source", target: "target" }));+ const nodesA = [+ { id: "source", x: 0, y: 0, width: 100, height: 80 },+ { id: "target", x: 121, y: 0, width: 100, height: 80 },+ ...Array.from({ length: 198 }, (_, index) => ({ id: `other-${index}`, x: 500 + index * 8, y: 400 + (index % 9) * 100, width: 80, height: 60 })),+ ];+ const nodesB = nodesA.map((node) => node.id === "other-197" ? { ...node, x: node.x + 200, y: node.y + 200 } : node);+ const sceneA = createRoutingScene(nodesA, edges);+ const sceneB = createRoutingScene(nodesB, edges);+ expect(new Set(sceneA.lanes.values()).size).toBe(400);+ expect(Math.min(...sceneA.lanes.values())).toBe(0);+ expect(Math.max(...sceneA.lanes.values())).toBe(399);+ const cache = new GraphRouteCache();+ for (const edge of edges) cache.resolve(sceneA, { ...request, id: edge.id });+ for (const edge of edges) cache.resolve(sceneB, { ...request, id: edge.id });+ expect(cache.computations).toBe(400);+ expect(cache.hits).toBe(400);+ });++ it("recomputes when endpoint geometry changes", () => {+ const edges = [{ id: "edge", source: "source", target: "target" }];+ const sceneA = createRoutingScene([+ { id: "source", x: 0, y: 0, width: 100, height: 80 },+ { id: "target", x: 121, y: 0, width: 100, height: 80 },+ ], edges);+ const sceneB = createRoutingScene([+ { id: "source", x: 0, y: 0, width: 100, height: 80 },+ { id: "target", x: 180, y: 0, width: 100, height: 80 },+ ], edges);+ const cache = new GraphRouteCache();+ cache.resolve(sceneA, request);+ cache.resolve(sceneB, { ...request, b: { x: 180, y: 40 } });+ expect(cache.computations).toBe(2);+ });+});diff --git a/scripts/graph-routing-provider.test.ts b/scripts/graph-routing-provider.test.tsnew file mode 100644index 00000000..b08f863c--- /dev/null+++ b/scripts/graph-routing-provider.test.ts@@ -0,0 +1,13 @@+import { readFileSync } from "node:fs";+import { describe, expect, it } from "vitest";++describe("graph-level routing ownership", () => {+ it("owns the obstacle scene above individual routed edges", () => {+ const canvas = readFileSync("components/shared/graph-canvas.tsx", "utf8");+ const edge = readFileSync("components/shared/graph-routed-edge.tsx", "utf8");+ expect(canvas).toContain("<GraphRoutingProvider");+ expect(edge).not.toContain("useNodes");+ expect(edge).not.toContain("useEdges");+ expect(edge).toContain("routing.cache.resolve");+ });+});