development_features #111

Open
timur wants to merge 30 commits from development_features into development
Owner

Branch Status Update

Cleaned up crates/inspector/ and crates/rpc/ from this branch — both have been moved to their own repositories:

This removes ~12,600 lines / 68 files from the diff.

What's still in this branch

Structural refactors:

  • packages/crates/ directory rename (~344 files are pure moves, ~57 have small path fixups)
  • herodohero_do rename + main.rs rewrite (1718 → 293 lines, drops the interactive REPL)
  • Rhai feature made optional across all crates

New features:

  • crates/clients_hero_os/ — extracts hero_embedder into its own Hero OS client crate (~4,900 lines)
  • crates/code/ — Rhai bindings for the code parser + examples (~935 lines)
  • crates/osis/rust_client.rs — generator rewrite/expansion (525 → 1,517 lines)

Minor:

  • Docs, CI scripts, AI prompts updated for packages/crates/ paths
  • Cargo.toml dependency tweaks across ~7 crates
  • hero_rpc git dependencies added to workspace

Before merging

  • The packages/crates/ rename will conflict with anything on development touching files under packages/ — needs coordination
  • packages/infra/ and packages/oserver/ are leftover on this branch — decide whether to move to crates/ or remove
  • hero_do REPL removal is intentional (script-only execution going forward)
## Branch Status Update Cleaned up `crates/inspector/` and `crates/rpc/` from this branch — both have been moved to their own repositories: - **inspector** → [hero_inspector](https://forge.ourworld.tf/lhumina_code/hero_inspector) - **rpc** → [hero_rpc](https://forge.ourworld.tf/lhumina_code/hero_rpc) This removes ~12,600 lines / 68 files from the diff. ### What's still in this branch **Structural refactors:** - `packages/` → `crates/` directory rename (~344 files are pure moves, ~57 have small path fixups) - `herodo` → `hero_do` rename + `main.rs` rewrite (1718 → 293 lines, drops the interactive REPL) - Rhai feature made optional across all crates **New features:** - `crates/clients_hero_os/` — extracts `hero_embedder` into its own Hero OS client crate (~4,900 lines) - `crates/code/` — Rhai bindings for the code parser + examples (~935 lines) - `crates/osis/rust_client.rs` — generator rewrite/expansion (525 → 1,517 lines) **Minor:** - Docs, CI scripts, AI prompts updated for `packages/` → `crates/` paths - Cargo.toml dependency tweaks across ~7 crates - `hero_rpc` git dependencies added to workspace ### Before merging - The `packages/` → `crates/` rename will conflict with anything on `development` touching files under `packages/` — needs coordination - `packages/infra/` and `packages/oserver/` are leftover on this branch — decide whether to move to `crates/` or remove - `hero_do` REPL removal is intentional (script-only execution going forward)
fix: use correct re-export path for ClientError in SDK generator
Some checks failed
Lint / lint-linux (pull_request) Failing after 23s
Tests with Services / test-linux (pull_request) Has been cancelled
Lint / lint-macos (pull_request) Has been cancelled
Tests with Services / test-macos (pull_request) Has been cancelled
d9b253bf47
The offline module re-exports ClientError at herolib_osis::offline::ClientError,
not herolib_osis::offline::transport::ClientError. This caused all generated
SDK clients to fail to compile.

Closes lhumina_code/hero_osis#6

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
merge: resolve conflict keeping WASM RPC client code from PR branch
All checks were successful
Lint / lint-linux (pull_request) Successful in 2m31s
Tests with Services / test-linux (pull_request) Successful in 15m10s
e686ba8158
- Convert rhai from a default/required dependency to an optional feature in
  core, os, virt, mos, clients, vault, ai, and code packages
- Add default-features = false to workspace dependency declarations so
  downstream crates opt-in explicitly
- Propagate rhai feature flags to transitive internal dependencies
  (e.g. mos/rhai enables virt/rhai, os/rhai, core/rhai)
- Update rhai version to 1.23.6 consistently across packages
- Gate rhai module compilation behind #[cfg(feature = "rhai")]
- Ensure herodo still activates rhai for all packages it aggregates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Integrate git_core enhancements from development
- Add rust_client generator from development_mik
- Update profiling modules with rhai feature flag handling

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Align directory structure with conventional Rust workspace layout
- Update all Cargo.toml workspace member paths from packages/* to crates/*
- Update all documentation, examples, and script references
- Verify build works correctly with new structure

All cargo check and compilation tests pass with crates/ naming.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Remove interactive shell (run_repl function and all related REPL infrastructure)
- Keep script execution modes:
  - Running single .rhai script files
  - Running all .rhai files in a directory (recursive)
  - Reading scripts from stdin with -i flag
- Remove REPL dependencies: rustyline, colored, dirs
- Simplify main.rs to ~200 lines focused on script execution
- Update description and keywords to reflect script runner vs interactive shell
- Binary now requires explicit file/directory argument or -i flag
- All functionality tested and builds successfully

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Extracts the hero_embedder module from herolib_clients into a dedicated
herolib_clients_hero_os crate to separate Hero OS service clients from
general-purpose infrastructure clients.

- Add crates/clients_hero_os with hero_embedder module (OpenRPC client + Rhai bindings)
- Remove hero_embedder from crates/clients (lib.rs, rhai.rs, Cargo.toml)
- Register herolib_clients_hero_os in workspace Cargo.toml

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rename crates/herodo to crates/hero_do for consistency with naming conventions
- Add #!/usr/bin/env rhai shebangs to all Rhai example and test scripts
- Reorganize crates/code examples into builder and codeparser subdirectories
- Add hero_do_code binary and Makefile/buildenv.sh build helpers for code crate
- Update documentation and add new parser module README

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Replace {*path} with /*path in static file routes. Axum requires catch-all parameters to use the /*path syntax without braces.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Pass SSE broadcaster to Scanner for real-time service discovery updates
- Probe all sockets and manual sources concurrently instead of sequentially
- Send ServiceAdded SSE events as each service is discovered
- UI navbar now updates incrementally instead of waiting for full scan
- Eliminates blocking delays during service discovery

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Adds comprehensive logging at all stages of service discovery:
- Initial startup shows configuration (socket dir, timeouts, refresh interval)
- Socket scan shows number of sockets found
- Each service probe shows status icon, name, method count, and duration
- Total scan time displayed
- Manual sources refresh shows count and timing
- Background refresh loop logs each cycle

Status icons:
- ✓ Healthy
- ⏸ Inactive
-  Non-RPC
-  Unhealthy

Helps identify slow probes and blocking operations.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Log each socket file discovered
- Show count of skipped and non-socket files
- Log before probing each socket
- Show which socket is currently being probed
- Set log level to debug by default for inspector
- Write logs to stderr to avoid buffering

Makes it easy to identify:
- Which sockets are found
- Which sockets are skipped
- Which probe is taking too long

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add kill-port target to Makefile to automatically kill existing processes on port 7400 before running
- Make run target depend on kill-port to avoid "Address already in use" errors
- Send SSE Scan event after initial service discovery completes (previously only sent on periodic refresh)
- Print discovery completion summary with discovered services count and list to console
- Improves user experience by showing clear progress feedback during initial startup

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add up-poll="3s" to sidebar to automatically refresh every 3 seconds
- Add up-keep="true" to preserve form state during updates
- Replace manual DOMContentLoaded load with Unpoly's polling mechanism
- Services will now appear in UI within 3 seconds of discovery
- Polling provides fallback to SSE for reliable real-time updates

This ensures services appear in the UI even if discovery happens before
the page loads, by polling the sidebar fragment every 3 seconds instead
of relying solely on one-time initial load.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Update socket probe to try both JSON-RPC and REST endpoints
- First attempts rpc.discover JSON-RPC method (standard)
- Falls back to GET /openrpc.json if method not found (for hero_embedder_server)
- Now discovers services that expose OpenRPC via REST instead of JSON-RPC

This enables hero_embedder_server and similar services to be properly
discovered and shown as Healthy instead of Inactive.

Fixes: Services that expose /openrpc.json REST endpoint now show as discoverable

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add DOMContentLoaded listener to explicitly load sidebar via up.reload()
- Ensures sidebar populates even if up-poll timing is delayed
- Sidebar still updates every 3s via polling + SSE for real-time changes

This fixes the issue where sidebar would show "Loading services..." indefinitely
instead of displaying discovered services once they were loaded.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add JavaScript hook in base.html to load sidebar via up.navigate()
- Waits for page to load before initiating Unpoly navigation
- Ensures sidebar content loads properly with discovered services
- Keeps polling (up-poll) for continuous updates every 3s

This fixes the persistent "Loading services..." issue by ensuring Unpoly
properly loads the sidebar fragment on page load.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Use fetch() + innerHTML to load sidebar directly from /fragments/sidebar
- Avoids Unpoly initialization issues
- Poll every 3 seconds using setInterval
- Sidebar now loads immediately on page load

This fixes the persistent "Loading services..." issue. The backend was
working correctly all along - 16 services were in the cache and the
sidebar endpoint returned them correctly. The issue was purely with
Unpoly's navigation not loading the content in the browser.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add loadServiceDetail() function to fetch service documentation
- Add attachServiceClickHandlers() to attach click listeners to service items
- Service clicks now load documentation in main panel without Unpoly
- Re-attach handlers after each sidebar reload

This allows users to click on services to view their OpenRPC documentation
and method details.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add /service/:id route for service detail HTML documentation
- Add /service/:id/markdown route for markdown documentation
- Both routes support direct URL access (e.g., http://localhost:7400/service/{id})
- Update JavaScript to use /service/:id instead of /fragments/service/:id
- Markdown endpoint returns proper text/markdown content type

This allows:
1. Clicking services in sidebar to load documentation
2. Direct URL access to service docs: /service/{id}
3. Direct markdown access: /service/{id}/markdown
4. Browser bookmarks and sharing of service documentation

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Replace up.reload() with fetch() for sidebar reloads
- Replace up.navigate() with fetch() for service detail loading
- Fix initRemoveButtons to reload sidebar on remove
- Fix initAddSpecForm to reload sidebar and auto-select new service
- Fix SSE event handlers to use fetch for sidebar reload
- Removes dependency on Unpoly working properly

This fixes the "Could not find common target" error when clicking scan,
remove, or add spec buttons. All sidebar updates now use plain fetch().

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add get_by_title() method to cache for title-based lookups
- Update service_detail_handler to accept both ID and title
- Update markdown_handler to accept both ID and title
- Routes now work with service names: /service/Hero%20Embedder%20Server%20API
- Falls back to ID lookup if title not found

Examples:
- /service/Hero%20Embedder%20Server%20API (via title)
- /service/aac03e5c-b9c5-503a-9373-bbbaff84985e (via ID)
- /service/Hero%20Embedder%20Server%20API/markdown (markdown by title)

Both formats work and are case-insensitive for titles.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Create service_page_handler for direct URL access (/service/{id})
- Returns complete HTML page with navbar, dark mode, and styling
- Includes Bootstrap 5.3.3 and dashboard CSS for proper theming
- service_detail_handler still returns fragment for sidebar loads
- Both ID and title-based URLs supported

This fixes direct URL access to services showing only raw fragment HTML
without proper page layout or dark mode styling. Now visiting
/service/{id} or /service/{title} displays a complete, styled page.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Update service_page_handler to only use get_by_title() for service lookups
- Update markdown_handler to only use get_by_title() for service lookups
- Removes ID fallback logic that was no longer needed
- All service URLs now use human-readable service names (titles)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add pulldown-cmark crate for markdown-to-HTML conversion
- Create markdown_view_handler that renders markdown as styled HTML
- Add /service/:id/markdown/view route for viewing docs in browser
- Update service detail template with "View Documentation" button
- Add viewMarkdown() JavaScript function to open docs in new tab
- Style markdown content with Bootstrap classes, code blocks, tables, and blockquotes
- Provides readable, professional documentation viewing experience

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Update attachServiceClickHandlers() to use data-title instead of data-id
- Update loadServiceDetail() to encode service name properly in URL
- Fixes 'Service not found' error when clicking services in sidebar
- Service names are now correctly matched by title lookup

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Remove download buttons, add Markdown/OpenRPC tabs with copy-to-clipboard,
JSON syntax highlighting, and Bootstrap dark-mode styled markdown rendering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
chore: remove inspector and rpc crates (moved to own repos)
Some checks failed
Lint / lint-linux (pull_request) Failing after 25s
Tests with Services / test-linux (pull_request) Failing after 6m56s
a4df2bf92e
- crates/inspector/ moved to hero_inspector repo
- crates/rpc/ moved to hero_rpc repo
- Remove inspector from workspace members in Cargo.toml

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Some checks failed
Lint / lint-linux (pull_request) Failing after 25s
Tests with Services / test-linux (pull_request) Failing after 6m56s
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin development_features:development_features
git switch development_features

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch development
git merge --no-ff development_features
git switch development_features
git rebase development
git switch development
git merge --ff-only development_features
git switch development_features
git rebase development
git switch development
git merge --no-ff development_features
git switch development
git merge --squash development_features
git switch development
git merge --ff-only development_features
git switch development
git merge development_features
git push origin development
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_lib!111
No description provided.