mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-31 01:37:28 +08:00
c0ebf98778
Add a new Kilo-REST Exa transport alongside the existing MCP-Exa and MCP-Parallel transports. When the websearch tool picks the Exa provider and the user is signed into Kilo, requests go to https://app.kilo.ai/api/exa/search with the user's Kilo bearer. The cloud proxy injects its own Exa API key; the client sends the user's Kilo API key as a Bearer token. The MCP-BYOK path (EXA_API_KEY) and MCP-unauthed fallback are preserved unchanged. Changes: * New `packages/opencode/src/kilocode/tool/websearch-kilo-exa.ts` implements `callKiloExa` against the Exa REST API (`POST /search`) with `{ highlights: true }` contents and clamps numResults at 10 (Exa's first-10-results flat $0.007 tier). * `packages/opencode/src/tool/websearch.ts` adds a `"kilo-exa"` provider variant (selected only via `KILO_WEBSEARCH_PROVIDER` override), an Auth.Service yield to source the Kilo bearer, a transport-dispatch block that prefers Kilo-REST over MCP when auth is available and EXA_API_KEY is unset, and `transport` metadata on the tool part. MCP-Exa numResults is now clamped at 10 (default stays 8). * 13 unit tests in `packages/opencode/test/kilocode/tool/websearch-kilo-exa.test.ts` cover request shape, response formatting, error handling, and the costDollars ignore case. * Parameters snapshot updated for the new numResults description string. * Patch-level changeset added.