Hero Script tab: show bundled example scripts from examples/rhai/ #31
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_proc#31
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
hero_procrepo ships example Rhai scripts inexamples/rhai/— these are ready-to-useinstall_and_run.rhaiscripts for each Hero service (hero_runner, hero_proxy, hero_aibroker, hero_os, etc.). However, the Hero Script tab in the UI only shows scripts from~/hero/cfg/proc/(user scripts). There is no way for users to discover or browse the bundled examples from the UI.Currently the only workaround is to manually symlink the example scripts into
~/hero/cfg/proc/, which only works for the local machine and doesn't scale.Proposed Solution
Make the Hero Script tab aware of two script sources:
~/hero/cfg/proc/(current behavior, read-write)examples/rhai/from the hero_proc repo (read-only, bundled)UI Requirements
~/hero/cfg/proc/so the user can customize itBackend Requirements
script.listRPC method needs to return both sources, with a flag indicating which source each script comes from (e.g.,"source": "examples"vs"source": "user")script.getRPC method needs to resolve paths from both rootsscript.setandscript.deletemethods must reject writes to the examples treescript.runmethod should work for both sources../examples/rhai/(works for dev builds)HERO_PROC_EXAMPLES_DIR)Current Example Scripts
More will be added as services are migrated (issue #29).
Context
This is part of the broader effort to make Rhai scripts the standard way to manage Hero service lifecycle (issue #29). Having the examples discoverable in the UI makes it much easier for users to get started.
Implemented in commit
d807672ondevelopment.Changes
Backend (
hero_proc_server)examples_root()— locates bundledexamples/rhai/viaHERO_PROC_EXAMPLES_DIRenv var or by walking ancestors of the executablescript.listnow returns scripts from both user and examples directories, each tagged with"source": "user"or"source": "example"script.get/script.runaccept optionalsourceparam to resolve from either rootscript.set/script.deletereject writes to example scripts ("read-only")OpenRPC spec
sourcefield to list items and optionalsourceparam to get/set/delete/run methodsUI