Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(chat): align delegation connectors with actual card centers
Linuxdazhao1e7239640fe8
diff --git a/apps/desktop/src/styles/messages.css b/apps/desktop/src/styles/messages.cssindex fd211b865..feb93b7b4 100644--- a/apps/desktop/src/styles/messages.css+++ b/apps/desktop/src/styles/messages.css@@ -2474,6 +2474,7 @@/* Nodes are raised tiles on the group's tile; connectors are tinted 2px barsrather than hairlines, and the dotted canvas is gone (D297). */.subagent-topology {+ --subagent-node-gap: 10px;display: grid;min-width: 0;grid-template-columns: minmax(138px, 0.58fr) 34px minmax(248px, 1.42fr);@@ -2541,21 +2542,10 @@position: relative;display: grid;min-width: 0;- gap: 10px;+ gap: var(--subagent-node-gap);padding-left: 14px;}-.subagent-topology-agents::before {- position: absolute;- top: 36px;- bottom: 36px;- left: 0;- width: 2px;- border-radius: var(--radius-full);- background: var(--ds-tile-deep);- content: "";-}-.subagent-topology-node {position: relative;min-width: 0;@@ -2567,14 +2557,37 @@.subagent-topology-node::before {position: absolute;- top: 35px;+ top: calc(50% - 1px);right: 100%;- width: 15px;+ width: 14px;height: 2px;background: var(--ds-tile-deep);content: "";}+.subagent-topology-agents > .subagent-topology-node {+ margin: 0;+}++/* Each card contributes a stem segment; only the outer ends stop at centers. */+.subagent-topology-node::after {+ position: absolute;+ top: calc(var(--subagent-node-gap) / -2);+ bottom: calc(var(--subagent-node-gap) / -2);+ left: -14px;+ width: 2px;+ background: var(--ds-tile-deep);+ content: "";+}++.subagent-topology-node:first-child::after {+ top: 50%;+}++.subagent-topology-node:last-child::after {+ bottom: 50%;+}+.subagent-stop-button {display: inline-flex;flex: none;@@ -2824,17 +2837,15 @@.subagent-topology-connector {width: 2px;height: 18px;- margin-left: 28px;+ margin-left: 14px;}.subagent-topology-agents {padding-left: 28px;}- .subagent-topology-agents::before {+ .subagent-topology-node:first-child::after {top: 0;- bottom: 36px;- left: 14px;}.subagent-topology-node::before {diff --git a/apps/desktop/test/fixtures/subagent-connector-layout.html b/apps/desktop/test/fixtures/subagent-connector-layout.htmlnew file mode 100644index 000000000..17a46da81--- /dev/null+++ b/apps/desktop/test/fixtures/subagent-connector-layout.html@@ -0,0 +1,71 @@+<!doctype html>+<html lang="en">+<meta charset="utf-8">+<title>Delegation connector layout regression</title>+<link rel="stylesheet" href="../../src/styles/messages.css">+<style>+ * { box-sizing: border-box; }+ body { display: block; margin: 16px; }+ article { container: subagent-activity / inline-size; margin-bottom: 24px; }+ .subagent-topology-root, .subagent-topology-node { background: #eee; }+</style>+<body>+<script>+ for (const [id, width, heights] of [+ ['mixed', 760, [70, 88, 112]], ['single', 760, [88]],+ ['narrow', 420, [70, 112, 88]], ['narrow-single', 420, [112]],+ ]) {+ const article = document.createElement('article');+ article.id = id;+ article.style.width = width + 'px';+ article.innerHTML = `<section class="subagent-topology">+ <div class="subagent-topology-root">Main agent</div>+ <span class="subagent-topology-connector"></span>+ <div class="subagent-topology-agents">${heights.map((height, index) =>+ `<div class="tool-row subagent-topology-node" style="height:${height}px">Worker ${index + 1}</div>`).join('')}</div>+ </section>`;+ document.body.append(article);+ }+ window.addEventListener('load', () => {+ const errors = [];+ let checks = 0;+ const close = (actual, expected, name) => {+ checks++;+ if (!Number.isFinite(actual) || Math.abs(actual - expected) > 0.51) errors.push(`${name}: ${actual} != ${expected}`);+ };+ const pseudo = (element, name) => {+ const style = getComputedStyle(element, name), rect = element.getBoundingClientRect();+ if (style.content === 'none' || style.content === 'normal') return null;+ return { x: rect.left + parseFloat(style.left), y: rect.top + parseFloat(style.top),+ width: parseFloat(style.width), height: parseFloat(style.height) };+ };+ for (const article of document.querySelectorAll('article')) {+ const group = article.querySelector('.subagent-topology-agents');+ const nodes = [...group.children], bounds = nodes.map(node => node.getBoundingClientRect());+ const narrow = article.clientWidth <= 520;+ const stemX = bounds[0].left - 14;+ const segments = [pseudo(group, '::before'), ...nodes.map(node => pseudo(node, '::after'))]+ .filter(segment => segment && segment.width > 0 && segment.width <= 2 && segment.height > 0)+ .sort((a, b) => a.y - b.y);+ nodes.forEach((node, index) => {+ const branch = pseudo(node, '::before');+ close(branch.y + branch.height / 2, bounds[index].top + bounds[index].height / 2, article.id + ' branch center');+ close(branch.x, stemX, article.id + ' branch starts at stem');+ close(branch.x + branch.width, bounds[index].left, article.id + ' branch reaches card');+ });+ if (nodes.length > 1 || narrow) {+ close(segments[0]?.y ?? NaN, narrow ? group.getBoundingClientRect().top : bounds[0].top + bounds[0].height / 2, article.id + ' stem start');+ const last = segments.at(-1), lastNode = bounds.at(-1);+ close(last?.y + last?.height, lastNode.top + lastNode.height / 2, article.id + ' stem end');+ for (let index = 1; index < segments.length; index++)+ close(segments[index - 1].y + segments[index - 1].height, segments[index].y, article.id + ' stem continuity');+ }+ if (narrow) {+ const connector = article.querySelector('.subagent-topology-connector').getBoundingClientRect();+ close(connector.left, stemX, article.id + ' incoming vertical alignment');+ }+ }+ window.layoutResult = { checks, errors, passed: errors.length === 0 };+ document.title = window.layoutResult.passed ? 'PASS: delegation connectors' : 'FAIL: delegation connectors';+ });+</script>diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.mdindex 27d5479bd..9406f31fa 100644--- a/docs/spec/04-ux/08-component-spec.md+++ b/docs/spec/04-ux/08-component-spec.md@@ -2690,6 +2690,12 @@ summary can wrap rather than forcing the user to resize the divider. Completedescriptions remain available through the node's accessible name/hover title;the node and its live process never create horizontal overflow.+Topology connectors use actual card centers rather than fixed pixel offsets.+Per-card vertical stem segments join across the list gap and terminate at the+first/last branch. The narrow-layout incoming connector shares the stem's axis,+including a single-worker topology. Variable card heights do not leave dangling+stem tails or detached branches.+An accepted steering message creates a new visual reply without ending theparent runtime turn. Earlier delegation cards in that running turn keep theirlive status and Stop controls across steering replies and compaction dividers.diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 45ca80605..2ef76b1c6 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -20842,3 +20842,17 @@ does not qualify native Electron interaction or live-provider execution.#### E2E-ISSUE-1926-scratch-prefixBuild two actual runtimes with identical configuration and different scratch directories. Their leading runtime system sections match; each trailing context retains its own path. Check PowerShell/POSIX guidance and custom system prompt behavior. Coverage: runtime.test.ts. No paid provider requests or cache-hit claims.++#### E2E-ISSUE-2350: Delegation connector centers and stem endpoints++- Serve `apps/desktop` locally and open+ `test/fixtures/subagent-connector-layout.html` in a browser. This isolated+ fixture loads the production stylesheet and publishes `window.layoutResult`.+- Verify `passed: true` and an empty `errors` array across mixed-height+ 70/88/112px cards, a single card, and both 760px and 420px topology widths.+ Branches meet card centers, vertical segments remain continuous and end at+ the outer branch centers, and narrow incoming lines share the stem axis.+- Repeat the rendered delegation user path with running/settled workers and+ wrapped descriptions; preserve detail navigation, Stop and responsive layout.+- Qualification: isolated Chromium geometry checks cover this layout regression;+ installed-client and live-provider checks remain separate.