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.

refactor(model-hub): drop page content from web search services (#2889)

Call White396ee273ec82
diff --git a/config/v2_config.py b/config/v2_config.py
index 0d8e67e6d..3f46b6ee0 100644
--- a/config/v2_config.py
+++ b/config/v2_config.py
@@ -3146,22 +3146,20 @@ class ModelHubSearchServiceSettings:
"""Partial saved overrides, not resolved defaults (web-search-services.md §3.2)."""
results: Optional[int] = None
- content: Optional[bool] = None
enabled: Optional[bool] = None
@classmethod
def from_payload(cls, payload: object) -> "ModelHubSearchServiceSettings":
if not isinstance(payload, dict):
raise ValueError("Config 'model_hub.hosted_tools.web_search.services' entries must be objects")
- unknown = set(payload) - {"results", "content", "enabled"}
+ unknown = set(payload) - {"results", "enabled"}
if unknown:
logger.warning("Config 'model_hub.hosted_tools.web_search.services' ignores unknown fields %s", sorted(unknown))
if "results" in payload and (type(payload["results"]) is not int or payload["results"] < 1):
raise ValueError("Config search service results must be a positive integer")
- for key in ("content", "enabled"):
- if key in payload and not isinstance(payload[key], bool):
- raise ValueError(f"Config search service {key} must be a boolean")
- return cls(**{key: payload[key] for key in ("results", "content", "enabled") if key in payload})
+ if "enabled" in payload and not isinstance(payload["enabled"], bool):
+ raise ValueError("Config search service enabled must be a boolean")
+ return cls(**{key: payload[key] for key in ("results", "enabled") if key in payload})
def clamped(self, service: Mapping[str, Any]) -> "ModelHubSearchServiceSettings":
"""Read an obsolete override safely; disk is unchanged until an authorized write."""
@@ -3169,19 +3167,17 @@ class ModelHubSearchServiceSettings:
return replace(
self,
results=min(self.results, service["limits"]["results_max"]) if self.results is not None else None,
- content=False if self.content and not service["result"].get("content") else self.content,
)
def effective(self, service: Mapping[str, Any]) -> dict[str, Any]:
saved = self.clamped(service)
return {
"results": saved.results if saved.results is not None else min(5, service["limits"]["results_max"]),
- "content": saved.content if saved.content is not None else False,
"enabled": saved.enabled if saved.enabled is not None else bool(service["tool_only"] or service.get("auto_enroll")),
}
def to_payload(self) -> dict[str, Any]:
- return {key: value for key in ("results", "content", "enabled") if (value := getattr(self, key)) is not None}
+ return {key: value for key in ("results", "enabled") if (value := getattr(self, key)) is not None}
def _search_service_settings_from_payload(
diff --git a/core/handlers/model_hub/hosted_tools.py b/core/handlers/model_hub/hosted_tools.py
index 57c09e8d6..86f76359e 100644
--- a/core/handlers/model_hub/hosted_tools.py
+++ b/core/handlers/model_hub/hosted_tools.py
@@ -542,8 +542,6 @@ def _service_vendors(config: ModelHubConfig) -> list[dict[str, Any]]:
"free_check": service["free_check"] is not None,
},
"results_max": service["limits"]["results_max"],
- "content_supported": bool(service["result"].get("content")),
- "content_changes_price": any(part.get("when") == "content" for part in service["price"]["extra"]),
"source_ids": [
source.id for source in config.sources
if source.vendor == vendor.id and model_hub_search_service(source) is not None
@@ -776,7 +774,7 @@ def _patch_search_services(config: ModelHubConfig, payload: object) -> dict[str,
continue
source = live.get(source_id)
service = model_hub_search_service(source) if source is not None else None
- if service is None or not isinstance(patch, dict) or set(patch) - {"results", "content", "enabled"}:
+ if service is None or not isinstance(patch, dict) or set(patch) - {"results", "enabled"}:
raise ValueError("services must name a search-capable Source and known fields")
merged = saved.get(source_id, ModelHubSearchServiceSettings()).clamped(service).to_payload()
for key, value in patch.items():
@@ -787,8 +785,6 @@ def _patch_search_services(config: ModelHubConfig, payload: object) -> dict[str,
parsed = ModelHubSearchServiceSettings.from_payload(merged)
if parsed.results is not None and parsed.results > service["limits"]["results_max"]:
raise ValueError("results exceeds the catalog maximum")
- if parsed.content and not service["result"].get("content"):
- raise ValueError("the service does not return page text")
if parsed.to_payload():
saved[source_id] = parsed
else:
diff --git a/docs/plans/model-hub-contracts/README.md b/docs/plans/model-hub-contracts/README.md
index 1d2fb4178..a14e8a1cd 100644
--- a/docs/plans/model-hub-contracts/README.md
+++ b/docs/plans/model-hub-contracts/README.md
@@ -3,15 +3,23 @@
Status: **contract_version 18**, 2026-10-20: web-search settings and dormant Tools
read (S1b, `../web-search-services.md` §3.2/§3.5). The RC tag `gh-v3.2.2rc12`
contains S1a and v17, so these additions open a new event rather than changing v17.
-- V2 adds `prefer_native`, partial Source-keyed `services` overrides with catalog
- clamping, and server-owned `executor_order_kinds` saved with each web-search order.
+- V2 adds `prefer_native`, partial Source-keyed `services` overrides (`results` and
+ `enabled`) with catalog result-count clamping, and server-owned `executor_order_kinds`
+ saved with each web-search order.
- The PUT merges Source/field patches and supports null override resets.
- The Tools read adds `prefer_native`, saved `services`, read-only `service_order`,
model/service candidate discriminants, service settings/health/trial/cooldown
- fields, service vendor facts, and page-text list-price extras.
+ fields, and service vendor facts.
- Service candidates and `service_vendors` remain absent behind the single internal
activation gate until S2. There is no new UI, service execution, placement rule,
turn freeze or native-preference routing change in S1b.
+- The 2026-10-20 owner decision makes phase-1 web search snippet-only. This event
+ withdraws v17's bundled page-content request/result mappings, `content_max_chars`
+ and per-page price extras; Exa's included `contents.highlights`, reported-cost
+ mapping and estimate flag remain. Page reading belongs to phase-2 `web_fetch`.
+ S1b's unshipped `content` setting and vendor content flags are removed from this
+ v18 event. A dev build's saved `services.<id>.content` is ignored with the normal
+ unknown-field warning, preserving the tool switch, search opt-outs and orders.
- The versioned mirrors advance together; persisted TurnProvenance retains v5–v17
and adds v18. The rc12 hosted-tools loader ignores new optional config fields
and retains the whole-tool switch and both orders, not per-Source service
@@ -21,22 +29,19 @@ contains S1a and v17, so these additions open a new event rather than changing v
It builds on v17 (2026-10-19): search-service foundations
(`../web-search-services.md`). Tool-only Sources use `protocol: search`; the catalog,
credential custody, free checks, re-enable response and service-order persistence
-ship before search execution. S1b, S2 and S3 extend this same version event only
-while it is unshipped; if an RC has carried v17, the next lane opens v18 instead.
-S2 activates the service reads and search chain.
+shipped before search execution in `gh-v3.2.2rc12`. Its page-content metadata is
+withdrawn by v18 as recorded above. Later lanes extend the current version event
+only while it is unshipped; an RC freezes its meaning. S2 activates the service
+reads and snippet-only search chain.
Catalog metadata verified on **2026-10-20**:
- `search.auto_enroll` is explicit for model vendors with search; only DeepSeek is
enabled automatically. S1b and S2 own the resulting settings defaults.
-- Exa's `search.result.reported_cost` names `costDollars.total` with `estimate: true`.
- Its `search.request.content_max_chars` names `contents.text.maxCharacters` with
- `value: 4000`, applied only when page content is requested. Both follow the
- [Exa Search reference](https://exa.ai/docs/reference/search).
-- The [DeepSeek Search reference](https://api-docs.deepseek.com/api/search) and
- [Tavily Search OpenAPI](https://docs.tavily.com/documentation/api-reference/openapi.json)
- publish no hard per-page text bound. They retain the content setting with no
- invented `content_results_max`. The adapter's hard 8 MiB response cap remains;
- an over-cap body is unreadable, not a guarantee that every legitimate page fits.
+- Exa's `search.result.reported_cost` names `costDollars.total` with `estimate: true`,
+ following the [Exa Search reference](https://exa.ai/docs/reference/search).
+ Its always-requested `contents.highlights` supplies snippets and is included in
+ the search price. The catalog has no page-content request or result mapping.
+- The adapter's hard 8 MiB response cap remains; an over-cap body is unreadable.
S2 applies the design's billing, cooldown and failover rules to that outcome.
- Tavily's usage response may omit account pairs. A valid key pair with headroom
(including `limit: null`) then passes the free credential check; it proves key
diff --git a/docs/plans/model-hub-contracts/api.md b/docs/plans/model-hub-contracts/api.md
index 39e76f169..44442b511 100644
--- a/docs/plans/model-hub-contracts/api.md
+++ b/docs/plans/model-hub-contracts/api.md
@@ -73,7 +73,7 @@ runtime open. Once models are configured it participates in the runtime Stop gua
| GET `/api/models/quota` | → `{quota: QuotaSummary}` | Rate-limit windows of every hub-held subscription Source, from the vendor's own usage report, plus each Source's API-price `value` (see Subscription quota). Served from the server cache; a Source older than five minutes is re-read before answering, bounded by a short deadline, and a Source still being read is listed in `pending`. Never starts the engine. |
| POST `/api/models/quota/refresh` | → `{quota: QuotaSummary}` | Forced re-read. Rate-limited per Source to one vendor call every 30 seconds and suppressed while a Source cools down after a vendor 429; a suppressed Source returns its cached snapshot. |
| GET `/api/models/hosted-tools` | → `{hosted_tools: HostedToolsStatus}` | Models → Tools (`hosted-tools-status.schema.json`): every catalog tool with its switch (absent setting = on), its passive status from real use (`latest_ok`, current `refused[]`, per-pair `verified[]`), for a search tool the saved and effective executor order with every eligible executor candidate and its unit rates, and for `image_generate` the saved and effective default and the available image models. Memory only; nothing is probed. |
-| PUT `/api/models/hosted-tools/<tool>` | `{enabled?: boolean, executor_order?: null \| [source_id], default_model?: null \| {source_id, model_id}, prefer_native?: boolean, services?: {source_id: null \| {results?: integer \| null, content?: boolean \| null, enabled?: boolean \| null}}}` → `{hosted_tools: HostedToolsStatus}` | Changes one tool's settings field by field: an absent field is unchanged, `null` resets `executor_order` to automatic or `default_model` to the default. `executor_order` is for search tools and `default_model` for `image_generate`; values are saved as given, never resolved. It applies from the next turn and interrupts nothing. An unknown tool returns `404 hosted_tool_not_found`; an empty or malformed body `400 invalid_parameter`, including a null `enabled`, an id that is not a Source id (`src_…`), or a model id with surrounding whitespace. |
+| PUT `/api/models/hosted-tools/<tool>` | `{enabled?: boolean, executor_order?: null \| [source_id], default_model?: null \| {source_id, model_id}, prefer_native?: boolean, services?: {source_id: null \| {results?: integer \| null, enabled?: boolean \| null}}}` → `{hosted_tools: HostedToolsStatus}` | Changes one tool's settings field by field: an absent field is unchanged, `null` resets `executor_order` to automatic or `default_model` to the default. `executor_order` is for search tools and `default_model` for `image_generate`; values are saved as given, never resolved. It applies from the next turn and interrupts nothing. An unknown tool returns `404 hosted_tool_not_found`; an empty or malformed body `400 invalid_parameter`, including a null `enabled`, an id that is not a Source id (`src_…`), or a model id with surrounding whitespace. |
| POST `/api/models/hosted-tools/<tool>/clear` | `{source_id?, model_id?}` → `{hosted_tools: HostedToolsStatus}` | Clears the tool's refusals (`call` and `replay`): on one Source and model, on one Source (every model), or with `{}` on every Source. `model_id` requires `source_id`; neither is nullable, so a malformed body is refused rather than widened into a broader clear. A Source or model with nothing to clear is a no-op that answers the read. The file is written first: a failed write returns `500 state_write_failed` and changes nothing. A cleared Source is assumed again from its next request. An unknown tool returns `404 hosted_tool_not_found`; any other body `400 invalid_parameter`. |
| POST `/api/models/sources/<source_id>/evidence/clear` | `{model_id, feature: {kind: "effort", name}}` → `{source: Source}` | Clears one effort refusal of a Source's model, so the next request at that effort may reach it. A missing record is a no-op. An unknown Source returns `404 source_not_found`; a hosted-tool feature or any other body `400 invalid_parameter` (hosted refusals clear through the Tools clear); a failed write `500 state_write_failed` with nothing changed. |
| POST `/api/models/oauth/start` | `{vendor, channel, client_nonce?}` → `{flow: OAuthFlow}` | Starts creation of a new subscription source. Before provider work, the optional exact `(client_nonce, vendor, channel)` tuple is atomically claimed; concurrent retries coalesce to its one pending start and terminal result. |
@@ -111,12 +111,12 @@ activation toggle exists.
The service variant is frozen for S4/S2 in `hosted-tools-status.schema.json`:
`model_id` is the catalog service id; `billing: "metered"`, `relay: false`, and
-`price` is the catalog list price, including optional `extra[].when: "content"`
-and unit `page`. `settings` holds effective `{results, content, enabled}`;
+`price` is the catalog list price per search, with no page-text surcharge.
+`settings` holds effective `{results, enabled}`;
`state` is the Source's health, `trial_pending` covers both armed and in-flight
one-shot trials, and `cooldown_until` is nullable (S2 owns service cooldowns).
`service_vendors` contains `{id, name, price, free_tier, facts, results_max,
-content_supported, content_changes_price, source_ids}`. Facts are the catalog's
+source_ids}`. Facts are the catalog's
`{tool_only, auto_enroll, free_check}` booleans. A free tier not verified in the
catalog reads as null, never a promise of zero cost. `source_ids` includes
opted-out search-capable Sources, but not relays or subscriptions.
@@ -125,17 +125,19 @@ 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
is untouched, a present object merges only its supplied fields, and a null
Source or null field removes its saved override. An empty patch is a no-op.
-Defaults are `results: min(5, vendor maximum)`, `content: false`, and `enabled:
-true`, except false for a model vendor without `auto_enroll`. Writes reject
-non-integer/out-of-range results and page text where the catalog does not offer
-it; unknown/non-search-capable Sources reject non-null patches. Null may clear
+Defaults are `results: min(5, vendor maximum)` and `enabled: true`, except false
+for a model vendor without `auto_enroll`. Writes reject non-integer/out-of-range
+results and unknown fields (including `content`); unknown/non-search-capable
+Sources reject non-null patches. Null may clear
a stale Source override. A rejected patch changes nothing. Concurrent edits to
different Sources or fields serialize against the current saved settings.
-Loading ignores removed Sources and clamps obsolete catalog bounds in memory
-without changing the file: results to the current maximum, content to false
-when page text is no longer offered. The next authorized config write persists
-normalization; absent overrides remain absent.
+Loading ignores removed Sources and clamps results to the current catalog maximum
+in memory without changing the file. Unknown service-entry fields, including a
+dev build's retired `content` override, are ignored with a warning without losing
+other saved settings. The next authorized config write persists normalization;
+absent overrides remain absent. Phase-1 search returns snippets only; page reading
+is deferred to the phase-2 `web_fetch` tool.
Every `web_search.executor_order` save also writes `executor_order_kinds` from
the resulting per-Source settings: each extant named Source's `service` or
diff --git a/docs/plans/model-hub-contracts/hosted-tools-status.schema.json b/docs/plans/model-hub-contracts/hosted-tools-status.schema.json
index 8e6aa27c4..9ef589313 100644
--- a/docs/plans/model-hub-contracts/hosted-tools-status.schema.json
+++ b/docs/plans/model-hub-contracts/hosted-tools-status.schema.json
@@ -89,9 +89,8 @@
"required": ["unit", "usd_per_1k"],
"additionalProperties": false,
"properties": {
- "unit": { "enum": ["call", "search", "post", "profile", "page"] },
- "usd_per_1k": { "type": "number", "minimum": 0 },
- "when": { "const": "content", "description": "Charged only when page text is requested; highlights are included in the search price." }
+ "unit": { "enum": ["call", "search", "post", "profile"] },
+ "usd_per_1k": { "type": "number", "minimum": 0 }
}
}
},
@@ -99,14 +98,6 @@
"url": { "type": "string", "pattern": "^https://" }
}
},
- "ModelListPrice": {
- "allOf": [
- { "$ref": "#/definitions/ListPrice" },
- { "properties": { "extra": { "items": { "properties": {
- "unit": { "enum": ["call", "search", "post", "profile"] }, "when": false
- } } } } }
- ]
- },
"ServiceListPrice": {
"allOf": [{ "$ref": "#/definitions/ListPrice" }, { "properties": { "unit": { "const": "search" } } }]
},
@@ -115,14 +106,13 @@
"additionalProperties": false,
"properties": {
"results": { "type": "integer", "minimum": 1, "maximum": 100 },
- "content": { "type": "boolean" },
"enabled": { "type": "boolean" }
}
},
"ServiceSettings": {
"allOf": [
{ "$ref": "#/definitions/SavedServiceSettings" },
- { "required": ["results", "content", "enabled"] }
+ { "required": ["results", "enabled"] }
]
},
"ModelExecutor": {
@@ -135,7 +125,7 @@
"model_id": { "type": "string", "minLength": 1 },
"billing": { "enum": ["monthly", "metered"] },
"relay": { "type": "boolean", "description": "A non-official endpoint is priced at its vendor's API price." },
- "price": { "oneOf": [{ "type": "null" }, { "$ref": "#/definitions/ModelListPrice" }] }
+ "price": { "oneOf": [{ "type": "null" }, { "$ref": "#/definitions/ListPrice" }] }
}
},
"ServiceExecutor": {
@@ -159,7 +149,7 @@
"ServiceVendor": {
"type": "object",
"additionalProperties": false,
- "required": ["id", "name", "price", "free_tier", "facts", "results_max", "content_supported", "content_changes_price", "source_ids"],
+ "required": ["id", "name", "price", "free_tier", "facts", "results_max", "source_ids"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"name": { "type": "string", "minLength": 1 },
@@ -176,8 +166,6 @@
}
},
"results_max": { "type": "integer", "minimum": 1, "maximum": 100 },
- "content_supported": { "type": "boolean" },
- "content_changes_price": { "type": "boolean" },
"source_ids": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/definitions/SourceId" }, "description": "All current search-capable Sources for this vendor, including opted-out Sources. Empty means not added." }
}
},
diff --git a/tests/fixtures/model_hub/development_search_content.json b/tests/fixtures/model_hub/development_search_content.json
new file mode 100644
index 000000000..e7d5d53d8
--- /dev/null
+++ b/tests/fixtures/model_hub/development_search_content.json
@@ -0,0 +1,10 @@
+{
+ "enabled": true,
+ "prefer_native": false,
+ "executor_order": ["src_tavily01"],
+ "executor_order_kinds": {"src_tavily01": "service"},
+ "service_order": ["src_tavily01", "src_exa00001"],
+ "services": {
+ "src_tavily01": {"results": 7, "content": true, "enabled": false}
+ }
+}
diff --git a/tests/test_model_hub_runtime.py b/tests/test_model_hub_runtime.py
index 7e3981a39..f62c3332e 100644
--- a/tests/test_model_hub_runtime.py
+++ b/tests/test_model_hub_runtime.py
@@ -2729,45 +2729,25 @@ def test_shipped_api_key_vendor_catalog_matches_its_schema() -> None:
Draft7Validator(schema).validate(catalog)
-def test_exa_catalog_bounds_content_and_marks_reported_cost_as_estimate() -> None:
- service = search_service("exa", "search")
- assert service["result"]["reported_cost"] == {
- "path": "costDollars.total", "estimate": True,
- }
- assert service["request"]["content_max_chars"] == {
- "path": "contents.text.maxCharacters", "value": 4000,
- }
-
-
[email protected](("mapping", "valid"), [
- ({"path": "contents.text.maxCharacters", "value": 4000}, True),
- ({"path": "contents.text.maxCharacters", "value": 1}, True),
- ("contents.text.maxCharacters", False),
- (None, False),
- ({}, False),
- ({"path": "contents.text.maxCharacters"}, False),
- ({"value": 4000}, False),
- ({"path": "", "value": 4000}, False),
- ({"path": 1, "value": 4000}, False),
- ({"path": "contents.text.maxCharacters", "value": True}, False),
- ({"path": "contents.text.maxCharacters", "value": "4000"}, False),
- ({"path": "contents.text.maxCharacters", "value": 0}, False),
- ({"path": "contents.text.maxCharacters", "value": -1}, False),
- ({"path": "contents.text.maxCharacters", "value": 1.5}, False),
- ({"path": "contents.text.maxCharacters", "value": 4001}, False),
- ({"path": "contents.text.maxCharacters", "value": 4000, "unknown": 1}, False),
[email protected]("vendor,protocol,snippet", [
+ ("deepseek", "openai_chat", "snippet"), ("tavily", "search", "content"), ("exa", "search", "highlights"),
])
-def test_search_content_limit_metadata_matches_schema_and_runtime(mapping, valid) -> None:
- catalog = json.loads(Path("vibe/data/api_key_vendors.json").read_text(encoding="utf-8"))
- row = next(row for row in catalog if row["id"] == "exa")
- row["search"]["request"]["content_max_chars"] = mapping
- schema = json.loads(Path("vibe/data/api_key_vendors.schema.json").read_text(encoding="utf-8"))
- assert Draft7Validator(schema).is_valid([row]) is valid
- if valid:
- assert _validate_search_catalog(row["search"], protocol="search")["request"]["content_max_chars"] == mapping
- else:
- with pytest.raises(ValueError, match="content maximum"):
- _validate_search_catalog(row["search"], protocol="search")
+def test_search_catalog_maps_only_snippets_without_page_text_or_surcharges(vendor, protocol, snippet) -> None:
+ """The bundled wire mapping is the owner of what S2 may request: no paid page text.
+
+ The old schema-validity test also accepted page-content declarations, so pin
+ the snippet-only shape while keeping Exa's included highlights and reported cost.
+ """
+ service = search_service(vendor, protocol)
+ assert set(service["request"]) == {"method", "query", "results"} | ({"highlights"} if vendor == "exa" else set())
+ assert set(service["result"]) == {"results", "url", "title", "snippet", "page_age"} | (
+ {"reported_cost"} if vendor == "exa" else set()
+ )
+ assert service["result"]["snippet"] == snippet
+ assert service["price"]["extra"] == []
+ if vendor == "exa":
+ assert service["request"]["highlights"] == "contents.highlights"
+ assert service["result"]["reported_cost"] == {"path": "costDollars.total", "estimate": True}
@pytest.mark.parametrize(("mapping", "valid"), [
diff --git a/tests/test_model_hub_search_settings.py b/tests/test_model_hub_search_settings.py
index 731a9904a..dd62296c0 100644
--- a/tests/test_model_hub_search_settings.py
+++ b/tests/test_model_hub_search_settings.py
@@ -82,10 +82,10 @@ def test_defaults_follow_catalog_without_freezing_overrides(monkeypatch):
assert setting.prefer_native is True
assert setting.services == {} and setting.executor_order_kinds is None
for source in config.sources[1:]:
- assert hosted_tools.search_service_settings(setting, source) == {"results": 5, "content": False, "enabled": True}
+ assert hosted_tools.search_service_settings(setting, source) == {"results": 5, "enabled": True}
_catalog_change(monkeypatch, "deepseek", auto_enroll=False, limits={"results_max": 3})
assert hosted_tools.search_service_settings(setting, config.sources[-1]) == {
- "results": 3, "content": False, "enabled": False,
+ "results": 3, "enabled": False,
}
assert setting.to_payload() == {"enabled": True}
# A subscription or relay cannot inherit an official API's search permission.
@@ -100,7 +100,7 @@ async def test_mixed_order_and_role_snapshot_survive_real_v2_restart(tmp_path):
order = [MODEL, TAVILY, GONE, DEEPSEEK, EXA]
await service.set_hosted_tool("web_search", {
"prefer_native": False, "executor_order": order,
- "services": {TAVILY: {"results": 7, "content": True}, DEEPSEEK: {"enabled": False}},
+ "services": {TAVILY: {"results": 7, "enabled": False}, DEEPSEEK: {"enabled": False}},
})
saved = json.loads(path.read_text())["model_hub"]["hosted_tools"]["web_search"]
assert saved["executor_order"] == order
@@ -167,20 +167,18 @@ def test_retargeted_source_keeps_its_opt_out_until_search_capability_returns(tmp
@pytest.mark.asyncio
async def test_catalog_downgrade_clamps_on_load_without_rewriting_until_next_save(tmp_path, monkeypatch):
- """A catalog maximum/content removal cannot disable the tool or silently edit disk on read."""
- service, path, _ = _disk_service(tmp_path, _config({"services": {TAVILY: {"results": 20, "content": True}}}))
+ """A catalog maximum reduction cannot disable the tool or silently edit disk on read."""
+ service, path, _ = _disk_service(tmp_path, _config({"services": {TAVILY: {"results": 20}}}))
original = path.read_bytes()
- result_mapping = dict(api_key_vendors.api_key_vendor_entry("tavily").search["result"])
- result_mapping.pop("content")
- _catalog_change(monkeypatch, "tavily", limits={"results_max": 2}, result=result_mapping)
+ _catalog_change(monkeypatch, "tavily", limits={"results_max": 2})
loaded = V2Config.load().model_hub.hosted_tools["web_search"]
assert loaded.enabled
- assert loaded.services[TAVILY].to_payload() == {"results": 2, "content": False}
- assert _web(service)["services"][TAVILY] == {"results": 2, "content": False}
+ assert loaded.services[TAVILY].to_payload() == {"results": 2}
+ assert _web(service)["services"][TAVILY] == {"results": 2}
assert path.read_bytes() == original
await service.set_hosted_tool("web_search", {"prefer_native": False})
written = json.loads(path.read_text())["model_hub"]["hosted_tools"]["web_search"]
- assert written["services"][TAVILY] == {"results": 2, "content": False}
+ assert written["services"][TAVILY] == {"results": 2}
assert V2ModelHubConfigStore().load().hosted_tools["web_search"].to_payload() == written
@@ -188,15 +186,15 @@ async def test_catalog_downgrade_clamps_on_load_without_rewriting_until_next_sav
async def test_put_merges_absent_sources_fields_and_null_resets(tmp_path):
"""MH-HOSTED-004: partial clients cannot echo defaults over other clients' saved choices."""
service, path, _ = _disk_service(tmp_path, _config({"services": {
- TAVILY: {"results": 8, "content": True, "enabled": False}, EXA: {"content": True},
+ TAVILY: {"results": 8, "enabled": False}, EXA: {"results": 10},
}}))
await service.set_hosted_tool("web_search", {"services": {TAVILY: {"results": 9}}})
assert _web(service)["services"] == {
- TAVILY: {"results": 9, "content": True, "enabled": False}, EXA: {"content": True},
+ TAVILY: {"results": 9, "enabled": False}, EXA: {"results": 10},
}
- await service.set_hosted_tool("web_search", {"services": {TAVILY: {"content": None}, EXA: None}})
- assert _web(service)["services"] == {TAVILY: {"results": 9, "enabled": False}}
- await service.set_hosted_tool("web_search", {"services": {TAVILY: {"results": None, "enabled": None}}})
+ await service.set_hosted_tool("web_search", {"services": {TAVILY: {"enabled": None}, EXA: None}})
+ assert _web(service)["services"] == {TAVILY: {"results": 9}}
+ await service.set_hosted_tool("web_search", {"services": {TAVILY: {"results": None}}})
assert _web(service)["services"] == {}
before = path.read_bytes()
await service.set_hosted_tool("web_search", {"services": {}})
@@ -210,7 +208,7 @@ async def test_concurrent_different_fields_and_sources_are_not_lost(tmp_path):
service, _, _ = _disk_service(tmp_path, _config())
async with service._mutation_lock:
writes = [asyncio.create_task(service.set_hosted_tool("web_search", patch)) for patch in (
- {"services": {TAVILY: {"results": 11}}}, {"services": {TAVILY: {"content": True}}},
+ {"services": {TAVILY: {"results": 11}}}, {"services": {TAVILY: {"enabled": False}}},
{"services": {EXA: {"enabled": False}}}, {"prefer_native": False},
)]
await asyncio.sleep(0)
@@ -218,7 +216,7 @@ async def test_concurrent_different_fields_and_sources_are_not_lost(tmp_path):
await asyncio.gather(*writes)
restarted = V2ModelHubConfigStore().load().hosted_tools["web_search"]
assert restarted.to_payload() == {"enabled": True, "prefer_native": False, "services": {
- TAVILY: {"results": 11, "content": True}, EXA: {"enabled": False},
+ TAVILY: {"results": 11, "enabled": False}, EXA: {"enabled": False},
}}
@@ -229,7 +227,10 @@ async def test_concurrent_different_fields_and_sources_are_not_lost(tmp_path):
("web_search", {"services": {TAVILY: {"results": 21}}}),
("web_search", {"services": {TAVILY: {"results": True}}}),
("web_search", {"services": {TAVILY: {"results": 0}}}),
- ("web_search", {"services": {TAVILY: {"content": 1}}}),
+ ("web_search", {"services": {TAVILY: {"enabled": 1}}}),
+ ("web_search", {"services": {TAVILY: {"content": True}}}),
+ ("web_search", {"services": {TAVILY: {"content": False}}}),
+ ("web_search", {"services": {TAVILY: {"content": None}}}),
("web_search", {"services": {TAVILY: {"unknown": True}}}),
("web_search", {"services": {GONE: {"results": 5}}}),
("web_search", {"services": {MODEL: {"enabled": True}}}),
@@ -245,18 +246,31 @@ async def test_invalid_patches_are_atomic(tmp_path, tool, patch):
assert path.read_bytes() == before
[email protected]("content", [True, False, None, "obsolete"])
@pytest.mark.asyncio
-async def test_content_write_requires_catalog_page_text(tmp_path, monkeypatch):
+async def test_development_content_override_is_ignored_without_losing_saved_choices(tmp_path, caplog, content):
+ """MH-HOSTED-002: pre-withdrawal dev settings must not break load or erase opt-outs.
+
+ Existing released-shape tests predate services.content. Read this fixture through V2,
+ not through the current writer, which must no longer be able to produce the field.
+ """
service, path, _ = _disk_service(tmp_path, _config())
- result = dict(api_key_vendors.api_key_vendor_entry("tavily").search["result"])
- result.pop("content")
- _catalog_change(monkeypatch, "tavily", result=result)
+ fixture = Path(__file__).parent / "fixtures/model_hub/development_search_content.json"
+ saved = json.loads(fixture.read_text(encoding="utf-8"))
+ saved["services"][TAVILY]["content"] = content
+ payload = json.loads(path.read_text())
+ payload["model_hub"]["hosted_tools"]["web_search"] = saved
+ path.write_text(json.dumps(payload), encoding="utf-8")
before = path.read_bytes()
- with pytest.raises(ModelHubError):
- await service.set_hosted_tool("web_search", {"services": {TAVILY: {"content": True}}})
+ expected = {**saved, "services": {TAVILY: {"results": 7, "enabled": False}}}
+ loaded = V2ModelHubConfigStore().load().hosted_tools["web_search"]
+ assert loaded.to_payload() == expected
+ assert _web(service)["services"] == expected["services"]
+ assert "content" in caplog.text and "ignores unknown fields" in caplog.text
assert path.read_bytes() == before
- await service.set_hosted_tool("web_search", {"services": {TAVILY: {"content": False}}})
- assert _web(service)["services"][TAVILY] == {"content": False}
+ await service.set_hosted_tool("x_search", {"enabled": False})
+ assert json.loads(path.read_text())["model_hub"]["hosted_tools"]["web_search"] == expected
+ assert V2ModelHubConfigStore().load().hosted_tools["web_search"].to_payload() == expected
def test_service_order_read_skips_removed_sources_without_rewriting_saved_order(tmp_path):
@@ -303,7 +317,7 @@ def test_removed_source_settings_are_ignored_before_validation():
@pytest.mark.parametrize("field,value", [("prefer_native", None), ("services", None),
- ("services", {TAVILY: {"content": None}})])
+ ("services", {TAVILY: {"enabled": None}})])
def test_damaged_optional_settings_disable_only_web_search(field, value):
config = _config({"executor_order": [TAVILY], field: value})
assert not config.hosted_tools["web_search"].enabled
@@ -356,9 +370,9 @@ async def test_dormant_read_and_future_service_variant_validate_without_paid_cal
exa = next(row for row in visible["executor_candidates"] if row["source_id"] == EXA)
assert exa == {
"kind": "service", "source_id": EXA, "model_id": "exa/search", "billing": "metered", "relay": False,
- "price": {"unit": "search", "usd_per_1k": 7, "extra": [{"unit": "page", "usd_per_1k": 1, "when": "content"}],
+ "price": {"unit": "search", "usd_per_1k": 7, "extra": [],
"as_of": "2026-10-19", "url": "https://exa.ai/blog/exa-3"},
- "settings": {"results": 5, "content": False, "enabled": True},
+ "settings": {"results": 5, "enabled": True},
"state": {"status": "needs_action", "retry_at": None, "detail_key": "models.source.needs_action.balance_exhausted"},
"trial_pending": True, "cooldown_until": None,
}
@@ -368,9 +382,16 @@ async def test_dormant_read_and_future_service_variant_validate_without_paid_cal
deepseek = next(vendor for vendor in visible["service_vendors"] if vendor["id"] == "deepseek")
assert deepseek["source_ids"] == [DEEPSEEK] and deepseek["facts"]["auto_enroll"] is True
assert deepseek["free_tier"] is None
- assert next(vendor for vendor in visible["service_vendors"] if vendor["id"] == "exa")["content_changes_price"]
+ for vendor in visible["service_vendors"]:
+ assert set(vendor) == {"id", "name", "price", "free_tier", "facts", "results_max", "source_ids"}
+ assert vendor["price"]["extra"] == []
validator = Draft7Validator({"$ref": CONTRACT + "#/definitions/ServiceExecutor"}, registry=_api_response_registry())
- for changed in ({"kind": "model"}, {"billing": "monthly"}, {"settings": {"results": 5}}, {"trial_pending": None}):
+ for changed in (
+ {"kind": "model"}, {"billing": "monthly"}, {"settings": {"results": 5}}, {"trial_pending": None},
+ {"settings": {"results": 5, "enabled": True, "content": False}},
+ {"price": {**exa["price"], "extra": [{"unit": "page", "usd_per_1k": 1}]}},
+ {"price": {**exa["price"], "extra": [{"unit": "search", "usd_per_1k": 1, "when": "content"}]}},
+ ):
with pytest.raises(ValidationError):
validator.validate({**exa, **changed})
@@ -389,7 +410,7 @@ def test_http_tools_put_and_read_preserve_patch_and_dormant_contract(tmp_path, m
origin = "http://127.0.0.1:15131"
response = client.put(
"/api/models/hosted-tools/web_search", base_url=origin, headers=csrf_headers(client, origin),
- json={"prefer_native": False, "services": {TAVILY: {"results": 7, "content": True}}},
+ json={"prefer_native": False, "services": {TAVILY: {"results": 7, "enabled": False}}},
)
assert response.status_code == 200
written = response.get_json()
@@ -398,7 +419,7 @@ def test_http_tools_put_and_read_preserve_patch_and_dormant_contract(tmp_path, m
Draft7Validator({"$ref": "model-hub/api-response.schema.json#/definitions/HostedToolsResponse"},
registry=_api_response_registry()).validate(written)
web = written["hosted_tools"]["tools"][0]
- assert web["prefer_native"] is False and web["services"] == {TAVILY: {"results": 7, "content": True}}
+ assert web["prefer_native"] is False and web["services"] == {TAVILY: {"results": 7, "enabled": False}}
assert "service_vendors" not in web and all(row["kind"] == "model" for row in web["executor_candidates"])
diff --git a/ui/src/components/settings/models/types.ts b/ui/src/components/settings/models/types.ts
index a78492eeb..a4797c591 100644
--- a/ui/src/components/settings/models/types.ts
+++ b/ui/src/components/settings/models/types.ts
@@ -1084,14 +1084,11 @@ export type HostedModelExecutorCandidate = {
price: HostedToolListPrice | null;
};
-/** Service prices extend model tool prices with page-text surcharges, without changing model-only renderers. */
-export type HostedServiceListPrice = Omit<HostedToolListPrice, 'unit' | 'extra'> & {
- unit: 'search';
- extra: { unit: HostedToolPriceUnit | 'page'; usd_per_1k: number; when?: 'content' }[];
-};
+/** A search service's catalog list price, in searches rather than model calls. */
+export type HostedServiceListPrice = HostedToolListPrice & { unit: 'search' };
/** Effective settings. Saved settings and PUT patches keep omitted fields absent instead. */
-export type HostedSearchServiceSettings = { results: number; content: boolean; enabled: boolean };
+export type HostedSearchServiceSettings = { results: number; enabled: boolean };
/** Defined now, but the server lists no service candidate until S2 activates the chain. */
export type HostedServiceExecutorCandidate = {
@@ -1117,8 +1114,6 @@ export type HostedSearchServiceVendor = {
free_tier: string | null;
facts: { tool_only: boolean; auto_enroll: boolean; free_check: boolean };
results_max: number;
- content_supported: boolean;
- content_changes_price: boolean;
/** Includes opted-out Sources, so a disabled DeepSeek still reads as already added. */
source_ids: string[];
};
diff --git a/vibe/data/api_key_vendors.json b/vibe/data/api_key_vendors.json
index b461df96d..defd00d35 100644
--- a/vibe/data/api_key_vendors.json
+++ b/vibe/data/api_key_vendors.json
@@ -37,15 +37,13 @@
"request": {
"method": "POST",
"query": "query",
- "results": "count",
- "content": "need_content"
+ "results": "count"
},
"result": {
"results": "results",
"url": "url",
"title": "title",
"snippet": "snippet",
- "content": "content",
"page_age": "date"
},
"limits": {
@@ -140,15 +138,13 @@
"request": {
"method": "POST",
"query": "query",
- "results": "max_results",
- "content": "include_raw_content"
+ "results": "max_results"
},
"result": {
"results": "results",
"url": "url",
"title": "title",
"snippet": "content",
- "content": "raw_content",
"page_age": "published_date"
},
"limits": {
@@ -194,8 +190,6 @@
"method": "POST",
"query": "query",
"results": "numResults",
- "content": "contents.text",
- "content_max_chars": {"path": "contents.text.maxCharacters", "value": 4000},
"highlights": "contents.highlights"
},
"result": {
@@ -203,7 +197,6 @@
"url": "url",
"title": "title",
"snippet": "highlights",
- "content": "text",
"page_age": "publishedDate",
"reported_cost": {"path": "costDollars.total", "estimate": true}
},
@@ -215,9 +208,7 @@
"price": {
"unit": "search",
"usd_per_1k": 7.0,
- "extra": [
- {"unit": "page", "usd_per_1k": 1.0, "when": "content"}
- ],
+ "extra": [],
"as_of": "2026-10-19",
"url": "https://exa.ai/blog/exa-3"
},
diff --git a/vibe/data/api_key_vendors.schema.json b/vibe/data/api_key_vendors.schema.json
index 9e609b462..1a71c2900 100644
--- a/vibe/data/api_key_vendors.schema.json
+++ b/vibe/data/api_key_vendors.schema.json
@@ -31,21 +31,7 @@
"service_id": {"type": "string", "minLength": 1},
"endpoint": {"type": "string", "format": "uri", "pattern": "^https://"},
"auth": {"enum": ["bearer", "x-api-key"]},
- "request": {
- "type": "object",
- "properties": {
- "content_max_chars": {
- "type": "object",
- "description": "Vendor text-length request parameter applied only when page content is requested; no larger than the per-source content bound.",
- "required": ["path", "value"],
- "additionalProperties": false,
- "properties": {
- "path": {"type": "string", "minLength": 1},
- "value": {"type": "integer", "minimum": 1, "maximum": 4000}
- }
- }
- }
- },
+ "request": {"type": "object"},
"result": {
"type": "object",
"properties": {
@@ -68,7 +54,7 @@
"type": "integer",
"minimum": 1,
"maximum": 100,
- "description": "Version-independent per-request results ceiling; usage page counts remain bounded across catalog versions."
+ "description": "Version-independent per-request results ceiling."
}
}
},
@@ -81,16 +67,8 @@
"usd_per_1k": {"type": "number", "minimum": 0},
"extra": {
"type": "array",
- "items": {
- "type": "object",
- "required": ["unit", "usd_per_1k"],
- "additionalProperties": false,
- "properties": {
- "unit": {"const": "page"},
- "usd_per_1k": {"type": "number", "minimum": 0},
- "when": {"const": "content"}
- }
- }
+ "maxItems": 0,
+ "description": "Search services have no additional charges beyond the search price. Exa highlights are included."
},
"as_of": {"type": "string", "format": "date"},
"url": {"type": "string", "format": "uri", "pattern": "^https://"}
diff --git a/vibe/model_hub_runtime/api_key_vendors.py b/vibe/model_hub_runtime/api_key_vendors.py
index 862a55adc..fbc425c1c 100644
--- a/vibe/model_hub_runtime/api_key_vendors.py
+++ b/vibe/model_hub_runtime/api_key_vendors.py
@@ -172,17 +172,6 @@ def _validate_search_catalog(item: object, *, protocol: str) -> dict[str, Any] |
raise ValueError("api-key vendor search catalog service id is invalid")
if item.get("auth") not in {"bearer", "x-api-key"} or not isinstance(item.get("request"), dict) or not isinstance(item.get("result"), dict) or not isinstance(item.get("limits"), dict):
raise ValueError("api-key vendor search catalog mapping is invalid")
- if "content_max_chars" in item["request"]:
- content_max_chars = item["request"]["content_max_chars"]
- if (
- not isinstance(content_max_chars, dict)
- or set(content_max_chars) != {"path", "value"}
- or not isinstance(content_max_chars.get("path"), str)
- or not content_max_chars["path"]
- or type(content_max_chars.get("value")) is not int
- or not 1 <= content_max_chars["value"] <= 4000
- ):
- raise ValueError("api-key vendor search catalog content maximum is invalid")
if "reported_cost" in item["result"]:
reported_cost = item["result"]["reported_cost"]
if (
@@ -194,7 +183,7 @@ def _validate_search_catalog(item: object, *, protocol: str) -> dict[str, Any] |
):
raise ValueError("api-key vendor search catalog reported cost is invalid")
results_max = item["limits"].get("results_max")
- # Usage page counters use this fixed ceiling even after a catalog update.
+ # Keep a fixed per-request results ceiling across catalog updates.
if isinstance(results_max, bool) or not isinstance(results_max, int) or not 1 <= results_max <= 100:
raise ValueError("api-key vendor search catalog results maximum is invalid")
price = item.get("price")
@@ -202,7 +191,7 @@ def _validate_search_catalog(item: object, *, protocol: str) -> dict[str, Any] |
raise ValueError("api-key vendor search catalog price is invalid")
if not isinstance(price.get("usd_per_1k"), (int, float)) or isinstance(price.get("usd_per_1k"), bool) or price["usd_per_1k"] < 0:
raise ValueError("api-key vendor search catalog price is invalid")
- if not isinstance(price.get("extra"), list) or not isinstance(price.get("as_of"), str) or not isinstance(price.get("url"), str):
+ if price.get("extra") != [] or not isinstance(price.get("as_of"), str) or not isinstance(price.get("url"), str):
raise ValueError("api-key vendor search catalog price is invalid")
if not isinstance(item.get("tool_only"), bool) or item["tool_only"] != (protocol == "search"):
raise ValueError("api-key vendor search catalog protocol is invalid")