Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
feat(settings): fold enhancement model into the prompt card (#628)
Lan720d877095e2
diff --git a/apps/desktop/src/components/settings/EnhancementModelCard.tsx b/apps/desktop/src/components/settings/EnhancementModelCard.tsxindex 1d80d2109..45671aa6b 100644--- a/apps/desktop/src/components/settings/EnhancementModelCard.tsx+++ b/apps/desktop/src/components/settings/EnhancementModelCard.tsx@@ -1,12 +1,10 @@/**- * Enhancement prompt model and reasoning (ADR 0121).+ * Enhancement model and reasoning rows (ADR 0121).** Which model rewrites the Composer draft, and with how much reasoning, live- * on Settings → AI, in their own card immediately below Prompt enhancement, so- * the template and the rewrite model for the same action sit together. They get- * their own card rather than joining the prompt card: that card's row is a- * switch plus an icon button, and the enhancement model needs a title, the- * current value, and a picker — the same shape as the default-model row.+ * on the Settings → AI Prompt enhancement card, as rows below the custom-template+ * switch. They are rows rather than a second card so the template, model, and+ * reasoning for the same action share one heading.** The picker reuses the default-model anchored menu so Settings offers one kind* of model picker, and the reasoning row reuses the shared settings menu select.@@ -29,7 +27,7 @@ import { Button, Input, cx } from "../ui";import { IconCheck, IconChevronDown, IconSearch } from "../icons";import { AnchoredMenu } from "./AnchoredMenu";import { SettingsMenuSelect } from "./SettingsMenuSelect";-import { SettingsCard, SettingsRow } from "../../features/settings/primitives";+import { SettingsRow } from "../../features/settings/primitives";import { defaultModelOptions } from "./default-model";import {groupSubagentModelChoices,@@ -157,7 +155,7 @@ export function EnhancementModelCard() {};return (- <SettingsCard title={t("settings.promptEnhancementModelTitle")}>+ <><SettingsRowtitle={t("settings.promptEnhancementModel")}description={@@ -312,6 +310,6 @@ export function EnhancementModelCard() {}/></SettingsRow>- </SettingsCard>+ </>);}diff --git a/apps/desktop/src/features/settings/SettingsPage.tsx b/apps/desktop/src/features/settings/SettingsPage.tsxindex bd6556237..32b6d1df8 100644--- a/apps/desktop/src/features/settings/SettingsPage.tsx+++ b/apps/desktop/src/features/settings/SettingsPage.tsx@@ -30,7 +30,6 @@ import {} from "../../components/icons";import { Button, cx } from "../../components/ui";import { ModelConfigPage } from "../../components/settings/ModelConfigPage";-import { EnhancementModelCard } from "../../components/settings/EnhancementModelCard";import { KeyboardShortcutsSection } from "../../components/settings/KeyboardShortcutsSection";import { FontFamilyRow } from "../../components/settings/FontFamilyRow";import { ThinkingDisplayModeRow } from "../../components/settings/ThinkingDisplayModeRow";@@ -438,7 +437,6 @@ export function SettingsPage() {settings={settings}saveSettings={saveSettings}/>- <EnhancementModelCard /></div>)}diff --git a/apps/desktop/src/features/settings/prompt-enhancement-card.tsx b/apps/desktop/src/features/settings/prompt-enhancement-card.tsxindex 68e731f98..610f65da7 100644--- a/apps/desktop/src/features/settings/prompt-enhancement-card.tsx+++ b/apps/desktop/src/features/settings/prompt-enhancement-card.tsx@@ -1,10 +1,10 @@/*** Prompt-enhancement settings (ADR 0121).*- * This card owns the prompt itself: a switch that chooses between the built-in- * user template and a saved one, and the settings icon button that opens the- * template editor. Which model runs the rewrite, and with how much reasoning,- * lives on the same AI tab in the Enhancement prompt card below this one.+ * This card owns the Composer Enhance prompt action: a switch that chooses+ * between the built-in user template and a saved one, the settings icon button+ * that opens the template editor, and the model plus reasoning rows that pick+ * which model runs the rewrite.** What is deliberately not editable: the system prompt. It carries the rewrite* contract the feature is verified against (proper-noun preservation, language@@ -29,6 +29,7 @@ import {import { Button, Field, TooltipButton, cx, portalOverlay } from "../../components/ui";import { IconPencil, IconX } from "../../components/icons";import { SettingsCard, SettingsRow } from "./primitives";+import { EnhancementModelCard } from "../../components/settings/EnhancementModelCard";export function PromptEnhancementCard({settings,@@ -91,6 +92,8 @@ export function PromptEnhancementCard({</TooltipButton></SettingsRow>+ <EnhancementModelCard />+{editorOpen ? (<PromptEnhancementEditorSheetsettings={settings}diff --git a/apps/desktop/test/prompt-enhancement.test.mjs b/apps/desktop/test/prompt-enhancement.test.mjsindex 6de2f1e99..9c6f707ba 100644--- a/apps/desktop/test/prompt-enhancement.test.mjs+++ b/apps/desktop/test/prompt-enhancement.test.mjs@@ -103,7 +103,8 @@ test("prompt-enhancement settings expose templates, restore, and the draft variaassert.match(card, /const templateChanged = savedTemplateValue !== savedTemplate/);assert.match(card, /settings-icon-button/);assert.match(card, /IconPencil/);- // The model and reasoning rows live on the sibling Enhancement prompt card, not here.+ assert.match(card, /EnhancementModelCard/);+ // Model and reasoning rows are composed in, not inlined on this file.assert.doesNotMatch(card, /promptEnhancementProviderId/);assert.doesNotMatch(card, /promptEnhancementThinkingLevel/);assert.doesNotMatch(card, /promptEnhancementModelId/);@@ -187,8 +188,9 @@ test("the default ceiling is about a minute", () => {assert.equal(PROMPT_ENHANCEMENT_TIMEOUT_MS, 60_000);});-test("the enhancement model and reasoning live on the AI tab next to the prompt card", async () => {+test("the enhancement model and reasoning are rows on the Prompt enhancement card", async () => {const settingsPage = await read("../src/features/settings/SettingsPage.tsx");+ const promptCard = await read("../src/features/settings/prompt-enhancement-card.tsx");const modelPage = await read("../src/components/settings/ModelConfigPage.tsx");const search = await read("../src/lib/settings-search.ts");const card = await read("../src/components/settings/EnhancementModelCard.tsx");@@ -197,23 +199,21 @@ test("the enhancement model and reasoning live on the AI tab next to the promptconst shortcutsStart = settingsPage.indexOf('{tab === "shortcuts" && settings && (');const aiSource = settingsPage.slice(aiStart, shortcutsStart);assert.match(aiSource, /PromptEnhancementCard/);- assert.match(aiSource, /EnhancementModelCard/);- assert.ok(- aiSource.indexOf("PromptEnhancementCard") < aiSource.indexOf("EnhancementModelCard"),- "enhancement model sits below the prompt card",- );+ assert.doesNotMatch(aiSource, /EnhancementModelCard/);+ assert.match(promptCard, /EnhancementModelCard/);assert.doesNotMatch(modelPage, /EnhancementModelCard/);assert.doesNotMatch(modelPage, /promptEnhancementProviderId/);const aiSearch = search.slice(search.indexOf('id: "ai"'), search.indexOf('id: "shortcuts"'));const agentSearch = search.slice(search.indexOf('id: "agent"'), search.indexOf('id: "skills"'));+ assert.match(aiSearch, /promptEnhancementTitle/);assert.match(aiSearch, /promptEnhancementModelTitle/);assert.match(aiSearch, /promptEnhancementThinking/);assert.doesNotMatch(agentSearch, /promptEnhancementModelTitle/);assert.doesNotMatch(agentSearch, /promptEnhancementThinking/);- // Card title and row title are separate strings (B3: both read "Default model").- assert.match(card, /promptEnhancementModelTitle/);+ assert.doesNotMatch(card, /promptEnhancementModelTitle/);+ assert.doesNotMatch(card, /SettingsCard/);assert.match(card, /t\("settings\.promptEnhancementModel"\)/);// Same control as the default-model row: one anchored menu, one search field.@@ -225,8 +225,6 @@ test("the enhancement model and reasoning live on the AI tab next to the promptassert.match(card, /promptEnhancementModelUnavailable/);assert.match(card, /pickModel/);- // The rows use the shared settings card and row, not an ad-hoc layout.- assert.match(card, /SettingsCard/);assert.match(card, /SettingsRow/);});diff --git a/apps/desktop/test/settings-general.test.mjs b/apps/desktop/test/settings-general.test.mjsindex cc562e39d..3780220bb 100644--- a/apps/desktop/test/settings-general.test.mjs+++ b/apps/desktop/test/settings-general.test.mjs@@ -111,7 +111,7 @@ test("Basics and AI tabs expose their respective app and AI controls", () => {assert.match(aiSource, /LargePasteThresholdRow/);assert.match(aiSource, /ContextUsageDisplayRow/);assert.match(aiSource, /PromptEnhancementCard/);- assert.match(aiSource, /EnhancementModelCard/);+ assert.doesNotMatch(aiSource, /EnhancementModelCard/);assert.match(settingsPageSource,/saveSettings\(\{ contextUsageDisplay: value \}\)/,diff --git a/docs/adr/0121-one-shot-composer-prompt-enhancement.md b/docs/adr/0121-one-shot-composer-prompt-enhancement.mdindex 7058a5826..2cdbf6f1c 100644--- a/docs/adr/0121-one-shot-composer-prompt-enhancement.md+++ b/docs/adr/0121-one-shot-composer-prompt-enhancement.md@@ -2,7 +2,7 @@- Status: Accepted- Date: 2026-08-24-- Updated: 2026-09-20 (enhancement model card on Settings → AI)+- Updated: 2026-09-20 (one Prompt enhancement card on Settings → AI)- Related: Issue #14, Issue #562## Context@@ -59,12 +59,9 @@ value. One request is bounded by a 60-second ceiling: expiry aborts thein-flight call (best-effort) and races the promise so the renderer is released,then fails with `TIMEOUT` rather than retrying on the session model.-The enhancement model and its reasoning level are configured on Settings → AI,-in their own card titled "Enhancement prompt", immediately below the Prompt-enhancement card, so the template, model, and reasoning for the same action live-on one destination. The model picker still needs a title and a current value-rather than a bare control, so it keeps its own card rather than joining the-prompt card's switch row; the prompt card keeps the switch and the template editor. The enhancement+The enhancement model and its reasoning level are configured on the same+Settings → AI Prompt enhancement card as the template, as rows below the+custom-template switch. The enhancementmodel follows the Composer's current model unless`promptEnhancementProviderId` / `promptEnhancementModelId` pin another. A pinwhose provider is disabled, whose account is signed out, or whose binding nodiff --git a/docs/spec/04-ux/06-settings-ia.md b/docs/spec/04-ux/06-settings-ia.mdindex 3cf3ff086..97645abcb 100644--- a/docs/spec/04-ux/06-settings-ia.md+++ b/docs/spec/04-ux/06-settings-ia.md@@ -161,18 +161,14 @@ Settings is a **full-window page** that replaces the app sidebar + main chrome (editor, which shows the built-in default text when no override is stored andoffers an insert action for the draft variable; a save that would leave thetemplate without that variable is refused. The system prompt is built in and- exposes no field. Settings search indexes the card, its switch, and the- template row.-- **Enhancement prompt** is its own card on the AI tab, immediately below- Prompt enhancement, so the template and the rewrite model for the same- Composer action live together. Its `Default model` row uses the same- anchored, searchable menu as the Models tab's default-model row; empty- means "follow the Composer's current model". Two rows therefore read- `Default model`, distinguished by their card headings (Prompt enhancement- vs Models Defaults). The reasoning row is a menu select listing the levels- the selected model actually supports (the row is disabled when it supports- none), defaults to Off, and has no follow-the-session entry. Settings- search indexes the card and both rows on the AI tab.+ exposes no field. The same card also has a `Default model` row using the same+ anchored, searchable menu as the Models tab's default-model row; empty means+ "follow the Composer's current model". Two rows therefore read `Default+ model`, distinguished by their card headings (Prompt enhancement vs Models+ Defaults). The reasoning row is a menu select listing the levels the selected+ model actually supports (the row is disabled when it supports none), defaults+ to Off, and has no follow-the-session entry. Settings search indexes the card,+ its switch, the template row, the default-model row, and the reasoning row.- **Thinking display mode** uses a menu select with Detailed (default) andCompact. Detailed retains reasoning text; Compact shows only an activethinking indicator and hides finished thought rows. The global preferencediff --git a/docs/spec/04-ux/12-prompt-enhancement.md b/docs/spec/04-ux/12-prompt-enhancement.mdindex 2a2de261e..764ff4906 100644--- a/docs/spec/04-ux/12-prompt-enhancement.md+++ b/docs/spec/04-ux/12-prompt-enhancement.md@@ -132,22 +132,19 @@ stored as absent rather than as an empty string.### Enhancement model and reasoning-Which model runs the rewrite, and with how much reasoning, live on-Settings -> AI, in their own card titled `Enhancement prompt`, immediately-below the Prompt enhancement card. The card has its own title because it-carries a model picker, which — like the default-model row — needs a title,-the current value, and a control, and does not fit the switch-and-icon-button-row on the prompt card.+Which model runs the rewrite, and with how much reasoning, live on the same+Settings -> AI Prompt enhancement card as the template, as two rows below the+custom-template switch. The model row is titled `Default model` and uses the+same anchored, searchable menu as Settings -> Models' default-model row.| Field | Effect when empty ||---|---|| `promptEnhancementProviderId` + `promptEnhancementModelId` | follow the Composer's current model || `promptEnhancementThinkingLevel` | `off` |-The card's model row is titled `Default model` and uses the same anchored,-searchable menu as Settings -> Models' default-model row, so both destinations-offer one kind of model picker. Both rows therefore read `Default model`; the-card heading is what separates the conversation's default from the enhancement's. When+Both destinations therefore offer one kind of model picker. Both rows read+`Default model`; the card heading (Prompt enhancement vs Models Defaults) is+what separates the conversation's default from the enhancement's. When`promptEnhancementProviderId` is set, the row still shows that pin even if theprovider is gone or disabled, with an unavailable hint. Main prefers the pinand logs a warning plus falls back to the Composer's current model if it cannotdiff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex 919b84d8e..af168e277 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -6220,3 +6220,11 @@ that was sitting at the bottom — including after the turn had finished.search indexes those rows on the AI tab. Presentation only: no IPC, storage, orhost-protocol change. See `04-ux/06-settings-ia.md` and`04-ux/12-prompt-enhancement.md` §5.++## 2026-09-20 — Prompt enhancement is one Settings → AI card++- Amend the same-day two-card placement: the Enhancement prompt card is folded+ into Prompt enhancement on Settings → AI. The custom-template switch, default+ model, and reasoning rows share one heading. Settings search still indexes+ `promptEnhancementModelTitle` so "增强提示词" finds the AI tab. Presentation+ only: no IPC, storage, or host-protocol change.diff --git a/docs/zh-CN/spec/04-ux/06-settings-ia.md b/docs/zh-CN/spec/04-ux/06-settings-ia.mdindex ff94fa6c6..497a4d32a 100644--- a/docs/zh-CN/spec/04-ux/06-settings-ia.md+++ b/docs/zh-CN/spec/04-ux/06-settings-ia.md@@ -94,12 +94,10 @@模式)。开关决定已存模板是否生效,在尚未保存模板时禁用,保存模板后自动打开;关闭开关会保留已存文本。弹窗内含用户模板编辑器;未保存覆盖值时显示内置默认文本,并提供插入草稿变量的操作。会让模板缺少该变量的保存会被拒绝。系统提示词为内置,不提供任何- 输入项。设置搜索会索引该卡、其开关与模板行。-- **增强提示词**是「AI」页上一张独立卡片,紧挨「提示词增强」之后,让同一操作的模板- 与改写模型放在一起。其「默认模型」行使用与「模型」页「默认项」卡片相同行的锚定可搜索菜单;为空表示+ 输入项。同一张卡还有「默认模型」行,使用与「模型」页「默认项」卡片相同行的锚定可搜索菜单;为空表示「跟随输入框当前模型」。因此会有两行都题为「默认模型」,靠各自卡片标题区分(提示词增强 vs 模型默认项)。思考强度行是一个菜单选择器,列出所选模型实际支持的等级(不支持时该行仍显示「关闭思考」并禁用),默认「关闭- 思考」,且不提供「跟随会话」项。设置搜索会在 AI 页索引该卡与这两行。+ 思考」,且不提供「跟随会话」项。设置搜索会索引该卡、其开关、模板行、默认模型行与思考强度行。- 语音绑定(`AppSettings.speech`)**不属于设置页面**(ADR 0291)。宿主仍保留语音能力与`speech/*` IPC,供插件和已存绑定使用;这里不再提供转写/朗读的服务、协议、模型或音色选择,设置搜索也不再索引语音相关键。diff --git a/docs/zh-CN/spec/04-ux/12-prompt-enhancement.md b/docs/zh-CN/spec/04-ux/12-prompt-enhancement.mdindex 75c19fef0..792263fb6 100644--- a/docs/zh-CN/spec/04-ux/12-prompt-enhancement.md+++ b/docs/zh-CN/spec/04-ux/12-prompt-enhancement.md@@ -104,16 +104,15 @@ Electron 主进程使用与 agent 回合相同的运行时启动解析器解析### 增强模型与思考强度-改写使用哪个模型、用多大思考强度,位于设置 → AI 中一张独立卡片「增强提示词」内,-紧挨「提示词增强」卡片之后。该卡之所以自带标题,是因为它包含一个模型选择器——与默认-模型行一样,需要标题、当前值与控件,无法套用提示词卡那种开关加图标按钮的行形态。+改写使用哪个模型、用多大思考强度,位于设置 → AI 的「提示词增强」卡内,作为自定义模板+开关下方的两行。模型行标题为「默认模型」,使用与设置 → 模型「默认项」卡片相同行的锚定可搜索菜单。| 字段 | 为空时的效果 ||---|---|| `promptEnhancementProviderId` + `promptEnhancementModelId` | 跟随输入框当前模型 || `promptEnhancementThinkingLevel` | `off` |-该卡片的模型行标题为「默认模型」,使用与设置 → 模型「默认项」卡片相同行的锚定可搜索菜单,因此两处只呈现一种模型选择交互。+因此两处只呈现一种模型选择交互。当设置了 `promptEnhancementProviderId` 时,该行仍显示该指定项(提供商已消失或已禁用时附不可用提示)。主进程优先使用该指定项;若无法解析,则记录警告并回退到输入框当前模型:过期的指定项只是无法满足的偏好,绝不会成为使该操作不可用的失败。diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.mdindex 588588575..969adb04a 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -4464,3 +4464,7 @@ that amendment are retired by ADR 0268; the upstream work-panel lifecycle stays.放到设置 → AI,紧挨提示词增强之后,让同一操作的模板与改写模型在同一目的地。该卡仍自带标题,因为模型选择器需要标题 / 当前值 / 控件。设置搜索在 AI 页索引这两行。仅演示层:无 IPC、存储或宿主协议改动。见 `04-ux/06-settings-ia.md` 与 `04-ux/12-prompt-enhancement.md` §5。++## 2026-09-20 —— 提示词增强合成一张设置 → AI 卡++- 修订同日的两卡放置:增强提示词卡并入设置 → AI 的提示词增强。自定义模板开关、默认模型与思考强度共用一个标题。设置搜索仍索引 `promptEnhancementModelTitle`,因此搜「增强提示词」仍会落到 AI。仅演示层:无 IPC、存储或宿主协议改动。