Coverage for core/langgraph/_builtins_functions.py: 100%
8 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-25 05:49 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-25 05:49 +0000
1"""
2_builtins_functions.py — deterministic, pure engine builtins for the function
3mechanism (ADR-0037 D4 call-expansion round).
5Implements the engine-owned pure builtin registered in the deterministic
6builtin register (00-process-contract § Deterministic builtin surface):
8- question-block-form deterministic human-interface question-block formation on
9 exhaustion/stage-escalation → {status, question_block}.
10 Pure (no LLM).
12The pure handler and its helpers live in the per-tool module
13tools/question_block_form.py (single source); this module's handler delegates.
14"""
15from __future__ import annotations
17from typing import Any
20def question_block_form(step: dict, state: dict) -> dict:
21 try:
22 from tools.question_block_form import question_block_form as _exec
23 except ImportError: # pragma: no cover — main.py run (qualified imports)
24 from langgraph.tools.question_block_form import question_block_form as _exec
25 return _exec(step, state)
28# ---------------------------------------------------------------------------
29# Registry helper
30# ---------------------------------------------------------------------------
33def register_all(executor: Any) -> None:
34 """Register the function-engine builtins on the executor (hyphen/underscore)."""
35 executor.register("question-block-form", question_block_form)