Skip to content

feat(agent): add server entry, complete pipeline, and Brave client tests#20

Open
macan88 wants to merge 3 commits intolangoustine69:mainfrom
macan88:felix/fix-1
Open

feat(agent): add server entry, complete pipeline, and Brave client tests#20
macan88 wants to merge 3 commits intolangoustine69:mainfrom
macan88:felix/fix-1

Conversation

@macan88
Copy link

@macan88 macan88 commented Mar 1, 2026

Problem

The repository had no server entry point (src/index.ts), leaving the four required HTTP endpoints unimplemented and the Brave/rank/synth logic disconnected from any transport. Additionally, the existing logic files lacked test coverage, making correctness unverifiable.

Solution

Added src/index.ts which bootstraps a Hono server, wires the shared in-memory cache, and implements all four endpoints (GET /health, GET /v1/search, GET /v1/search/news, POST /v1/search/deep) by composing braveSearch → rank → synthesise in sequence. The deep-search endpoint fetches web and news results in parallel then merges before ranking, maximising source diversity. A .env.example documents all required environment variables. Focused unit tests for brave.ts cover the web-result normalisation contract, news-result normalisation, the 429 → BraveRateLimitError error path, and the fast-fail behaviour when BRAVE_API_KEY is absent — all using inline fetch mocks so no real network calls are made.

Testing

  • Added src/logic/brave.test.ts with 4 focused cases (web normalisation, news normalisation, rate-limit error, missing-key fast-fail)
  • Run with bun test src/logic/brave.test.ts
  • Manual smoke test: BRAVE_API_KEY=x OPENAI_API_KEY=y bun run src/index.ts then curl localhost:3000/health

Closes #1

@macan88
Copy link
Author

macan88 commented Mar 7, 2026

Hi 👋

Just checking in on this PR — the implementation is complete and the branch is clean/ready to merge. Happy to address any feedback if needed!

Thanks!

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.

[T1] Core Lucid Agent — x402 paid API with TDD

1 participant