Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

feat(chat): restyle the inline message editor as a composer plate

vastsa8f4d764e35f0
diff --git a/apps/desktop/src/features/chat/transcript/MessageRow.tsx b/apps/desktop/src/features/chat/transcript/MessageRow.tsx
index 8ac4e2329..69fe4f46f 100644
--- a/apps/desktop/src/features/chat/transcript/MessageRow.tsx
+++ b/apps/desktop/src/features/chat/transcript/MessageRow.tsx
@@ -93,7 +93,14 @@ export const MessageRow = memo(function MessageRow({
{isUser || displayed ? (
<div className="message-bubble">
{editing && editableUserMessage ? (
- <div className="message-edit">
+ <form
+ className="message-edit"
+ aria-busy={retryingEdit || undefined}
+ onSubmit={(event) => {
+ event.preventDefault();
+ void retryEdit();
+ }}
+ >
<textarea
className="message-edit-input selectable"
value={editValue}
@@ -117,22 +124,21 @@ export const MessageRow = memo(function MessageRow({
<div className="message-edit-actions">
<button
type="button"
- className="copy-btn"
+ className="icon-btn message-edit-cancel"
disabled={retryingEdit}
onClick={cancelEdit}
>
{t("chat.cancelEdit")}
</button>
<button
- type="button"
- className="copy-btn primary"
+ type="submit"
+ className="send-btn message-edit-submit"
disabled={retryingEdit || (!editValue.trim() && !message.attachments?.length)}
- onClick={() => void retryEdit()}
>
{retryingEdit ? t("chat.retryingEdit") : t("chat.retryEdit")}
</button>
</div>
- </div>
+ </form>
) : isUser ? (
<>
{extraAttachments.length ? (
diff --git a/apps/desktop/src/styles/messages.css b/apps/desktop/src/styles/messages.css
index 3372ee4e1..9a239cf3a 100644
--- a/apps/desktop/src/styles/messages.css
+++ b/apps/desktop/src/styles/messages.css
@@ -1338,11 +1338,26 @@
font-variant-numeric: tabular-nums;
}
+/* Compact composer plate: same surface, radius, and shadow lift as the
+ bottom composer. The textarea is unboxed; actions sit in a 28px footer. */
.message-edit {
display: flex;
width: min(100%, 720px);
+ margin: 0;
flex-direction: column;
- gap: 8px;
+ border: 0;
+ border-radius: var(--ds-composer-radius, var(--radius-xl));
+ background: var(--ds-bg-composer);
+ box-shadow: var(--ds-shadow-composer);
+ isolation: isolate;
+ transition:
+ background var(--motion-duration-fast) var(--motion-ease-out),
+ box-shadow var(--motion-duration-normal) var(--motion-ease-out);
+}
+
+/* Focus deepens the lift; the plate never gains a stroke (D297). */
+.message-edit:focus-within {
+ box-shadow: 0 7px 24px color-mix(in oklab, var(--ds-text-primary) 9%, transparent);
}
/* A prompt being edited needs typing room, so the user column drops its
@@ -1354,34 +1369,65 @@
.message-row.user .message-bubble:has(.message-edit) {
width: 100%;
+ max-width: 100%;
+ border-radius: 0;
background: transparent;
padding: 0;
}
.message-edit-input {
+ display: block;
width: 100%;
- min-height: 112px;
- max-height: 50vh;
- resize: vertical;
+ min-height: 3lh;
+ max-height: min(12lh, 50vh);
+ resize: none;
+ overflow-y: auto;
border: 0;
- border-radius: var(--radius-md-plus);
- background: var(--ds-raised);
- box-shadow: var(--ds-raised-shadow);
- padding: 10px 12px;
+ background: transparent;
+ padding: 12px 14px 8px;
color: var(--ds-text-primary);
font: inherit;
+ font-size: var(--text-base);
line-height: var(--leading-chat);
outline: none;
+ white-space: pre-wrap;
+ overflow-wrap: break-word;
}
-.message-edit-input:focus {
- box-shadow: 0 0 0 2px color-mix(in oklab, var(--ds-accent) 30%, transparent);
+.message-edit-input:focus,
+.message-edit-input:focus-visible {
+ outline: none;
+ box-shadow: none;
}
.message-edit-actions {
display: flex;
+ align-items: center;
justify-content: flex-end;
gap: 4px;
+ padding: 4px 8px 8px;
+}
+
+.message-edit-cancel {
+ height: 28px;
+ min-height: 28px;
+ padding: 0 10px;
+ color: var(--ds-text-secondary);
+ font-size: var(--text-sm);
+ font-weight: var(--font-weight-medium);
+ line-height: var(--leading-compact);
+ white-space: nowrap;
+}
+
+.send-btn.message-edit-submit {
+ width: auto;
+ min-width: 28px;
+ flex: 0 0 auto;
+ padding: 0 12px;
+ font-size: var(--text-sm);
+ font-weight: var(--font-weight-medium);
+ line-height: var(--leading-compact);
+ white-space: nowrap;
}
.message-revision-label {
diff --git a/apps/desktop/src/styles/responsive.css b/apps/desktop/src/styles/responsive.css
index bcf7429e3..db3a01baf 100644
--- a/apps/desktop/src/styles/responsive.css
+++ b/apps/desktop/src/styles/responsive.css
@@ -74,6 +74,8 @@
.composer-shell,
.composer-shell:focus-within,
+ .message-edit,
+ .message-edit:focus-within,
.btn,
.icon-btn,
.send-btn,
diff --git a/apps/desktop/test/transcript-style.test.mjs b/apps/desktop/test/transcript-style.test.mjs
index 35a59014b..26dbd08b5 100644
--- a/apps/desktop/test/transcript-style.test.mjs
+++ b/apps/desktop/test/transcript-style.test.mjs
@@ -269,6 +269,13 @@ test("editing a user prompt regenerates it and keeps the old branch reachable",
stylesSource,
/\.message-row\.user \.message-col:has\(\.message-edit\)/,
);
+ assert.match(
+ stylesSource,
+ /\.message-edit \{[\s\S]*?background:\s*var\(--ds-bg-composer\);[\s\S]*?box-shadow:\s*var\(--ds-shadow-composer\);/,
+ );
+ assert.match(stylesSource, /\.message-edit:focus-within/);
+ assert.match(transcriptSource, /className="icon-btn message-edit-cancel"/);
+ assert.match(transcriptSource, /className="send-btn message-edit-submit"/);
});
test("message toolbars are icon-only with hover tooltips", () => {
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index b10413b40..a57c13815 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -1540,14 +1540,16 @@ Single message render — either user (plaintext) or assistant (markdown streami
selected assistant response, requires an idle source, and leaves that
source's transcript, live runtime, and provider cache state untouched (D134).
Edit belongs to the user turn: it swaps the prompt bubble for a focused
- inline textarea (Escape cancels, Cmd/Ctrl+Enter retries; slash turns seed the
- typed `command` form so retrying re-expands the template), widens the user
- column to the assistant reading width while open, and hides the action
- toolbar. The inline controls are localized Retry and Cancel actions. Retry
- runs the Regenerate path with the current text in the same session, even when
- the text is unchanged, so the replaced prompt and its whole answer tail are
- archived as a D109 revision and the pager walks back to the original
- exchange (D274).
+ composer-plate editor (same `--ds-bg-composer` fill, `--ds-composer-radius`,
+ and shadow lift as the bottom composer; no stroke per D297). The textarea is
+ unboxed inside that plate; localized Retry and Cancel sit in a 28px footer
+ (Escape cancels, Cmd/Ctrl+Enter retries; slash turns seed the typed
+ `command` form so retrying re-expands the template). Opening it widens the
+ user column to the assistant reading width and hides the action toolbar.
+ Retry runs the Regenerate path with the current text in the same session,
+ even when the text is unchanged, so the replaced prompt and its whole
+ answer tail are archived as a D109 revision and the pager walks back to
+ the original exchange (D274).
- Tool-mediated assistant output uses one visual turn from the preceding user
message to the next user message. Intermediate provider message boundaries
remain visible as ordered markdown fragments around activity disclosures but
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 78b03370f..4c261bafc 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -4152,8 +4152,8 @@ identify the platform validation still needed.
streaming, its toolbar omits
Copy; after the response settles, the assistant toolbar offers Copy, Fork,
Regenerate. The user toolbar offers the pager (when variants exist), Copy,
- Edit, Delete. Edit replaces the prompt bubble with a wider inline
- textarea with Retry and Cancel controls; Escape or Cancel restores the bubble
+ Edit, Delete. Edit replaces the prompt bubble with a wider composer-matched
+ inline editor plate with Retry and Cancel controls; Escape or Cancel restores the bubble
unchanged. Retry truncates the transcript from that prompt and streams a new
answer whether or not the text changed, leaving a `current / total` pager on
the user turn that restores the original prompt with its full answer tail in
diff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.md
index 1c779e9f7..86c4e37b2 100644
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@ -1135,11 +1135,12 @@ tail 不得将该寻呼机从用户气泡中移动或分离。寻呼机是
Fork 创建并激活一个独立的会话,其快照结束于
选择辅助响应,需要一个空闲源,然后留下
源的转录本、实时运行时和提供程序缓存状态保持不变 (D134)。
- 编辑属于用户回合:它将提示气泡替换为焦点
- 内联文本区域(Escape 取消,Cmd/Ctrl+Enter 重试;斜杠转为种子
- 输入 `command` 表单,重试后会重新扩展模板),扩大用户范围
- 打开时将列调整为助理阅读宽度,并隐藏操作
- 工具栏。内联控件显示本地化的“重试”和“取消”。重试运行同一会话的
+ 编辑属于用户回合:它将提示气泡替换为与底部输入框同族的
+ composer 面板(`--ds-bg-composer` 填充、`--ds-composer-radius`、阴影抬升,
+ 无描边,D297)。文本区域嵌在面板内不加第二层底;底部 28px 工具条放本地化的
+ “重试”和“取消”(Escape 取消,Cmd/Ctrl+Enter 重试;斜杠转为种子
+ 输入 `command` 表单,重试后会重新扩展模板)。打开时把用户列加宽到
+ 助理阅读宽度,并隐藏操作工具栏。重试运行同一会话的
重新生成路径,即使文本没有变化也会执行,因此替换的提示及其整个答案
尾部被存档为 D109 修订版,寻呼机可以返回原来的交换(D274)。
- 工具介导的辅助输出使用前一用户的视觉转向