Skip to content

feat(vigil): Janet plugin bridge and hooks (slice 4 of 5) - #819

Draft
allen-munsch wants to merge 1 commit into
vigil/03-tui-wiringfrom
vigil/04-plugin-bridge
Draft

feat(vigil): Janet plugin bridge and hooks (slice 4 of 5)#819
allen-munsch wants to merge 1 commit into
vigil/03-tui-wiringfrom
vigil/04-plugin-bridge

Conversation

@allen-munsch

Copy link
Copy Markdown
Collaborator

Summary

Slice 4 of the vigil feature stack: the Janet plugin bridge and lifecycle hooks. This is the piece that lets Janet plugins interact with the running vigil-keeper at runtime.

  • Exposes vigil/live?, vigil/emit, vigil/list, vigil/get, and vigil/set-state to Janet plugins via a process-global OnceLock bridge in the plugin worker.
  • Registers the three vigil lifecycle hooks (on-vigil-event, on-vigil-reap, on-vigil-observance) in the loader so harness/register-hook accepts them.
  • Installs the keeper's plugin event channel into the bridge at startup so (vigil/emit name data) reaches the keeper router across the worker/runtime thread boundary.

Scope

  • src/plugin/worker.rs — the vigil_bridge module (statics, install functions, C functions, HARNESS_VIGIL_INIT prelude) plus unit tests.
  • src/plugin/loader.rs — three hook names appended to HOOK_NAMES.
  • src/main.rs — installs vigil_plugin_tx + vigil names after the keeper is created (behind #[cfg(feature = "plugin")], nested inside the existing #[cfg(feature = "vigil")] region).

Stack

Testing

Local reproduction of the CI matrix before opening:

  • cargo build --bin dirge for vigil, plugin, windows-default, no-plugin, and default feature sets — all clean.
  • cargo clippy --bin dirge for all-features, windows-default, no-plugin, and default — zero warnings.
  • cargo fmt --all --check — clean.
  • cargo test --bin dirge --all-features -- --skip sandbox::microvm --skip ui::relay_tests5925 passed, 0 failed.

Known environment-dependent gaps (not caused by this change, and not exercised in CI):

  • The 13 sandbox::microvm OCI-image tests fail locally (podman/buildah environment).
  • The ui::relay_tests PTY integration tests hang locally under load; they are gated on sandbox-microvm and unrelated to the plugin bridge.

Self-review notes

  • vigil_bridge::json_to_janet duplicates the existing free json_to_janet (which goes through a depth-limited json_to_janet_depth). The bridge copy is recursive without a depth cap, so a pathologically nested value set via vigil/set-state could recurse deeply. It's bounded by what a plugin sets, but reusing the depth-limited free function would be cleaner.
  • The module-level doc comment still says "Thread-local mpsc sender" while the code (and the comment directly below it) correctly use a process-global OnceLock; that first line is stale and should be corrected.

Expose vigil/* Janet functions (live?, emit, list, get, set-state) to
plugins via a process-global OnceLock bridge in the plugin worker, and
register the three vigil lifecycle hooks (on-vigil-event, on-vigil-reap,
on-vigil-observance) in the loader. The keeper's plugin event channel is
installed into the bridge at startup so (vigil/emit ...) reaches the
keeper router across the worker/runtime thread boundary.
@allen-munsch
allen-munsch force-pushed the vigil/04-plugin-bridge branch from 8a964ba to 6fca7f0 Compare August 26, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant