Skip to content

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

feat(search): route official search from existing provider entries

hui455d6d30a6ac903
diff --git a/apps/desktop/src/components/settings/ModelSelectionPanes.tsx b/apps/desktop/src/components/settings/ModelSelectionPanes.tsx
index bfb74c16c..8bffe093f 100644
--- a/apps/desktop/src/components/settings/ModelSelectionPanes.tsx
+++ b/apps/desktop/src/components/settings/ModelSelectionPanes.tsx
@@ -277,10 +277,9 @@ export function ModelSelectionPanes({
if (models.length === 0) setChosenQuery("");
}, [models.length]);
- // The hosted web search tool only exists on two wires; on any other
- // style the opt-in cannot work, so the checkbox stays present but disabled
- // with an explanatory hint instead of silently doing nothing.
- const nativeWebSearchWireCapable = nativeWebSearchSupportedOn(apiStyle);
+ // Use the same published endpoint routing as the runtime. A disabled control
+ // means this connection is not integrated, not that the vendor cannot search.
+ const nativeWebSearchWireCapable = nativeWebSearchSupportedOn(apiStyle, lookupContext?.baseUrl);
/**
* The chosen list narrows with the discovered list's rule plus the binding's
diff --git a/apps/desktop/src/components/settings/ProviderEndpointGuidance.tsx b/apps/desktop/src/components/settings/ProviderEndpointGuidance.tsx
new file mode 100644
index 000000000..c0adac593
--- /dev/null
+++ b/apps/desktop/src/components/settings/ProviderEndpointGuidance.tsx
@@ -0,0 +1,24 @@
+import { useTranslation } from "react-i18next";
+import type { CatalogApiStyle } from "@pi-desktop/shared";
+import { Button } from "../ui";
+import { API_STYLE_LABEL_KEYS } from "./provider-api-style";
+import { endpointSuggestion } from "./provider-endpoint-guidance";
+
+export function ProviderEndpointGuidance({ baseUrl, apiStyle, disabled, onApply }: {
+ baseUrl: string;
+ apiStyle: CatalogApiStyle;
+ disabled: boolean;
+ onApply: (suggestion: { baseUrl: string; apiStyle: CatalogApiStyle }) => void;
+}) {
+ const { t } = useTranslation();
+ const suggestion = endpointSuggestion(baseUrl, apiStyle);
+ if (!suggestion) return null;
+ return <div className="provider-endpoint-guidance" role="status">
+ <span>{t("settings.endpointFormatGuidance", {
+ format: t(API_STYLE_LABEL_KEYS[suggestion.apiStyle]),
+ })}</span>
+ <Button type="button" disabled={disabled} onClick={() => onApply(suggestion)}>
+ {t("settings.applyEndpointFormat")}
+ </Button>
+ </div>;
+}
diff --git a/apps/desktop/src/components/settings/ProviderSetupDialog.tsx b/apps/desktop/src/components/settings/ProviderSetupDialog.tsx
index 7fd61eb1a..c19e4649d 100644
--- a/apps/desktop/src/components/settings/ProviderSetupDialog.tsx
+++ b/apps/desktop/src/components/settings/ProviderSetupDialog.tsx
@@ -25,64 +25,8 @@ import { CUSTOM_SERVICE, ServicePicker } from "./ServicePicker";
import type { ProviderCopyDraft } from "./provider-copy";
import { API_STYLE_LABEL_KEYS, CUSTOM_PROVIDER_API_STYLES, 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 "";
@@ -90,7 +34,7 @@ function serviceIdFor(provider?: ProviderPublic | null): string {
}
function initialName(provider?: ProviderPublic | null): string {
- return providerSetupPreset(provider)?.name ?? provider?.name ?? "";
+ return provider?.name ?? providerSetupPreset(provider)?.name ?? "";
}
function initialBaseUrl(provider?: ProviderPublic | null): string {
@@ -391,6 +335,21 @@ export function ProviderSetupDialog({
<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);
+ setError("");
+ setTestResult("");
+ }}
+ />
+
<div className="provider-setup-credentials">
<div
className={
diff --git a/apps/desktop/src/components/settings/provider-api-style.ts b/apps/desktop/src/components/settings/provider-api-style.ts
index 7f1df51ce..cf81345bd 100644
--- a/apps/desktop/src/components/settings/provider-api-style.ts
+++ b/apps/desktop/src/components/settings/provider-api-style.ts
@@ -36,9 +36,11 @@ export function needsCustomApiStyleChoice(
export function providerSetupPreset(provider?: ProviderPublic | null) {
if (!provider || isAccountOnlyApiStyle(provider.apiStyle)) return undefined;
- return matchNamedPreset({
+ const preset = matchNamedPreset({
vendorKey: provider.vendorKey,
baseUrl: provider.baseUrl,
apiStyle: provider.apiStyle,
});
+ // A published hostname does not override an explicitly saved wire format.
+ return provider.apiStyle && preset?.apiStyle !== provider.apiStyle ? undefined : preset;
}
diff --git a/apps/desktop/src/components/settings/provider-endpoint-guidance.ts b/apps/desktop/src/components/settings/provider-endpoint-guidance.ts
new file mode 100644
index 000000000..632a898d4
--- /dev/null
+++ b/apps/desktop/src/components/settings/provider-endpoint-guidance.ts
@@ -0,0 +1,48 @@
+import type { CatalogApiStyle } from "@pi-desktop/shared";
+
+export function getBaseUrlIssue(value: string): "invalid" | null {
+ if (!value.trim()) return null;
+ try {
+ const url = new URL(value.trim());
+ return !["http:", "https:"].includes(url.protocol) || !url.hostname ||
+ url.username || url.password || url.search || url.hash ? "invalid" : null;
+ } catch {
+ return "invalid";
+ }
+}
+
+const OPERATIONS: ReadonlyArray<readonly [string, CatalogApiStyle]> = [
+ ["/chat/completions", "chat_completions"],
+ ["/responses", "responses"],
+ ["/messages", "anthropic_messages"],
+];
+
+/** URL evidence is a suggestion, never a successful capability probe. */
+export function endpointSuggestion(value: string, current: CatalogApiStyle):
+ { baseUrl: string; apiStyle: CatalogApiStyle } | undefined {
+ if (!value.trim() || getBaseUrlIssue(value)) return undefined;
+ const url = new URL(value.trim());
+ const path = url.pathname.replace(/\/+$/, "");
+ for (const [suffix, apiStyle] of OPERATIONS) {
+ if (!path.endsWith(suffix)) continue;
+ if (current === apiStyle ||
+ (apiStyle === "chat_completions" && current === "opencode_go") ||
+ (apiStyle === "responses" && current === "openai_codex_responses") ||
+ (apiStyle === "anthropic_messages" && current === "pi_messages")) return undefined;
+ return { baseUrl: `${url.origin}${path.slice(0, -suffix.length)}`, apiStyle };
+ }
+ return undefined;
+}
+
+/** Strip only operations belonging to the selected protocol. */
+export function normalizeBaseUrlInput(value: string, apiStyle: CatalogApiStyle): string {
+ const trimmed = value.trim();
+ if (!trimmed || getBaseUrlIssue(trimmed)) return trimmed;
+ const normalized = trimmed.replace(/\/+$/, "");
+ const wireStyle = apiStyle === "opencode_go" ? "chat_completions"
+ : apiStyle === "openai_codex_responses" ? "responses"
+ : apiStyle === "pi_messages" ? "anthropic_messages" : apiStyle;
+ const suffixes = [...OPERATIONS.filter(([, style]) => style === wireStyle).map(([suffix]) => suffix), "/models"];
+ const suffix = suffixes.find((item) => normalized.toLowerCase().endsWith(item));
+ return suffix ? normalized.slice(0, -suffix.length).replace(/\/+$/, "") : normalized;
+}
diff --git a/apps/desktop/src/styles/providers.css b/apps/desktop/src/styles/providers.css
index 3ae7d672b..5b8a81011 100644
--- a/apps/desktop/src/styles/providers.css
+++ b/apps/desktop/src/styles/providers.css
@@ -1507,3 +1507,17 @@
flex: 1;
min-width: 0;
}
+
+/* Keep endpoint advice readable without widening the provider dialog. */
+.provider-endpoint-guidance {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 8px;
+ padding: 8px;
+ color: var(--ds-text-secondary);
+ font-size: var(--text-sm);
+}
+.provider-endpoint-guidance > span {
+ flex: 1 1 260px;
+}
diff --git a/apps/desktop/test/provider-api-style.test.mjs b/apps/desktop/test/provider-api-style.test.mjs
index edade5daf..bed759db9 100644
--- a/apps/desktop/test/provider-api-style.test.mjs
+++ b/apps/desktop/test/provider-api-style.test.mjs
@@ -50,3 +50,8 @@ test("ordinary named services retain existing preset selection", () => {
assert.equal(preset.apiStyle, "anthropic_messages");
assert.equal(providerSetupPreset(null), undefined);
});
+
+test("a named hostname cannot overwrite a manually saved protocol", () => {
+ assert.equal(providerSetupPreset(source("chat_completions")), undefined);
+
+});
diff --git a/apps/desktop/test/provider-endpoint-guidance.test.mjs b/apps/desktop/test/provider-endpoint-guidance.test.mjs
new file mode 100644
index 000000000..07a14c9e7
--- /dev/null
+++ b/apps/desktop/test/provider-endpoint-guidance.test.mjs
@@ -0,0 +1,30 @@
+import assert from "node:assert/strict";
+import { register } from "node:module";
+import test from "node:test";
+register(new URL("./helpers/ts-import-hooks.mjs", import.meta.url));
+const { endpointSuggestion, normalizeBaseUrlInput } = await import(
+ "../src/components/settings/provider-endpoint-guidance.ts"
+);
+
+test("pasted operation URLs suggest the matching format without guessing from a model or host", () => {
+ for (const [suffix, apiStyle] of [["chat/completions", "chat_completions"], ["responses", "responses"], ["messages", "anthropic_messages"]]) {
+ assert.deepEqual(endpointSuggestion(`https://relay.example/v1/${suffix}/`, "google_generative_ai"), {
+ baseUrl: "https://relay.example/v1", apiStyle,
+ });
+ assert.equal(endpointSuggestion(`https://relay.example/v1/${suffix}`, apiStyle), undefined);
+ }
+ assert.equal(endpointSuggestion("https://relay.example/v1", "chat_completions"), undefined);
+ assert.equal(endpointSuggestion("https://api.deepseek.com.evil.example", "chat_completions"), undefined);
+});
+
+test("unsafe or ambiguous addresses never produce a recommendation", () => {
+ for (const url of ["", "not a url", "file:///messages", "https://user:[email protected]/messages", "https://relay.example/messages?key=secret", "https://relay.example/messages#fragment"]) {
+ assert.equal(endpointSuggestion(url, "chat_completions"), undefined);
+ }
+});
+
+test("normalization preserves mismatched operations until the user applies a recommendation", () => {
+ assert.equal(normalizeBaseUrlInput("https://relay.example/v1/responses", "chat_completions"), "https://relay.example/v1/responses");
+ assert.equal(normalizeBaseUrlInput("https://relay.example/v1/chat/completions/", "opencode_go"), "https://relay.example/v1");
+ assert.equal(normalizeBaseUrlInput("https://relay.example/v1/responses", "opencode_go"), "https://relay.example/v1/responses");
+});
diff --git a/docs/adr/0297-provider-hosted-web-search-adapter-capability.md b/docs/adr/0297-provider-hosted-web-search-adapter-capability.md
index 595ded26e..1aa4ffcc0 100644
--- a/docs/adr/0297-provider-hosted-web-search-adapter-capability.md
+++ b/docs/adr/0297-provider-hosted-web-search-adapter-capability.md
@@ -37,11 +37,12 @@ Two upstream facts forced the design:
1. **Capability is declared data and gated by the resolved wire API.** The
per-model opt-in is `ModelBinding.nativeWebSearch` (settings UI: a checkbox
- in the model's advanced sheet, disabled unless the provider style is
+ in the model's advanced sheet, disabled unless its resolved search route is
`responses`, `openai_codex_responses`, or `anthropic_messages`). models.dev
publishes no hosted-tool capability, so there is no catalog default; absent
means off. Runtime `resolveNativeWebSearch` keys on the final adapter API —
- never vendor names, base URL hostnames, or model-id substrings.
+ never vendor names or model-id substrings. The official-route amendment
+ below resolves an opted-in request before this final wire gate.
2. **Attachment and extraction live in pi-ai adapters**, delivered by
extending `patches/@[email protected]`:
@@ -111,3 +112,21 @@ Two upstream facts forced the design:
- Search executes on the provider. There is no local fetch, no ask/allow
prompt, and billing is the provider's. The model-level opt-in (default
off) is the user consent surface.
+
+## 2026-09-24 amendment: one service entry for official search
+
+DeepSeek's saved Completions configuration cannot carry the hosted search
+tool available on its published Anthropic interface. Keep the existing
+per-model search opt-in and resolve the request
+through a shared published-route table instead. DeepSeek Completions requests
+use its same-origin Anthropic interface only when search is enabled; xAI and
+legacy OpenAI Completions use same-origin Responses. The existing adapters own
+request construction, search parsing, citations and history replay.
+
+Only exact official HTTPS origins and paths match; vendor/model labels do not.
+Unknown relays and explicit non-Completions protocols stay unchanged. Saved
+provider settings are never rewritten, so turning search off restores the
+original route. The model, registry, history restoration and delegation must
+all use the same effective API. No new engine, tool executor or persistence
+contract is introduced. Distinct vendor formats need their own tested adapter;
+a disabled control describes missing app integration, not vendor inability.
diff --git a/docs/project/native-search-provider-audit.md b/docs/project/native-search-provider-audit.md
new file mode 100644
index 000000000..82fdc69ba
--- /dev/null
+++ b/docs/project/native-search-provider-audit.md
@@ -0,0 +1,38 @@
+# Native search provider audit
+
+Checked 2026-09-24 against the configured endpoint presets and public vendor
+documentation. No paid inference or live search request was made. This is an
+implementation audit, not a claim that every model offered by a vendor supports
+every tool. An enabled checkbox still requires a model accepting that tool.
+
+| Connection | Finding | Application behavior in this change |
+| --- | --- | --- |
+| DeepSeek official Chat Completions | Official Harness uses the same key and `/anthropic/v1/messages` with `web_search_20250305`. | One existing entry; search opt-in routes this model's request internally. Search off keeps Completions. |
+| xAI official Chat Completions | Official search documentation specifies Responses and `web_search`. | Same opt-in routing to same-origin Responses; no second preset. |
+| OpenAI official legacy Chat Completions | The existing application supports search through Responses; the current OpenAI preset already uses it. | Legacy Completions entries can opt in without replacing their saved configuration. Current Responses and Codex accounts stay unchanged. |
+| Anthropic / existing Responses connections | Existing adapters attach tools and preserve search blocks and citations. | Existing behavior retained; protocol compatibility alone does not prove model or gateway support. |
+| Google Gemini | Google documents a Google Search tool and grounding/search-suggestion results. The current Google adapter has no `webSearch` request/response handling. | Still not integrated for this format; the hint says so rather than claiming the vendor lacks search. Requires a distinct adapter contract. |
+| Qwen / DashScope | Completions uses `enable_search`; newer models also have Responses or Anthropic paths, with model and workspace constraints. | No blind route switch for all configured models; those formats require model-specific capability and result handling. |
+| Zhipu / Z.AI | Zhipu documents its own `web_search` object and a separate search API. | No substitution of OpenAI/Anthropic tool schemas; format-specific integration remains outstanding. |
+| Moonshot / Kimi | `$web_search` is a `builtin_function` with a tool-call/result loop. | Not treated as a provider-hosted Anthropic/Responses block; needs its own tool lifecycle integration. |
+| Groq | Compound models were deprecated on September 21; current docs point to browser search for particular GPT OSS models. | No blanket capability inferred from the Groq preset or old Compound documentation. |
+| MiniMax / Kimi Coding Anthropic routes | The preset already selects Anthropic Messages. Support for the exact hosted tool is not established by the protocol alone. | Existing manual opt-in retained; not newly certified by this audit. |
+| Mistral, Xiaomi, Together, Fireworks, SiliconFlow, Volcengine | This audit did not establish a drop-in compatible hosted-search contract for the configured endpoints. Mistral's attempted page returned 404; Xiaomi docs transport failed. | No inferred support or automatic credential rerouting. Further vendor-specific integration remains open. |
+
+## Sources
+
+- [DeepSeek official Harness search provider](https://github.com/deepseek-ai/deepseek-harness/blob/46a7f68b0922371ce7144b668b90e377d8e799f4/packages/web/web-search-deepseek/src/provider.ts)
+- [xAI web search](https://docs.x.ai/developers/tools/web-search)
+- [Google Search grounding](https://ai.google.dev/gemini-api/docs/google-search)
+- [Model Studio web search](https://www.alibabacloud.com/help/en/model-studio/web-search)
+- [Zhipu web search](https://docs.bigmodel.cn/cn/guide/tools/web-search)
+- [Kimi built-in web search](https://platform.moonshot.cn/docs/guide/use-web-search)
+- [Groq Compound status](https://console.groq.com/docs/compound)
+- Existing application contracts: `packages/shared/src/native-web-search.ts`,
+ `packages/agent-runtime/src/provider-binding.ts`, and the pinned pi-ai adapters.
+
+Exact first-party origins and paths are required for request routing. Vendor
+names and model labels are not authority to send a relay key to an official
+service. Unknown connections retain their configured destination. No new
+discovery probes, hidden inference charges, or persistent transport migrations
+are introduced. Full protocol probing from issue #907 remains separate work.
diff --git a/docs/spec/03-runtime/11-provider-model-system.md b/docs/spec/03-runtime/11-provider-model-system.md
index 39150bcb0..47fb8b15d 100644
--- a/docs/spec/03-runtime/11-provider-model-system.md
+++ b/docs/spec/03-runtime/11-provider-model-system.md
@@ -238,7 +238,8 @@ PI-Desktop must not permanently restrict users to a short fixed model list.
When enabled and the model resolves to `anthropic-messages`,
`openai-responses`, `azure-openai-responses`, or
`openai-codex-responses` (stored apiStyle `anthropic_messages`, `responses`,
- or `openai_codex_responses`), the adapter attaches the provider's hosted
+ or `openai_codex_responses`, or a published official search route from
+ Chat Completions), the adapter attaches the provider's hosted
search tool (`web_search_20250305` / `web_search`), extracts activity into
`UiMessage.hostedSearch` (`rounds` for display, `replay` for convertMessages),
and restores raw blocks on later turns including after restart (ADR 0297).
@@ -791,3 +792,15 @@ fix.
- Automatic paid-plan discovery for every vendor portal
- Proprietary non-HTTP SDKs without pi-ai support
- Cloud-synced provider profiles
+
+### Search setup guidance
+
+The search checkbox uses the same request-only transport resolver as the
+runtime. An opted-in official DeepSeek, xAI or legacy OpenAI Chat Completions
+model can use its published search interface without another service entry or
+changes to stored connection settings. Other models and search-off requests
+keep their configured transport. Search is off by default. Known routes match
+exact origins and paths, never display names or model substrings.
+The resolved adapter remains authoritative for search extraction and replay.
+Unknown connection formats are described as not integrated by this app rather
+than unsupported by the vendor. See the provider configuration specification.
diff --git a/docs/spec/03-runtime/12-provider-config-schema.md b/docs/spec/03-runtime/12-provider-config-schema.md
index 4104de65f..ad9c138af 100644
--- a/docs/spec/03-runtime/12-provider-config-schema.md
+++ b/docs/spec/03-runtime/12-provider-config-schema.md
@@ -643,3 +643,31 @@ secret:provider:<providerId>:oauth
The two refs are independent, so one row may hold a key, a vendor account, or
both; see [14-secrets-storage](14-secrets-storage.md) §10. Future multi-secret
providers may add further suffixes (`:client_secret`, etc.).
+
+### Endpoint format guidance and native search
+
+A provider keeps one saved service entry. Enabling `ModelBinding.nativeWebSearch`
+does not rewrite its URL, API style, name, credential reference, or other models.
+The UI and runtime share `nativeWebSearchTransport`: for exact published HTTPS
+origins and paths, an opted-in Chat Completions request uses an existing search
+adapter. DeepSeek (`api.deepseek.com`, root or `/v1`) uses `/anthropic/v1/messages`;
+xAI and OpenAI (`api.x.ai/v1`, `api.openai.com/v1`) use Responses at the same
+origin. Turning search off uses the original configured transport again.
+Existing Responses, Codex, Anthropic and explicitly selected other protocols
+retain their behavior. Vendor/model names never cause routing; proxies, custom
+ports, unrelated paths, userinfo, queries and fragments do not match.
+
+No extra DeepSeek preset, search service, interface-switch action, migration or
+new IPC field is introduced. Unknown connection formats stay unavailable in
+this app; that is not a claim about a vendor website or other API. Some official
+search APIs require distinct adapters; see the native search provider audit.
+
+For custom endpoints, an explicit `/chat/completions`, `/responses`, or
+`/messages` URL can suggest the matching format. Applying that suggestion only
+changes the draft format and strips the operation suffix, preserving the
+origin. It is not a successful connection/capability probe. A plain base URL
+does not prove the protocol. Invalid/credential-bearing URLs give no advice.
+OpenCode Go normalizes `/chat/completions`, not `/responses`. Saved explicit
+formats take precedence over hostname presets; service names survive edits.
+Cancel does not persist draft changes. Full probing and automatic error-driven
+fallback from #907 remain separate work.
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 8b25c2fe5..e73a9a1ae 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -14992,3 +14992,26 @@ renderer's durable transcript reads. No real model or provider is contacted.
`node --test apps/desktop/test/plugin-timeout-budgets.test.mjs`,
`pnpm --filter @pi-desktop/shared test`, and
`pnpm --filter @pi-desktop/host-runtime test`.
+
+## E2E-PROVIDER-endpoint-guidance-and-search
+
+- **Preconditions:** Isolated Electron/Chromium, production provider form,
+ synthetic provider responses; no live keys or services.
+- **Steps:** Open an existing DeepSeek, xAI and legacy OpenAI Completions entry.
+ Check search directly, cancel, reopen, check and save, reopen, uncheck and save.
+ Apply format advice on relay `/responses` and `/messages` operation URLs.
+- **Expected:** One service entry and one checkbox; no separate search preset or
+ interface-switch action. Save changes only the model opt-in, retaining URL,
+ format, name, key and other model settings; Cancel writes nothing. A selected
+ explicit format wins over hostname defaults. Relay advice preserves origin.
+- **Specs:** 03-runtime/12 endpoint guidance; 03-runtime/11 search setup guidance;
+ ADR 0297 official-route amendment.
+- **Acceptance:** English/Chinese interaction flows and the previous custom and
+ Codex account paths pass. Real adapter contracts verify opt-in request routes,
+ credentials and search tools. A DeepSeek conversation continues off/on/off,
+ retains prior text, and does not replay encrypted search blocks to Completions.
+- **Milestone:** Provider configuration maintenance.
+- **Status:** `pnpm test:e2e:provider-api-style` and
+ `official-native-search.test.ts`; shared route tests reject lookalike hosts,
+ unsafe URLs and unknown gateways. The UI fixture does not prove Host/SQLite
+ persistence or live provider availability.
diff --git a/docs/zh-CN/spec/03-runtime/11-provider-model-system.md b/docs/zh-CN/spec/03-runtime/11-provider-model-system.md
index 1af2ff7ef..1df70ce1d 100644
--- a/docs/zh-CN/spec/03-runtime/11-provider-model-system.md
+++ b/docs/zh-CN/spec/03-runtime/11-provider-model-system.md
@@ -212,7 +212,7 @@ PI-Desktop 不得把用户永久限制在一份简短的固定模型列表上。
因此没有目录默认值)。启用后,当模型解析到 `anthropic-messages`、
`openai-responses`、`azure-openai-responses` 或 `openai-codex-responses`
(存储的 apiStyle 为 `anthropic_messages`、`responses` 或
- `openai_codex_responses`)时,适配器附加提供商托管搜索工具
+ `openai_codex_responses`,或从 Chat Completions 解析到已确认的官方搜索路径)时,适配器附加提供商托管搜索工具
(`web_search_20250305` / `web_search`),将活动写入
`UiMessage.hostedSearch`,并在后续回合(含重启后)回放原始数据(ADR 0297)。
OpenAI OAuth 使用独立的 Codex Responses 适配器和 ChatGPT 订阅端点,不是公开的
@@ -681,3 +681,11 @@ OpenAI Responses 适配器必须把 `response.completed`(以及
已知目标模型时,估算遵守该适配器既有的模型切换回放边界。压缩序列化把搜索投影传入摘要请求,
不伪装成客户端工具调用。被压缩前缀转为生成的文本摘要;保留尾部中的原始搜索仍按既有规则回放,
不承诺摘要无损保留原始搜索块。
+
+### 搜索配置引导
+
+搜索开关与运行时共用请求路由判断。官方 DeepSeek、xAI 和旧 OpenAI Chat Completions
+配置开启搜索后,内部使用已确认的搜索接口,不增加第二个服务,不改写连接设置。
+其他模型及关闭搜索的请求继续使用原协议,搜索默认关闭。路由只匹配精确来源和路径,
+不根据展示名称或模型名推断。最终适配器继续负责搜索解析和历史回放。
+未集成格式显示“应用尚未适配”,不冒充厂商能力结论。详见提供商配置规格。
diff --git a/docs/zh-CN/spec/03-runtime/12-provider-config-schema.md b/docs/zh-CN/spec/03-runtime/12-provider-config-schema.md
index 7ff1798a2..2a0813c84 100644
--- a/docs/zh-CN/spec/03-runtime/12-provider-config-schema.md
+++ b/docs/zh-CN/spec/03-runtime/12-provider-config-schema.md
@@ -463,3 +463,23 @@ secret:provider:<providerId>:oauth
两个引用相互独立,因此一行可以只有密钥、只有厂商账户,或两者兼有;参见
[14-secrets-storage](14-secrets-storage.md) §10。未来的多重秘密提供商可能会
继续添加后缀(`:client_secret` 等)。
+
+### 接口格式引导与原生搜索
+
+每个提供商保留一个服务入口。开启模型的 `nativeWebSearch` 不改写服务地址、
+接口格式、名称、凭据引用或其他模型。界面与运行时共用 `nativeWebSearchTransport`:
+仅匹配已确认的官方 HTTPS 来源和路径,且用户开启搜索时,才在请求阶段选择已有适配器。
+DeepSeek 官方根地址或 `/v1` 通过 `/anthropic/v1/messages` 搜索;xAI 和旧 OpenAI
+Chat Completions 配置使用同源 Responses。关闭搜索后恢复原配置的请求方式。
+原有 Responses、Codex、Anthropic 及其他明确选择的协议不变。
+不依据厂商名或模型名跳转;中转站、自定义端口、其他路径、含凭据或查询片段的地址不匹配。
+
+不增加 DeepSeek 搜索预设、第二个服务、切换接口操作、迁移或 IPC 字段。
+其他尚未集成的搜索格式会说明应用未适配,不代表厂商官网或其他 API 不支持。
+部分官方搜索需要独立的协议适配,详见搜索服务核查记录。
+
+自定义服务粘贴 `/chat/completions`、`/responses` 或 `/messages` 完整请求地址时,
+可显式应用格式建议并移除请求后缀,服务来源不变。这不是联网能力验证;普通基础地址
+不触发猜测,无效及带凭据地址不给建议。OpenCode Go 对应 `/chat/completions` 后缀。
+已保存的明确格式优先于域名预设,服务备注保留,取消不写入草稿。
+#907 的完整探测和错误驱动自动切换仍是独立工作。
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 4e6e8c0ae..2e1b9d99d 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -8849,3 +8849,19 @@ the latest destination. These assertions measure work counts, not device FPS.
`node --test apps/desktop/test/session-transcript-empty-read.test.mjs`、
`node --test apps/desktop/test/plugin-timeout-budgets.test.mjs`、
`pnpm --filter @pi-desktop/shared test`、`pnpm --filter @pi-desktop/host-runtime test`。
+
+## E2E-PROVIDER-endpoint-guidance-and-search
+
+- **前提:** 隔离 Electron/Chromium、真实配置表单、合成响应,无真实密钥或服务。
+- **步骤:** 打开已有 DeepSeek、xAI、旧 OpenAI 服务,直接勾选搜索、取消、重开、
+ 勾选并保存、重开后取消勾选并保存;应用中转站完整请求地址的格式建议。
+- **预期:** 一个服务入口、一个搜索开关;没有额外搜索预设或切换接口按钮。
+ 只保存模型搜索选项,地址、协议、名称、密钥及其他模型配置保持不变;取消不写入。
+ 已保存格式优先于域名预设,中转站建议不改变来源。
+- **规格:** 03-runtime/12、03-runtime/11、ADR 0297 官方路由修订。
+- **验收:** 中英文及原有自定义/OAuth 路径通过;真实适配器验证开关控制的请求路径、
+ 凭据和工具。DeepSeek 同一会话关闭→开启→关闭搜索后仍能继续,保留文本,
+ 不向 Completions 重放搜索加密数据。
+- **里程碑:** 提供商配置维护。
+- **状态:** `pnpm test:e2e:provider-api-style`、`official-native-search.test.ts`;
+ 共享路由测试覆盖伪装域名、不安全地址和未知中转站。未验证线上服务或 Host/SQLite 保存。
diff --git a/packages/agent-runtime/src/official-native-search.test.ts b/packages/agent-runtime/src/official-native-search.test.ts
new file mode 100644
index 000000000..283a9fe74
--- /dev/null
+++ b/packages/agent-runtime/src/official-native-search.test.ts
@@ -0,0 +1,105 @@
+import { describe, expect, it } from "vitest";
+import type { Message } from "@earendil-works/pi-ai";
+import { buildProviderModel, createProviderModels, apiBindingForProviderModel, type RuntimeProviderConfig } from "./provider-binding.js";
+import { modelConfigWithBinding } from "./model-capabilities.js";
+
+describe("official search through the existing service", () => {
+ it("continues the same DeepSeek conversation when search is enabled then disabled", async () => {
+ const history: Message[] = [];
+ const paths: string[] = [];
+ const bodies: Record<string, unknown>[] = [];
+ for (const [turn, enabled] of [false, true, false].entries()) {
+ const provider: RuntimeProviderConfig = {
+ id: "same-provider", name: "DeepSeek", vendorKey: "deepseek",
+ baseUrl: "https://api.deepseek.com", apiStyle: "chat_completions",
+ modelId: "deepseek-v4-flash", apiKey: "synthetic-test-key",
+ supportsReasoning: false, supportedThinkingLevels: ["off"],
+ modelConfig: {
+ source: "generic", name: "DeepSeek", baseUrl: "https://api.deepseek.com",
+ reasoning: false, input: ["text"], contextWindow: 128000, maxTokens: 4096,
+ webSearch: enabled, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
+ },
+ };
+ history.push({ role: "user", content: `question-${turn}`, timestamp: turn + 1 });
+ const model = buildProviderModel(provider);
+ const output = await createProviderModels(provider, model).streamSimple(model, { messages: history }, {
+ fetch: async (input, init) => {
+ paths.push(new URL(input instanceof Request ? input.url : String(input)).pathname);
+ bodies.push(JSON.parse(String(init?.body)) as Record<string, unknown>);
+ const event = (type: string, data: object) => `event: ${type}\ndata: ${JSON.stringify({ type, ...data })}\n\n`;
+ const body = enabled
+ ? event("message_start", { message: { id: "m-search", type: "message", role: "assistant", model: model.id,
+ content: [], stop_reason: null, usage: { input_tokens: 10, output_tokens: 0 } } }) +
+ event("content_block_start", { index: 0, content_block: { type: "server_tool_use", id: "srv-search", name: "web_search", input: { query: "fixture" } } }) +
+ event("content_block_stop", { index: 0 }) +
+ event("content_block_start", { index: 1, content_block: { type: "web_search_tool_result", tool_use_id: "srv-search",
+ content: [{ type: "web_search_result", url: "https://example.invalid/source", title: "Fixture", encrypted_content: "fixture-cipher" }] } }) +
+ event("content_block_stop", { index: 1 }) +
+ event("content_block_start", { index: 2, content_block: { type: "text", text: "" } }) +
+ event("content_block_delta", { index: 2, delta: { type: "text_delta", text: `answer-${turn}` } }) +
+ event("content_block_stop", { index: 2 }) +
+ event("message_delta", { delta: { stop_reason: "end_turn" }, usage: { output_tokens: 5 } }) +
+ event("message_stop", {})
+ : `data: ${JSON.stringify({ id: "fixture", choices: [{ index: 0, delta: { role: "assistant", content: `answer-${turn}` }, finish_reason: null }] })}\n\n` +
+ `data: ${JSON.stringify({ id: "fixture", choices: [{ index: 0, delta: {}, finish_reason: "stop" }] })}\n\ndata: [DONE]\n\n`;
+ return new Response(body, { status: 200, headers: { "content-type": "text/event-stream" } });
+ },
+ }).result();
+ expect(output.stopReason).toBe("stop");
+ expect(output.content).toContainEqual(expect.objectContaining({ type: "text", text: `answer-${turn}` }));
+ if (enabled) expect(output.content).toContainEqual(expect.objectContaining({ type: "hostedSearch" }));
+ history.push(output);
+ }
+ expect(paths).toEqual(["/chat/completions", "/anthropic/v1/messages", "/chat/completions"]);
+ expect(JSON.stringify(bodies[1])).toContain("answer-0");
+ expect(JSON.stringify(bodies[2])).toContain("answer-1");
+ expect(JSON.stringify(bodies[2])).not.toContain("fixture-cipher");
+ expect(bodies[2].tools ?? []).toEqual([]);
+ });
+ for (const [vendorKey, baseUrl, modelId, searchApi, searchPath] of [
+ ["deepseek", "https://api.deepseek.com", "deepseek-v4-flash", "anthropic-messages", "/anthropic/v1/messages"],
+ ["xai", "https://api.x.ai/v1", "grok-4.7", "openai-responses", "/v1/responses"],
+ ["openai", "https://api.openai.com/v1", "gpt-6-sol", "openai-responses", "/v1/responses"],
+ ]) {
+ for (const enabled of [false, true]) {
+ it(`${vendorKey}: only the search opt-in changes the request route (${enabled})`, async () => {
+ const provider: RuntimeProviderConfig = {
+ id: "fixture-provider", name: "My service", vendorKey, baseUrl, modelId,
+ apiStyle: "chat_completions", apiKey: "synthetic-test-key", authKind: "api_key_and_base_url",
+ supportsReasoning: false, supportedThinkingLevels: ["off"],
+ modelConfig: modelConfigWithBinding({
+ source: "generic", name: modelId, baseUrl, reasoning: false, input: ["text"],
+ contextWindow: 128000, maxTokens: 4096,
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
+ }, { contextWindow: 128000, maxTokens: 4096, thinkingLevels: ["off"], nativeWebSearch: enabled }),
+ };
+ const before = structuredClone(provider);
+ const model = buildProviderModel(provider);
+ expect(apiBindingForProviderModel(provider).api).toBe(model.api);
+ expect(model.api).toBe(enabled ? searchApi : "openai-completions");
+ let endpoint = "";
+ let body: Record<string, unknown> = {};
+ let key: string | null = null;
+ const result = await createProviderModels(provider, model).streamSimple(model, {
+ messages: [{ role: "user", content: "Find release notes", timestamp: 1 }],
+ }, { fetch: async (input, init) => {
+ endpoint = input instanceof Request ? input.url : String(input);
+ body = JSON.parse(String(init?.body)) as Record<string, unknown>;
+ const headers = new Headers(init?.headers);
+ key = headers.get("x-api-key") ?? headers.get("authorization");
+ return new Response("captured offline", { status: 400 });
+ } }).result();
+ expect(result.stopReason).toBe("error");
+ const url = new URL(endpoint);
+ expect(url.origin).toBe(new URL(baseUrl).origin);
+ expect(url.pathname).toBe(enabled ? searchPath : `${new URL(baseUrl).pathname.replace(/\/$/, "")}/chat/completions`);
+ expect(key).toContain("synthetic-test-key");
+ expect(body.model).toBe(modelId);
+ if (enabled) expect(body.tools).toContainEqual(searchApi === "anthropic-messages"
+ ? { type: "web_search_20250305", name: "web_search" } : { type: "web_search" });
+ else expect(body.tools ?? []).toEqual([]);
+ expect(provider).toEqual(before);
+ });
+ }
+ }
+});
diff --git a/packages/agent-runtime/src/provider-binding.ts b/packages/agent-runtime/src/provider-binding.ts
index 77a842e94..1a81f6f54 100644
--- a/packages/agent-runtime/src/provider-binding.ts
+++ b/packages/agent-runtime/src/provider-binding.ts
@@ -33,6 +33,7 @@ import {
OPENCODE_GO_BASE_URL,
resolveApiStyle,
resolveNativeWebSearch,
+ nativeWebSearchTransport,
deepseekRequestCompat,
zhipuRequestCompat,
type ThinkingLevel,
@@ -160,7 +161,16 @@ export function providerRequestKey(provider: RuntimeProviderConfig): string {
* wrong adapter (the gateway answers 500, see #105).
*/
export function apiBindingForProviderModel(provider: RuntimeProviderConfig): ApiBinding {
- return apiBindingForStyle(resolveApiStyle(provider.modelConfig?.api) ?? provider.apiStyle);
+ return apiBindingForStyle(providerRequestTransport(provider).apiStyle);
+}
+
+function providerRequestTransport(provider: RuntimeProviderConfig) {
+ const apiStyle = resolveApiStyle(provider.modelConfig?.api) ?? provider.apiStyle;
+ return nativeWebSearchTransport({
+ apiStyle,
+ baseUrl: provider.baseUrl ?? provider.modelConfig?.baseUrl ?? apiBindingForStyle(apiStyle).defaultBaseUrl,
+ enabled: provider.modelConfig?.webSearch === true,
+ });
}
/**
@@ -223,7 +233,7 @@ export function buildProviderModel(
: genericModelConfig(provider.modelId, provider.baseUrl ?? binding.defaultBaseUrl);
const baseUrl = runtimeBaseUrlForApi(
binding.api,
- provider.baseUrl ?? catalog?.baseUrl ?? binding.defaultBaseUrl,
+ providerRequestTransport(provider).baseUrl ?? binding.defaultBaseUrl,
);
const zhipuCompat = zhipuRequestCompat({
vendorKey: provider.vendorKey,
@@ -290,7 +300,7 @@ export function createProviderModels(
createProvider({
id: provider.id,
name: provider.name,
- baseUrl: provider.baseUrl,
+ baseUrl: model.baseUrl,
auth: {
apiKey: {
name: `${provider.name} API key`,
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index 24b3ec406..74ad4fd0c 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -1245,6 +1245,8 @@ sklm: {
"presetTogether": "Together AI",
"presetFireworks": "Feuerwerk",
"presetDeepseek": "DeepSeek",
+ endpointFormatGuidance: "Diese Anfrage-URL deutet auf {{format}} hin. Übernehmen Sie Format und Basisadresse; dies prüft weder die Verbindung noch die Suchfunktion.",
+ applyEndpointFormat: "Vorgeschlagenes Format übernehmen",
"presetAlibabaCn": "Qwen (DashScope)",
"presetMoonshotCn": "Moonshot / Kimi",
"presetZhipuApi": "Zhipu AI",
@@ -1360,7 +1362,7 @@ sklm: {
"availableForSubagentsHint": "Ermöglichen Sie AI, dieses Modell zu verwenden, wenn Aufgaben an Subagenten delegiert werden.",
"nativeWebSearch": "Native Websuche",
"nativeWebSearchHint": "Hängt das vom Anbieter gehostete Websuche-Tool an Anfragen für dieses Modell an. Erfordert einen Endpunkt, der dies unterstützt; die Abrechnung erfolgt pro Suche beim Anbieter.",
- "nativeWebSearchUnsupported": "Die native Websuche erfordert den API-Stil „Responses“ oder „Anthropic Messages“",
+ nativeWebSearchUnsupported: "Diese Verbindung unterstützt in der App noch keine native Suche. Die Website oder eine andere API kann Suche anbieten.",
"searchModelId": "Modell-ID suchen…",
"searchChosenModels": "Hinzugefügte Modelle suchen…",
"noChosenModelMatches": "Keine passenden hinzugefügten Modelle.",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index 9ae9e0086..a3e36d209 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -1260,6 +1260,8 @@ sklm: {
presetTogether: "Together AI",
presetFireworks: "Fireworks",
presetDeepseek: "DeepSeek",
+ endpointFormatGuidance: "This request URL suggests {{format}}. Apply the matching format and base address; this is not a connection or search capability test.",
+ applyEndpointFormat: "Apply suggested format",
presetAlibabaCn: "Qwen (DashScope)",
presetMoonshotCn: "Moonshot / Kimi",
presetZhipuApi: "Zhipu AI",
@@ -1379,7 +1381,7 @@ sklm: {
availableForSubagentsHint: "Allow AI to use this model when delegating tasks to subagents",
nativeWebSearch: "Native web search",
nativeWebSearchHint: "Attach the provider-hosted web search tool to requests for this model. Requires an endpoint that supports it; billed by the provider per search.",
- nativeWebSearchUnsupported: "Native web search needs the Responses or Anthropic Messages API style",
+ nativeWebSearchUnsupported: "This app has not integrated native search for this connection. Website search or another API may still be available.",
searchModelId: "Search model ID…",
searchChosenModels: "Search added models…",
noChosenModelMatches: "No matching added models.",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index 3cdaa36e2..a62082bc4 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -1245,6 +1245,8 @@ sklm: {
"presetTogether": "Juntos AI",
"presetFireworks": "Fuegos artificiales",
"presetDeepseek": "DeepSeek",
+ endpointFormatGuidance: "Esta URL de solicitud indica {{format}}. Aplica el formato y la dirección base correspondientes; esto no verifica la conexión ni la capacidad de búsqueda.",
+ applyEndpointFormat: "Aplicar formato sugerido",
"presetAlibabaCn": "Qwen (DashScope)",
"presetMoonshotCn": "Moonshot / Kimi",
"presetZhipuApi": "Zhipu AI",
@@ -1360,7 +1362,7 @@ sklm: {
"availableForSubagentsHint": "Permitir que AI use este modelo al delegar tareas a subagentes",
"nativeWebSearch": "Búsqueda web nativa",
"nativeWebSearchHint": "Adjunta la herramienta de búsqueda web alojada por el proveedor a las solicitudes de este modelo. Requiere un punto de conexión que la admita; el proveedor la factura por búsqueda.",
- "nativeWebSearchUnsupported": "La búsqueda web nativa requiere el estilo de API Responses o Anthropic Messages",
+ nativeWebSearchUnsupported: "La aplicación aún no integra búsqueda nativa para esta conexión. El sitio web u otra API pueden ofrecerla.",
"searchModelId": "ID de modelo de búsqueda…",
"searchChosenModels": "Buscar modelos añadidos…",
"noChosenModelMatches": "No hay modelos añadidos que coincidan.",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index f88903962..ce5deab3f 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -1245,6 +1245,8 @@ sklm: {
"presetTogether": "Ensemble AI",
"presetFireworks": "Feux d'artifice",
"presetDeepseek": "DeepSeek",
+ endpointFormatGuidance: "Cette URL de requête indique {{format}}. Appliquez le format et l’adresse de base correspondants ; cela ne vérifie ni la connexion ni la recherche.",
+ applyEndpointFormat: "Appliquer le format suggéré",
"presetAlibabaCn": "Qwen (DashScope)",
"presetMoonshotCn": "Moonshot / Kimi",
"presetZhipuApi": "Zhipu AI",
@@ -1360,7 +1362,7 @@ sklm: {
"availableForSubagentsHint": "Autoriser l'IA à utiliser ce modèle lors de la délégation de tâches à des sous-agents",
"nativeWebSearch": "Recherche web native",
"nativeWebSearchHint": "Attache l'outil de recherche web hébergé par le fournisseur aux requêtes pour ce modèle. Nécessite un point de terminaison qui le prend en charge ; facturé par le fournisseur à chaque recherche.",
- "nativeWebSearchUnsupported": "La recherche web native nécessite le style d'API Responses ou Anthropic Messages",
+ nativeWebSearchUnsupported: "La recherche native n’est pas encore intégrée pour cette connexion. Le site web ou une autre API peut la proposer.",
"searchModelId": "ID de modèle de recherche…",
"searchChosenModels": "Rechercher les modèles ajoutés…",
"noChosenModelMatches": "Aucun modèle ajouté correspondant.",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index aff4d83c1..95df39746 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -1258,6 +1258,8 @@ sklm: {
presetTogether: "Together AI",
presetFireworks: "Fireworks",
presetDeepseek: "DeepSeek",
+ endpointFormatGuidance: "이 요청 URL은 {{format}} 형식을 나타냅니다. 해당 형식과 기본 주소를 적용할 수 있지만 연결이나 검색 기능이 검증된 것은 아닙니다.",
+ applyEndpointFormat: "제안된 형식 적용",
presetAlibabaCn: "Qwen (DashScope)",
presetMoonshotCn: "Moonshot / Kimi",
presetZhipuApi: "Zhipu AI",
@@ -1377,7 +1379,7 @@ sklm: {
availableForSubagentsHint: "서브에이전트에 작업을 위임할 때 AI가 이 모델을 사용하도록 허용",
nativeWebSearch: "네이티브 웹 검색",
nativeWebSearchHint: "이 모델에 대한 요청에 공급자 호스팅 웹 검색 도구를 첨부합니다. 이를 지원하는 엔드포인트가 필요하며, 검색 건수로 공급자에게 과금됩니다.",
- nativeWebSearchUnsupported: "네이티브 웹 검색에는 Responses 또는 Anthropic Messages API 스타일이 필요합니다",
+ nativeWebSearchUnsupported: "이 연결의 네이티브 검색은 아직 앱에 통합되지 않았습니다. 웹사이트나 다른 API에서는 검색을 지원할 수 있습니다.",
searchModelId: "모델 ID 검색…",
searchChosenModels: "추가된 모델 검색…",
noChosenModelMatches: "일치하는 추가된 모델이 없습니다.",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index 9f0aba335..33d2ed712 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -1248,6 +1248,8 @@ sklm: {
presetTogether: "Together AI",
presetFireworks: "Fireworks",
presetDeepseek: "DeepSeek",
+ endpointFormatGuidance: "Bu istek URL’si {{format}} biçimini gösteriyor. Eşleşen biçimi ve temel adresi uygulayın; bu, bağlantıyı veya arama yeteneğini test etmez.",
+ applyEndpointFormat: "Önerilen biçimi uygula",
presetAlibabaCn: "Qwen (DashScope)",
presetMoonshotCn: "Moonshot / Kimi",
presetZhipuApi: "Zhipu AI",
@@ -1367,7 +1369,7 @@ sklm: {
availableForSubagentsHint: "Görevler alt ajanlara devredilirken AI’nin bu modeli kullanmasına izin ver",
nativeWebSearch: "Yerel web araması",
nativeWebSearchHint: "Bu modele yapılan isteklere sağlayıcının barındırdığı web arama aracını ekler. Bunu destekleyen bir uç nokta gerekir; arama başına sağlayıcı tarafından faturalandırılır.",
- nativeWebSearchUnsupported: "Yerel web araması için Responses veya Anthropic Messages API stili gerekir",
+ nativeWebSearchUnsupported: "Bu bağlantı için yerel arama henüz uygulamaya entegre edilmedi. Web sitesi veya başka bir API aramayı destekleyebilir.",
searchModelId: "Model kimliği ara…",
searchChosenModels: "Eklenen modellerde ara…",
noChosenModelMatches: "Eşleşen eklenen model yok.",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index 1b492dfa3..1dd0ae0e7 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -1232,6 +1232,8 @@ sklm: {
presetTogether: "Together AI",
presetFireworks: "Fireworks",
presetDeepseek: "DeepSeek",
+ endpointFormatGuidance: "此请求地址对应 {{format}}。可应用匹配的接口格式和基础地址;这不代表连接或搜索能力已验证。",
+ applyEndpointFormat: "应用建议格式",
presetAlibabaCn: "通义千问",
presetMoonshotCn: "月之暗面",
presetZhipuApi: "智谱 AI",
@@ -1347,7 +1349,7 @@ sklm: {
availableForSubagentsHint: "允许 AI 在委派子任务时自动选用此模型",
nativeWebSearch: "原生联网搜索",
nativeWebSearchHint: "为该模型的请求附加提供商托管的联网搜索工具。需要端点实际支持;按次计费由提供商收取。",
- nativeWebSearchUnsupported: "原生联网搜索需要 Responses 或 Anthropic Messages 接口风格",
+ nativeWebSearchUnsupported: "应用尚未适配此连接的原生搜索;不代表厂商官网或其他 API 不支持搜索。",
searchModelId: "搜索模型 ID…",
searchChosenModels: "搜索已添加模型…",
noChosenModelMatches: "没有匹配的已添加模型",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index 08f4e64ef..532f8002c 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -1232,6 +1232,8 @@ sklm: {
presetTogether: "Together AI",
presetFireworks: "Fireworks",
presetDeepseek: "DeepSeek",
+ endpointFormatGuidance: "此請求位址對應 {{format}}。可套用相符的介面格式和基礎位址;這不代表連線或搜尋能力已驗證。",
+ applyEndpointFormat: "套用建議格式",
presetAlibabaCn: "通義千問",
presetMoonshotCn: "月之暗面",
presetZhipuApi: "智譜 AI",
@@ -1347,7 +1349,7 @@ sklm: {
availableForSubagentsHint: "允許 AI 在委派子任務時自動選用此模型",
nativeWebSearch: "原生網路搜尋",
nativeWebSearchHint: "為該模型的請求附加提供商託管的網路搜尋工具。需要端點實際支援;按次計費由提供商收取。",
- nativeWebSearchUnsupported: "原生網路搜尋需要 Responses 或 Anthropic Messages 介面風格",
+ nativeWebSearchUnsupported: "應用程式尚未整合此連線的原生搜尋;不代表廠商官網或其他 API 不支援搜尋。",
searchModelId: "搜尋模型 ID…",
searchChosenModels: "搜尋已新增模型…",
noChosenModelMatches: "沒有符合的已新增模型",
diff --git a/packages/shared/src/changelog-de.ts b/packages/shared/src/changelog-de.ts
index b087779fb..8f4435ddf 100644
--- a/packages/shared/src/changelog-de.ts
+++ b/packages/shared/src/changelog-de.ts
@@ -5,6 +5,7 @@ export const deEntries: ChangelogEntry[] = [
"version": "0.15.6",
"date": "2026-09-23",
"highlights": [
+ "Native Suche direkt in bestehenden DeepSeek-, xAI- und OpenAI-Diensten aktivieren, ohne gespeicherte Verbindungen zu ändern.",
"Unterstützung für GPT-6 Astra, Sol und Luna in den OpenAI- und ChatGPT/Codex-Modellkatalogen.",
],
},
diff --git a/packages/shared/src/changelog-es.ts b/packages/shared/src/changelog-es.ts
index 8d57747af..d345adda9 100644
--- a/packages/shared/src/changelog-es.ts
+++ b/packages/shared/src/changelog-es.ts
@@ -5,6 +5,7 @@ export const esEntries: ChangelogEntry[] = [
"version": "0.15.6",
"date": "2026-09-23",
"highlights": [
+ "Activa la búsqueda nativa en los servicios existentes de DeepSeek, xAI y OpenAI sin cambiar su configuración de conexión.",
"Añade compatibilidad con GPT-6 Astra, Sol y Luna en los catálogos de modelos de OpenAI y ChatGPT/Codex.",
],
},
diff --git a/packages/shared/src/changelog-fr.ts b/packages/shared/src/changelog-fr.ts
index b677dcf3a..5a54a9410 100644
--- a/packages/shared/src/changelog-fr.ts
+++ b/packages/shared/src/changelog-fr.ts
@@ -5,6 +5,7 @@ export const frEntries: ChangelogEntry[] = [
"version": "0.15.6",
"date": "2026-09-23",
"highlights": [
+ "Activez la recherche native dans vos services DeepSeek, xAI et OpenAI existants sans modifier leurs paramètres de connexion.",
"Prend en charge GPT-6 Astra, Sol et Luna dans les catalogues de modèles OpenAI et ChatGPT/Codex.",
],
},
diff --git a/packages/shared/src/changelog-ko.ts b/packages/shared/src/changelog-ko.ts
index dfa698f61..bace39f5f 100644
--- a/packages/shared/src/changelog-ko.ts
+++ b/packages/shared/src/changelog-ko.ts
@@ -5,6 +5,7 @@ export const koEntries: ChangelogEntry[] = [
version: "0.15.6",
date: "2026-09-23",
highlights: [
+ "저장된 연결 설정을 바꾸지 않고 기존 DeepSeek, xAI, OpenAI 서비스에서 네이티브 검색을 켜세요.",
"OpenAI 및 ChatGPT/Codex 모델 카탈로그에서 GPT-6 Astra, Sol, Luna를 지원합니다.",
],
},
diff --git a/packages/shared/src/changelog-tr.ts b/packages/shared/src/changelog-tr.ts
index f0707542c..09e827d7b 100644
--- a/packages/shared/src/changelog-tr.ts
+++ b/packages/shared/src/changelog-tr.ts
@@ -5,6 +5,7 @@ export const trEntries: ChangelogEntry[] = [
"version": "0.15.6",
"date": "2026-09-23",
"highlights": [
+ "Kayıtlı bağlantı ayarlarını değiştirmeden mevcut DeepSeek, xAI ve OpenAI hizmetlerinde yerel aramayı etkinleştirin.",
"OpenAI ve ChatGPT/Codex model kataloglarında GPT-6 Astra, Sol ve Luna desteği eklenir.",
],
},
diff --git a/packages/shared/src/changelog.ts b/packages/shared/src/changelog.ts
index cbdb94d75..0bf76606d 100644
--- a/packages/shared/src/changelog.ts
+++ b/packages/shared/src/changelog.ts
@@ -32,6 +32,7 @@ const enEntries: ChangelogEntry[] = [
version: "0.15.6",
date: "2026-09-23",
highlights: [
+ "Enable native search directly on existing DeepSeek, xAI and OpenAI services without changing their saved connection settings.",
"Support GPT-6 Astra, Sol, and Luna across the OpenAI and ChatGPT/Codex model catalogs.",
],
},
@@ -844,6 +845,7 @@ const zhCNEntries: ChangelogEntry[] = [
version: "0.15.6",
date: "2026-09-23",
highlights: [
+ "在原有 DeepSeek、xAI 和 OpenAI 服务中直接开启原生搜索,无需切换入口或改写连接配置。",
"支持 OpenAI 与 ChatGPT/Codex 模型目录中的 GPT-6 Astra、Sol 和 Luna。",
],
},
@@ -1656,6 +1658,7 @@ const zhTWEntries: ChangelogEntry[] = [
version: "0.15.6",
date: "2026-09-23",
highlights: [
+ "在原有 DeepSeek、xAI 和 OpenAI 服務中直接啟用原生搜尋,無須切換入口或改寫連線設定。",
"支援 OpenAI 與 ChatGPT/Codex 模型目錄中的 GPT-6 Astra、Sol 與 Luna。",
],
},
diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts
index d77291100..6093c777d 100644
--- a/packages/shared/src/index.ts
+++ b/packages/shared/src/index.ts
@@ -66,4 +66,5 @@ export * from "./tray-sessions.js";
export * from "./window-chrome.js";
export * from "./prompt-enhancement.js";
export * from "./native-web-search.js";
+export * from "./native-web-search-transport.js";
export * from "./header-value.js";
diff --git a/packages/shared/src/native-web-search-transport.test.ts b/packages/shared/src/native-web-search-transport.test.ts
new file mode 100644
index 000000000..46d8a1bfd
--- /dev/null
+++ b/packages/shared/src/native-web-search-transport.test.ts
@@ -0,0 +1,47 @@
+import { describe, expect, it } from "vitest";
+import { nativeWebSearchTransport } from "./native-web-search-transport.js";
+import { nativeWebSearchSupportedOn } from "./native-web-search.js";
+import { NAMED_ENDPOINT_PRESETS } from "./provider-presets.js";
+
+describe("official native search request routing", () => {
+ it("keeps exactly one DeepSeek service preset", () => {
+ expect(NAMED_ENDPOINT_PRESETS.filter((preset) => preset.vendorKey === "deepseek").map((preset) => preset.id)).toEqual(["deepseek"]);
+ });
+ for (const [baseUrl, apiStyle, searchBase] of [
+ ["https://api.deepseek.com", "anthropic_messages", "https://api.deepseek.com/anthropic"],
+ ["https://api.deepseek.com/v1/", "anthropic_messages", "https://api.deepseek.com/anthropic"],
+ ["https://api.x.ai/v1", "responses", "https://api.x.ai/v1"],
+ ["https://api.openai.com/v1", "responses", "https://api.openai.com/v1"],
+ ]) {
+ it(`keeps one saved configuration for ${baseUrl}`, () => {
+ const input = { apiStyle: "chat_completions", baseUrl, enabled: true };
+ const before = { ...input };
+ expect(nativeWebSearchSupportedOn(input.apiStyle, baseUrl)).toBe(true);
+ expect(nativeWebSearchTransport(input)).toEqual({ apiStyle, baseUrl: searchBase });
+ expect(input).toEqual(before);
+ expect(nativeWebSearchTransport({ ...input, enabled: false })).toEqual({ apiStyle: input.apiStyle, baseUrl });
+ });
+ }
+
+ it("never reroutes relay credentials or guesses from an official-looking hostname", () => {
+ for (const baseUrl of [
+ "https://relay.example/v1", "https://api.deepseek.com.evil.example",
+ "https://api.deepseek.com:8443", "http://api.deepseek.com", "https://api.deepseek.com/private",
+ "https://[email protected]", "https://api.deepseek.com?key=private", "https://api.deepseek.com/#fragment",
+ "https://dashscope.aliyuncs.com/compatible-mode/v1", "https://api.moonshot.cn/v1",
+ ]) {
+ expect(nativeWebSearchSupportedOn("chat_completions", baseUrl)).toBe(false);
+ expect(nativeWebSearchTransport({ apiStyle: "chat_completions", baseUrl, enabled: true }))
+ .toEqual({ apiStyle: "chat_completions", baseUrl });
+ }
+ });
+
+ it("keeps explicit non-Completions protocols and existing search-capable relays unchanged", () => {
+ for (const apiStyle of ["anthropic_messages", "responses", "openai_codex_responses", "google_generative_ai", "opencode_go"]) {
+ const input = { apiStyle, baseUrl: "https://api.deepseek.com", enabled: true };
+ expect(nativeWebSearchTransport(input)).toEqual({ apiStyle, baseUrl: input.baseUrl });
+ }
+ expect(nativeWebSearchSupportedOn("responses", "https://relay.example/v1")).toBe(true);
+ expect(nativeWebSearchSupportedOn("google_generative_ai", "https://generativelanguage.googleapis.com/v1beta")).toBe(false);
+ });
+});
diff --git a/packages/shared/src/native-web-search-transport.ts b/packages/shared/src/native-web-search-transport.ts
new file mode 100644
index 000000000..328364122
--- /dev/null
+++ b/packages/shared/src/native-web-search-transport.ts
@@ -0,0 +1,30 @@
+/** Published first-party search routes that reuse existing request adapters. */
+const SEARCH_ROUTES = [
+ { origin: "https://api.deepseek.com", paths: ["", "/v1"], apiStyle: "anthropic_messages", path: "/anthropic" },
+ { origin: "https://api.x.ai", paths: ["/v1"], apiStyle: "responses", path: "/v1" },
+ { origin: "https://api.openai.com", paths: ["/v1"], apiStyle: "responses", path: "/v1" },
+] as const;
+
+/**
+ * Resolve a request-only route. Never mutate the saved provider or infer an
+ * official origin from a vendor/model name: relay credentials stay on the relay.
+ */
+export function nativeWebSearchTransport(input: {
+ apiStyle: string | undefined;
+ baseUrl: string | undefined;
+ enabled: boolean;
+}): { apiStyle: string | undefined; baseUrl: string | undefined } {
+ const unchanged = { apiStyle: input.apiStyle, baseUrl: input.baseUrl };
+ if (!input.enabled || !input.baseUrl ||
+ !["chat_completions", "openai-completions"].includes(input.apiStyle ?? "")) return unchanged;
+ try {
+ const url = new URL(input.baseUrl);
+ if (url.username || url.password || url.search || url.hash) return unchanged;
+ const path = url.pathname.replace(/\/+$/, "");
+ const route = SEARCH_ROUTES.find((item) => item.origin === url.origin &&
+ (item.paths as readonly string[]).includes(path));
+ return route ? { apiStyle: route.apiStyle, baseUrl: `${url.origin}${route.path}` } : unchanged;
+ } catch {
+ return unchanged;
+ }
+}
diff --git a/packages/shared/src/native-web-search.ts b/packages/shared/src/native-web-search.ts
index 53ea07a47..b4eac5097 100644
--- a/packages/shared/src/native-web-search.ts
+++ b/packages/shared/src/native-web-search.ts
@@ -1,3 +1,5 @@
+import { nativeWebSearchTransport } from "./native-web-search-transport.js";
+
/**
* Evaluation helpers for the provider-hosted web search tool.
*
@@ -11,9 +13,9 @@
* - `hostedSearchFromMessage` is what the runtime persists: display rounds
* plus raw `replay` blocks for convertMessages after a restart.
*
- * Vendor display names, base URL hostnames, and model id substrings are
- * intentionally not consulted. An endpoint either carries the tool on the
- * wire named here or it does not; guessing breeds silent behavior drift.
+ * Published official endpoint routes are resolved before the wire gate, using
+ * nativeWebSearchTransport. Vendor display names and model-id substrings never
+ * establish endpoint support. Unknown gateways retain their configured wire.
*/
export const NATIVE_WEB_SEARCH_WIRE_APIS = new Set([
@@ -72,8 +74,9 @@ const NATIVE_WEB_SEARCH_API_STYLES = new Set(["responses", "anthropic_messages",
* spellings because the pane sees `responses` / `anthropic_messages` while
* the runtime sees `openai-responses` / `anthropic-messages`.
*/
-export function nativeWebSearchSupportedOn(api: string | undefined): boolean {
- const value = (api ?? "").trim().toLowerCase();
+export function nativeWebSearchSupportedOn(api: string | undefined, baseUrl?: string): boolean {
+ const route = nativeWebSearchTransport({ apiStyle: api, baseUrl, enabled: true });
+ const value = (route.apiStyle ?? "").trim().toLowerCase();
if (!value) return false;
if (NATIVE_WEB_SEARCH_WIRE_APIS.has(value)) return true;
if (NATIVE_WEB_SEARCH_API_STYLES.has(value)) return true;
diff --git a/scripts/e2e/provider-api-style.tsx b/scripts/e2e/provider-api-style.tsx
index b6054e70c..04854e64e 100644
--- a/scripts/e2e/provider-api-style.tsx
+++ b/scripts/e2e/provider-api-style.tsx
@@ -64,6 +64,8 @@ globalThis.providerApiStyleProbe = async () => {
flushSync(() => root.render(<I18nextProvider i18n={i18n}>
<ProviderSetupDialog key={++key} onClose={() => { closes++; }} onSaved={() => {}} {...props} />
</I18nextProvider>));
+ const advanced = document.querySelector<HTMLButtonElement>(".provider-chosen-advanced-toggle");
+ if (advanced?.getAttribute("aria-expanded") === "false") flushSync(() => advanced.click());
};
const click = (element: HTMLElement | null | undefined) => {
assert(element, "missing click target");
@@ -152,6 +154,15 @@ globalThis.providerApiStyleProbe = async () => {
};
const results: string[] = [];
+ const until = async (condition: () => boolean, label: string) => {
+ const deadline = performance.now() + 5000;
+ while (!condition()) {
+ assert(performance.now() < deadline, `timed out: ${label}`);
+ await frame();
+ }
+ };
+ const searchInput = () => [...document.querySelectorAll<HTMLInputElement>("input[type=checkbox]")]
+ .find((input) => input.closest("label")?.textContent?.trim() === i18n.t("settings.nativeWebSearch"));
try {
for (const locale of ["en", "zh-CN"]) {
await i18n.changeLanguage(locale);
@@ -222,9 +233,67 @@ globalThis.providerApiStyleProbe = async () => {
assert(JSON.stringify(original) === before, "edit/copy mutated source object");
results.push(`${locale}:${style}:edit-change-copy-cancel`);
}
+ for (const [vendorKey, baseUrl, modelId] of [
+ ["deepseek", "https://api.deepseek.com", "deepseek-v4-flash"],
+ ["xai", "https://api.x.ai/v1", "grok-4.7"],
+ ["openai", "https://api.openai.com/v1", "gpt-6-sol"],
+ ]) {
+ const original = { ...fixture("chat_completions"), name: "My service", vendorKey, baseUrl,
+ models: [{ ...fixture("chat_completions").models[0], id: modelId }] };
+ render({ provider: original });
+ await until(() => Boolean(searchInput()), "official model settings");
+ assert(!searchInput()?.disabled && !searchInput()?.checked, `${vendorKey}: search must be directly selectable and default off`);
+ assert(!document.querySelector(".provider-endpoint-guidance"), "official search requires an extra interface action");
+ const count = updates.length;
+ click(searchInput());
+ click(control("settings.cancel"));
+ assert(updates.length === count, "cancel persisted the search opt-in");
+ render({ provider: original });
+ click(searchInput());
+ click(control("settings.saveProvider"));
+ await until(() => updates.length === count + 1, "save search opt-in");
+ const update = updates.at(-1)!;
+ assert(update.apiStyle === original.apiStyle && update.baseUrl === original.baseUrl,
+ "search opt-in rewrote the saved service transport");
+ assert(update.name === original.name && !("secretValue" in update), "search opt-in replaced name or key");
+ assert(update.models?.[0].nativeWebSearch === true && update.models[0].alias === "Fixture alias", "model settings lost");
+ render({ provider: { ...original, ...update } });
+ assert(searchInput()?.checked && !searchInput()?.disabled, "search opt-in was lost on reopen");
+ click(searchInput());
+ click(control("settings.saveProvider"));
+ await until(() => updates.length === count + 2, "save search off");
+ assert(!updates.at(-1)?.models?.[0].nativeWebSearch, "search opt-out was not saved");
+ assert(updates.at(-1)?.apiStyle === original.apiStyle && updates.at(-1)?.baseUrl === original.baseUrl,
+ "search opt-out changed the stored route");
+ results.push(`${locale}:${vendorKey}:single-entry-search-cancel-save-reopen-off`);
+ }
+
+ for (const [operation, style] of [["responses", "responses"], ["messages", "anthropic_messages"]] as const) {
+ const relay = { ...fixture("chat_completions"), baseUrl: `https://relay.example/v1/${operation}` };
+ render({ provider: relay });
+ assert(apiStyleTrigger()?.textContent?.includes(apiStyleLabel("chat_completions")), "URL advice silently changed protocol");
+ click(control("settings.applyEndpointFormat"));
+ assert(apiStyleTrigger()?.textContent?.includes(apiStyleLabel(style)), "suggested format not applied");
+ const count = updates.length;
+ click(control("settings.saveProvider"));
+ await until(() => updates.length === count + 1, "save suggested format");
+ assert(updates.at(-1)?.baseUrl === "https://relay.example/v1" && updates.at(-1)?.apiStyle === style,
+ "suggestion changed destination or retained the operation suffix");
+ render({ provider: { ...relay, ...updates.at(-1)! } });
+ assert(!button("settings.applyEndpointFormat"), "suggestion reappeared after save");
+ }
+ results.push(`${locale}:relay-explicit-format-suggestion-save-reopen`);
+
+ const manual = { ...fixture("chat_completions"), vendorKey: "openai" };
+ render({ provider: manual });
+ assert(apiStyleTrigger()?.textContent?.includes(apiStyleLabel("chat_completions")), "named host overwrote manual format");
+ results.push(`${locale}:saved-protocol-wins-over-preset`);
+
const 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);
const findWebSearch = () => [...document.querySelectorAll<HTMLInputElement>("input[type=checkbox]")].find((input) => input.closest("label")?.textContent?.trim() === i18n.t("settings.nativeWebSearch"));
const searchCheckbox = findWebSearch();