Collapse catalog to a meta-service for managing Hero services (#1) #3

Closed
timur wants to merge 3 commits from issue-1-meta-service into development
Owner

Closes #1.

Summary

  • ServiceDefinition collapses from a parallel ServiceToml (binaries, sockets, category, status, version, …) to { name, description, interfaces: [Interface] }sid/created_at/updated_at are auto-injected (hero_rpc#85), and the redeclared Kind/Category/Protocol/SockType/Binary/Socket/ServiceMeta types are gone (live service metadata is read from each service's own service.toml). Closes hero_rpc#72.
  • service ServiceCatalog exposes:
    • list / get_by_name / list_by_interface — real, backed by OsisCatalog.
    • bootstrap(name, description, interfaces) → OpReportmocked; real wiring → hero_rpc_osis::build::OschemaBuilder + canonical service template from hero_skills.
    • refactor(name, prompt) → OpReportmocked; real wiring → herolib_ai::AiClient::from_env() with skill bodies as system prompt.
    • check(name) → OpReportmocked; real wiring → rule packs from hero_skills/skills/* (service.toml, sockets, branching, naming, layout).
    • verify(name) → OpReportmocked; real wiring → cargo build + --info --json parse + socket connect + tests_smoketest.
  • Each mocked handler returns a canned OpReport with a TODO[<op>] block in crates/hero_service_server/src/catalog/rpc.rs naming the exact crate / skill the production version will pull.

Refs

  • Closes hero_rpc#72 at the schema level.
  • Built on hero_rpc#85 / #87 — generator no longer requires an explicit sid field.
  • Drives hero_skills#275 — skill should stop telling authors to declare sid/created_at/updated_at.

Test plan

  • cargo build --workspace — clean.
  • cargo test --workspace — clean (2 catalog CRUD tests pass).
  • Smoke test the four meta-ops via the SDK once real implementations land (follow-ups).
Closes #1. ## Summary - `ServiceDefinition` collapses from a parallel `ServiceToml` (`binaries`, `sockets`, `category`, `status`, `version`, …) to `{ name, description, interfaces: [Interface] }` — `sid`/`created_at`/`updated_at` are auto-injected (hero_rpc#85), and the redeclared `Kind`/`Category`/`Protocol`/`SockType`/`Binary`/`Socket`/`ServiceMeta` types are gone (live service metadata is read from each service's own `service.toml`). Closes [hero_rpc#72](https://forge.ourworld.tf/lhumina_code/hero_rpc/issues/72). - `service ServiceCatalog` exposes: - `list` / `get_by_name` / `list_by_interface` — real, backed by `OsisCatalog`. - `bootstrap(name, description, interfaces) → OpReport` — **mocked**; real wiring → `hero_rpc_osis::build::OschemaBuilder` + canonical service template from `hero_skills`. - `refactor(name, prompt) → OpReport` — **mocked**; real wiring → `herolib_ai::AiClient::from_env()` with skill bodies as system prompt. - `check(name) → OpReport` — **mocked**; real wiring → rule packs from `hero_skills/skills/*` (service.toml, sockets, branching, naming, layout). - `verify(name) → OpReport` — **mocked**; real wiring → `cargo build` + `--info --json` parse + socket connect + `tests_smoketest`. - Each mocked handler returns a canned `OpReport` with a `TODO[<op>]` block in `crates/hero_service_server/src/catalog/rpc.rs` naming the exact crate / skill the production version will pull. ## Refs - Closes [hero_rpc#72](https://forge.ourworld.tf/lhumina_code/hero_rpc/issues/72) at the schema level. - Built on [hero_rpc#85 / #87](https://forge.ourworld.tf/lhumina_code/hero_rpc/pulls/87) — generator no longer requires an explicit `sid` field. - Drives [hero_skills#275](https://forge.ourworld.tf/lhumina_code/hero_skills/issues/275) — skill should stop telling authors to declare `sid`/`created_at`/`updated_at`. ## Test plan - [x] `cargo build --workspace` — clean. - [x] `cargo test --workspace` — clean (2 catalog CRUD tests pass). - [ ] Smoke test the four meta-ops via the SDK once real implementations land (follow-ups).
`hero_service` is the canonical template *and* the seed of the meta-service
that bootstraps, refactors, checks and verifies other Hero services. This
commit rewrites the catalog domain so it actually looks like that service —
its OSchema, its RPC surface, and its handler stubs all line up with the
"manage hero services" framing.

`ServiceDefinition` collapses from a parallel `ServiceToml` (binaries,
sockets, category, status, version, …) to the minimum the catalog needs:

    ServiceDefinition = {
        name:        str @index
        description: str
        interfaces:  [Interface]
    }

`sid` / `created_at` / `updated_at` are no longer declared in the schema —
they are auto-injected by the generator (hero_rpc#85). All redeclared
ServiceToml types (Kind / Category / Protocol / SockType / Binary / Socket /
ServiceMeta) are gone; live service metadata is read from each service's
own `service.toml` via `herolib_core::base::ServiceToml`. Closes hero_rpc#72.

`Interface` (server | admin | cli | web | rhai), `OpStatus`, `Diagnostic`
and `OpReport` are added — owned by the catalog, used by the meta-ops below.

`service ServiceCatalog` now exposes:

  - list / get_by_name / list_by_interface  — queries
  - bootstrap(name, description, interfaces) → OpReport
  - refactor(name, prompt)                   → OpReport
  - check(name)                              → OpReport
  - verify(name)                             → OpReport

The four meta-ops are **mocked** — each returns a realistic canned `OpReport`
and a single `TODO[<op>]` comment naming the exact crate / skill that the
production implementation will pull:

| op        | production wiring                                              |
|-----------|----------------------------------------------------------------|
| bootstrap | `hero_rpc_osis::build::{OschemaBuildConfig, OschemaBuilder}` + canonical service template from hero_skills |
| refactor  | `herolib_ai::AiClient::from_env()` with skill bodies as system prompt |
| check     | rule packs from hero_skills (service.toml, sockets, branching, naming, layout) |
| verify    | cargo build + `<binary> --info --json` + socket connect + tests_smoketest |

Queries (`list`, `get_by_name`, `list_by_interface`) are real — they hit the
OSIS-backed `OsisCatalog` domain.

- `crates/hero_service/build.rs`: drop the removed `.docs_dir(...)` builder
  call (the new generator emits canonical `docs/openrpc.json`).
- `crates/hero_service/src/services/`: removed — was an empty placeholder
  module; meta-op handlers live in `hero_service_server` where handlers belong.

`hero_rpc` deps point at branch `issue-85-rootobj-sid-validation`. Without
that fix, the generator rejects `ServiceDefinition` because it has no
explicit `sid` field, even though the Rust struct emitter auto-injects it.
Switch the three Cargo.toml files back to `branch = "development"` once
hero_rpc#85 is merged.

- Closes hero_rpc#72 (no service redeclares `herolib_core::base` types).
- Blocks on hero_rpc#85 (`fix(generator): drop redundant sid-field
  requirement on root objects`).
- Drives hero_skills#275 (skill change to stop telling authors to declare
  `sid` / `created_at` / `updated_at`).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Cleanup follow-up after the dep flip:
- Drop the now-obsolete TEMPORARY hero_rpc#85 comments from the three
  Cargo.toml files (the actual branch pins already point at development).
- Regenerate catalog code against hero_rpc development (commit 41961658,
  post-hero_rpc#87): refreshed osis_server_generated.rs, rpc_generated.rs,
  docs/catalog/openrpc.json; tests.rs collapses to `use super::*`.
- Cargo.lock: unify all hero_rpc transitive crates onto the same commit
  (was split between 41961658 and 345b933a, which made cargo test pick the
  older one and fail with the must-have-sid validation).

cargo test --workspace clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
timur closed this pull request 2026-05-20 08:49:28 +00:00
Author
Owner

Closing — equivalent content was already squash-merged via #2 onto development (commit 8c0df0f). Will open a small follow-up PR for the leftover cleanup (drop the now-stale TEMPORARY hero_rpc#85 comments).

Closing — equivalent content was already squash-merged via #2 onto development (commit 8c0df0f). Will open a small follow-up PR for the leftover cleanup (drop the now-stale TEMPORARY hero_rpc#85 comments).

Pull request closed

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_service!3
No description provided.