Go from Zinit to Hero_proc #29

Open
opened 2026-03-20 02:43:42 +00:00 by mik-tf · 3 comments
Owner

check & fix where needed this repo based on

skills

/hero_crates_best_practices_check
/hero_sockets
/hero_proc_service_selfstart

check & fix where needed this repo based on skills /hero_crates_best_practices_check /hero_sockets /hero_proc_service_selfstart
Owner

Implementation Spec for Issue #29: Go from Zinit to Hero_proc

Objective

Replace all Zinit-based process management with Hero Proc, using hero_proc_sdk for self-start/self-stop lifecycle. Both hero_aibroker_server and hero_aibroker_ui binaries will support --start and --stop flags instead of subcommands that delegate to HeroLifecycle (which wraps zinit). Fix socket compliance issues and remove TCP fallback code.

Current State

  • Both binaries use hero_rpc_server::HeroLifecycle wrapping zinit for lifecycle
  • Workspace declares hero_rpc_server and zinit_sdk dependencies
  • Already uses Unix Domain Sockets (good)
  • Core library has dead TCP support code
  • UI discovery manifest has wrong protocol ("web" instead of "openrpc")
  • UI health endpoint returns plain text instead of JSON

Requirements

  • Replace hero_rpc_server + zinit_sdk with hero_proc_sdk
  • Replace subcommand CLI with --start/--stop flags in both binaries
  • Fix discovery manifest protocol to "openrpc"
  • Fix health endpoint to return JSON
  • Remove TCP support from core library
  • Update Makefile targets

Implementation Plan

Step 1: Update workspace dependencies (Cargo.toml)
Step 2: Update server crate deps + CLI (hero_aibroker_server)
Step 3: Update UI crate deps + CLI (hero_aibroker_ui)
Step 4: Fix discovery manifest and health endpoint (routes.rs)
Step 5: Remove TCP support from core library (socket.rs)
Step 6: Update Makefile
Step 7: Update buildenv.sh
Step 8: Verify with cargo check/clippy

Acceptance Criteria

  • No references to zinit, zinit_sdk, or hero_rpc_server remain
  • --start/--stop flags work for both binaries via hero_proc
  • Discovery manifest returns "protocol": "openrpc"
  • Health endpoint returns proper JSON
  • No TCP code remains
  • make start / make stop work with new pattern
  • cargo check and cargo clippy pass
## Implementation Spec for Issue #29: Go from Zinit to Hero_proc ### Objective Replace all Zinit-based process management with Hero Proc, using `hero_proc_sdk` for self-start/self-stop lifecycle. Both `hero_aibroker_server` and `hero_aibroker_ui` binaries will support `--start` and `--stop` flags instead of subcommands that delegate to `HeroLifecycle` (which wraps zinit). Fix socket compliance issues and remove TCP fallback code. ### Current State - Both binaries use `hero_rpc_server::HeroLifecycle` wrapping zinit for lifecycle - Workspace declares `hero_rpc_server` and `zinit_sdk` dependencies - Already uses Unix Domain Sockets (good) - Core library has dead TCP support code - UI discovery manifest has wrong protocol (`"web"` instead of `"openrpc"`) - UI health endpoint returns plain text instead of JSON ### Requirements - Replace `hero_rpc_server` + `zinit_sdk` with `hero_proc_sdk` - Replace subcommand CLI with `--start`/`--stop` flags in both binaries - Fix discovery manifest protocol to `"openrpc"` - Fix health endpoint to return JSON - Remove TCP support from core library - Update Makefile targets ### Implementation Plan **Step 1**: Update workspace dependencies (Cargo.toml) **Step 2**: Update server crate deps + CLI (hero_aibroker_server) **Step 3**: Update UI crate deps + CLI (hero_aibroker_ui) **Step 4**: Fix discovery manifest and health endpoint (routes.rs) **Step 5**: Remove TCP support from core library (socket.rs) **Step 6**: Update Makefile **Step 7**: Update buildenv.sh **Step 8**: Verify with cargo check/clippy ### Acceptance Criteria - [ ] No references to zinit, zinit_sdk, or hero_rpc_server remain - [ ] `--start`/`--stop` flags work for both binaries via hero_proc - [ ] Discovery manifest returns `"protocol": "openrpc"` - [ ] Health endpoint returns proper JSON - [ ] No TCP code remains - [ ] `make start` / `make stop` work with new pattern - [ ] `cargo check` and `cargo clippy` pass
Owner

Test Results

  • Total: 21
  • Passed: 21
  • Failed: 0
  • cargo check: clean (no warnings)
  • cargo clippy: clean (no warnings)

Implementation Summary

Changes Made

Dependencies (Cargo.toml)

  • Removed hero_rpc_server, zinit_sdk, open from workspace
  • Added hero_proc_sdk to workspace and both binary crates

Server (hero_aibroker_server/src/main.rs)

  • Replaced subcommand CLI (Run/Start/Stop/Serve/Status/Logs/Ui/Zinit) with --start/--stop flags
  • Removed all HeroLifecycle usage
  • Added self_start() using hero_proc_sdk (ServiceBuilder, ActionBuilder)
  • Added self_stop() with status polling
  • Default (no flags) runs server directly for hero_proc to launch

UI (hero_aibroker_ui/src/main.rs)

  • Same CLI migration as server
  • Added .requires(&["hero_aibroker_server"]) dependency
  • Default (no flags) runs UI directly for hero_proc to launch

Socket compliance (routes.rs, api/mod.rs)

  • Fixed discovery manifest: "protocol": "web""protocol": "openrpc"
  • Fixed health endpoint: plain text "OK" → JSON {"status": "ok", "service": "hero_aibroker_ui", "version": "..."}

Core library (socket.rs, lib.rs)

  • Removed TCP support (SocketMode::Tcp, Listener::Tcp, from_env_or_default)
  • Simplified to Unix socket helpers only
  • Removed Listener/SocketMode re-exports from lib.rs

Build (Makefile, buildenv.sh)

  • Updated run/start/stop/rundev targets for --start/--stop pattern
  • Removed logs/status/run-ui/start-ui/stop-ui/logs-ui targets
  • Removed TCP port 3385 from buildenv.sh

Verification

  • No references to zinit, zinit_sdk, or hero_rpc_server remain in codebase
  • cargo check passes clean
  • cargo clippy passes clean
  • All 21 tests pass
## Test Results - Total: 21 - Passed: 21 - Failed: 0 - `cargo check`: clean (no warnings) - `cargo clippy`: clean (no warnings) ## Implementation Summary ### Changes Made **Dependencies (Cargo.toml)** - Removed `hero_rpc_server`, `zinit_sdk`, `open` from workspace - Added `hero_proc_sdk` to workspace and both binary crates **Server (`hero_aibroker_server/src/main.rs`)** - Replaced subcommand CLI (`Run/Start/Stop/Serve/Status/Logs/Ui/Zinit`) with `--start`/`--stop` flags - Removed all `HeroLifecycle` usage - Added `self_start()` using `hero_proc_sdk` (ServiceBuilder, ActionBuilder) - Added `self_stop()` with status polling - Default (no flags) runs server directly for hero_proc to launch **UI (`hero_aibroker_ui/src/main.rs`)** - Same CLI migration as server - Added `.requires(&["hero_aibroker_server"])` dependency - Default (no flags) runs UI directly for hero_proc to launch **Socket compliance (`routes.rs`, `api/mod.rs`)** - Fixed discovery manifest: `"protocol": "web"` → `"protocol": "openrpc"` - Fixed health endpoint: plain text `"OK"` → JSON `{"status": "ok", "service": "hero_aibroker_ui", "version": "..."}` **Core library (`socket.rs`, `lib.rs`)** - Removed TCP support (`SocketMode::Tcp`, `Listener::Tcp`, `from_env_or_default`) - Simplified to Unix socket helpers only - Removed `Listener`/`SocketMode` re-exports from lib.rs **Build (`Makefile`, `buildenv.sh`)** - Updated `run`/`start`/`stop`/`rundev` targets for `--start`/`--stop` pattern - Removed `logs`/`status`/`run-ui`/`start-ui`/`stop-ui`/`logs-ui` targets - Removed TCP port `3385` from buildenv.sh ### Verification - No references to `zinit`, `zinit_sdk`, or `hero_rpc_server` remain in codebase - `cargo check` passes clean - `cargo clippy` passes clean - All 21 tests pass
Owner

Implementation committed: 7205b11

Browse: 7205b11

Implementation committed: `7205b11` Browse: https://forge.ourworld.tf/lhumina_code/hero_aibroker/commit/7205b11
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#29
No description provided.