openlatch-client 0.6.5

OpenLatch runtime enforcement node — the capture-and-enforce adapter that evaluates every covered action against a coding agent's Autonomy Zone before it runs
pub mod claude_code;
pub mod cline;
pub mod codex_cli;
pub mod cursor;

use crate::core::envelope::alias::AliasTable;

/// Every binding's alias table, in detection order.
fn tables() -> [&'static AliasTable; 4] {
    [
        &claude_code::ALIASES,
        &codex_cli::ALIASES,
        &cursor::ALIASES,
        &cline::ALIASES,
    ]
}

/// The alias table of the binding an event's `source` names, or `None` for a
/// source no binding answers for — an unknown agent, or a fork, whose tools
/// are then neither mapped nor claimed.
pub fn aliases_for(source: &str) -> Option<&'static AliasTable> {
    tables().into_iter().find(|table| table.agent == source)
}

/// The `olbinding` a lane decided through: the binding's own id for the lane
/// that is not a hook (Cline's enforcement plugin) when `renders`, otherwise
/// its hook. A source no binding answers for is `<source>_hook`.
pub fn binding_id(source: &str, renders: bool) -> String {
    match aliases_for(source) {
        Some(table) => table.binding_id(renders).to_string(),
        None => format!("{}_hook", source.replace('-', "_")),
    }
}