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): make tool calls follow conversation width
vastsa21d3a27900a9
diff --git a/apps/desktop/src/styles/messages.css b/apps/desktop/src/styles/messages.cssindex b37e16456..68f78ca38 100644--- a/apps/desktop/src/styles/messages.css+++ b/apps/desktop/src/styles/messages.css@@ -1801,10 +1801,19 @@overflow-clip-margin: 8px;}+/*+ * A disclosure header is a row, not a chip. A content-sized `inline-flex`+ * header (the whole process, an ordinary group, a subagent card) stopped at+ * its own label, so the tool call never used the conversation width: it stayed+ * narrow next to full-width prose and did not change when the band was dragged+ * wider, and a long label overran the chip because only the level-specific+ * overrides below carried an ellipsis. The row claims the band like every+ * other transcript row; the label ellipsizes and the caret trails it.+ */.tool-activity-header {- display: inline-flex;+ display: flex;+ width: 100%;min-width: 0;- max-width: 100%;min-height: 26px;align-items: center;gap: 5px;@@ -1827,9 +1836,14 @@color: var(--ds-text-muted);}+/* Long labels ellipsize inside the band-wide header instead of overrunning it. */.tool-activity-label {- flex: none;+ min-width: 0;+ flex: 0 1 auto;+ overflow: hidden;font-weight: var(--font-weight-medium);+ text-overflow: ellipsis;+ white-space: nowrap;}.tool-activity-count {@@ -1852,9 +1866,11 @@white-space: nowrap;}+/* The caret closes the row, so a short label keeps it at the trailing edge. */.tool-activity-caret {display: inline-flex;flex: none;+ margin-inline-start: auto;color: var(--ds-text-muted);opacity: 0.65;transition: transform var(--motion-duration-fast) var(--motion-ease-out);@@ -1906,20 +1922,15 @@background: var(--ds-tile);}+/* The subagent card only re-dresses the shared header row: its material is the+ card itself, so the row loses the radius and the bleed. */.tool-activity-group.has-subagents .tool-activity-header {- display: flex;- width: 100%;- max-width: none;min-height: 42px;margin: 0;border-radius: 0;padding: 10px 16px;}-.tool-activity-group.has-subagents .tool-activity-caret {- margin-inline-start: auto;-}-.subagent-activity-metrics {min-width: 0;overflow: hidden;@@ -2256,7 +2267,11 @@}}+/* A tool row claims the conversation column whatever its parent displays as:+ the disclosure header is the row's only width-bearing box. */.tool-row {+ width: 100%;+ min-width: 0;margin: 3px 0;}@@ -3034,25 +3049,9 @@padding-inline-start: 12px;}-.process-activity-group > .tool-activity-header,-.turn-process > .tool-activity-header {- display: flex;- width: 100%;-}--.process-activity-group > .tool-activity-header > .tool-activity-label,-.turn-process > .tool-activity-header > .tool-activity-label {- min-width: 0;- flex: 0 1 auto;- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;-}--.process-activity-group > .tool-activity-header > .tool-activity-caret,-.turn-process > .tool-activity-header > .tool-activity-caret {- margin-inline-start: auto;-}+/* The nested process levels share the base header row: no level-specific+ width, label or caret overrides are needed now that the row claims the+ band itself (see `.tool-activity-header`). */.thinking-compact {display: flex;@@ -3104,7 +3103,10 @@text-decoration: underline;}+/* The title ellipsizes inside the row: an inline-flex anchor would otherwise+ let a long source name push the host label past the band. */.hosted-search-source-title {+ min-width: 0;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;diff --git a/apps/desktop/test/transcript-style.test.mjs b/apps/desktop/test/transcript-style.test.mjsindex 4d1c9b91e..1115885ec 100644--- a/apps/desktop/test/transcript-style.test.mjs+++ b/apps/desktop/test/transcript-style.test.mjs@@ -122,6 +122,50 @@ test("tool details do not add a second visual indent", () => {assert.match(stylesSource, /\.subagent-topology-node > \.tool-row-body,[\s\S]*?margin-left:\s*38px;/);});+/*+ * The width regression this guards: a content-sized `inline-flex` disclosure+ * header stopped at its own label, so a tool call never used the conversation+ * width — it stayed narrower than the prose, ignored the dragged band width,+ * and let a long label overrun the chip. The header row now claims the band at+ * every level, the label ellipsizes, and the caret trails the row.+ */+test("tool-call disclosure headers span the conversation band", () => {+ const header = stylesSource.match(/\n\.tool-activity-header \{([^}]*)\}/)?.[1];+ assert.ok(header);+ assert.match(header, /display:\s*flex;/);+ assert.match(header, /width:\s*100%;/);+ assert.match(header, /min-width:\s*0;/);+ // A chip default (content width) or a max-width cap would freeze the row.+ assert.doesNotMatch(header, /inline-flex|max-width/);++ const label = stylesSource.match(/\n\.tool-activity-label \{([^}]*)\}/)?.[1];+ assert.ok(label);+ assert.match(label, /text-overflow:\s*ellipsis;/);+ assert.match(label, /min-width:\s*0;/);+ assert.match(label, /white-space:\s*nowrap;/);++ const caret = stylesSource.match(/\n\.tool-activity-caret \{([^}]*)\}/)?.[1];+ assert.ok(caret);+ assert.match(caret, /margin-inline-start:\s*auto;/);++ // No level keeps its own width or label override: every disclosure header+ // resolves through the single base row.+ assert.doesNotMatch(+ stylesSource,+ /\.(process-activity-group|turn-process) > \.tool-activity-header[^{]*\{[^}]*width:/,+ );+ assert.doesNotMatch(+ stylesSource,+ /\.tool-activity-group\.has-subagents \.tool-activity-header \{[^}]*width:/,+ );++ // A tool row itself owns the column so no parent display mode can shrink it.+ const row = stylesSource.match(/\n\.tool-row \{([^}]*)\}/)?.[1];+ assert.ok(row);+ assert.match(row, /width:\s*100%;/);+ assert.match(row, /min-width:\s*0;/);+});+test("assistant turns stay transparent full-width prose", () => {assert.match(stylesSource,diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.mdindex 52af422fb..c8855a6d6 100644--- a/docs/spec/04-ux/08-component-spec.md+++ b/docs/spec/04-ux/08-component-spec.md@@ -752,6 +752,9 @@ reading surface of the workstation.- Background: bg-primary- Max content width: 760px default, user-resizable (D439); assistant rows follow the band. User plates stay `min(82%, 600px)`+ subagent card, or a single tool row — spans that band: its header is a+ full-width row with an ellipsizing label and a trailing caret, never a+ content-sized chip, so it follows the dragged width instead of its own text.- The transcript keeps one stable scrollbar gutter on the trailing edge. Itnever reserves a matching left gutter, so the minimap and first message donot leave a decorative blank strip beside the session.diff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.mdindex fd6fc9c7c..1c2120fba 100644--- a/docs/zh-CN/spec/04-ux/08-component-spec.md+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md@@ -1194,6 +1194,7 @@ row 而不是在转录本中添加树镶边。### 8.3 布局- 最大内容带:760px 线程列;助理身体最大720px+- 工具调用的每一级披露行(整个处理过程、活动组、子代理卡片、单条工具行)都铺满该内容带:标题行是全宽行,标签过长时省略号,箭头贴在行尾,而不是按自身文字宽度收缩的小块,因此跟随用户拖拽后的宽度变化,不会停在原地。- 用户:右对齐、主题中性的软板(主墨水上的 `color-mix`,从来没有固定的口音色调),无边界,`radius-lg-plus` 更紧右下角,上限为 `min(82%, 600px)`,因此简短的提示如下