pub fn try_daemon_tool_call_blocking(
name: &str,
arguments: Option<Value>,
) -> Option<String>Expand description
Blocking helper for CLI commands: routes a tool call through the daemon.
Returns None if no daemon can serve the call (caller then renders the tool
locally / standalone). Behaviour splits on caller identity:
- Normal CLI invocation: connects to a running daemon, and auto-starts
one if none is listening (so the long-lived
LeanCtxServerstate — caches, indexes, detectors — is reused across commands). - Shadow-mode hook child (
LEAN_CTX_HOOK_CHILDset): connect-only. It reuses an already-running daemon for full parity (thereadyfast-path below routes straight through/v1/tools/call→call_tool_guarded, so the in-memoryLoopDetector, correction-loop auto-degrade, bounce tracker and adaptive thresholds all fire on the daemon’s long-lived state — #566), but it MUST NEVER auto-start a daemon. A hook fires once per intercepted read/grep as a fresh process; auto-starting from there would spawn daemons uncontrollably. With no live daemon it returnsNoneand the caller falls back to the enriched standalone path (disk-backed learning sinks + Context IR from #550/#569).