feat(aibroker): hero_aibroker admin in hero_components (typed OpenRPC clients) #17

Merged
nabil_salah merged 1 commit from development_aibroker_admin into development 2026-06-24 13:51:27 +00:00
Member

Adds the hero_aibroker service admin to the shared admin bundle, per the
web/hero_admin_ui.md skill ("service repos ship no admin code"). No changes
in the aibroker repo — only hero_components_app. Once merged, the aibroker
repo's hero_aibroker_app + hero_aibroker_admin crates can be deleted.

Approach

Built on generated typed OpenRPC clients (openrpc_client!), per the
dioxus_openrpc_client skill, instead of the repo's usual untyped call_at.
One single-spec Client per domain (the browser-safe pattern — multi-domain
bundles are native-only), generated from the broker's specs vendored under
src/aibroker/openrpc/.

Tabs (tabs_for("hero_aibroker"))

The spec-driven defaults (Playground / Docs / MCP / Agent / Diagnostics) come
free and are domain-scoped over all 10 domains. Added service-specific panes:

Tab Domain Calls
Models models list
Catalog models + admin catalog + models_catalog_refresh
Providers admin provider_list / priority_* / provider_*_key (masked keys + key_health)
API Keys admin api_key_list_full / create (key shown once) / set (enable·disable) / delete
Mothers admin mother_list_full / set / delete
MCP admin mcp_health / list_servers / list_tools / refresh / add/remove_server
Metrics admin metrics_detailed
Chat chat chat (operator smoke test)

Notes

  • Toolchain: rust-toolchain.toml (root + app) pins rustc 1.96
    required by herolib (the server via hero_lifecycle, the app via the
    generated clients).
  • Chat wire shape: the request is wrapped {request: ChatRequest} with
    content as the {text,parts} struct (verified against the live PR#166
    broker; the SDK's "flat" note is stale).
  • Log source: "aibroker" (prefix-matches aibroker.*; not the crate
    target hero_aibroker_server or the socket name hero_aibroker).
  • Vendored specs are a snapshot — re-copy from the broker when its API changes.
    The macro-generated *.client.generated.rs are gitignored.
  • Because Client::new is wasm-only, the app no longer host-cargo checks;
    verify with cargo check --target wasm32-unknown-unknown / dx build.

Verification

cargo check --target wasm32 (lib + bin) clean; no-raw-Bootstrap lint rules
pass. Built with make build and run against a live hero_router + PR#166
broker: discovery healthy, the SPA + wasm bundle serve through the router, and
every pane's read calls return the expected typed shapes (42 models, 6
providers with masked keys, etc.).

Adds the **hero_aibroker** service admin to the shared admin bundle, per the `web/hero_admin_ui.md` skill ("service repos ship no admin code"). No changes in the aibroker repo — only `hero_components_app`. Once merged, the aibroker repo's `hero_aibroker_app` + `hero_aibroker_admin` crates can be deleted. ## Approach Built on **generated typed OpenRPC clients** (`openrpc_client!`), per the `dioxus_openrpc_client` skill, instead of the repo's usual untyped `call_at`. One single-spec `Client` per domain (the browser-safe pattern — multi-domain bundles are native-only), generated from the broker's specs vendored under `src/aibroker/openrpc/`. ## Tabs (`tabs_for("hero_aibroker")`) The spec-driven defaults (Playground / Docs / MCP / Agent / Diagnostics) come free and are domain-scoped over all 10 domains. Added service-specific panes: | Tab | Domain | Calls | |---|---|---| | Models | models | `list` | | Catalog | models + admin | `catalog` + `models_catalog_refresh` | | Providers | admin | `provider_list` / `priority_*` / `provider_*_key` (masked keys + key_health) | | API Keys | admin | `api_key_list_full` / `create` (key shown once) / `set` (enable·disable) / `delete` | | Mothers | admin | `mother_list_full` / `set` / `delete` | | MCP | admin | `mcp_health` / `list_servers` / `list_tools` / `refresh` / `add`/`remove_server` | | Metrics | admin | `metrics_detailed` | | Chat | chat | `chat` (operator smoke test) | ## Notes - **Toolchain:** `rust-toolchain.toml` (root + app) pins **rustc 1.96** — required by herolib (the server via `hero_lifecycle`, the app via the generated clients). - **Chat wire shape:** the request is wrapped `{request: ChatRequest}` with `content` as the `{text,parts}` struct (verified against the live PR#166 broker; the SDK's "flat" note is stale). - **Log source:** `"aibroker"` (prefix-matches `aibroker.*`; not the crate target `hero_aibroker_server` or the socket name `hero_aibroker`). - Vendored specs are a snapshot — re-copy from the broker when its API changes. The macro-generated `*.client.generated.rs` are gitignored. - Because `Client::new` is wasm-only, the app no longer host-`cargo check`s; verify with `cargo check --target wasm32-unknown-unknown` / `dx build`. ## Verification `cargo check --target wasm32` (lib + bin) clean; no-raw-Bootstrap lint rules pass. Built with `make build` and run against a live `hero_router` + PR#166 broker: discovery healthy, the SPA + wasm bundle serve through the router, and every pane's read calls return the expected typed shapes (42 models, 6 providers with masked keys, etc.).
Adds the hero_aibroker service admin to the shared admin bundle (no code in
the aibroker repo), built on generated typed OpenRPC clients per the
dioxus_openrpc_client skill rather than the repo's untyped call_at.

- src/aibroker/client.rs: one openrpc_client! Client per domain
  (models/admin/chat), generated from vendored specs in src/aibroker/openrpc/.
- src/aibroker/mod.rs: 8 panes — Models, Catalog (models domain); Providers,
  API Keys, Mothers, MCP, Metrics (admin domain); Chat (chat domain). Wired in
  main.rs tabs_for("hero_aibroker"); the spec-driven default tabs stay free and
  domain-scoped.
- chat: request is wrapped {request: ChatRequest} with content as the
  {text,parts} struct (verified against the live PR#166 broker).
- log_source_for("hero_aibroker") -> "aibroker" (prefix-matches aibroker.*).
- rust-toolchain.toml (root + app): pin rustc 1.96 — required by herolib (the
  server via hero_lifecycle, the app via the generated clients).

Verified against a live router + broker: discovery healthy, every pane's read
calls return the expected typed shapes (42 models, 6 providers, ...), and the
SPA + wasm bundle serve through hero_router.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
nabil_salah merged commit 34aeb2d1e2 into development 2026-06-24 13:51:27 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_components!17
No description provided.