Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

feat(model-hub): turn on keyless Exa web search (KEX-3) (#2957)

Call Whitefecf3e29512e
diff --git a/config/v2_config.py b/config/v2_config.py
index 3a6bf8dea..334643fa3 100644
--- a/config/v2_config.py
+++ b/config/v2_config.py
@@ -3131,9 +3131,9 @@ class ModelHubImageModelChoice:
return {"source_id": self.source_id, "model_id": self.model_id}
-# Built-in keyless Exa is a dormant reader contract in KEX-1. KEX-3 flips this
-# predicate together with the producer and public disclosure.
-KEYLESS_EXA_ACTIVE = False
+# Built-in keyless Exa is active by default. The reader and producer must use this
+# one predicate together so the public Source cannot be read without its chain.
+KEYLESS_EXA_ACTIVE = True
KEYLESS_EXA_SOURCE_ID = "src_exakeyless"
KEYLESS_EXA_VENDOR_ID = "exa-mcp"
KEYLESS_EXA_SERVICE_ID = "exa/mcp"
diff --git a/core/handlers/model_hub/hosted_tools.py b/core/handlers/model_hub/hosted_tools.py
index 2a561b030..50d4f3c08 100644
--- a/core/handlers/model_hub/hosted_tools.py
+++ b/core/handlers/model_hub/hosted_tools.py
@@ -266,12 +266,36 @@ def _search_chain(
remaining = dict(models)
disabled: list[ExecutorCandidate] = []
ordered = _vibey_order(config)
- if KEYLESS_EXA_ACTIVE:
- ordered.append(model_hub_keyless_exa_source())
+ keyless = model_hub_keyless_exa_source() if KEYLESS_EXA_ACTIVE else None
+ if keyless is not None:
+ ordered.append(keyless)
by_id = {source.id: source for source in ordered}
first = [by_id[sid] for sid in (setting.service_order or ()) if sid in by_id and by_id[sid].protocol == "search"]
- sources = first + [s for s in ordered if s.protocol == "search" and s not in first]
- sources += [s for s in ordered if s.protocol != "search"]
+ # Tool-only search Sources keep their saved/source order first. Official
+ # model Sources that auto-enroll a search API (currently DeepSeek) follow,
+ # then the built-in keyless Exa, and only then model executors. Do not use
+ # protocol alone here: DeepSeek is an OpenAI-compatible model Source whose
+ # search service still belongs before keyless Exa in the automatic chain.
+ tool_services = [
+ source for source in ordered
+ if source.protocol == "search" and source.id != KEYLESS_EXA_SOURCE_ID
+ ]
+ auto_model_services = [
+ source for source in ordered
+ if source.protocol != "search"
+ and source.id != KEYLESS_EXA_SOURCE_ID
+ and model_hub_search_service(source) is not None
+ ]
+ model_sources = [
+ source for source in ordered
+ if source.id != KEYLESS_EXA_SOURCE_ID
+ and model_hub_search_service(source) is None
+ ]
+ sources = first + [source for source in tool_services if source not in first]
+ sources += auto_model_services
+ if keyless is not None:
+ sources.append(keyless)
+ sources += model_sources
for source in sources:
service = model_hub_search_service(source)
settings = search_service_settings(setting, source)
diff --git a/core/hosted_activity.py b/core/hosted_activity.py
index 1330d4292..60d6f47e9 100644
--- a/core/hosted_activity.py
+++ b/core/hosted_activity.py
@@ -25,6 +25,7 @@ from __future__ import annotations
from dataclasses import dataclass, fields
from typing import Any, Callable, Literal, Mapping, Optional
+from config.v2_config import KEYLESS_EXA_SOURCE_ID
from core.agent_core.hosted_continuations import pending_hosted
from core.agent_core.messages import (
HOSTED_ERROR_CODES,
@@ -397,6 +398,10 @@ def _view(attempt: HostedAttempt, source_names: SourceNames, source_state: Optio
reason = f"skip.{attempt.skipped}"
if attempt.skipped == "disabled" and current is not None and current.get("enabled") is False:
remedy = "repair.disabled"
+ if (attempt.source_id == KEYLESS_EXA_SOURCE_ID and not superseded
+ and current is not None and current.get("enabled") is not False
+ and (attempt.error_code == "service_rate_limited" or attempt.skipped == "cooling")):
+ remedy = "repair.retrySearch"
return HostedAttemptView(
**{field.name: getattr(attempt, field.name) for field in fields(HostedAttempt)}
| {"label": source_names(attempt.source_id) or attempt.label, "superseded": superseded or None},
@@ -562,7 +567,7 @@ def _chain_cost(execution: Optional[ProxyExecution]) -> tuple[Optional[HostedCos
return HostedCost(basis=basis, usd=round(sum(cost.usd or 0.0 for cost in priced), 6)), unpriced
-def _runner_label(activity: HostedActivity, escape: Callable[[str], str]) -> Optional[str]:
+def _runner_label(activity: HostedActivity, lang: str, escape: Callable[[str], str]) -> Optional[str]:
"""Who ran a call, as the IM line names it: its vendor's catalog label, else the Source's own name.
A Source added as a compatible endpoint has the vendor id ``custom``, which names no vendor, so its name is the
@@ -573,6 +578,8 @@ def _runner_label(activity: HostedActivity, escape: Callable[[str], str]) -> Opt
from vibe.model_hub_runtime.api_key_vendors import catalog_api_key_vendor_label
+ if activity.executor_kind == "service" and activity.source_id == KEYLESS_EXA_SOURCE_ID:
+ return i18n_t("hostedTools.keylessExa", lang)
label = catalog_api_key_vendor_label(activity.provider) if activity.provider else None
if label and activity.executor_kind != "service":
return label
@@ -614,19 +621,20 @@ def _ran(activity: HostedActivity, lang: str, escape: Callable[[str], str]) -> l
size = f"{first.width}×{first.height}" if first is not None and first.width and first.height else None
more = _count(activity, lang) if len(activity.images) > 1 else None
return [_untrusted(activity.model, escape) if activity.model else None, size, more]
- vendor = _runner_label(activity, escape)
+ vendor = _runner_label(activity, lang, escape)
if vendor and activity.mode == "proxy" and activity.fallback_source_id is not None:
# Why it ran by proxy: the turn's own Source refused the native tool (§8.3, mockup 06).
refused_by = _untrusted(activity.fallback_source_name or activity.fallback_source_id, escape)
mode = i18n_t("hostedTools.mode.fallback", lang, source=refused_by, provider=vendor)
elif activity.switch is not None:
# Why it ran where it did: the Sources before it failed or were blocked (§6.5).
- mode = _switch_text(activity.switch, lang, escape)
+ mode = _switch_text(activity, lang, escape)
elif not vendor:
mode = None
elif activity.executor_kind == "service":
- # A search service is named alone: "🔎 网页搜索 “…” · Tavily · 5 个来源" (§6.5).
- mode = vendor
+ # Keep the released service labels; the built-in row has no user name.
+ mode = (i18n_t("hostedTools.mode.service", lang, provider=vendor)
+ if activity.source_id == KEYLESS_EXA_SOURCE_ID else vendor)
elif activity.mode == "proxy" and activity.model:
mode = i18n_t("hostedTools.mode.proxyModel", lang, provider=vendor, model=_untrusted(activity.model, escape))
else:
@@ -651,7 +659,10 @@ def _cost(activity: HostedActivity, lang: str) -> Optional[str]:
cost = activity.cost
if cost is None:
return None
- if cost.basis == "included":
+ if (activity.executor_kind == "service" and activity.source_id == KEYLESS_EXA_SOURCE_ID
+ and cost.usd == 0 and not activity.cost_at_least):
+ text = i18n_t("hostedTools.cost.free", lang)
+ elif cost.basis == "included":
text = i18n_t("hostedTools.cost.included", lang)
elif cost.usd is None:
return None
@@ -678,10 +689,23 @@ def _error_text(activity: HostedActivity, lang: str) -> str:
return activity.error or ""
-def _switch_text(switch: HostedSwitch, lang: str, escape: Callable[[str], str]) -> str:
- names = i18n_t("hostedTools.listSeparator", lang).join(_untrusted(name, escape) for name in switch.sources)
+def _switch_text(activity: HostedActivity, lang: str, escape: Callable[[str], str]) -> str:
+ switch = activity.switch
+ assert switch is not None
+ # Switch labels are the projection's recorded names. Localize only an
+ # unambiguous built-in label; never rename an ordinary user Source.
+ labels = {attempt.label for attempt in activity.attempts or () if attempt.source_id == KEYLESS_EXA_SOURCE_ID}
+ labels -= {attempt.label for attempt in activity.attempts or () if attempt.source_id != KEYLESS_EXA_SOURCE_ID}
+ names = i18n_t("hostedTools.listSeparator", lang).join(
+ i18n_t("hostedTools.keylessExa", lang) if name in labels else _untrusted(name, escape)
+ for name in switch.sources
+ )
+ provider = (i18n_t("hostedTools.keylessExa", lang) if activity.source_id == KEYLESS_EXA_SOURCE_ID
+ else _untrusted(switch.to, escape))
+ if switch.reason_key == "reason.service_rate_limited":
+ return i18n_t("hostedTools.rateLimitSwitch", lang, sources=names, provider=provider)
failed = f"{names} {i18n_t(f'hostedTools.{switch.reason_key}', lang)}"
- return i18n_t("hostedTools.switch", lang, failed=failed, provider=_untrusted(switch.to, escape))
+ return i18n_t("hostedTools.switch", lang, failed=failed, provider=provider)
def _attempt_items(activity: HostedActivity, lang: str, escape: Callable[[str], str]) -> Optional[str]:
@@ -691,7 +715,7 @@ def _attempt_items(activity: HostedActivity, lang: str, escape: Callable[[str],
if activity.completed or not activity.attempts:
return None
items = [
- f"{_untrusted(attempt.label, escape)} {i18n_t(f'hostedTools.{key}', lang)}"
+ f"{i18n_t('hostedTools.keylessExa', lang) if attempt.source_id == KEYLESS_EXA_SOURCE_ID else _untrusted(attempt.label, escape)} {i18n_t(f'hostedTools.{key}', lang)}"
for attempt in activity.attempts
if (key := attempt.remedy_key or attempt.reason_key)
]
diff --git a/docs/plans/model-hub-contracts/README.md b/docs/plans/model-hub-contracts/README.md
index 003755c8e..ed6d9ee64 100644
--- a/docs/plans/model-hub-contracts/README.md
+++ b/docs/plans/model-hub-contracts/README.md
@@ -1,13 +1,15 @@
# Model Hub contracts
-Status: **contract_version 21**, 2026-10-24: keyless Exa readers (KEX-1).
-`gh-v3.2.3rc3` through `rc6` carry v20, so this dormant reader event opens v21.
-The versioned mirrors advance together; persisted TurnProvenance retains v5–v20 and adds v21.
-KEX-1 adds only optional built-in catalog/read metadata, the synthetic `src_exakeyless`
-Source identity (`exa-mcp` / `exa/mcp`), keyless cooldown retry classification, and
-compatibility-safe readers. `KEYLESS_EXA_ACTIVE = false`; no producer or live Exa call
-ships in this event. A later activation may populate the shape, and an older release
-must ignore the additive fields while retaining ordinary service settings and orders.
+Status: **contract_version 21**, 2026-10-24: keyless Exa activation (KEX-3).
+`gh-v3.2.3rc3` through `rc7` carry v20, so the unreleased v21 event now includes
+its coordinated readers, producer, and default-on activation. The versioned
+mirrors advance together; persisted TurnProvenance retains v5–v20 and adds v21.
+KEX-1 and KEX-2 supplied the optional built-in catalog/read metadata, synthetic
+`src_exakeyless` Source identity (`exa-mcp` / `exa/mcp`), keyless MCP producer,
+cooldown classification, and compatibility-safe readers. KEX-3 sets
+`KEYLESS_EXA_ACTIVE = true` for the reader and producer together and ships the
+public disclosure; no live Exa call is used in tests or CI. An older release must
+ignore the additive fields while retaining ordinary service settings and orders.
The localized hosted-activity vocabulary adds `service_rate_limited` as a fallback
reason; it never creates a credential health blocker for the synthetic Source.
diff --git a/docs/plans/model-hub-contracts/api.md b/docs/plans/model-hub-contracts/api.md
index 967d0d24b..95a517657 100644
--- a/docs/plans/model-hub-contracts/api.md
+++ b/docs/plans/model-hub-contracts/api.md
@@ -126,14 +126,17 @@ catalog reads as null, never a promise of zero cost. `source_ids` includes
opted-out search-capable Sources, and a built-in vendor includes its synthetic Source;
relays and subscriptions are excluded.
-KEX-1 adds the dormant built-in `exa-mcp` catalog row (`service_id: "exa/mcp"`) and
-synthetic Source id `src_exakeyless`. It has no credential row, `auth: "none"`, exact
-zero list price, `free_tier: "Free; IP rate-limited"`, and `facts.built_in: true` /
+KEX-1 adds the built-in `exa-mcp` catalog row (`service_id: "exa/mcp"`) and
+synthetic Source id `src_exakeyless`. KEX-2 adds its credential-free MCP producer.
+The active row has no credential record, `auth: "none"`, exact zero list price,
+`free_tier: "Free; IP rate-limited"`, and `facts.built_in: true` /
`requires_setup: false`; it is never addable or removable. Its saved partial settings,
role-map entry and deliberate `executor_order` placement are read and serialized by
Source id, while a release that does not know the id safely skips it. The synthetic
identity is also used for status/evidence, usage labels, activity and retry cooldowns;
-no config migration is performed. The KEX-1 build keeps `KEYLESS_EXA_ACTIVE = false`.
+no config migration is performed. KEX-3 sets `KEYLESS_EXA_ACTIVE = true` for the
+reader and producer together, with the public disclosure shipped in the same v21
+event.
PUT accepts `prefer_native` and `services` only for `web_search`. `prefer_native`
is a boolean, not nullable. `services` is a Source-keyed patch: an absent Source
diff --git a/docs/plans/web-search-keyless-exa.md b/docs/plans/web-search-keyless-exa.md
index fa21a75d9..fcec07366 100644
--- a/docs/plans/web-search-keyless-exa.md
+++ b/docs/plans/web-search-keyless-exa.md
@@ -888,13 +888,14 @@ localized activity/UI types. No live upstream response is a contract fixture.
## 11. Implementation split
Use the same layering as S2: **readers first, producer behind a flag, then one
-flip plus public docs together**.
+flip plus public docs together**. The intermediate KEX-1 and KEX-2 heads kept the
+new path dormant; KEX-3 is the coordinated activation event documented here.
| Lane | Scope | Gate |
| --- | --- | --- |
-| KEX-1 readers and catalog | Add the built-in catalog/read shape, `src_exakeyless` defaulting and old-order reader behavior; extend status/candidate, attempts, service-origin, usage, activity, and UI readers/types/fixtures; add contract mirrors, the built-in cooldown-retry RPC/route branch, and released-shape compatibility tests. No network call. | `KEYLESS_EXA_ACTIVE = false`; all existing service behavior remains unchanged. |
-| KEX-2 producer | Add the adapter's keyless MCP session boundary, schema adaptation, SSE/JSON-RPC parser, highlights-only mapping, rate-limit detection/cooldown, service outcomes, usage writes, and UI actions behind the same flag. Use only stub MCP servers. | Flag-off control stays green; flag-on focused tests prove the new path. |
-| KEX-3 activation and public docs | Re-check contract tags, flip the producer/read predicate together, publish the English/Chinese privacy/default/UI copy, and run exact-head review/CI. | No activation before the public disclosure is present. |
+| KEX-1 readers and catalog | Add the built-in catalog/read shape, `src_exakeyless` defaulting and old-order reader behavior; extend status/candidate, attempts, service-origin, usage, activity, and UI readers/types/fixtures; add contract mirrors, the built-in cooldown-retry RPC/route branch, and released-shape compatibility tests. No network call. | Intermediate reader head only; activation remains with KEX-3. |
+| KEX-2 producer | Add the adapter's keyless MCP session boundary, schema adaptation, SSE/JSON-RPC parser, highlights-only mapping, rate-limit detection/cooldown, service outcomes, usage writes, and UI actions behind the same flag. Use only stub MCP servers. | Intermediate producer head only; hermetic tests prove the path before activation. |
+| KEX-3 activation and public docs | Re-check contract tags, flip the producer/read predicate together, publish the English/Chinese privacy/default/UI copy, and run exact-head review/CI. | Completed in contract v21: `KEYLESS_EXA_ACTIVE = true`; public disclosure ships with activation. |
KEX-1 and KEX-2 must not make a live Exa call in tests or CI. KEX-3 owns the
coordinated activation; no lane merges this design PR.
diff --git a/tests/test_hosted_activity.py b/tests/test_hosted_activity.py
index be2799644..a0b1873db 100644
--- a/tests/test_hosted_activity.py
+++ b/tests/test_hosted_activity.py
@@ -547,14 +547,15 @@ def test_every_known_hosted_error_code_has_copy_on_every_surface(code):
SERVICE_FIXTURE = json.loads(
(Path(__file__).resolve().parents[1] / "ui/src/lib/hostedServiceActivity.fixture.json").read_text(encoding="utf-8")
)
-TAVILY, EXA, DEEPSEEK, CLAUDE = "src_tavily01", "src_exa00001", "src_deepseek1", "src_claude001"
-LABELS = {TAVILY: "Tavily", EXA: "Exa", DEEPSEEK: "DeepSeek", CLAUDE: "Anthropic API key"}
+TAVILY, EXA, KEYLESS, DEEPSEEK, CLAUDE = "src_tavily01", "src_exa00001", "src_exakeyless", "src_deepseek1", "src_claude001"
+LABELS = {TAVILY: "Tavily", EXA: "Exa", KEYLESS: "Exa", DEEPSEEK: "DeepSeek", CLAUDE: "Anthropic API key"}
NEEDS = "models.source.needs_action."
KEY, BALANCE, LIMIT = f"{NEEDS}credential_revoked", f"{NEEDS}balance_exhausted", f"{NEEDS}spend_limit_reached"
# Each Source as Model Hub holds it now, healthy; a test changes what it needs.
HEALTHY = {
TAVILY: {"protocol": "search", "vendor": "tavily", "enabled": True},
EXA: {"protocol": "search", "vendor": "exa", "enabled": True},
+ KEYLESS: {"protocol": "search", "vendor": "exa-mcp", "enabled": True},
DEEPSEEK: {"protocol": "openai_chat", "vendor": "deepseek", "enabled": True},
CLAUDE: {"protocol": "anthropic", "vendor": "anthropic"},
}
@@ -631,6 +632,36 @@ def _chain(attempts, *, status="completed", execution=None, state=HEALTHY, names
)
[email protected]("lang", ["en", "zh"])
[email protected]("outcome", ["success", "rate_limited", "unavailable", "failed"])
+def test_keyless_im_projection_names_free_service_and_network_remedy(lang, outcome):
+ keyless_attempt = _tried(
+ KEYLESS, "completed" if outcome == "success" else "failed", usd=0,
+ **({} if outcome == "success" else {"error_code":
+ "service_unavailable" if outcome == "unavailable" else "service_rate_limited"}),
+ )
+ fallback = outcome in {"rate_limited", "unavailable"}
+ activity = _chain(
+ (keyless_attempt, _tried(DEEPSEEK, "completed", usd=0.00075)) if fallback else (keyless_attempt,),
+ status="failed" if outcome == "failed" else "completed",
+ execution=_service_ran(DEEPSEEK, "deepseek", 0.00075) if fallback else _service_ran(KEYLESS, "exa-mcp", 0),
+ sources=() if outcome == "failed" else RESULTS,
+ error_code="service_rate_limited" if outcome == "failed" else None,
+ )
+ line = hosted_line(activity, lang)
+ assert ("Exa(免费)" if lang == "zh" else "Exa (free)") in line
+ assert not any(word in line.lower() for word in ("密钥", "api key", "credential", "included", "$0 ·"))
+ if outcome == "success":
+ assert ("通过 Exa(免费) · 5 个来源 · 免费" if lang == "zh" else "via Exa (free) · 5 sources · Free") in line
+ elif outcome == "rate_limited":
+ assert ("Exa(免费)限流,已改用 DeepSeek" if lang == "zh" else "Rate-limited: Exa (free); switched to DeepSeek") in line
+ elif outcome == "unavailable":
+ assert ("暂时不可用" if lang == "zh" else "unavailable") in line
+ else:
+ assert ("立即重试" if lang == "zh" else "Retry now") in line
+ assert activity.attempts[0].remedy_key == "repair.retrySearch"
+
+
SERVICE_CARDS = {
# Design example: Tavily answers with five results.
"service_completed": lambda: _chain(
@@ -762,6 +793,36 @@ def test_a_search_services_card_and_line_say_the_same_in_both_languages(case):
{"basis": "list", "usd": 0, "calls": 1}, "$0",
id="an exact zero is never an estimate",
),
+ pytest.param(
+ (_tried(KEYLESS, "completed", usd=0.0),), _service_ran(KEYLESS, "exa-mcp", 0.0), "completed",
+ {"executor_kind": "service", "source_id": KEYLESS, "source_name": "Exa", "provider": "exa-mcp"},
+ {"basis": "list", "usd": 0, "calls": 1}, "Free",
+ id="keyless exact zero is free",
+ ),
+ pytest.param(
+ (_tried(KEYLESS, error_code="service_rate_limited", usd=0.0), _tried(DEEPSEEK, "completed", kind="model", usd=0.01)),
+ ProxyExecution(
+ executor_origin=Origin(provider="deepseek", api="openai_chat", model="deepseek-chat"),
+ executor_source_id=DEEPSEEK,
+ executor_billing="metered",
+ cost=HostedCost(basis="list", usd=0.01),
+ ), "completed",
+ {"executor_kind": "model", "source_id": DEEPSEEK, "source_name": "DeepSeek", "provider": "deepseek", "model": "deepseek-chat"},
+ {"basis": "list", "usd": 0.01, "calls": 1}, "≈ $0.01",
+ id="keyless rate limit falls back without key wording",
+ ),
+ pytest.param(
+ (_tried(TAVILY, "completed", usd=0.01), _tried(KEYLESS, "completed", usd=0.0)), _service_ran(KEYLESS, "exa-mcp", 0.0), "completed",
+ {"executor_kind": "service", "source_id": KEYLESS, "source_name": "Exa", "provider": "exa-mcp"},
+ {"basis": "list", "usd": 0.01, "calls": 1}, "≈ $0.01",
+ id="keyless after a paid attempt keeps the paid total",
+ ),
+ pytest.param(
+ (_tried(TAVILY, "completed"), _tried(KEYLESS, "completed", usd=0.0)), _service_ran(KEYLESS, "exa-mcp", 0.0), "completed",
+ {"executor_kind": "service", "source_id": KEYLESS, "source_name": "Exa", "provider": "exa-mcp"},
+ {"basis": "list", "usd": 0, "calls": 1, "at_least": True}, "at least $0",
+ id="keyless with an unknown earlier charge is not free",
+ ),
pytest.param(
None, _service_ran(TAVILY, "tavily", 0.008), "completed",
{"executor_kind": "service", "source_id": TAVILY, "source_name": "Tavily", "provider": "tavily"},
@@ -852,6 +913,12 @@ def test_a_search_chain_alone_says_who_ran_it_and_what_it_cost(attempts, executi
# Skips that are no failure of the Source's own, and need nothing.
pytest.param(_skip(TAVILY, "cooling", retry_at="2026-10-21T04:30:00Z"), HEALTHY,
("skip.cooling", None, None), id="cooling"),
+ pytest.param(_skip(KEYLESS, "cooling"), _now({KEYLESS: {"enabled": True}}),
+ ("skip.cooling", "repair.retrySearch", None), id="keyless cooling: retry search, never credentials"),
+ pytest.param(_tried(KEYLESS, error_code="service_rate_limited", usd=0.0), _now({KEYLESS: {"enabled": True}}),
+ ("reason.service_rate_limited", "repair.retrySearch", None), id="keyless rate limit: retry search, never credentials"),
+ pytest.param(_skip(KEYLESS, "cooling"), _now({KEYLESS: {"enabled": False}}),
+ ("skip.cooling", None, None), id="keyless disabled: no credential repair"),
pytest.param(_skip(DEEPSEEK, "query_too_long"), HEALTHY, ("skip.query_too_long", None, None), id="query too long"),
pytest.param(_skip(TAVILY, "unavailable"), _now({TAVILY: None}), ("skip.unavailable", None, None), id="unavailable"),
],
@@ -920,6 +987,7 @@ ATTEMPT_COPY = (
"key", "reauthorize", "balance", "balanceReenable", "limit", "limitReenable", "tavilyLimit", "plan",
"account", "error", "disabled",
)),
+ "repair.retrySearch",
"listSeparator",
"itemSeparator",
"switch",
diff --git a/tests/test_model_hub_hosted_executor.py b/tests/test_model_hub_hosted_executor.py
index 899383a1c..6583a91ef 100644
--- a/tests/test_model_hub_hosted_executor.py
+++ b/tests/test_model_hub_hosted_executor.py
@@ -19,8 +19,14 @@ from datetime import timedelta
import aiohttp
import pytest
-from config.v2_config import ModelHubBackendModelConfig, ModelHubHostedToolConfig, ModelHubModelConfig
+from config.v2_config import (
+ KEYLESS_EXA_SOURCE_ID,
+ ModelHubBackendModelConfig,
+ ModelHubHostedToolConfig,
+ ModelHubModelConfig,
+)
from core.agent_core.messages import HostedCost, message_from_dict
+from core.handlers.model_hub import search_chain as search_chain_module
from core.handlers.model_hub import service as service_module
from core.handlers.model_hub.adapter import DiscoveredModel, InvokeCancelledError, RawOutcomeKind, UpstreamRejection
from core.handlers.model_hub.capability_evidence import EvidenceFeature
@@ -116,6 +122,18 @@ def _executor_models(monkeypatch):
monkeypatch.setattr(
hosted_tools_module, "source_executor_models", lambda vendor, protocol: _EXECUTOR_MODELS.get(vendor, ()),
)
+ # These gateway tests exercise model executors and their fallback/error records. The active keyless Exa
+ # service is covered at the owning search-chain boundary in test_model_hub_search_chain; keep it out of
+ # this model-only fixture without changing the shipped activation predicate.
+ original_service = hosted_tools_module.model_hub_search_service
+
+ def without_keyless(source):
+ if source.id == KEYLESS_EXA_SOURCE_ID:
+ return None
+ return original_service(source)
+
+ monkeypatch.setattr(hosted_tools_module, "model_hub_search_service", without_keyless)
+ monkeypatch.setattr(search_chain_module, "model_hub_search_service", without_keyless)
def _bind(service, tool, executor):
diff --git a/tests/test_model_hub_hosted_tools_config.py b/tests/test_model_hub_hosted_tools_config.py
index 320c046fb..56138f43b 100644
--- a/tests/test_model_hub_hosted_tools_config.py
+++ b/tests/test_model_hub_hosted_tools_config.py
@@ -145,12 +145,21 @@ def test_disk_load_with_a_broken_hosted_tools_section_keeps_model_hub(monkeypatc
def _validate_status(status):
- from jsonschema import Draft7Validator
-
- schema = json.loads(
- (Path(__file__).parents[1] / "docs/plans/model-hub-contracts/hosted-tools-status.schema.json").read_text()
+ from jsonschema import Draft7Validator, RefResolver
+
+ schema_dir = Path(__file__).parents[1] / "docs/plans/model-hub-contracts"
+ schema = json.loads((schema_dir / "hosted-tools-status.schema.json").read_text())
+ source_schema = json.loads((schema_dir / "source.schema.json").read_text())
+ schema.pop("$id", None)
+ source_schema.pop("$id", None)
+ # The contract files use repository-relative ids; anchor this test resolver at
+ # a synthetic absolute URI so jsonschema does not recursively prefix them.
+ resolver = RefResolver(
+ base_uri="https://schemas.avibe.test/model-hub/",
+ referrer=schema,
+ store={"https://schemas.avibe.test/model-hub/source.schema.json": source_schema},
)
- Draft7Validator(schema).validate(status)
+ Draft7Validator(schema, resolver=resolver).validate(status)
def _api_service(tmp_path):
diff --git a/tests/test_model_hub_hosted_tools_resolution.py b/tests/test_model_hub_hosted_tools_resolution.py
index 868e20e0a..2cc47bfc5 100644
--- a/tests/test_model_hub_hosted_tools_resolution.py
+++ b/tests/test_model_hub_hosted_tools_resolution.py
@@ -14,6 +14,7 @@ from datetime import date, datetime, timezone
import pytest
from config.v2_config import (
+ KEYLESS_EXA_SOURCE_ID,
ModelHubAgentSupplyConfig,
ModelHubConfig,
ModelHubHostedToolConfig,
@@ -79,7 +80,7 @@ IMAGE_MODELS = {
@pytest.fixture(autouse=True)
-def _overlay(monkeypatch):
+def _overlay(monkeypatch, request):
monkeypatch.setattr(
hosted_tools_module, "source_executor_models", lambda vendor, protocol: EXECUTOR_MODELS.get(vendor, ()),
)
@@ -87,6 +88,18 @@ def _overlay(monkeypatch):
monkeypatch.setattr(
hosted_tools_module, "source_image_models", lambda vendor, protocol, listed: IMAGE_MODELS.get(vendor, ()),
)
+ # These cases pin model-executor priors and ordering. The active keyless Exa
+ # chain is covered by the owning search-chain tests; omit that catalog service
+ # from this model-only fixture without changing the shipped activation predicate.
+ original_service = hosted_tools_module.model_hub_search_service
+
+ def without_keyless(source):
+ if source.id == KEYLESS_EXA_SOURCE_ID:
+ return None
+ return original_service(source)
+
+ hosted_tools_module.model_hub_search_service = without_keyless
+ request.addfinalizer(lambda: setattr(hosted_tools_module, "model_hub_search_service", original_service))
# The bundled overlay's vendors; which of them list image models is `IMAGE_MODELS`.
monkeypatch.setattr(hosted_tools_module, "bundled_provider_vendors", lambda: dict.fromkeys(("anthropic", "openai", "xai")))
diff --git a/tests/test_model_hub_search_chain.py b/tests/test_model_hub_search_chain.py
index 74de2e494..8773d5c60 100644
--- a/tests/test_model_hub_search_chain.py
+++ b/tests/test_model_hub_search_chain.py
@@ -9,6 +9,7 @@ import asyncio
import copy
import json
import threading
+from dataclasses import replace
from datetime import timedelta
import pytest
@@ -16,7 +17,7 @@ import pytest
from config.v2_config import (
KEYLESS_EXA_SERVICE_ID,
KEYLESS_EXA_SOURCE_ID,
- ModelHubConfig, ModelHubSourceStateConfig,
+ ModelHubConfig, ModelHubSearchServiceSettings, ModelHubSourceStateConfig,
model_hub_keyless_exa_source,
)
from core.handlers.model_hub import hosted_tools, search_chain
@@ -35,13 +36,29 @@ ROW = {"url": "https://example.test/a", "title": "Title", "summary": "Model exce
"date": "2026-10-21", "published_date": "today", "publishedDate": "yesterday"}
-def owner(tmp_path, vendors=("exa",), *, web=None, model=False):
+def owner(tmp_path, vendors=("exa",), *, web=None, model=False, include_keyless=False):
service, store, adapter = _service(tmp_path)
config = _config(web)
selected = [IDS[vendor] for vendor in vendors]
config.sources = [next(s for s in config.sources if s.id == sid) for sid in selected] + (
[next(s for s in config.sources if s.id == MODEL)] if model else []
)
+ setting = config.hosted_tools["web_search"]
+ if not include_keyless:
+ services = dict(setting.services)
+ services.setdefault(KEYLESS_EXA_SOURCE_ID, ModelHubSearchServiceSettings(enabled=False))
+ setting = replace(setting, services=services)
+ if not include_keyless and setting.executor_order is None and not (web and web.get("service_order")):
+ automatic_without_keyless = list(selected)
+ if model:
+ automatic_without_keyless.append(MODEL)
+ config.hosted_tools["web_search"] = replace(
+ setting,
+ executor_order=tuple(automatic_without_keyless),
+ executor_order_kinds={sid: "model" if sid == MODEL else "service" for sid in automatic_without_keyless},
+ )
+ else:
+ config.hosted_tools["web_search"] = setting
store.config = config
service.now = lambda: NOW
return service
@@ -239,12 +256,12 @@ async def test_mapping_bounds_and_decode_are_off_loop(tmp_path, monkeypatch):
@pytest.mark.parametrize("saved,kinds,expected", [
- (None, None, [EXA, TAVILY, DEEPSEEK, MODEL]),
- ([MODEL], None, [EXA, TAVILY, DEEPSEEK, MODEL]),
- ([MODEL, DEEPSEEK], None, [EXA, TAVILY, DEEPSEEK, MODEL]),
- ([MODEL, DEEPSEEK], {MODEL: "model", DEEPSEEK: "service"}, [EXA, TAVILY, MODEL, DEEPSEEK]),
- ([DEEPSEEK], {DEEPSEEK: "service"}, [DEEPSEEK, EXA, TAVILY, MODEL]),
- ([EXA, MODEL], {EXA: "model", MODEL: "model"}, [EXA, TAVILY, DEEPSEEK, MODEL]),
+ (None, None, [EXA, TAVILY, DEEPSEEK, MODEL, KEYLESS_EXA_SOURCE_ID]),
+ ([MODEL], None, [EXA, TAVILY, DEEPSEEK, MODEL, KEYLESS_EXA_SOURCE_ID]),
+ ([MODEL, DEEPSEEK], None, [EXA, TAVILY, DEEPSEEK, MODEL, KEYLESS_EXA_SOURCE_ID]),
+ ([MODEL, DEEPSEEK], {MODEL: "model", DEEPSEEK: "service"}, [EXA, TAVILY, MODEL, DEEPSEEK, KEYLESS_EXA_SOURCE_ID]),
+ ([DEEPSEEK], {DEEPSEEK: "service"}, [DEEPSEEK, EXA, TAVILY, MODEL, KEYLESS_EXA_SOURCE_ID]),
+ ([EXA, MODEL], {EXA: "model", MODEL: "model"}, [EXA, TAVILY, DEEPSEEK, MODEL, KEYLESS_EXA_SOURCE_ID]),
])
def test_order_placement_is_read_only_and_survives_reload(tmp_path, saved, kinds, expected):
web = {"service_order": [EXA, TAVILY]}
@@ -266,7 +283,7 @@ async def test_turn_freezes_preference_candidates_results_and_disabled_tail(tmp_
service = owner(tmp_path, ("exa", "deepseek"), model=True,
web={"prefer_native": False, "services": {EXA: {"results": 2}, DEEPSEEK: {"enabled": False}}})
turn = service.freeze_turn_hosted_tools(service.store.load())
- assert [slot.source_id for slot in turn.executors["web_search"]] == [EXA, MODEL, DEEPSEEK]
+ assert [slot.source_id for slot in turn.executors["web_search"]] == [EXA, MODEL, DEEPSEEK, KEYLESS_EXA_SOURCE_ID]
model = service.store.load().sources[-1]
facts = service.hosted_tools_for_hop(model, "grok-4.6", turn)["web_search"]
assert facts == {"native": "unsupported", "replay": "unsupported"}
@@ -282,13 +299,13 @@ async def test_turn_freezes_preference_candidates_results_and_disabled_tail(tmp_
@pytest.mark.asyncio
@pytest.mark.parametrize("mix,code,skips", [
- ("disabled", "search_sources_blocked", ["disabled", "disabled"]),
- ("blocked", "search_sources_blocked", ["blocked", "disabled"]),
- ("cooling", "service_unavailable", ["cooling", "disabled"]),
- ("unavailable", "service_unavailable", ["unavailable", "disabled"]),
- ("long", "search_query_too_long", ["query_too_long", "disabled"]),
- ("blocked_long", "search_sources_blocked", ["blocked", "disabled"]),
- ("cooling_long", "service_unavailable", ["cooling", "disabled"]),
+ ("disabled", "search_sources_blocked", ["disabled", "disabled", "disabled"]),
+ ("blocked", "search_sources_blocked", ["blocked", "disabled", "disabled"]),
+ ("cooling", "service_unavailable", ["cooling", "disabled", "disabled"]),
+ ("unavailable", "service_unavailable", ["unavailable", "disabled", "disabled"]),
+ ("long", "search_query_too_long", ["query_too_long", "disabled", "disabled"]),
+ ("blocked_long", "search_sources_blocked", ["blocked", "disabled", "disabled"]),
+ ("cooling_long", "service_unavailable", ["cooling", "disabled", "disabled"]),
])
async def test_skip_precedence_terminal_reason_and_attempts_without_execution(tmp_path, mix, code, skips):
service = owner(tmp_path, ("deepseek", "exa"), web={"services": {EXA: {"enabled": False}, DEEPSEEK: {"enabled": mix != "disabled"}}})
@@ -326,8 +343,6 @@ async def test_keyless_producer_writes_request_only_zero_cost_usage(tmp_path, mo
"services": {KEYLESS_EXA_SOURCE_ID: {"enabled": True, "results": 3}},
},
)
- monkeypatch.setattr(hosted_tools, "KEYLESS_EXA_ACTIVE", True)
- monkeypatch.setattr(search_chain, "KEYLESS_EXA_ACTIVE", True)
body = {"jsonrpc": "2.0", "id": 1, "result": {"content": [{"type": "text", "text": json.dumps({
"results": [{"url": "https://example.test/keyless", "title": "Keyless", "highlights": ["excerpt"]}],
})}]}}
@@ -359,8 +374,6 @@ async def test_keyless_rate_limit_settles_service_cooldown_without_persisted_sou
"services": {KEYLESS_EXA_SOURCE_ID: {"enabled": True, "results": 3}},
},
)
- monkeypatch.setattr(hosted_tools, "KEYLESS_EXA_ACTIVE", True)
- monkeypatch.setattr(search_chain, "KEYLESS_EXA_ACTIVE", True)
calls = answers(monkeypatch, service, wire(429, {"error": {"message": "slow down"}}, headers={"Retry-After": "60"}))
first = await run(service)
second = await run(service)
@@ -387,8 +400,6 @@ async def test_keyless_overlapping_searches_settle_rate_limit_before_next_admiss
"services": {KEYLESS_EXA_SOURCE_ID: {"enabled": True, "results": 3}},
},
)
- monkeypatch.setattr(hosted_tools, "KEYLESS_EXA_ACTIVE", True)
- monkeypatch.setattr(search_chain, "KEYLESS_EXA_ACTIVE", True)
entered = asyncio.Event()
release = asyncio.Event()
calls = []
@@ -427,8 +438,6 @@ async def test_keyless_queued_waiter_times_out_before_admission(tmp_path, monkey
"services": {KEYLESS_EXA_SOURCE_ID: {"enabled": True, "results": 3}},
},
)
- monkeypatch.setattr(hosted_tools, "KEYLESS_EXA_ACTIVE", True)
- monkeypatch.setattr(search_chain, "KEYLESS_EXA_ACTIVE", True)
monkeypatch.setattr(search_chain, "ATTEMPT_SECONDS", 0.01)
await service._keyless_exa_attempt_lock.acquire()
calls = answers(monkeypatch, service, wire())
@@ -444,8 +453,8 @@ async def test_keyless_queued_waiter_times_out_before_admission(tmp_path, monkey
@pytest.mark.asyncio
-async def test_keyless_retry_branch_accepts_the_synthetic_source_while_flag_is_off(tmp_path):
- """KEX-1: a downgraded reader can clear a built-in cooldown without a Source row or network call."""
+async def test_keyless_retry_branch_accepts_the_synthetic_source(tmp_path):
+ """KEX-3: a built-in cooldown clears without a credential Source or network call."""
service = owner(tmp_path, ("exa",))
source = model_hub_keyless_exa_source()
generation = service._service_cooldowns.advance(source, KEYLESS_EXA_SERVICE_ID)
@@ -637,20 +646,26 @@ async def test_free_check_is_joined_without_holding_the_mutation_lock(tmp_path,
@pytest.mark.asyncio
async def test_search_read_and_chain_activate_together(tmp_path, monkeypatch):
- """MH-SEARCH-SERVICES-001: shipped defaults expose the same service that the frozen turn executes.
+ """MH-SEARCH-SERVICES-001: shipped defaults expose the same active services that the frozen turn executes.
- No activation monkeypatch: a dormant producer or a separately gated read must fail here.
+ The default-on reader and producer share one predicate; no activation monkeypatch is allowed.
"""
- service = owner(tmp_path, ("exa",), web={"prefer_native": False})
+ service = owner(tmp_path, ("deepseek", "exa"), web={"prefer_native": False}, include_keyless=True)
calls = answers(monkeypatch, service, wire())
frozen = service.freeze_turn_hosted_tools(service.store.load())
visible = _web(service)
assert frozen.prefer_native is False
assert [(slot.source_id, slot.kind, slot.results, slot.label) for slot in frozen.executors["web_search"]] == [
(EXA, "service", 5, "exa"),
+ (DEEPSEEK, "service", 5, "deepseek"),
+ (KEYLESS_EXA_SOURCE_ID, "service", 5, "Exa (free)"),
+ ]
+ assert [(row["source_id"], row["kind"]) for row in visible["executor_candidates"]] == [
+ (EXA, "service"),
+ (DEEPSEEK, "service"),
+ (KEYLESS_EXA_SOURCE_ID, "service"),
]
- assert [(row["source_id"], row["kind"]) for row in visible["executor_candidates"]] == [(EXA, "service")]
- assert {vendor["id"] for vendor in visible["service_vendors"]} == {"exa", "tavily", "deepseek"}
+ assert {vendor["id"] for vendor in visible["service_vendors"]} == {"exa", "tavily", "deepseek", "exa-mcp"}
answer = await run(service, turn=frozen)
assert len(calls) == 1 and calls[0][0] == EXA
assert answer["record"]["status"] == "completed"
@@ -698,16 +713,17 @@ async def test_mixed_chain_keeps_every_attempts_cost_even_when_the_last_failed_b
expected = [EXA, TAVILY]
result = await run(service)
attempts = result["record"]["attempts"]
- assert [row["source_id"] for row in attempts] == expected
- assert attempts[-1]["cost"] == {"basis": "list", "usd": 0}
- assert len(calls) == (1 if first == "model" else 2)
+ executed_candidates = [row for row in attempts if row["source_id"] != KEYLESS_EXA_SOURCE_ID]
+ assert [row["source_id"] for row in executed_candidates] == expected
+ assert executed_candidates[-1]["cost"] == {"basis": "list", "usd": 0}
+ assert len(calls) == 2
earlier = result["execution"]["failed_attempts"][0]
assert earlier["source_id"] == expected[0]
- assert earlier.get("cost") == attempts[0].get("cost")
+ assert earlier.get("cost") == executed_candidates[0].get("cost")
if first == "unknown":
- assert "cost" not in attempts[0]
+ assert "cost" not in executed_candidates[0]
else:
- assert attempts[0]["cost"]["usd"] > 0
+ assert executed_candidates[0]["cost"]["usd"] > 0
assert result["execution"]["executor_source_id"] == expected[-1]
_hosted_result("web_search", result)
@@ -909,12 +925,14 @@ def test_read_time_role_changes_never_duplicate_sources_or_rewrite_config(tmp_pa
rows = _web(service)["executor_candidates"]
ids = [row["source_id"] for row in rows]
assert len(ids) == len(set(ids))
+ stable_rows = [row for row in rows if row["source_id"] != KEYLESS_EXA_SOURCE_ID]
+ stable_ids = [row["source_id"] for row in stable_rows]
if scenario == "retired":
- assert ids == [DEEPSEEK, MODEL]
+ assert stable_ids == [DEEPSEEK, MODEL]
elif scenario == "opt_in":
- assert ids == [EXA, DEEPSEEK, MODEL] and all(row["kind"] == "service" for row in rows)
+ assert stable_ids == [EXA, DEEPSEEK, MODEL] and all(row["kind"] == "service" for row in stable_rows)
else:
- assert ids == [EXA, DEEPSEEK, MODEL] and rows[-1]["kind"] == "model"
+ assert stable_ids == [EXA, DEEPSEEK, MODEL] and stable_rows[-1]["kind"] == "model"
assert config.to_payload() == before
@@ -1009,7 +1027,7 @@ async def test_stop_during_timeout_teardown_never_runs_the_next_paid_candidate(t
@pytest.mark.parametrize("mixed", [False, True])
async def test_model_executor_retains_the_chain_budget_not_the_service_attempt_limit(tmp_path, monkeypatch, mixed):
"""A native model search is not cut short and paid for again just because services are active."""
- from config.v2_config import ModelHubHostedToolConfig
+ from config.v2_config import ModelHubHostedToolConfig, ModelHubSearchServiceSettings
from core.handlers.model_hub import search_chain
from tests.test_model_hub_hosted_executor import WEB_ANSWER, WEB_CALL, _responses
from tests.test_model_hub_l3 import LiveInvokeHandle, RawOutcomeKind, _outcome
@@ -1031,6 +1049,7 @@ async def test_model_executor_retains_the_chain_budget_not_the_service_attempt_l
service.store.config.hosted_tools["web_search"] = ModelHubHostedToolConfig(
executor_order=(MODEL, EXA) if mixed else (MODEL,),
executor_order_kinds={MODEL: "model", EXA: "service"} if mixed else {MODEL: "model"},
+ services={KEYLESS_EXA_SOURCE_ID: ModelHubSearchServiceSettings(enabled=False)},
)
monkeypatch.setattr(search_chain, "ATTEMPT_SECONDS", .01)
monkeypatch.setattr(search_chain, "call_timeout", lambda tool: 1)
@@ -1038,7 +1057,7 @@ async def test_model_executor_retains_the_chain_budget_not_the_service_attempt_l
result = await run(service)
assert not calls and result["record"]["status"] == "completed"
assert result["execution"]["executor_source_id"] == MODEL
- assert ("attempts" in result["record"]) is mixed
+ assert "attempts" in result["record"]
@pytest.mark.asyncio
@@ -1094,6 +1113,7 @@ async def test_blocked_model_executor_keeps_its_own_remedy_beside_a_disabled_ser
{"source_id": MODEL, "label": model.display_name, "kind": "model", "outcome": "skipped",
"skipped": "blocked", "needs_action": "models.source.error.unclassified"},
{"source_id": EXA, "label": "exa", "kind": "service", "outcome": "skipped", "skipped": "disabled"},
+ {"source_id": KEYLESS_EXA_SOURCE_ID, "label": "Exa (free)", "kind": "service", "outcome": "skipped", "skipped": "disabled"},
]
assert "execution" not in result
_hosted_result("web_search", result)
diff --git a/tests/test_model_hub_search_settings.py b/tests/test_model_hub_search_settings.py
index 2bc016d2c..4913230d3 100644
--- a/tests/test_model_hub_search_settings.py
+++ b/tests/test_model_hub_search_settings.py
@@ -103,13 +103,11 @@ def test_released_and_keyless_search_settings_read_without_a_migration_write(fix
assert setting.services[KEYLESS_EXA_SOURCE_ID].to_payload() == {"results": 9, "enabled": False}
-def test_keyless_candidate_and_catalog_are_dormant_by_default_and_readable_when_enabled(tmp_path, monkeypatch):
- """KEX-1: the shipped flag-off read is unchanged; a future flip reads the built-in candidate."""
+def test_keyless_candidate_and_catalog_are_active_by_default(tmp_path):
+ """KEX-3: the default read includes the built-in candidate and catalog row."""
config = _config()
- assert hosted_tools.KEYLESS_EXA_ACTIVE is False
- assert all(vendor["id"] != "exa-mcp" for vendor in hosted_tools._service_vendors(config))
+ assert hosted_tools.KEYLESS_EXA_ACTIVE is True
service, _, _ = _disk_service(tmp_path, config)
- monkeypatch.setattr(hosted_tools, "KEYLESS_EXA_ACTIVE", True)
visible = _web(service)
assert any(row["source_id"] == KEYLESS_EXA_SOURCE_ID and row["model_id"] == KEYLESS_EXA_SERVICE_ID
for row in visible["executor_candidates"])
@@ -121,7 +119,7 @@ def test_keyless_candidate_and_catalog_are_dormant_by_default_and_readable_when_
@pytest.mark.asyncio
async def test_keyless_override_role_and_cooldown_survive_an_unrelated_config_write(tmp_path):
- """KEX-1: synthetic state is preserved by a later real V2 save, even while dormant."""
+ """KEX-3: synthetic state is preserved by a later real V2 save while active."""
raw = json.loads((FIXTURES / "keyless_exa_v21.json").read_text(encoding="utf-8"))
service, path, _ = _disk_service(tmp_path, _config(raw))
source = model_hub_keyless_exa_source()
@@ -171,8 +169,8 @@ async def test_mixed_order_and_role_snapshot_survive_real_v2_restart(tmp_path):
assert restarted.hosted_tools["web_search"].service_order == (TAVILY, EXA)
assert not restarted.hosted_tools["web_search"].prefer_native
assert _web(service)["executor_order"] == order
- # Active search placement keeps the deliberate model first, then named service EXA, then disabled entries.
- assert _web(service)["effective_order"] == [MODEL, EXA, TAVILY, DEEPSEEK]
+ # Active search placement keeps the built-in service first, then deliberate model/service entries and disabled tails.
+ assert _web(service)["effective_order"] == [KEYLESS_EXA_SOURCE_ID, MODEL, EXA, TAVILY, DEEPSEEK]
await service.set_hosted_tool("web_search", {"executor_order": None})
reset = V2ModelHubConfigStore().load().hosted_tools["web_search"].to_payload()
assert "executor_order" not in reset and "executor_order_kinds" not in reset
@@ -476,9 +474,9 @@ def test_http_tools_put_and_read_preserve_patch_and_active_contract(tmp_path, mo
registry=_api_response_registry()).validate(written)
web = written["hosted_tools"]["tools"][0]
assert web["prefer_native"] is False and web["services"] == {TAVILY: {"results": 7, "enabled": False}}
- assert {vendor["id"] for vendor in web["service_vendors"]} == {"deepseek", "tavily", "exa"}
+ assert {vendor["id"] for vendor in web["service_vendors"]} == {"deepseek", "tavily", "exa", "exa-mcp"}
assert [(row["source_id"], row["kind"]) for row in web["executor_candidates"]] == [
- (EXA, "service"), (DEEPSEEK, "service"), (MODEL, "model"), (TAVILY, "service"),
+ (EXA, "service"), (DEEPSEEK, "service"), (KEYLESS_EXA_SOURCE_ID, "service"), (MODEL, "model"), (TAVILY, "service"),
]
assert web["executor_candidates"][-1]["settings"] == {"results": 7, "enabled": False}
diff --git a/ui/src/components/settings/models/AddSearchServiceDialog.tsx b/ui/src/components/settings/models/AddSearchServiceDialog.tsx
index 3bb0c6328..74d9c96f1 100644
--- a/ui/src/components/settings/models/AddSearchServiceDialog.tsx
+++ b/ui/src/components/settings/models/AddSearchServiceDialog.tsx
@@ -19,7 +19,8 @@ export const AddSearchServiceDialog: React.FC<{
onClose: () => void;
onAdded: (created: SourceCreated) => void;
onOpenSource: (sourceId: string) => void;
-}> = ({ tool, pending, sourceReads, onClose, onAdded, onOpenSource }) => {
+ onViewOrder: () => void;
+}> = ({ tool, pending, sourceReads, onClose, onAdded, onOpenSource, onViewOrder }) => {
const { t } = useTranslation();
const [selectedId, setSelectedId] = React.useState<string | null>(null);
const selected = tool.service_vendors?.find((vendor) => vendor.id === selectedId);
@@ -44,7 +45,7 @@ export const AddSearchServiceDialog: React.FC<{
<SearchServicePrice price={vendor.price} />
{builtIn ? <>
<span className="model-hub-pill model-hub-accent-pill--neutral self-start border">{t('settings.models.searchServices.builtIn')}</span>
- <Button variant="outline" size="sm" disabled={pending} onClick={() => onOpenSource(vendor.source_ids[0])}>{t('settings.models.searchServices.viewOrder')}<ChevronRight aria-hidden /></Button>
+ <Button variant="outline" size="sm" disabled={pending} onClick={onViewOrder}>{t('settings.models.searchServices.viewOrder')}<ChevronRight aria-hidden /></Button>
</> : added ? <>
<span className="model-hub-pill model-hub-accent-pill--neutral self-start border">{t(`settings.models.searchServices.${state}`)}</span>
<Button variant="outline" size="sm" disabled={pending} onClick={() => onOpenSource(vendor.source_ids.find((id) => !serviceSettings(tool, vendor, id).enabled) ?? vendor.source_ids[0])}>{t('settings.models.searchServices.openDetail', { vendor: vendorName })}</Button>
@@ -52,7 +53,7 @@ export const AddSearchServiceDialog: React.FC<{
</section>;
})}
</div>
- <SearchServiceNotes />
+ <SearchServiceNotes vendor={tool.service_vendors?.find((vendor) => vendor.facts.built_in)} />
<p className="model-hub-tool-note">{t('settings.models.searchServices.priceNote')}</p>
</DialogContent>
</Dialog>;
diff --git a/ui/src/components/settings/models/SearchServiceParts.tsx b/ui/src/components/settings/models/SearchServiceParts.tsx
index def2a64e1..9e30033e8 100644
--- a/ui/src/components/settings/models/SearchServiceParts.tsx
+++ b/ui/src/components/settings/models/SearchServiceParts.tsx
@@ -7,9 +7,9 @@ import { Select } from '@/components/ui/select';
import { cn } from '@/lib/utils';
import { ToggleSwitch } from '../SettingsPrimitives';
import { Field } from './dialogFields';
-import { atLeast, formatCost, formatCount, formatMonthDay, formatSmallUsd, formatUsd } from './format';
+import { atLeast, cooldownTime, formatCost, formatCount, formatMonthDay, formatSmallUsd, formatUsd } from './format';
import { foldRegionRead, regionFailed, type RegionRead } from './regionRead';
-import { serviceSettings } from './searchServices';
+import { KEYLESS_EXA_SOURCE_ID, serviceSettings } from './searchServices';
import { sourceStatePresentation } from './sourceStatePresentation';
import { usageHasNoPrice, type ServiceMonth } from './usageProjection';
import { VendorGlyph } from './vendorGlyph';
@@ -38,11 +38,19 @@ export const SearchCandidateStatus: React.FC<{
const { t, i18n } = useTranslation();
const state = candidate.kind === 'service' ? candidate.state : source?.state;
const success = tool.status.verified.find((row) => row.source_id === candidate.source_id && row.model_id === candidate.model_id);
+ const keyless = candidate.kind === 'service' && candidate.source_id === KEYLESS_EXA_SOURCE_ID;
let text: string | null = null;
let tone = 'model-hub-status-mint';
+ const until = candidate.kind === 'service' ? candidate.cooldown_until : null;
+ const time = until ? cooldownTime(until, i18n.language) : null;
if (candidate.kind === 'service' && !candidate.settings.enabled) {
text = t('settings.models.searchServices.unused');
tone = 'model-hub-accent-pill--neutral';
+ } else if (keyless) {
+ // The built-in service has no credential health or key repair. Only its
+ // service cooldown and per-row switch can override the free status.
+ text = until ? t('settings.models.searchServices.keylessCooldown') : t('settings.models.searchServices.keylessReady');
+ if (until) tone = 'model-hub-status-gold';
} else if (state && (state.status === 'needs_action' || state.status === 'error' || state.status === 'cooldown')) {
const presentation = sourceStatePresentation(state, 'card', i18n.language);
const reason = candidate.kind === 'service' && state.detail_key === 'models.source.needs_action.credential_revoked'
@@ -50,10 +58,6 @@ export const SearchCandidateStatus: React.FC<{
text = t('settings.models.searchServices.skipped', { reason });
tone = 'model-hub-status-gold';
} else if (candidate.kind === 'service' && candidate.cooldown_until !== null) {
- const date = new Date(candidate.cooldown_until);
- const today = new Date();
- const clock = new Intl.DateTimeFormat(i18n.language, { hour: '2-digit', minute: '2-digit', hour12: false }).format(date);
- const time = date.toDateString() === today.toDateString() ? clock : `${formatMonthDay(candidate.cooldown_until)} ${clock}`;
text = t('settings.models.searchServices.cooldown', { time });
tone = 'model-hub-status-gold';
} else if (success) {
@@ -89,7 +93,7 @@ export const SearchVendorFacts: React.FC<{ vendor: HostedSearchServiceVendor }>
};
/** This month's requests and their list valuation, with the vendors' own figure beside it, never in it. */
-const ServiceMonthLine: React.FC<{ month: RegionRead<ServiceMonth>; onOpenUsage?: () => void }> = ({ month, onOpenUsage }) => {
+const ServiceMonthLine: React.FC<{ month: RegionRead<ServiceMonth>; keyless?: boolean; onOpenUsage?: () => void }> = ({ month, keyless = false, onOpenUsage }) => {
const { t, i18n } = useTranslation();
const usage = foldRegionRead<ServiceMonth, ServiceMonth | null>(month, {
loading: () => null, ready: (data) => data, unread: () => null, degraded: (data) => data,
@@ -103,7 +107,11 @@ const ServiceMonthLine: React.FC<{ month: RegionRead<ServiceMonth>; onOpenUsage?
// Without a price table the report carries counts only.
...(usage.priced ? [usageHasNoPrice(usage.totals)
? t('settings.models.usage.cost.noPrice')
- : t('settings.models.searchServices.monthEstimate', {
+ : keyless && (usage.totals.api_cost_usd ?? 0) === 0
+ && (usage.totals.api_cost_usd !== undefined || usage.totals.requests === 0)
+ && !usage.totals.api_cost_lower_bound && !usage.partial
+ ? t('settings.models.searchServices.free')
+ : t('settings.models.searchServices.monthEstimate', {
usd: formatCost(usage.totals.api_cost_usd ?? 0, usage.totals.api_cost_lower_bound || usage.partial, i18n.language),
})] : []),
...(usage.priced && usage.totals.reported_requests > 0
@@ -148,6 +156,6 @@ export const SearchServiceSettings: React.FC<{
</Field>
<p className="model-hub-tool-note">{t('settings.models.searchServices.settingsNote')}</p>
<SearchServicePrice price={vendor.price} />
- {month && <ServiceMonthLine month={month} onOpenUsage={onOpenUsage} />}
+ {month && <ServiceMonthLine month={month} keyless={source.id === KEYLESS_EXA_SOURCE_ID} onOpenUsage={onOpenUsage} />}
</section>;
};
diff --git a/ui/src/components/settings/models/SearchServices.test.tsx b/ui/src/components/settings/models/SearchServices.test.tsx
index fea29e5c9..d786e4bf6 100644
--- a/ui/src/components/settings/models/SearchServices.test.tsx
+++ b/ui/src/components/settings/models/SearchServices.test.tsx
@@ -46,11 +46,11 @@ const MONTH_REPORT: UsageReport = {
}],
})),
};
-const detail = (source: Source, tool = ACTIVE_SEARCH, serviceView = true) => {
+const detail = (source: Source, tool = ACTIVE_SEARCH, serviceView = true, report = MONTH_REPORT) => {
const onSaveSearch = vi.fn();
const onRetryService = vi.fn();
const onOpenUsage = vi.fn();
- const readUsage = vi.spyOn(modelsApi, 'getUsageSummary').mockResolvedValue(MONTH_REPORT);
+ const readUsage = vi.spyOn(modelsApi, 'getUsageSummary').mockResolvedValue(report);
const settle: SourceMutationSettlement = {
source: vi.fn().mockResolvedValue(null), gone: vi.fn().mockResolvedValue(null), unread: vi.fn().mockResolvedValue(null), release: vi.fn(),
readInventory: vi.fn().mockResolvedValue({ snapshot: 1, sources: [source] }),
@@ -59,11 +59,12 @@ const detail = (source: Source, tool = ACTIVE_SEARCH, serviceView = true) => {
const view = render(wrap(<SourceDetailPanel source={source} hostedTools={readyRegion({ tools: [tool] })} onSaveSearch={onSaveSearch} onRetryService={onRetryService} serviceView={serviceView} onManageSource={vi.fn()} onOpenUsage={onOpenUsage} trackMutation={trackMutation} onReauth={vi.fn()} onMutationCommitted={async (commit) => { await commit.settle(); }} />));
return { ...view, onSaveSearch, onRetryService, onOpenUsage, readUsage, settle };
};
-const addDialog = (tool = ACTIVE_SEARCH) => {
+const addDialog = (tool = ACTIVE_SEARCH, lng = 'en') => {
const onAdded = vi.fn();
const onOpenSource = vi.fn();
- render(wrap(<AddSearchServiceDialog tool={tool} pending={false} sourceReads={createSourceCollectionReadAuthority(modelsApi)} onClose={vi.fn()} onAdded={onAdded} onOpenSource={onOpenSource} />));
- return { onAdded, onOpenSource };
+ const onViewOrder = vi.fn();
+ render(wrap(<AddSearchServiceDialog tool={tool} pending={false} sourceReads={createSourceCollectionReadAuthority(modelsApi)} onClose={vi.fn()} onAdded={onAdded} onOpenSource={onOpenSource} onViewOrder={onViewOrder} />, lng));
+ return { onAdded, onOpenSource, onViewOrder };
};
const newVendors = (): HostedWebSearchToolStatus => ({
...ACTIVE_SEARCH, services: {}, executor_candidates: [],
@@ -121,16 +122,30 @@ describe('search service activation and mixed order', () => {
expect(screen.getByRole('heading', { name: 'Status by Source' })).toBeTruthy();
});
- it('renders the built-in keyless Exa row as free and non-addable', async () => {
- tab(KEYLESS_ACTIVE_SEARCH);
- expect(screen.getByText('Exa (free)')).toBeTruthy();
- expect(screen.getByText('Free')).toBeTruthy();
- expect(screen.getByText(/IP rate-limited/)).toBeTruthy();
- const { onOpenSource } = addDialog(KEYLESS_ACTIVE_SEARCH);
- expect(screen.getByText('Free; IP rate-limited')).toBeTruthy();
- expect(screen.queryByRole('button', { name: 'Add Exa (free)' })).toBeNull();
- await userEvent.click(screen.getByRole('button', { name: 'View search order' }));
- expect(onOpenSource).toHaveBeenCalledWith('src_exakeyless');
+ it.each(['en', 'zh'])('keeps the built-in row visible when overall web search is off in %s', (lng) => {
+ const tool = { ...KEYLESS_ACTIVE_SEARCH, enabled: false };
+ render(wrap(<ToolsTab read={readyRegion({ tools: [tool] })} sources={SEARCH_SOURCES} pending={new Set()} onSave={vi.fn()} onClear={vi.fn()} onRetry={vi.fn()} />, lng));
+ const row = document.querySelector('[data-executor="src_exakeyless"]') as HTMLElement;
+ expect(row).toBeTruthy();
+ expect(within(row).getByRole('switch', { name: i18n.cloneInstance({ lng }).t('settings.models.searchServices.use') as string })).toBeTruthy();
+ });
+
+ it.each(['en', 'zh'])('renders the built-in keyless Exa row as free and non-addable in %s', async (lng) => {
+ const locale = i18n.cloneInstance({ lng });
+ render(wrap(<ToolsTab read={readyRegion({ tools: [KEYLESS_ACTIVE_SEARCH] })} sources={SEARCH_SOURCES} pending={new Set()} onSave={vi.fn()} onClear={vi.fn()} onRetry={vi.fn()} />, lng));
+ expect(screen.getByText(locale.t('settings.models.searchServices.vendorName.exa-mcp'))).toBeTruthy();
+ expect(screen.getByText(locale.t('settings.models.searchServices.keylessReady'))).toBeTruthy();
+ expect(screen.getByText(locale.t('settings.models.searchServices.keylessResults', { count: 5 }))).toBeTruthy();
+ expect(screen.getByText(locale.t('settings.models.searchServices.free'))).toBeTruthy();
+ const keylessRow = document.querySelector('[data-executor="src_exakeyless"]') as HTMLElement;
+ expect(within(keylessRow).getByText(locale.t('settings.models.searchServices.use'))).toBeTruthy();
+ expect(keylessRow.textContent).not.toMatch(/使用供应商|Uses .* key|invalid key|Replace key|密钥无效/i);
+ cleanup();
+ const { onViewOrder } = addDialog(KEYLESS_ACTIVE_SEARCH, lng);
+ expect(screen.getByText(locale.t('settings.models.searchServices.freeTier'))).toBeTruthy();
+ expect(screen.queryByRole('button', { name: locale.t('settings.models.searchServices.addVendor', { vendor: locale.t('settings.models.searchServices.vendorName.exa-mcp') }) })).toBeNull();
+ await userEvent.click(screen.getByRole('button', { name: locale.t('settings.models.searchServices.viewOrder') }));
+ expect(onViewOrder).toHaveBeenCalledOnce();
});
it('saves the built-in keyless Exa row switch without opening credential actions', async () => {
@@ -141,13 +156,61 @@ describe('search service activation and mixed order', () => {
});
it('opens the built-in keyless detail without key or removal actions', () => {
- detail(keylessExaSource(KEYLESS_ACTIVE_SEARCH.executor_candidates[0], KEYLESS_ACTIVE_SEARCH.service_vendors?.[0]), KEYLESS_ACTIVE_SEARCH);
+ const candidate = KEYLESS_ACTIVE_SEARCH.executor_candidates.find((row) => row.source_id === 'src_exakeyless');
+ const vendor = KEYLESS_ACTIVE_SEARCH.service_vendors?.find((row) => row.id === 'exa-mcp');
+ detail(keylessExaSource(candidate, vendor), KEYLESS_ACTIVE_SEARCH);
expect(screen.getByText('mcp.exa.ai')).toBeTruthy();
expect(screen.getByText('Free')).toBeTruthy();
expect(screen.queryByRole('button', { name: 'Replace key' })).toBeNull();
expect(screen.queryByRole('button', { name: 'Remove' })).toBeNull();
});
+ it('renders known zero keyless usage as free, not a paid zero', async () => {
+ const candidate = KEYLESS_ACTIVE_SEARCH.executor_candidates.find((row) => row.source_id === 'src_exakeyless');
+ const vendor = KEYLESS_ACTIVE_SEARCH.service_vendors?.find((row) => row.id === 'exa-mcp');
+ detail(keylessExaSource(candidate, vendor), KEYLESS_ACTIVE_SEARCH);
+ const line = await screen.findByText('This month');
+ expect(line.closest('p')?.textContent).toContain('Free');
+ expect(line.closest('p')?.textContent).not.toContain('$0');
+ });
+
+ it.each([
+ { name: 'known zero after actual requests', usd: 0, lower: false, partial: false, free: true },
+ { name: 'paid total', usd: 0.01, lower: false, partial: false, free: false },
+ { name: 'unknown price', usd: undefined, lower: false, partial: false, free: false },
+ { name: 'zero lower bound', usd: 0, lower: true, partial: false, free: false },
+ { name: 'partial history', usd: 0, lower: false, partial: true, free: false },
+ ])('keeps keyless monthly cost truthful: $name', async ({ usd, lower, partial, free }) => {
+ const candidate = KEYLESS_ACTIVE_SEARCH.executor_candidates.find((row) => row.source_id === 'src_exakeyless');
+ const vendor = KEYLESS_ACTIVE_SEARCH.service_vendors?.find((row) => row.id === 'exa-mcp');
+ const report: UsageReport = {
+ ...MONTH_REPORT,
+ buckets: MONTH_REPORT.buckets.map((bucket) => ({
+ ...bucket, history_complete: !partial,
+ rows: [{ kind: 'service', source_id: 'src_exakeyless', service_id: 'exa/mcp', requests: 3,
+ billable_requests: 0, uncertain_requests: 0, reported_requests: 0,
+ ...(usd === undefined ? {} : { api_cost_usd: usd }), api_cost_lower_bound: lower }],
+ })),
+ };
+ detail(keylessExaSource(candidate, vendor), KEYLESS_ACTIVE_SEARCH, true, report);
+ const line = (await screen.findByText('This month')).closest('p')?.textContent;
+ expect(line?.includes('Free')).toBe(free);
+ expect(line).toContain('3');
+ if (free) expect(line).not.toMatch(/\$0|included/i);
+ });
+
+ it('shows keyless cooldown and retries through the built-in route without credential wording', async () => {
+ const candidate = KEYLESS_ACTIVE_SEARCH.executor_candidates.find((row) => row.source_id === 'src_exakeyless')!;
+ const tool = { ...KEYLESS_ACTIVE_SEARCH, executor_candidates: KEYLESS_ACTIVE_SEARCH.executor_candidates.map((row) => row.source_id === candidate.source_id ? { ...row, cooldown_until: '2026-12-01T10:00:00Z' } : row) };
+ const view = tab(tool);
+ const row = document.querySelector('[data-executor="src_exakeyless"]') as HTMLElement;
+ expect(row.textContent).toContain('Rate-limited · retry later');
+ expect(row.textContent).toMatch(/Paused until 12-01/);
+ expect(row.textContent).toContain('5 results · IP rate-limited');
+ expect(row.textContent).not.toMatch(/invalid key|replacement key|API key/i);
+ await userEvent.click(within(row).getByRole('button', { name: 'Retry now' }));
+ expect(view.onRetryService).toHaveBeenCalledWith('src_exakeyless');
+ });
it('keeps keyboard focus on a usable arrow when the last movable row is followed by disabled Sources', async () => {
const view = tab();
await userEvent.click(screen.getByRole('button', { name: 'Move Exa down' }));
diff --git a/ui/src/components/settings/models/SettingsModelsPage.tsx b/ui/src/components/settings/models/SettingsModelsPage.tsx
index 0a1c2ed28..7fea4aebd 100644
--- a/ui/src/components/settings/models/SettingsModelsPage.tsx
+++ b/ui/src/components/settings/models/SettingsModelsPage.tsx
@@ -1788,7 +1788,7 @@ export const SettingsModelsPage: React.FC = () => {
: <section className="grid min-h-0 flex-1 place-items-center px-5 py-12 text-center text-[12px] text-muted">{t('settings.models.sourceDetail.gone')}</section>}
</DialogContent>
</Dialog>
- {searchServiceOpen && searchServicesActive(searchTool) && searchTool && <AddSearchServiceDialog tool={searchTool} pending={hostedTools.pending.has('web_search')} sourceReads={sourceCollectionReads} onClose={() => setSearchServiceOpen(false)} onAdded={(created) => void sourceAdded(created)} onOpenSource={(sourceId) => {
+ {searchServiceOpen && searchServicesActive(searchTool) && searchTool && <AddSearchServiceDialog tool={searchTool} pending={hostedTools.pending.has('web_search')} sourceReads={sourceCollectionReads} onClose={() => setSearchServiceOpen(false)} onAdded={(created) => void sourceAdded(created)} onViewOrder={() => { setSearchServiceOpen(false); setTab('tools'); }} onOpenSource={(sourceId) => {
setSearchServiceOpen(false);
selectSource({ sourceId, returnFocus: () => apiKeyTriggerRef.current, serviceView: true });
}} />}
diff --git a/ui/src/components/settings/models/SourceDetailPanel.tsx b/ui/src/components/settings/models/SourceDetailPanel.tsx
index 6212a78c5..0ed906472 100644
--- a/ui/src/components/settings/models/SourceDetailPanel.tsx
+++ b/ui/src/components/settings/models/SourceDetailPanel.tsx
@@ -828,14 +828,14 @@ export const SourceDetailPanel: React.FC<{
<header className="flex shrink-0 items-center gap-3 border-b border-border px-5 py-4">
<SearchVendorGlyph vendor={source.vendor} />
<div className="flex min-w-0 flex-col gap-1">
- <h2 ref={headingRef} tabIndex={-1} className="text-lg font-bold text-foreground">{source.display_name}</h2>
+ <h2 ref={headingRef} tabIndex={-1} className="text-lg font-bold text-foreground">{keylessExa ? t('settings.models.searchServices.vendorName.exa-mcp') : source.display_name}</h2>
<p className="model-hub-tool-note">{t(source.protocol === 'search' ? 'settings.models.searchServices.noModels' : 'settings.models.searchServices.modelsAndSearch')}</p>
{keylessExa && <p className="model-hub-tool-note">{t('settings.models.searchServices.keylessEndpoint')}</p>}
</div>
</header>
<div className="min-h-0 flex-1 overflow-y-auto">
{capabilityFailure}
- {state.key && wasBlocked(source.state) && <div className="model-hub-status-gold m-5 flex flex-col gap-2 rounded-lg border p-3" role="status">
+ {!keylessExa && state.key && wasBlocked(source.state) && <div className="model-hub-status-gold m-5 flex flex-col gap-2 rounded-lg border p-3" role="status">
<p className="font-semibold">{t(state.key, state.values)}</p>
<p className="model-hub-tool-note">{t(source.state.detail_key ?? 'models.source.error.unclassified')}</p>
{source.vendor === 'tavily' && source.state.detail_key === 'models.source.needs_action.spend_limit_reached' && <p className="model-hub-tool-note">{t('settings.models.searchServices.tavilyLimit')}</p>}
@@ -846,7 +846,7 @@ export const SourceDetailPanel: React.FC<{
<section className="flex flex-col gap-3 border-b border-border px-5 py-4">
<h3 className="font-semibold text-foreground">{keylessExa ? t('settings.models.searchServices.noSetup') : t('settings.models.sourceDetail.metadata.apiKey')}</h3>
{source.protocol === 'search' ? <div className="flex flex-wrap items-center gap-3">
- {credentialValue && <SourcePrivateValue value={credentialValue} className="font-mono" />}
+ {!keylessExa && credentialValue && <SourcePrivateValue value={credentialValue} className="font-mono" />}
{!keylessExa && <Button variant="outline" size="sm" disabled={busy} onClick={() => setReplacingKey(true)}>{t('settings.models.searchServices.replaceKey')}</Button>}
</div> : <>
<p className="model-hub-tool-note">{t('settings.models.searchServices.sharedKey', { source: source.display_name })}</p>
diff --git a/ui/src/components/settings/models/ToolsTab.test.tsx b/ui/src/components/settings/models/ToolsTab.test.tsx
index 8dc8ffe42..d1b395293 100644
--- a/ui/src/components/settings/models/ToolsTab.test.tsx
+++ b/ui/src/components/settings/models/ToolsTab.test.tsx
@@ -13,6 +13,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
import en from '../../../i18n/en.json';
import zh from '../../../i18n/zh.json';
import { readyRegion } from './regionRead';
+import { KEYLESS_ACTIVE_SEARCH } from './searchServices.fixtures';
import { ToolsTab } from './ToolsTab';
import type {
HostedExecutorCandidate,
@@ -185,6 +186,38 @@ describe('ToolsTab status lines', () => {
expect(within(card('X 搜索')).getByText('最近一次由 Grok 执行 · 正常 · 10-15')).toBeTruthy();
});
+ // Built-ins have catalog membership but no persisted Source. Existing status
+ // tests only name persisted Sources, so they miss raw ids in latest/fallback copy.
+ const builtinLabels = [
+ { vendorId: 'exa-mcp', sourceId: 'src_exakeyless', catalogName: 'Exa (free)', en: 'Exa (free)', zh: 'Exa(免费)' },
+ { vendorId: 'local-search', sourceId: 'src_local_search', catalogName: 'Local search', en: 'Local search', zh: 'Local search' },
+ { vendorId: 'jina', sourceId: 'src_jina_builtin', catalogName: 'Jina', en: 'Jina', zh: 'Jina' },
+ // A persisted user name still wins over catalog membership.
+ { vendorId: 'local-search', sourceId: RELAY.id, catalogName: 'Local search', en: 'relay-gpt', zh: 'relay-gpt' },
+ ];
+ it.each(builtinLabels.flatMap((builtin) => (['en', 'zh'] as const).flatMap((lng) =>
+ [false, true].map((switched) => ({ ...builtin, lng, switched })),
+ )))('MH-HOSTED-UI-002: resolves $vendorId ($sourceId), $lng, fallback=$switched through the shared catalog lookup', ({ vendorId, sourceId, catalogName, lng, switched, ...labels }) => {
+ const builtin = KEYLESS_ACTIVE_SEARCH.service_vendors!.find((vendor) => vendor.id === 'exa-mcp')!;
+ renderTab({ tools: [{
+ ...KEYLESS_ACTIVE_SEARCH,
+ // No executor row is needed to name historical evidence; catalog membership
+ // is authoritative even when the built-in is not a current candidate.
+ executor_candidates: [], effective_order: [],
+ service_vendors: [{ ...builtin, id: vendorId, name: catalogName, source_ids: [sourceId] }],
+ status: run({
+ latest_ok: { source_id: sourceId, model_id: 'builtin/search', mode: 'service', at: '2026-10-25T06:00:00Z' },
+ refused: switched ? [refusal(CLAUDE.id, 'claude-haiku-5-5', '2026-10-24T06:00:00Z')] : [],
+ }),
+ }] }, { lng });
+
+ const name = labels[lng];
+ const expected = switched
+ ? lng === 'zh' ? `relay-claude 不支持 · claude-haiku-5-5,已改用 ${name}` : `Not supported on relay-claude · claude-haiku-5-5; now using ${name}`
+ : lng === 'zh' ? `最近一次由 ${name} 执行 · 正常 · 10-25` : `Last run by ${name} · OK · 10-25`;
+ expect(within(card(lng === 'zh' ? '网页搜索' : 'Web search')).getByText(expected)).toBeTruthy();
+ });
+
it('MH-HOSTED-UI-020: one refusing Source: its line names the models and where the tool runs now, and clears that Source', async () => {
const user = userEvent.setup();
const { onClear } = renderTab({
diff --git a/ui/src/components/settings/models/ToolsTab.tsx b/ui/src/components/settings/models/ToolsTab.tsx
index 5f6360ae5..bf3f6b098 100644
--- a/ui/src/components/settings/models/ToolsTab.tsx
+++ b/ui/src/components/settings/models/ToolsTab.tsx
@@ -13,10 +13,10 @@ import { Button } from '@/components/ui/button';
import { Select } from '@/components/ui/select';
import { cn } from '@/lib/utils';
import { ToggleSwitch } from '../SettingsPrimitives';
-import { formatMonthDay, formatNameList, formatSmallUsd } from './format';
+import { cooldownTime, formatMonthDay, formatNameList, formatSmallUsd } from './format';
import { executorOrderAfterMove, imageModelCopyKey, pairEvidence, refusalSummary, type PairEvidence, type RefusalSummary } from './hostedTools';
import { foldRegionRead, regionFailed, type RegionRead } from './regionRead';
-import { searchServicesActive, webSearchTool } from './searchServices';
+import { KEYLESS_EXA_SOURCE_ID, searchServicesActive, serviceVendorForSource, webSearchTool } from './searchServices';
import { SearchCandidateStatus, SearchServicePrice, SearchVendorGlyph } from './SearchServiceParts';
import { ACCENT_ICON, ACCENT_PILL, ACCENT_TILE, sourceVisual } from './vendorMeta';
import type {
@@ -167,7 +167,7 @@ const ExecutorPrice: React.FC<{ candidate: HostedExecutorCandidate }> = ({ candi
* `null`, which is automatic. The order shown is always the server's.
*/
const ExecutorOrder: React.FC<{ tool: HostedSearchToolStatus; lookup: SourceLookup; pending: boolean; onSave: Save; onOpenService?: (sourceId: string, opener: HTMLButtonElement) => void; onRetryService?: (sourceId: string) => void }> = ({ tool, lookup, pending, onSave, onOpenService, onRetryService }) => {
- const { t } = useTranslation();
+ const { t, i18n } = useTranslation();
const toolInline = t(`settings.models.tools.tool.${tool.name}.inline`) as string;
const activeWeb = tool.name === 'web_search' && searchServicesActive(tool) ? tool : null;
const candidates = tool.executor_candidates;
@@ -225,7 +225,7 @@ const ExecutorOrder: React.FC<{ tool: HostedSearchToolStatus; lookup: SourceLook
<div className="flex min-w-0 flex-col gap-0.5">
<h4 className="font-semibold text-foreground">{t(activeWeb ? 'settings.models.searchServices.order' : 'settings.models.tools.order.title')}</h4>
<p className="model-hub-tool-note">{activeWeb
- ? <>{t(activeWeb.prefer_native ? 'settings.models.searchServices.orderNative' : 'settings.models.searchServices.orderAll')} {t(custom ? 'settings.models.searchServices.orderCustom' : 'settings.models.searchServices.orderAuto')}</>
+ ? <>{t(activeWeb.prefer_native ? 'settings.models.searchServices.orderNative' : 'settings.models.searchServices.orderAll')} {t(custom ? 'settings.models.searchServices.orderCustom' : activeWeb.service_vendors?.some((vendor) => vendor.id === 'exa-mcp') ? 'settings.models.searchServices.orderAutoKeyless' : 'settings.models.searchServices.orderAuto')}</>
: t(custom ? 'settings.models.tools.order.captionCustom' : 'settings.models.tools.order.caption')}</p>
</div>
{custom && (
@@ -243,8 +243,12 @@ const ExecutorOrder: React.FC<{ tool: HostedSearchToolStatus; lookup: SourceLook
const vendor = candidate.kind === 'service'
? activeWeb?.service_vendors?.find((item) => item.source_ids.includes(candidate.source_id))
: undefined;
- const name = source?.display_name
+ const keyless = candidate.kind === 'service' && candidate.source_id === KEYLESS_EXA_SOURCE_ID;
+ const name = keyless ? t('settings.models.searchServices.vendorName.exa-mcp') as string : source?.display_name
?? (vendor ? t(`settings.models.searchServices.vendorName.${vendor.id}`, { defaultValue: vendor.name }) as string : lookup.name(candidate.source_id));
+ const cooldown = candidate.kind === 'service' && candidate.cooldown_until !== null
+ ? cooldownTime(candidate.cooldown_until, i18n.language)
+ : null;
const disabledService = candidate.kind === 'service' && !candidate.settings.enabled;
const arrow = (direction: -1 | 1) => {
const blocked = disabledService || (direction === -1 ? index === 0 : index === movable.length - 1);
@@ -280,15 +284,18 @@ const ExecutorOrder: React.FC<{ tool: HostedSearchToolStatus; lookup: SourceLook
{candidate.kind === 'service' ? <button type="button" data-search-source={candidate.source_id} className="truncate text-left font-semibold text-foreground hover:underline" onClick={(event) => onOpenService?.(candidate.source_id, event.currentTarget)}>{name}</button> : <span className="truncate font-semibold text-foreground">{name}</span>}
<span className={cn('model-hub-pill border', candidate.kind === 'service' ? ACCENT_PILL.cyan : ACCENT_PILL.muted)}>{t(candidate.kind === 'service' ? 'settings.models.searchServices.kind' : 'settings.models.searchServices.modelKind')}</span>
<SearchCandidateStatus candidate={candidate} tool={activeWeb} source={source} />
- {candidate.kind === 'service' && <ToggleSwitch
- enabled={candidate.settings.enabled}
- disabled={pending}
- label={t('settings.models.searchServices.use') as string}
- onClick={() => onSave('web_search', { services: { [candidate.source_id]: { enabled: !candidate.settings.enabled } } })}
- />}
+ {candidate.kind === 'service' && <span className="inline-flex items-center gap-2">
+ <span className="model-hub-tool-note">{t('settings.models.searchServices.use')}</span>
+ <ToggleSwitch
+ enabled={candidate.settings.enabled}
+ disabled={pending}
+ label={t('settings.models.searchServices.use') as string}
+ onClick={() => onSave('web_search', { services: { [candidate.source_id]: { enabled: !candidate.settings.enabled } } })}
+ />
+ </span>}
</div>
<span className="model-hub-tool-note">{candidate.kind === 'service'
- ? <>{t(source?.protocol === 'search' ? 'settings.models.searchServices.resultCount' : 'settings.models.searchServices.sharedKeyResults', { count: candidate.settings.results, source: name })}{vendor?.id === 'exa-mcp' && vendor.free_tier ? ` · ${t('settings.models.searchServices.freeTier')}` : null}</>
+ ? <>{cooldown && keyless && <>{t('settings.models.searchServices.keylessCooldownUntil', { time: cooldown })} · </>}{t(keyless ? 'settings.models.searchServices.keylessResults' : source?.protocol === 'search' ? 'settings.models.searchServices.resultCount' : 'settings.models.searchServices.sharedKeyResults', { count: candidate.settings.results, source: name })}</>
: <span className="font-mono">{candidate.model_id}</span>}</span>
{candidate.kind === 'service' && candidate.cooldown_until !== null && <Button variant="outline" size="xs" className="self-start" disabled={pending} onClick={() => onRetryService?.(candidate.source_id)}>{t('settings.models.searchServices.retry')}</Button>}
</div>
@@ -544,7 +551,7 @@ type ServiceActions = {
const WebSearchServices: React.FC<{ tool: HostedWebSearchToolStatus; lookup: SourceLookup; pending: boolean; onSave: Save } & ServiceActions> = ({ tool, lookup, pending, onSave, onAddService, onOpenService, onRetryService }) => {
const { t, i18n } = useTranslation();
- const noServices = !tool.service_vendors?.some((vendor) => vendor.source_ids.length > 0);
+ const noServices = !tool.service_vendors?.some((vendor) => !vendor.facts.built_in && vendor.source_ids.length > 0);
const hasKeyless = tool.service_vendors?.some((vendor) => vendor.id === 'exa-mcp') === true;
return <div className="flex flex-col gap-4 border-t border-border p-4">
<div className="flex items-center justify-between gap-4 rounded-lg border border-border bg-background p-3">
@@ -552,7 +559,7 @@ const WebSearchServices: React.FC<{ tool: HostedWebSearchToolStatus; lookup: Sou
<ToggleSwitch enabled={tool.prefer_native} disabled={pending} label={t('settings.models.searchServices.preferNative')} onClick={() => onSave('web_search', { prefer_native: !tool.prefer_native })} />
</div>
<ExecutorOrder tool={tool} lookup={lookup} pending={pending} onSave={onSave} onOpenService={onOpenService} onRetryService={onRetryService} />
- {noServices && <p className="model-hub-tool-note">{t('settings.models.searchServices.empty', { prices: formatNameList((tool.service_vendors ?? []).map((vendor) => t('settings.models.searchServices.vendorPrice', { vendor: vendor.name, usd: formatSmallUsd(vendor.price.usd_per_1k) })), i18n.language) })}</p>}
+ {noServices && <p className="model-hub-tool-note">{t(hasKeyless ? 'settings.models.searchServices.keylessEmpty' : 'settings.models.searchServices.empty', { prices: formatNameList((tool.service_vendors ?? []).filter((vendor) => !vendor.facts.built_in).map((vendor) => t('settings.models.searchServices.vendorPrice', { vendor: vendor.name, usd: formatSmallUsd(vendor.price.usd_per_1k) })), i18n.language) })}</p>}
{hasKeyless && <p className="model-hub-tool-note">{t('settings.models.searchServices.keylessQueryDestination')}</p>}
<div className="flex flex-wrap items-center justify-between gap-3">
<Button variant={noServices ? 'default' : 'outline'} size="sm" disabled={pending} onClick={(event) => onAddService?.(event.currentTarget)}><Plus aria-hidden />{t('settings.models.searchServices.add')}</Button>
@@ -588,7 +595,7 @@ const ToolCard: React.FC<{ tool: HostedToolStatus; lookup: SourceLookup; pending
</span>
</header>
<StatusLines tool={tool} summary={summary} lookup={lookup} pending={pending} onClear={onClear} />
- {tool.name === 'web_search' && searchServicesActive(tool) && tool.enabled && <WebSearchServices tool={tool} lookup={lookup} pending={pending} onSave={onSave} {...serviceActions} />}
+ {tool.name === 'web_search' && searchServicesActive(tool) && <WebSearchServices tool={tool} lookup={lookup} pending={pending} onSave={onSave} {...serviceActions} />}
{tool.name === 'image_generate' && <ImageModels tool={tool} lookup={lookup} pending={pending} onSave={onSave} />}
<Advanced tool={tool} summary={summary} lookup={lookup} pending={pending} onSave={onSave} onClear={onClear} />
</section>
@@ -613,8 +620,20 @@ export const ToolsTab: React.FC<{
});
const lookup = React.useMemo<SourceLookup>(() => {
const byId = new Map(sources.map((source) => [source.id, source]));
- return { name: (id) => byId.get(id)?.display_name ?? id, source: (id) => byId.get(id) };
- }, [sources]);
+ return {
+ name: (id) => {
+ const source = byId.get(id);
+ if (source) return source.display_name;
+ // Built-ins have catalog membership, not a persisted Source. Resolve
+ // them here so status, fallback, evidence and action labels agree.
+ const vendor = serviceVendorForSource(webSearchTool(status), id);
+ return vendor?.facts.built_in
+ ? t(`settings.models.searchServices.vendorName.${vendor.id}`, { defaultValue: vendor.name }) as string
+ : id;
+ },
+ source: (id) => byId.get(id),
+ };
+ }, [sources, status, t]);
return (
<section className="model-hub-tools flex flex-col" aria-label={t('settings.models.tools.title') as string}>
<div className="flex min-w-0 flex-col gap-1">
diff --git a/ui/src/components/settings/models/format.ts b/ui/src/components/settings/models/format.ts
index 377746110..497b18fcb 100644
--- a/ui/src/components/settings/models/format.ts
+++ b/ui/src/components/settings/models/format.ts
@@ -131,6 +131,12 @@ export function formatSmallUsd(value: number): string {
* ("verified 10-13"). Both locales use the same numeric form, so the chip reads
* the same width in either. An unparseable stamp renders verbatim.
*/
+export const cooldownTime = (until: string, language: string): string => {
+ const date = new Date(until);
+ const clock = new Intl.DateTimeFormat(language, { hour: '2-digit', minute: '2-digit', hour12: false }).format(date);
+ return date.toDateString() === new Date().toDateString() ? clock : `${formatMonthDay(until)} ${clock}`;
+};
+
export function formatMonthDay(instant: string): string {
const ms = Date.parse(instant);
if (Number.isNaN(ms)) return instant;
diff --git a/ui/src/components/settings/models/useHostedTools.test.tsx b/ui/src/components/settings/models/useHostedTools.test.tsx
index b05594814..75cb5c1a6 100644
--- a/ui/src/components/settings/models/useHostedTools.test.tsx
+++ b/ui/src/components/settings/models/useHostedTools.test.tsx
@@ -269,7 +269,7 @@ describe('useHostedTools ordering', () => {
// Retry has no status payload: unlike PUT/clear it must keep the write queue
// held through its follow-up GET, or an older read could overwrite a later save.
- it('serializes a service retry and its authoritative read before subsequent settings writes', async () => {
+ it.each(['src_exa000001', 'src_exakeyless'])('serializes a service retry and its authoritative read before subsequent settings writes for %s', async (sourceId) => {
const refresh = deferred<HostedToolsStatus>();
vi.spyOn(document, 'cookie', 'get').mockReturnValue('vibe_csrf_token=fixture-token');
const get = vi.spyOn(modelsApi, 'getHostedTools').mockResolvedValueOnce(status(false)).mockReturnValueOnce(refresh.promise);
@@ -279,15 +279,15 @@ describe('useHostedTools ordering', () => {
const { result } = renderHook(() => useHostedTools(true), { wrapper });
await waitFor(() => expect(shown(result.current.read)).toBe(false));
let retrying!: Promise<void>;
- act(() => { retrying = result.current.retryService('src_exa000001'); });
+ act(() => { retrying = result.current.retryService(sourceId); });
await waitFor(() => expect(get).toHaveBeenCalledTimes(2));
- expect(fetch).toHaveBeenCalledWith('/api/models/hosted-tools/web_search/services/src_exa000001/retry', expect.objectContaining({ method: 'POST', body: '{}' }));
+ expect(fetch).toHaveBeenCalledWith(`/api/models/hosted-tools/web_search/services/${sourceId}/retry`, expect.objectContaining({ method: 'POST', body: '{}' }));
expect(result.current.pending.has('web_search')).toBe(true);
let saving!: Promise<void>;
- act(() => { saving = result.current.save('web_search', { services: { src_exa000001: { results: 10 } } }); });
+ act(() => { saving = result.current.save('web_search', { services: { [sourceId]: { results: 10 } } }); });
expect(put).not.toHaveBeenCalled();
await act(async () => { refresh.resolve(status(true)); await retrying; await saving; });
- expect(put).toHaveBeenCalledWith('web_search', { services: { src_exa000001: { results: 10 } } });
+ expect(put).toHaveBeenCalledWith('web_search', { services: { [sourceId]: { results: 10 } } });
expect(shown(result.current.read)).toBe(false);
expect(result.current.pending.has('web_search')).toBe(false);
});
diff --git a/ui/src/components/workbench/HostedToolRow.test.tsx b/ui/src/components/workbench/HostedToolRow.test.tsx
index 7dbf86412..b47c09ba3 100644
--- a/ui/src/components/workbench/HostedToolRow.test.tsx
+++ b/ui/src/components/workbench/HostedToolRow.test.tsx
@@ -216,8 +216,38 @@ describe('hosted tool cards', () => {
});
describe('search service cards', () => {
- // The cards `tests/test_hosted_activity.py` projects from a search chain and its Sources' current state, with the
- // words both surfaces show for them: the note here is the sentence the IM line carries.
+ it('MH-HOSTED-UI-008: renders keyless success, rate-limit fallback and final failure without credential wording', () => {
+ const success = {
+ version: 1, call_id: 'call_keyless_success', tool: 'web_search', mode: 'proxy', status: 'completed',
+ subject: 'DeepSeek search API pricing', provider: 'exa-mcp', source_id: 'src_exakeyless', source_name: 'Exa', executor_kind: 'service',
+ sources: [{ url: 'https://exa.example/result', title: 'Exa result' }], images: [],
+ attempts: [{ source_id: 'src_exakeyless', label: 'Exa', kind: 'service', outcome: 'completed', cost: { basis: 'list', usd: 0 } }],
+ cost: { basis: 'list', calls: 1, usd: 0 },
+ };
+ const fallback = {
+ ...success, call_id: 'call_keyless_fallback', source_id: 'src_deepseek1', source_name: 'DeepSeek', provider: 'deepseek', executor_kind: 'model', model: 'deepseek-chat',
+ attempts: [
+ { source_id: 'src_exakeyless', label: 'Exa', kind: 'service', outcome: 'failed', error_code: 'service_rate_limited', reason_key: 'reason.service_rate_limited', remedy_key: 'repair.retrySearch', cost: { basis: 'list', usd: 0 } },
+ { source_id: 'src_deepseek1', label: 'DeepSeek', kind: 'model', outcome: 'completed', cost: { basis: 'list', usd: 0.01 } },
+ ],
+ switch: { sources: ['Exa'], reason_key: 'reason.service_rate_limited', to: 'DeepSeek' },
+ cost: { basis: 'list', calls: 1, usd: 0.01 },
+ };
+ const failed = {
+ ...success, call_id: 'call_keyless_failed', status: 'failed', error: 'the search failed', error_code: 'service_rate_limited',
+ attempts: [{ source_id: 'src_exakeyless', label: 'Exa', kind: 'service', outcome: 'failed', error_code: 'service_rate_limited', reason_key: 'reason.service_rate_limited', remedy_key: 'repair.retrySearch', cost: { basis: 'list', usd: 0 } }],
+ cost: { basis: 'list', calls: 1, usd: 0 },
+ };
+ renderGroup([success, fallback, failed], 'zh');
+ within(row('call_keyless_success')).getByText('通过 Exa(免费)');
+ within(row('call_keyless_success')).getByText('免费');
+ within(row('call_keyless_success')).getByText('1 个来源');
+ within(row('call_keyless_fallback')).getByText('由 DeepSeek 代理 · deepseek-chat');
+ within(row('call_keyless_fallback')).getByText('Exa(免费)限流,已改用 DeepSeek。冷却结束后会自动重试,也可在 模型 › 工具 中立即重试。');
+ within(row('call_keyless_failed')).getByText(/Exa(免费)\s+暂时限流/);
+ expect(document.body.textContent).not.toMatch(/密钥|key/i);
+ });
+
it.each(['en', 'zh'] as const)('MH-HOSTED-UI-008 (%s): names the service that ran, what it found and cost, and why it moved past a Source', (lng) => {
const { service_completed: completed, service_switch: switched, service_estimate: estimated, service_blocked: blocked } = services;
renderGroup([completed.payload, switched.payload, estimated.payload, blocked.payload], lng);
diff --git a/ui/src/components/workbench/HostedToolRow.tsx b/ui/src/components/workbench/HostedToolRow.tsx
index 153c45961..c410c5cae 100644
--- a/ui/src/components/workbench/HostedToolRow.tsx
+++ b/ui/src/components/workbench/HostedToolRow.tsx
@@ -3,6 +3,7 @@
// executor, or directly on an image endpoint), what it cost when known, and the
// sources or image it produced. Every mode draws the same card from the same record.
import * as React from 'react';
+import type { TFunction } from 'i18next';
import { useTranslation } from 'react-i18next';
import { AtSign, Check, ChevronRight, CircleSlash, Download, FileImage, Globe, Image as ImageIcon, TriangleAlert, Type, Waypoints } from 'lucide-react';
import clsx from 'clsx';
@@ -10,6 +11,7 @@ import clsx from 'clsx';
import { ChatImage } from '../ui/chat-image';
import { useInstanceAuthorization } from '../../context/InstanceAuthorizationContext';
import { apiKeyVendorPreset } from '../settings/models/apiKeyVendors';
+import { KEYLESS_EXA_SOURCE_ID } from '../settings/models/searchServices';
import { serverText } from '../settings/models/serverCopy';
import { hostedCompleted, type HostedActivity, type HostedActivityImage, type HostedToolName } from '../../lib/hostedActivity';
@@ -33,7 +35,10 @@ const presetLabel = (provider: string | undefined): string | null =>
* vendor id is `custom`, which names no vendor, so its name is the only thing that says where the
* call ran. A search service is named by its Source first, as the user named it. A vendor id with
* neither stays as it is, as for a row stored without a Source. The IM line reads the same rule. */
-const runnerLabel = (card: HostedActivity): string | null => {
+const SERVICE_RATE_LIMITED_REASON = ['reason', 'service_rate_limited'].join('.');
+
+const runnerLabel = (card: HostedActivity, t: TFunction): string | null => {
+ if (card.executor_kind === 'service' && card.source_id === KEYLESS_EXA_SOURCE_ID) return t('chat.agentActivity.hosted.keylessExa');
const vendor = presetLabel(card.provider);
if (vendor && card.executor_kind !== 'service') return vendor;
return card.source_name ?? vendor ?? card.provider ?? null;
@@ -78,7 +83,9 @@ const useHostedCost = (card: HostedActivity): string | null => {
const { t } = useTranslation();
const cost = card.cost;
if (!cost) return null;
- const figure = cost.basis === 'included'
+ const figure = card.executor_kind === 'service' && card.source_id === KEYLESS_EXA_SOURCE_ID && cost.usd === 0 && !cost.at_least
+ ? t('chat.agentActivity.hosted.cost.free') as string
+ : cost.basis === 'included'
? t('chat.agentActivity.hosted.cost.included') as string
: cost.usd === undefined
? null
@@ -105,7 +112,7 @@ export const HostedModeChip: React.FC<{ card: HostedActivity }> = ({ card }) =>
</span>
);
}
- const vendor = runnerLabel(card);
+ const vendor = runnerLabel(card, t);
if (card.mode === 'direct') {
// An image call names the model it picked and where it ran, not a vendor: the model is the choice.
const where = card.source_name ?? vendor;
@@ -178,7 +185,7 @@ export const HostedImageFigure: React.FC<{ card: HostedActivity; image: HostedAc
<ImageIcon className="size-3" aria-hidden="true" />
{image.width && image.height ? `${card.model} · ${image.width}×${image.height}` : card.model}
</span>
- {(card.source_name ?? runnerLabel(card)) && <span>{card.source_name ?? runnerLabel(card)}</span>}
+ {(card.source_name ?? runnerLabel(card, t)) && <span>{card.source_name ?? runnerLabel(card, t)}</span>}
</>
)
: <HostedModeChip card={card} />}
@@ -219,17 +226,23 @@ const HostedAttemptNotes: React.FC<{ card: HostedActivity }> = ({ card }) => {
if (hostedCompleted(card)) {
const note = card.switch;
if (!note) return null;
- const failed = `${note.sources.join(t('chat.agentActivity.hosted.listSeparator'))} ${say(note.reason_key)}`;
+ const labels = new Set((card.attempts ?? []).filter((a) => a.source_id === KEYLESS_EXA_SOURCE_ID).map((a) => a.label));
+ (card.attempts ?? []).filter((a) => a.source_id !== KEYLESS_EXA_SOURCE_ID).forEach((a) => labels.delete(a.label));
+ const sources = note.sources.map((name) => labels.has(name) ? t('chat.agentActivity.hosted.keylessExa') : name).join(t('chat.agentActivity.hosted.listSeparator'));
+ const provider = card.source_id === KEYLESS_EXA_SOURCE_ID ? t('chat.agentActivity.hosted.keylessExa') : note.to;
+ const failed = `${sources} ${say(note.reason_key)}`;
return (
<p className="mx-1.5 mb-1 mt-0.5 flex items-center gap-1.5 rounded-md border border-gold/40 bg-gold/10 px-2.5 py-1.5 text-[11px] text-foreground" data-hosted-switch={card.call_id}>
<TriangleAlert className="size-3 shrink-0 text-gold-ink" aria-hidden="true" />
- {t('chat.agentActivity.hosted.switch', { failed, provider: note.to })}
+ {note.reason_key === SERVICE_RATE_LIMITED_REASON
+ ? t('chat.agentActivity.hosted.rateLimitSwitch', { sources, provider })
+ : t('chat.agentActivity.hosted.switch', { failed, provider })}
</p>
);
}
const items = (card.attempts ?? [])
.filter((attempt) => attempt.remedy_key || attempt.reason_key)
- .map((attempt) => `${attempt.label} ${say(attempt.remedy_key ?? attempt.reason_key)}`);
+ .map((attempt) => `${attempt.source_id === KEYLESS_EXA_SOURCE_ID ? t('chat.agentActivity.hosted.keylessExa') : attempt.label} ${say(attempt.remedy_key ?? attempt.reason_key)}`);
if (items.length === 0) return null;
return (
<p className="mx-1.5 mb-1 mt-0.5 rounded-md border border-destructive/30 bg-destructive/5 px-2.5 py-1.5 text-[11px] text-destructive-ink" data-hosted-attempts={card.call_id}>
@@ -242,7 +255,7 @@ const HostedDetail: React.FC<{ card: HostedActivity }> = ({ card }) => {
const { t } = useTranslation();
const cost = useHostedCost(card);
const completed = hostedCompleted(card);
- const where = completed ? [card.source_name ?? runnerLabel(card), card.model].filter(Boolean).join(' · ') : '';
+ const where = completed ? [card.source_id === KEYLESS_EXA_SOURCE_ID ? t('chat.agentActivity.hosted.keylessExa') : card.source_name ?? runnerLabel(card, t), card.model].filter(Boolean).join(' · ') : '';
const ran = card.executor_kind === 'service' ? 'ranService' : RAN_KEY[card.mode];
const facts = [
where && t(`chat.agentActivity.hosted.${ran}`, { where }),
@@ -312,7 +325,7 @@ const FallbackNote: React.FC<{ card: HostedActivity }> = ({ card }) => {
// Only an instance manager reaches Models › Tools; anyone else is told who can clear it.
const { capabilities } = useInstanceAuthorization();
const from = card.fallback_from;
- const vendor = runnerLabel(card);
+ const vendor = runnerLabel(card, t);
if (!from || !hostedCompleted(card) || !vendor) return null;
const refusedBy = from.source_name ?? from.source_id;
const toolInline = t(`settings.models.tools.tool.${card.tool}.inline`);
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 33522a0c0..b20dbe2a1 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -2528,6 +2528,7 @@
"orderNative": "Used when the model cannot search natively. A failure tries the next entry.",
"orderAll": "Used for every model. A failure tries the next entry.",
"orderAuto": "Automatic: search services first, then model executors.",
+ "orderAutoKeyless": "Automatic: your added search services → enabled official DeepSeek → Exa (free) → model executors; use the arrows to reorder.",
"orderCustom": "Customized order.",
"kind": "Search service",
"modelKind": "Model executor",
@@ -2542,13 +2543,19 @@
"price": "${{usd}} / 1k searches",
"free": "Free",
"freeTier": "Free; IP rate-limited",
+ "keylessReady": "Free · no API key",
+ "keylessResults_one": "{{count}} result · IP rate-limited",
+ "keylessResults_other": "{{count}} results · IP rate-limited",
+ "keylessCooldown": "Rate-limited · retry later",
+ "keylessCooldownUntil": "Paused until {{time}}",
+ "keylessEmpty": "Exa (free) is built in, needs no key, and searches before model executors. Added search services precede it. List prices: {{prices}}. Plans and actual bills may differ.",
"vendorPrice": "{{vendor}} ${{usd}} / 1k searches",
"priceDate": "API list price · {{date}}",
"priceNote": "Prices are the catalog's dated API list prices. Free allowances, plans and actual bills may differ.",
"custody": "Search service keys stay with the gateway, like other provider keys. They are never passed to the model or Agent.",
"keylessQueryDestination": "Queries go directly from this Avibe runtime to Exa (mcp.exa.ai); Exa can see the connection's IP.",
"keylessEndpoint": "mcp.exa.ai",
- "keylessCustody": "Exa (free) needs no key; no key is given to the model or Agent.",
+ "keylessCustody": "Added-service keys stay in the gateway; Exa (free) needs no key, and no key is given to the model or Agent.",
"queryDestination": "Queries are sent to the service that runs the search.",
"queryVendor": "Search queries are sent to {{vendor}}.",
"placement": "A new search service joins before the model executors, including in a saved order. Change the order in Tools → Web search.",
@@ -5089,6 +5096,8 @@
},
"agentActivity": {
"hosted": {
+ "keylessExa": "Exa (free)",
+ "rateLimitSwitch": "Rate-limited: {{sources}}; switched to {{provider}}. Retry after the cooldown, or use Retry now in Models › Tools.",
"errorCode": {
"provider_no_reason": "The provider gave no reason.",
"provider_no_image": "The provider returned no image.",
@@ -5132,6 +5141,7 @@
"proxyModel": "Via {{provider}} proxy · {{model}}"
},
"repair": {
+ "retrySearch": "was rate-limited; retry later or use Retry now in Models › Tools",
"disabled": "needs web search enabled in Models › Tools",
"key": "needs a replacement key",
"reauthorize": "needs a new sign-in",
@@ -5151,7 +5161,7 @@
"service_balance": "is out of balance",
"service_limit": "reached its usage limit",
"service_unavailable": "was unavailable",
- "service_rate_limited": "was rate-limited; the next source was tried",
+ "service_rate_limited": "was rate-limited",
"service_refused": "refused this query",
"service_unreadable": "returned an unreadable response"
},
@@ -5171,6 +5181,7 @@
"pending": "Cut off"
},
"cost": {
+ "free": "Free",
"included": "Included in subscription",
"list": "≈ ${{usd}}",
"reported": "${{usd}}",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index e94e5c43a..0fcabe5ab 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -2528,6 +2528,7 @@
"orderNative": "模型不能自带搜索时,按这个顺序执行;失败后自动换下一个。",
"orderAll": "所有模型都按这个顺序执行;失败后自动换下一个。",
"orderAuto": "自动:搜索服务在前,模型代搜在后。",
+ "orderAutoKeyless": "自动:已添加的搜索服务 → 已启用的官方 DeepSeek → Exa(免费) → 模型代搜;可上下调整。",
"orderCustom": "已手动调整顺序。",
"kind": "搜索服务",
"modelKind": "模型代搜",
@@ -2542,13 +2543,19 @@
"price": "${{usd}} / 千次",
"free": "免费",
"freeTier": "免费;按 IP 限流",
+ "keylessReady": "免费 · 无需密钥",
+ "keylessResults_one": "{{count}} 个结果 · 按 IP 限流",
+ "keylessResults_other": "{{count}} 个结果 · 按 IP 限流",
+ "keylessCooldown": "暂时限流 · 稍后重试",
+ "keylessCooldownUntil": "冷却至 {{time}}",
+ "keylessEmpty": "Exa(免费)已内置,无需密钥,在模型代搜之前搜索。添加的搜索服务会排在它前面。标价:{{prices}}。套餐和实际账单可能不同。",
"vendorPrice": "{{vendor}} ${{usd}} / 千次",
"priceDate": "API 标价 · {{date}}",
"priceNote": "价格为目录标注日期的 API 标价,免费额度、套餐与实际账单可能不同。",
"custody": "搜索服务的密钥和其他供应商一样由网关保管,不会交给模型或 Agent。",
- "keylessQueryDestination": "查询会从此 Avibe 运行时直接发送到 Exa(mcp.exa.ai);Exa 可以看到该连接的 IP。",
+ "keylessQueryDestination": "查询会从此 Avibe 运行时直接发送到 Exa(mcp.exa.ai);Exa 可看到该连接的 IP。",
"keylessEndpoint": "mcp.exa.ai",
- "keylessCustody": "Exa(免费)无需密钥,也不会把密钥交给模型或 Agent。",
+ "keylessCustody": "已添加服务的密钥由网关保管;Exa(免费)无需密钥,也不会把密钥交给模型或 Agent。",
"queryDestination": "搜索词会发送给执行搜索的服务。",
"queryVendor": "搜索词会发送给 {{vendor}}。",
"placement": "新增搜索服务会排在模型代搜之前,已保存的顺序也一样;可在 工具 › 网页搜索 中调整顺序。",
@@ -5089,6 +5096,8 @@
},
"agentActivity": {
"hosted": {
+ "keylessExa": "Exa(免费)",
+ "rateLimitSwitch": "{{sources}}限流,已改用 {{provider}}。冷却结束后会自动重试,也可在 模型 › 工具 中立即重试。",
"errorCode": {
"provider_no_reason": "供应商未说明原因。",
"provider_no_image": "供应商没有返回图片。",
@@ -5132,6 +5141,7 @@
"proxyModel": "由 {{provider}} 代理 · {{model}}"
},
"repair": {
+ "retrySearch": "暂时限流,可稍后重试或在 模型 › 工具 中立即重试",
"disabled": "需要在 模型 › 工具 中启用网页搜索",
"key": "需要更换密钥",
"reauthorize": "需要重新授权登录",
@@ -5151,7 +5161,7 @@
"service_balance": "余额不足",
"service_limit": "已达用量上限",
"service_unavailable": "暂时不可用",
- "service_rate_limited": "受到限流,已尝试下一个来源",
+ "service_rate_limited": "限流",
"service_refused": "拒绝了这次搜索",
"service_unreadable": "返回了无法读取的结果"
},
@@ -5171,6 +5181,7 @@
"pending": "已中断"
},
"cost": {
+ "free": "免费",
"included": "订阅内含",
"list": "≈ ${{usd}}",
"reported": "${{usd}}",
diff --git a/vibe/i18n/en.json b/vibe/i18n/en.json
index dd222f842..5eab71fc9 100644
--- a/vibe/i18n/en.json
+++ b/vibe/i18n/en.json
@@ -1836,6 +1836,8 @@
"mainSessionProtected": "The desktop mini's main session is managed by Avibe and cannot be archived or edited."
},
"hostedTools": {
+ "keylessExa": "Exa (free)",
+ "rateLimitSwitch": "Rate-limited: {sources}; switched to {provider}. Retry after the cooldown, or use Retry now in Models › Tools.",
"errorCode": {
"provider_no_reason": "the provider gave no reason",
"provider_no_image": "the provider returned no image",
@@ -1877,6 +1879,7 @@
},
"quoted": "“{subject}”",
"mode": {
+ "service": "via {provider}",
"native": "native ({provider})",
"proxy": "via {provider} proxy",
"proxyModel": "via {provider} proxy ({model})",
@@ -1892,6 +1895,7 @@
"images": "{count} images"
},
"cost": {
+ "free": "Free",
"included": "included in subscription",
"list": "≈ ${usd}",
"reported": "${usd}",
@@ -1899,6 +1903,7 @@
"atLeast": "at least {cost}"
},
"repair": {
+ "retrySearch": "was rate-limited; retry later or use Retry now in Models › Tools",
"disabled": "needs web search enabled in Models › Tools",
"key": "needs a replacement key",
"reauthorize": "needs a new sign-in",
@@ -1918,7 +1923,7 @@
"service_balance": "is out of balance",
"service_limit": "reached its usage limit",
"service_unavailable": "was unavailable",
- "service_rate_limited": "was rate-limited; the next source was tried",
+ "service_rate_limited": "was rate-limited",
"service_refused": "refused this query",
"service_unreadable": "returned an unreadable response"
},
diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.json
index 1149a7a71..1d13fb2a5 100644
--- a/vibe/i18n/zh.json
+++ b/vibe/i18n/zh.json
@@ -1836,6 +1836,8 @@
"mainSessionProtected": "桌宠主会话由 Avibe 管理,不能归档或编辑。"
},
"hostedTools": {
+ "keylessExa": "Exa(免费)",
+ "rateLimitSwitch": "{sources}限流,已改用 {provider}。冷却结束后会自动重试,也可在 模型 › 工具 中立即重试。",
"errorCode": {
"provider_no_reason": "供应商未说明原因",
"provider_no_image": "供应商没有返回图片",
@@ -1877,6 +1879,7 @@
},
"quoted": "“{subject}”",
"mode": {
+ "service": "通过 {provider}",
"native": "原生({provider})",
"proxy": "由 {provider} 代理",
"proxyModel": "由 {provider} 代理({model})",
@@ -1892,6 +1895,7 @@
"images": "{count} 张"
},
"cost": {
+ "free": "免费",
"included": "订阅内含",
"list": "≈ ${usd}",
"reported": "${usd}",
@@ -1899,6 +1903,7 @@
"atLeast": "至少 {cost}"
},
"repair": {
+ "retrySearch": "暂时限流,可稍后重试或在 模型 › 工具 中立即重试",
"disabled": "需要在 模型 › 工具 中启用网页搜索",
"key": "需要更换密钥",
"reauthorize": "需要重新授权登录",
@@ -1918,7 +1923,7 @@
"service_balance": "余额不足",
"service_limit": "已达用量上限",
"service_unavailable": "暂时不可用",
- "service_rate_limited": "受到限流,已尝试下一个来源",
+ "service_rate_limited": "限流",
"service_refused": "拒绝了这次搜索",
"service_unreadable": "返回了无法读取的结果"
},