RAG-1300: Add web_search binding kind support#13955
Merged
dario-piotrowicz merged 1 commit intoMay 28, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 6b9ed38 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
ffac1d2 to
344d2a1
Compare
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
d17a336 to
9c09fcf
Compare
9c09fcf to
4d668aa
Compare
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers |
Member
Author
|
/bonk |
bf2e71d to
de2c85e
Compare
Cloudflare Web Search is a new zero-config Workers binding. Declared
in wrangler.jsonc as a single object (there is exactly one shared web
corpus, so no namespace/instance/setting is required):
{ "web_search": { "binding": "WEBSEARCH" } }
At runtime the binding exposes a single `search()` method that returns
URLs and catalog metadata. The binding is always-remote -- Miniflare
proxies to the production Web Search service via the remote-bindings
transport.
A new top-level CLI command is also added:
wrangler websearch search "cloudflare workers" [--limit N] [--json]
which calls the public REST endpoint `POST /accounts/:id/websearch/search`
directly (no Worker required).
Changes in this PR:
@cloudflare/workers-utils
* environment.ts: `web_search` field (single-object shape)
* config.ts: default value
* validation.ts: `ConfigBindingFieldName` entry, friendly-name maps,
`notInheritable` registration using `validateNamedSimpleBinding`,
`safeBindings` entry
* worker.ts: `CfWebSearch` interface
* types.ts: `web_search` entries in `WorkerMetadataBinding` and
`Binding` discriminated unions
* map-worker-metadata-bindings.ts: `case "web_search":` arm
* config/binding-local-support.ts: register `web_search` as
`DO-NOT-USE-this-resource-will-never-have-a-local-simulator`
* tests: validation tests for the new field
wrangler
* deployment-bundle/create-worker-upload-form.ts: extract + serialise
into the upload metadata
* api/startDevWorker/utils.ts: config-to-bindings + metadata-to-bindings
switches
* deploy/config-diffs.ts: `reorderableBindings` and
`singleBindingFields` entries
* deploy/check-remote-secrets-override.ts: switch case
* dev/miniflare/index.ts: `WorkerOptionsBindings` pick, extract,
`warnOrError`, pass to miniflare options
* type-generation/index.ts: emit `WebSearch` runtime type in both
type-generation entry points
* user/user.ts: add `websearch.run` OAuth scope (dot, not colon -- matches
Bach source-of-truth)
* user/whoami.ts: handle dot-separated OAuth scopes in the expected-scope
diff (previous code split on ':' then re-joined with ':', producing
`websearch.run:undefined` which never matched the expected literal)
* utils/print-bindings.ts: extract + render in startup banner; always
remote (matches ai_search/ai_search_namespace pattern)
* websearch/{types,client,index,search}.ts: new `wrangler websearch search`
command, calling REST `/accounts/:id/websearch/search`. Field names mirror
the REST API (snake_case); the Worker binding stays camelCase per workerd
type defs.
* core/teams.d.ts: add "Product: Web Search" entry
* utils/add-created-resource-config.ts: exclude `web_search` from
`ValidKeys` (singleton binding)
miniflare
* plugins/web-search/index.ts: new always-remote proxy plugin
* plugins/index.ts: register the plugin in PLUGINS, intersect
WorkerOptions, re-export
Companion changes land in workerd (Web Search type definitions) and
edgeworker-config-service (binding kind + pipeline stage).
de2c85e to
6b9ed38
Compare
workers-devprod
approved these changes
May 28, 2026
workers-devprod
left a comment
Contributor
There was a problem hiding this comment.
Codeowners reviews satisfied
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds wrangler / miniflare / workers-utils support for the new
web_searchWorkers binding plus awrangler websearch searchcommand.includes:
Binding
Declared as a single object in
wrangler.jsonc(one shared corpus, no namespace/instance):{ "web_search": { "binding": "WEBSEARCH" } }At runtime the binding exposes a single
search()method returning{ items, metadata }. Always-remote in local dev: Miniflare proxies to the production service via the remote-bindings transport.CLI
--limitand--jsonare optional. Default output is a pretty table;--jsonprints the raw response.