From b89efef749f87225d7c3914877dad64a585fa08f Mon Sep 17 00:00:00 2001 From: Jon Uleis Date: Sat, 24 Jan 2026 22:28:00 -0500 Subject: [PATCH] feat(web_search): add freshness parameter for Brave time filtering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds support for Brave Search API's freshness parameter to filter results by discovery time: - 'pd' - Past 24 hours - 'pw' - Past week - 'pm' - Past month - 'py' - Past year - 'YYYY-MM-DDtoYYYY-MM-DD' - Custom date range Useful for cron jobs and monitoring tasks that need recent results. Note: Perplexity provider ignores this parameter (Brave only). --- 🤖 AI-assisted: This PR was created with Claude (Opus). Lightly tested via build script. The change follows existing patterns for optional parameters (country, search_lang, ui_lang). --- src/agents/tools/web-search.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/agents/tools/web-search.ts b/src/agents/tools/web-search.ts index 50d3d19a1..9616e2842 100644 --- a/src/agents/tools/web-search.ts +++ b/src/agents/tools/web-search.ts @@ -252,7 +252,9 @@ function isValidIsoDate(value: string): boolean { const date = new Date(Date.UTC(year, month - 1, day)); return ( - date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day + date.getUTCFullYear() === year && + date.getUTCMonth() === month - 1 && + date.getUTCDate() === day ); }