Skip to main content

execute_with_ledger

Function execute_with_ledger 

Source
pub async fn execute_with_ledger(
    substrate: &Arc<dyn Substrate>,
    ledger: &ReadLedger,
    tool: &str,
    params: &Value,
) -> Option<Result<Value, String>>
Expand description

Like execute, but threads a per-session ReadLedger so the built-in file tools enforce read-before-edit and content staleness: edit_file (and write_file over an existing file) require the session to have read the path first, and a successful read/write/edit records the current content so the next edit is licensed. Opt-in — every in-repo executor call site uses this so its agent gets the guard; the plain execute stays ungated for external consumers of the stable API.