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): lead the API-key group with the custom endpoint
vastsacc492b0c50e3
diff --git a/apps/desktop/src/components/settings/ServiceChooser.tsx b/apps/desktop/src/components/settings/ServiceChooser.tsxindex fc8efa5cf..fc22d87da 100644--- a/apps/desktop/src/components/settings/ServiceChooser.tsx+++ b/apps/desktop/src/components/settings/ServiceChooser.tsx@@ -5,9 +5,9 @@* The old form opened on a closed Service menu, and subscriptions had their* own button and dialog further down the page, so the first decision was* where to look rather than what to connect. Subscriptions and API-key- * services now sit side by side as tiles; the custom endpoint comes last,- * because it is the one choice that asks for more than a key. Filtering never- * talks to the host.+ * services now sit side by side as tiles; the custom endpoint leads its+ * group, because it is the one choice that needs no preset found first.+ * Filtering never talks to the host.*/import { useMemo, useRef, useState, type KeyboardEvent } from "react";import { useTranslation } from "react-i18next";@@ -49,7 +49,7 @@ export function ServiceChooser({const gridRef = useRef<HTMLDivElement>(null);const serviceOptions = useMemo(- () => [...namedServiceOptions(t), customServiceOption(t)],+ () => [customServiceOption(t), ...namedServiceOptions(t)],[t],);const subscriptionOptions = useMemo<SubscriptionOption[]>(diff --git a/apps/desktop/test/service-chooser.test.mjs b/apps/desktop/test/service-chooser.test.mjsindex 3f93e9afc..3dd8da6a7 100644--- a/apps/desktop/test/service-chooser.test.mjs+++ b/apps/desktop/test/service-chooser.test.mjs@@ -37,8 +37,12 @@ test("a new service starts on a searchable chooser, not a closed menu (D625)", (assert.doesNotMatch(catalogSource, /\bapi\.\w+\(/);});-test("subscriptions and API services share the chooser, custom endpoint last", () => {- assert.match(chooserSource, /\[\.\.\.namedServiceOptions\(t\), customServiceOption\(t\)\]/);+test("subscriptions and API services share the chooser, custom endpoint first", () => {+ assert.match(chooserSource, /\[customServiceOption\(t\), \.\.\.namedServiceOptions\(t\)\]/);+ // The custom endpoint is the group's first tile, ahead of every named host.+ const customAt = chooserSource.indexOf("customServiceOption(t)");+ const namedAt = chooserSource.indexOf("namedServiceOptions(t)");+ assert.ok(customAt > 0 && customAt < namedAt, "the custom endpoint leads the API-key group");assert.match(chooserSource, /settings\.chooserSubscriptions/);assert.match(chooserSource, /settings\.chooserApiKeys/);const subscriptionsAt = chooserSource.indexOf("settings.chooserSubscriptions");diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex f1acb6f92..b9eee1224 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -7113,3 +7113,16 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.`data-service-id`, the custom endpoint last, and the account dialog opening on`provider-models-summary` with per-model controls behind Manage models and afolded Advanced disclosure). ADR 0098 still governs vendor OAuth accounts.++## 2026-09-25 — The custom endpoint leads the API-key group (D626)++- The service chooser listed its API-key tiles in the shared preset order and+ put the custom endpoint after all of them, so reaching one's own address+ meant scrolling past every named host first. The custom endpoint now leads+ the group instead: it is the one choice that needs nothing found before it,+ and the group still reads as "connect with an API key". The groups keep+ their order (subscriptions above API-key services), and the keyboard walk+ still enters the grid at its first tile.+- Covered by the updated `apps/desktop/test/service-chooser.test.mjs` and the+ `scripts/e2e/provider-api-style.tsx` probe, which now asserts that the first+ `[data-service-id]` tile is `custom` rather than the last.diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.mdindex 85e0f722b..18b192054 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -5032,3 +5032,13 @@ Markdown 源码,不是 `text/html` 负载;对禁用行内 HTML 的外部编标记、自定义端点排最后、账号对话框打开在 `provider-models-summary` 上、每模型控件位于"管理模型"和折叠的"高级"展开项之后)。厂商 OAuth 账号仍由 ADR 0098管辖。++## 2026-09-25 —— 自定义端点排在 API-key 组首位(D626)++- 服务选择器按共享预设顺序列出 API-key 磁贴,把自定义端点放在它们之后,于是要+ 连上自己的地址就得先滚过所有具名厂商。自定义端点现在排在所在组首位:它是唯一+ 不需要先找到什么的选择,而该组仍然是"用 API key 连接"。分组顺序不变(订阅+ 仍在 API-key 服务之上),键盘遍历也仍从网格第一个磁贴进入。+- 覆盖:更新后的 `apps/desktop/test/service-chooser.test.mjs`,以及+ `scripts/e2e/provider-api-style.tsx` 探针——它现在断言第一个+ `[data-service-id]` 磁贴是 `custom`,而不是最后一个。diff --git a/scripts/e2e/provider-api-style.tsx b/scripts/e2e/provider-api-style.tsxindex 55bc1f079..76e25a52a 100644--- a/scripts/e2e/provider-api-style.tsx+++ b/scripts/e2e/provider-api-style.tsx@@ -172,13 +172,13 @@ globalThis.providerApiStyleProbe = async () => {for (const locale of ["en", "zh-CN"]) {await i18n.changeLanguage(locale);render();- // A new service opens on the chooser (D625); the custom endpoint is the- // last tile, and picking it moves to the form.+ // A new service opens on the chooser (D625, D626); the custom endpoint+ // leads the API-key tiles, and picking it moves to the form.const tiles = [...document.querySelectorAll<HTMLButtonElement>("[data-service-id]")];assert(tiles.length > 1, `${locale}: service chooser tiles missing`);- assert(tiles.at(-1)?.dataset.serviceId === CUSTOM_SERVICE, `${locale}: custom endpoint is not last`);+ assert(tiles.at(0)?.dataset.serviceId === CUSTOM_SERVICE, `${locale}: custom endpoint is not first`);assert(!apiStyleTrigger(), `${locale}: form rendered before a service was chosen`);- click(tiles.at(-1));+ click(tiles.at(0));await frame();assert(!document.querySelector("[data-service-id]"), `${locale}: chooser stayed open after a pick`);await openApiStyleMenu();