Hero OS service running Rhai, Nushell, and Python scripts in isolated worker pools.
  • JavaScript 45%
  • Rust 43.2%
  • HTML 7.1%
  • CSS 4.7%
Find a file
omarz 4fa33122d6
All checks were successful
lab release / release (push) Successful in 40m17s
fix(admin): wrap $ref struct params in standalone editor pages
The job/file editor and job-output pages each have their own bespoke direct-fetch
RPC helper that bypasses rpc.js and sent params flat, so struct-param methods
failed with "missing field input":
- job_editor.js: job.submit (New Job form)
- file_editor.js: file.write, job.submit
- job_output.js: job.logs

Add a small per-page wrap map keyed by full method name; scalar-param methods
(file.read, job.get) stay flat. Verified the New Job editor submits and runs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 18:11:20 +02:00
.cargo hero_builder: add musl cross-compilation support and documentation 2026-05-08 22:19:37 +02:00
.codegraph chore: auto-commit local changes before pull 2026-06-24 13:36:02 +02:00
.forgejo/workflows ci: unify workflows to a single lab-release thin caller 2026-06-18 16:54:44 +02:00
crates fix(admin): wrap $ref struct params in standalone editor pages 2026-06-24 18:11:20 +02:00
.gitignore feat: branch management, bulk tagging, job proxy, and cache fixes 2026-06-15 10:08:30 +02:00
Cargo.lock refactor(server): convert hero_code_server to clean multi-domain OpenRPC 2026-06-24 16:44:24 +02:00
Cargo.toml refactor(server): convert hero_code_server to clean multi-domain OpenRPC 2026-06-24 16:44:24 +02:00
README.md chore: rename FORGEJO_TOKEN→FORGE_TOKEN and HERO_SOCKET_DIR→PATH_SOCKET, prune stale env vars 2026-05-26 12:28:19 +02:00
rust-toolchain.toml refactor: migrate service_base! to baso_info! and pin rust-version to 1.95.0 2026-06-01 07:36:41 +02:00

hero_code

Hero OS service — multi-language script execution engine.

Runs Rhai, Nushell, and Python scripts in isolated worker pools and exposes a JSON-RPC 2.0 interface over Unix sockets.

Binaries

Binary Role
hero_code_server Main RPC daemon — executes scripts, stores jobs
hero_code_admin Admin dashboard web UI (Unix socket: admin.sock)
hero_code CLI — registers and manages the service lifecycle

Sockets

Socket Purpose
$PATH_SOCKET/hero_code/rpc.sock JSON-RPC 2.0 API for script execution
$PATH_SOCKET/hero_code/admin.sock Admin dashboard HTTP

Languages Supported

  • Rhai — embedded scripting (pre-forked worker pool)
  • Nushell — shell-style scripting (pre-forked worker pool)
  • Python — via uv external process runner

Service Lifecycle

lab service code --install # build + install all binaries
lab service code --start # register with hero_proc and start
lab service code --stop # stop all binaries
lab service code --status # status of all binaries

Architecture

  1. Worker pools for Rhai and Nushell are pre-forked before the tokio runtime starts (required to avoid unsafe fork() in a multithreaded process).
  2. The tokio runtime then starts the JSON-RPC HTTP server on rpc.sock.
  3. Jobs are stored in a local SQLite database (~/hero/var/hero_code.db).
  4. The admin UI is a separate Axum process registered with hero_proc.