Agents: real ClawBrainHub integration (list + pull brains → trading cards)
CI / policy (push) Has been cancelled
CI / backend (push) Has been cancelled
CI / profile (push) Has been cancelled
CI / mobile (push) Has been cancelled

Backend:
- brainhub.rs: BrainHubClient trait + HttpBrainHubClient (public discovery API,
  optional Bearer token) + FakeBrainHubClient. Lists the user's brains
  (CLAWBRAINHUB_OWNER, default "omar") + redclawsystems reference brains, and
  pulls a .brain JSON, parsing identity/skills/tools into card fields
  (tagline, skills, tools, capabilities). 2 parser unit tests.
- Routes GET /v1/brainhub/brains + /v1/brainhub/pull (rate-limited); wired into
  AppState + main (HttpBrainHubClient) + test harness (FakeBrainHubClient).

Mobile:
- src/api/brainhub.ts (listBrains/pullBrain), draftStore.pendingAgentBrain.
- app/pick-brain.tsx: pick a brain → pull → hand to the agent-card editor.
- Agents "+ New agent" now opens the brain picker; demo.tsx adopts the pulled
  brain (name, tagline, skill bars, tools, capabilities) for the flip side.

Verified live against clawbrainhub.com (omar's brains + reference brains list;
general-assistant pull yields real skills). Token stays server-side/env only.
Gate: mobile 28, backend 123.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
Omar Sobh
2026-06-06 00:50:16 -05:00
co-authored by Claude Opus 4.8
parent d30deaf857
commit 9765a08a5a
13 changed files with 611 additions and 3 deletions
@@ -20,6 +20,7 @@ use tower::ServiceExt;
use cardclaws_api::ai::FakeAiClient;
use cardclaws_api::assets::InMemoryStore;
use cardclaws_api::brainhub::FakeBrainHubClient;
use cardclaws_api::cache::InMemoryCache;
use cardclaws_api::email::CapturingEmailSender;
use cardclaws_api::geo::{GeoLocation, GeoResolver};
@@ -86,6 +87,7 @@ pub async fn try_setup() -> Option<TestApp> {
assets: assets.clone(),
geo: Arc::new(FakeGeo),
ai: Arc::new(FakeAiClient),
brainhub: Arc::new(FakeBrainHubClient),
jwt: JwtKeys::new("test-jwt-secret"),
apple: Arc::new(NoopApple),
apple_audience: "com.cardclaws.test".into(),