feat(agent-core): slim WebSearch to query-only; fetch page content via FetchURL (#1260)

* feat(agent-core): slim WebSearch to query-only; fetch page content via FetchURL

The coding search backend no longer honors `limit`/`enable_page_crawling` and
always returns full page content, which was token-heavy and frequently
truncated. Realign the web tools around a search+fetch split:

- WebSearch request sends only `text_query`; the tool exposes only `query`.
- Search results drop inline page content and add the source site; full page
  content is now fetched on demand via FetchURL.
- Add a citation reminder to both WebSearch and FetchURL results (in the
  FetchURL front note so it survives body truncation).
- Update tool descriptions and reference docs accordingly.

* fix(agent-core): satisfy no-base-to-string lint and drop redundant | undefined

- Assert the exact serialized WebSearch request body instead of String()-coercing
  a BodyInit, fixing the type-aware no-base-to-string lint error.
- Drop redundant `| undefined` from WebSearchResult optional fields per AGENTS.md.
- Add changeset.

* chore(changeset): bump agent-core to minor for WebSearch input-contract change

Removing the `limit`/`include_content` tool inputs tightens a closed
(`additionalProperties: false`) schema, so previously-valid args are now
rejected — an incompatible change for a released package. Bump minor rather
than patch.
This commit is contained in:
Kai 2026-07-01 18:46:15 +08:00 committed by GitHub
parent 8cfb1657ad
commit e47ca10267
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 158 additions and 75 deletions

View file

@ -53,7 +53,7 @@ Foreground mode blocks the current turn until the command completes or times out
| `WebSearch` | Auto-allow | Web search |
| `FetchURL` | Auto-allow | Fetch the content of a specified URL |
**`WebSearch`** accepts `query` (search terms) and optional `limit` (number of results to return, 120; defaults to 5) and `include_content` (whether to return the page body; defaults to false). Requires the host to provide a search implementation; when not injected, the tool does not appear in the tool list.
**`WebSearch`** accepts `query` (search terms). Requires the host to provide a search implementation; when not injected, the tool does not appear in the tool list.
**`FetchURL`** accepts a single `url` parameter and returns the page content. For HTML pages, the host extracts the body text rather than returning the full HTML; plain text or Markdown pages are passed through directly. Also requires a host-provided implementation.

View file

@ -53,7 +53,7 @@
| `WebSearch` | 自动放行 | 网络搜索 |
| `FetchURL` | 自动放行 | 获取指定 URL 的内容 |
**`WebSearch`** 接受 `query`(搜索词)和可选的 `limit`返回结果数120默认 5`include_content`(是否返回网页正文,默认 false。需要宿主提供搜索实现,未注入时不会出现在工具列表中。
**`WebSearch`** 接受 `query`(搜索词)。需要宿主提供搜索实现,未注入时不会出现在工具列表中。
**`FetchURL`** 接受单个 `url` 参数,返回页面内容。对 HTML 页面,宿主会提取正文而非返回完整 HTML纯文本或 Markdown 页面直接透传。同样需要宿主注入实现。