Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
refactor(settings): give modes and roles dedicated detail pages
v_wyxgwang7cb109378048
diff --git a/apps/desktop/src/features/modes/ModeBundleTabs.tsx b/apps/desktop/src/features/modes/ModeBundleTabs.tsxindex ac89ab7c8..454414659 100644--- a/apps/desktop/src/features/modes/ModeBundleTabs.tsx+++ b/apps/desktop/src/features/modes/ModeBundleTabs.tsx@@ -1,25 +1,11 @@-/**- * The three tabs of one mode's settings (issue #2544).- *- * These cards render in the existing Settings content area, without a nested- * modal, drawer, or sidebar.- *- * Model and thinking controls appear only under the role they belong to: the- * mode itself follows the session model and has no model setting. A role's own- * pin, its ordered fallbacks and each fallback's thinking level are its own- * file's business, and this tab is where that file is edited.- *- * The skills tab is read-only except for one switch per skill: the issue gives- * the page no create, import, edit or delete there. The user drops a skill- * folder into the mode directory themselves and the host validates it.- */-import { useMemo } from "react";+/** Mode definition, prompt, private role, and skill editors. */+import { ChevronLeft, ChevronRight } from "lucide-react";+import { useId, useMemo, useState } from "react";import { useTranslation } from "react-i18next";import {SUBAGENT_ASSIGNABLE_TOOLS,SUBAGENT_THINKING_LEVELS,imageGenerationBindings,- isSubagentMutatingTool,type ModeSkillsResult,type SubagentThinkingLevel,} from "@pi-desktop/shared";@@ -28,7 +14,7 @@ import {Button,Checkbox,Field,- HelpIcon,+ SegmentedControl,Input,SettingsToggle,Textarea,@@ -46,7 +32,6 @@ import { useAppStore } from "../../stores/app-store";import {addRoleReference,bundleList,- bundleScalar,includeGlobalSubagents,modeRoleRows,setBundleList,@@ -94,19 +79,18 @@ function useRoleModelChoices() {export function ModeTab({draft,setDraft,- promptFile,+ section,disabled,}: {draft: ModeBundleDraft;setDraft: (next: ModeBundleDraft) => void;- promptFile: string;+ section: "mode" | "prompt";disabled: boolean;}) {const { t } = useTranslation();const includeGlobals = includeGlobalSubagents(draft.source);- return (- <>- <SettingsCard title={t("modes.settings.tabMode")}>+ return section === "mode" ? (+ <SettingsCard title={t("modes.settings.modeMap")}><SettingsRowtitle={t("modes.settings.includeGlobalSubagents")}>@@ -123,7 +107,6 @@ export function ModeTab({/></SettingsRow><div className="modes-settings-tab-field">- <Field label={t("modes.settings.modeMap")}><TextareaclassName="modes-settings-source"value={draft.source}@@ -131,10 +114,10 @@ export function ModeTab({disabled={disabled}onChange={(event) => setDraft({ ...draft, source: event.target.value })}/>- </Field></div></SettingsCard>- <SettingsCard title={t("modes.settings.promptTitle")} caption={promptFile}>+ ) : (+ <SettingsCard title={t("modes.settings.promptTitle")}><div className="modes-settings-tab-field"><TextareaclassName="modes-settings-source"@@ -145,7 +128,6 @@ export function ModeTab({/></div></SettingsCard>- </>);}@@ -198,11 +180,19 @@ export function SubagentsTab({const agents = { ...draft.agents };delete agents[row.reference];setDraft({ ...draft, agents, source: setBundleList(draft.source, "subagents", remaining) });- onSelect(remaining[0] ?? null);+ onSelect(null);};- return (- <>+ return row ? (+ <RoleEditor+ key={row.reference}+ row={row}+ disabled={disabled}+ onBack={() => onSelect(null)}+ onChange={(source) => write(row.reference, source)}+ onRemove={removeRole}+ />+ ) : (<SettingsCardtitle={t("modes.settings.rolesTitle")}action={@@ -214,10 +204,10 @@ export function SubagentsTab({<div className="modes-settings-list" role="list" aria-label={t("modes.settings.rolesTitle")}>{rows.map((role) => (<div role="listitem" key={role.reference}>- <button+ <Buttontype="button"className="modes-settings-row"- aria-current={role.reference === selected || undefined}+ variant="ghost"data-role-reference={role.reference}title={role.description || undefined}disabled={disabled}@@ -225,7 +215,6 @@ export function SubagentsTab({><span className="modes-settings-row-copy"><span>{role.name}</span>- <span className="modes-settings-row-id">{role.reference}</span></span><span className="modes-settings-row-badges"><Badge tone={role.inheritsModel ? "neutral" : "success"}>@@ -233,22 +222,13 @@ export function SubagentsTab({</Badge>{role.thinkingLevel ? <Badge>{role.thinkingLevel}</Badge> : null}</span>- </button>+ <ChevronRight size={14} aria-hidden="true" />+ </Button></div>))}</div>{rows.length === 0 ? <p className="modes-settings-hint">{t("modes.settings.rolesEmpty")}</p> : null}</SettingsCard>- {row ? (- <RoleEditor- key={row.reference}- row={row}- disabled={disabled}- onChange={(source) => write(row.reference, source)}- onRemove={removeRole}- />- ) : null}- </>);}@@ -265,11 +245,13 @@ function RoleEditor({row,disabled,onChange,+ onBack,onRemove,}: {row: ModeRoleRow;disabled: boolean;onChange: (source: string) => void;+ onBack: () => void;onRemove: () => void;}) {const { t } = useTranslation();@@ -279,9 +261,30 @@ function RoleEditor({const write = (next: RoleDocument) => onChange(serializeRoleDocument(next));const orphan = subagentModelOrphanPin(role.model, choices);+ const [section, setSection] = useState<RoleSection>("identity");+ const sectionId = useId();+ const options = ROLE_SECTIONS.map(({ value, label }) => ({+ value, label: t(label), id: sectionId + "-" + value, controls: sectionId + "-panel-" + value,+ }));+ const active = options.find((option) => option.value === section);+return (- <SettingsCard title={row.name} caption={row.reference}>- <div className="modes-settings-tab-fields">+ <div className="settings-stack" data-testid="mode-role-detail">+ <div className="modes-settings-page-head">+ <Button size="sm" variant="ghost" onClick={onBack}>+ <ChevronLeft size={14} aria-hidden="true" />+ {t("modes.settings.rolesTitle")}+ </Button>+ <Button size="sm" variant="ghost" disabled={disabled} onClick={onRemove}>+ {t("modes.settings.removeRole")}+ </Button>+ </div>+ <h3 className="modes-settings-role-title">{row.name}</h3>+ <div className="modes-settings-tabs">+ <SegmentedControl role="tablist" value={section} onChange={setSection} options={options} label={row.name} />+ </div>+ <div className="modes-settings-tab-fields" role="tabpanel" id={active?.controls} aria-labelledby={active?.id}>+ {section === "identity" && (<div className="ext-field-pair"><Field label={t("extensions.subagents.name")}><Input@@ -298,20 +301,8 @@ function RoleEditor({/></Field></div>-- <div className="ext-field-group">- <div className="ext-field-label">- {t("extensions.subagents.tools")}- <HelpIcon- label={t(- role.inheritTools- ? "extensions.subagents.toolsInheritHint"- : role.tools.some(isSubagentMutatingTool)- ? "extensions.subagents.mutatingHint"- : "extensions.subagents.toolsHint",- )}- />- </div>+ )}+ {section === "tools" && (<div className="ext-tool-pick" role="group" aria-label={t("extensions.subagents.tools")}><Checkboxlabel={t("extensions.subagents.toolsInherit")}@@ -331,17 +322,10 @@ function RoleEditor({/>))}</div>- </div>-+ )}+ {section === "model" && <><div className="ext-field-pair">- <Field- label={t("extensions.subagents.model")}- hint={- choices.length > 0- ? t("extensions.subagents.modelHint")- : t("extensions.subagents.modelPickEmpty")- }- >+ <Field label={t("extensions.subagents.model")}><SubagentModelPickervalue={subagentModelSelectValue(role.model, choices)}groups={groups}@@ -350,7 +334,7 @@ function RoleEditor({onChange={(next) => write({ ...role, model: next })}/></Field>- <Field label={t("extensions.subagents.thinking")} hint={t("extensions.subagents.thinkingHint")}>+ <Field label={t("extensions.subagents.thinking")}><SettingsMenuSelectfullWidthlabel={t("extensions.subagents.thinking")}@@ -362,10 +346,7 @@ function RoleEditor({</Field></div>- <Field- label={t("extensions.subagents.fallbackModels")}- hint={t("extensions.subagents.fallbackModelsHint")}- >+ <Field label={t("extensions.subagents.fallbackModels")}><ol className="modes-settings-fallbacks">{role.fallbacks.map((fallback, index) => (<li key={`${index}:${fallback.model}`} className="modes-settings-fallback">@@ -435,7 +416,8 @@ function RoleEditor({/>) : null}</Field>-+ </>}+ {section === "prompt" && (<Field label={t("extensions.subagents.body")}><TextareaclassName="ext-skill-body"@@ -447,17 +429,20 @@ function RoleEditor({onChange={(event) => write({ ...role, body: event.target.value })}/></Field>-- <div className="modes-settings-tab-actions">- <Button size="sm" variant="ghost" disabled={disabled} onClick={onRemove}>- {t("modes.settings.removeRole")}- </Button>- </div>+ )}</div>- </SettingsCard>+ </div>);}+const ROLE_SECTIONS = [+ { value: "identity", label: "extensions.subagents.name" },+ { value: "tools", label: "extensions.subagents.tools" },+ { value: "model", label: "extensions.subagents.model" },+ { value: "prompt", label: "modes.settings.promptTitle" },+] as const;+type RoleSection = (typeof ROLE_SECTIONS)[number]["value"];+function thinkingOptions(t: (key: string) => string) {return [{ id: "", label: t("extensions.subagents.thinkingInherit") },@@ -471,11 +456,6 @@ function thinkingOptions(t: (key: string) => string) {/* --- Skills tab ----------------------------------------------------------- */-/** The map's declared prompt reference, for the Mode tab's caption. */-export function promptReference(source: string): string {- return bundleScalar(source, "promptFile") ?? "";-}-/*** The mode's own `skills/` folder: where it is, a way to open it, and one* switch per discovered skill.@@ -506,7 +486,6 @@ export function SkillsTab({}><div className="modes-settings-directory">- <span className="settings-row-title">{t("modes.settings.skillsDirectory")}</span><span className="modes-settings-path" data-testid="modes-skills-directory">{state?.directory ?? ""}</span>@@ -514,7 +493,7 @@ export function SkillsTab({<div className="modes-settings-list" role="list" aria-label={t("modes.settings.skillsTitle")}>{(state?.skills ?? []).map((skill) => (<div role="listitem" key={skill.id}>- <SettingsRow title={skill.name} detail={<code>{`/skill:${skill.id}`}</code>}>+ <SettingsRow title={skill.name}><SettingsTogglechecked={skill.enabled}label={t("settings.enableCapability", { name: skill.name })}diff --git a/apps/desktop/src/features/modes/ModesSettingsPage.tsx b/apps/desktop/src/features/modes/ModesSettingsPage.tsxindex cfac0bb79..e7f3f3e47 100644--- a/apps/desktop/src/features/modes/ModesSettingsPage.tsx+++ b/apps/desktop/src/features/modes/ModesSettingsPage.tsx@@ -1,4 +1,5 @@import { useEffect, useId, useRef, useState } from "react";+import { ChevronLeft, ChevronRight } from "lucide-react";import { useTranslation } from "react-i18next";import type { ModeDocumentValidation, ModeSkillsResult } from "@pi-desktop/shared";import { Badge, Button, Field, Input, SegmentedControl, Textarea } from "../../components/ui";@@ -13,13 +14,11 @@ import {bundleDraftDirty,bundleDraftFrom,bundleReferencesChanged,- bundleScalar,disabledSkillsAfterToggle,modeDocumentFormat,modeSettingsTabs,newBundleDraft,newBundleProblem,- openDocumentLabel,setBundleList,type ModeBundleDraft,type ModeDocumentFormat,@@ -39,24 +38,7 @@ import { ModeTab, SkillsTab, SubagentsTab } from "./ModeBundleTabs";import { useModeSourceValidation } from "./use-mode-source-validation";import "../../styles/modes.css";-/**- * Settings → Modes (ADR mode-definitions, issue #2544).- *- * One mode at a time, in three tabs inside the existing settings content area:- *- * - **Mode** — the mode's own definition and the `includeGlobalSubagents`- * switch. A new-format mode edits `mode.yaml` and its prompt document; a- * legacy mode keeps the single Markdown editor it always had, unchanged.- * - **Subagents** — the mode's private role documents, each with its own tools,- * primary model, ordered fallbacks and thinking levels. The mode itself never- * gets a model setting.- * - **Skills** — the mode's `skills/` folder, a button that opens it, and one- * switch per skill. No create, import, edit or delete.- *- * Everything is written through Electron main, so this page never touches a- * file. A read or save that a newer open overtakes is dropped, which is what- * keeps a stale selection from applying the previous mode's documents.- */+/** Settings → Modes owns the catalog, detail navigation, and shared draft. *//** The document open in the editor; `saved: false` is a new or duplicated one. */type OpenDocument = {@@ -77,6 +59,7 @@ const ID_PROBLEM_KEYS: Record<NewModeIdProblem, string> = {const TAB_LABEL_KEYS: Record<ModeSettingsTab, string> = {mode: "modes.settings.tabMode",+ prompt: "modes.settings.promptTitle",subagents: "modes.settings.tabSubagents",skills: "modes.settings.tabSkills",};@@ -104,6 +87,7 @@ export function ModesSettingsPage() {const readTicket = useRef(0);const skillsTicket = useRef(0);const tabsId = useId();+ const pageHeading = useRef<HTMLHeadingElement>(null);const { armed, setArmed } = useArmedDelete();const editable = !!open;const removable = !!open && open.saved && (!open.builtin || !!open.filePath);@@ -130,8 +114,12 @@ export function ModesSettingsPage() {return () => { readTicket.current += 1; };}, []);+ const openId = open?.id;+ const formOpen = idForm !== null;+ useEffect(() => {+ if (!formOpen) pageHeading.current?.focus();+ }, [openId, formOpen]);const entries = settingsModeEntries(catalog);- const promptFile = bundleDraft ? bundleScalar(bundleDraft.source, "promptFile") ?? "" : "";const discardAllowed = () => !dirty || window.confirm(t("modes.settings.discardConfirm"));/** Read one mode's documents, tagged so a stale answer is dropped. */@@ -190,6 +178,17 @@ export function ModesSettingsPage() {if (modeId !== busyModeId && discardAllowed()) void loadMode(modeId);};+ const backToCatalog = () => {+ if (!discardAllowed()) return;+ readTicket.current += 1;+ setLoading(false);+ setIdForm(null);+ setOpen(null);+ setRoleSelection(null);+ setSkills(null);+ setArmed(null);+ };+const idProblem = idForm ? newModeIdProblem(idForm.value.trim(), catalog) : null;// New modes are YAML bundles. Only legacy duplication starts another draft;@@ -398,24 +397,16 @@ export function ModesSettingsPage() {}));return (- <div className="settings-stack" data-testid="modes-settings">- <SettingsCard- title={t("modes.settings.listTitle")}- action={- <Button size="sm" disabled={controlsDisabled} onClick={() => setIdForm({ purpose: "new", value: "" })}>- {t("modes.settings.newMode")}- </Button>- }- >- {catalog ? (- <div className="modes-settings-directory">- <span className="settings-row-title">{t("modes.settings.directory")}</span>- <span className="modes-settings-path" data-testid="modes-directory">- {catalog.directory}- </span>+ <div className="settings-stack modes-settings-page" data-testid="modes-settings">+ {idForm ? (+ <>+ <div className="modes-settings-breadcrumb">+ <Button size="sm" variant="ghost" onClick={backToCatalog}>+ <ChevronLeft size={14} aria-hidden="true" />+ {t("modes.settings.listTitle")}+ </Button></div>- ) : null}- {idForm ? (+ <SettingsCard title={t(idForm.purpose === "new" ? "modes.settings.newMode" : "modes.settings.duplicate")}><ModeIdFormt={t}form={idForm}@@ -423,96 +414,91 @@ export function ModesSettingsPage() {disabled={controlsDisabled}onChange={(value) => setIdForm({ ...idForm, value })}onSubmit={() => void submitIdForm()}- onCancel={() => setIdForm(null)}+ onCancel={() => { setIdForm(null); }}/>- ) : null}- <div className="modes-settings-list" role="list" aria-label={t("modes.settings.listTitle")}>- {entries.map((entry) => {- const diagnostic = modeEntryDiagnostic(catalog, entry);- const selected = !!open && open.id === entry.id && !entry.reserved;+ </SettingsCard>+ </>+ ) : !open ? (+ <>+ <div className="modes-settings-page-head">+ <h2 ref={pageHeading} tabIndex={-1}>{t("modes.settings.listTitle")}</h2>+ <Button size="sm" variant="primary" disabled={controlsDisabled} onClick={() => setIdForm({ purpose: "new", value: "" })}>+ {t("modes.settings.newMode")}+ </Button>+ </div>+ {(["builtin", "user"] as const).map((source) => {+ const group = entries.filter((entry) => entry.source === source);+ if (!group.length) return null;+ const title = t(source === "builtin" ? "modes.settings.builtin" : "modes.settings.user");return (- <div role="listitem" key={modeEntryKey(entry)}>- <button- type="button"- className="modes-settings-row"- aria-current={selected || undefined}- aria-disabled={entry.reserved || busyModeId === entry.id || undefined}- title={entry.reserved ? t("modes.settings.reservedHint") : entry.description || undefined}- data-mode-id={entry.id}- onClick={() => void (entry.reserved ? undefined : openEntry(entry.id))}- >- <span className="modes-settings-row-copy">- <span>{entry.label || entry.id}</span>- <span className="modes-settings-row-id">{entry.id}</span>- {diagnostic.errors[0] ? (- <span className="modes-settings-row-diagnostic">{diagnostic.errors[0]}</span>- ) : null}- </span>- <span className="modes-settings-row-badges">- <Badge>{t(entry.source === "builtin" ? "modes.settings.builtin" : "modes.settings.user")}</Badge>- {entry.customized ? <Badge>{t("modes.settings.customized")}</Badge> : null}- {entry.staged ? <Badge>{t("modes.settings.staged")}</Badge> : null}- {entry.reserved ? (- <Badge tone="warning">{t("modes.settings.reserved")}</Badge>- ) : !entry.available ? (- <Badge tone="error">{t("modes.settings.unavailable")}</Badge>- ) : null}- </span>- </button>- </div>+ <SettingsCard key={source} title={title}>+ <div className="modes-settings-list" role="list" aria-label={title}>+ {group.map((entry) => {+ const diagnostic = modeEntryDiagnostic(catalog, entry);+ return (+ <div role="listitem" key={modeEntryKey(entry)}>+ <Button+ type="button"+ variant="ghost"+ className="modes-settings-row"+ aria-disabled={entry.reserved || busyModeId === entry.id || undefined}+ title={diagnostic.errors[0] ?? (entry.reserved ? t("modes.settings.reservedHint") : undefined)}+ data-mode-id={entry.id}+ onClick={() => { if (!entry.reserved) openEntry(entry.id); }}+ >+ <span className="modes-settings-row-copy">{entry.label || entry.id}</span>+ {entry.customized && <Badge>{t("modes.settings.customized")}</Badge>}+ {entry.staged && <Badge>{t("modes.settings.staged")}</Badge>}+ {entry.reserved ? <Badge tone="warning">{t("modes.settings.reserved")}</Badge>+ : !entry.available ? <Badge tone="error">{t("modes.settings.unavailable")}</Badge> : null}+ <ChevronRight size={14} aria-hidden="true" />+ </Button>+ </div>+ );+ })}+ </div>+ </SettingsCard>);})}- </div>- </SettingsCard>-- {open ? (- <SettingsCard- title={openLabel}- caption={openDocumentLabel(open, open.format)}- action={+ {catalog?.directory && <div className="modes-settings-path" data-testid="modes-directory">{catalog.directory}</div>}+ </>+ ) : (+ <>+ <div className="modes-settings-breadcrumb">+ <Button size="sm" variant="ghost" onClick={backToCatalog}>+ <ChevronLeft size={14} aria-hidden="true" />+ {t("modes.settings.listTitle")}+ </Button>+ </div>+ <div className="modes-settings-page-head">+ <h2 ref={pageHeading} tabIndex={-1}>{openLabel}</h2><div className="modes-settings-editor-actions"><Button size="sm" variant="ghost" disabled={controlsDisabled || (isBundle && !open.saved)} onClick={() => setIdForm({ purpose: "duplicate", value: "" })}>{t("modes.settings.duplicate")}</Button>- {removable ? (+ {removable && (<Button size="sm" variant="ghost" disabled={controlsDisabled} onClick={() => void remove()}>{open.builtin? t(armed === open.id ? "modes.settings.restoreConfirm" : "modes.settings.restore"): t(armed === open.id ? "modes.settings.deleteConfirm" : "modes.settings.delete")}</Button>- ) : null}- <Button- size="sm"- variant="primary"- disabled={controlsDisabled || !dirty || saveBlocked}- onClick={() => void save()}- >+ )}+ <Button size="sm" variant="primary" disabled={controlsDisabled || !dirty || saveBlocked} onClick={() => void save()}>{busy ? t("modes.settings.saving") : t("modes.settings.save")}</Button></div>- }- >+ </div><div className="modes-settings-tabs" data-testid="modes-tabs" data-mode-id={open.id}><SegmentedControlvalue={activeTab}- onChange={(next) => setTab(next)}+ onChange={(next) => { setTab(next); setRoleSelection(null); }}options={tabOptions}label={openLabel}disabled={loading}role="tablist"/></div>- {open.builtin && !isBundle ? (- <p className="modes-settings-hint">- {t("modes.settings.builtinHint", { id: open.id })}- </p>- ) : null}- </SettingsCard>- ) : (- <p className="modes-settings-hint">{t("modes.settings.empty")}</p>- )}-- {open && tabOptions.map(({ value, id, controls }) => (+ {tabOptions.map(({ value, id, controls }) => (<divkey={value}id={controls}@@ -521,11 +507,11 @@ export function ModesSettingsPage() {hidden={activeTab !== value}className={activeTab === value ? "settings-stack" : undefined}>- {value === activeTab && value === "mode" && (isBundle ? (+ {value === activeTab && (value === "mode" || value === "prompt") && (isBundle ? (bundleDraft && <ModeTabdraft={bundleDraft}setDraft={setBundleDraft}- promptFile={promptFile}+ section={value}disabled={controlsDisabled}/>) : (@@ -560,7 +546,9 @@ export function ModesSettingsPage() {/>)}</div>- ))}+ ))}+ </>+ )}</div>);}@@ -591,7 +579,7 @@ function ModeIdForm({onSubmit();}}>- <Field label={t("modes.settings.newModeId")} hint={t("modes.settings.idInvalid")}>+ <Field label={t("modes.settings.newModeId")}><Inputvalue={form.value}autoFocusdiff --git a/apps/desktop/src/features/modes/mode-bundle-model.ts b/apps/desktop/src/features/modes/mode-bundle-model.tsindex 1e1229f21..81418621a 100644--- a/apps/desktop/src/features/modes/mode-bundle-model.ts+++ b/apps/desktop/src/features/modes/mode-bundle-model.ts@@ -1,7 +1,7 @@/*** Pure rules of the grouped mode settings page (issue #2544).*- * The page shows one mode at a time in three tabs — Mode, Subagents, Skills —+ * The page shows one mode at a time in Definition, Prompt, Subagents and Skills.* inside the existing settings container. Nothing here reads files or talks to* IPC: the renderer only decides which tab is offered for the mode that is* open, what the tab's rows are, and how an edit maps onto the bundle the host@@ -26,8 +26,8 @@ import type {} from "@pi-desktop/shared";import { parseRoleDocument } from "./mode-role-document";-/** The three tabs the issue asks for, in the order it asks for them. */-export const MODE_SETTINGS_TABS = ["mode", "subagents", "skills"] as const;+/** Sections of a bundle editor, in navigation order. */+export const MODE_SETTINGS_TABS = ["mode", "prompt", "subagents", "skills"] as const;export type ModeSettingsTab = (typeof MODE_SETTINGS_TABS)[number];/** Tabs offered for a document. A legacy mode has only its own document. */diff --git a/apps/desktop/src/styles/modes.css b/apps/desktop/src/styles/modes.cssindex 70aa84b68..17630cc8e 100644--- a/apps/desktop/src/styles/modes.css+++ b/apps/desktop/src/styles/modes.css@@ -174,6 +174,50 @@}/* Settings → Modes. */+.modes-settings-page-head {+ display: flex;+ min-width: 0;+ flex-wrap: wrap;+ align-items: center;+ justify-content: space-between;+ gap: 8px 16px;+}++.modes-settings-page-head h2,+.modes-settings-role-title {+ min-width: 0;+ margin: 0;+ color: var(--ds-text-primary);+ font-weight: var(--font-weight-strong);+ overflow-wrap: anywhere;+}++.modes-settings-page-head h2 {+ font-size: var(--text-lg);+}++.modes-settings-role-title {+ font-size: var(--text-base);+}++.modes-settings-breadcrumb {+ display: flex;+}++.modes-settings-row > svg {+ flex: 0 0 auto;+ color: var(--ds-text-muted);+}++.modes-settings-row[aria-disabled="true"] > svg {+ visibility: hidden;+}++.modes-settings-tabs > * {+ max-width: 100%;+ flex-wrap: wrap;+}+.modes-settings-list {display: flex;flex-direction: column;@@ -202,26 +246,11 @@}.modes-settings-row-copy {- display: flex;min-width: 0;flex: 1 1 auto;- flex-direction: column;- gap: 2px;-}--.modes-settings-row-id {- color: var(--ds-text-muted);- font-family: var(--font-mono);- font-size: var(--text-xs);+ overflow-wrap: anywhere;}-.modes-settings-row-diagnostic {- overflow: hidden;- color: var(--ds-error);- font-size: var(--text-xs);- text-overflow: ellipsis;- white-space: nowrap;-}.modes-settings-row-badges {display: flex;@@ -270,7 +299,9 @@/* --- Grouped tabs inside the settings content area (issue #2544) ---------- */.modes-settings-tabs {- padding: 8px 12px;+ min-width: 0;+ padding-block-end: 8px;+ border-bottom: 1px solid var(--ds-border-subtle);}.modes-settings-tab-field,@@ -308,6 +339,16 @@min-width: 0;}+@container (max-width: 480px) {+ .modes-settings-page .ext-field-pair {+ grid-template-columns: minmax(0, 1fr);+ }+}++.modes-settings-page {+ container-type: inline-size;+}+.modes-settings-validation {display: flex;flex-direction: column;diff --git a/apps/desktop/test/mode-bundle-settings-renderer.test.mjs b/apps/desktop/test/mode-bundle-settings-renderer.test.mjsindex b178e3150..1f23ff9d1 100644--- a/apps/desktop/test/mode-bundle-settings-renderer.test.mjs+++ b/apps/desktop/test/mode-bundle-settings-renderer.test.mjs@@ -1,7 +1,7 @@/*** Renderer rules for the grouped mode settings page (issue #2544).*- * The page shows one mode in three tabs. What it offers and what a save writes+ * The page shows one mode at a time. What it offers and what a save writes* is decided by pure helpers, so this test exercises those directly: which tabs* a document gets, how the map's keys read, how a role row is described, how a* role document round-trips, and how an out-of-order read is dropped.@@ -48,10 +48,10 @@ const ORACLE = ["",].join("\n");-test("a bundle gets all three tabs and a legacy document only its own", () => {- assert.deepEqual(model.modeSettingsTabs("bundle"), ["mode", "subagents", "skills"]);+test("a bundle has four navigation sections and a legacy document only its own", () => {+ assert.deepEqual(model.modeSettingsTabs("bundle"), ["mode", "prompt", "subagents", "skills"]);assert.deepEqual(model.modeSettingsTabs("legacy"), ["mode"]);- assert.deepEqual(model.MODE_SETTINGS_TABS, ["mode", "subagents", "skills"]);+ assert.deepEqual(model.MODE_SETTINGS_TABS, ["mode", "prompt", "subagents", "skills"]);});test("the entry point decides the format, and a mode with no file starts as YAML", () => {diff --git a/apps/desktop/test/mode-definitions-user-path.test.mjs b/apps/desktop/test/mode-definitions-user-path.test.mjsindex 8d8f20931..480411b2b 100644--- a/apps/desktop/test/mode-definitions-user-path.test.mjs+++ b/apps/desktop/test/mode-definitions-user-path.test.mjs@@ -135,7 +135,11 @@ const skillsDirectory = () => query('[data-testid="modes-skills-directory"]')?.tconst save = () => button(t("modes.settings.save"));const openFolder = () => button(t("modes.settings.openSkillsDirectory"));const click = (node) => flushSync(() => node.click());+const showCatalog = () => {+ if (!query('[data-testid="modes-directory"]')) click(button(t("modes.settings.listTitle")));+};const selectMode = async (id) => {+ showCatalog();click(await waitFor(() => modeRow(id), "Mode row missing: " + id));await waitFor(() => currentId() === id && tabs().every((node) => !node.disabled), "Mode did not open: " + id);};@@ -223,8 +227,13 @@ window.modesProbe = async () => {result.directory = (await waitFor(() => query('[data-testid="modes-directory"]'), "Settings list missing")).textContent;await selectMode("sisyphus");result.tabs = tabLabels();+ result.detailReplacesCatalog = !modeRow("sisyphus") && !query('[data-testid="modes-directory"]');+ result.modeOnly = !prompt();result.source = modeSource().value;+ selectTab("Prompt");result.prompt = prompt().value;+ result.promptOnly = !modeSource();+ selectTab("Mode");result.globalDefault = checked(button(t("modes.settings.includeGlobalSubagents")));click(button(t("modes.settings.includeGlobalSubagents")));click(save());@@ -241,10 +250,12 @@ window.modesProbe = async () => {result.legacyErrorsBlockSave = save().disabled;typeInto(legacySource(), legacyCopy);click(save());- await waitFor(() => modeRow("legacy-copy") && save()?.disabled, "Legacy duplicate did not save");+ await waitFor(() => save()?.disabled, "Legacy duplicate did not save");+ showCatalog();click(await enterId("New mode", "my-mode"));await waitFor(() => currentId() === "my-mode", "New mode not opened");result.newTabs = tabLabels();+ selectTab("Prompt");result.newHasPrompt = prompt().value.length > 0;result.newCanSave = !save().disabled;result.newDuplicateDisabled = button("Duplicate").disabled;@@ -253,7 +264,7 @@ window.modesProbe = async () => {result.newBlankPromptBlocked = save().disabled;typeInto(prompt(), starterPrompt);click(save());- await waitFor(() => modeRow("my-mode") && save()?.disabled, "New bundle was not created");+ await waitFor(() => save()?.disabled, "New bundle was not created");await selectMode("my-mode");result.newReopened = modeSource().value;@@ -262,6 +273,7 @@ window.modesProbe = async () => {await waitFor(() => currentId() === "sisyphus-copy" && save()?.disabled, "Host copy did not open");result.copyMap = modeSource().value;result.copyGlobal = checked(button(t("modes.settings.includeGlobalSubagents")));+ selectTab("Prompt");result.copyPrompt = prompt().value;selectTab("Skills");result.copiedSkillEnabled = checked(await waitFor(() => skillSwitch(), "Copy did not discover its own skill"));@@ -274,18 +286,25 @@ window.modesProbe = async () => {click(button("Cancel"));click(roleRow("agents/oracle.agent.md"));- const model = () => button(t("extensions.subagents.model"));+ result.roleReplacesList = !roleRow("agents/oracle.agent.md") && !!query('[data-testid="mode-role-detail"]');+ const roleDetail = () => query('[data-testid="mode-role-detail"]');+ const showRoleModel = () => click(all('[role="tab"]', roleDetail()).find((tab) => tab.textContent.trim() === t("extensions.subagents.model")));+ showRoleModel();+ const model = () => button(t("extensions.subagents.model"), query('[role="tabpanel"]', roleDetail()));result.roleInitialModel = model().textContent.trim();await choose(model(), "gpt-5");const reasoning = () => button(t("extensions.subagents.thinking"), query(".modes-settings-fallback"));await choose(reasoning(), "medium");click(save());+ click(button(t("modes.settings.rolesTitle"), roleDetail()));+ if (!roleRow("agents/oracle.agent.md") || roleDetail()) throw new Error("Returning from a role did not restore its list");await waitFor(() => save()?.disabled, "Role change did not save");await selectMode("sisyphus");await selectMode("sisyphus-copy");selectTab("Subagents");result.roleSelectionCleared = !query('[data-role-reference][aria-current="true"]');click(roleRow("agents/oracle.agent.md"));+ showRoleModel();result.roleModelReopened = model().textContent.trim();result.fallbackThinkingReopened = reasoning().textContent.trim();@@ -293,15 +312,15 @@ window.modesProbe = async () => {click(await enterId("Duplicate", "occupied"));await waitFor(() => document.body.innerText.includes('the destination "occupied" already exists'), "Host copy conflict was not shown");await waitFor(() => !button("Cancel").disabled, "Conflict did not re-enable form");- result.copyConflict = currentId();click(button("Cancel"));+ result.copyConflict = currentId();await fixture("hold", IPC.invoke.modesCopy, "late-copy");click(await enterId("Duplicate", "late-copy"));await waitFor(() => fixture("held"), "Duplicate reply not held");await selectMode("my-mode");await releaseReply();- await waitFor(() => modeRow("late-copy") && save()?.disabled, "Late copy did not appear in the catalog");+ await waitFor(() => save()?.disabled, "Late copy did not settle");result.modeAfterStaleCopy = [currentId(), modeSource().value];// Refuse writing over an unmanaged path from a saved mode.@@ -317,20 +336,20 @@ window.modesProbe = async () => {selectTab("Skills");await waitFor(() => skillSwitch(), "Private skill not listed");result.skillsDirectory = skillsDirectory();- result.skillLabel = document.body.innerText.includes("/skill:verify-delivery");+ result.skillLabel = !!skillSwitch();result.skillInitiallyOn = checked(skillSwitch());click(openFolder());await waitFor(async () => (await fixture("opened")).length && !openFolder()?.disabled, "Open folder not handed to shell");result.skillsOpened = await fixture("opened");// A mode-local switch must not discard an unrelated prompt draft.- selectTab("Mode");+ selectTab("Prompt");const originalPrompt = prompt().value;typeInto(prompt(), "Unsaved prompt edit");selectTab("Skills");click(skillSwitch());await waitFor(() => checked(skillSwitch()) === "false" && !skillSwitch().disabled, "Skill did not turn off");- selectTab("Mode");+ selectTab("Prompt");result.promptAfterToggle = prompt().value;typeInto(prompt(), originalPrompt);@@ -346,6 +365,7 @@ window.modesProbe = async () => {result.skillPatches = await sent(IPC.invoke.modesBundleSettings);// Complete a bundle read and a skills read out of order.+ showCatalog();await fixture("hold", IPC.invoke.modesBundleRead, "sisyphus");click(modeRow("sisyphus"));await waitFor(() => fixture("held"), "Bundle reply not held");@@ -613,7 +633,11 @@ test("modes: grouped Electron settings create, copy and edit private mode documeinput: "Review the docs too", budget: { maxTurns: 40, maxTokens: 200000 },}]);assert.equal(result.directory, modes);- assert.deepEqual(result.tabs, ["Mode", "Subagents", "Skills"]);+ assert.deepEqual(result.tabs, ["Mode", "Prompt", "Subagents", "Skills"]);+ assert.equal(result.detailReplacesCatalog, true);+ assert.equal(result.modeOnly, true);+ assert.equal(result.promptOnly, true);+ assert.equal(result.roleReplacesList, true);assert.equal(result.source, BUNDLE);assert.equal(result.prompt, PROMPT);assert.equal(result.globalDefault, "false");diff --git a/docs/spec/06-delivery/e2e/plans-goals-automation.md b/docs/spec/06-delivery/e2e/plans-goals-automation.mdindex f6e742ab9..e5d1d7fd3 100644--- a/docs/spec/06-delivery/e2e/plans-goals-automation.md+++ b/docs/spec/06-delivery/e2e/plans-goals-automation.md@@ -20,6 +20,17 @@5. Order two model candidates on one private role. A provider failure switchesthe same child to its configured alternative without repeating a completedwrite. Selecting a different primary pin requires per-invocation authorization.+6. Send a prompt in both a simple YAML mode and a staged YAML mode, including+ a bundle with no private roles or skills. Each reaches the runtime with+ its prompt and permissions; the staged mode retains its claimed stage.+ Remove an active run whose return mode is a YAML mode. The running turn+ releases its run context and applies the return mode's execution definition;+ the Host retains the full return-mode snapshot, including bundle metadata.+7. In Settings → Modes, open an item from the built-in or custom group. The+ detail replaces the catalog. Definition, Prompt, Subagents and Skills+ switch the working pane without clearing the draft. Open a role; its+ editor replaces the role list. Check the role sections, return to the list,+ then return to the catalog with and without unsaved edits.## E2E-SCHEDULED-independent-loading-and-route-return