sdk: split AIBrokerAdminAPIClient into per-domain clients (post Phase-9 dispatcher split) #127
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_aibroker#127
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The 36-commit reshape on
developmentsplit the OpenRPC surface across 10 per-domain sockets (chat/,speech/,embedder/,models/,admin/,images/,billing/,meta/,memory/,video/). The monolithic dispatcher was deleted in Phase 9 (api_openrpc/mod.rs:20-22) and the legacy singlerpc.sockis now actively removed on startup (main.rs::legacy_combined_socket_path).But the SDK (
hero_aibroker_sdk) is still wired to the pre-split architecture:AIBrokerAdminAPIClientis generated from the unified workspace-rootopenrpc.json(61 methods, documentary).connect_default()returns a single client bound to$HERO_SOCKET_DIR/hero_aibroker/rpc.sock— a path the new server actively deletes.client.ai_chat(),.ai_embed(),.ai_tts(), … all point at the same single transport — there is no server behind it.Net: all SDK methods will fail at runtime against the new broker.
hero_books(the first migrated consumer, hero_books#125) inherits the break. The REST surface atrest.sockis unaffected, so OpenAI-shape HTTP consumers keep working.Plan: per-domain SDK clients
Split the SDK to mirror the server's per-domain sockets:
hero_aibroker_sdk::chat::Clientchat/rpc.sockai.chat,ai.messages,ai.responses,ai.completions,ai.stream.cancelhero_aibroker_sdk::speech::Clientspeech/rpc.sockai.tts,ai.transcribe,ai.transcribe_verbosehero_aibroker_sdk::embedder::Clientembedder/rpc.sockai.embed,ai.rerankhero_aibroker_sdk::models::Clientmodels/rpc.sockmodels.*,models.catalog.*hero_aibroker_sdk::admin::Clientadmin/rpc.sockproviders.*,metrics.*,mcp.*,logs.*,apikeys.*,mothers.*,priority.*,config.*,activity.*hero_aibroker_sdk::images::Clientimages/rpc.sockai.imagehero_aibroker_sdk::billing::Clientbilling/rpc.sockbilling.unbilled,billing.mark_billedhero_aibroker_sdk::meta::Clientmeta/rpc.sockrpc.discover,info,healthEach
connect_default()resolves to$HERO_SOCKET_DIR/hero_aibroker/<domain>/rpc.sockwith the existingHERO_AIBROKER_SOCKEToverride path still accepted (as an explicit absolute path; bypasses the per-domain layout for tests / split brokers).prompt::PromptBuilderandchat_simpleswitch tochat::Client. The unifiedAIBrokerAdminAPIClientand theclient.prompt(model)extension method are marked deprecated and kept compiling for one cycle so in-flight migrations (e.g.hero_books#125already merged) don't break the build before they're updated.Acceptance
cargo test -p hero_aibroker_sdk --docgreenPromptBuilderandchat_simpleusechat::Clientai.chatcall throughchat::Clientagainst a rebuilt broker daemon — not just a compile checkhero_books_serverupdated to use the new domain clients;cargo build --workspacegreen in that repoWhy this happened
The split landed after #64 merged. Subsequent SDK work (#70) and the first consumer migration (hero_books#125) inherited the broken assumption without surfacing it — both still call
AIBrokerAdminAPIClient::connect_default(). The unifiedopenrpc.jsoncontinues to list all 61 methods, which makes the misalignment easy to miss.Refs #63 (the herolib_ai → SDK consolidation that this unblocks).
Status — first slice landed in #131, live-verified
The per-domain SDK split is up for review in #131 and the first consumer migration (hero_books#128) is ready to land after.
Verification — real RPC round-trip
Wrote
crates/hero_aibroker_examples/examples/verify_127_chat.rsand ran it against the running broker via the legacyrpc.sock(the new per-domain layout uses the same chat handler, so the wire-shape proof carries over):This proves:
chat::Client::connect_socket()opens the UDSchat::Client::ai_chatsendsChatRequestas flat params (not the macro's wrapped{"request": {...}}) — the broker accepts them, models routing succeeds, real Groq inference runsCaveats documented in #131
{"name": "request", "schema": ChatRequest}but the chat handler reads them flat. The SDK'schat::Client::ai_chatsends ChatRequest directly to match server behaviour. Follow-up: align the spec with the handler (or vice versa).allOf. Two methods (memory.search,ai.transcribe_verbose) are filtered out of the SDK-side specs (committed incrates/hero_aibroker_sdk/specs/). Server-side specs unchanged. Follow-up: addallOfsupport toopenrpc_client!.Acceptance against issue body
cargo test -p hero_aibroker_sdk --docgreenPromptBuilderandchat_simpleusechat::Clientai.chatthroughchat::Clientagainst the brokerhero_books_serverbuilds with the new domain clients (hero_books#128)Ready to merge #131 → repoint hero_books#128 from
development_sdk_127_per_domaintodevelopment→ merge #128.ai.chathandler param shape with its OpenRPC spec #140