Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.
fix/Inputs-pipe-ref · L-261004-f9aad5 (#1327)
Louis Choquel62d3a228dfb4
diff --git a/.drift/acks/cli-docs.toml b/.drift/acks/cli-docs.tomlindex 74c132367..3d5ce609a 100644--- a/.drift/acks/cli-docs.toml+++ b/.drift/acks/cli-docs.toml@@ -1,8 +1,8 @@contract = "cli-docs"-digest = "sha256:cadd09e33b7f32258183fed5533b8ca706a3254088eb806016991feef15abb4b"+digest = "sha256:0abffb6250cb4295f1533db1951fbf2cce547efd4ed746ae129c37fac680aa6d"reviewed_by = "Louis Choquel"-reviewed_at = "2026-10-04T00:24:06Z"-rationale = "clean-pass: pipe_cmd.py gains the PipeJudge emission branch writing question, model, options, levels, criteria and threshold; docs/tools/cli/ and pipelex/cli/agent_cli/CLAUDE.md describe the pipe command without listing pipe types or their fields, so nothing there went stale."+reviewed_at = "2026-10-04T11:52:31Z"+rationale = "real-catch: the inputs commands now print exactly success, pipe_ref and inputs, pipe_ref being the resolved qualified ref, with no message key on a pipe that declares no inputs; docs/tools/cli/agent-cli.md named the envelope success/pipe_code/inputs, so it now documents pipe_ref, its resolution and the no-inputs answer in JSON and TOML. pipelex/cli/agent_cli/CLAUDE.md describes the inputs command without its envelope keys and stays accurate."[trigger_files]"pipelex/cli/__init__.py" = "blob:8b137891791fe96927ad78e64b0aad7bded08bdc"@@ -27,11 +27,11 @@ rationale = "clean-pass: pipe_cmd.py gains the PipeJudge emission branch writing"pipelex/cli/agent_cli/commands/fmt_cmd.py" = "blob:97d6fb6c328e0b718b1293bd6b73cba03edcb7dc""pipelex/cli/agent_cli/commands/init_cmd.py" = "blob:f10c15f5f1c220cb5f9509336258eaa2d2a11967""pipelex/cli/agent_cli/commands/inputs/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"-"pipelex/cli/agent_cli/commands/inputs/_inputs_core.py" = "blob:d37826d96099028a1ad5dbc5cbf8ce0cfdb01e30"+"pipelex/cli/agent_cli/commands/inputs/_inputs_core.py" = "blob:57233a09522464bb95f14eda83d7849800785418""pipelex/cli/agent_cli/commands/inputs/app.py" = "blob:7e19284687b334c684fb03381a8d9d20af1aa152"-"pipelex/cli/agent_cli/commands/inputs/bundle_cmd.py" = "blob:fcff51a97ae081a4fb40273dd6ec85c521179993"-"pipelex/cli/agent_cli/commands/inputs/method_cmd.py" = "blob:025f52a0d9703ea8dbe30f2a466f925eaed03ae9"-"pipelex/cli/agent_cli/commands/inputs/pipe_cmd.py" = "blob:d109d3103b2ad851d281a9ef1a91e2822e92926e"+"pipelex/cli/agent_cli/commands/inputs/bundle_cmd.py" = "blob:a3cab23f83f375f7571f86c16b54904cd2045449"+"pipelex/cli/agent_cli/commands/inputs/method_cmd.py" = "blob:56fc7edc47ec9513d4e289010c42405df351544e"+"pipelex/cli/agent_cli/commands/inputs/pipe_cmd.py" = "blob:bdddcc8f1bf6e5437ab4375b1c601ee66bee994f""pipelex/cli/agent_cli/commands/lint_cmd.py" = "blob:91ad9cb4d618ba4c0b7da366cde2f74f38d350df""pipelex/cli/agent_cli/commands/migrate_cmd.py" = "blob:ce733b78df03e65c3c8a10d46b27b57c05ec054c""pipelex/cli/agent_cli/commands/models_cmd.py" = "blob:5678c00ab389b0a433c080be3454c7905e569308"diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 491fa4afa..d64fe1983 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,7 @@- **The native concepts are pinned at MTHDS 3.0.0: `YesNo` gains a probability, and `Choice` and `Rating` are added (Breaking)**: `YesNo` carries an optional `probability`, which a `PipeLLM` whose output is `YesNo` may fill with the model's own estimate; `Choice` (an option key, with optional `confidence` and `probabilities`) and `Rating` (a level index, with optional `confidence`, `probabilities` and `position`) are new natives, so a bundle declaring a concept named `Choice` or `Rating` must rename it. A `YesNo` written to the wire carries `"probability": null` when none was reported, the output-form descriptor states a `YesNo` result as an object carrying `yes_no` and `probability` while an input stays a bare boolean, and a crate's normalized fingerprint changes wherever it materializes `YesNo`. Python callers read the new verdicts with `main_stuff_as_choice` and `main_stuff_as_rating`. Every measure is a strict number, so a boolean or a numeric string is refused rather than read as `1.0` or `0.9`; and a `PipeDocGen` office template or auto-layout sees a verdict as its verdict alone, while a `pdf` template reads it whole.- **The method-app template and the SDK references link `Pipelex/pipelex-sdk`**: the SDKs and the method-app templates now live in the `Pipelex/pipelex-sdk` repository, so the README and the documentation's **Quick Start** link the method-app template to its `method-apps/` directory, the webapp's by-hand commands clone it and copy `method-apps/webapp-js/`, and the `@pipelex/sdk` and `pipelex-sdk` references point at its `js/docs/` and `python/docs/` directories.- **Boot builds the secrets provider before the log sink, and a sink factory receives it (Breaking)**: a `LogSinkFactoryFn` is now called as `factory(log_config, secrets_provider=…)`, and the plugin API version moves to 5, so a plugin declaring `targets_api = 4` is refused at discovery and is rebuilt against this release. A secrets provider that fails to build now reports on stderr, redacted, rather than through the configured sink.+- **`pipelex-agent inputs` names the pipe `pipe_ref`, qualified (Breaking)**: the JSON success envelope of `inputs bundle`, `inputs pipe` and `inputs method` is `{success, pipe_ref, inputs}`, as `mthds-agent` prints on the API runner, where it was `pipe_code`. The value is the qualified `domain.pipe_code` of the pipe that was resolved, so a bare `--pipe summarize` answers `doc.summarize` and a dependency pipe keeps its `alias->` prefix, and a pipe that declares no inputs names its pipe too, where it printed `null` when `--pipe` was omitted, and no longer adds a `message` key. That pipe's message, the TOML comment here and the line `pipelex build inputs` and `pipelex codegen inputs` print, now reads `Pipe '<pipe_ref>' declares no inputs.`### Fixeddiff --git a/docs/tools/cli/agent-cli.md b/docs/tools/cli/agent-cli.mdindex b7276b29e..fc805d8de 100644--- a/docs/tools/cli/agent-cli.md+++ b/docs/tools/cli/agent-cli.md@@ -125,11 +125,23 @@ pipelex-agent inputs method <NAME> [OPTIONS]For `bundle` and `method`, use `--pipe` to target a specific pipe.+The JSON success envelope names the pipe the template was generated for as `pipe_ref`, the qualified `domain.pipe_code` of the pipe that was resolved, whether you named it with a bare code, a qualified ref, or let it default to the bundle's `main_pipe`. A pipe you reached through a dependency alias keeps that alias, `alias->domain.pipe_code`, since that is the ref that selects it again:++```json+{+ "success": true,+ "pipe_ref": "my_domain.main_pipe",+ "inputs": { ... }+}+```++A pipe that declares no inputs is not an error: the envelope carries `"inputs": {}` and the command exits `0`; under `--format toml` it prints the comment `# Pipe 'my_domain.main_pipe' declares no inputs.`+!!! note "`inputs --format` is `json|toml`, not `markdown|json`"Unlike `run`/`validate`, the `inputs` command's `--format` selects the **template serialization**, not a presentation style. `json` (the default) emits the structured JSON success envelope; `toml` prints the raw TOML template straight to stdout (a pipe with no inputs prints a TOML comment line, which loads back as an empty dict). This mirrors the raw-TOML output of the `concept` and `pipe` commands. `inputs` has no `--error-format` — its errors stay JSON.!!! note "`--explicit` and concept hints"- The light `--format toml` template carries the declared concept for each key as a `# concept: ...` comment; the light `--format json` template (the default) cannot (JSON has no comments), so pass `--explicit` when you want the concept written out inline. The JSON success envelope shape (`success` / `pipe_code` / `inputs`) is unchanged — only the `inputs` payload flips between the light values and the envelope form.+ The light `--format toml` template carries the declared concept for each key as a `# concept: ...` comment; the light `--format json` template (the default) cannot (JSON has no comments), so pass `--explicit` when you want the concept written out inline. The JSON success envelope shape (`success` / `pipe_ref` / `inputs`) is unchanged — only the `inputs` payload flips between the light values and the envelope form.### Flat Commandsdiff --git a/pipelex/builder/operations/inputs_ops.py b/pipelex/builder/operations/inputs_ops.pyindex ded4e5dd8..c28a659db 100644--- a/pipelex/builder/operations/inputs_ops.py+++ b/pipelex/builder/operations/inputs_ops.py@@ -5,9 +5,11 @@ from __future__ import annotationsimport jsonfrom typing import TYPE_CHECKING, Any+from pipelex.core.pipes.inputs.exceptions import NoInputsRequiredError+from pipelex.core.qualified_ref import QualifiedReffrom pipelex.interpreter_hub import get_library_manager, get_required_entry_pipe, resolve_library_dirs, set_current_libraryfrom pipelex.pipe_machinery.pipe_factory import PipeFactory-from pipelex.pipe_machinery.rendering.input_renderer import build_concept_comments, render_inputs+from pipelex.pipe_machinery.rendering.input_renderer import build_concept_comments, no_inputs_message, render_inputsfrom pipelex.pipeline.blueprint_selection import select_primary_blueprintfrom pipelex.pipeline.validate_bundle import validate_bundle@@ -36,7 +38,9 @@ async def build_inputs_for_pipe(explicit: When True, emit the ceremonial envelope form; when False (default), the light shape.Returns:- Dictionary with inputs suitable for JSON serialization.+ Dictionary with ``success``, the resolved ``pipe_ref``, the ``inputs`` template and the+ internal ``concept_comments``. A pipe that declares no inputs answers with empty ``inputs``+ and an internal ``no_inputs_message`` saying so.Raises:ValidateBundleError: If bundle validation fails.@@ -79,7 +83,27 @@ async def build_inputs_for_pipe(raise ValueError(msg)the_pipe = get_required_entry_pipe(pipe_code=pipe_code)- inputs_json_str = render_inputs(the_pipe, indent=2, explicit=explicit)+ # The envelope names the pipe that was resolved, always domain-qualified, never the selector+ # the caller typed: a bare code and an omitted one both answer with the same `pipe_ref`. A+ # dependency pipe keeps the alias it was reached through, since only `alias->domain.code`+ # selects it again; the pipe itself does not know its alias.+ pipe_ref = the_pipe.pipe_ref+ if QualifiedRef.has_cross_package_prefix(pipe_code):+ alias, _ = QualifiedRef.split_cross_package_ref(pipe_code)+ pipe_ref = f"{alias}->{pipe_ref}"+ try:+ inputs_json_str = render_inputs(the_pipe, indent=2, explicit=explicit)+ except NoInputsRequiredError:+ # A pipe that declares no inputs is an answer, not a failure: its template is empty. The+ # message is rebuilt from the reported ref rather than taken from the renderer, whose ref+ # cannot carry the dependency alias.+ return {+ "success": True,+ "pipe_ref": pipe_ref,+ "inputs": {},+ "concept_comments": {},+ "no_inputs_message": no_inputs_message(pipe_ref=pipe_ref),+ }inputs_dict = json.loads(inputs_json_str)# concept_comments is internal plumbing for the light-TOML emitter (stripped before the JSON@@ -87,7 +111,7 @@ async def build_inputs_for_pipe(# the human `build inputs --format toml` does.return {"success": True,- "pipe_code": pipe_code,+ "pipe_ref": pipe_ref,"inputs": inputs_dict,"concept_comments": build_concept_comments(the_pipe.inputs),}diff --git a/pipelex/cli/agent_cli/commands/inputs/_inputs_core.py b/pipelex/cli/agent_cli/commands/inputs/_inputs_core.pyindex d37826d96..57233a095 100644--- a/pipelex/cli/agent_cli/commands/inputs/_inputs_core.py+++ b/pipelex/cli/agent_cli/commands/inputs/_inputs_core.py@@ -18,17 +18,17 @@ async def inputs_core("""Core logic for generating input JSON for a pipe.Args:- pipe_code: The pipe code to generate inputs for.+ pipe_code: The pipe to generate inputs for, a bare code or a qualified ref.bundle_path: Path to the bundle file (.mthds).library_dirs: List of library directories to search for pipe definitions.explicit: When True, emit the ceremonial envelope form; when False (default), the light shape.Returns:- Dictionary with inputs suitable for JSON serialization.+ The inputs-generation result: ``success``, the resolved ``pipe_ref``, ``inputs``, and the+ internal ``concept_comments`` and ``no_inputs_message``.Raises:ValidateBundleError: If bundle validation fails.- NoInputsRequiredError: If the pipe has no inputs."""return await build_inputs_for_pipe(pipe_code=pipe_code,@@ -46,46 +46,28 @@ def emit_inputs_result(result: dict[str, Any], *, template_format: InputsTemplatcommands. The default light template needs the inline-table layout (``light=True``) so abare scalar declared after a structured value stays valid TOML, and carries the declaredconcept as a ``# concept: ...`` comment per key (same hints the human ``build inputs --format- toml`` writes); ``--explicit`` restores the all-tables envelope layout.+ toml`` writes); ``--explicit`` restores the all-tables envelope layout. A pipe that declares+ no inputs prints its ``no_inputs_message`` as a comment line, valid TOML that loads back as an+ empty dict.- ``concept_comments`` is internal plumbing: it is stripped here so the JSON envelope stays the- plain ``success``/``pipe_code``/``inputs`` shape and is only consumed by the light-TOML path.+ ``concept_comments`` and ``no_inputs_message`` are internal plumbing: they are stripped here so+ the JSON envelope stays the plain ``success``/``pipe_ref``/``inputs`` shape, the same on every+ runner, and are only consumed by the TOML path.Args:- result: The inputs-generation result (``success``/``pipe_code``/``inputs`` + internal- ``concept_comments``).+ result: The inputs-generation result (``success``/``pipe_ref``/``inputs`` + internal+ ``concept_comments`` and ``no_inputs_message``).template_format: The requested inputs template format.explicit: Whether ``result["inputs"]`` is the envelope form (True) or the light form (False)."""concept_comments = cast("dict[str, str] | None", result.pop("concept_comments", None))+ no_inputs_message = cast("str | None", result.pop("no_inputs_message", None))match template_format:case InputsTemplateFormat.JSON:agent_success(result)case InputsTemplateFormat.TOML:+ if no_inputs_message is not None:+ print(f"# {no_inputs_message}")+ returntoml_content = serialize_inputs_template_to_toml(result["inputs"], light=not explicit, concept_comments=concept_comments)print(toml_content, end="" if toml_content.endswith("\n") else "\n")---def emit_no_inputs_result(*, pipe_code: str | None, message: str, template_format: InputsTemplateFormat) -> None:- """Emit the not-an-error result for a pipe that requires no inputs.-- JSON keeps the structured envelope with an empty ``inputs`` dict; TOML- prints a comment line — valid TOML that loads back as an empty dict.-- Args:- pipe_code: The pipe code the inputs were requested for, if known.- message: The human-readable no-inputs-required message.- template_format: The requested inputs template format.- """- match template_format:- case InputsTemplateFormat.JSON:- agent_success(- {- "success": True,- "pipe_code": pipe_code,- "inputs": {},- "message": message,- }- )- case InputsTemplateFormat.TOML:- print(f"# {message}")diff --git a/pipelex/cli/agent_cli/commands/inputs/bundle_cmd.py b/pipelex/cli/agent_cli/commands/inputs/bundle_cmd.pyindex fcff51a97..a3cab23f8 100644--- a/pipelex/cli/agent_cli/commands/inputs/bundle_cmd.py+++ b/pipelex/cli/agent_cli/commands/inputs/bundle_cmd.py@@ -11,9 +11,8 @@ import typerfrom pipelex.builder.conventions import DEFAULT_BUNDLE_FILE_NAMEfrom pipelex.cli.agent_cli.commands.agent_cli_factory import make_pipelex_for_agent_clifrom pipelex.cli.agent_cli.commands.agent_output import agent_error, extract_validation_errors-from pipelex.cli.agent_cli.commands.inputs._inputs_core import emit_inputs_result, emit_no_inputs_result, inputs_core+from pipelex.cli.agent_cli.commands.inputs._inputs_core import emit_inputs_result, inputs_corefrom pipelex.core.pipes.exceptions import PipeOperatorModelChoiceError-from pipelex.core.pipes.inputs.exceptions import NoInputsRequiredErrorfrom pipelex.mthds_parsing.helpers import MTHDS_EXTENSION, is_pipelex_filefrom pipelex.pipe_machinery.rendering.input_renderer import InputsTemplateFormatfrom pipelex.pipe_operators.exceptions import PipeOperatorModelAvailabilityError@@ -93,12 +92,11 @@ def inputs_bundle_cmd(error_type="ArgumentError",)- pipe_code: str | None = pipelibrary_dirs = [Path(lib_dir) for lib_dir in library_dir] if library_dir else Nonemake_pipelex_for_agent_cli(library_dirs=library_dirs, needs_inference=False, needs_model_specs=True)try:- result = asyncio.run(inputs_core(pipe_code=pipe_code, bundle_path=Path(bundle_path), library_dirs=library_dirs, explicit=explicit)) # type: ignore[arg-type]+ result = asyncio.run(inputs_core(pipe_code=pipe, bundle_path=Path(bundle_path), library_dirs=library_dirs, explicit=explicit)) # type: ignore[arg-type]emit_inputs_result(result, template_format=template_format, explicit=explicit)except FileNotFoundError as exc:@@ -108,9 +106,6 @@ def inputs_bundle_cmd(# A failing dry run rides validation_errors as one located dry_run item per failing pipe.agent_error(exc.message, error_type="ValidateBundleError", cause=exc, validation_errors=extract_validation_errors(exc))- except NoInputsRequiredError as exc:- emit_no_inputs_result(pipe_code=pipe_code, message=str(exc), template_format=template_format)-except PipeOperatorModelChoiceError as exc:agent_error(exc.message,diff --git a/pipelex/cli/agent_cli/commands/inputs/method_cmd.py b/pipelex/cli/agent_cli/commands/inputs/method_cmd.pyindex 025f52a0d..56fc7edc4 100644--- a/pipelex/cli/agent_cli/commands/inputs/method_cmd.py+++ b/pipelex/cli/agent_cli/commands/inputs/method_cmd.py@@ -10,10 +10,9 @@ import typerfrom pipelex.cli.agent_cli.commands.agent_cli_factory import make_pipelex_for_agent_clifrom pipelex.cli.agent_cli.commands.agent_output import agent_error, extract_validation_errors-from pipelex.cli.agent_cli.commands.inputs._inputs_core import emit_inputs_result, emit_no_inputs_result, inputs_core+from pipelex.cli.agent_cli.commands.inputs._inputs_core import emit_inputs_result, inputs_corefrom pipelex.cli.method_resolver import resolve_method_targetfrom pipelex.core.pipes.exceptions import PipeOperatorModelChoiceError-from pipelex.core.pipes.inputs.exceptions import NoInputsRequiredErrorfrom pipelex.methods.exceptions import MethodRefErrorfrom pipelex.pipe_machinery.rendering.input_renderer import InputsTemplateFormatfrom pipelex.pipe_operators.exceptions import PipeOperatorModelAvailabilityError@@ -89,9 +88,6 @@ def inputs_method_cmd(# A failing dry run rides validation_errors as one located dry_run item per failing pipe.agent_error(exc.message, error_type="ValidateBundleError", cause=exc, validation_errors=extract_validation_errors(exc))- except NoInputsRequiredError as exc:- emit_no_inputs_result(pipe_code=pipe_code, message=str(exc), template_format=template_format)-except PipeOperatorModelChoiceError as exc:agent_error(exc.message,diff --git a/pipelex/cli/agent_cli/commands/inputs/pipe_cmd.py b/pipelex/cli/agent_cli/commands/inputs/pipe_cmd.pyindex d109d3103..bdddcc8f1 100644--- a/pipelex/cli/agent_cli/commands/inputs/pipe_cmd.py+++ b/pipelex/cli/agent_cli/commands/inputs/pipe_cmd.py@@ -10,10 +10,9 @@ import typerfrom pipelex.cli.agent_cli.commands.agent_cli_factory import make_pipelex_for_agent_clifrom pipelex.cli.agent_cli.commands.agent_output import agent_error, extract_validation_errors-from pipelex.cli.agent_cli.commands.inputs._inputs_core import emit_inputs_result, emit_no_inputs_result, inputs_core+from pipelex.cli.agent_cli.commands.inputs._inputs_core import emit_inputs_result, inputs_corefrom pipelex.cli.method_resolver import resolve_pipe_from_exportsfrom pipelex.core.pipes.exceptions import PipeOperatorModelChoiceError-from pipelex.core.pipes.inputs.exceptions import NoInputsRequiredErrorfrom pipelex.mthds_parsing.helpers import MTHDS_EXTENSION, is_pipelex_filefrom pipelex.pipe_machinery.rendering.input_renderer import InputsTemplateFormatfrom pipelex.pipe_operators.exceptions import PipeOperatorModelAvailabilityError@@ -88,10 +87,6 @@ def inputs_pipe_cmd(# A failing dry run rides validation_errors as one located dry_run item per failing pipe.agent_error(exc.message, error_type="ValidateBundleError", cause=exc, validation_errors=extract_validation_errors(exc))- except NoInputsRequiredError as exc:- # Not really an error - just a pipe with no inputs- emit_no_inputs_result(pipe_code=pipe_code, message=str(exc), template_format=template_format)-except PipeOperatorModelChoiceError as exc:agent_error(exc.message,diff --git a/pipelex/pipe_machinery/rendering/input_renderer.py b/pipelex/pipe_machinery/rendering/input_renderer.pyindex 58e1f04db..036f35956 100644--- a/pipelex/pipe_machinery/rendering/input_renderer.py+++ b/pipelex/pipe_machinery/rendering/input_renderer.py@@ -18,6 +18,11 @@ class InputsTemplateFormat(StrEnum):TOML = "toml"+def no_inputs_message(*, pipe_ref: str) -> str:+ """The sentence every inputs surface answers with for a pipe that declares no inputs."""+ return f"Pipe '{pipe_ref}' declares no inputs."++def build_inputs_template(the_pipe: PipeAbstract, *, explicit: bool = False) -> dict[str, Any]:"""Build the inputs template dict for a pipe.@@ -38,8 +43,7 @@ def build_inputs_template(the_pipe: PipeAbstract, *, explicit: bool = False) ->NoInputsRequiredError: If the pipe has no inputs"""if not the_pipe.inputs.root:- msg = f"No inputs required for pipe '{the_pipe.code}'."- raise NoInputsRequiredError(msg)+ raise NoInputsRequiredError(no_inputs_message(pipe_ref=the_pipe.pipe_ref))envelope_template = the_pipe.inputs.build_inputs_template(concept_provider=get_concept_library())if explicit:diff --git a/tests/unit/pipelex/builder/operations/test_inputs_ops.py b/tests/unit/pipelex/builder/operations/test_inputs_ops.pyindex 7a67602a4..cb2fe2c88 100644--- a/tests/unit/pipelex/builder/operations/test_inputs_ops.py+++ b/tests/unit/pipelex/builder/operations/test_inputs_ops.py@@ -10,6 +10,7 @@ from typing import TYPE_CHECKING, Anyimport pytestfrom pipelex.builder.operations.inputs_ops import build_inputs_for_pipe+from pipelex.core.pipes.inputs.exceptions import NoInputsRequiredErrorif TYPE_CHECKING:from pytest_mock import MockerFixture@@ -31,7 +32,8 @@ class TestBuildInputsForPipe:"resolve_library_dirs": mocker.patch(f"{MODULE}.resolve_library_dirs", return_value=([], "defaults")),"validate_bundle": mocker.patch(f"{MODULE}.validate_bundle", new=mocker.AsyncMock(return_value=validate_result)),"get_required_entry_pipe": mocker.patch(- f"{MODULE}.get_required_entry_pipe", return_value=SimpleNamespace(code="bundle_main", inputs=SimpleNamespace(root={}))+ f"{MODULE}.get_required_entry_pipe",+ return_value=SimpleNamespace(code="bundle_main", pipe_ref="demo_domain.bundle_main", inputs=SimpleNamespace(root={})),),"render_inputs": mocker.patch(f"{MODULE}.render_inputs", return_value='{\n "topic": "your topic"\n}'),}@@ -46,10 +48,12 @@ class TestBuildInputsForPipe:])+ ops_mocks["get_required_entry_pipe"].return_value = SimpleNamespace(code="main", pipe_ref="domain.main", inputs=SimpleNamespace(root={}))+result = asyncio.run(build_inputs_for_pipe(mthds_contents=["mthds content"]))ops_mocks["get_required_entry_pipe"].assert_called_once_with(pipe_code="domain.main")- assert result["pipe_code"] == "domain.main"+ assert result["pipe_ref"] == "domain.main"def test_mthds_contents_validates_with_allow_signatures(self, ops_mocks: dict[str, Any]) -> None:"""The mthds_contents branch validates with allow_signatures=True — placeholders are tolerated on purpose."""@@ -76,11 +80,15 @@ class TestBuildInputsForPipe:asyncio.run(build_inputs_for_pipe(mthds_contents=["mthds content"]))def test_mthds_contents_explicit_pipe_code_skips_scan(self, ops_mocks: dict[str, Any]) -> None:- """An explicit pipe code is used verbatim, ignoring the blueprints' main_pipe declarations."""+ """An explicit pipe code selects the pipe verbatim, and the result names the pipe it resolved to, qualified."""+ ops_mocks["get_required_entry_pipe"].return_value = SimpleNamespace(+ code="explicit_pipe", pipe_ref="demo_domain.explicit_pipe", inputs=SimpleNamespace(root={})+ )+result = asyncio.run(build_inputs_for_pipe(pipe_code="explicit_pipe", mthds_contents=["mthds content"]))ops_mocks["get_required_entry_pipe"].assert_called_once_with(pipe_code="explicit_pipe")- assert result["pipe_code"] == "explicit_pipe"+ assert result["pipe_ref"] == "demo_domain.explicit_pipe"def test_bundle_path_validates_file_and_qualifies_main_pipe(self, ops_mocks: dict[str, Any], tmp_path: Path) -> None:"""The bundle_path branch validates by file path and domain-qualifies the bundle's main_pipe."""@@ -94,7 +102,7 @@ class TestBuildInputsForPipe:allow_signatures=True,)ops_mocks["get_required_entry_pipe"].assert_called_once_with(pipe_code="demo_domain.bundle_main")- assert result["pipe_code"] == "demo_domain.bundle_main"+ assert result["pipe_ref"] == "demo_domain.bundle_main"def test_bundle_path_without_main_pipe_raises_with_path(self, ops_mocks: dict[str, Any], tmp_path: Path) -> None:"""A bundle file without a main_pipe raises a ValueError naming the bundle path."""@@ -107,11 +115,15 @@ class TestBuildInputsForPipe:assert str(bundle_path) in str(exc_info.value)def test_bundle_path_explicit_pipe_code_wins(self, ops_mocks: dict[str, Any], tmp_path: Path) -> None:- """With a bundle path, an explicit pipe code overrides the bundle's main_pipe."""+ """With a bundle path, an explicit pipe code overrides the bundle's main_pipe, and the result names it qualified."""+ ops_mocks["get_required_entry_pipe"].return_value = SimpleNamespace(+ code="explicit_pipe", pipe_ref="demo_domain.explicit_pipe", inputs=SimpleNamespace(root={})+ )+result = asyncio.run(build_inputs_for_pipe(pipe_code="explicit_pipe", bundle_path=tmp_path / "demo.mthds"))ops_mocks["get_required_entry_pipe"].assert_called_once_with(pipe_code="explicit_pipe")- assert result["pipe_code"] == "explicit_pipe"+ assert result["pipe_ref"] == "demo_domain.explicit_pipe"def test_no_bundle_loads_libraries_from_resolved_dirs(self, ops_mocks: dict[str, Any]) -> None:"""Without a bundle, the library is opened, set current, and non-empty resolved dirs are loaded."""@@ -141,14 +153,44 @@ class TestBuildInputsForPipe:ops_mocks["get_required_entry_pipe"].assert_not_called()def test_happy_path_return_shape(self, ops_mocks: dict[str, Any]) -> None:- """The result carries success, the resolved pipe code, and the parsed inputs dict from render_inputs."""+ """The result carries success, the resolved pipe ref, and the parsed inputs dict from render_inputs."""result = asyncio.run(build_inputs_for_pipe(pipe_code="my_pipe"))the_pipe = ops_mocks["get_required_entry_pipe"].return_valueops_mocks["render_inputs"].assert_called_once_with(the_pipe, indent=2, explicit=False)assert result == {"success": True,- "pipe_code": "my_pipe",+ "pipe_ref": "demo_domain.bundle_main","inputs": {"topic": "your topic"},"concept_comments": {},}++ def test_pipe_without_inputs_answers_an_empty_template(self, ops_mocks: dict[str, Any], tmp_path: Path) -> None:+ """A pipe that declares no inputs is an answer: empty inputs, the resolved pipe ref, and a message naming that ref for the TOML path."""+ ops_mocks["render_inputs"].side_effect = NoInputsRequiredError("the renderer's own wording")++ result = asyncio.run(build_inputs_for_pipe(bundle_path=tmp_path / "demo.mthds"))++ assert result == {+ "success": True,+ "pipe_ref": "demo_domain.bundle_main",+ "inputs": {},+ "concept_comments": {},+ "no_inputs_message": "Pipe 'demo_domain.bundle_main' declares no inputs.",+ }++ def test_dependency_pipe_keeps_its_alias(self, ops_mocks: dict[str, Any]) -> None:+ """A pipe reached through a dependency alias is reported under that alias, the only ref that selects it again."""+ result = asyncio.run(build_inputs_for_pipe(pipe_code="github.com/acme/tools/summarizer->demo_domain.bundle_main"))++ ops_mocks["get_required_entry_pipe"].assert_called_once_with(pipe_code="github.com/acme/tools/summarizer->demo_domain.bundle_main")+ assert result["pipe_ref"] == "github.com/acme/tools/summarizer->demo_domain.bundle_main"++ def test_dependency_pipe_without_inputs_names_its_alias(self, ops_mocks: dict[str, Any]) -> None:+ """The no-inputs message names the same alias-qualified ref the envelope reports."""+ ops_mocks["render_inputs"].side_effect = NoInputsRequiredError("the renderer's own wording")++ result = asyncio.run(build_inputs_for_pipe(pipe_code="dep->demo_domain.bundle_main"))++ assert result["pipe_ref"] == "dep->demo_domain.bundle_main"+ assert result["no_inputs_message"] == "Pipe 'dep->demo_domain.bundle_main' declares no inputs."diff --git a/tests/unit/pipelex/cli/agent_cli/test_inputs_template_format_toml.py b/tests/unit/pipelex/cli/agent_cli/test_inputs_template_format_toml.pyindex 9c97d1499..f37c83f85 100644--- a/tests/unit/pipelex/cli/agent_cli/test_inputs_template_format_toml.py+++ b/tests/unit/pipelex/cli/agent_cli/test_inputs_template_format_toml.py@@ -9,7 +9,6 @@ import tomlifrom pipelex.cli.agent_cli.commands.inputs._inputs_core import emit_inputs_resultfrom pipelex.cli.agent_cli.commands.inputs.pipe_cmd import inputs_pipe_cmd-from pipelex.core.pipes.inputs.exceptions import NoInputsRequiredErrorfrom pipelex.pipe_machinery.rendering.input_renderer import InputsTemplateFormatif TYPE_CHECKING:@@ -18,6 +17,14 @@ if TYPE_CHECKING:PIPE_CMD_MODULE = "pipelex.cli.agent_cli.commands.inputs.pipe_cmd"+NO_INPUTS_RESULT: dict[str, Any] = {+ "success": True,+ "pipe_ref": "demo.my_pipe",+ "inputs": {},+ "concept_comments": {},+ "no_inputs_message": "Pipe 'demo.my_pipe' declares no inputs.",+}+INPUTS_TEMPLATE: dict[str, Any] = {"topic": {"concept": "demo.Topic",@@ -27,19 +34,16 @@ INPUTS_TEMPLATE: dict[str, Any] = {class TestAgentInputsTemplateFormatToml:- def _patch_inputs(self, mocker: MockerFixture, *, result: dict[str, Any] | None = None, error: Exception | None = None) -> None:- """Patch the pipe command's dependencies; inputs_core returns result or raises error."""+ def _patch_inputs(self, mocker: MockerFixture, *, result: dict[str, Any]) -> None:+ """Patch the pipe command's dependencies; inputs_core returns a copy of result."""mocker.patch(f"{PIPE_CMD_MODULE}.make_pipelex_for_agent_cli")mocker.patch(f"{PIPE_CMD_MODULE}.Pipelex.teardown_if_needed")mocker.patch(f"{PIPE_CMD_MODULE}.resolve_pipe_from_exports", return_value=[])- if error is not None:- mocker.patch(f"{PIPE_CMD_MODULE}.inputs_core", new=mocker.AsyncMock(side_effect=error))- else:- mocker.patch(f"{PIPE_CMD_MODULE}.inputs_core", new=mocker.AsyncMock(return_value=result))+ mocker.patch(f"{PIPE_CMD_MODULE}.inputs_core", new=mocker.AsyncMock(return_value=dict(result)))def test_toml_format_prints_raw_toml(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:"""--format toml prints the raw TOML template, not the JSON envelope."""- self._patch_inputs(mocker, result={"success": True, "pipe_code": "demo.my_pipe", "inputs": INPUTS_TEMPLATE})+ self._patch_inputs(mocker, result={"success": True, "pipe_ref": "demo.my_pipe", "inputs": INPUTS_TEMPLATE})inputs_pipe_cmd("my_pipe", template_format=InputsTemplateFormat.TOML)@@ -49,40 +53,37 @@ class TestAgentInputsTemplateFormatToml:def test_json_default_keeps_envelope(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:"""The default format keeps the structured JSON success envelope."""- self._patch_inputs(mocker, result={"success": True, "pipe_code": "demo.my_pipe", "inputs": INPUTS_TEMPLATE})+ self._patch_inputs(mocker, result={"success": True, "pipe_ref": "demo.my_pipe", "inputs": INPUTS_TEMPLATE})inputs_pipe_cmd("my_pipe")envelope = json.loads(capsys.readouterr().out)- assert envelope["success"] is True- assert envelope["inputs"] == INPUTS_TEMPLATE+ assert envelope == {"success": True, "pipe_ref": "demo.my_pipe", "inputs": INPUTS_TEMPLATE}def test_no_inputs_in_toml_mode_prints_comment(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:"""A pipe without inputs yields a TOML comment line — valid TOML that loads as an empty dict."""- self._patch_inputs(mocker, error=NoInputsRequiredError("No inputs required for pipe 'demo.my_pipe'."))+ self._patch_inputs(mocker, result=NO_INPUTS_RESULT)inputs_pipe_cmd("my_pipe", template_format=InputsTemplateFormat.TOML)captured = capsys.readouterr()- assert captured.out.startswith("# No inputs required")+ assert captured.out == "# Pipe 'demo.my_pipe' declares no inputs.\n"assert tomli.loads(captured.out) == {}def test_no_inputs_in_json_mode_keeps_envelope(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:- """A pipe without inputs keeps the structured envelope in JSON mode."""- self._patch_inputs(mocker, error=NoInputsRequiredError("No inputs required for pipe 'demo.my_pipe'."))+ """A pipe without inputs keeps the plain envelope in JSON mode, naming the pipe it resolved; the message stays internal."""+ self._patch_inputs(mocker, result=NO_INPUTS_RESULT)inputs_pipe_cmd("my_pipe")envelope = json.loads(capsys.readouterr().out)- assert envelope["success"] is True- assert envelope["inputs"] == {}- assert "No inputs required" in envelope["message"]+ assert envelope == {"success": True, "pipe_ref": "demo.my_pipe", "inputs": {}}def test_light_toml_carries_concept_comments(self, capsys: pytest.CaptureFixture[str]) -> None:"""The agent-CLI TOML surface carries the same `# concept:` hints the human build inputs does."""result: dict[str, Any] = {"success": True,- "pipe_code": "demo.my_pipe",+ "pipe_ref": "demo.my_pipe","inputs": {"question": "text_value", "invoice": {"invoice_number": "INV-1"}},"concept_comments": {"question": "concept: demo.Question", "invoice": "concept: demo.Invoice"},}@@ -98,7 +99,7 @@ class TestAgentInputsTemplateFormatToml:"""concept_comments is internal plumbing — it must not leak into the JSON envelope."""result: dict[str, Any] = {"success": True,- "pipe_code": "demo.my_pipe",+ "pipe_ref": "demo.my_pipe","inputs": {"question": "text_value"},"concept_comments": {"question": "concept: demo.Question"},}diff --git a/tests/unit/pipelex/pipe_machinery/rendering/test_input_renderer_no_inputs.py b/tests/unit/pipelex/pipe_machinery/rendering/test_input_renderer_no_inputs.pynew file mode 100644index 000000000..abaf66164--- /dev/null+++ b/tests/unit/pipelex/pipe_machinery/rendering/test_input_renderer_no_inputs.py@@ -0,0 +1,34 @@+"""Unit tests for the inputs renderer's answer to a pipe that declares no inputs."""++from __future__ import annotations++from types import SimpleNamespace+from typing import TYPE_CHECKING, cast++import pytest++from pipelex.core.pipes.inputs.exceptions import NoInputsRequiredError+from pipelex.pipe_machinery.rendering.input_renderer import build_inputs_template, render_inputs++if TYPE_CHECKING:+ from pipelex.pipe_machinery.pipe_abstract import PipeAbstract+++def _pipe_without_inputs() -> PipeAbstract:+ # The empty-inputs check runs before any concept is resolved, so a stub stands in for the pipe;+ # its bare code differs from its ref so the message proves which one it names.+ return cast("PipeAbstract", SimpleNamespace(code="greet", pipe_ref="inputs_probe.greet", inputs=SimpleNamespace(root={})))+++class TestInputRendererNoInputs:+ def test_template_names_the_qualified_pipe_ref(self) -> None:+ """The template builder refuses a pipe without inputs with a message naming its qualified ref."""+ with pytest.raises(NoInputsRequiredError) as exc_info:+ build_inputs_template(_pipe_without_inputs())++ assert str(exc_info.value) == "Pipe 'inputs_probe.greet' declares no inputs."++ def test_render_inputs_propagates_the_same_message(self) -> None:+ """The JSON renderer, which the inputs commands call, raises the same message."""+ with pytest.raises(NoInputsRequiredError, match=r"^Pipe 'inputs_probe\.greet' declares no inputs\.$"):+ render_inputs(_pipe_without_inputs())