Restructure to Hero Service 5-crate standard (issue #6) #9

Merged
timur merged 1 commit from development_standardize into development 2026-02-24 01:44:02 +00:00
Owner

Summary

Restructure hero_aibroker to follow the hero_service.md 5-crate standard (issue #6).

Crate Layout

Crate Type Binary Purpose
hero_aibroker lib Core library: providers, registry, services, middleware, auth, MCP
hero_aibroker_openrpc bin hero_aibroker_openrpc Raw JSON-RPC 2.0 backend over Unix socket (~/hero/var/sockets/hero_aibroker.sock)
hero_aibroker_http bin hero_aibroker_http Admin UI + OpenAI-compat HTTP API + RPC proxy to backend socket
hero_aibroker_client lib HTTP client SDK (talks to _http's /rpc endpoint)
hero_aibroker_cli bin hero_aibroker_cli Interactive CLI client
hero_aibroker_rhai lib Rhai scripting bindings

What Changed

  • Renamed llmbrokerhero_aibroker (pure library, no binary)
  • Renamed hero_aibroker_sdkhero_aibroker_client
  • Renamed llmbroker_clihero_aibroker_cli
  • Created hero_aibroker_openrpc — newline-delimited JSON-RPC server with rpc.discover, rpc.health, and all admin methods (models.*, apikeys.*, metrics.*, logs.*, mcp.*)
  • Merged hero_aibroker_ui + HTTP server into hero_aibroker_http — serves admin dashboard, OpenAI-compat endpoints (/v1/*), and proxies /rpc/proxy to the backend Unix socket
  • Deleted old llmbroker, hero_aibroker_sdk, hero_aibroker_ui, llmbroker_cli crates
  • HTTP service supports --bind unix:/path for hero_proxy or --bind host:port for TCP (default 127.0.0.1:3385)
  • Service discovery at /.well-known/heroservice.json
  • All MCP crates unchanged

Design Note

aibroker is a global service (not context-aware) — single socket, no per-context routing. The OpenAI-compat HTTP endpoints require streaming SSE and multipart uploads, so _http uses the core library directly for /v1/* rather than proxying through the raw JSON-RPC backend.

Test Plan

  • cargo check --workspace — zero errors
  • cargo test --workspace — 12 tests pass
  • All 3 binaries build: hero_aibroker_openrpc, hero_aibroker_http, hero_aibroker_cli
  • Manual: hero_aibroker_http serves admin dashboard at /
  • Manual: hero_aibroker_openrpc binds Unix socket and responds to rpc.health
## Summary Restructure hero_aibroker to follow the [hero_service.md](https://forge.ourworld.tf/geomind_code/dev_docs/bestpractices/services/hero_service.md) 5-crate standard (issue #6). ### Crate Layout | Crate | Type | Binary | Purpose | |-------|------|--------|---------| | `hero_aibroker` | lib | — | Core library: providers, registry, services, middleware, auth, MCP | | `hero_aibroker_openrpc` | bin | `hero_aibroker_openrpc` | Raw JSON-RPC 2.0 backend over Unix socket (`~/hero/var/sockets/hero_aibroker.sock`) | | `hero_aibroker_http` | bin | `hero_aibroker_http` | Admin UI + OpenAI-compat HTTP API + RPC proxy to backend socket | | `hero_aibroker_client` | lib | — | HTTP client SDK (talks to `_http`'s `/rpc` endpoint) | | `hero_aibroker_cli` | bin | `hero_aibroker_cli` | Interactive CLI client | | `hero_aibroker_rhai` | lib | — | Rhai scripting bindings | ### What Changed - **Renamed** `llmbroker` → `hero_aibroker` (pure library, no binary) - **Renamed** `hero_aibroker_sdk` → `hero_aibroker_client` - **Renamed** `llmbroker_cli` → `hero_aibroker_cli` - **Created** `hero_aibroker_openrpc` — newline-delimited JSON-RPC server with `rpc.discover`, `rpc.health`, and all admin methods (`models.*`, `apikeys.*`, `metrics.*`, `logs.*`, `mcp.*`) - **Merged** `hero_aibroker_ui` + HTTP server into `hero_aibroker_http` — serves admin dashboard, OpenAI-compat endpoints (`/v1/*`), and proxies `/rpc/proxy` to the backend Unix socket - **Deleted** old `llmbroker`, `hero_aibroker_sdk`, `hero_aibroker_ui`, `llmbroker_cli` crates - HTTP service supports `--bind unix:/path` for hero_proxy or `--bind host:port` for TCP (default `127.0.0.1:3385`) - Service discovery at `/.well-known/heroservice.json` - All MCP crates unchanged ### Design Note aibroker is a **global service** (not context-aware) — single socket, no per-context routing. The OpenAI-compat HTTP endpoints require streaming SSE and multipart uploads, so `_http` uses the core library directly for `/v1/*` rather than proxying through the raw JSON-RPC backend. ## Test Plan - [x] `cargo check --workspace` — zero errors - [x] `cargo test --workspace` — 12 tests pass - [x] All 3 binaries build: `hero_aibroker_openrpc`, `hero_aibroker_http`, `hero_aibroker_cli` - [ ] Manual: `hero_aibroker_http` serves admin dashboard at `/` - [ ] Manual: `hero_aibroker_openrpc` binds Unix socket and responds to `rpc.health`
Restructure to Hero Service 5-crate standard (issue #6)
All checks were successful
Build and Test / build-and-test (pull_request) Successful in 1m46s
3dad5aa9bc
Reorganize the workspace to follow the hero_service.md architecture:

- hero_aibroker: core library (renamed from llmbroker)
  - Types, providers, registry, services, middleware, MCP, auth
  - Pure library — no binary

- hero_aibroker_openrpc: raw JSON-RPC backend (NEW)
  - Newline-delimited JSON-RPC 2.0 over Unix socket
  - Binds ~/hero/var/sockets/hero_aibroker.sock (global service)
  - All admin methods: models.*, apikeys.*, metrics.*, logs.*, mcp.*
  - Built-in rpc.discover and rpc.health

- hero_aibroker_http: HTTP service (replaces llmbroker binary + hero_aibroker_ui)
  - Admin dashboard UI (Askama templates)
  - OpenAI-compatible HTTP endpoints (/v1/*)
  - RPC proxy to backend socket (/rpc/proxy)
  - Service discovery (/.well-known/heroservice.json)
  - Supports --bind for Unix socket (hero_proxy) or TCP

- hero_aibroker_client: HTTP client SDK (renamed from hero_aibroker_sdk)

- hero_aibroker_cli: CLI client (renamed from llmbroker_cli)

- hero_aibroker_rhai: Rhai bindings (updated imports)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
timur merged commit b4ba5f80a2 into development 2026-02-24 01:44:02 +00:00
timur deleted branch development_standardize 2026-02-24 01:44:14 +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_aibroker!9
No description provided.