Skip to content

feat(search): add Keenable as an optional keyed search provider - #28

Open
KGKallasmaa wants to merge 1 commit into
w01fb0ss:mainfrom
KGKallasmaa:feat/keenable-search-provider
Open

KGKallasmaa wants to merge 1 commit into
w01fb0ss:mainfrom
KGKallasmaa:feat/keenable-search-provider

Conversation

@KGKallasmaa

Copy link
Copy Markdown

Closes #13. Disclosure: I work with Keenable.

Following your points on #13, this adds Keenable as an optional provider next to Brave, Tavily and SearXNG. It is keyed only: there is no keyless Keenable path in this PR, so no permission for a distributed app to use the public endpoint is claimed or needed. Keyless can be a separate follow-up if you want it.

What changes

  1. Not the default. The keyless DuckDuckGo/Bing path stays the default. Choosing Keenable without a saved key still resolves to the keyless default (covered by a test).
  2. Same rules as the other providers. The key is stored through SecretStore like the Brave/Tavily keys and never logged or sent to the renderer. Choosing the card is the consent, as for the others. UI text is in packages/i18n in zh and en.
  3. Privacy text. docs/privacy (both languages) and the settings copy say Keenable logs search requests under its default data policy, and that adding a key does not turn logging off. Only an Enterprise zero-data-retention agreement differs (docs.keenable.ai/data-privacy).
  4. Errors. A 429, a 401/403, a 402 and other HTTP errors are mapped in search-run.ts to a message that says what to do (switch provider, or fix or replace the key), never an empty result. searchJson now throws a SearchStatusError that carries the status; other providers' messages are unchanged (tested). One note: search-circuit.ts only tracks the keyless DuckDuckGo route, so I put the mapping in the existing failure handling in search-run.ts rather than the circuit. Tell me if you'd rather it live elsewhere.
  5. Header. X-Keenable-Title: Pi Bot is sent only on Keenable requests, with no user or device information (tested, including that Tavily requests don't get it).
  6. Structure and tests. Follows packages/brain/src/integrations/search/; tests are offline (HTTP layer replaced) in search-service.keenable.test.ts. Every commit is signed off (git commit -s).

Keenable's search is POST https://api.keenable.ai/v1/search with X-API-Key; results use snippet for the page text (description is always empty).

If #12 lands first and touches the same provider enum, I'll merge main into this branch.

Checks run

  • vitest for the new test file: 9 tests pass.
  • pnpm lint: passes.
  • pnpm typecheck: the project build and semantics passes were all green, but the extra tsconfig.ui/dev projects were killed by memory pressure on my shared machine (SIGKILL, not a type error), so those did not finish. I did not run pnpm verify. CI is the authority.

Keenable joins Brave and Tavily as an optional provider in Settings > Web search.
The keyless DuckDuckGo/Bing path stays the default; nothing changes unless the user
picks Keenable and saves a key. Keyed only: there is no keyless Keenable path.

- Provider enum, config schema and key storage follow the Brave/Tavily shape: the key is
  stored through SecretStore and never logged or sent to the renderer.
- SearchService sends POST https://api.keenable.ai/v1/search with X-API-Key and
  X-Keenable-Title: Pi Bot, only on Keenable requests; the result text is read from
  snippet (description is always empty).
- search-run maps 429, 401/403, 402 and other HTTP errors to a message that says what to
  do (switch provider or fix the key) instead of an empty result. SearchStatusError
  carries the status from searchJson; other providers' messages are unchanged.
- UI text in packages/i18n (zh and en); the settings copy says Keenable logs requests
  under its default data policy and that a key does not turn logging off.
- docs/privacy and docs/guide updated in both languages.
- Offline tests cover the default staying keyless, the request shape, no header leakage to
  other providers, key removal and the error messages.

Signed-off-by: KGKallasmaa <29797627+KGKallasmaa@users.noreply.github.com>
@w01fb0ss

Copy link
Copy Markdown
Owner

Thanks — this matches every point from #13: keyed-only, keyless DuckDuckGo/Bing still the default, the key handled like Brave/Tavily, the logging wording in both languages, actionable 429/401/403/402 messages, and the header scoped to Keenable requests. Putting the status mapping in search-run.ts is the right call, since search-circuit.ts only tracks the keyless route.

We're in a release freeze for v0.0.4, so this will land right after that release, in v0.0.5. CI is approved to run now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optional Keenable web search provider (keyless DuckDuckGo/Bing stays default)

2 participants