refactor(tool-web): port web tools to the render-intent union

master's web_search/web_fetch tools were authored against the old
ToolCallPresentation bag; the render-intent union replaces it with a
card-tagged discriminated union. Both are simple generic cards, so they
declare card:'generic' explicitly.
This commit is contained in:
Tianyi Cui
2026-07-03 22:52:18 +08:00
parent 53ebf6fc54
commit 8ca82d03ab
3 changed files with 8 additions and 8 deletions

View File

@@ -7,7 +7,7 @@
import type { Context } from 'cordis'
import { defineTool } from '@deepseek-ai/dsh-tools'
import type { ToolCallPresentation } from '@deepseek-ai/dsh-tools'
import type { GenericCallView } from '@deepseek-ai/dsh-tools'
import type { ContentBlock } from '@deepseek-ai/dsh-llm'
import type { WebFetchBody, WebFetchResult } from '@deepseek-ai/dsh-web'
import { assertNever } from '@deepseek-ai/dsh-llm'
@@ -44,8 +44,8 @@ export function formatFetchOutput(result: WebFetchResult): string {
}
/** Pending-call presentation: a fetch card titled by the URL. */
export function presentFetchCall(args: { url: string; timeout_ms?: number }): ToolCallPresentation {
return { title: args.url, kind: 'fetch', rawInput: args.url }
export function presentFetchCall(args: { url: string; timeout_ms?: number }): GenericCallView {
return { card: 'generic', title: args.url, kind: 'fetch', rawInput: args.url }
}
/** Register the `web_fetch` tool and its system-prompt guidance. */

View File

@@ -7,7 +7,7 @@
import type { Context } from 'cordis'
import { defineTool } from '@deepseek-ai/dsh-tools'
import type { ToolCallPresentation } from '@deepseek-ai/dsh-tools'
import type { GenericCallView } from '@deepseek-ai/dsh-tools'
import type { ContentBlock } from '@deepseek-ai/dsh-llm'
import type { WebSearchResult } from '@deepseek-ai/dsh-web'
import type {} from '@deepseek-ai/dsh-system-prompt'
@@ -63,8 +63,8 @@ export function formatSearchOutput(result: WebSearchResult): string {
}
/** Pending-call presentation: a search card titled by the query. */
export function presentSearchCall(args: { query: string }): ToolCallPresentation {
return { title: args.query, kind: 'search', rawInput: args.query }
export function presentSearchCall(args: { query: string }): GenericCallView {
return { card: 'generic', title: args.query, kind: 'search', rawInput: args.query }
}
/** Register the `web_search` tool and its system-prompt guidance. */