Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
chore(merge): integrate latest origin/main
vastsaec04074a93c6
diff --cc apps/desktop/src/components/settings/ModelConfigPage.tsxindex 467f26c77,04142c749..e1ccc7191--- a/apps/desktop/src/components/settings/ModelConfigPage.tsx+++ b/apps/desktop/src/components/settings/ModelConfigPage.tsx@@@ -1,22 -1,16 +1,19 @@@/**- * Model configuration tab: default model, configured AI services, OAuth- * vendor accounts, and the models.dev enrichment snapshot status.+ * Model configuration tab: default model, the AI service list, and the+ * models.dev enrichment snapshot status.+ *+ * API services, plugin-declared services and vendor subscription accounts- * share one list (D623). An account row still lives and dies through the++ * share one list (D625). An account row still lives and dies through the+ * vendor-account editor and `deleteOauthAccount`, never the provider CRUD.** The default picker lists each configured model, while provider rows use* `models[0]` as the provider's quick default. Editing the default provider* preserves `settings.defaultModelId` while that model remains configured, and* adding a provider claims the chat or image default only while none resolves.*/-import { useEffect, useMemo, useRef, useState } from "react";+import { useEffect, useMemo, useState } from "react";import { useTranslation } from "react-i18next";import {- imageGenerationBindings,- isImageGenerationModel,- modelIdsMatch,- OAUTH_AUTH_KIND,type ImageGenerationBinding,type ModelBinding,type ProviderPublic,@@@ -32,14 -26,14 +29,9 @@@ importIconPlus,IconServer,IconSearch,- IconTrash,} from "../icons";import { AnchoredMenu } from "./AnchoredMenu";- import {- defaultModelOptions,- displayedDefaultModelId,- keepsAppDefaultModel,- providerServesChatModels,- } from "./default-model";+ import { providerServesChatModels } from "./default-model";import { planImageGenerationDefaults } from "./image-generation-default";import { copyProviderConfiguration, type ProviderCopyDraft } from "./provider-copy";import { ImageGenerationModelRow } from "./ImageGenerationModelRow";@@@ -60,6 -53,61 +52,51 @@@ type CatalogStatus =lastError?: string;};-/** Host part of a base URL, or an em dash when nothing is configured. */-function hostFromBaseUrl(baseUrl?: string | null): string {- if (!baseUrl) return "—";- try {- return new URL(baseUrl).host || baseUrl;- } catch {- return baseUrl.replace(/^https?:\/\//, "").split("/")[0] || baseUrl;- }-}-+ const sameWireId = (left: string, right: string) => left.toLowerCase() === right.toLowerCase();++ /** Image candidates and chat choices are keyed by complete provider + wire id. */+ function imageCandidates(+ candidates: readonly ImageGenerationBinding[] | null | undefined,+ active: ImageGenerationBinding | null | undefined,+ ): ImageGenerationBinding[] {+ const source = candidates === undefined ? (active ? [active] : []) : candidates ?? [];+ const result: ImageGenerationBinding[] = [];+ for (const entry of source) {+ if (!result.some((other) =>+ other.providerId === entry.providerId && sameWireId(other.modelId, entry.modelId)+ )) result.push(entry);+ }+ if (active && !result.some((entry) =>+ entry.providerId === active.providerId && sameWireId(entry.modelId, active.modelId)+ )) result.push(active);+ return result;+ }++ function isImageCandidate(candidates: readonly ImageGenerationBinding[], providerId: string, modelId: string) {+ return candidates.some((entry) => entry.providerId === providerId && sameWireId(entry.modelId, modelId));+ }++ function chatModelOptions(providers: readonly ProviderPublic[], imageModels: readonly ImageGenerationBinding[]) {+ return providers.flatMap((provider) => {+ const ids = provider.models?.length+ ? provider.models.map((model) => model.id)+ : [provider.defaultModelId ?? ""];+ return ids.filter((id) => !!id.trim() && !isImageCandidate(imageModels, provider.id, id))+ .map((modelId) => ({ provider, modelId }));+ });+ }+++ function displayedChatModelId(+ provider: ProviderPublic,+ selected: string | undefined,+ imageModels: readonly ImageGenerationBinding[],+ ) {+ const configured = chatModelOptions([provider], imageModels).map(({ modelId }) => modelId);+ // Never display a different configured model in place of the saved wire ID.+ return selected?.trim() || configured[0];+ }+export function ModelConfigPage() {const { t, i18n } = useTranslation();const providers = useAppStore((s) => s.providers);@@@ -110,10 -161,13 +147,8 @@@const providerReady = (provider: ProviderPublic) =>providerServesChatModels(provider, imageGenerationCandidates);- const aiProviders = useMemo(- () => providers.filter((provider) => provider.authKind !== OAUTH_AUTH_KIND),- [providers],- );- const reorder = useProviderReorder(aiProviders, busyId !== null || testingId !== null || setupFor !== null);const readyProviders = providers.filter(providerReady);- const defaultModelOptionsList = defaultModelOptions(readyProviders, imageGenerationCandidates);+ const defaultModelOptionsList = chatModelOptions(readyProviders, imageGenerationCandidates);const visibleDefaultModelOptions = useMemo(() => {const query = defaultModelQuery.trim().toLowerCase();if (!query) return defaultModelOptionsList;@@@ -129,12 -183,12 +164,15 @@@providers.find((provider) => provider.id === settings.defaultProviderId) ?? null;const editingProvider =setupFor ? providers.find((provider) => provider.id === setupFor) ?? null : null;+ const editingAccount = editingAccountId+ ? providers.find((provider) => provider.id === editingAccountId) ?? null+ : null;+ const effectiveDefaultModelId = settings.defaultModelId?.trim() ||+ defaultProvider?.models?.[0]?.id || defaultProvider?.defaultModelId;const defaultProviderReady = defaultProvider !== null && providerReady(defaultProvider) &&- !isImageGenerationModel(imageGenerationCandidates, defaultProvider.id,- displayedDefaultModelId(defaultProvider, settings.defaultModelId));+ chatModelOptions([defaultProvider], imageGenerationCandidates).some(+ ({ modelId }) => sameWireId(modelId, effectiveDefaultModelId ?? ""),+ );const setDefaultModel = async (provider: ProviderPublic, modelId: string) => {@@@ -541,51 -602,233 +596,51 @@@</Button></div>) : (- <ul className="model-provider-list" aria-busy={reorder.saving}>- {reorder.providers.map((provider) => {- const isDefault = settings.defaultProviderId === provider.id;- const rowBusy = reorder.saving || busyId === provider.id || testingId === provider.id;- const confirming = confirmDeleteId === provider.id;- const modelCount = provider.models?.length ?? 0;- // A plugin-declared row is refreshed from the plugin's manifest- // on every load, so its fields and its enabled switch are not- // the user's to change. The credential is.- const ownedByPlugin = provider.ownerPluginId;- const keyEntry = keyFor === provider.id;- return (- <li- key={provider.id}- className={cx("model-provider-row", !provider.enabled && "is-disabled", reorder.draggingId === provider.id && "is-dragging")}- data-provider-id={provider.id}- aria-label={t("settings.reorderProvider", { name: provider.name })}- ref={reorder.rowRef(provider.id)}- {...reorder.rowEvents(provider.id)}- >- <div className="model-provider-row-copy">- <div className="model-provider-row-title">- <span className="model-provider-row-name">{provider.name}</span>- {isDefault ? (- <Badge tone="success">{t("settings.default")}</Badge>- ) : null}- {!provider.hasSecret && provider.authKind !== "none" ? (- <Badge tone="warning">{t("settings.noSecret")}</Badge>- ) : null}- {!provider.enabled ? (- <Badge tone="neutral">{t("settings.providerDisabledBadge")}</Badge>- ) : null}- {ownedByPlugin ? (- <span- title={t("settings.pluginProviderManaged", {- plugin: ownedByPlugin,- })}- >- <Badge tone="neutral">{t("settings.pluginProviderBadge")}</Badge>- </span>- ) : null}- </div>- <div className="model-provider-row-meta">- <span>{hostFromBaseUrl(provider.baseUrl)}</span>- <span className="model-provider-meta-dot" aria-hidden>- ·- </span>- <span>{t("settings.providerModelCount", { count: modelCount })}</span>- {ownedByPlugin ? (- <>- <span className="model-provider-meta-dot" aria-hidden>- ·- </span>- <span>{t("settings.pluginProviderBy", { plugin: ownedByPlugin })}</span>- </>- ) : null}- </div>- </div>-- <div className="model-provider-row-actions">- {!isDefault ? (- <Button- size="sm"- variant="ghost"- disabled={rowBusy || !providerReady(provider)}- onClick={() =>- void setDefaultModel(provider, chatModelOptions([provider], imageGenerationCandidates)[0]?.modelId ?? "")- }- >- {t("settings.makeDefault")}- </Button>- ) : null}- {!ownedByPlugin ? (- <TooltipButton- type="button"- className="icon-btn icon-btn-square model-provider-icon-btn"- tooltip={t("settings.copyProvider")}- ariaLabel={t("settings.copyProvider")}- disabled={rowBusy}- onClick={() => {- setCopyDraft(copyProviderConfiguration(provider, t("settings.copyProviderName", { name: provider.name })));- setSetupFor("");- }}- >- <IconCopy size={14} />- </TooltipButton>- ) : null}- {ownedByPlugin && provider.authKind === "api_key" ? (- <TooltipButton- type="button"- className="icon-btn icon-btn-square model-provider-icon-btn"- tooltip={t("settings.pluginProviderKey")}- ariaLabel={t("settings.pluginProviderKey")}- disabled={rowBusy}- onClick={() => {- setKeyFor(keyEntry ? null : provider.id);- setKeyValue("");- }}- >- <IconKey size={14} />- </TooltipButton>- ) : null}- <TooltipButton- type="button"- className="icon-btn icon-btn-square model-provider-icon-btn"- tooltip={- ownedByPlugin- ? t("settings.pluginProviderManaged", { plugin: ownedByPlugin })- : t("settings.editProvider")- }- ariaLabel={t("settings.editProvider")}- disabled={rowBusy || Boolean(ownedByPlugin)}- onClick={() => setSetupFor(provider.id)}- >- <IconPencil size={14} />- </TooltipButton>- <TooltipButton- type="button"- className={cx(- "icon-btn icon-btn-square model-provider-icon-btn",- testingId === provider.id && "is-testing",- )}- tooltip={t("settings.testConnection")}- ariaLabel={t("settings.testConnection")}- disabled={rowBusy}- onClick={() => void testProvider(provider)}- >- <IconPlug size={14} />- </TooltipButton>- {confirming ? (- <button- type="button"- className="model-provider-delete-confirm"- disabled={rowBusy}- onBlur={() => setConfirmDeleteId(null)}- onClick={() => void removeProvider(provider)}- >- {t("settings.deleteConfirm")}- </button>- ) : (- <TooltipButton- type="button"- className="icon-btn icon-btn-square model-provider-icon-btn is-danger"- tooltip={- ownedByPlugin- ? t("settings.pluginProviderManaged", { plugin: ownedByPlugin })- : t("settings.delete")- }- ariaLabel={t("settings.delete")}- disabled={rowBusy || Boolean(ownedByPlugin)}- onClick={() => setConfirmDeleteId(provider.id)}- >- <IconTrash size={14} />- </TooltipButton>- )}- <TooltipButton- type="button"- className={cx("settings-toggle", provider.enabled && "on")}- role="switch"- aria-checked={provider.enabled}- tooltip={- ownedByPlugin- ? t("settings.pluginProviderManaged", { plugin: ownedByPlugin })- : t("settings.enabledToggle")- }- ariaLabel={t("settings.enabledToggle")}- disabled={rowBusy || Boolean(ownedByPlugin)}- onClick={() => void toggleEnabled(provider)}- >- <span className="settings-toggle-thumb" />- </TooltipButton>- </div>- {keyEntry ? (- <div className="model-provider-key-entry">- <Field- label={t("settings.pluginProviderKey")}- hint={t("settings.pluginProviderKeyHint")}- >- <Input- type="password"- autoFocus- value={keyValue}- placeholder={- provider.hasSecret ? t("settings.apiKeyKeepHint") : undefined- }- onChange={(event) => setKeyValue(event.target.value)}- onKeyDown={(event) => {- if (event.key === "Escape") setKeyFor(null);- if (event.key === "Enter") {- void saveProviderKey(provider, keyValue);- }- }}- />- </Field>- <div className="model-provider-key-actions">- <Button- size="sm"- variant="ghost"- disabled={rowBusy}- onClick={() => setKeyFor(null)}- >- {t("settings.cancel")}- </Button>- {provider.hasSecret ? (- <Button- size="sm"- variant="ghost"- disabled={rowBusy}- onClick={() => void saveProviderKey(provider, "")}- >- {t("settings.pluginProviderKeyRemove")}- </Button>- ) : null}- <Button- size="sm"- disabled={rowBusy || !keyValue.trim()}- onClick={() => void saveProviderKey(provider, keyValue)}- >- {t("settings.save")}- </Button>- </div>- </div>- ) : null}- </li>+ <ServiceList+ providers={providers}+ defaultProviderId={settings.defaultProviderId}+ isReady={providerReady}+ accountFor={accountFor}+ busy={+ busyId !== null ||+ testingId !== null ||+ setupFor !== null ||+ editingAccountId !== null ||+ busyAccountId !== null ||+ savingAccount ||+ login !== null+ }+ isRowBusy={(id) => busyId === id || testingId === id || busyAccountId === id}+ testingId={testingId}+ onEdit={(provider) =>+ serviceRowKind(provider) === "account"+ ? setEditingAccountId(provider.id)+ : setSetupFor(provider.id)+ }+ onMakeDefault={(provider) =>+ void setDefaultModel(+ provider,- defaultModelOptions([provider], imageGenerationCandidates)[0]?.modelId ?? "",++ chatModelOptions([provider], imageGenerationCandidates)[0]?.modelId ?? "",+ )+ }+ onTest={(provider) => void testProvider(provider)}+ onCopy={(provider) => {+ setCopyDraft(+ copyProviderConfiguration(+ provider,+ t("settings.copyProviderName", { name: provider.name }),+ ),);- })}- </ul>+ setSetupFor("");+ }}+ onToggleEnabled={(provider) => void toggleEnabled(provider)}+ onRemove={(provider) =>+ void (serviceRowKind(provider) === "account"+ ? removeAccount(provider)+ : removeProvider(provider))+ }+ onSaveKey={saveProviderKey}+ />)}</div></section>diff --cc apps/desktop/src/components/settings/ModelSelectionPanes.tsxindex df2d8b5d5,8bffe093f..7bff35272--- a/apps/desktop/src/components/settings/ModelSelectionPanes.tsx+++ b/apps/desktop/src/components/settings/ModelSelectionPanes.tsx@@@ -209,10 -209,6 +209,10 @@@ export type ModelSelectionPanesProps =* limits; absent fields only widen the catalog search.*/lookupContext?: CustomModelLookupContext;+ /** Attached to the hand-typed id field, so a caller can focus it. */+ customModelInputRef?: Ref<HTMLInputElement>;- /** Folds the picker back into the chosen-models summary (D623). */++ /** Folds the picker back into the chosen-models summary (D625). */+ onCollapse?: () => void;};/**@@@ -239,8 -233,9 +239,7 @@@ export function ModelSelectionPanes(const [chosenQuery, setChosenQuery] = useState("");const [customModelId, setCustomModelId] = useState("");const [customModelError, setCustomModelError] = useState("");- // Nothing opens on its own: the advanced settings of one model are not- // what the picker is opened for.- // Keep fetched selections scannable. Expanding the first row by default can- // fill the pane with its controls and push every other checked model below- // the fold, which makes a successful multi-select look empty.++ // Keep selections scannable; advanced settings stay folded until requested.const [expandedModelId, setExpandedModelId] = useState<string | null>(null);// The returned list is short and already local, so filtering is client-side:diff --cc apps/desktop/src/components/settings/ProviderSetupDialog.tsxindex a39823491,62ed4150c..81bf5a4bb--- a/apps/desktop/src/components/settings/ProviderSetupDialog.tsx+++ b/apps/desktop/src/components/settings/ProviderSetupDialog.tsx@@@ -1,11 -1,8 +1,11 @@@/**- * One dialog to add or edit an AI service, in two views (D623).- * One form to add or edit an AI service.++ * One dialog to add or edit an AI service, in two views (D625).*- * Named services: pick a vendor and paste a key. Custom: name, URL, key and- * API format on the common path. Models come from the service endpoint.+ * A new service opens on the service chooser; picking a tile moves to the+ * form. Named services: paste a key and the recommended models are chosen as+ * soon as the service answers. Custom: name, URL, key and API format on the+ * common path. Models come from the service endpoint; the full picker stays+ * one click away behind the chosen-models summary.*/import { useEffect, useRef, useState } from "react";import { useTranslation } from "react-i18next";@@@ -23,74 -18,15 +22,18 @@@ import { api } from "../../lib/api"import { pairsToRecord, recordToPairs } from "../extensions/KeyValueRows";import { Button, Field, HelpIcon, Input, portalOverlay } from "../ui";import { ProviderHeadersEditor } from "./ProviderHeadersEditor";-import { SettingsMenuSelect } from "./SettingsMenuSelect";import { useProviderModels } from "./useProviderModels";import { ModelSelectionPanes, useModelSelection } from "./ModelSelectionPanes";-import { CUSTOM_SERVICE, ServicePicker } from "./ServicePicker";+import { ChosenModelsSummary } from "./ChosenModelsSummary";+import { ConnectionStatus, ProviderConnectionFields } from "./ProviderConnectionFields";+import { ServiceChooser } from "./ServiceChooser";+import { CUSTOM_SERVICE } from "./service-catalog";+import { useRecommendedModelSelection } from "./useRecommendedModelSelection";import type { ProviderCopyDraft } from "./provider-copy";-import { API_STYLE_LABEL_KEYS, CUSTOM_PROVIDER_API_STYLES, isAccountOnlyApiStyle, needsCustomApiStyleChoice, providerSetupPreset } from "./provider-api-style";+import { isAccountOnlyApiStyle, needsCustomApiStyleChoice, providerSetupPreset } from "./provider-api-style";- type BaseUrlIssue = "invalid";-- function endpointPathSuffixes(apiStyle: CatalogApiStyle): string[] {- switch (apiStyle) {- case "anthropic_messages":- case "pi_messages":- return ["/messages", "/models"];- case "chat_completions":- return ["/chat/completions", "/models"];- case "responses":- case "openai_codex_responses":- case "opencode_go":- return ["/responses", "/models"];- case "google_generative_ai":- return ["/models"];- default:- return ["/chat/completions", "/models"];- }- }-- function getBaseUrlIssue(value: string): BaseUrlIssue | null {- const trimmed = value.trim();- if (!trimmed) return null;- try {- const parsed = new URL(trimmed);- if (- !["http:", "https:"].includes(parsed.protocol) ||- !parsed.hostname ||- parsed.username ||- parsed.password ||- parsed.search ||- parsed.hash- ) {- return "invalid";- }- return null;- } catch {- return "invalid";- }- }-- /** Keep pasted operation URLs usable by storing the service root instead. */- function normalizeBaseUrlInput(value: string, apiStyle: CatalogApiStyle): string {- const trimmed = value.trim();- if (!trimmed || getBaseUrlIssue(trimmed)) return trimmed;-- let normalized = trimmed.replace(/\/+$/, "");- const suffixes = endpointPathSuffixes(apiStyle).sort(- (left, right) => right.length - left.length,- );- for (const suffix of suffixes) {- if (normalized.toLowerCase().endsWith(suffix)) {- normalized = normalized.slice(0, -suffix.length).replace(/\/+$/, "");- break;- }- }- return normalized || trimmed;- }+ import { getBaseUrlIssue, normalizeBaseUrlInput } from "./provider-endpoint-guidance";+ import { ProviderEndpointGuidance } from "./ProviderEndpointGuidance";function serviceIdFor(provider?: ProviderPublic | null): string {if (!provider) return "";@@@ -325,7 -224,11 +268,9 @@@ export function ProviderSetupDialog(const result = await api.updateProvider({id: provider.id,name: providerName,- vendorKey: namedPreset?.vendorKey ?? "custom",+ // A row whose stored wire format differs from the published preset is+ // no longer that preset, but its catalog identity is still its own.- // A row whose stored wire format differs from the published preset is- // no longer that preset, but its catalog identity is still its own.+ vendorKey: namedPreset?.vendorKey ?? provider?.vendorKey ?? "custom",baseUrl: providerBaseUrl,defaultModelId: persisted[0]?.id,models: persisted,@@@ -376,89 -279,226 +321,105 @@@!baseUrlIssue &&models.length > 0;- return portalOverlay(- <div- className="overlay provider-setup-overlay"- role="presentation"- onClick={() => {- if (saving) return;- onClose();- }}- >- <div- className="dialog provider-setup-dialog"- role="dialog"- aria-modal="true"- aria-labelledby="provider-setup-title"- onClick={(event) => event.stopPropagation()}- >- <div className="provider-setup-head">- <h3 id="provider-setup-title" className="provider-setup-title">- {initialDraft ? t("settings.copyProviderTitle") : editing ? t("settings.editProviderTitle") : t("settings.addProviderTitle")}- {/* What a copy does and does not take is the title's own promise. */}- {initialDraft ? <HelpIcon label={t("settings.copyProviderHint")} /> : null}- </h3>- <div className="provider-setup-head-actions">- {named || custom ? (- <Button- variant="ghost"- size="sm"- disabled={saving}- onClick={() => setAdvancedOpen(true)}- >- {t("settings.advancedSettings")}- </Button>- ) : null}- {provider ? (- <Button- variant="ghost"- size="sm"- disabled={testing || saving}- onClick={() => void testConnection()}- >- {testing ? t("settings.testing") : t("settings.testConnection")}- </Button>- ) : null}- <Button variant="ghost" size="sm" disabled={saving} onClick={onClose}>- {t("settings.cancel")}+ const formView = (+ <>+ <div className="provider-setup-head">+ <h3 id="provider-setup-title" className="provider-setup-title">+ {initialDraft ? t("settings.copyProviderTitle") : editing ? t("settings.editProviderTitle") : t("settings.addProviderTitle")}+ {/* What a copy does and does not take is the title's own promise. */}+ {initialDraft ? <HelpIcon label={t("settings.copyProviderHint")} /> : null}+ </h3>+ <div className="provider-setup-head-actions">+ {named || custom ? (+ <Button+ variant="ghost"+ size="sm"+ disabled={saving}+ onClick={() => setAdvancedOpen(true)}+ >+ {t("settings.advancedSettings")}</Button>+ ) : null}+ {provider ? (<Button- variant="primary"+ variant="ghost"size="sm"- disabled={!canSave}- onClick={() => void save()}+ disabled={testing || saving}+ onClick={() => void testConnection()}>- {saving ? t("settings.saving") : t("settings.saveProvider")}+ {testing ? t("settings.testing") : t("settings.testConnection")}</Button>- </div>+ ) : null}+ <Button variant="ghost" size="sm" disabled={saving} onClick={onClose}>+ {t("settings.cancel")}+ </Button>+ <Button+ variant="primary"+ size="sm"+ disabled={!canSave}+ onClick={() => void save()}+ >+ {saving ? t("settings.saving") : t("settings.saveProvider")}+ </Button></div>+ </div>- <div className="provider-setup-body">- {error ? <div className="provider-setup-error">{error}</div> : null}+ <div className="provider-setup-body">+ {error ? <div className="provider-setup-error">{error}</div> : null}- <ProviderEndpointGuidance- baseUrl={resolvedBaseUrl}- apiStyle={resolvedApiStyle}- disabled={saving}- onApply={(suggestion) => {- const preset = NAMED_ENDPOINT_PRESETS.find((item) =>- item.baseUrl === suggestion.baseUrl && item.apiStyle === suggestion.apiStyle);- setService(preset?.id ?? CUSTOM_SERVICE);- setBaseUrl(suggestion.baseUrl);- setApiStyle(suggestion.apiStyle);++ <ProviderEndpointGuidance++ baseUrl={resolvedBaseUrl}++ apiStyle={resolvedApiStyle}++ disabled={saving}++ onApply={(suggestion) => {++ const preset = NAMED_ENDPOINT_PRESETS.find((item) =>++ item.baseUrl === suggestion.baseUrl && item.apiStyle === suggestion.apiStyle,++ );++ setService(preset?.id ?? CUSTOM_SERVICE);++ setBaseUrl(suggestion.baseUrl);++ setApiStyle(suggestion.apiStyle);++ setError("");++ setTestResult("");++ }}++ />+++ <div className="provider-setup-credentials">+ <ProviderConnectionFields+ named={named}+ custom={custom}+ editing={editing}+ saving={saving}+ serviceLabel={namedPreset ? t(namedPreset.labelKey) : t("settings.presetCustomEndpoint")}+ serviceBaseUrl={namedPreset?.baseUrl ?? ""}+ onChangeService={() => setChoosing(true)}+ apiKeyRef={apiKeyRef}+ nameRef={nameRef}+ apiKey={apiKey}+ onApiKeyChange={setApiKey}+ name={name}+ onNameChange={setName}+ baseUrl={baseUrl}+ onBaseUrlChange={(value) => {+ setBaseUrl(value);setError("");- setTestResult("");}}+ commitBaseUrl={commitBaseUrl}+ baseUrlError={baseUrlError}+ apiStyle={apiStyle}+ onApiStyleChange={setApiStyle}+ accountOnlyApiStyle={accountOnlyApiStyle}+ requiresApiStyleChoice={requiresApiStyleChoice}+ status={<ConnectionStatus active={discoveryActive} discovery={discovery} named={named} />}/>- <div className="provider-setup-credentials">- <div- className={- named- ? "provider-setup-fields is-named"- : custom- ? "provider-setup-fields is-custom"- : "provider-setup-fields is-empty"- }- >- <div- className={`provider-setup-field-row provider-setup-service-row ${- named ? "is-named" : "is-single"- }`}- >- <div className="provider-setup-service">- <Field label={t("settings.service")}>- <ServicePicker- value={service}- autoFocus={!named && !custom}- disabled={saving}- onChange={onServiceChange}- />- </Field>- </div>-- {named ? (- <Field- label={t("settings.apiKey")}- hint={editing ? t("settings.apiKeyKeepHint") : undefined}- >- <Input- ref={apiKeyRef}- type="password"- value={apiKey}- placeholder="sk-…"- className="font-mono text-sm-plus"- autoComplete="off"- autoFocus- onChange={(event) => setApiKey(event.target.value)}- />- </Field>- ) : null}- </div>-- {named && resolvedBaseUrl ? (- <div className="provider-setup-host" title={resolvedBaseUrl}>- {endpointHost(resolvedBaseUrl)}- </div>- ) : null}-- {custom ? (- <>- <div className="provider-setup-field-row provider-setup-custom-identity-row">- <Field label={t("settings.name")}>- <Input- ref={nameRef}- value={name}- autoFocus- onChange={(event) => setName(event.target.value)}- />- </Field>- <div className="provider-setup-base-url">- <Field label={t("settings.baseUrl")}>- <Input- value={baseUrl}- type="url"- inputMode="url"- autoComplete="url"- className="font-mono text-sm-plus"- placeholder="https://api.example.com/v1"- aria-invalid={Boolean(baseUrlError)}- aria-describedby={baseUrlError ? "provider-base-url-error" : undefined}- onChange={(event) => {- setBaseUrl(event.target.value);- setError("");- }}- onBlur={commitBaseUrl}- />- {baseUrlError ? (- <div- id="provider-base-url-error"- className="provider-setup-field-error"- role="alert"- >- {baseUrlError}- </div>- ) : null}- </Field>- </div>- </div>- <div className="provider-setup-field-row provider-setup-custom-auth-row">- <Field- label={t("settings.apiKey")}- hint={editing ? t("settings.apiKeyKeepHint") : undefined}- >- <Input- ref={apiKeyRef}- type="password"- value={apiKey}- placeholder="sk-…"- className="font-mono text-sm-plus"- autoComplete="off"- onChange={(event) => setApiKey(event.target.value)}- />- </Field>- <Field- label={t("settings.apiStyle")}- hint={accountOnlyApiStyle ? t(requiresApiStyleChoice- ? "settings.apiStyleChooseCustom"- : "settings.apiStyleLegacyAccount") : undefined}- >- <SettingsMenuSelect- fullWidth- label={t("settings.apiStyle")}- value={apiStyle}- disabled={saving}- onChange={(id) => setApiStyle(id as CatalogApiStyle)}- options={[- ...(accountOnlyApiStyle- ? [{- id: apiStyle,- label: t(API_STYLE_LABEL_KEYS[apiStyle]),- disabled: true,- }]- : []),- ...CUSTOM_PROVIDER_API_STYLES.map((style) => ({- id: style,- label: t(API_STYLE_LABEL_KEYS[style]),- })),- ]}- />- </Field>- </div>- </>- ) : null}+ {testResult ? (+ <div className="provider-credential-test">+ <span className="provider-credential-test-result">{testResult}</span></div>+ ) : null}+ </div>- {testResult ? (- <div className="provider-credential-test">- <span className="provider-credential-test-result">{testResult}</span>- </div>- ) : null}- </div>-+ {managing ? (<ModelSelectionPanesdiscovery={discovery}selection={selection}@@@ -468,11 -508,9 +429,11 @@@apiStyle={resolvedApiStyle}imageModelIds={imageModelDraft ?? imageModelIds}onImageModelChange={updateImageModelDraft}+ customModelInputRef={customModelRef}+ onCollapse={() => setManaging(false)}lookupContext={{baseUrl: requestBaseUrl,- vendorKey: namedPreset?.vendorKey ?? "custom",+ vendorKey: namedPreset?.vendorKey ?? provider?.vendorKey ?? "custom",providerId: provider?.id,}}/>diff --cc apps/desktop/test/model-advanced-capabilities.test.mjsindex c5d9a8122,34a8c87e6..9de94d6ac--- a/apps/desktop/test/model-advanced-capabilities.test.mjs+++ b/apps/desktop/test/model-advanced-capabilities.test.mjs@@@ -236,9 -237,8 +237,9 @@@ test("the advanced body is a compact sh);assert.doesNotMatch(pickerSource, /hint=\{t\("settings\.modelAliasHint"\)\}/);assert.match(pickerSource, /aria-controls=\{advancedId\}/);- // Every row starts folded (D623); the chosen list is for review first.- // Keep the selected-model summary visible until Advanced is requested.++ // Every row starts folded so chosen models stay scannable (D625).assert.match(pickerSource, /useState<string \| null>\(null\)/);+ assert.doesNotMatch(pickerSource, /models\[0\]\?\.id \?\? null/);assert.match(pickerSource,/className="provider-chosen-thinking-head">[\s\S]*?provider-chosen-thinking-default[\s\S]*?provider-chosen-thinking-chips/,diff --cc docs/spec/08-meta/decisions-log.mdindex 36986a0e1,23d429bff..7efb34023--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@@ -7007,47 -7010,60 +7010,105 @@@ must keep splitting are covered by `marand explicit binding overrides retain their existing precedence. See`03-runtime/13-model-catalog-and-selection.md` §11.3.- ## 2026-09-25 — Model settings unify around one AI service list and a chosen-models summary (D623)+ ## 2026-09-23 — Compact before the hard request budget (D623, issue #970)++ - Automatic session and subagent compaction now starts at 90% of the derived+ `hardLimit`, inline at the next request boundary. New user prompts are+ included in the preflight estimate; tool results are measured before the+ follow-up provider request.+ - `hardLimit` remains the final safety boundary. A failed summary below it may+ proceed without a checkpoint; a context at or above it never reaches the+ provider. This trades some additional summaries for fewer provider overflows.+ - The runtime remains inline-only: no background summary, user setting,+ protocol change, or transcript/storage rewrite. See ADR 0064,+ `03-runtime/02-agent-runtime.md`, and E2E-164.++ ## 2026-09-24 — Windows stdio MCP resolves official Node and fnm npx (D624, issue #789)++ - Amend D176 / D600 / ADR 0038. D600 probes the login-shell PATH on Unix and+ explicitly keeps Windows on the inherited PATH. That does not start+ `npx.cmd`: `spawn({ shell: false })` returns ENOENT for `npx` and EINVAL+ for the `.cmd` shim, even when official Node is on PATH (issue #789).+ - Electron main now resolves bare `npx`/`npm`/`node`/`uvx` before spawn:+ PATH `node.exe` from an official install wins, then fnm/nvm-windows/Volta.+ When `npx-cli.js` sits next to `node.exe`, the child is `node` plus that+ script — no cmd.exe. Remaining `.cmd` files go through+ `cmd.exe /d /s /c` with quoted literal arguments. PATHEXT is searched+ before an extensionless Git-Bash `npx` shim.+ - Secrets still do not cross (D018). Command names stay bare. See ADR 0038+ and `07-plugins/04-plugin-security.md`.++ ## 2026-09-24 — The transcript occludes itself instead of the dock painting a band (D624, issue #728)++ - The opaque `--ds-bg-primary` band added for issue #728 kept transcript rows+ from showing below the Composer, but it also covered whatever a contributed+ theme had drawn on the conversation pane. A theme that fills `.main-pane` or+ `.thread-scroll` (the theme studio's `main` / `thread` regions) got a+ hard-edged rectangle of the built-in workspace colour across the bottom of the+ chat. No theme region could reach that band: the only lever was+ `--ds-bg-primary` itself, which every other primary surface follows.+ - `.composer-dock-docked` now paints nothing, and `.thread-scroll` masks its own+ content out with `linear-gradient(to bottom, #000 calc(100% -+ var(--composer-dock-height) - 16px), transparent calc(100% -+ var(--composer-dock-height) + 2px))`. The gradient resolves against the+ scrollport's own box, so it stays anchored to the pane while rows move through+ it. `- 16px` is exactly the trailing reserve `.thread-content` adds below the+ measured Composer height, so a transcript pinned to its end keeps its last row+ fully opaque and only the rows crossing the boundary fade.+ - The mask belongs on the scroller rather than on `.thread-wrap`: the minimap+ rail, the jump-to-latest button, the settle veil, and the navigation status+ are `.thread-wrap` children that must stay fully painted. The dock's own+ stacked plates (`.asktool-card`, `.plan-approval-bar`, queued prompts, the+ shell) were already opaque and are siblings of `.thread-wrap`, so they are+ unaffected. The scrollport's last 18px of scrollbar now fades instead of being+ covered by the band.+ - Renderer CSS and the theme surface regression change only. The theme surface+ probe pins the dock to fully transparent and asserts the mask tracks+ `--composer-dock-height`. There is no scroll state, protocol, persistence,+ theme schema, or permission change. See `04-ux/08-component-spec.md` and+ E2E-CHAT-opaque-floating-decision-and-retry-surfaces.++++## 2026-09-25 — Model settings unify around one AI service list and a chosen-models summary (D625)++- The model settings page asked too much before a user could connect anything.+ API-key services opened on a closed Service menu, vendor subscriptions had+ their own button and dialog further down the page, and plugin-declared+ services sat elsewhere again, so the first decision was where to look rather+ than what to connect. Users reported the flow as needlessly heavy. This+ redesign keeps the immersive, borderless D297 tone (in-flow surfaces use+ `--ds-tile`/`--ds-raised` and spacing, no borders; only floating menus and+ dialogs keep a 0.5px stroke and a shadow) and collapses the choices into one+ list and one add flow.+- API services, plugin-declared services and vendor subscription accounts now+ share a single AI service list (`ServiceList`, `ServiceRow`). A row is itself+ the way in — a click or Enter opens its editor — so the only controls left on+ a row are the enable switch and one overflow menu; the click lives on the row+ element rather than a button so a card drag still starts anywhere on the card.+ An account row still lives and dies through the vendor-account editor and+ `deleteOauthAccount`, never the provider CRUD, so ownership boundaries are+ unchanged even though the two kinds render in one list.+- Adding a service starts on a searchable chooser (`ServiceChooser`), not a+ closed menu: subscriptions and API-key services sit side by side as tiles and+ the custom endpoint comes last, because it is the one choice that asks for+ more than a key. Filtering never talks to the host. Picking a tile moves to+ the service form (`ProviderSetupDialog`, two views), and the credential rows- live in their own component (`ProviderConnectionFields`, D310 + D623).++ live in their own component (`ProviderConnectionFields`, D310 + D625).+- Both the service dialog and the vendor-account dialog open on a chosen-models+ summary (`ChosenModelsSummary`) with the full two-pane picker+ (`ModelSelectionPanes`) one click away, because most people keep the models a+ service starts with. A new API service preselects recommended models+ (`recommended-models.ts`, `useRecommendedModelSelection`): only tool-capable+ chat models are candidates, and when models.dev metadata is present the newest+ stable model per family wins (up to `RECOMMENDED_MODEL_LIMIT`), with the first+ pick becoming the service default — so saving a key is enough to start+ chatting. Without trustworthy discovery (a rejected key, a timeout or a+ network failure) nothing is preselected; a named vendor that simply has no+ `/models` route still counts as accepting the key.+- Covered by `apps/desktop/test/service-chooser.test.mjs`,+ `service-catalog.test.mjs`, `service-row-status.test.mjs`,+ `recommended-models.test.mjs`, `provider-form-layout.test.mjs`,+ `default-model-display.test.mjs` and the updated `settings-general.test.mjs`,+ plus the `scripts/e2e/provider-api-style.tsx` probe (chooser tiles keyed by+ `data-service-id`, the custom endpoint last, and the account dialog opening on+ `provider-models-summary` with per-model controls behind Manage models and a+ folded Advanced disclosure). ADR 0098 still governs vendor OAuth accounts.diff --cc docs/zh-CN/spec/08-meta/decisions-log.mdindex 50909e877,f1446cddb..3536a4bb4--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@@ -4959,36 -4961,39 +4961,73 @@@ Markdown 源码,不是 `text/html` �模型,已发布能力和显式绑定覆盖沿用既有优先级。见`03-runtime/13-model-catalog-and-selection.md` §11.2。- ## 2026-09-25 —— 模型设置统一为一份 AI 服务列表加一份已选模型摘要(D623)+ ## 2026-09-24 —— Windows stdio MCP 解析官方 Node 与 fnm 的 npx(D624,issue #789)++ - 修订 D176 / D600 / ADR 0038。D600 在 Unix 探测 login-shell PATH,Windows 仍用+ 进程继承的 PATH。这启动不了 `npx.cmd`:`spawn({ shell: false })` 对 `npx`+ 返回 ENOENT,对 `.cmd` 返回 EINVAL,即使官方 Node 已在 PATH 里(issue #789)。+ - Electron main 在 spawn 前解析裸 `npx`/`npm`/`node`/`uvx`:PATH 上的官方+ `node.exe` 优先,然后是 fnm / nvm-windows / Volta。若 `npx-cli.js` 与+ `node.exe` 同目录,子进程直接跑 `node` 加该脚本,不经过 cmd.exe。其余+ `.cmd` 走 `cmd.exe /d /s /c`,参数加引号保持字面量。PATHEXT 优先于无扩展名+ 的 Git-Bash `npx` 脚本。+ - 密钥仍不穿越(D018)。命令名保持裸名。见 ADR 0038 与+ `07-plugins/04-plugin-security.md`。++ ## 2026-09-24 — 由正文自己遮挡,而不是停靠区画一条色带(D624,issue #728)++ - 为 issue #728 加在 `.composer-dock-docked` 上的不透明 `--ds-bg-primary`+ 色带确实挡住了正文漏到 Composer 下方,但它同时盖住了主题画在会话面板上的+ 东西:主题填充 `.main-pane` 或 `.thread-scroll`(主题工坊的 `main` /+ `thread` 区域)时,聊天底部会出现一块内置工作区色的硬边矩形。这条色带不+ 属于任何主题区域,唯一可用的杠杆是 `--ds-bg-primary` 本身,而所有其它主+ 表面都跟着它走。+ - `.composer-dock-docked` 现在不绘制任何底衬,改由 `.thread-scroll` 用+ `linear-gradient(to bottom, #000 calc(100% - var(--composer-dock-height)+ - 16px), transparent calc(100% - var(--composer-dock-height) + 2px))`+ 遮掉自身内容。渐变按滚动容器自己的盒子解析,因此正文移动时它仍锚在面板+ 上;`- 16px` 正好是 `.thread-content` 在 Composer 实测高度之下留出的尾部+ 预留,所以滚到底时最后一行保持完全不透明,只有越过边界的行会淡出。+ - 遮罩挂在滚动容器而不是 `.thread-wrap`:缩略导航轨道、跳到最新按钮、骨架+ 遮罩和导航状态都是 `.thread-wrap` 的子节点,必须保持完全绘制。停靠区自己+ 堆叠的面板(`.asktool-card`、`.plan-approval-bar`、排队提示、输入胶囊)+ 本来就是不透明的,且是 `.thread-wrap` 的兄弟节点,因此不受影响。滚动条+ 最后 18px 由「被色带盖住」改为「淡出」。+ - 仅改渲染器 CSS 与主题表面回归用例。主题表面探针把停靠区固定为全透明,并+ 断言遮罩跟随 `--composer-dock-height`。滚动状态、协议、持久化、主题+ schema、权限都没有变化。见 `04-ux/08-component-spec.md` 与+ E2E-CHAT-opaque-floating-decision-and-retry-surfaces。++++## 2026-09-25 —— 模型设置统一为一份 AI 服务列表加一份已选模型摘要(D625)++- 模型设置页在用户连接任何服务前要求太多。API-key 服务打开时是一个收起的+ 服务菜单,订阅式厂商在页面靠下有自己的按钮和对话框,插件声明的服务又在+ 另一处,于是第一步的决定是"去哪看"而不是"连什么"。用户反馈流程过于繁重。+ 本次重设计保留沉浸式、无边框的 D297 基调(in-flow 面用+ `--ds-tile`/`--ds-raised` 与间距、不描边;只有浮层菜单和对话框保留 0.5px+ 描边和阴影),把这些选择收拢为一份列表和一条新增流程。+- API 服务、插件声明的服务和厂商订阅账号现在共享同一份 AI 服务列表+ (`ServiceList`、`ServiceRow`)。行本身就是入口——点击或回车打开它的编辑器+ ——因此行上只保留启用开关和一个溢出菜单;点击挂在行元素而非按钮上,这样卡片+ 拖拽仍可从卡片任意处开始。账号行仍通过厂商账号编辑器与 `deleteOauthAccount`+ 存续,绝不走 provider CRUD,所以即便两类在同一列表渲染,所有权边界不变。+- 新增服务从一个可搜索的选择器(`ServiceChooser`)开始,而非收起的菜单:订阅+ 与 API-key 服务并列成磁贴,自定义端点排最后,因为它是唯一需要不止一个密钥的+ 选择。过滤从不与 host 通信。选中磁贴后进入服务表单(`ProviderSetupDialog`,- 两个视图),凭据行独立成组件(`ProviderConnectionFields`,D310 + D623)。++ 两个视图),凭据行独立成组件(`ProviderConnectionFields`,D310 + D625)。+- 服务对话框与厂商账号对话框都打开在已选模型摘要(`ChosenModelsSummary`)上,+ 完整的双栏选择器(`ModelSelectionPanes`)只需一次点击,因为多数人会保留服务+ 自带的模型。新的 API 服务会预选推荐模型(`recommended-models.ts`、+ `useRecommendedModelSelection`):只有可调用工具的对话模型才是候选,存在+ models.dev 元数据时每个家族取最新稳定型(至多 `RECOMMENDED_MODEL_LIMIT` 个),+ 首个入选成为服务默认——因此保存一个密钥就足以开始对话。缺乏可信发现结果时+ (密钥被拒、超时或网络失败)不预选;仅是没有 `/models` 路由的已知厂商仍算作+ 接受了密钥。+- 覆盖测试:`apps/desktop/test/service-chooser.test.mjs`、+ `service-catalog.test.mjs`、`service-row-status.test.mjs`、+ `recommended-models.test.mjs`、`provider-form-layout.test.mjs`、+ `default-model-display.test.mjs` 及更新后的 `settings-general.test.mjs`,+ 另加 `scripts/e2e/provider-api-style.tsx` 探针(选择器磁贴以 `data-service-id`+ 标记、自定义端点排最后、账号对话框打开在 `provider-models-summary` 上、每模型+ 控件位于"管理模型"和折叠的"高级"展开项之后)。厂商 OAuth 账号仍由 ADR 0098+ 管辖。diff --cc scripts/e2e/provider-api-style.tsxindex 3a90cc498,fcaf294d3..1f6e3d434--- a/scripts/e2e/provider-api-style.tsx+++ b/scripts/e2e/provider-api-style.tsx@@@ -228,16 -310,9 +313,18 @@@ globalThis.providerApiStyleProbe = asynconst codexAccount = { ...fixture("openai_codex_responses"), id: "codex-account", name: "OpenAI OAuth", vendorKey: "openai-codex", type: "native", protocol: "openai", authKind: "oauth" } satisfies ProviderPublic;let savedCodexAccount: VendorAccountForm | undefined;flushSync(() => root.render(<I18nextProvider i18n={i18n}><VendorAccountDialog provider={codexAccount} initialName={codexAccount.name} onClose={() => { closes++; }} onSave={(form) => { savedCodexAccount = structuredClone(form); }} saving={false} /></I18nextProvider>));+ const accountAdvanced = document.querySelector<HTMLButtonElement>(".provider-chosen-advanced-toggle");+ if (accountAdvanced?.getAttribute("aria-expanded") === "false") click(accountAdvanced);await pause(650);+ // Models open as a summary (D623); the per-model controls sit behind+ // Manage models and the row's own Advanced disclosure.+ assert(document.querySelector(".provider-models-summary"), `${locale}: account dialog did not open on the summary`);+ click(control("settings.manageModels"));+ await frame();+ const advancedToggle = document.querySelector<HTMLButtonElement>(".provider-chosen-advanced-toggle");+ assert(advancedToggle?.getAttribute("aria-expanded") === "false", `${locale}: a model opened its advanced settings on its own`);+ click(advancedToggle);+ await frame();const findWebSearch = () => [...document.querySelectorAll<HTMLInputElement>("input[type=checkbox]")].find((input) => input.closest("label")?.textContent?.trim() === i18n.t("settings.nativeWebSearch"));const searchCheckbox = findWebSearch();assert(searchCheckbox, `${locale}: Codex web search checkbox missing`);