Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

test(providers): cover StepFun Plan setup across the service picker

zszz3dd50362f5dfa
diff --cc apps/desktop/test/service-catalog.test.mjs
index f206e98f2,f206e98f2..3c422b685
--- a/apps/desktop/test/service-catalog.test.mjs
+++ b/apps/desktop/test/service-catalog.test.mjs
@@@ -14,10 -14,10 +14,11 @@@ import
namedServiceOptions,
} from "../src/components/settings/service-catalog.ts";
--// Stands in for i18next with two localized labels, so a label-only match is
++// Stands in for i18next with localized labels, so a label-only match is
// distinguishable from a match on the canonical English name.
const labels = {
"settings.presetMoonshotCn": "月之暗面",
++ "settings.presetStepfunPlan": "阶跃星辰 Plan(订阅)",
"settings.presetCustomEndpoint": "自定义端点",
};
const translate = (key) => labels[key] ?? key;
@@@ -33,6 -33,6 +34,16 @@@ test("every named preset is offered onc
assert.equal(openai?.host, "api.openai.com");
});
++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");
++ for (const query of ["阶跃星辰", "StepFun Plan", "stepfun-step-plan", "api.stepfun.com/step_plan/v1"]) {
++ assert.ok(ids(query).includes("stepfun-plan"), query);
++ }
++});
++
test("an empty or blank query keeps every option", () => {
assert.deepEqual(ids(""), options.map((option) => option.id));
assert.deepEqual(ids(" "), options.map((option) => option.id));
diff --cc docs/spec/06-delivery/04-e2e-test-plan.md
index aa5456842,c17af702f..9f1cc3a50
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@@ -8389,6 -8433,6 +8433,24 @@@ must keep splitting are covered by `mar
Host persistence, live OAuth/model calls and visual layout were not exercised.
Post-integration main E2E is NOT RUN.
++#### E2E-PROVIDER-stepfun-plan-setup: Save the StepFun subscription preset
++
++- **Preconditions**: Isolated Electron profile, English and Simplified Chinese,
++ 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 for
++ model discovery, explicitly select Step 5 Preview, then save.
++- **Expected**: 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 ordinary
++ StepFun `/v1` endpoint is not substituted for the subscription endpoint.
++- **Automation**: `pnpm test:e2e:provider-api-style` uses real settings components
++ with only the API boundary stubbed. `provider-presets.test.ts` checks the
++ preset contract and ordinary-endpoint separation; `service-catalog.test.mjs`
++ checks discoverability by localized label, name, vendor key, and URL.
++- **Scope**: Save/discovery payloads are covered; host persistence, live model
++ calls, and visual layout are not asserted by this fixture.
++- **Specs linked**: `03-runtime/12-provider-config-schema.md`, `guide/stepfun.md`.
++
#### E2E-PROVIDER-copy-config-without-credentials: Copy configuration into an independent provider
- **Preconditions**: Settings contains an ordinary provider with a saved API
diff --cc packages/shared/src/provider-presets.test.ts
index e4f57ea77,e4f57ea77..c714c53cd
--- a/packages/shared/src/provider-presets.test.ts
+++ b/packages/shared/src/provider-presets.test.ts
@@@ -181,6 -181,6 +181,19 @@@ describe("named endpoint presets", () =
});
});
++ it("keeps StepFun Plan on its subscription endpoint and catalog vendor", () => {
++ const expected = {
++ id: "stepfun-plan",
++ vendorKey: "stepfun-step-plan",
++ baseUrl: "https://api.stepfun.com/step_plan/v1",
++ apiStyle: "anthropic_messages",
++ };
++ expect(NAMED_ENDPOINT_PRESETS.find((preset) => preset.id === expected.id)).toMatchObject(expected);
++ expect(matchNamedPreset({ vendorKey: expected.vendorKey })).toMatchObject(expected);
++ expect(matchNamedPreset({ baseUrl: expected.baseUrl })).toMatchObject(expected);
++ expect(matchNamedPreset({ baseUrl: "https://api.stepfun.com/v1" })?.id).not.toBe(expected.id);
++ });
++
it("maps DashScope and Doubao aliases to China catalog keys", () => {
expect(matchNamedPreset({ vendorKey: "dashscope" })?.id).toBe("alibaba-cn");
expect(matchNamedPreset({ vendorKey: "doubao" })?.id).toBe("volcengine");
diff --cc scripts/e2e/provider-api-style.tsx
index 7dba83949,770d6190a..e1f83a373
--- a/scripts/e2e/provider-api-style.tsx
+++ b/scripts/e2e/provider-api-style.tsx
@@@ -52,6 -52,6 +52,13 @@@ globalThis.providerApiStyleProbe = asyn
};
api.listProviderModels = async (input) => {
discoveries.push(structuredClone(input));
++ if (input.baseUrl === "https://api.stepfun.com/step_plan/v1") {
++ return { models: [{
++ modelId: "step-5-preview", displayName: "Step 5 Preview", providerId: "stepfun-fixture",
++ source: "discovered", capabilities: ["text", "tools", "vision", "reasoning"],
++ supportedThinkingLevels: ["low", "medium", "high"], contextWindow: 1000000, maxTokens: 65536,
++ }], source: "remote" };
++ }
return { models: [], source: "remote" };
};
/* The root container only mounts React; every production surface under test
@@@ -173,6 -173,6 +180,40 @@@
for (const locale of ["en", "zh-CN"]) {
await i18n.changeLanguage(locale);
render();
++ const beforeStepfunCreate = creates.length;
++ const beforeStepfunDiscovery = discoveries.length;
++ click(document.querySelector('[data-service-id="stepfun-plan"]'));
++ await frame();
++ const keyInput = document.querySelector<HTMLInputElement>('input[type="password"]');
++ assert(keyInput, `${locale}: StepFun key input missing`);
++ flushSync(() => {
++ Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!
++ .call(keyInput, "stepfun-fixture-key");
++ keyInput!.dispatchEvent(new Event("input", { bubbles: true }));
++ });
++ await until(() => discoveries.length > beforeStepfunDiscovery, "StepFun discovery");
++ const discovery = discoveries.at(-1)!;
++ assert(discovery.baseUrl === "https://api.stepfun.com/step_plan/v1" &&
++ discovery.apiStyle === "anthropic_messages" && discovery.apiKey === "stepfun-fixture-key",
++ `${locale}: StepFun discovery used the wrong route or credentials`);
++ const stepfunCheckbox = () => [...document.querySelectorAll<HTMLInputElement>('input[type="checkbox"]')]
++ .find((input) => input.closest("label")?.textContent?.includes("step-5-preview"));
++ await until(() => Boolean(stepfunCheckbox()), "StepFun discovered model");
++ // Exercise explicit selection even when the recommendation preselected it.
++ if (stepfunCheckbox()!.checked) click(stepfunCheckbox());
++ click(stepfunCheckbox());
++ assert(stepfunCheckbox()!.checked, `${locale}: StepFun model was not selected`);
++ await until(() => !control("settings.saveProvider").disabled, "StepFun save enabled");
++ click(control("settings.saveProvider"));
++ await until(() => creates.length === beforeStepfunCreate + 1, "StepFun saved");
++ const savedStepfun = creates.at(-1)!;
++ assert(savedStepfun.vendorKey === "stepfun-step-plan" &&
++ savedStepfun.baseUrl === "https://api.stepfun.com/step_plan/v1" &&
++ savedStepfun.apiStyle === "anthropic_messages", `${locale}: StepFun saved the wrong preset`);
++ assert(savedStepfun.models?.length === 1 && savedStepfun.models[0].id === "step-5-preview",
++ `${locale}: StepFun saved the wrong model selection`);
++ results.push(`${locale}:stepfun-plan-choose-key-discover-select-save`);
++ render();
// 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]")];