From 34462b32216897d56a06d350b5533138b4ec4639 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 19 Jan 2026 13:03:03 -0500 Subject: [PATCH 1/2] Config: allow Perplexity web_search provider --- CHANGELOG.md | 4 +++ src/config/config.web-search-provider.test.ts | 25 +++++++++++++++++++ src/config/schema.ts | 10 ++++++-- src/config/zod-schema.agent-runtime.ts | 10 +++++++- 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 src/config/config.web-search-provider.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index afe6d23f5..f82e21959 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Docs: https://docs.clawd.bot - Android: remove legacy bridge transport code now that nodes use the gateway protocol. - Android: send structured payloads in node events/invokes and include user-agent metadata in gateway connects. +### Fixes +- Gateway: restart heartbeat runner on agents.list hot reloads so per-agent heartbeat changes apply without a full restart. (#1221) +- Config: allow Perplexity as a web_search provider in config validation. (#1230) + ## 2026.1.19-2 ### Changes diff --git a/src/config/config.web-search-provider.test.ts b/src/config/config.web-search-provider.test.ts new file mode 100644 index 000000000..a91c0f438 --- /dev/null +++ b/src/config/config.web-search-provider.test.ts @@ -0,0 +1,25 @@ +import { describe, expect, it } from "vitest"; + +import { validateConfigObject } from "./config.js"; + +describe("web search provider config", () => { + it("accepts perplexity provider and config", () => { + const res = validateConfigObject({ + tools: { + web: { + search: { + enabled: true, + provider: "perplexity", + perplexity: { + apiKey: "test-key", + baseUrl: "https://api.perplexity.ai", + model: "perplexity/sonar-pro", + }, + }, + }, + }, + }); + + expect(res.ok).toBe(true); + }); +}); diff --git a/src/config/schema.ts b/src/config/schema.ts index 855d93be1..46b6fe77b 100644 --- a/src/config/schema.ts +++ b/src/config/schema.ts @@ -338,12 +338,18 @@ const FIELD_HELP: Record = { "tools.message.crossContext.marker.suffix": 'Text suffix for cross-context markers (supports "{channel}").', "tools.message.broadcast.enabled": "Enable broadcast action (default: true).", - "tools.web.search.enabled": "Enable the web_search tool (requires Brave API key).", - "tools.web.search.provider": 'Search provider (only "brave" supported today).', + "tools.web.search.enabled": "Enable the web_search tool (requires a provider API key).", + "tools.web.search.provider": 'Search provider ("brave" or "perplexity").', "tools.web.search.apiKey": "Brave Search API key (fallback: BRAVE_API_KEY env var).", "tools.web.search.maxResults": "Default number of results to return (1-10).", "tools.web.search.timeoutSeconds": "Timeout in seconds for web_search requests.", "tools.web.search.cacheTtlMinutes": "Cache TTL in minutes for web_search results.", + "tools.web.search.perplexity.apiKey": + "Perplexity or OpenRouter API key (fallback: PERPLEXITY_API_KEY or OPENROUTER_API_KEY env var).", + "tools.web.search.perplexity.baseUrl": + "Perplexity base URL override (default: https://openrouter.ai/api/v1 or https://api.perplexity.ai).", + "tools.web.search.perplexity.model": + 'Perplexity model override (default: "perplexity/sonar-pro").', "tools.web.fetch.enabled": "Enable the web_fetch tool (lightweight HTTP fetch).", "tools.web.fetch.maxChars": "Max characters returned by web_fetch (truncated).", "tools.web.fetch.timeoutSeconds": "Timeout in seconds for web_fetch requests.", diff --git a/src/config/zod-schema.agent-runtime.ts b/src/config/zod-schema.agent-runtime.ts index 2c81510b8..537129acc 100644 --- a/src/config/zod-schema.agent-runtime.ts +++ b/src/config/zod-schema.agent-runtime.ts @@ -124,11 +124,19 @@ export const ToolPolicySchema = z export const ToolsWebSearchSchema = z .object({ enabled: z.boolean().optional(), - provider: z.union([z.literal("brave")]).optional(), + provider: z.union([z.literal("brave"), z.literal("perplexity")]).optional(), apiKey: z.string().optional(), maxResults: z.number().int().positive().optional(), timeoutSeconds: z.number().int().positive().optional(), cacheTtlMinutes: z.number().nonnegative().optional(), + perplexity: z + .object({ + apiKey: z.string().optional(), + baseUrl: z.string().optional(), + model: z.string().optional(), + }) + .strict() + .optional(), }) .strict() .optional(); From 154c49511c66c746f60bd4b82ed794ddc45d7142 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 19 Jan 2026 13:19:09 -0500 Subject: [PATCH 2/2] Changelog: drop unrelated gateway fix --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f82e21959..2ec85ca0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,6 @@ Docs: https://docs.clawd.bot - Android: send structured payloads in node events/invokes and include user-agent metadata in gateway connects. ### Fixes -- Gateway: restart heartbeat runner on agents.list hot reloads so per-agent heartbeat changes apply without a full restart. (#1221) - Config: allow Perplexity as a web_search provider in config validation. (#1230) ## 2026.1.19-2