Skip to main content

is_code_mode_eligible

Function is_code_mode_eligible 

Source
pub fn is_code_mode_eligible(
    name: &str,
    policy: &ToolPolicy,
    hints: &ToolHints,
) -> bool
Expand description

Whether a tool is eligible to be driven through Lua “code mode” (the tools.<name> table) rather than called directly.

This is the single source of truth shared by two call sites so they can never drift apart: the engine’s code-mode exposure ([gated_code_mode_tools]) and the lua_code_mode capability’s tool-definition filter (which hides exactly this set from the model). If the two used different predicates a tool could be hidden from the model yet not re-exposed in Lua — an unreachable tool.

Conservative gate (TM-LUA-009): Auto policy only (never approval- or client-side tools), non-destructive, non-cpu_bound, and never the execution tools themselves (lua/bash are excluded so code mode cannot re-enter a shell or itself).