Skip to content

Commit 6fca7f0

Browse files
committed
vigil: Janet plugin bridge and hooks (slice 4 of 5)
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.
1 parent 7776140 commit 6fca7f0

3 files changed

Lines changed: 450 additions & 0 deletions

File tree

src/main.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,6 +2138,17 @@ async fn main() -> anyhow::Result<()> {
21382138
(None, None, None, None, None)
21392139
} else {
21402140
let n = keeper.vigils.len();
2141+
#[cfg(feature = "plugin")]
2142+
{
2143+
if let Some(ref vig_tx) = keeper.vigil_plugin_tx {
2144+
crate::plugin::worker::vigil_bridge::install_vigil_tx(
2145+
vig_tx.clone(),
2146+
);
2147+
}
2148+
let names: Vec<String> =
2149+
keeper.vigils.iter().map(|v| v.name.clone()).collect();
2150+
crate::plugin::worker::vigil_bridge::install_vigil_names(names);
2151+
}
21412152
eprintln!("info: vigil-keeper started with {n} vigil(s)");
21422153
let wake = keeper.wake_rx.take();
21432154
let obs = keeper.observance_rx.take();

src/plugin/loader.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ pub const HOOK_NAMES: &[&str] = &[
3737
// ctx :messages (JSON); may call harness/set-compact-summary to
3838
// supply a summary instead of the LLM summarizer.
3939
"on-compact",
40+
// --- vigil hooks (dirge-vigil) ---
41+
"on-vigil-event",
42+
"on-vigil-reap",
43+
"on-vigil-observance",
4044
];
4145

4246
/// Filter an input candidate list to only paths that exist as

0 commit comments

Comments
 (0)