fix(agent-core-v2): restore web search source site and citation reminders

- surface source site: add WebSearchResult.siteName, map site_name in the
  Moonshot provider, and render the Site: line in tool output
- restore the per-search inline citation reminder alongside the results
- align web-search.md with v1: source-site/result-summary guidance and the
  static citation reminder
This commit is contained in:
haozhe.yang 2026-07-08 18:52:08 +08:00
parent c6b6c30bd4
commit 3272e22eac
3 changed files with 13 additions and 1 deletions

View file

@ -89,6 +89,7 @@ export class MoonshotWebSearchProvider implements WebSearchProvider {
snippet: r.snippet ?? '',
};
if (typeof r.date === 'string' && r.date.length > 0) out.date = r.date;
if (typeof r.site_name === 'string' && r.site_name.length > 0) out.siteName = r.site_name;
if (typeof r.content === 'string' && r.content.length > 0) out.content = r.content;
return out;
});

View file

@ -1,3 +1,5 @@
Search the web for information. Use this when you need up-to-date information from the internet.
Each result includes its title, URL, snippet, and—when available—a publication date. When `include_content` is enabled, the full page content—when available—is appended after the snippet.
Each result includes its title, its URL, and a snippet, plus its source site and publication date when available. Results are short summaries, not full pages — when a result looks relevant, call the FetchURL tool on its URL to read the full page content. Fetch only the few URLs you actually need. Prefer specific queries, and refine the query if the results don't contain what you need.
When you rely on a result in your answer, cite its source URL so the user can verify it.

View file

@ -35,6 +35,7 @@ export interface WebSearchResult {
url: string;
snippet: string;
date?: string;
siteName?: string;
content?: string;
}
@ -126,12 +127,20 @@ export class WebSearchTool implements BuiltinTool<WebSearchInput> {
first = false;
builder.write(`Title: ${result.title}\n`);
if (result.siteName) builder.write(`Site: ${result.siteName}\n`);
if (result.date) builder.write(`Date: ${result.date}\n`);
builder.write(`URL: ${result.url}\n`);
builder.write(`Snippet: ${result.snippet}\n\n`);
if (result.content) builder.write(`${result.content}\n\n`);
}
// Keep the citation reminder next to the data (not just in the static tool
// description), so it is present on every search. Cite the page actually
// relied on — after a FetchURL follow-up, that is the fetched page.
builder.write(
'When you rely on a result in your answer, cite it inline as a markdown link, e.g. [title](url).',
);
return builder.ok();
} catch (error) {
// Propagate in-flight cancellation so the executor can classify it