Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(settings): show subscription paths in provider summaries
zszz3267698ccbea8
diff --git a/apps/desktop/src/components/settings/ProviderConnectionFields.tsx b/apps/desktop/src/components/settings/ProviderConnectionFields.tsxindex 70f2055dc..8513b49ab 100644--- a/apps/desktop/src/components/settings/ProviderConnectionFields.tsx+++ b/apps/desktop/src/components/settings/ProviderConnectionFields.tsx@@ -15,7 +15,7 @@ import { SettingsMenuSelect } from "./SettingsMenuSelect";import { ServiceMonogram } from "./ServiceMonogram";import { ModelsFetchErrorMessage } from "./ModelsFetchErrorMessage";import { canRecommendFrom } from "./recommended-models";-import { hostOf } from "./service-catalog";+import { endpointLabel } from "./service-catalog";import type { ProviderModelsState } from "./useProviderModels";import { API_STYLE_LABEL_KEYS, CUSTOM_PROVIDER_API_STYLES } from "./provider-api-style";@@ -138,7 +138,7 @@ export function ProviderConnectionFields({<span className="provider-service-chip-name">{serviceLabel}</span>{serviceBaseUrl ? (<span className="provider-service-chip-host" title={serviceBaseUrl}>- {hostOf(serviceBaseUrl)}+ {endpointLabel(serviceBaseUrl)}</span>) : null}</span>diff --git a/apps/desktop/src/components/settings/ServiceChooser.tsx b/apps/desktop/src/components/settings/ServiceChooser.tsxindex fc22d87da..c1492b4f5 100644--- a/apps/desktop/src/components/settings/ServiceChooser.tsx+++ b/apps/desktop/src/components/settings/ServiceChooser.tsx@@ -255,7 +255,7 @@ export function ServiceChooser({<span className="service-chooser-tile-copy"><span className="service-chooser-tile-name">{option.label}</span><span className="service-chooser-tile-detail">- {isCustom ? t("settings.customEndpointDesc") : option.host}+ {isCustom ? t("settings.customEndpointDesc") : option.endpoint}</span></span></button>diff --git a/apps/desktop/src/components/settings/service-catalog.ts b/apps/desktop/src/components/settings/service-catalog.tsindex f853b1a5c..975b6b593 100644--- a/apps/desktop/src/components/settings/service-catalog.ts+++ b/apps/desktop/src/components/settings/service-catalog.ts@@ -14,14 +14,15 @@ type Translate = (key: string) => string;export type ServiceOption = {id: string;label: string;- /** Endpoint host shown under the label; empty for the custom endpoint. */- host: string;+ /** Endpoint host and path shown under the label; empty for the custom endpoint. */+ endpoint: string;haystack: string;};-export function hostOf(url: string): string {+export function endpointLabel(url: string): string {try {- return new URL(url).host;+ const parsed = new URL(url);+ return parsed.host + parsed.pathname.replace(/\/+$/, "");} catch {return url;}@@ -29,14 +30,14 @@ export function hostOf(url: string): string {function presetOption(preset: NamedEndpointPreset, translate: Translate): ServiceOption {const label = translate(preset.labelKey);- const host = hostOf(preset.baseUrl);+ const endpoint = endpointLabel(preset.baseUrl);const aliases = preset.aliases?.join(" ") ?? "";return {id: preset.id,label,- host,+ endpoint,haystack:- `${label} ${preset.name} ${preset.id} ${preset.vendorKey} ${aliases} ${preset.baseUrl} ${host}`.toLowerCase(),+ `${label} ${preset.name} ${preset.id} ${preset.vendorKey} ${aliases} ${preset.baseUrl} ${endpoint}`.toLowerCase(),};}@@ -51,7 +52,7 @@ export function customServiceOption(translate: Translate): ServiceOption {return {id: CUSTOM_SERVICE,label,- host: "",+ endpoint: "",haystack: `${label} custom endpoint`.toLowerCase(),};}diff --git a/apps/desktop/src/styles/model-config.css b/apps/desktop/src/styles/model-config.cssindex 0818a2762..8a1ea5e99 100644--- a/apps/desktop/src/styles/model-config.css+++ b/apps/desktop/src/styles/model-config.css@@ -162,7 +162,7 @@/*The chosen service is a settled fact, not an open menu: its letter tile,- name and host on the field tone, with Change leading back to the chooser.+ name and endpoint on the field tone, with Change leading back to the chooser.*/.provider-service-chip {display: flex;@@ -185,11 +185,10 @@.provider-service-chip-copy {display: flex;flex: 1;+ flex-wrap: wrap;align-items: baseline;- gap: 8px;+ gap: 2px 8px;min-width: 0;- overflow: hidden;- white-space: nowrap;}.provider-service-chip-name {@@ -202,12 +201,11 @@.provider-service-chip-host {min-width: 0;- overflow: hidden;+ overflow-wrap: anywhere;color: var(--ds-text-muted);font-family: var(--font-mono);font-size: var(--text-2xs);line-height: var(--leading-tight);- text-overflow: ellipsis;}.provider-service-chip-change,diff --git a/apps/desktop/src/styles/service-setup.css b/apps/desktop/src/styles/service-setup.cssindex 256c47585..757b61ba3 100644--- a/apps/desktop/src/styles/service-setup.css+++ b/apps/desktop/src/styles/service-setup.css@@ -123,8 +123,7 @@min-width: 0;}-.service-chooser-tile-name,-.service-chooser-tile-detail {+.service-chooser-tile-name {min-width: 0;overflow: hidden;text-overflow: ellipsis;@@ -138,6 +137,8 @@}.service-chooser-tile-detail {+ min-width: 0;+ overflow-wrap: anywhere;color: var(--ds-text-muted);font-size: var(--text-2xs);line-height: var(--leading-tight);diff --git a/apps/desktop/test/service-catalog.test.mjs b/apps/desktop/test/service-catalog.test.mjsindex 3c422b685..692eb8d95 100644--- a/apps/desktop/test/service-catalog.test.mjs+++ b/apps/desktop/test/service-catalog.test.mjs@@ -10,7 +10,7 @@ import {CUSTOM_SERVICE,customServiceOption,filterServiceOptions,- hostOf,+ endpointLabel,namedServiceOptions,} from "../src/components/settings/service-catalog.ts";@@ -31,14 +31,14 @@ test("every named preset is offered once, in the shared table's order", () => {NAMED_ENDPOINT_PRESETS.map((preset) => preset.id),);const openai = namedServiceOptions(translate).find((option) => option.id === "openai");- assert.equal(openai?.host, "api.openai.com");+ assert.equal(openai?.endpoint, "api.openai.com/v1");});test("StepFun Plan is offered once and searchable by its label, vendor and endpoint", () => {const rows = namedServiceOptions(translate).filter((option) => option.id === "stepfun-plan");assert.equal(rows.length, 1);assert.equal(rows[0].label, labels["settings.presetStepfunPlan"]);- assert.equal(rows[0].host, "api.stepfun.com");+ assert.equal(rows[0].endpoint, "api.stepfun.com/step_plan/v1");for (const query of ["阶跃星辰", "StepFun Plan", "stepfun-step-plan", "api.stepfun.com/step_plan/v1"]) {assert.ok(ids(query).includes("stepfun-plan"), query);}@@ -67,7 +67,7 @@ test("a query matches the vendor key and the endpoint host", () => {test("the custom endpoint is searchable by its label and by 'custom'", () => {const custom = customServiceOption(translate);assert.equal(custom.id, CUSTOM_SERVICE);- assert.equal(custom.host, "");+ assert.equal(custom.endpoint, "");assert.deepEqual(ids("自定义"), [CUSTOM_SERVICE]);assert.deepEqual(ids("custom endpoint"), [CUSTOM_SERVICE]);});@@ -76,7 +76,14 @@ test("an unmatched query yields no options", () => {assert.deepEqual(ids("no-such-service-anywhere"), []);});-test("hostOf keeps unparseable input as-is", () => {- assert.equal(hostOf("https://api.openai.com/v1"), "api.openai.com");- assert.equal(hostOf("not a url"), "not a url");+test("endpointLabel keeps unparseable input as-is", () => {+ assert.equal(endpointLabel("https://api.openai.com/v1"), "api.openai.com/v1");+ assert.equal(endpointLabel("not a url"), "not a url");+});+++test("endpoint labels retain routes and ports without showing credentials or query fields", () => {+ assert.equal(endpointLabel("https://user:[email protected]:8443/plan/v1?key=private#fragment"),+ "api.example:8443/plan/v1");+ assert.equal(endpointLabel("https://api.example/"), "api.example");});diff --git a/docs/spec/03-runtime/12-provider-config-schema.md b/docs/spec/03-runtime/12-provider-config-schema.mdindex ab5dd3c8f..cd1dc0e49 100644--- a/docs/spec/03-runtime/12-provider-config-schema.md+++ b/docs/spec/03-runtime/12-provider-config-schema.md@@ -394,7 +394,8 @@ Presets only prefill form defaults; they are not a closed world.These rows are created from the add-provider **Service** select, not from anew protocol. They remain `type: "openai_compatible"`. The common path is-Service + API key; the published host is a summary, and the display name is+Service + API key; the summary shows the endpoint host and path so subscription+routes remain visible (wrapping when needed), and the display name iseditable in Advanced. Custom endpoint shows Name beside Base URL, then API keybeside API format. `vendorKey` is the models.dev provider key.diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex ff9b1916f..d4091bbc1 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -8437,7 +8437,8 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.synthetic API key and a discovered `step-5-preview` model; no live provider.- **Steps**: Select StepFun Plan in Add AI service, enter the test key, wait formodel discovery, explicitly select Step 5 Preview, then save.-- **Expected**: Discovery receives `https://api.stepfun.com/step_plan/v1`,+- **Expected**: The chooser and connection summary both visibly include+ `api.stepfun.com/step_plan/v1`. Discovery receives `https://api.stepfun.com/step_plan/v1`,`anthropic_messages` and the entered key. Save retains that URL and format,the catalog vendor `stepfun-step-plan`, and the selected model. The ordinaryStepFun `/v1` endpoint is not substituted for the subscription endpoint.diff --git a/scripts/e2e/provider-api-style.tsx b/scripts/e2e/provider-api-style.tsxindex e1f83a373..69aac366d 100644--- a/scripts/e2e/provider-api-style.tsx+++ b/scripts/e2e/provider-api-style.tsx@@ -182,8 +182,13 @@ globalThis.providerApiStyleProbe = async () => {render();const beforeStepfunCreate = creates.length;const beforeStepfunDiscovery = discoveries.length;- click(document.querySelector('[data-service-id="stepfun-plan"]'));+ const stepfunTile = document.querySelector<HTMLElement>('[data-service-id="stepfun-plan"]');+ assert(stepfunTile?.textContent?.includes("api.stepfun.com/step_plan/v1"),+ `${locale}: StepFun chooser hides the subscription path`);+ click(stepfunTile);await frame();+ assert(document.querySelector(".provider-service-chip-host")?.textContent === "api.stepfun.com/step_plan/v1",+ `${locale}: StepFun connection summary hides the subscription path`);const keyInput = document.querySelector<HTMLInputElement>('input[type="password"]');assert(keyInput, `${locale}: StepFun key input missing`);flushSync(() => {