hackagent.attacks.techniques.static.h4rm3l.decorators.compiler
Public facade and compiler for the h4rm3l decorator engine.
is_llm_assisted_decorator_name
def is_llm_assisted_decorator_name(name: str) -> bool
Return True if the decorator class name is LLM-assisted.
compile_program
def compile_program(
program: str,
syntax_version: int = 2,
*,
completion: Completion | None = None
) -> Callable[[str], DecorationResult]
Compile a decorator program string into a callable.
Arguments:
program- The program string (either v1 or v2 syntax).syntax_version-1for semicolon-separated,2for.then().completion- The model LLM-assisted decorators rewrite prompts with.
Returns:
A function (prompt) -> str | Awaitable[str] applying the chain.
Raises:
ValueError- Ifsyntax_versionis not 1 or 2, the program is not a valid decorator chain, or it uses an LLM-assisted decorator without acompletion.SyntaxError- If the program string cannot be parsed.
program_uses_llm_assisted_decorators
def program_uses_llm_assisted_decorators(program: str,
syntax_version: int = 2) -> bool
Return whether a program names at least one LLM-assisted decorator.