chore: migrate DuckDuckGo tool to ddg-kit - #1572
Open
lennney wants to merge 1 commit into
Open
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Signed-off-by: lennney <lennney@example.com>
lennney
force-pushed
the
codex/migrate-ddg-kit
branch
from
July 29, 2026 05:20
c932f40 to
218dcbb
Compare
lennney
marked this pull request as ready for review
July 29, 2026 05:28
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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.
Why
BeeAI currently uses
duck-duck-scrape@^2.2.7directly fromDuckDuckGoSearchTool. This patch replaces it withddg-kit@^0.1.0whilepreserving the tool name, input schema, throttle, pagination, safe-search and
offset handling, AbortSignal propagation, and result mapping.
The main behavior gain is explicit provider failure handling.
ddg-kitexposesDdgErrorfor bot challenges, rate limits, HTTP failures, timeouts, and parserchanges, and its default client applies a bounded request deadline and
challenge cooldown. This tool already passes its caller AbortSignal and proxy
option; the migration keeps those paths intact.
I maintain
ddg-kitand disclose that relationship here. It is an unofficial,greenfield compatibility implementation, has no affiliation with DuckDuckGo,
and is not an official
duck-duck-scraperelease. This PR gives BeeAImaintainers room to review the dependency, the transport-option change, and the
maintenance model before deciding whether to adopt it.
Why use ddg-kit here
search,SearchOptions, andSafeSearchTypesurface;ddg-kitpreserves those exports and theSearchResultsfields consumed here.distinguishable from a valid empty result.
RequestOptionsprovides a small portable contract forproxy,signal,and
timeoutMs, matching the options this tool can safely preserve.Node 18/20/22 compatibility matrix.
Evidence:
ddg-kitrepositoryv0.1.0releaseDownstream adoption evidence:
commit is
c7a7af0.not broad production proof or a provider SLA.
Changes
duck-duck-scrapewithddg-kit@^0.1.0.httpClientOptionstype fromNeedleOptionstoddg-kit.RequestOptions.options, and output mapping.
uri_modifier, andrejectUnauthorized, plusthe now-unused
header-generatorand@types/needledependencies.The old
BEEAI_DDG_TOOL_PROXY_VERIFYsetting is no longer applicable becauseRequestOptionsdoes not expose a TLS-verification override. The PR does notsilently claim to preserve that setting.
Validation
The prepared downstream canary recorded:
In this follow-up sparse checkout, ESLint passed for both changed files. A full
TypeScript/Vitest run was not reproducible locally because the canary does not
contain the repository's complete workspace source and peer-provided
dependencies (
zod,vite, and related setup). BeeAI CI is therefore theauthoritative full validation. No live DuckDuckGo response is included.
Limits and rollback
DuckDuckGo does not publish a supported contract for these endpoints. The
migration does not provide a provider SLA, prove production stability, or
preserve Needle-specific headers and TLS options. The package's typed errors
make failures visible, but BeeAI still needs to decide how those failures
should be surfaced or retried at the tool/workflow layer.
The migration has no persistent data change. A rollback can restore
duck-duck-scrape, the Needle/HeaderGenerator imports and options, the removeddependencies, and the prior lockfile.
Additional downstream adoption evidence
intercept-mcpPR #6 has now merged the Web-search migration in merge commit700b10a.