Coverage for little_loops / hooks / pre_tool_use.py: 100%
5 statements
« prev ^ index » next coverage.py v7.12.0, created at 2026-05-22 16:19 -0500
« prev ^ index » next coverage.py v7.12.0, created at 2026-05-22 16:19 -0500
1"""PreToolUse hook handler: no-op baseline for opt-in synchronous observability.
3Per FEAT-1489 (and FEAT-1488 research), this handler is registered as the
4pre-tool-use intent so future consumers (rate-limit enforcement, permission
5checks, tool-argument validation) can extend it. Today it returns a passing
6result with no side effects.
8**Opt-in only**: unlike ``post_tool_use``, this handler runs *synchronously*
9in the host's tool-execution path. The OpenCode adapter benchmark measured
10cold-start p95 ≈ 10ms (well below the 200ms target), so the cost when
11disabled is bounded — but users must explicitly opt in by editing host
12config to dispatch ``tool.execute.before`` (OpenCode) or ``PreToolUse``
13(Codex) to this intent. By default, neither adapter dispatches it.
15See ``hooks/adapters/opencode/README.md`` and
16``hooks/adapters/codex/README.md`` for opt-in instructions.
17"""
19from __future__ import annotations
21from little_loops.hooks.types import LLHookEvent, LLHookResult
24def handle(event: LLHookEvent) -> LLHookResult:
25 """Return a passing result. No-op baseline for future opt-in consumers."""
26 del event
27 return LLHookResult(exit_code=0)