Skip to content

feat!: codemode-websearch package, one websearch.query across twelve providers (SHFT-2967) - #102

Merged
Michaelliv merged 14 commits into
mainfrom
feat/SHFT-2967-websearch-package
Nov 22, 2026
Merged

Michaelliv merged 14 commits into
mainfrom
feat/SHFT-2967-websearch-package

Conversation

@Michaelliv

@Michaelliv Michaelliv commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

What

codemode-websearch, a package with one plugin and one action: websearch.query searches the web through whichever provider the connection has a key for, and answers results in one shape (SHFT-2967).

const { provider, results } = await websearch.query({ query: "duckdb 1.4 release notes" });
// results: [{ title, url, content, publishedDate?, author?, sourceType? }]

Twelve providers, ported from pi-websearch (the code Vex's web_search runs) with the same environment variables and preference order: Parallel, Brave, Exa, You.com, Tavily, Firecrawl, Jina, Linkup, Valyu, Perplexity, Serper, SerpAPI.

The input

Each input has one form. Nothing in it is a provider's own parameter name, and nothing names a provider: the connection chooses it.

Input Form
query Text of 1 to 400 characters
numResults A whole number from 1 to 20. The default is 10
country An ISO 3166-1 alpha-2 code, in either case
language An ISO 639-1 code, in either case
includeDomains, excludeDomains 1 to 20 hostnames; one list or the other
freshness day, week, month, or year
  • includeDomains, excludeDomains and freshness are filters: a provider applies them or the call is refused. Only Jina has none.
  • A search goes to the connection's provider, else to the first provider with a key that applies the search's filters. The result says which one answered.
  • country and language are preferences: sent where the provider takes the value, left out where it does not.
  • Each provider converts a value to what its API documents. DE reaches Parallel as de, Tavily as germany, Brave as DE. The lists each provider publishes are in src/codes.ts.

How

  • One connection holds a key per provider. One staticCredential has a part per provider, each optional and each placed only on that provider's target, so a search through one provider sends no other provider's key. No codemode change was needed.
  • A provider is data and two pure functions (params, results) in src/providers.ts. The plugin builds the credential target and sends the request, with no per-provider branches.
  • A host adds a provider with websearch([mine, ...PROVIDERS]).
  • A filter that leaves a provider's request unchanged is one it cannot apply, so support is never declared separately from the code that implements it.

Changed from pi-websearch

Read against each provider's current reference: Parallel /v1beta/search to /v1/search; Firecrawl v1 to v2, without a page scrape; You.com GET to POST; Valyu to api.valyu.ai; Perplexity from a Sonar chat answer to its Search API; Jina GET to POST; SerpAPI without num, which its reference no longer lists.

Breaking

  • The bundled parallel plugin is removed, with its icon and fixture. parallel.search is gone; websearch.query searches through Parallel. docs/migrating-from-runline.md has "Install web search".
  • Codemode and this package have to be released together, or there is no web search between the two.

Tests

53 tests with the providers' hosts stood in for: every provider's request and answer, key isolation, each filter and each code conversion per provider, refusals, a host that signs requests, a host-added provider, and the README's provider table derived from the provider list.

Not proven

  • No search has run with a working key. Each real endpoint was called with a made-up key and refused it (401, 403, or Brave's 422), which shows the address and the key's place; request bodies and answer shapes rest on the references.
  • Serper has no public reference; its request and answer are pi-websearch's. Jina's per-result fields are only partly documented.
  • site: filtering on Brave and Serper is the least certain mapping.
  • A provider request is not aborted when the run ends. It ends by itself within 60 seconds.

…for a key; tests for a signing host and the README table (SHFT-2967)
@Michaelliv
Michaelliv merged commit 88de089 into main Nov 22, 2026
1 check passed
@Michaelliv
Michaelliv deleted the feat/SHFT-2967-websearch-package branch November 22, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant