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): move enhancement prompt card to AI (#627)
Lanf79199a4aa8a
diff --git a/apps/desktop/src/components/settings/EnhancementModelCard.tsx b/apps/desktop/src/components/settings/EnhancementModelCard.tsxindex 01880a076..1d80d2109 100644--- a/apps/desktop/src/components/settings/EnhancementModelCard.tsx+++ b/apps/desktop/src/components/settings/EnhancementModelCard.tsx@@ -1,14 +1,14 @@/*** Enhancement prompt model and reasoning (ADR 0121).*- * Which model rewrites the Composer draft, and with how much reasoning, are- * model decisions, so they live on this page next to the default model. They get- * their own card rather than joining the Defaults card: that card's rows pair a- * short value with one control, and the enhancement model needs a title, the- * current value, and a picker — the same shape as the default-model row, which- * has a card of its own for exactly that reason.+ * 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.*- * The picker reuses the default-model anchored menu so the page offers one kind+ * 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.*/import { useMemo, useState } from "react";@@ -29,7 +29,7 @@ import { Button, Input, cx } from "../ui";import { IconCheck, IconChevronDown, IconSearch } from "../icons";import { AnchoredMenu } from "./AnchoredMenu";import { SettingsMenuSelect } from "./SettingsMenuSelect";-import { SettingsRow } from "../../features/settings/primitives";+import { SettingsCard, SettingsRow } from "../../features/settings/primitives";import { defaultModelOptions } from "./default-model";import {groupSubagentModelChoices,@@ -157,11 +157,7 @@ export function EnhancementModelCard() {};return (- <section className="settings-card-block">- <div className="model-config-section-head">- <h3 className="settings-card-heading">{t("settings.promptEnhancementModelTitle")}</h3>- </div>- <div className="settings-panel model-default-panel">+ <SettingsCard title={t("settings.promptEnhancementModelTitle")}><SettingsRowtitle={t("settings.promptEnhancementModel")}description={@@ -316,7 +312,6 @@ export function EnhancementModelCard() {}/></SettingsRow>- </div>- </section>+ </SettingsCard>);}diff --git a/apps/desktop/src/components/settings/ModelConfigPage.tsx b/apps/desktop/src/components/settings/ModelConfigPage.tsxindex 0303b77ac..e5be50edc 100644--- a/apps/desktop/src/components/settings/ModelConfigPage.tsx+++ b/apps/desktop/src/components/settings/ModelConfigPage.tsx@@ -38,7 +38,6 @@ import {} from "./default-model";import { copyProviderConfiguration, type ProviderCopyDraft } from "./provider-copy";import { ProviderSetupDialog } from "./ProviderSetupDialog";-import { EnhancementModelCard } from "./EnhancementModelCard";import { VendorAccountsSection } from "./VendorAccountsSection";const DELETE_CONFIRM_MS = 3000;@@ -418,8 +417,6 @@ export function ModelConfigPage() {</div></section>- <EnhancementModelCard />-<section className="settings-card-block"><div className="model-config-section-head"><div className="settings-card-heading-line">diff --git a/apps/desktop/src/features/settings/SettingsPage.tsx b/apps/desktop/src/features/settings/SettingsPage.tsxindex 32b6d1df8..bd6556237 100644--- a/apps/desktop/src/features/settings/SettingsPage.tsx+++ b/apps/desktop/src/features/settings/SettingsPage.tsx@@ -30,6 +30,7 @@ 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";@@ -437,6 +438,7 @@ 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 20f61b108..68e731f98 100644--- a/apps/desktop/src/features/settings/prompt-enhancement-card.tsx+++ b/apps/desktop/src/features/settings/prompt-enhancement-card.tsx@@ -4,7 +4,7 @@* 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,- * is a model decision and lives on the Model configuration page.+ * lives on the same AI tab in the Enhancement prompt card below this one.** What is deliberately not editable: the system prompt. It carries the rewrite* contract the feature is verified against (proper-noun preservation, languagediff --git a/apps/desktop/src/lib/settings-search.ts b/apps/desktop/src/lib/settings-search.tsindex bd704b9c0..b694b7999 100644--- a/apps/desktop/src/lib/settings-search.ts+++ b/apps/desktop/src/lib/settings-search.ts@@ -95,6 +95,10 @@ export const SETTINGS_NAV: SettingsNavEntry[] = ["settings.promptEnhancementCustomTemplate","settings.promptEnhancementEdit","settings.promptEnhancementUserTemplate",+ "settings.promptEnhancementModelTitle",+ "settings.promptEnhancementModel",+ "settings.promptEnhancementModelFollow",+ "settings.promptEnhancementThinking","settings.largePasteThreshold",],},@@ -127,10 +131,6 @@ export const SETTINGS_NAV: SettingsNavEntry[] = [titleKey: "settings.configuration",group: "agent",keywordKeys: [- "settings.promptEnhancementModelTitle",- "settings.promptEnhancementModel",- "settings.promptEnhancementModelFollow",- "settings.promptEnhancementThinking","settings.providers","settings.models","settings.defaultModel",diff --git a/apps/desktop/test/prompt-enhancement.test.mjs b/apps/desktop/test/prompt-enhancement.test.mjsindex c448730f3..6de2f1e99 100644--- a/apps/desktop/test/prompt-enhancement.test.mjs+++ b/apps/desktop/test/prompt-enhancement.test.mjs@@ -103,7 +103,7 @@ 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 Model configuration page, not here.+ // The model and reasoning rows live on the sibling Enhancement prompt card, not here.assert.doesNotMatch(card, /promptEnhancementProviderId/);assert.doesNotMatch(card, /promptEnhancementThinkingLevel/);assert.doesNotMatch(card, /promptEnhancementModelId/);@@ -187,14 +187,31 @@ test("the default ceiling is about a minute", () => {assert.equal(PROMPT_ENHANCEMENT_TIMEOUT_MS, 60_000);});-test("the enhancement model and reasoning live on their own Model-page card", async () => {+test("the enhancement model and reasoning live on the AI tab next to the prompt card", async () => {+ const settingsPage = await read("../src/features/settings/SettingsPage.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");- // The Models page mounts the dedicated card rather than inlining the rows.- assert.match(modelPage, /EnhancementModelCard/);+ const aiStart = settingsPage.indexOf('{tab === "ai" && settings && (');+ const 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(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, /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.match(card, /t\("settings\.promptEnhancementModel"\)/);@@ -208,7 +225,8 @@ test("the enhancement model and reasoning live on their own Model-page card", asassert.match(card, /promptEnhancementModelUnavailable/);assert.match(card, /pickModel/);- // The rows use the shared settings row, not an ad-hoc layout.+ // The rows use the shared settings card and row, not an ad-hoc layout.+ assert.match(card, /SettingsCard/);assert.match(card, /SettingsRow/);});@@ -230,7 +248,7 @@ test("the reasoning row follows the selected model's real ladder", async () => {assert.doesNotMatch(card, /promptEnhancementThinkingFollow/);});-test("the model-page copy exists in both reference locales", () => {+test("the enhancement-model copy exists in both reference locales", () => {for (const source of [en, zh]) {for (const key of ["promptEnhancementModelTitle",diff --git a/apps/desktop/test/settings-general.test.mjs b/apps/desktop/test/settings-general.test.mjsindex b77bff00d..cc562e39d 100644--- a/apps/desktop/test/settings-general.test.mjs+++ b/apps/desktop/test/settings-general.test.mjs@@ -110,6 +110,8 @@ test("Basics and AI tabs expose their respective app and AI controls", () => {assert.match(aiSource, /enterToSend: !settings\.enterToSend/);assert.match(aiSource, /LargePasteThresholdRow/);assert.match(aiSource, /ContextUsageDisplayRow/);+ assert.match(aiSource, /PromptEnhancementCard/);+ assert.match(aiSource, /EnhancementModelCard/);assert.match(settingsPageSource,/saveSettings\(\{ contextUsageDisplay: value \}\)/,@@ -225,6 +227,7 @@ test("model configuration keeps model defaults; AI owns app behavior defaults",assert.match(providersSource, /settings\.defaultModel/);assert.doesNotMatch(providersSource, /enterToSend/);assert.doesNotMatch(providersSource, /settings\.modeAgent/);+ assert.doesNotMatch(providersSource, /EnhancementModelCard/);});test("default model selector shows every configured model under its provider", () => {@@ -361,6 +364,7 @@ test("settings nav keeps a flat searchable index with titled visual groups", ()assert.doesNotMatch(generalEntry, /settings\.defaultsTitle/);assert.match(aiEntry, /settings\.defaultsTitle/);assert.match(aiEntry, /settings\.commandShell/);+ assert.match(aiEntry, /settings\.promptEnhancementModelTitle/);assert.match(settingsSearchSource, /keywordKeys/);assert.match(settingsSearchSource, /settings\.projectArchive/);assert.doesNotMatch(stylesSource, /\.token-usage-page/);diff --git a/docs/adr/0121-one-shot-composer-prompt-enhancement.md b/docs/adr/0121-one-shot-composer-prompt-enhancement.mdindex f1eb3b234..7058a5826 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-18 (user-overridable templates; enhancement model pin)+- Updated: 2026-09-20 (enhancement model card on Settings → AI)- Related: Issue #14, Issue #562## Context@@ -59,11 +59,12 @@ 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 the Model-configuration page, in their own card titled "Enhancement prompt", because both-are model decisions and the model picker needs a title and a current value rather-than a bare control;-the prompt card keeps only the switch and the template editor. The enhancement+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 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 991f4ee0b..3cf3ff086 100644--- a/docs/spec/04-ux/06-settings-ia.md+++ b/docs/spec/04-ux/06-settings-ia.md@@ -163,15 +163,16 @@ Settings is a **full-window page** that replaces the app sidebar + main chrome (template without that variable is refused. The system prompt is built in andexposes no field. Settings search indexes the card, its switch, and thetemplate row.-- **Enhancement prompt** is its own card on the Models tab, below Defaults,- because both fields are model decisions and the model picker needs the- title/value/control shape the Defaults rows do not have. Its `Default model`- row uses the same anchored, searchable menu as the Defaults card's row; empty- means "follow the Composer's current model". Two rows therefore read `Default- model`, distinguished by their card headings. 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.+- **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.- **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 5d79a753b..2a2de261e 100644--- a/docs/spec/04-ux/12-prompt-enhancement.md+++ b/docs/spec/04-ux/12-prompt-enhancement.md@@ -132,12 +132,12 @@ stored as absent rather than as an empty string.### Enhancement model and reasoning-Which model runs the rewrite, and with how much reasoning, are model decisions-and live on Settings -> Models, in their own card titled `Enhancement prompt`,-below the Defaults 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 single-control row shape the Defaults-card uses.+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.| Field | Effect when empty ||---|---|@@ -145,9 +145,9 @@ card uses.| `promptEnhancementThinkingLevel` | `off` |The card's model row is titled `Default model` and uses the same anchored,-searchable menu as the Defaults card's row, so the page shows 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+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`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 d6a3b149d..919b84d8e 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -6209,3 +6209,14 @@ that was sitting at the bottom — including after the turn had finished.in the inspector. Archived records stay grouped and visible.- Presentation only: no IPC, storage, or host protocol change. See`04-ux/06-settings-ia.md` and E2E-038.++## 2026-09-20 — Prompt-enhancement model card moves to Settings → AI++- Amend ADR 0121 and the 2026-09-18 D447 placement: the Enhancement prompt card+ (default model + reasoning) leaves Settings → Models and sits on Settings → AI+ immediately below Prompt enhancement, so the template and the rewrite model for+ the same Composer action live on one destination. The card keeps its own title+ because the model picker still needs title / current value / control. Settings+ search indexes those rows on the AI tab. Presentation only: no IPC, storage, or+ host-protocol change. See `04-ux/06-settings-ia.md` and+ `04-ux/12-prompt-enhancement.md` §5.diff --git a/docs/zh-CN/spec/04-ux/06-settings-ia.md b/docs/zh-CN/spec/04-ux/06-settings-ia.mdindex c1d7fbcf7..ff94fa6c6 100644--- a/docs/zh-CN/spec/04-ux/06-settings-ia.md+++ b/docs/zh-CN/spec/04-ux/06-settings-ia.md@@ -95,12 +95,11 @@开关会保留已存文本。弹窗内含用户模板编辑器;未保存覆盖值时显示内置默认文本,并提供插入草稿变量的操作。会让模板缺少该变量的保存会被拒绝。系统提示词为内置,不提供任何输入项。设置搜索会索引该卡、其开关与模板行。-- **增强提示词**是「模型」页上一张独立卡片,位于「默认项」之后,因为这两项都是- 模型层面的决定,且模型选择器需要「标题/当前值/控件」的形态,而「默认项」的行形态- 无法承载。其「默认模型」行使用与「默认项」卡片相同行的锚定可搜索菜单;为空表示- 「跟随输入框当前模型」。因此会有两行都题为「默认模型」,靠各自卡片标题区分。思考+- **增强提示词**是「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 ff77ba18c..75c19fef0 100644--- a/docs/zh-CN/spec/04-ux/12-prompt-enhancement.md+++ b/docs/zh-CN/spec/04-ux/12-prompt-enhancement.md@@ -104,17 +104,16 @@ Electron 主进程使用与 agent 回合相同的运行时启动解析器解析### 增强模型与思考强度-改写使用哪个模型、用多大思考强度,属于模型层面的决定,位于设置 → 模型 中一张独立-卡片「增强提示词」内,排在「默认项」卡片之后。该卡之所以自带标题,是因为它包含-一个模型选择器——与默认模型行一样,需要标题、当前值与控件,无法套用「默认项」卡那种-单选控件的行形态。+改写使用哪个模型、用多大思考强度,位于设置 → 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 a5e42b7b7..588588575 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -4457,3 +4457,10 @@ that amendment are retired by ADR 0268; the upstream work-panel lifecycle stays.- 单击行会选中并留在设置页。双击、Enter 或检查器的打开操作激活项目并返回聊天。归档和关闭仍使该目的地保持打开(D133 / D267)。- 文件夹、对话(按最新活动、每批 8 条)和原有菜单放在检查器中。归档记录仍分组可见。- 仅演示层:无 IPC、存储或宿主协议改动。见 `04-ux/06-settings-ia.md` 与 E2E-038。++## 2026-09-20 —— 提示词增强模型卡移到设置 → AI++- 修订 ADR 0121 与 2026-09-18 D447 的放置:增强提示词卡(默认模型 + 思考强度)离开设置 → 模型,+ 放到设置 → AI,紧挨提示词增强之后,让同一操作的模板与改写模型在同一目的地。该卡仍自带标题,+ 因为模型选择器需要标题 / 当前值 / 控件。设置搜索在 AI 页索引这两行。仅演示层:无 IPC、存储或+ 宿主协议改动。见 `04-ux/06-settings-ia.md` 与 `04-ux/12-prompt-enhancement.md` §5。