opencode/packages/plugin/src/v2/promise/websearch.ts
Shoubhit Dash efb629a33a
feat(core): add pluggable web search (#35558)
Co-authored-by: Dax Raad <d@ironbay.co>
2026-07-26 03:55:05 +00:00

25 lines
737 B
TypeScript

import type { WebSearch } from "@opencode-ai/schema/websearch"
import type { WebSearchApi } from "@opencode-ai/client/promise/api"
import type { Transform } from "./registration.js"
export interface WebSearchDefinition {
readonly id: string
readonly name: string
readonly execute: (
input: WebSearch.ProviderInput,
context: { readonly signal: AbortSignal },
) => Promise<readonly WebSearch.Result[]>
}
export interface WebSearchDomain extends WebSearchApi {
readonly transform: Transform<WebSearchDraft>
readonly reload: () => Promise<void>
}
export interface WebSearchDraft {
add(definition: WebSearchDefinition): void
readonly default: {
get(): string | undefined
set(providerID: string): void
}
}