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.
feature/Hosted-pipe-io-sends-tree · L-261017-58850d (#1476)
Louis Choquela0e5bb52b6a7
diff --git a/.drift/acks/cli-docs.toml b/.drift/acks/cli-docs.tomlindex 69c7b9410..3692532e8 100644--- a/.drift/acks/cli-docs.toml+++ b/.drift/acks/cli-docs.toml@@ -1,8 +1,8 @@contract = "cli-docs"-digest = "sha256:7d61432bb26b53a3fac3a61531332f19c0b516bd40e85a345072226b9706dc75"+digest = "sha256:5e8e0e791107e17b9da7c48df71037ac92ea1d0c87e69a172e03eae2d3126556"reviewed_by = "Louis Choquel"-reviewed_at = "2026-10-20T09:11:42Z"-rationale = "real-catch: merged origin/dev's agent validate and fix exit 2 on a configuration refused before the boot, and its validate bundle --graph output folder, with this branch's CLI changes, where run, validate and fix hand the MethodTreeListing that resolved their target down to their load, so the tree they list is the tree loaded, and a file of it edited after that listing is refused as an invalid method naming the file; docs/tools/cli/run.md, agent-cli.md and pipelex/cli/agent_cli/CLAUDE.md now say both sides, and no flag, output or error format changed beyond what each side documents."+reviewed_at = "2026-10-22T15:31:43Z"+rationale = "real-catch: a hosted run's failed tree upload now carries pipelex-sdk's verdict as the agent CLI problem's retry and step kind, and a lost connection reads as client.outcome_unknown only when pipelex-sdk says the run may have started; docs/tools/cli/run.md, agent-cli.md and pipelex/cli/agent_cli/CLAUDE.md now say so. No flag or output format changed."[trigger_files]"pipelex/cli/__init__.py" = "blob:8b137891791fe96927ad78e64b0aad7bded08bdc"@@ -38,11 +38,11 @@ rationale = "real-catch: merged origin/dev's agent validate and fix exit 2 on a"pipelex/cli/agent_cli/commands/run/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""pipelex/cli/agent_cli/commands/run/_output_helpers.py" = "blob:40ed1700e0d5e86d7696eadd7f9887baeb8059f6""pipelex/cli/agent_cli/commands/run/_run_core.py" = "blob:6190638f8542dd39db5458bc47a2da332fb39726"-"pipelex/cli/agent_cli/commands/run/_run_hosted.py" = "blob:8d2e819c44d5669756e931b9f3fc83741d54a1df"+"pipelex/cli/agent_cli/commands/run/_run_hosted.py" = "blob:96803db7f0a09728ebaa8aa9d099461fec0e9105""pipelex/cli/agent_cli/commands/run/app.py" = "blob:7546d9b31ea2dc22b1ddae538edfbc8e7f7d08df"-"pipelex/cli/agent_cli/commands/run/bundle_cmd.py" = "blob:a461d40dc34a1f8e273358eb6b6f2e6ea084f391"-"pipelex/cli/agent_cli/commands/run/method_cmd.py" = "blob:0df77aa1e35c22ceffdcefd7f4c12f28fda366c7"-"pipelex/cli/agent_cli/commands/run/pipe_cmd.py" = "blob:6bacf08886c38463828d9432b2cae4730e9004a3"+"pipelex/cli/agent_cli/commands/run/bundle_cmd.py" = "blob:7a30bb003770fec1db0c4b839017c50f7e6959a2"+"pipelex/cli/agent_cli/commands/run/method_cmd.py" = "blob:41e1060693568363d922fad1f8663c05bfdab351"+"pipelex/cli/agent_cli/commands/run/pipe_cmd.py" = "blob:d6f3c69d7f4edcf20883cddba7d41018f18935a8""pipelex/cli/agent_cli/commands/run/stdin_resolver.py" = "blob:db0176d7de1e074fd6eefd787c10e71b891eeb32""pipelex/cli/agent_cli/commands/validate/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""pipelex/cli/agent_cli/commands/validate/_validate_core.py" = "blob:11e4ee205e309a9aa89e0aced56ae52059f32eba"@@ -107,18 +107,18 @@ rationale = "real-catch: merged origin/dev's agent validate and fix exit 2 on a"pipelex/cli/commands/plugins_cmd.py" = "blob:9657b713c3650ff4a929e92ae68af453d896393e""pipelex/cli/commands/resolve_cmd.py" = "blob:88237df0f048bbf5a02e585baef932bfc355e1ee""pipelex/cli/commands/run/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"-"pipelex/cli/commands/run/_hosted_sources.py" = "blob:c38ae7b75c51fe17d565462f9df5e716e634d5cb"+"pipelex/cli/commands/run/_hosted_sources.py" = "blob:2a5a8066e28bdb7c1990a53e780956b7dff4c2d9""pipelex/cli/commands/run/_inputs_file_loader.py" = "blob:8039ca6b29f4f9091d0ea7406c8b8a4590848131""pipelex/cli/commands/run/_inputs_path_resolver.py" = "blob:c8ec89d98718e18af7aaaded44c9f545be60adab""pipelex/cli/commands/run/_main_stuff_file.py" = "blob:ca806e55085aa2e5748492751521296ce1f42960""pipelex/cli/commands/run/_run_core.py" = "blob:c70b6f445b2961cbd0eda878f23900ece290dfd8"-"pipelex/cli/commands/run/_run_hosted.py" = "blob:f61b3ea7fdc6c29823ecd6cb5b469ab271814c3f"+"pipelex/cli/commands/run/_run_hosted.py" = "blob:31a956c8fdde89bb83382f0153c5092a60af60da""pipelex/cli/commands/run/_run_output_folder.py" = "blob:6f3b237849d9b6498a4dbf5cb81ceea948c91782""pipelex/cli/commands/run/app.py" = "blob:e312b159625e0a72bc9a18d3bfd2c73e7ac59f24"-"pipelex/cli/commands/run/bundle_cmd.py" = "blob:b4803104d485fd60be7092ea6608875c65ee4953"+"pipelex/cli/commands/run/bundle_cmd.py" = "blob:a33dc6bd6c08715d880a587da54114055e9d5e1b""pipelex/cli/commands/run/exceptions.py" = "blob:cebeb5950c87a1e113ed717565ae8cb783bb5001"-"pipelex/cli/commands/run/method_cmd.py" = "blob:924bca6e242d8490e32eeb9ed2329db3d1b58b8d"-"pipelex/cli/commands/run/pipe_cmd.py" = "blob:c967729a039518a718d7bc28d77797423ce20fc4"+"pipelex/cli/commands/run/method_cmd.py" = "blob:71585bc668fe50c67093b12cb9360d470586a1ce"+"pipelex/cli/commands/run/pipe_cmd.py" = "blob:15cea0289cfae60b85d6347c42c7d8ce1a47b566""pipelex/cli/commands/show_cmd.py" = "blob:ed0653825fa72563e9dd20840457929ea6c71e3b""pipelex/cli/commands/update_cmd.py" = "blob:b2db6170ddd9c67f17d88096ba1f1796a897557d""pipelex/cli/commands/usage_stats_cmd.py" = "blob:b3723c64f911d1b69e1e1aa126610a132a16e3da"diff --git a/.test_durations b/.test_durationsindex 85a1f1871..c7fd8aa43 100644--- a/.test_durations+++ b/.test_durations@@ -271,6 +271,8 @@"tests/integration/pipelex/cli/test_agent_fix_bundle.py::TestAgentFixBundle::test_unfixable_bundle_exits_one_with_structured_error": 0.1829,"tests/integration/pipelex/cli/test_agent_validate_defaults_strict.py::TestAgentValidateDefaultsStrict::test_agent_validate_allow_signatures_succeeds": 1.4468,"tests/integration/pipelex/cli/test_agent_validate_defaults_strict.py::TestAgentValidateDefaultsStrict::test_agent_validate_defaults_to_strict": 1.8281,+ "tests/integration/pipelex/cli/test_agent_validate_graph_folder.py::TestAgentValidateGraphFolder::test_a_named_pipe_of_a_nested_bundle_draws_into_the_folder_s_own_results": 0.1739,+ "tests/integration/pipelex/cli/test_agent_validate_graph_folder.py::TestAgentValidateGraphFolder::test_two_validations_with_a_graph_leave_the_method_tree_unchanged": 0.5117,"tests/integration/pipelex/cli/test_agent_validate_pipe_core_library_lifecycle.py::TestAgentValidatePipeCoreLibraryLifecycle::test_failure_restores_outer_and_tears_down_temp": 1.0088,"tests/integration/pipelex/cli/test_agent_validate_pipe_core_library_lifecycle.py::TestAgentValidatePipeCoreLibraryLifecycle::test_success_restores_outer_and_tears_down_temp": 1.1458,"tests/integration/pipelex/cli/test_agent_validate_pipe_dry_run_items.py::TestAgentValidatePipeDryRunItems::test_a_failing_dry_run_is_an_invalid_verdict_with_the_located_item[all]": 0.362,@@ -605,6 +607,18 @@"tests/integration/pipelex/libraries/test_dependency_private_pipes.py::TestDependencyPrivatePipes::test_an_exported_controller_runs_its_private_helper": 9.7808,"tests/integration/pipelex/libraries/test_dependency_private_pipes.py::TestDependencyPrivatePipes::test_exports_are_scoped_by_domain": 11.9715,"tests/integration/pipelex/libraries/test_dependency_private_pipes.py::TestDependencyPrivatePipes::test_the_entry_door_reaches_a_private_helper_by_hand": 9.7622,+ "tests/integration/pipelex/libraries/test_fetched_dependency_lock.py::TestFetchedDependencyLock::test_a_copy_installed_without_a_fetch_provenance_is_not_checked": 0.8472,+ "tests/integration/pipelex/libraries/test_fetched_dependency_lock.py::TestFetchedDependencyLock::test_a_fetched_dependency_the_lock_does_not_contradict_loads[lock naming another address]": 0.8689,+ "tests/integration/pipelex/libraries/test_fetched_dependency_lock.py::TestFetchedDependencyLock::test_a_fetched_dependency_the_lock_does_not_contradict_loads[lock recording the fetched tree]": 0.812,+ "tests/integration/pipelex/libraries/test_fetched_dependency_lock.py::TestFetchedDependencyLock::test_a_fetched_dependency_the_lock_does_not_contradict_loads[no lock]": 0.7662,+ "tests/integration/pipelex/libraries/test_fetched_dependency_lock.py::TestFetchedDependencyLock::test_a_fetched_dependency_whose_tree_the_lock_does_not_record_is_refused[github.com/pipelex-tests/fom-lock-methods/scoring->fom_lock_scoring.compute]": 1.2453,+ "tests/integration/pipelex/libraries/test_fetched_dependency_lock.py::TestFetchedDependencyLock::test_a_fetched_dependency_whose_tree_the_lock_does_not_record_is_refused[github.com/pipelex-tests/fom-lock-methods/[email protected]>fom_lock_scoring.compute]": 0.2952,+ "tests/integration/pipelex/libraries/test_fetched_dependency_lock.py::TestFetchedDependencyLock::test_a_later_batch_calling_a_dependency_an_earlier_batch_fetched_is_checked[False]": 0.8375,+ "tests/integration/pipelex/libraries/test_fetched_dependency_lock.py::TestFetchedDependencyLock::test_a_later_batch_calling_a_dependency_an_earlier_batch_fetched_is_checked[True]": 0.7927,+ "tests/integration/pipelex/libraries/test_fetched_dependency_lock.py::TestFetchedDependencyLock::test_a_lock_that_cannot_be_read_refuses_a_fetched_dependency": 0.2616,+ "tests/integration/pipelex/libraries/test_fetched_dependency_lock.py::TestFetchedDependencyLock::test_a_shipped_dependency_is_not_checked": 0.7002,+ "tests/integration/pipelex/libraries/test_fetched_dependency_lock.py::TestFetchedDependencyLock::test_the_copy_an_earlier_fetch_installed_is_checked_too[None]": 2.1105,+ "tests/integration/pipelex/libraries/test_fetched_dependency_lock.py::TestFetchedDependencyLock::test_the_copy_an_earlier_fetch_installed_is_checked_too[v0.1.0]": 1.5841,"tests/integration/pipelex/libraries/test_hosted_pipe_func_load.py::TestHostedPipeFuncLoad::test_a_module_named_like_a_runner_package_is_refused_in_direct_mode": 0.051,"tests/integration/pipelex/libraries/test_hosted_pipe_func_load.py::TestHostedPipeFuncLoad::test_a_module_named_like_a_runner_package_passes_on_a_sandbox_hosted_deployment": 0.0548,"tests/integration/pipelex/libraries/test_hosted_pipe_func_load.py::TestHostedPipeFuncLoad::test_content_strings_name_the_tree_of_the_files_their_library_directory_submits": 0.0818,@@ -631,6 +645,11 @@"tests/integration/pipelex/libraries/test_load_from_crate.py::TestLoadFromCrate::test_load_into_non_current_library": 0.2424,"tests/integration/pipelex/libraries/test_load_from_crate.py::TestLoadFromCrate::test_pipe_source_is_scoped_to_current_library": 0.0127,"tests/integration/pipelex/libraries/test_load_prevalidated_crate.py::TestLoadPrevalidatedCrate::test_prevalidated_load_skips_only_validation": 0.3822,+ "tests/integration/pipelex/libraries/test_method_loads_off_the_event_loop.py::TestMethodLoadsOffTheEventLoop::test_a_cancelled_acquisition_tears_its_library_down_once_the_load_has_ended": 0.1327,+ "tests/integration/pipelex/libraries/test_method_loads_off_the_event_loop.py::TestMethodLoadsOffTheEventLoop::test_a_load_called_on_the_event_loop_is_refused_before_the_package_offer_is_asked": 0.0085,+ "tests/integration/pipelex/libraries/test_method_loads_off_the_event_loop.py::TestMethodLoadsOffTheEventLoop::test_a_validation_of_a_method_tree_asks_the_package_offer_off_the_event_loop": 0.2566,+ "tests/integration/pipelex/libraries/test_method_loads_off_the_event_loop.py::TestMethodLoadsOffTheEventLoop::test_an_asynchronous_acquisition_loads_off_the_event_loop_and_leaves_the_library_current": 0.0778,+ "tests/integration/pipelex/libraries/test_method_loads_off_the_event_loop.py::TestMethodLoadsOffTheEventLoop::test_the_in_process_validator_lists_the_tree_once_off_the_event_loop_and_draws_its_graph_from_it": 0.078,"tests/integration/pipelex/libraries/test_method_requirements_load.py::TestMethodRequirementsLoad::test_a_bundle_file_named_alone_loads_under_its_trees_requirements_on_every_load": 0.194,"tests/integration/pipelex/libraries/test_method_requirements_load.py::TestMethodRequirementsLoad::test_a_dependency_package_whose_requirements_are_not_met_refuses_the_load": 0.0094,"tests/integration/pipelex/libraries/test_method_requirements_load.py::TestMethodRequirementsLoad::test_a_requirement_no_environment_can_hold_refuses_the_method_with_the_plugins_reason": 0.0959,@@ -639,6 +658,15 @@"tests/integration/pipelex/libraries/test_method_requirements_load.py::TestMethodRequirementsLoad::test_locally_a_met_requirement_loads_the_method_and_its_python_is_imported_only_when_its_step_binds": 0.563,"tests/integration/pipelex/libraries/test_method_requirements_load.py::TestMethodRequirementsLoad::test_locally_an_unmet_requirement_refuses_the_method_before_its_python_is_imported": 0.1469,"tests/integration/pipelex/libraries/test_method_requirements_load.py::TestMethodRequirementsLoad::test_on_a_sandbox_hosted_deployment_the_stated_package_set_is_the_whole_offer": 0.2765,+ "tests/integration/pipelex/libraries/test_one_listing_per_run.py::TestOneListingPerRun::test_a_bundle_edited_after_its_command_listed_it_is_refused_before_the_run_loads_it": 0.008,+ "tests/integration/pipelex/libraries/test_one_listing_per_run.py::TestOneListingPerRun::test_a_bundle_file_named_alone_is_placed_in_the_tree_its_command_listed": 0.2783,+ "tests/integration/pipelex/libraries/test_one_listing_per_run.py::TestOneListingPerRun::test_a_fix_of_a_valid_folder_its_command_listed_lists_it_no_more": 0.0571,+ "tests/integration/pipelex/libraries/test_one_listing_per_run.py::TestOneListingPerRun::test_a_folder_run_loads_the_tree_its_command_listed_without_listing_it_again": 0.1947,+ "tests/integration/pipelex/libraries/test_one_listing_per_run.py::TestOneListingPerRun::test_a_load_handed_no_listing_lists_each_tree_once": 0.2497,+ "tests/integration/pipelex/libraries/test_one_listing_per_run.py::TestOneListingPerRun::test_a_template_edited_after_its_command_listed_the_bundle_is_refused_before_the_run_loads_it": 0.0129,+ "tests/integration/pipelex/libraries/test_one_listing_per_run.py::TestOneListingPerRun::test_the_in_process_validator_lists_a_method_once_for_its_load_and_its_graph": 0.0947,+ "tests/integration/pipelex/libraries/test_one_listing_per_run.py::TestOneListingPerRun::test_validating_a_bundle_whose_template_changed_since_its_listing_refuses_it": 0.0106,+ "tests/integration/pipelex/libraries/test_one_listing_per_run.py::TestOneListingPerRun::test_validating_a_folder_its_command_listed_lists_it_no_more": 0.0726,"tests/integration/pipelex/libraries/test_pipe_namespace.py::TestPipeNamespace::test_bare_code_lookup_from_mthds": 0.3891,"tests/integration/pipelex/libraries/test_pipe_namespace.py::TestPipeNamespace::test_duplicate_concept_same_domain_raises": 0.3916,"tests/integration/pipelex/libraries/test_pipe_namespace.py::TestPipeNamespace::test_duplicate_pipe_same_domain_raises": 0.3849,@@ -2372,6 +2400,7 @@"tests/unit/pipelex/cli/agent_cli/commands/test_agent_init_routing.py::TestAgentInitRouting::test_no_backends_named_keeps_the_template_profile": 0.1333,"tests/unit/pipelex/cli/agent_cli/commands/test_agent_init_routing.py::TestAgentInitRouting::test_primary_named_alone_routes_the_template_backends_to_it_first": 0.1546,"tests/unit/pipelex/cli/agent_cli/commands/test_agent_init_routing.py::TestAgentInitRouting::test_several_backends_named_without_a_primary_is_refused": 0.1915,+ "tests/unit/pipelex/cli/agent_cli/commands/test_bundle_path_resolver.py::TestResolveBundleTarget::test_a_configuration_that_does_not_validate_before_the_boot_exits_2": 0.2269,"tests/unit/pipelex/cli/agent_cli/commands/test_bundle_path_resolver.py::TestResolveBundleTarget::test_a_folder_holding_no_bundle_exits_2[empty]": 0.0035,"tests/unit/pipelex/cli/agent_cli/commands/test_bundle_path_resolver.py::TestResolveBundleTarget::test_a_folder_holding_no_bundle_exits_2[no_bundle]": 0.0034,"tests/unit/pipelex/cli/agent_cli/commands/test_bundle_path_resolver.py::TestResolveBundleTarget::test_a_folder_is_read_whole_whatever_its_main_pipes[manifest_main_pipe]": 0.0982,@@ -2431,9 +2460,13 @@"tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_a_configuration_that_does_not_validate_before_the_boot_is_the_failed_boot_envelope[inputs]": 0.0029,"tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_a_configuration_that_does_not_validate_before_the_boot_is_the_failed_boot_envelope[run]": 0.0019,"tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_a_configuration_that_does_not_validate_before_the_boot_is_the_failed_boot_envelope[validate]": 0.0028,+ "tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_a_configuration_that_does_not_validate_before_the_boot_is_the_failed_boot_problem[fix-2]": 0.0062,"tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_a_configuration_that_does_not_validate_before_the_boot_is_the_failed_boot_problem[fix]": 0.0027,+ "tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_a_configuration_that_does_not_validate_before_the_boot_is_the_failed_boot_problem[inputs-1]": 0.0064,"tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_a_configuration_that_does_not_validate_before_the_boot_is_the_failed_boot_problem[inputs]": 0.0028,+ "tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_a_configuration_that_does_not_validate_before_the_boot_is_the_failed_boot_problem[run-1]": 0.0063,"tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_a_configuration_that_does_not_validate_before_the_boot_is_the_failed_boot_problem[run]": 0.003,+ "tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_a_configuration_that_does_not_validate_before_the_boot_is_the_failed_boot_problem[validate-2]": 0.1699,"tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_a_configuration_that_does_not_validate_before_the_boot_is_the_failed_boot_problem[validate]": 0.0027,"tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_fix_patches_the_whole_method_validate_judges[manifest_main_pipe]": 0.0077,"tests/unit/pipelex/cli/agent_cli/test_folder_entry_commands.py::TestAgentFolderEntryCommands::test_fix_patches_the_whole_method_validate_judges[no_main_pipe]": 0.0051,@@ -2807,6 +2840,7 @@"tests/unit/pipelex/cli/commands/run/test_bundle_cmd_method_folder.py::TestBundleCmdMethodFolder::test_a_folder_runs_from_its_manifest_s_main_pipe_and_records_its_tree": 0.1594,"tests/unit/pipelex/cli/commands/run/test_bundle_cmd_method_folder.py::TestBundleCmdMethodFolder::test_a_folder_with_no_single_entry_is_refused": 0.0025,"tests/unit/pipelex/cli/commands/run/test_bundle_cmd_method_folder.py::TestBundleCmdMethodFolder::test_a_named_pipe_needs_no_entry": 0.0049,+ "tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_bundle_file_of_a_method_folder_is_keyed_by_its_tree_path_there": 0.0054,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_catalog_id_is_told_from_a_method_name[github.com/Pipelex/methods/text_stats-False]": 0.0035,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_catalog_id_is_told_from_a_method_name[mt abc-False]": 0.0018,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_catalog_id_is_told_from_a_method_name[mt_-False]": 0.0005,@@ -2814,13 +2848,17 @@"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_catalog_id_is_told_from_a_method_name[mt_abc123-True]": 0.0013,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_catalog_id_is_told_from_a_method_name[my-method-False]": 0.0028,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_catalog_id_no_installed_method_bears_is_sent_as_an_id": 0.0018,+ "tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_file_that_changed_since_its_listing_is_refused": 0.0049,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_library_with_no_bundle_is_refused": 0.0008,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_local_method_sends_its_files_and_anchors_in_its_directory": 0.0031,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_pipe_run_falls_back_to_pipelexpath": 0.0012,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_pipe_run_without_a_library_is_refused": 0.0856,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_remote_method_is_anchored_in_the_working_directory": 0.0005,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_remote_method_with_a_local_library_is_refused": 0.004,+ "tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_a_tree_nested_in_the_method_s_folder_is_keyed_under_its_folder": 0.1689,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_an_installed_method_named_like_a_catalog_id_is_the_installed_method": 0.0794,+ "tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_libraries_beside_the_method_are_keyed_under_their_names_each_once": 0.0204,+ "tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_the_bundle_file_goes_first_and_each_file_once_by_its_tree_path": 0.3777,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_the_library_of_a_run_is_its_library_dirs_else_pipelexpath": 0.001,"tests/unit/pipelex/cli/commands/run/test_hosted_sources.py::TestHostedSources::test_the_primary_file_goes_first_and_each_file_once": 0.0898,"tests/unit/pipelex/cli/commands/run/test_inputs_arg_resolution.py::TestResolveInputsArgAgainstDir::test_absolute_path_passes_through": 0.002,@@ -2872,6 +2910,7 @@"tests/unit/pipelex/cli/commands/run/test_main_stuff_file.py::TestMainStuffFile::test_the_file_never_takes_a_name_the_run_writes_afterwards": 0.0032,"tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.py::TestRunHostedCli::test_a_bundle_file_without_a_library_sends_pipelexpath": 0.0123,"tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.py::TestRunHostedCli::test_a_folder_run_names_its_main_pipe_by_its_domain_when_two_domains_share_its_code": 0.1778,+ "tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.py::TestRunHostedCli::test_a_folder_run_sends_its_tree_and_saves_the_outputs": 0.2268,"tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.py::TestRunHostedCli::test_a_hosted_failure_exits_with_its_next_step": 0.0179,"tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.py::TestRunHostedCli::test_a_hosted_failure_prints_its_items_and_its_run[error0-expected_lines0]": 0.0124,"tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.py::TestRunHostedCli::test_a_hosted_failure_prints_its_items_and_its_run[error1-expected_lines1]": 0.0171,@@ -2902,6 +2941,12 @@"tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.py::TestRunHostedCli::test_method_named_remotely_is_resolved_by_the_hosted_api[mt_abc123-None-mt_abc123]": 0.0117,"tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.py::TestRunHostedCli::test_no_graph_saves_no_graphspec": 0.0155,"tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.py::TestRunHostedCli::test_the_configured_default_runs_hosted_and_local_overrides_it": 0.0182,+ "tests/unit/pipelex/cli/commands/run/test_run_output_folder.py::TestRunOutputFolder::test_a_bundle_run_writes_beside_the_bundle_it_starts_in_else_in_the_folder_named[method-None-method/bundle.mthds-method/results]": 0.2141,+ "tests/unit/pipelex/cli/commands/run/test_run_output_folder.py::TestRunOutputFolder::test_a_bundle_run_writes_beside_the_bundle_it_starts_in_else_in_the_folder_named[method-None-method/parts/extra.mthds-method/parts/results]": 0.2626,+ "tests/unit/pipelex/cli/commands/run/test_run_output_folder.py::TestRunOutputFolder::test_a_bundle_run_writes_beside_the_bundle_it_starts_in_else_in_the_folder_named[method-graph_folder_probe.wave-method/parts/extra.mthds-method/results]": 0.0044,+ "tests/unit/pipelex/cli/commands/run/test_run_output_folder.py::TestRunOutputFolder::test_a_bundle_run_writes_beside_the_bundle_it_starts_in_else_in_the_folder_named[method-wave-None-method/results]": 0.0046,+ "tests/unit/pipelex/cli/commands/run/test_run_output_folder.py::TestRunOutputFolder::test_a_bundle_run_writes_beside_the_bundle_it_starts_in_else_in_the_folder_named[method/bundle.mthds-None-None-method/results]": 0.1512,+ "tests/unit/pipelex/cli/commands/run/test_run_output_folder.py::TestRunOutputFolder::test_a_bundle_run_writes_beside_the_bundle_it_starts_in_else_in_the_folder_named[method/parts/extra.mthds-wave-None-method/parts/results]": 0.003,"tests/unit/pipelex/cli/commands/run/test_run_output_folder.py::TestRunOutputFolder::test_a_run_folder_is_labelled_by_the_pipe_s_own_code[report.summarize-summarize]": 0.0012,"tests/unit/pipelex/cli/commands/run/test_run_output_folder.py::TestRunOutputFolder::test_a_run_folder_is_labelled_by_the_pipe_s_own_code[scoring->report.summarize-summarize]": 0.1216,"tests/unit/pipelex/cli/commands/run/test_run_output_folder.py::TestRunOutputFolder::test_a_run_folder_is_labelled_by_the_pipe_s_own_code[scoring->summarize-summarize]": 0.0016,@@ -3863,6 +3908,30 @@"tests/unit/pipelex/cli/dev/test_subject_grant_registry.py::TestSubjectGrantRegistry::test_unknown_entry_key_raises": 0.0011,"tests/unit/pipelex/cli/dev/test_subject_grant_registry.py::TestSubjectGrantRegistry::test_valid_registry_loads": 0.7797,"tests/unit/pipelex/cli/dev/test_subject_grant_registry.py::TestSubjectGrantRegistry::test_wrong_version_raises": 0.002,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_catalog.py::TestOpenRouterCatalog::test_all_modalities_auth_category_pagination": 0.1595,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_catalog.py::TestOpenRouterCatalog::test_anonymous_lookup": 0.007,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_catalog.py::TestOpenRouterCatalog::test_rejects_unsafe_or_repeated_pages[https://attacker.example/models]": 0.0042,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_catalog.py::TestOpenRouterCatalog::test_rejects_unsafe_or_repeated_pages[https://openrouter.ai/api/v1/models]": 0.003,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_export_refuses_overwrite": 0.0364,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_export_reports_skipped_modalities": 0.0274,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_help[False]": 0.0685,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_help[True]": 0.0479,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_http_failure": 0.0204,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_json_filter": 0.243,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_malformed_response[payload0]": 0.0107,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_malformed_response[payload1]": 0.2361,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_malformed_response[payload2]": 0.0169,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_markdown": 0.1755,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_sort_json[context_length-acme/text.v1:free]": 0.0096,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_sort_json[created-acme/image]": 0.0089,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_command.py::TestOpenRouterCommand::test_sort_json[name-acme/image]": 0.0073,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_export.py::TestOpenRouterExport::test_explicit_structured_and_quoted_key": 0.0022,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_export.py::TestOpenRouterExport::test_unknown_prices[-1]": 0.2216,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_export.py::TestOpenRouterExport::test_unknown_prices[Infinity]": 0.0031,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_export.py::TestOpenRouterExport::test_unknown_prices[NaN]": 0.0037,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_export.py::TestOpenRouterExport::test_unknown_prices[None]": 0.0055,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_export.py::TestOpenRouterExport::test_unknown_prices[not a price]": 0.0039,+ "tests/unit/pipelex/cli/dev_cli/openrouter/test_export.py::TestOpenRouterExport::test_validated_drafts": 0.1516,"tests/unit/pipelex/cli/dev_cli/test_dev_cli_failure_prints.py::TestDevCliFailurePrints::test_a_failure_prints_its_bracketed_text_as_written[corpus-generation]": 0.1036,"tests/unit/pipelex/cli/dev_cli/test_dev_cli_failure_prints.py::TestDevCliFailurePrints::test_a_failure_prints_its_bracketed_text_as_written[corpus-record]": 0.0048,"tests/unit/pipelex/cli/dev_cli/test_dev_cli_failure_prints.py::TestDevCliFailurePrints::test_a_failure_prints_its_bracketed_text_as_written[corpus-validation]": 0.0953,@@ -10979,8 +11048,10 @@"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_local_file_for_a_method_whose_address_dependency_was_not_shipped_is_refused_naming_it[validation_errors]": 0.134,"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_local_file_for_a_method_with_an_address_dependency_is_refused_with_a_url_to_use": 0.0299,"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_local_file_is_anchored_then_uploaded_before_the_run": 0.0388,+ "tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_local_method_without_inputs_starts_and_waits_on_its_tree": 0.2935,"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_method_that_does_not_load_is_refused_before_the_run_with_its_labelled_items": 0.028,"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_null_optional_file_beside_a_local_file_reaches_the_run_as_null": 0.0329,+ "tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_pipe_io_refusal_is_the_hosted_api_s_refusal": 0.0862,"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_remote_source_is_named_not_sent[source0-github.com/Pipelex/methods/[email protected]]": 0.0334,"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_remote_source_is_named_not_sent[source1-None-mt_abc123]": 0.0278,"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_request_names_exactly_one_source[source0]": 0.0008,@@ -11006,6 +11077,7 @@"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_transport_failure_before_the_start_is_sent_is_an_unreachable_api[transport_error2-PoolTimeout]": 0.2446,"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_transport_failure_before_the_start_is_sent_is_an_unreachable_api[transport_error3-UnsupportedProtocol]": 0.1184,"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_transport_failure_before_the_start_is_sent_is_an_unreachable_api[transport_error4-ProxyError]": 0.0401,+ "tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_tree_upload_that_fails_is_the_sdk_s_transfer_error_and_no_unknown_outcome": 0.2785,"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_verdict_naming_no_unshipped_dependency_is_the_method_s_fault[dependency_cycle]": 0.0305,"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_a_verdict_naming_no_unshipped_dependency_is_the_method_s_fault[words_only]": 0.0445,"tests/unit/pipelex/hosted/test_hosted_run.py::TestHostedRun::test_an_acknowledged_start_is_announced_before_the_run_is_followed": 0.142,@@ -11797,6 +11869,7 @@"tests/unit/pipelex/libraries/test_method_requirements_check.py::TestMethodRequirementsCheck::test_a_deployment_refusing_the_requirements_refuses_the_method_with_its_reason": 0.0047,"tests/unit/pipelex/libraries/test_method_requirements_check.py::TestMethodRequirementsCheck::test_a_factory_refusing_only_what_its_sandbox_needs_lets_a_false_marker_requirement_load": 0.0068,"tests/unit/pipelex/libraries/test_method_requirements_check.py::TestMethodRequirementsCheck::test_a_file_that_is_not_utf8_is_refused": 0.0043,+ "tests/unit/pipelex/libraries/test_method_requirements_check.py::TestMethodRequirementsCheck::test_a_run_s_listing_asks_the_factory_once_for_a_tree_found_met_and_again_for_a_refused_one": 0.1824,"tests/unit/pipelex/libraries/test_method_requirements_check.py::TestMethodRequirementsCheck::test_a_served_method_checks_the_packages_nested_in_its_directory": 0.003,"tests/unit/pipelex/libraries/test_method_requirements_check.py::TestMethodRequirementsCheck::test_a_served_method_refused_in_direct_mode_names_no_host_path_to_its_caller": 0.0049,"tests/unit/pipelex/libraries/test_method_requirements_check.py::TestMethodRequirementsCheck::test_a_served_method_whose_directory_cannot_be_listed_is_the_hosts_fault": 0.0023,@@ -11863,6 +11936,21 @@"tests/unit/pipelex/libraries/test_method_requirements_parsing.py::TestMethodRequirementsParsing::test_a_pep_508_requirement_is_declared[wildcard-pandas==2.*-pandas]": 0.0006,"tests/unit/pipelex/libraries/test_method_requirements_parsing.py::TestMethodRequirementsParsing::test_blank_lines_and_comments_declare_nothing_and_lines_keep_their_numbers": 0.0004,"tests/unit/pipelex/libraries/test_method_requirements_parsing.py::TestMethodRequirementsParsing::test_every_refused_line_is_kept_not_only_the_first": 0.0008,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_bundle_file_named_alone_inside_a_library_directory_shares_the_directory_s_listing[False]": 0.2711,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_bundle_file_named_alone_inside_a_library_directory_shares_the_directory_s_listing[True]": 0.0088,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_bundle_file_named_alone_is_rooted_at_the_manifest_above_it_else_alone": 0.2408,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_bundle_read_after_its_listing_is_read_as_listed": 0.0072,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_dependency_package_is_listed_and_judged_once_per_run": 0.0128,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_load_reads_a_tree_listed_before_it_again_once_and_a_tree_it_lists_never": 0.1713,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_symbolic_link_named_alone_is_refused_whichever_the_run_listed_first[False-False]": 0.0104,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_symbolic_link_named_alone_is_refused_whichever_the_run_listed_first[False-True]": 0.0062,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_symbolic_link_named_alone_is_refused_whichever_the_run_listed_first[True-False]": 0.0092,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_symbolic_link_named_alone_is_refused_whichever_the_run_listed_first[True-True]": 0.0069,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_symbolic_link_naming_a_directory_is_followed_as_the_lister_follows_it[False]": 0.0073,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_symbolic_link_naming_a_directory_is_followed_as_the_lister_follows_it[True]": 0.008,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_a_tree_edited_after_its_listing_is_refused_as_a_load_takes_it": 0.0088,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_concurrent_asks_of_one_tree_list_it_once_while_other_trees_list_beside_them": 0.0301,+ "tests/unit/pipelex/libraries/test_method_tree_listing.py::TestMethodTreeListing::test_concurrent_judgements_of_one_tree_judge_it_once_per_environment": 0.3191,"tests/unit/pipelex/libraries/test_method_trees.py::TestMethodTrees::test_a_bundle_file_named_alone_is_rooted_at_the_manifest_above_it_else_alone": 0.0033,"tests/unit/pipelex/libraries/test_method_trees.py::TestMethodTrees::test_a_dependency_package_refusal_names_its_address_never_this_host_s_path[limit]": 0.0026,"tests/unit/pipelex/libraries/test_method_trees.py::TestMethodTrees::test_a_dependency_package_refusal_names_its_address_never_this_host_s_path[symbolic_link]": 0.0018,@@ -11979,6 +12067,24 @@"tests/unit/pipelex/methods/test_fetching.py::TestFetchMethodPackage::test_tagged_ref_clones_at_version": 0.1947,"tests/unit/pipelex/methods/test_fetching.py::TestFetchMethodPackage::test_total_bytes_bound_is_enforced": 0.1703,"tests/unit/pipelex/methods/test_fetching.py::TestFetchMethodPackage::test_without_refusal_flag_structures_package_is_returned": 0.0154,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_a_caller_without_a_lock_checks_nothing": 0.1236,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_a_fetched_tree_the_lock_does_not_record_is_refused": 0.0062,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_a_fetched_tree_the_lock_records_passes[github.com/Invented/Locked-Lib/scoring]": 0.0042,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_a_fetched_tree_the_lock_records_passes[github.com/invented/locked-lib/scoring]": 0.0044,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_a_lock_listed_in_a_tree_no_longer_held_is_refused": 0.0023,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_a_lock_on_disk_that_moved_after_the_listing_is_refused[False-changed since the method's tree was listed]": 0.0049,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_a_lock_on_disk_that_moved_after_the_listing_is_refused[True-cannot be read]": 0.0163,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_a_lock_that_cannot_be_read_is_refused[[\"github.com/invented/locked-lib/scoring\"\\nversion = \"1.0.0\"\\n-Invalid TOML]": 0.0045,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_a_lock_that_cannot_be_read_is_refused[[\"github.com/invented/locked-lib/scoring\"]\\nversion = \"1.0.0\"\\nhash = \"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\"\\nsource = \"https://github.com/invented/locked-lib.git\"\\n-predates tree digests]": 0.0041,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_a_lock_that_cannot_be_read_is_refused[[\"github.com/invented/locked-lib/scoring\"]\\nversion = \"\\xff\"\\n-not UTF-8]": 0.176,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_a_lock_that_does_not_name_the_address_checks_nothing": 0.2581,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_every_calling_tree_s_lock_is_checked": 0.0032,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_the_lock_of_a_tree_held_in_memory_is_read_from_the_store": 0.0022,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_the_refusal_names_the_remedy_that_fits_how_the_copy_was_found[an unpinned reference fetched another version-fetched0-present0-absent0]": 0.0047,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_the_refusal_names_the_remedy_that_fits_how_the_copy_was_found[the locked version, another tree-fetched4-present4-absent4]": 0.1725,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_the_refusal_names_the_remedy_that_fits_how_the_copy_was_found[the reference pins a third version, an installed copy fetched at another tag was used-fetched3-present3-absent3]": 0.0061,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_the_refusal_names_the_remedy_that_fits_how_the_copy_was_found[the reference pins another version, fetched at that tag-fetched1-present1-absent1]": 0.0076,+ "tests/unit/pipelex/methods/test_method_lock.py::TestMethodLock::test_the_refusal_names_the_remedy_that_fits_how_the_copy_was_found[the reference pins the locked version, an installed copy of another was used-fetched2-present2-absent2]": 0.0045,"tests/unit/pipelex/methods/test_method_ref.py::TestMethodRefGrammar::test_looks_like_method_ref[-False]": 0.015,"tests/unit/pipelex/methods/test_method_ref.py::TestMethodRefGrammar::test_looks_like_method_ref[./local/path-False]": 1.5362,"tests/unit/pipelex/methods/test_method_ref.py::TestMethodRefGrammar::test_looks_like_method_ref[/absolute/path-False]": 0.0004,@@ -14735,6 +14841,7 @@"tests/unit/pipelex/pipeline/test_bundle_graph_rendering_dry_run.py::TestDryRunBundle::test_library_dirs_already_containing_parent_passed_through": 0.0939,"tests/unit/pipelex/pipeline/test_bundle_graph_rendering_dry_run.py::TestDryRunBundle::test_library_dirs_missing_parent_gets_parent_appended": 0.0026,"tests/unit/pipelex/pipeline/test_bundle_graph_rendering_dry_run.py::TestDryRunBundle::test_library_dirs_none_uses_bundle_parent": 0.7806,+ "tests/unit/pipelex/pipeline/test_bundle_graph_rendering_generate_graph.py::TestGenerateGraphForBundle::test_a_render_that_fails_makes_no_folder": 0.0211,"tests/unit/pipelex/pipeline/test_bundle_graph_rendering_generate_graph.py::TestGenerateGraphForBundle::test_format_dispatch_sets_inclusion_flags[both-True-True]": 0.0053,"tests/unit/pipelex/pipeline/test_bundle_graph_rendering_generate_graph.py::TestGenerateGraphForBundle::test_format_dispatch_sets_inclusion_flags[mermaidflow-True-False]": 0.8203,"tests/unit/pipelex/pipeline/test_bundle_graph_rendering_generate_graph.py::TestGenerateGraphForBundle::test_format_dispatch_sets_inclusion_flags[reactflow-False-True]": 0.0085,@@ -14743,6 +14850,7 @@"tests/unit/pipelex/pipeline/test_bundle_graph_rendering_generate_graph.py::TestGenerateGraphForBundle::test_rename_branch_sanitizes_traversal_name": 0.0029,"tests/unit/pipelex/pipeline/test_bundle_graph_rendering_generate_graph.py::TestGenerateGraphForBundle::test_return_shape[None-None]": 0.0111,"tests/unit/pipelex/pipeline/test_bundle_graph_rendering_generate_graph.py::TestGenerateGraphForBundle::test_return_shape[left_to_right-left_to_right]": 0.2862,+ "tests/unit/pipelex/pipeline/test_bundle_graph_rendering_generate_graph.py::TestGenerateGraphForBundle::test_the_graph_is_written_to_the_folder_made_for_the_pipe_drawn": 0.2125,"tests/unit/pipelex/pipeline/test_bundle_graph_rendering_generate_view.py::TestGenerateViewForBundle::test_direction_precedence[None-None-None]": 0.0056,"tests/unit/pipelex/pipeline/test_bundle_graph_rendering_generate_view.py::TestGenerateViewForBundle::test_direction_precedence[None-left_to_right-left_to_right]": 0.018,"tests/unit/pipelex/pipeline/test_bundle_graph_rendering_generate_view.py::TestGenerateViewForBundle::test_direction_precedence[top_down-left_to_right-top_down]": 0.0032,@@ -15006,6 +15114,8 @@"tests/unit/pipelex/pipeline/test_runner_execute_error_paths.py::TestRunnerExecuteErrorPaths::test_pipelex_error_with_resolved_job_wraps_into_pipeline_execution_error": 0.814,"tests/unit/pipelex/pipeline/test_runner_execute_error_paths.py::TestRunnerExecuteErrorPaths::test_validation_error_wraps_into_pipe_execution_error": 0.101,"tests/unit/pipelex/pipeline/test_runner_models.py::TestRunnerModels::test_deck_keeps_category_keyed_aliases_on_cross_category_collision": 0.9182,+ "tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_an_empty_files_map_is_no_method_and_is_not_refused": 0.0146,+ "tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_execute_refuses_a_method_given_as_the_protocol_s_files_map": 0.1395,"tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_execute_rejects_extra_args_listing_keys_sorted": 0.7517,"tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_models_category_filter_translates_to_listing_enum": 0.0015,"tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_models_category_filter_translates_to_listing_enum[extract]": 0.0006,@@ -15021,7 +15131,9 @@"tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_models_types_every_listing_category_by_the_protocol_member_of_its_name[llm]": 0.0007,"tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_models_types_every_listing_category_by_the_protocol_member_of_its_name[search]": 0.0006,"tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_start_raises_not_implemented_pointing_at_execute": 0.001,+ "tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_validate_refuses_a_method_given_as_the_protocol_s_files_map": 0.0053,"tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_validate_rejects_blank_graph_pipe_code_extra": 0.001,+ "tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_validate_without_mthds_contents_is_an_invalid_request": 0.1224,"tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_version_falls_back_to_unknown_when_distribution_missing": 0.1142,"tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py::TestRunnerProtocolSurfaces::test_version_reports_installed_distribution": 0.0015,"tests/unit/pipelex/pipeline/test_runner_validate_plumbing.py::TestRunnerValidatePlumbing::test_a_local_protocol_states_the_local_caller": 0.1833,@@ -18426,6 +18538,13 @@"tests/unit/pipelex/tools/misc/test_toml_utils.py::TestTOMLUtils::test_validate_toml_file_trailing_space_after_triple_quotes": 0.0019,"tests/unit/pipelex/tools/misc/test_toml_utils.py::TestTOMLUtils::test_validate_toml_file_trailing_whitespace": 0.0017,"tests/unit/pipelex/tools/misc/test_toml_utils.py::TestTOMLUtils::test_validate_toml_file_valid_file_passes": 0.0017,+ "tests/unit/pipelex/tools/misc/test_worker_threads.py::TestWorkerThreads::test_a_call_waits_for_a_free_thread_beyond_the_bound": 0.0555,+ "tests/unit/pipelex/tools/misc/test_worker_threads.py::TestWorkerThreads::test_a_cancelled_caller_waits_for_the_running_call_to_end": 0.1084,+ "tests/unit/pipelex/tools/misc/test_worker_threads.py::TestWorkerThreads::test_a_cancelled_caller_withdraws_a_call_no_thread_has_taken": 0.0576,+ "tests/unit/pipelex/tools/misc/test_worker_threads.py::TestWorkerThreads::test_the_call_runs_in_a_named_thread_off_the_loop_with_the_callers_context": 0.2075,+ "tests/unit/pipelex/tools/misc/test_worker_threads.py::TestWorkerThreads::test_the_calls_error_reaches_the_caller": 0.0031,+ "tests/unit/pipelex/tools/misc/test_worker_threads.py::TestWorkerThreads::test_the_shutdown_of_asyncio_run_waits_for_the_running_call_before_the_cleanup": 0.2455,+ "tests/unit/pipelex/tools/misc/test_worker_threads.py::TestWorkerThreads::test_what_the_call_binds_stays_in_its_thread": 0.1543,"tests/unit/pipelex/tools/network/test_host_rules.py::TestHostRules::test_classify_disallowed_host[-None]": 0.0008,"tests/unit/pipelex/tools/network/test_host_rules.py::TestHostRules::test_classify_disallowed_host[0.0.0.0-private]": 0.0009,"tests/unit/pipelex/tools/network/test_host_rules.py::TestHostRules::test_classify_disallowed_host[10.0.0.5-private]": 0.0008,@@ -20956,6 +21075,8 @@"tests/unit/pipelex/tools/typing/test_import_module_from_file_if_has_classes.py::TestImportModuleFromFileIfHasClasses::test_skip_file_with_no_classes_when_no_filter": 0.1171,"tests/unit/pipelex/tools/typing/test_import_module_from_file_if_has_classes.py::TestImportModuleFromFileIfHasClasses::test_skip_file_without_matching_classes": 0.0138,"tests/unit/pipelex/tools/typing/test_module_file_error.py::TestModuleFileError::test_exception_inheritance": 0.8983,+ "tests/unit/pipelex/tools/typing/test_module_import_lock.py::TestModuleImportLock::test_a_module_failing_to_execute_leaves_sys_modules": 0.1665,+ "tests/unit/pipelex/tools/typing/test_module_import_lock.py::TestModuleImportLock::test_two_concurrent_imports_of_one_file_both_get_the_complete_module": 0.2483,"tests/unit/pipelex/tools/typing/test_serialize_model.py::TestSerializeModel::test_serialize_model_with_hidden_fields": 0.7903,"tests/unit/pipelex/tools/typing/test_structure_printer.py::TestStructurePrinter::test_enum_content": 0.0005,"tests/unit/pipelex/tools/typing/test_structure_printer.py::TestStructurePrinter::test_gantt_chart_content": 0.0971,diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1f731d40b..49df77f34 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -18,6 +18,10 @@- **The refusal of a package the request did not send**: the message of the `unresolved_package_dependency` refusal a static resolution gives, such as the one behind `/v1/resolve`, `/v1/codegen` and `/v1/pipe-io`, tells its reader to send the package's files in `dependencies`, keyed by its address, beside the method's own files in `files`, where it spoke of an in-memory resolve and the host filesystem and advised directory-based resolution; it still carries the words `address-based dependency '<address>'`.- **A run lists each method tree once (Breaking)**: the method trees a run reads, the method's own, its library directories' and its dependency packages', are each listed once, and the run loads the trees its caller listed, so the `method_tree_digest` a run records is the digest of the tree it loaded: `PipelexMTHDSProtocol.execute`, `pipeline_run_setup`, `acquire_library`, `acquire_library_async`, `validate_bundle`, `validate_bundles_in_process`, `fix_bundle_file`, `fix_method_folder`, and `LibraryManagerAbstract.load_libraries` and `load_from_blueprints` take `tree_listing`, a `MethodTreeListing` (`pipelex.libraries.method_tree_listing`) holding the trees already listed, which `run bundle`, `validate bundle` and `fix bundle` on both CLIs hand down from the listing that resolved their target. The listing reads a path as the standard's lister does before it takes anything from what it holds: a folder and a symbolic link naming it are one listing, since the lister follows such a link, a bundle file named alone inside a library directory shares the listing of the tree that directory roots, and a symbolic link to a bundle file, named alone, is refused as the lister refuses it, even once the run listed the file it points to. Loads of one run running at the same time list each tree once and list different trees side by side. The API server's run routes and `/v1/validate` load the trees their check of the method's requirements listed, which `ensure_served_method_requirements_met` now lists through `tree_listing` in place of its `limits`, and which reaches the in-process validator through `scoped_tree_listing`, so the bundle-validator plugin contract is unchanged. `list_library_trees` and `list_library_dir_trees` (`pipelex.libraries.method_trees`) take the lister of a directory's own tree or of its trees (`own_tree_of`, `trees_of`), through which the listing lists them, and `tree_bundle_of_lone_file` is removed: a bundle file named alone is placed in its tree with `MethodTreeListing.lone_file_bundle`.- **A run asks the PipeFunc package-offer factory once per tree**: the run's `MethodTreeListing` keeps each method tree and each dependency package whose `requirements.txt` a check found met, with the execution mode and the factory it was judged against (`PipeFuncEnvironmentSource`, `current_pipe_func_environment_source` in `pipelex.libraries.package_environments`), so a run judges each tree once against them however many of its steps and loads read it, two loads judging one tree at the same moment ask once (`MethodTreeListing.judge_requirements_once`), and on the API server the load serving a request takes the verdict of the runner's check of the served method instead of asking the factory again. A check against another mode or factory, a refused tree and every new run ask again: pipelex keeps a verdict for one run alone, so a factory whose answer takes time keeps its own cache across runs, by the requirements' texts. `ensure_method_requirements_met` and `ensure_package_requirements_met` take the listing as `tree_listing`.+- **`mthds` 0.25.0 and `pipelex-sdk` 0.48.0 (Breaking)**: pipelex pins `mthds==0.25.0` and `pipelex-sdk==0.48.0`, so it implements the MTHDS standard 8.0.0 and the protocol 2.0.0, which the version handshake reports, and a method tree never holds a run's inputs file, `inputs.json` or `inputs.toml` at any depth, so a method folder holding one is listed, and digested, without it.+- **`PipelexMTHDSProtocol` takes the protocol's `files` (Breaking)**: `execute`, `start` and `validate` take the MTHDS protocol's `files` map in the position the protocol gives it, and the local runtime refuses a map holding a file with `request.unsupported` and the reason `method_files_on_local_runtime`, `METHOD_FILES_UNSUPPORTED_REASON` in `pipelex.errors.unsupported_reasons`; `mthds_contents` is a keyword-only argument, which `validate` requires. The API server's `ApiRunner` takes the same arguments, and its routes, which write a method sent in `files` out as a tree before they run it, are unchanged.+- **A hosted run sends its method as a tree (Breaking)**: `pipelex run --hosted` and `pipelex-agent run --runner hosted` send a local method to `/v1/pipe-io`, `/v1/start` and `/v1/execute` as the MTHDS protocol's `files` map, each `.mthds` bundle under its path in the method's tree and each library directory beside the method under a top-level folder named after it, inline up to 256 KiB and by hash beyond, where the run took the bundles' bare contents and pipe-io a list the runner now refuses with a `422`, so a hosted run whose inputs name a local file reads the signature again, and a method that does not load is reported by the tree path of each faulty file. `HostedRunRequest` (`pipelex.hosted.hosted_run`) takes `contents`, each bundle's bytes by tree path, in place of `mthds_files`. A file of the tree that cannot be uploaded stops the run before anything starts, as pipelex-sdk's `MethodFileTransferError`, which both CLIs report with the SDK's verdict and a next step: run again, or report a file the storage refused. A bundle file given with `-L` that the membership rule keeps out of its tree, a hidden one under a dot segment or one `.gitignore` excludes, is refused before anything is sent, as a local run refuses it, where it was sent as it was.+- **A hosted run's lost connection follows pipelex-sdk's reading**: `pipelex run --hosted` and `pipelex-agent run --runner hosted` report a connection lost on the start or the execute request as `HostedRunOutcomeUnknownError` (`client.outcome_unknown`) whenever pipelex-sdk reads it as one that may have started the run (`run_may_have_started`), a proxy's failure and a TLS handshake that was dropped included, which read as an unreachable API, while a connection lost on a request sent before the run's, such as the blob check of a tree sent by hash, stays pipelex-sdk's `ApiUnreachableError`.- **`pipelex-agent validate bundle` and `fix bundle` exit 2 on a configuration refused before the boot**: a configuration that does not validate, which these commands read before the boot for the limits a method's folder is listed under, exits 2, no verdict, where it exited 1, as `pipelex validate bundle` and `pipelex fix bundle` exit on it; the problem is unchanged, and `run bundle` and `inputs bundle` still exit 1.### Fixed@@ -29,7 +33,7 @@### Removed-- **`resolve_crate_from_contents` (Breaking)**: `pipelex.pipeline.resolve_bundle` no longer resolves a crate from bundle contents held as strings. A host resolves a method as `/v1/resolve`, `/v1/codegen` and `/v1/pipe-io` do, by writing its tree out and calling `resolve_crate_from_method_dir`, with the packages it ships in `methods_dirs`; a call into a package nothing shipped is then an `unresolved_package_dependency` item of the invalid verdict, never the `request.unsupported` refusal with the reason `address_based_dependency`, which no resolution of this release gives.+- **`resolve_crate_from_contents` (Breaking)**: `pipelex.pipeline.resolve_bundle` no longer resolves a crate from bundle contents held as strings. A host resolves a method as `/v1/resolve`, `/v1/codegen` and `/v1/pipe-io` do, by writing its tree out and calling `resolve_crate_from_method_dir`, with the packages it ships in `methods_dirs`; a call into a package nothing shipped is then an `unresolved_package_dependency` item of the invalid verdict, never the `request.unsupported` refusal with the reason `address_based_dependency`, which no resolution of this release gives: its constant `ADDRESS_DEPENDENCY_UNSUPPORTED_REASON` (`pipelex.errors.unsupported_reasons`) is removed with `ADDRESS_DEPENDENCY_REFUSAL_MARKER` (`pipelex.methods.address_dependencies`), and a hosted run no longer reads that refusal from `/v1/pipe-io`, only the invalid verdict naming the package nothing shipped.### Securitydiff --git a/api/.claude/skills/postman-bundle/scripts/build_postman_query.py b/api/.claude/skills/postman-bundle/scripts/build_postman_query.pyindex 7c067bf9d..f118ed589 100644--- a/api/.claude/skills/postman-bundle/scripts/build_postman_query.py+++ b/api/.claude/skills/postman-bundle/scripts/build_postman_query.py@@ -14,11 +14,10 @@ judged by the membership rule the runner and every MTHDS client apply(``mthds/docs/spec/method-tree.md``): its root is the nearest directory at orabove the bundle holding ``METHODS.toml``, else the directory handed over, else,for a ``.mthds`` file named alone, the one-file tree of that file; dotfiles,-``.gitignore``d files, virtual environments and nested packages stay out. The-script itself drops a run's inputs file, any file named ``inputs.json`` or-``inputs.toml`` at any depth, as the standard's run-inputs default does, since-the ``mthds`` lister pinned here still lists it: the sibling ``inputs.json``-travels as ``inputs`` and never as a file of the tree. A body built here never uses the by-hash entry+``.gitignore``d files, virtual environments, nested packages and a run's inputs+file, any file named ``inputs.json`` or ``inputs.toml`` at any depth, stay out:+the sibling ``inputs.json`` travels as ``inputs`` and never as a file of the+tree. A body built here never uses the by-hash entry(``{"sha256", "size"}``), which only resolves once the bytes are uploaded to therunner's blob store, so a Postman query or a curl command stays self-contained.The listing stops at the runner's own limits on a tree a request sends.@@ -61,22 +60,17 @@ from pathlib import Pathfrom typing import Any, NamedTuple, NoReturn, castfrom mthds.method_tree.exceptions import MethodTreeError-from mthds.method_tree.file_entry import encode_file_map+from mthds.method_tree.file_entry import Base64FileEntry, HashFileEntry, encode_file_mapfrom mthds.method_tree.lister import list_method_treefrom mthds.method_tree.models import MethodTree, TreeLimitsfrom mthds.method_tree.tree_path import nfc-from pipelex.pipeline.default_file_names import DEFAULT_INPUTS_FILE_NAME, DEFAULT_INPUTS_TOML_FILE_NAME+from pipelex.pipeline.default_file_names import DEFAULT_INPUTS_FILE_NAMEfrom pipelex_api.limits import MAX_METHOD_TREE_FILE_BYTES, MAX_METHOD_TREE_FILES, MAX_METHOD_TREE_TOTAL_BYTES# One file of a method tree as a body carries it: its UTF-8 text, or {"base64": ...} for other bytes.FileEntry = str | dict[str, str | int]-# A run's inputs file, which the standard's run-inputs default keeps out of every tree at any depth-# (`mthds/docs/spec/method-tree.md`, "Run Inputs Files"): a file named exactly so, letter case included.-# A directory of either name excludes nothing.-RUN_INPUTS_FILE_NAMES = frozenset({DEFAULT_INPUTS_FILE_NAME, DEFAULT_INPUTS_TOML_FILE_NAME})-DEFAULT_COLLECTION_UID = "35082494-559c5753-885c-409a-af63-7647fe28d301"POSTMAN_API_BASE = "https://api.getpostman.com"DEFAULT_BUNDLE_FILE_NAME = "bundle.mthds"@@ -205,19 +199,8 @@ def tree_path_of(tree: MethodTree, file_path: Path) -> str | None:return tree_path if tree_path in tree.members else None-def is_run_inputs_file(tree_path: str) -> bool:- """Whether a file of a tree is a run's inputs file, which the standard's run-inputs default keeps out of every tree."""- return tree_path.rsplit("/", 1)[-1] in RUN_INPUTS_FILE_NAMES--def build_files_map(tree: MethodTree) -> dict[str, FileEntry]:- """The ``files`` a body carries: every file of the tree under its tree path, inline, but a run's inputs file.-- The ``mthds`` lister pinned here still lists a file named ``inputs.json`` or- ``inputs.toml``, which the standard keeps out of every tree and a runner- applying the rule refuses as a key, so it is dropped here: a run's inputs- travel as ``inputs``, never as a file of the method. Once the lister applies- the rule itself, no such file reaches this loop.+ """The ``files`` a body carries: every file of the tree under its tree path, inline, as the body's JSON writes it.``mthds`` encodes each file: its text when its bytes are UTF-8, else``{"base64": ...}``. No file is sent by hash, since a hash entry resolves@@ -226,14 +209,19 @@ def build_files_map(tree: MethodTree) -> dict[str, FileEntry]:"""contents: dict[str, bytes] = {}for tree_path in tree.tree_paths:- if is_run_inputs_file(tree_path):- continuelocation = tree.file_location(tree_path)try:contents[tree_path] = location.read_bytes()except OSError as exc:fail(f"cannot read '{location}' to send it as '{tree_path}': {exc}")- return encode_file_map(contents)+ files: dict[str, FileEntry] = {}+ for tree_path, entry in encode_file_map(contents).items():+ match entry:+ case str():+ files[tree_path] = entry+ case Base64FileEntry() | HashFileEntry():+ files[tree_path] = entry.model_dump(mode="json")+ return filesdef parse_bundle_meta(text: str) -> tuple[str | None, str | None]:diff --git a/api/pipelex_api/routes/pipelex/pipeline.py b/api/pipelex_api/routes/pipelex/pipeline.pyindex d994ff36d..7060046de 100644--- a/api/pipelex_api/routes/pipelex/pipeline.py+++ b/api/pipelex_api/routes/pipelex/pipeline.py@@ -25,7 +25,7 @@ from pipelex.pipe_run.pipe_run_protocol import PipeRunProtocolfrom pipelex.pipeline.exceptions import ValidateBundleErrorfrom pipelex.pipeline.pipeline_response import PipelexRunResultExecute, PipelexRunResultStart, RunStatefrom pipelex.pipeline.pipeline_run_setup import pipeline_run_setup-from pipelex.pipeline.runner import PipelexMTHDSProtocol+from pipelex.pipeline.runner import PipelexMTHDSProtocol, refuse_method_filesfrom pipelex.pipeline.validate_bundle_translation import translate_to_validate_bundle_errorfrom pipelex.reporting.usage_records import apply_tokens_usage_wire_shapefrom pipelex.runtime_bridge.exceptions import MissingBundleValidatorError, MissingOrchestratorError@@ -83,6 +83,7 @@ from pipelex_api.security import AuthMode, get_auth_modeif TYPE_CHECKING:from collections.abc import AsyncGenerator+ from mthds.method_tree.file_entry import MethodFilesfrom mthds.protocol.pipe_output import VariableMultiplicityfrom mthds.protocol.pipeline_inputs import PipelineInputsfrom mthds.protocol.working_memory import WorkingMemoryAbstract@@ -345,12 +346,14 @@ class ApiRunner(PipelexMTHDSProtocol):async def execute(self,pipe_code: str | None = None,- mthds_contents: list[str] | None = None,+ files: MethodFiles | None = None,inputs: PipelineInputs | WorkingMemoryAbstract[Any] | None = None,output_name: str | None = None,output_multiplicity: VariableMultiplicity | None = None,dynamic_output_concept_ref: str | None = None,extra: dict[str, Any] | None = None,+ *,+ mthds_contents: list[str] | None = None,delivery_assignment: DeliveryAssignment | None = None,request_id: str | None = None,tree_listing: MethodTreeListing | None = None,@@ -381,6 +384,10 @@ class ApiRunner(PipelexMTHDSProtocol):The method's trees are listed once for the request: the check of its requirements lists them through`tree_listing`, or a listing of its own when none is given, and the run loads them from that same listing."""+ # The route resolves a method sent as `files` into a written tree before it calls this runner, which takes it+ # as its library directory, so the map reaches the runner only from in-process code, and is refused as the+ # base runner refuses it, before any backend is looked up.+ refuse_method_files(files=files)# Resolve the effective orchestration mode FIRST — a per-request override the deployment# policy forbids is refused (422) here, before any library load / run registration. Mirrors start().api_config = get_api_config()@@ -398,6 +405,7 @@ class ApiRunner(PipelexMTHDSProtocol):self._pipe_run = _OrchestratorPipeRun(orchestrator=orchestrator, orchestration_mode=orchestration_mode)return await super().execute(pipe_code=pipe_code,+ files=files,mthds_contents=mthds_contents,inputs=inputs,output_name=output_name,@@ -413,12 +421,14 @@ class ApiRunner(PipelexMTHDSProtocol):async def start(self,pipe_code: str | None = None,- mthds_contents: list[str] | None = None,+ files: MethodFiles | None = None,inputs: PipelineInputs | WorkingMemoryAbstract[Any] | None = None,output_name: str | None = None,output_multiplicity: VariableMultiplicity | None = None,dynamic_output_concept_ref: str | None = None,extra: dict[str, Any] | None = None,+ *,+ mthds_contents: list[str] | None = None,pipeline_run_id: str | None = None,callback_urls: list[str] | None = None,request_id: str | None = None,@@ -459,6 +469,10 @@ class ApiRunner(PipelexMTHDSProtocol):(`PipelineApiExtras.orchestration_mode`); it is resolved against the deployment's`api.toml` policy and a forbidden override is refused with a 422."""+ # The route resolves a method sent as `files` into a written tree before it calls this runner, which takes it+ # as its library directory, so the map reaches the runner only from in-process code, and is refused as the+ # base runner refuses it.+ refuse_method_files(files=files)if extra:# Nothing on the wire reaches `extra`: the route parses the extras itself and passes them by name, so a# value here is a fault of the in-process code calling this runner, never the caller's.diff --git a/api/tests/unit/test_execute_dispatch.py b/api/tests/unit/test_execute_dispatch.pyindex c1c90ecb3..f619f46b2 100644--- a/api/tests/unit/test_execute_dispatch.py+++ b/api/tests/unit/test_execute_dispatch.py@@ -30,9 +30,12 @@ from mthds.protocol.pipe_io_contracts import (from pipelex.core.memory.working_memory import MAIN_STUFF_NAMEfrom pipelex.core.pipes.pipe_io_artifacts import PipeIOArtifactsfrom pipelex.core.pipes.pipe_output import PipeOutput+from pipelex.errors.problem import ProblemView+from pipelex.errors.unsupported_reasons import METHOD_FILES_UNSUPPORTED_REASONfrom pipelex.graph.graphspec import GraphSpecfrom pipelex.pipe_run.delivery_assignment import DeliveryAssignmentfrom pipelex.pipe_run.pipe_job import PipeJob+from pipelex.pipeline.request_exceptions import PipelexRequestErrorfrom pipelex.plugins.orchestrator_registry import OrchestratorRegistryfrom pipelex.runtime_bridge.exceptions import MissingOrchestratorErrorfrom pipelex.runtime_bridge.payloads import PipelexPipeDispatchAck, PipelexPipeRunOutput@@ -50,6 +53,13 @@ from tests.unit._problems import assert_problem_PIPELINE_NS = "pipelex_api.routes.pipelex.pipeline"+def _assert_the_files_map_refusal(*, error: PipelexRequestError) -> None:+ """The refusal of a `files` map handed to the runner object: on the field `files`, with the local runtime's reason."""+ assert error.field == "files"+ params = error.to_problem(view=ProblemView.CALLER).model_dump(mode="json")["params"]+ assert params == {"field": "files", "reason": METHOD_FILES_UNSUPPORTED_REASON}++class _StubOrchestrator:"""A backend-agnostic stand-in orchestrator: echoes the job's working memory back as completed output.@@ -407,3 +417,24 @@ class TestExecuteDispatch:)assert exc_info.value.mode == "temporal"assert exc_info.value.resolve_error_code() == "runtime.unsupported"++ @pytest.mark.asyncio+ async def test_execute_refuses_a_method_given_as_the_protocol_s_files_map_before_any_dispatch(self, mocker: MockerFixture) -> None:+ """The runner's routes resolve a request's `files` into a tree themselves: the runner object takes `mthds_contents`."""+ registry = mocker.patch(f"{_PIPELINE_NS}.get_orchestrator_registry")++ with pytest.raises(PipelexRequestError) as exc_info:+ await ApiRunner().execute(pipe_code="echo", files={"main.mthds": VALID_MTHDS}, inputs={"text": "hello"})++ _assert_the_files_map_refusal(error=exc_info.value)+ registry.assert_not_called()++ @pytest.mark.asyncio+ async def test_start_refuses_a_method_given_as_the_protocol_s_files_map_before_any_dispatch(self, mocker: MockerFixture) -> None:+ registry = mocker.patch(f"{_PIPELINE_NS}.get_orchestrator_registry")++ with pytest.raises(PipelexRequestError) as exc_info:+ await ApiRunner().start(pipe_code="echo", files={"main.mthds": VALID_MTHDS}, inputs={"text": "hello"})++ _assert_the_files_map_refusal(error=exc_info.value)+ registry.assert_not_called()diff --git a/docs/api-server/openapi/pipelex-api.openapi.yaml b/docs/api-server/openapi/pipelex-api.openapi.yamlindex a33d0e446..707de91da 100644--- a/docs/api-server/openapi/pipelex-api.openapi.yaml+++ b/docs/api-server/openapi/pipelex-api.openapi.yaml@@ -2,8 +2,8 @@openapi: 3.1.0info:title: Pipelex API- summary: The source-available Pipelex runner — implements MTHDS Protocol v1.0.0.- description: 'This server implements the [MTHDS Protocol](https://mthds.ai) v1.0.0 (`POST /execute`, `POST /start`, `POST+ summary: The source-available Pipelex runner — implements MTHDS Protocol v2.0.0.+ description: 'This server implements the [MTHDS Protocol](https://mthds.ai) v2.0.0 (`POST /execute`, `POST /start`, `POST/validate`, `GET /models`, `GET /version` — marked `x-mthds-protocol: true`) plus the Pipelex API extensions: resolveand codegen (`/resolve`, `/codegen`), the pipe I/O route (`/pipe-io`), the model reference check (`/models/check`), andeditor tooling (`/lint`, `/format`). Contract layering: MTHDS Protocol ⊂ Pipelex API (this server) ⊂ Pipelex hosted API.@@ -7141,6 +7141,10 @@ components:- type: string- type: 'null'title: Runner Version+ blob_store:+ type: boolean+ title: Blob Store+ default: falseimplementation:type: stringtitle: Implementation@@ -7152,10 +7156,6 @@ components:- type: string- type: 'null'title: Runtime Version- blob_store:- type: boolean- title: Blob Store- default: falseadditionalProperties: truetype: objectrequired:diff --git a/docs/building-methods/pipes/executing-pipelines.md b/docs/building-methods/pipes/executing-pipelines.mdindex 7480e85ff..ec1544c8c 100644--- a/docs/building-methods/pipes/executing-pipelines.md+++ b/docs/building-methods/pipes/executing-pipelines.md@@ -90,7 +90,7 @@ When using `PipelexMTHDSProtocol`, you can control library behavior with these p- **`library_dirs`**: A list of directory paths to load pipe definitions from. **These directories must contain both your `.mthds` files AND any Python files defining `StructuredContent` classes** (e.g., `*_struct.py` files). If not specified, Pipelex falls back to the default library directories passed to `Pipelex.make(library_dirs=...)`, then to the `PIPELEXPATH` environment variable; if none of these are set, no library directories are loaded.-- **`mthds_contents`**: When provided to `PipelexMTHDSProtocol.execute()`, Pipelex parses these strings and loads them into the library in addition to any resolved library directories. To run with only this content, disable directory loading explicitly (e.g. `library_dirs=[]`). This is useful for dynamic pipeline execution without file-based definitions.+- **`mthds_contents`**: When provided to `PipelexMTHDSProtocol.execute()` or `validate()`, by keyword, Pipelex parses these strings and loads them into the library in addition to any resolved library directories. To run with only this content, disable directory loading explicitly (e.g. `library_dirs=[]`). This is useful for dynamic pipeline execution without file-based definitions. `validate()` requires it. The protocol's own method source, `files`, a map from each file's path in the method's tree to its content, sits in the position the MTHDS protocol gives it, but the local runtime does not take it yet: a map holding a file is refused with `request.unsupported` and the reason `method_files_on_local_runtime` (`METHOD_FILES_UNSUPPORTED_REASON` in `pipelex.errors.unsupported_reasons`), before anything is set up.- **`bundle_uris`**: Optional file paths identifying the bundles passed as `mthds_contents` (matched by position). When a URI matches a bundle already loaded from the library directories, that content is skipped instead of being loaded twice. Without `bundle_uris`, every `mthds_contents` entry is loaded unconditionally — so passing content that duplicates a directory-loaded bundle raises a duplicate-declaration error. A content whose URI names a file on this machine is loaded as read from that file, so its steps read the files beside it, such as a `PipeDocGen` step's `template_file`, and an address-based reference is looked for in a `.mthds/methods/` directory above it, exactly as when its directory loads; without `bundle_uris`, a content string has no directory, and its template files are passed as `submitted_files` to `PipelexMTHDSProtocol`, so a step naming one by a path no such file could be keyed by, such as one through a `..` segment, is refused when the content is parsed.diff --git a/docs/building-methods/pipes/running-on-the-hosted-api.md b/docs/building-methods/pipes/running-on-the-hosted-api.mdindex 558309cf6..34dc8e68f 100644--- a/docs/building-methods/pipes/running-on-the-hosted-api.md+++ b/docs/building-methods/pipes/running-on-the-hosted-api.md@@ -14,7 +14,7 @@ The client reads its key from `PIPELEX_API_KEY` and its origin from `PIPELEX_BAS## Running a Method-The client runs the same three sources the CLI does: a published method by its address (`method_ref`), a method stored on the hosted platform by its catalog id (`method_id`), or your own bundle by its contents (`mthds_contents`). `start_and_wait` starts the run and polls it until it ends, so a long run is not cut short by a synchronous request's timeout.+The client runs the same three sources the CLI does: a published method by its address (`method_ref`), a method stored on the hosted platform by its catalog id (`method_id`), or your own method as its tree, the MTHDS protocol's `files` map from each file's path in the method's folder to its content, which the client builds for you from a folder or a `.mthds` file (`tree`) or from each file's bytes or text by its path (`contents`). `start_and_wait` starts the run and polls it until it ends, so a long run is not cut short by a synchronous request's timeout.```pythonimport asyncio@@ -37,18 +37,20 @@ asyncio.run(main())`results.main_stuff` is the main output's content, as JSON. `results.working_memory` holds every stuff of the run, each naming its concept by ref, and `results.graph_spec` the run's execution graph.-To run your own bundle, send its contents and name the pipe, or leave `pipe_code` out to run the bundle's `main_pipe`:+To run your own method, send its tree and name the pipe, or leave `pipe_code` out to run the method's entry pipe:```pythonfrom pathlib import Pathresults = await client.start_and_wait(pipe_code="summarize",- mthds_contents=[Path("my_bundle.mthds").read_text(encoding="utf-8")],+ tree=Path("my_bundle.mthds"),inputs={"text": "…"},)```+The client lists the tree as every MTHDS client lists it, so a `.gitignore`d or hidden file, and a run's `inputs.json`, stay out. A small tree travels inline; a larger one by the hash of each file, once the client has uploaded the files the hosted API lacks.+## Inputs That Name Local FilesThe hosted API cannot read your machine's files, so a document or an image given as a local path is uploaded first. `prepare_inputs` reads the pipe's signature from the hosted API, uploads each local file found at a document or image input, and returns the inputs with each one replaced by its storage URI. It takes the method the same way the run does, and the pipe as its qualified ref, `domain.pipe_code`:@@ -71,7 +73,7 @@ A relative path is read from the working directory, and a `file://` URI is not dTwo cases where `pipelex run --hosted` goes further than `prepare_inputs`:- `prepare_inputs` refuses an explicit `None` at a document or image input. Leave an optional file out of the inputs rather than setting it to `None`. The CLI uploads the files itself and keeps the `null` for the run.-- `prepare_inputs` reads the signature through a route that cannot load a method calling another method by its address (`github.com/…`), so it refuses such a method, which `start_and_wait` runs. Give its files as `https://` URLs and start the run without preparing the inputs.+- `prepare_inputs` reads the signature through a route that loads only the packages the request sends in `dependencies`, so it refuses a method calling another method by its address (`github.com/…`) whose package is not sent with it, which `start_and_wait` runs, the hosted API fetching the package itself. Send that package in `dependencies`, or give the files as `https://` URLs and start the run without preparing the inputs.## Errors@@ -82,27 +84,25 @@ A failure is one of the SDK's typed errors, from `pipelex_sdk.errors`, all subcl- `RunTimeoutError` is a run that outlived the wait; it keeps running, and `run_id` reads its result later with `wait_for_result`.- `ApiUnreachableError` is a request that got no answer, on every route, `start` and `execute` included. Its `__cause__` is httpx's exception, and its `code` names the failure: `ABORT_TIMEOUT` for a read or a write that timed out, otherwise httpx's class name, such as `ConnectError`, `ConnectTimeout`, `ReadError` or `RemoteProtocolError`.- `InputPreparationError` and its subclasses are a local file that could not be read or uploaded.+- `MethodFileTransferError` is a file of a tree sent by hash that could not be uploaded to the hosted API's storage before the request, so nothing was started. Its `code` says why, `unreachable`, `storage_error` or `refused`, and `retryable` whether the same call can succeed later, which holds for every code but `refused`.### A Start That Got No Answer-An `ApiUnreachableError` raised by `start` does not say by itself whether the run was created, but its cause does. A `ConnectError`, `ConnectTimeout`, `PoolTimeout`, `UnsupportedProtocol` or `ProxyError` means the request never left your machine, so no run exists and starting again is safe. Any other cause, such as a `ReadError`, a `WriteError`, a `RemoteProtocolError` or a timeout coded `ABORT_TIMEOUT`, can come after the hosted API received the request, so a run may exist with no id returned: check the run history on app.pipelex.com before starting it again.+An `ApiUnreachableError` raised by `start` or `execute` says whether the run may have been created, in `run_may_have_started`. pipelex-sdk sets it only on the start or the execute request itself, and only when the transport failure does not prove the request never left your machine. It is `False` for a connection that could not be made, and for a failure on a request the call sends before the run's, such as the blob check of a tree sent by hash, so no run exists and starting again is safe. It is `True` for a read or a write that failed or timed out, a connection closed once the request had left, a proxy's failure or a TLS handshake that was dropped, any of which can come after the hosted API received the request: a run may exist with no id returned, so check the run history on app.pipelex.com before starting it again.```python-import httpxfrom pipelex_sdk.errors import ApiUnreachableError-NEVER_SENT = (httpx.ConnectError, httpx.ConnectTimeout, httpx.PoolTimeout, httpx.UnsupportedProtocol, httpx.ProxyError)-try:started = await client.start(method_ref="github.com/Pipelex/methods/[email protected]", inputs={"text": "Hello world."})except ApiUnreachableError as exc:- if isinstance(exc.__cause__, NEVER_SENT):- ... # No run was created: check the network and the origin, then start again.- else:+ if exc.run_may_have_started:... # A run may exist: look it up in the run history before starting again.+ else:+ ... # No run was created: check the network and the origin, then start again.```-`start_and_wait` sends more than the start, so tell its requests apart with its two callbacks. `on_starting` is called right before each request that may create a run is sent, and `on_started` with the acknowledgement once the run exists. A failure before `on_starting` was called started nothing, a failure after `on_started` concerns a run whose id you hold, which `wait_for_result` follows, and only a failure in between needs its cause read as above.+`start_and_wait` sends more than the start, so tell its requests apart with its two callbacks. `on_starting` is called right before each request that may create a run is sent, and `on_started` with the acknowledgement once the run exists. A failure before `on_starting` was called started nothing, a failure after `on_started` concerns a run whose id you hold, which `wait_for_result` follows, and only a failure in between needs `run_may_have_started` read as above.`pipelex run --hosted` and `pipelex-agent run --runner hosted` draw the same line, and report the second case as pipelex's own `HostedRunOutcomeUnknownError`. `PipelexAPIClient` never raises that error, so a program that calls the client directly reads the cause itself.diff --git a/docs/tools/cli/agent-cli.md b/docs/tools/cli/agent-cli.mdindex 3b82c345f..aba7ad935 100644--- a/docs/tools/cli/agent-cli.md+++ b/docs/tools/cli/agent-cli.md@@ -55,7 +55,7 @@ For `bundle` and `method`, use `--pipe` to target a specific pipe.#### Running on the hosted API-With `--runner hosted` (or `--hosted`, or `[run] execution = "hosted"`), the run executes on the hosted Pipelex API and nothing local is booted: no provider key or inference configuration is needed on this machine, only a Pipelex API key in `PIPELEX_API_KEY`, saved in `~/.pipelex/.env` by `pipelex login` or exported in the shell. A `.env` file Pipelex loads wins over the shell, and the working directory's wins over `~/.pipelex/.env`, so an exported key is read only when neither file sets the variable. What the run sends is what a local run would load, and only the contents of its `.mthds` files: a PipeFunc's Python, structure classes, `METHODS.toml` and the packages a dependency alias names stay on this machine, so a local bundle relying on them runs with `--runner local`. `run bundle` sends the bundle, then every `.mthds` file of its library directories' method trees, so a bundle the membership rule keeps out is never sent. `run pipe` sends its library directories' files (the installed method exporting the pipe and `-L`, else `PIPELEXPATH`) and is refused when it has none. `run method` sends an installed or local method's files, but a published address (`github.com/owner/repo[/name][@tag]`) goes as a `method_ref` and a stored method's catalog id (`mt_…`) as a `method_id`, both resolved by the hosted API, so nothing is fetched or read locally and `-L` is refused with them. A local file named at a document or image input is uploaded first (a relative path in an inputs file resolves against that file's directory, and a `file://` URI is read as its path), and the run's inputs carry its storage URI, while a `.csv` path at a structured-list input is not uploaded, so give its rows as a JSON list; an explicit `null`, such as an optional image left out, reaches the run as `null`. The method's signature is read only when some value of the inputs names an existing file on this machine, so inputs naming none go straight to the run, a method calling another one by its address included. Such a method cannot have a local file uploaded yet: give the file as an `https://` URL. `run bundle` on a bundle file with no `-L` sends `PIPELEXPATH`'s files too, as a local run loads them, and `run method` takes a method installed under a name spelled like a catalog id (`mt_reports`) as that method. `--dry-run` and `--mock-inputs` are refused on a hosted run, while `--graph` / `--no-graph` and `--costs` / `--no-costs` are accepted and have no effect there, since a hosted run writes nothing to disk and emits no cost events on this machine (`pipelex run --hosted` refuses `--costs`). Its requests name their client in the `User-Agent` as `pipelex-cli/<version>`, as `pipelex run --hosted` does, so the hosted API counts them as CLI runs.+With `--runner hosted` (or `--hosted`, or `[run] execution = "hosted"`), the run executes on the hosted Pipelex API and nothing local is booted: no provider key or inference configuration is needed on this machine, only a Pipelex API key in `PIPELEX_API_KEY`, saved in `~/.pipelex/.env` by `pipelex login` or exported in the shell. A `.env` file Pipelex loads wins over the shell, and the working directory's wins over `~/.pipelex/.env`, so an exported key is read only when neither file sets the variable. What the run sends is what a local run would load, and only its `.mthds` files, as one method tree, the MTHDS protocol's `files` map: the method's own bundles under the paths they have in its folder and each library directory beside it under a top-level folder named after it, inline up to 256 KiB and by hash beyond (see [Running on the Hosted API](run.md#running-on-the-hosted-api)). A PipeFunc's Python, structure classes, `METHODS.toml` and the packages a dependency alias names stay on this machine, so a local bundle relying on them runs with `--runner local`. `run bundle` sends the bundle, then every `.mthds` file of its library directories' method trees, so a bundle the membership rule keeps out is never sent. `run pipe` sends its library directories' files (the installed method exporting the pipe and `-L`, else `PIPELEXPATH`) and is refused when it has none. `run method` sends an installed or local method's files, but a published address (`github.com/owner/repo[/name][@tag]`) goes as a `method_ref` and a stored method's catalog id (`mt_…`) as a `method_id`, both resolved by the hosted API, so nothing is fetched or read locally and `-L` is refused with them. A local file named at a document or image input is uploaded first (a relative path in an inputs file resolves against that file's directory, and a `file://` URI is read as its path), and the run's inputs carry its storage URI, while a `.csv` path at a structured-list input is not uploaded, so give its rows as a JSON list; an explicit `null`, such as an optional image left out, reaches the run as `null`. The method's signature is read only when some value of the inputs names an existing file on this machine, so inputs naming none go straight to the run, a method calling another one by its address included. Such a method cannot have a local file uploaded yet: give the file as an `https://` URL. `run bundle` on a bundle file with no `-L` sends `PIPELEXPATH`'s files too, as a local run loads them, and `run method` takes a method installed under a name spelled like a catalog id (`mt_reports`) as that method. `--dry-run` and `--mock-inputs` are refused on a hosted run, while `--graph` / `--no-graph` and `--costs` / `--no-costs` are accepted and have no effect there, since a hosted run writes nothing to disk and emits no cost events on this machine (`pipelex run --hosted` refuses `--costs`). Its requests name their client in the `User-Agent` as `pipelex-cli/<version>`, as `pipelex run --hosted` does, so the hosted API counts them as CLI runs.The success envelope has the shape of a local run's. Compact, it is the main output's content. With `--with-memory`, `main_stuff.json` is that content (the hosted API renders no Markdown, so the markdown output shows the JSON), `working_memory` is the whole working memory, `pipeline_run_id` names the run on the hosted API, and `uploads` lists the files uploaded for it. A hosted run writes nothing to disk.@@ -235,7 +235,8 @@ In Markdown, the default, the problem reads as a `## <title>` heading, the detai- **A run the runner refuses** reports the runner's problem document by the members the standard and Pipelex declare: its `code`, `domain`, `retry`, `next_step`, `params`, `location`, its `errors` items, each with its `code`, `detail`, `params`, `location`, `suggestions` and `suggested_fix`, its `status` and its `request_id`, which is what to quote when the fault is the runner's. A member no reader declares, at any level, such as the `error_type`, `error_domain` and `retryable` a runner's own refusals may still carry, is left out, and so is a member of Pipelex's (`request_id`, `run_error`) in a shape this version does not read, alone, so the problem around it is still reported. An answer that carries `diagnostics`, which a runner answers only to its operator, is projected onto the caller's view, its next step re-aimed at the caller, and so is the run's problem an answer nests as `run_error`, which is the run's stored record, whatever view the answer around it is in. A run that failed at a pipe is located there, `location.pipe` and `location.path`. A method refused before any pipe ran is `method.invalid`, its faults in `errors`.- **A refusal the hosted plane answers in its own shape**, which predates the standard's problem document, reads as the core code its status and the plane's own `code` name, with the plane's own `detail`, its `request_id` and the next step `pipelex run --hosted` gives: `auth.missing_credential` for a `401` or a `403` when no key was sent, telling how to get one with `pipelex login`; `auth.invalid_credential` for a `401`, and for the bare `403` the hosted API's edge answers without a reason, an unknown key among its causes, telling to run `pipelex login` or correct `PIPELEX_API_KEY`; `auth.forbidden` for a `403` the platform answers with one of its authorization codes, `forbidden` or `role_not_permitted`, for a key it accepted and an operation that key may not do, while a `403` with any other code, such as one for a key that expired, is `auth.invalid_credential`; `run.not_found` or `method.not_found` for a `404` whose code names the run or the method's version, and `request.not_found` for any other, telling to check the method's address and the origin; and `account.rate_limited` for a `429`, with `retry: yes` and the delay its `Retry-After` header or its body states as `retry_after`.-- **A runner that cannot be reached** is `client.unreachable`, naming the base URL in `params.base_url`, with `retry: yes`: check the network connection and the origin, `--base-url`, else `PIPELEX_BASE_URL`, then run again. A connection lost after the run request left, when a run may exist with no id returned, is `client.outcome_unknown`.+- **A runner that cannot be reached** is `client.unreachable`, naming the base URL in `params.base_url`, with `retry: yes`: check the network connection and the origin, `--base-url`, else `PIPELEX_BASE_URL`, then run again. A connection lost on the start or the execute request, unless it proves that request never left, is `client.outcome_unknown`, since a run may exist with no id returned; one lost on a request sent before the run's, such as the check of which files of a large tree the runner holds, reads as a runner that cannot be reached.+- **A file of the method's tree that could not be uploaded**, a tree past 256 KiB travelling by the hash of each file, stops the run before anything starts. Its problem is the one the client read for the upload, `client.unreachable` naming the storage's host when no answer came, else the one the storage's status reads as, and its `retry` verdict and its next step's kind are pipelex-sdk's own verdict: `retry: yes` with a `retry` step to run again, or, for a file the storage refused, `retry: no` with a `report` step. `message` names the file's SHA-256, never the upload link.- **Any other answer that is no problem document**, such as a gateway's error page, is read from its status by the client: `client.response_unreadable` naming the status. When the answer gives its reason, as a runner's own refusal in the former shape does (the `422` an older runner answers for a reserved input key), that reason is the problem's `detail`, and its next step is the one `pipelex run --hosted` gives: the advice the answer gave, of the kind that advice names (`check_account` for an advice to check the billing, for instance), else, for a `4xx`, to change what the reason names. **A runner's own refusal in the former shape that lists validation items**, the `422` a runner answers `/v1/start` and `/v1/execute` with for a method that does not validate, is `method.invalid` with those items as its `errors`, each coded as a local verdict codes it and located in the file it was sent as, its reason as the `detail` and its advice as the next step, as a failed run's stored report in the same shape reads. **A server fault on the run request**, any 5xx but a `501` and a `503` coded `pipeline_start_unavailable`, is `client.outcome_unknown` whatever its body, because the runner may have started the run before it failed to answer: check the run history before running again, since running again can repeat a paid run.- **A run that started and failed** is `run.failed`, naming the run and the status it ended with in `params` and `pipeline_run_id`, and `message` quotes the reason the hosted API stored for it. The run's own problem rides as `run_error`, in the caller's view, rendered in Markdown under `### The run's own problem` as a problem is, one heading level down. A stored report that is a problem document is read as a runner's answer is; one in the shape the hosted plane wrote before it stored problem documents names no code, so it reads as `method.invalid` with its validation items as `errors` when it lists some, and as `runtime.unexpected` otherwise, its message as the `detail`, its advice as the next step and its `retryable` as the `retry` verdict, which is what `pipelex run --hosted` tells of the same run.- **A run that failed on the way** carries the code of what happened: `run.not_finished` for a run that keeps going past the wait, `client.response_unreadable` for a completed run that delivered no main output, `client.follow_failed` for a run that started and whose result could not be read (it may still be running and is paid for, so look it up rather than run again), `method.invalid` for a method the hosted API found does not load before any run starts, when the inputs name a local file (its `errors` coded as a local verdict codes them, each naming its file in `location.file`), `request.unsupported` when the inputs name a local file and the method calls another one by its address (give the file as an `https://` URL), and `client.not_configured` for a base URL that is not an origin, refused before anything is sent. Every failure met once the hosted API acknowledged the run carries its `pipeline_run_id`. pipelex's own failures add their sentence as `message` and their advice as the Markdown's `💡` tip, and so do the client's own, whose sentence says what the code's parameters cannot, such as how long it waited for a run that did not finish. A failure the client meets on its own side takes the next step `pipelex run --hosted` tailors for it, in place of its code's: where to find a run that did not finish, that a blocking run cut off may still be going, that the server takes no uploads, which file path to check.diff --git a/docs/tools/cli/run.md b/docs/tools/cli/run.mdindex a8f7060a5..43cff6946 100644--- a/docs/tools/cli/run.md+++ b/docs/tools/cli/run.md@@ -208,11 +208,13 @@ Every request a hosted run sends names its client in its `User-Agent` as `pipele- `run pipe` sends every `.mthds` file of its library directories: the installed method exporting the pipe and `-L`, else `PIPELEXPATH`. With none of them, the run is refused and asks for `-L`.- `run method` sends an installed or local method's files. A published address goes as a reference and a catalog id (`mt_…`) as an id, both resolved by the hosted API: nothing is fetched or read locally, `-L` is refused with them, and a relative `--inputs` path resolves against the working directory rather than the method's. A method installed under a name spelled like a catalog id, such as `mt_reports`, is that installed method, not an id.-Only the contents of the `.mthds` files are sent. A PipeFunc's Python function, Python structure classes, the package manifest `METHODS.toml` and the packages a bundle calls through a dependency alias (`alias->domain.pipe_code`) stay on this machine, and the hosted runner does not have them, so a local bundle or method that relies on any of them runs with `--local`. A published method run by its address is not limited this way: the hosted runner fetches the whole package itself (see [Python in fetched methods](run-by-address.md#python-in-fetched-methods-the-hosted-rule)).+The files go as one method tree, the MTHDS protocol's `files` map, which the hosted API reads for both the signature and the run: each bundle under its path in its method's tree, so the method's own bundles keep the paths they have in its folder, a tree nested in that folder keeps its place there, and each library directory beside the method goes under a top-level folder of its own, named after the directory, numbered when that name is already taken (`shared-2/`), or `library-1/` when the name is not one a method tree may hold, such as a hidden directory's. A tree of 256 KiB or less travels inline; a larger one travels by the hash of each file, once the files the hosted API does not hold yet are uploaded, and nothing of the run starts when that upload fails: the next step says to run again, or to report a file the hosted API's storage refused, which running again does not change.++Only the `.mthds` files are sent. A PipeFunc's Python function, Python structure classes, the package manifest `METHODS.toml` and the packages a bundle calls through a dependency alias (`alias->domain.pipe_code`) stay on this machine, and the hosted runner does not have them, so a local bundle or method that relies on any of them runs with `--local`. A published method run by its address is not limited this way: the hosted runner fetches the whole package itself (see [Python in fetched methods](run-by-address.md#python-in-fetched-methods-the-hosted-rule)).**Local files in the inputs** are uploaded before the run. A path at a document or image input (compact, as `"invoice.pdf"`, or as the `url` of a document or image object, in a list or nested in a structure) is uploaded, and the run receives its storage URI instead. A relative path written in an inputs file resolves against that file's directory, as on a local run, and a `file://` URI is read as the path it names. A text that reads like a file name at any other input is left as text, and that includes a `.csv` path given to a structured-list input: it is not uploaded, the hosted runner receives a path it cannot read, so give the rows as a JSON list instead, or run with `--local`. `http(s)://` URLs, whatever the case of the scheme, are passed through for the hosted API to fetch, and an explicit `null`, such as an optional image left out, reaches the run as `null`.-The method's signature, which says where a file sits, is read from the hosted API only when some value of the inputs, at any depth, names an existing file on this machine (from the inputs file's directory or the working directory). Inputs naming none go straight to the run. When the signature is read, a method that does not load is refused there, before any run starts, with validation errors that name the file each fault is in. A method that calls another method by its address (`github.com/…`) cannot have its signature read yet, so a local file cannot be uploaded for it: the run is refused before it starts, and the file has to be given as an `https://` URL instead. The same method runs with inputs that name no local file.+The method's signature, which says where a file sits, is read from the hosted API only when some value of the inputs, at any depth, names an existing file on this machine (from the inputs file's directory or the working directory). Inputs naming none go straight to the run. When the signature is read, a method that does not load is refused there, before any run starts, with validation errors that name each faulty file by its path in the tree sent. A method that calls another method by its address (`github.com/…`) cannot have its signature read yet, since the signature is read with only the packages the request sends and a hosted run sends none, so a local file cannot be uploaded for it: the run is refused before it starts, naming the package, and the file has to be given as an `https://` URL instead. The same method runs with inputs that name no local file, the hosted API fetching the package itself.**What it saves** goes where a local run saves its outputs, in `<output-dir>/<label>_output_NN/`: `main_stuff.json` (and `main_stuff.md` when the main output is text), `working_memory.json`, and `graphspec.json` when the hosted API returned the run's graph, which [`pipelex graph render`](../../features/execution-graph.md) turns into a viewer. The label is the pipe that ran, or, for a method run by its address or its catalog id without `--pipe`, the last segment of the address or the id itself, as in `mt_abc123_output_01/`. The run id is printed as soon as the hosted API acknowledges the run, as `Run <id> started on the hosted API`, and again with the recap.@@ -220,7 +222,7 @@ The method's signature, which says where a file sits, is read from the hosted AP**What it refuses**: `--dry-run`, `--mock-inputs`, `--orchestrator`, `--save-csv`, `--costs` / `--no-costs` and `--graph-full-data` / `--graph-no-data` steer this machine's runtime, which a hosted run never boots, so each is refused with a message pointing at `--local`. `--base-url` on a run that executes locally is refused too.-**When it fails**, the message gives the hosted API's reason and a next step: the one the server advised when it gave one, else one that follows the status (a refused key points at `PIPELEX_API_KEY` and `pipelex login`, an unknown method or route at the method's address and the base URL, a rate limit says to wait). A bundle the hosted API refuses lists its validation errors, and so does a run that started and failed on them. Once the hosted API has acknowledged the run, the failure also prints the run id: a run that failed, one that outlived the wait, one that completed without a main output, and one whose result could not be read, because the network or the hosted API failed while the run was being followed. That last one may still be running and is paid for, so look it up by its id on app.pipelex.com rather than running the command again. A connection lost after the request that runs the method was sent is not reported as a network failure either: the hosted API may have created the run before the connection failed, and its id never arrived, so check the run history before running again. Only a failure before the request left this machine, a connection that could not be made, points at the network and the base URL. A server that keeps no runs to poll, such as a self-hosted runner, is run on the blocking route, and when the connection is cut before its result comes back, the run may still be going there: running the command again runs the method again, so raise the timeout of the proxy in front of that server, or point the base URL at a server that keeps runs. The exit code is `1`.+**When it fails**, the message gives the hosted API's reason and a next step: the one the server advised when it gave one, else one that follows the status (a refused key points at `PIPELEX_API_KEY` and `pipelex login`, an unknown method or route at the method's address and the base URL, a rate limit says to wait). A bundle the hosted API refuses lists its validation errors, and so does a run that started and failed on them. Once the hosted API has acknowledged the run, the failure also prints the run id: a run that failed, one that outlived the wait, one that completed without a main output, and one whose result could not be read, because the network or the hosted API failed while the run was being followed. That last one may still be running and is paid for, so look it up by its id on app.pipelex.com rather than running the command again. A connection lost on the request that runs the method is not reported as a network failure either, unless it proves that request never left this machine: the hosted API may have created the run before the connection failed, and its id never arrived, so check the run history before running again. Only a failure that proves no run was asked for points at the network and the base URL: a connection that could not be made, or one lost on a request sent before the run's, such as the check of which files of a large tree the hosted API holds. A server that keeps no runs to poll, such as a self-hosted runner, is run on the blocking route, and when the connection is cut before its result comes back, the run may still be going there: running the command again runs the method again, so raise the timeout of the proxy in front of that server, or point the base URL at a server that keeps runs. The exit code is `1`.**A self-hosted Pipelex API server**, such as the [Pipelex API server](../../api-server/index.md) run from its Docker image, is reached the same way, by pointing `--base-url` or `PIPELEX_BASE_URL` at its origin (`http://localhost:8081`, without `/v1`). `PIPELEX_API_KEY` is sent to it as the bearer token, so set it to the key that server expects when it requires one. Such a server runs your methods, but it does less than the hosted Pipelex API:diff --git a/pipelex/cli/agent_cli/CLAUDE.md b/pipelex/cli/agent_cli/CLAUDE.mdindex 001c83717..d0242fa5a 100644--- a/pipelex/cli/agent_cli/CLAUDE.md+++ b/pipelex/cli/agent_cli/CLAUDE.md@@ -107,8 +107,8 @@ commands/- **Validate refusals of the method are verdicts**: the `validate` commands run their library load inside `translate_to_validate_bundle_error` (`pipelex/pipeline/validate_bundle_translation.py`), so every refusal raised while loading a bundle whose code is in the `method` domain, the unknown model (`PipeOperatorModelChoiceError`, an `unknown_model` item) included, reaches the command as a `ValidateBundleError` and leaves with the invalid verdict's problem and exit 1. A refusal of another actor, the request's or the input's included, keeps its own class and code, and so does a dry run none of whose failures is the method's. No `validate` command keeps an arm of its own for a model-choice error; exit 2 stays for a failure of the tool or its environment (config, runtime, security).- **Run refusals are verdicts too**: a run loads its bundle inside the same translation (`acquire_library`), so an invalid bundle leaves `run pipe` / `run bundle` / `run method` as a `ValidateBundleError` with exit 1, through the generic `agent_error` arm (`run bundle`'s own reading of its bundle through `agent_error_method_refusal()`, in the caller's view on a runner), and its problem (`method.invalid`) carries the verdict's items as `errors`, and the Markdown lists the same errors one per line, so both formats list the one problem's errors and a foreign exception raised while handling an earlier verdict lists none of its items. `run_pipeline_core` sets `library_dirs_are_callers=True`, so a refusal in a `-L` directory (or the bundle's own directory) is the same verdict; `run bundle`'s own parse of a bundle without `--pipe` goes through the translation too, and so does its reading of the method tree: a folder resolves through `pipelex/cli/bundle_target_resolution.py` (`resolve_method_folder_run`, the protocol's entry rule in `pipelex/pipeline/method_entry.py`) and a lone file through `list_bundle_file_tree`, listed before the file is read, through the `MethodTreeListing` the command hands to `run_pipeline_core` so the run loads the tree it listed rather than listing it again (`pipelex/libraries/method_tree_listing.py`; `validate bundle` and `fix bundle` hand theirs down through `JudgedBundleTarget.tree_listing`), so a tree past its limits, a symbolic link or a special file such as a FIFO is a `ValidateBundleError` too, refused unread, and so is a tree a file of which changed after that listing (`MethodTreeChangedError`, reason `tree_changed`, whose item names the file), and a bundle file the listing cannot read is `client.file_unreadable`, while a folder with no single `main_pipe` is the run's own refusal, a `MethodEntryError` coded `request.pipe_unspecified` or `request.pipe_ambiguous`, no verdict on a method that may be valid. So no `run` command keeps an arm of its own for a model-choice error either: an unknown model reaches it as the verdict's `unknown_model` item.- **Two readings of a folder, one resolution path**: `run bundle`, `validate bundle`, `fix bundle` and `inputs bundle` read a folder through `pipelex/cli/bundle_target_resolution.py` (`run` through `resolve_method_folder_run`, the others through `resolve_bundle_target_core`, validate and fix by way of `pipelex/cli/judged_target.py`, whose `JudgedBundleTarget.judged_path` is the path the verdict names and whose `fix_judged_target` is the one fix dispatch both CLIs call, and of `commands/bundle_path_resolver.py`), as its method tree, but with the `FolderReading` their job asks for. `validate` and `fix` take `WHOLE_TREE`, the MTHDS protocol's validation (`mthds/docs/spec/protocol.md`): every bundle of the tree is judged (`validate_bundle(method_dir=..., library_dirs_are_callers=True)`, `fix_method_folder`), with no pipe to start at, so a folder whose bundles declare several `main_pipe`s, or none, is validated like any other; mthds-js's local runner calls `pipelex validate bundle <dir>` to validate a whole method at install and relies on this. `--pipe` there only narrows the dry run, and `--graph` / `--view` draw from the pipe named, else from the entry (`locate_folder_pipe`), or, when the folder decides none, put `graph_unavailable` in the envelope and leave the verdict alone. `run` and `inputs` take `ENTRY_PIPE`, acting on one pipe: the one `--pipe` names, else the protocol's entry (`select_method_entry` in `pipelex/pipeline/method_entry.py`); no single `main_pipe` is the `MethodEntryError` with exit 1 on both, coded `request.pipe_unspecified` or `request.pipe_ambiguous`, the message the same, and no verdict on a method that may be valid. A folder holding no bundle is `EmptyMethodTreeError` with exit 2 on `validate` and `fix`, and a `MethodEntryError` saying it has no pipe to start at on the others, each problem coded `method.invalid`. A folder whose tree is refused at resolution (past its limits, a symbolic link) is the invalid verdict: `ValidateBundleError` on `validate`, and on `fix` the still-invalid `method.invalid` problem of a fix that could not start (`unfixable_method_result`, through `agent_error_fix_bundle`), exit 1 both. A fix of a folder writes anywhere in its method tree, from the root (`method_tree_root`) down, and the human `--diff` preview mirrors that root, so a fix landing in a bundle above the folder named is proposed and written alike. Only the tree's own pipes are judged: `validate_bundle(method_dir=...)` keeps the blueprints its tree lists (`_is_member_blueprint`), so a nested package, a dependency or a `-L` directory loads without being judged; `dirs_beside_method` is the one place the `-L` directories naming the folder itself are dropped, compared resolved. Reading the tree's limits loads the configuration before the boot, so each resolution site catches `PipelexConfigError` and reports it through `report_agent_init_failure` (`agent_cli_factory.py`), the problem a failed boot gives: with exit 2 on `validate` and `fix`, whose resolver passes `exit_code=2` since the refusal gives no verdict, as the human `pipelex validate bundle` and `fix bundle` exit, and with the boot's exit 1 on `run` and `inputs`. `validate` and `fix` do not list a lone `.mthds` file before the boot, so for a file the same configuration surfaces only at the boot, which exits 1.-- **Hosted runs**: every `run` subcommand takes `--runner local|hosted`, `--hosted/--local` and `--base-url`; `resolve_agent_run_execution()` (`run/_run_hosted.py`) settles them through `pipelex.hosted.execution.resolve_run_execution` (the flag, then `[run] execution`, then local), refusing a `--runner` that contradicts the flag pair and a `--base-url` on a local run as `client.argument_invalid` problems; a configuration that cannot be read there reports its own problem, as a failed boot does (`agent_cli_factory.py`). Every refusal made before anything is sent is a problem in the operator's view, except a refusal of the method the run would send; what the run itself fails with is the problem the runner or the client produced, in the caller's view (below). `run bundle` reads its bundle before it runs it, wherever it runs, so it settles where the run executes first (`resolve_agent_run_execution()`, then `refuse_local_only_flags()`), and reports a bundle that does not parse or validate (`ValidateBundleError`) or a bundle file or folder with no pipe to start at (`MethodEntryError`, `request.pipe_unspecified`, which a lone file with no `main_pipe` raises too, naming its pipes as `candidates`) through `agent_error_method_refusal()` (`run/_run_hosted.py`): on this machine's runtime through `agent_error`, in the operator's view with the command's sentence; on a runner as the refusal the runner would answer for the same method, `to_problem(view=ProblemView.CALLER)` printed through `agent_error_problem()`, with no `diagnostics` and no `message`, since both carry the raise site's classes and text, the items, their locations, the caller's step and the Markdown tip kept. A hosted run boots nothing: it builds a `HostedRunRequest` from what `pipelex/cli/commands/run/_hosted_sources.py` resolves (the bundle and its library's `.mthds` files, a pipe's library, or a method's files; an address or a catalog id as `method_ref` / `method_id`, never fetched) and `run_hosted_for_agent()` runs it through `pipelex.hosted.hosted_run.run_hosted`, which reads the signature and uploads local input files (only when some input string names an existing local file, so a method with an address-based dependency runs with any other inputs), then drives the lifecycle `start_and_wait` drives step by step (the `/v1/version` handshake, `start`, `wait_for_result`, and the blocking `execute` on a server with no run store), so a failure while following an acknowledged run is a `HostedRunPollingError` naming the run, and a transport failure after the run request was sent is a `HostedRunOutcomeUnknownError` rather than an `ApiUnreachableError`. `run_hosted`'s `on_started` callback records the acknowledged run's id, so Ctrl-C (`KeyboardInterrupt`, or the `CancelledError` of a cancelled task) leaves as the problem of a `HostedRunInterruptedError`, `client.follow_failed` carrying `pipeline_run_id` once the run was acknowledged and `client.outcome_unknown` before, with exit code 130. `run bundle` on a file with no `-L` sends `PIPELEXPATH`'s files (`hosted_library_dirs`), and an installed method named like a catalog id is that method. An exception no hosted arm names is this process's own failure and leaves through the command-boundary catch-all as a local run's does, in the operator's view: a Pipelex error under its own code, any other exception as `runtime.unexpected`. Its success envelope is `build_run_output()`'s, with the main output's content as `json`, an empty `markdown`, the working memory dump and `pipeline_run_id`; nothing is written to disk. `--dry-run` / `--mock-inputs` are refused on it, while `--graph` and `--costs` are accepted and ignored. There is no global `--runner` any more, and no `ctx.obj`.-- **A run on a runner that fails** reports the problem the runner or the client produced, in the caller's view, as it came: `agent_error_hosted()` (`run/_run_hosted.py`) builds it with `hosted_failure_problem()` and prints it through `agent_error_problem()` (`agent_output.py`), which neither rebuilds nor reclassifies it, in Markdown by default and JSON with `--error-format json`. A refusal the runner answered (pipelex-sdk's `ApiResponseError`), a runner that cannot be reached (`ApiUnreachableError`, `client.unreachable` naming `params.base_url`) and every other request error of pipelex-sdk or the MTHDS client carries the standard client's problem as `exc.problem`: the runner's own problem document when the answer is one, its `errors` items, its next step and its `request_id` included (`received_problem()`, which keeps only the members the standard and Pipelex declare, at every level, leaves out alone one of Pipelex's members that does not read, fills `request_id` from the answer when the document names none, and projects an answer carrying diagnostics onto the caller's view, deciding it from the document as it came, and a nested `run_error` always, since it is the run's stored record), else the code the client reads from the answer, such as `client.response_unreadable` naming the status, or `client.outcome_unknown` for an answer that leaves a run possibly started, which pipelex-sdk reads for every 5xx on the run request but a 501 and a 503 coded `pipeline_start_unavailable`, whatever the body. An answer in a shape that predates the standard's, which the client reads by its status alone, goes through `hosted_refusal_problem()` (`pipelex/hosted/error_rendering.py`): a refusal of the hosted plane reads as the core code its status and the plane's own `code` name, built by `make_problem` in the caller's view, `auth.missing_credential` for a `401` or `403` with no key sent (`HOSTED_MISSING_KEY_NEXT_STEP`), `auth.invalid_credential` for a `401` and for the edge's bare `403`, `auth.forbidden` for a `403` the platform codes with one of its authorization codes, `forbidden` or `role_not_permitted` (`HOSTED_FORBIDDEN_NEXT_STEP`), and `auth.invalid_credential` for a `403` with any other code, `run.not_found` or `method.not_found` for a `404` coded `run_not_found` or `method_version_not_found` and `request.not_found` for any other, `account.rate_limited` with its `retry_after` for a `429`, with the plane's own `detail` and the next step the human CLI gives (`HOSTED_REFUSAL_NEXT_STEPS_BY_STATUS`); a runner's own refusal in the former shape that lists validation items, the `422` of a method that does not validate on `/v1/start` or `/v1/execute`, is read first, by `_former_refusal_problem()` in `run/_run_hosted.py`, as `method.invalid` with those items, its reason, its advice and its status, through the builder a stored report in the same shape goes through (`_former_problem()`); any other such answer that gives its reason, a runner's own `422` for a reserved input key included, keeps the client's `client.response_unreadable`, read by the standard's members alone so a member beside them that does not read never stops it (`_client_reading()`), with that reason as its `detail` and the human CLI's step (`hosted_refusal_next_step()`), of the kind its advice names through `FORMER_ADVICE_KINDS` (`pipelex/hosted/error_rendering.py`), else `change_input` for a `4xx`; an answer that may have started a run keeps its `client.outcome_unknown`. A run that started and failed (`RunFailedError`) is `run.failed` naming the run and its status, with the client's sentence as `message`, which quotes the stored report's reason, and nests the run's own problem as `run_error`: a stored report that is a problem document is read as a runner's answer is, so a member it holds beside the problem is left out, and one in the former `RunErrorReport` shape is `method.invalid` with its validation items (`hosted_method_problem_items()`) or `runtime.unexpected`, its message, its advice (kind through `FORMER_ADVICE_KINDS`) and its `retryable` carried (`_former_run_problem()`). Markdown renders the nested problem with the head `render_problem_markdown` uses, one heading level down (`_problem_head_lines`). Every error of pipelex-sdk's own but an answer's refusal and an unreachable runner adds its sentence as `message`, since it says what its code's parameters cannot (how long the client waited, that a completed run delivered no main output), and every one but an answer's refusal and a failed run takes the next step the human CLI tailors for it (`tailored_next_step()`, the step `describe_hosted_error()` gives when it is not `HOSTED_RUN_REQUEST_NEXT_STEP`), keeping its code's kind. pipelex's own `HostedRunError`s report their problem in the caller's view with their sentence as `message` and their advice as the Markdown tip, `pipeline_run_id` included for `HostedRunPollingError` and `HostedRunInterruptedError`; a `HostedMethodInvalidError` lists pipe-io's items as `errors`, each coded as a local verdict codes it (`hosted_method_problem_items()`, through `validation_item_code` and `problem_item_of`, `method.schema_violation` with the item's sentence as its finding for an item of a type this version does not read, each item read by the fields this version declares, so a field it does not keeps nothing from being typed, and a declared field whose value it cannot read, such as a newer runner's fix, is left out alone, so the item keeps its type, its locators and its dependency facts), its file in `location.file`. Nothing of the envelope this CLI wrote before it reported problems is left (`error`, `error_type`, `error_source`, `hint`, `error_domain`, `retryable`, `error_code`, `http_status`, …), which `tests/unit/pipelex/cli/test_agent_output_drift.py` guards in the source and in the emitted document.+- **Hosted runs**: every `run` subcommand takes `--runner local|hosted`, `--hosted/--local` and `--base-url`; `resolve_agent_run_execution()` (`run/_run_hosted.py`) settles them through `pipelex.hosted.execution.resolve_run_execution` (the flag, then `[run] execution`, then local), refusing a `--runner` that contradicts the flag pair and a `--base-url` on a local run as `client.argument_invalid` problems; a configuration that cannot be read there reports its own problem, as a failed boot does (`agent_cli_factory.py`). Every refusal made before anything is sent is a problem in the operator's view, except a refusal of the method the run would send; what the run itself fails with is the problem the runner or the client produced, in the caller's view (below). `run bundle` reads its bundle before it runs it, wherever it runs, so it settles where the run executes first (`resolve_agent_run_execution()`, then `refuse_local_only_flags()`), and reports a bundle that does not parse or validate (`ValidateBundleError`) or a bundle file or folder with no pipe to start at (`MethodEntryError`, `request.pipe_unspecified`, which a lone file with no `main_pipe` raises too, naming its pipes as `candidates`) through `agent_error_method_refusal()` (`run/_run_hosted.py`): on this machine's runtime through `agent_error`, in the operator's view with the command's sentence; on a runner as the refusal the runner would answer for the same method, `to_problem(view=ProblemView.CALLER)` printed through `agent_error_problem()`, with no `diagnostics` and no `message`, since both carry the raise site's classes and text, the items, their locations, the caller's step and the Markdown tip kept. A hosted run boots nothing: it builds a `HostedRunRequest` from what `pipelex/cli/commands/run/_hosted_sources.py` resolves (the bundle and its library's `.mthds` files, a pipe's library, or a method's files, as `contents`, one tree's bytes by tree path that `method_tree_contents` keys from the method's own tree; an address or a catalog id as `method_ref` / `method_id`, never fetched) and `run_hosted_for_agent()` runs it through `pipelex.hosted.hosted_run.run_hosted`, which reads the signature and uploads local input files only when some input string names an existing local file, so a method with an address-based dependency runs with any other inputs. To read the signature it hands `contents` to `client.pipe_io` (`PipeIORequest(contents=…)`, `pipelex/hosted/hosted_inputs.py`), and it hands the same `contents` again to `client.start` or `client.execute` (`pipelex/hosted/hosted_run.py`). pipelex-sdk prepares the tree as the protocol's `files` map in each call, inline up to 256 KiB and by hash past that, so a blob uploaded for the signature read is found held for the run and nothing is uploaded twice; a public preparation that would let pipelex prepare the tree once is L-261022-18cca3. `run_hosted` then drives the lifecycle `start_and_wait` drives step by step (the `/v1/version` handshake, `start`, `wait_for_result`, and the blocking `execute` on a server with no run store), so a failure while following an acknowledged run is a `HostedRunPollingError` naming the run, and a transport failure pipelex-sdk reads as one that may have started the run (`run_may_have_started`, set only on the start or the execute request itself, so never on the version handshake or the blob requests of a tree sent by hash) is a `HostedRunOutcomeUnknownError` rather than an `ApiUnreachableError`. `run_hosted`'s `on_started` callback records the acknowledged run's id, so Ctrl-C (`KeyboardInterrupt`, or the `CancelledError` of a cancelled task) leaves as the problem of a `HostedRunInterruptedError`, `client.follow_failed` carrying `pipeline_run_id` once the run was acknowledged and `client.outcome_unknown` before, with exit code 130. `run bundle` on a file with no `-L` sends `PIPELEXPATH`'s files (`hosted_library_dirs`), and an installed method named like a catalog id is that method. An exception no hosted arm names is this process's own failure and leaves through the command-boundary catch-all as a local run's does, in the operator's view: a Pipelex error under its own code, any other exception as `runtime.unexpected`. Its success envelope is `build_run_output()`'s, with the main output's content as `json`, an empty `markdown`, the working memory dump and `pipeline_run_id`; nothing is written to disk. `--dry-run` / `--mock-inputs` are refused on it, while `--graph` and `--costs` are accepted and ignored. There is no global `--runner` any more, and no `ctx.obj`.+- **A run on a runner that fails** reports the problem the runner or the client produced, in the caller's view, as it came: `agent_error_hosted()` (`run/_run_hosted.py`) builds it with `hosted_failure_problem()` and prints it through `agent_error_problem()` (`agent_output.py`), which neither rebuilds nor reclassifies it, in Markdown by default and JSON with `--error-format json`. A refusal the runner answered (pipelex-sdk's `ApiResponseError`), a runner that cannot be reached (`ApiUnreachableError`, `client.unreachable` naming `params.base_url`) and every other request error of pipelex-sdk or the MTHDS client carries the standard client's problem as `exc.problem`: the runner's own problem document when the answer is one, its `errors` items, its next step and its `request_id` included (`received_problem()`, which keeps only the members the standard and Pipelex declare, at every level, leaves out alone one of Pipelex's members that does not read, fills `request_id` from the answer when the document names none, and projects an answer carrying diagnostics onto the caller's view, deciding it from the document as it came, and a nested `run_error` always, since it is the run's stored record), else the code the client reads from the answer, such as `client.response_unreadable` naming the status, or `client.outcome_unknown` for an answer that leaves a run possibly started, which pipelex-sdk reads for every 5xx on the run request but a 501 and a 503 coded `pipeline_start_unavailable`, whatever the body. An answer in a shape that predates the standard's, which the client reads by its status alone, goes through `hosted_refusal_problem()` (`pipelex/hosted/error_rendering.py`): a refusal of the hosted plane reads as the core code its status and the plane's own `code` name, built by `make_problem` in the caller's view, `auth.missing_credential` for a `401` or `403` with no key sent (`HOSTED_MISSING_KEY_NEXT_STEP`), `auth.invalid_credential` for a `401` and for the edge's bare `403`, `auth.forbidden` for a `403` the platform codes with one of its authorization codes, `forbidden` or `role_not_permitted` (`HOSTED_FORBIDDEN_NEXT_STEP`), and `auth.invalid_credential` for a `403` with any other code, `run.not_found` or `method.not_found` for a `404` coded `run_not_found` or `method_version_not_found` and `request.not_found` for any other, `account.rate_limited` with its `retry_after` for a `429`, with the plane's own `detail` and the next step the human CLI gives (`HOSTED_REFUSAL_NEXT_STEPS_BY_STATUS`); a runner's own refusal in the former shape that lists validation items, the `422` of a method that does not validate on `/v1/start` or `/v1/execute`, is read first, by `_former_refusal_problem()` in `run/_run_hosted.py`, as `method.invalid` with those items, its reason, its advice and its status, through the builder a stored report in the same shape goes through (`_former_problem()`); any other such answer that gives its reason, a runner's own `422` for a reserved input key included, keeps the client's `client.response_unreadable`, read by the standard's members alone so a member beside them that does not read never stops it (`_client_reading()`), with that reason as its `detail` and the human CLI's step (`hosted_refusal_next_step()`), of the kind its advice names through `FORMER_ADVICE_KINDS` (`pipelex/hosted/error_rendering.py`), else `change_input` for a `4xx`; an answer that may have started a run keeps its `client.outcome_unknown`. A run that started and failed (`RunFailedError`) is `run.failed` naming the run and its status, with the client's sentence as `message`, which quotes the stored report's reason, and nests the run's own problem as `run_error`: a stored report that is a problem document is read as a runner's answer is, so a member it holds beside the problem is left out, and one in the former `RunErrorReport` shape is `method.invalid` with its validation items (`hosted_method_problem_items()`) or `runtime.unexpected`, its message, its advice (kind through `FORMER_ADVICE_KINDS`) and its `retryable` carried (`_former_run_problem()`). Markdown renders the nested problem with the head `render_problem_markdown` uses, one heading level down (`_problem_head_lines`). Every error of pipelex-sdk's own but an answer's refusal and an unreachable runner adds its sentence as `message`, since it says what its code's parameters cannot (how long the client waited, that a completed run delivered no main output), and every one but an answer's refusal and a failed run takes the next step the human CLI tailors for it (`tailored_next_step()`, the step `describe_hosted_error()` gives when it is not `HOSTED_RUN_REQUEST_NEXT_STEP`), keeping its code's kind, except a file of the method's tree that could not be uploaded (`MethodFileTransferError`), whose problem the SDK reads off storage's status alone, so it carries the SDK's verdict as its `retry` and its step's kind, `retry` for every code but `refused`, which is `report` (`_transfer_verdict_problem()`). pipelex's own `HostedRunError`s report their problem in the caller's view with their sentence as `message` and their advice as the Markdown tip, `pipeline_run_id` included for `HostedRunPollingError` and `HostedRunInterruptedError`; a `HostedMethodInvalidError` lists pipe-io's items as `errors`, each coded as a local verdict codes it (`hosted_method_problem_items()`, through `validation_item_code` and `problem_item_of`, `method.schema_violation` with the item's sentence as its finding for an item of a type this version does not read, each item read by the fields this version declares, so a field it does not keeps nothing from being typed, and a declared field whose value it cannot read, such as a newer runner's fix, is left out alone, so the item keeps its type, its locators and its dependency facts), its file in `location.file`. Nothing of the envelope this CLI wrote before it reported problems is left (`error`, `error_type`, `error_source`, `hint`, `error_domain`, `retryable`, `error_code`, `http_status`, …), which `tests/unit/pipelex/cli/test_agent_output_drift.py` guards in the source and in the emitted document.- **Method-reference failures**: the `run`/`validate`/`inputs` method commands call `resolve_method_target(..., raise_ref_errors=True)` and report the typed `MethodRefError` subclasses through `agent_error(...)` themselves, each with its own code (validate uses `exit_code=2`, its no-verdict convention) — the human CLI's red-text rendering stays in `resolve_method_target`'s default arm.- **Usage statistics**: the root callback runs every command through `run_with_usage_stats` (`pipelex/cli/usage_stats_cli.py`) with surface `pipelex-agent`, which reads the switches before the command does anything and sends one `command_completed` when it ends. Stderr is a machine contract when the invocation's errors are JSON (the command's `--error-format json`, else the program's given before the command, else a presentation `--format json`, as `use_agent_cli_error_format` resolves it), so the anonymous-statistics notice is then neither printed nor recorded, though the events are still sent. `_emit_problem` notes the problem's code and domain as the command's error (`note_command_error(error=usage_stats_error_of_problem(...))`); a run on a runner notes its problem's code too, except a refusal a server answered, noted by the code and domain its body sent alone (`sent_usage_stats_error`) and not at all when it sent none, never by the client's reading of its status. `fmt` and `lint` start `plxt` with `PIPELEX_USAGE_STATS=0`, since the command's statistics are this CLI's own. There is no `usage-stats` group here: `pipelex usage-stats` serves both CLIs. The contract is `conformance/specs/usage-statistics.md`; the user docs are `docs/setup/usage-statistics.md`.- **TOML handling**: Uses `tomlkit` (not `tomllib`) to preserve formatting and inline tables.diff --git a/pipelex/cli/agent_cli/commands/run/_run_hosted.py b/pipelex/cli/agent_cli/commands/run/_run_hosted.pyindex 8d2e819c4..96803db7f 100644--- a/pipelex/cli/agent_cli/commands/run/_run_hosted.py+++ b/pipelex/cli/agent_cli/commands/run/_run_hosted.py@@ -26,8 +26,8 @@ from typing import TYPE_CHECKING, Any, NoReturn, castfrom mthds.protocol.exceptions import PipelineRequestErrorfrom mthds.protocol.problem.models import NextStep, Problem, ProblemItem, ProblemLocation, SuggestedFix-from mthds.protocol.problem.registry import CoreCode, RetryVerdict-from pipelex_sdk.errors import ApiResponseError, ApiUnreachableError, PipelexRequestError, RunFailedError+from mthds.protocol.problem.registry import CoreCode, RetryVerdict, StepKind+from pipelex_sdk.errors import ApiResponseError, ApiUnreachableError, MethodFileTransferError, PipelexRequestError, RunFailedErrorfrom pydantic import BaseModel, ValidationErrorfrom pipelex.base_exceptions import PipelexError, ValidationErrorCategory, ValidationErrorItem@@ -418,9 +418,28 @@ def hosted_failure_problem(*, error: PipelineRequestError | HostedRunError, credtailored = None if isinstance(error, ApiResponseError) else tailored_next_step(error=error)if tailored is not None:problem = problem.model_copy(update={"next_step": NextStep(kind=problem.next_step.kind, detail=tailored)})+ if isinstance(error, MethodFileTransferError):+ problem = _transfer_verdict_problem(problem=problem, error=error)return problem+def _transfer_verdict_problem(*, problem: PipelexProblem, error: MethodFileTransferError) -> PipelexProblem:+ """The problem of a file of the method's tree that could not be moved, its retry verdict and its step's kind the SDK's verdict.++ pipelex-sdk states the problem of an answer storage gave from its status alone, which the standard reads by its own+ table, so a status the SDK calls retryable, a `429` for one, can come as a code no retry gets past. Whether the+ same transfer can succeed later is the SDK's verdict (`error.retryable`), the one the human CLI tells+ (`describe_hosted_error`), so the problem carries it: a retry for every code but a refusal, which is reported.+ """+ kind = StepKind.RETRY if error.retryable else StepKind.REPORT+ return problem.model_copy(+ update={+ "retry": RetryVerdict.YES if error.retryable else RetryVerdict.NO,+ "next_step": NextStep(kind=kind, detail=problem.next_step.detail),+ }+ )++def agent_error_hosted(*, error: PipelineRequestError | HostedRunError, credential_sent: bool, exit_code: int = 1) -> NoReturn:"""Report a run on a runner that failed as its problem (:func:`hosted_failure_problem`), and exit with `exit_code`.diff --git a/pipelex/cli/agent_cli/commands/run/bundle_cmd.py b/pipelex/cli/agent_cli/commands/run/bundle_cmd.pyindex a461d40dc..7a30bb003 100644--- a/pipelex/cli/agent_cli/commands/run/bundle_cmd.py+++ b/pipelex/cli/agent_cli/commands/run/bundle_cmd.py@@ -34,7 +34,7 @@ from pipelex.cli.agent_cli.commands.run._run_hosted import ()from pipelex.cli.agent_cli.commands.run.stdin_resolver import parse_cli_inputsfrom pipelex.cli.bundle_target_resolution import list_bundle_file_tree, resolve_method_folder_run-from pipelex.cli.commands.run._hosted_sources import collect_mthds_files, hosted_library_dirs+from pipelex.cli.commands.run._hosted_sources import hosted_library_dirs, method_tree_contentsfrom pipelex.cli.commands.run._run_output_folder import bundle_run_outputs_dirfrom pipelex.hosted.exceptions import HostedRunSourceErrorfrom pipelex.hosted.hosted_run import HostedRunRequest@@ -254,15 +254,14 @@ def run_bundle_cmd(pipeline_inputs: dict[str, Any] | None = parsed_inputs.pipeline_inputsif execution.is_hosted:- # The bundle goes first, then the rest of the library a local run would load with it: -L, else PIPELEXPATH.+ # The method's tree, a bundle file's own entry first, then the rest of the library a local run would load with it:+ # the method's folder and -L, else PIPELEXPATH, as one tree keyed from the method's own.try:- bundle_files = collect_mthds_files(- primary=Path(bundle_path) if bundle_path else None, library_dirs=hosted_library_dirs(library_dirs=library_dir)- )+ bundle_contents = method_tree_contents(method_tree=method_tree, library_dirs=hosted_library_dirs(library_dirs=library_dir))except HostedRunSourceError as exc:agent_error(exc.message, cause=exc)request = HostedRunRequest(- mthds_files=bundle_files,+ contents=bundle_contents,pipe_code=hosted_pipe_code,inputs=pipeline_inputs,inputs_base_dir=parsed_inputs.inputs_base_dir,diff --git a/pipelex/cli/agent_cli/commands/run/method_cmd.py b/pipelex/cli/agent_cli/commands/run/method_cmd.pyindex 0df77aa1e..41e106069 100644--- a/pipelex/cli/agent_cli/commands/run/method_cmd.py+++ b/pipelex/cli/agent_cli/commands/run/method_cmd.py@@ -141,7 +141,7 @@ def run_method_cmd(stdin_fallback=True,)request = HostedRunRequest(- mthds_files=target.mthds_files,+ contents=target.contents,method_ref=target.method_ref,method_id=target.method_id,pipe_code=target.pipe_code,diff --git a/pipelex/cli/agent_cli/commands/run/pipe_cmd.py b/pipelex/cli/agent_cli/commands/run/pipe_cmd.pyindex 6bacf0888..d6f3c69d7 100644--- a/pipelex/cli/agent_cli/commands/run/pipe_cmd.py+++ b/pipelex/cli/agent_cli/commands/run/pipe_cmd.py@@ -28,7 +28,7 @@ from pipelex.cli.agent_cli.commands.run._run_hosted import (run_hosted_for_agent,)from pipelex.cli.agent_cli.commands.run.stdin_resolver import parse_cli_inputs-from pipelex.cli.commands.run._hosted_sources import hosted_pipe_library_files+from pipelex.cli.commands.run._hosted_sources import hosted_pipe_library_contentsfrom pipelex.cli.exceptions import ExportedPipeAmbiguousErrorfrom pipelex.cli.method_resolver import resolve_pipe_from_exportsfrom pipelex.hosted.exceptions import HostedRunSourceError@@ -147,11 +147,11 @@ def run_pipe_cmd(refuse_local_only_flags(dry_run=dry_run, mock_inputs=mock_inputs)# The hosted API holds no library of yours: the one a local run would load is sent along.try:- library_files = hosted_pipe_library_files(library_dirs=library_dir)+ library_contents = hosted_pipe_library_contents(library_dirs=library_dir)except HostedRunSourceError as exc:agent_error(exc.message, cause=exc)request = HostedRunRequest(- mthds_files=library_files,+ contents=library_contents,pipe_code=pipe_code,inputs=pipeline_inputs,inputs_base_dir=parsed_inputs.inputs_base_dir,diff --git a/pipelex/cli/commands/run/_hosted_sources.py b/pipelex/cli/commands/run/_hosted_sources.pyindex c38ae7b75..2a5a8066e 100644--- a/pipelex/cli/commands/run/_hosted_sources.py+++ b/pipelex/cli/commands/run/_hosted_sources.py@@ -11,24 +11,31 @@ send the same thing for the same arguments:both resolved by the hosted API, so nothing is fetched or read here. An installed method's name or a localmethod directory is resolved as a local run resolves it, and its files are sent; an installed method wins over acatalog id spelled the same, since `mt_reports` is a valid method name too.++The files a local method is sent as are the bundles of the method trees the run reads (`pipelex.libraries.method_trees`),+each read as its tree's listing hashed it, gathered into the one tree the MTHDS protocol's `files` map carries: each+bundle is keyed by a tree path, the hosted API names it by that path in the diagnostics of a method that does not load,+and both `POST /v1/pipe-io` and the run route read the same tree (`method_tree_contents`)."""from __future__ import annotationsimport refrom pathlib import Path-from typing import TYPE_CHECKING+from typing import TYPE_CHECKING, NamedTuple-from pipelex_sdk.crate_models import MthdsFileItem+from mthds.method_tree.file_entry import excluded_name_violation+from mthds.method_tree.tree_path import nfc, path_collisions, tree_path_violationfrom pydantic import BaseModel, ConfigDictfrom pipelex.cli.commands.run._run_output_folder import run_output_labelfrom pipelex.cli.exceptions import DuplicateMethodNameError, MethodNotFoundErrorfrom pipelex.cli.installed_methods import find_method_by_namefrom pipelex.cli.method_resolver import method_output_base_dir, resolve_method_target+from pipelex.core.method_trees.tree_bundle import TreeBundlefrom pipelex.hosted.exceptions import HostedRunSourceErrorfrom pipelex.libraries.exceptions import MethodTreeLoadError-from pipelex.libraries.method_trees import list_library_bundle_files+from pipelex.libraries.method_trees import list_library_bundle_files, list_local_method_tree, lone_file_member, read_tree_bundle_as_listedfrom pipelex.methods.method_ref import looks_like_method_ref, parse_method_reffrom pipelex.mthds_parsing.helpers import is_pipelex_filefrom pipelex.system.environment import PIPELEXPATH_ENV_KEY, get_pipelexpath_dirs@@ -36,6 +43,8 @@ from pipelex.system.environment import PIPELEXPATH_ENV_KEY, get_pipelexpath_dirsif TYPE_CHECKING:from collections.abc import Sequence+ from mthds.method_tree.models import MethodTree+#: A stored method's catalog id on the hosted platform, as `pipelex-server` mints it.METHOD_ID_PATTERN = re.compile(r"^mt_[A-Za-z0-9_-]{1,64}$")@@ -70,51 +79,150 @@ def hosted_library_dirs(*, library_dirs: Sequence[str] | None) -> Sequence[str |return get_pipelexpath_dirs()-def collect_mthds_files(*, primary: Path | None, library_dirs: Sequence[str | Path] | None) -> list[MthdsFileItem]:- """Read the `.mthds` files a local run would load: `primary` first, then each library directory's, each file once.+#: The folder a tree beside the method is keyed under when its root's name is no folder a tree may hold, numbered from 1.+_FALLBACK_FOLDER_STEM = "library-"+#: A file name to ask the membership rule whether a folder may hold anything, since it judges file paths alone.+_PROBE_FILE_NAME = "probe.mthds"+++class _SentBundle(NamedTuple):+ """A bundle to send: the root of the tree listing it, its tree path there, and its bytes as that listing hashed them."""- A library directory's files are the bundles of its method tree and of the trees nested in it, as a local load- reads them (`pipelex.libraries.method_trees`), so a file the membership rule keeps out, a `.gitignore`d or hidden- one, is never sent; a library entry naming a `.mthds` file is taken as it is; a missing one is skipped, as a local- load skips it. Each file carries its path as its label: the hosted API names it in the validation errors of the- method's signature, read before the run, while the run route takes the bare contents.+ root: Path+ tree_path: str+ data: bytes+++def _bundles_to_send(*, method_tree: MethodTree | None, library_dirs: Sequence[str | Path] | None) -> list[TreeBundle]:+ """The bundles a local run would load, each as the member of its listed tree: `method_tree`'s entry, then each library's.Raises:- HostedRunSourceError: If a tree cannot be listed or a file cannot be read.+ HostedRunSourceError: If a tree cannot be listed."""- ordered: list[Path] = []- if primary is not None:- ordered.append(primary)+ bundles: list[TreeBundle] = []+ if method_tree is not None and method_tree.entry is not None:+ bundles.append(TreeBundle(tree=method_tree, tree_path=method_tree.entry))for library_dir in library_dirs or []:library_path = Path(library_dir)- if library_path.is_file() and is_pipelex_file(library_path):- ordered.append(library_path)- elif library_path.is_dir():- try:- library_bundle_files = list_library_bundle_files(library_dirs=[library_path])- except MethodTreeLoadError as exc:- msg = f"Could not list the method tree of '{library_path}' to send its bundles to the hosted API: {exc.message}"- raise HostedRunSourceError(msg) from exc- ordered.extend(bundle_file.path for bundle_file in library_bundle_files)+ try:+ if library_path.is_file() and is_pipelex_file(library_path):+ bundles.append(lone_file_member(tree=list_local_method_tree(handed_over=library_path), bundle_file=library_path))+ elif library_path.is_dir():+ bundles.extend(bundle_file.tree_bundle for bundle_file in list_library_bundle_files(library_dirs=[library_path]))+ except MethodTreeLoadError as exc:+ msg = f"Could not list the method tree of '{library_path}' to send its bundles to the hosted API: {exc.message}"+ raise HostedRunSourceError(msg) from exc+ return bundles+++def _is_tree_folder(*, folder: str) -> bool:+ """Whether a folder, one name or several joined by `/`, is one a tree may hold files in."""+ return tree_path_violation(folder) is None and not excluded_name_violation(f"{folder}/{_PROBE_FILE_NAME}")++def _fresh_folder(*, name: str, used_folders: set[str]) -> str:+ """A top-level folder for a tree beside the method: its root's name, numbered when taken, else a numbered `library-`.++ `used_folders` holds the top-level names already taken, case-folded, since a tree refuses two names equal once folded.+ """+ if _is_tree_folder(folder=name):+ candidate = name+ index_name = 1+ while candidate.casefold() in used_folders:+ index_name += 1+ candidate = f"{name}-{index_name}"+ if _is_tree_folder(folder=candidate):+ return candidate+ index_fallback = 1+ while f"{_FALLBACK_FOLDER_STEM}{index_fallback}".casefold() in used_folders:+ index_fallback += 1+ return f"{_FALLBACK_FOLDER_STEM}{index_fallback}"+++def _tree_prefixes(*, sent: list[_SentBundle], anchor: Path) -> dict[Path, str]:+ """The folder each listed tree's bundles are keyed under, in the one tree the request carries, by the tree's root.++ The tree rooted at `anchor`, the method's own, is keyed by its own tree paths, as the run names its bundles, and a+ tree rooted under it, such as a package nested in the method's folder, under its folder from there: the method's+ files keep the places they hold on disk. Every other tree, such as a `-L` directory beside the method, goes under a+ top-level folder of its own that no other key uses, its root's name, numbered when taken, so no library is mixed+ into a folder of the method's.+ """+ prefixes: dict[Path, str] = {}+ beside: list[Path] = []+ for one_bundle in sent:+ root = one_bundle.root+ if root in prefixes or root in beside:+ continue+ if root == anchor:+ prefixes[root] = ""+ elif root.is_relative_to(anchor) and _is_tree_folder(folder=nfc(root.relative_to(anchor).as_posix())):+ prefixes[root] = f"{nfc(root.relative_to(anchor).as_posix())}/"+ else:+ beside.append(root)+ used_folders = {+ f"{prefixes[one_bundle.root]}{one_bundle.tree_path}".split("/", 1)[0].casefold() for one_bundle in sent if one_bundle.root in prefixes+ }+ for root in beside:+ folder = _fresh_folder(name=nfc(root.name), used_folders=used_folders)+ used_folders.add(folder.casefold())+ prefixes[root] = f"{folder}/"+ return prefixes+++def method_tree_contents(*, method_tree: MethodTree | None, library_dirs: Sequence[str | Path] | None) -> dict[str, bytes]:+ """The bundles a local run would load, as the one tree a hosted run sends: each bundle's bytes by its tree path.++ `method_tree`'s entry goes first, when it is the tree of a bundle file named alone, then each library directory's+ bundles, those of its method tree and of the trees nested in it, as a local load reads them+ (`pipelex.libraries.method_trees`), so a file the membership rule keeps out, a `.gitignore`d or hidden one, is never+ sent; a library entry naming a `.mthds` file is taken alone, as the member of its tree; a missing one is skipped, as+ a local load skips it. Each file goes once, and is read as its tree's listing hashed it.++ Only the bundles are sent, keyed as `_tree_prefixes` places their trees: the method's own tree, `method_tree`'s, else+ the first one listed, by its own tree paths. A run names its pipe, so no manifest is needed to select it.++ Args:+ method_tree: The tree the run reads, as the run listed it: a bundle file's own, whose entry is sent first, or a+ method folder's, which the library directories hold. `None` for a run that names no bundle.+ library_dirs: The library directories a local run would load.++ Raises:+ HostedRunSourceError: If a tree cannot be listed, a file is not the one its listing hashed, or the bundles hold no+ one tree, which listed trees never give.+ """+ sent: list[_SentBundle] = []seen: set[Path] = set()- files: list[MthdsFileItem] = []- for path in ordered:- resolved = path.resolve()- if resolved in seen:+ for tree_bundle in _bundles_to_send(method_tree=method_tree, library_dirs=library_dirs):+ location = tree_bundle.location.resolve()+ if location in seen:continue- seen.add(resolved)+ seen.add(location)+ if tree_bundle.tree.directory is None or tree_bundle.tree_path is None:+ msg = f"The bundle '{location}' to send to the hosted API belongs to no tree listed from a directory."+ raise HostedRunSourceError(msg)try:- content = path.read_text(encoding="utf-8")- except (OSError, UnicodeDecodeError) as exc:- msg = f"Could not read the method file '{path}' to send it to the hosted API: {exc}"+ data = read_tree_bundle_as_listed(tree_bundle=tree_bundle)+ except MethodTreeLoadError as exc:+ msg = f"Could not read the method file '{location}' to send it to the hosted API: {exc.message}"raise HostedRunSourceError(msg) from exc- files.append(MthdsFileItem(content=content, source=str(path)))- return files+ sent.append(_SentBundle(root=tree_bundle.tree.directory.resolve(), tree_path=tree_bundle.tree_path, data=data))+ if not sent:+ return {}+ # The method's own tree sets the root every other tree is placed from, the library directories holding it or not.+ anchor = method_tree.directory.resolve() if method_tree is not None and method_tree.directory is not None else sent[0].root+ prefixes = _tree_prefixes(sent=sent, anchor=anchor)+ contents = {f"{prefixes[one_bundle.root]}{one_bundle.tree_path}": one_bundle.data for one_bundle in sent}+ faulty_keys = [key for key in contents if tree_path_violation(key) is not None or excluded_name_violation(key)]+ faulty_keys.extend(path_collisions(contents))+ if len(contents) != len(sent) or faulty_keys:+ msg = f"The method's bundles hold no one tree to send to the hosted API: {', '.join(faulty_keys) or 'two bundles share a tree path'}."+ raise HostedRunSourceError(msg)+ return contents-def hosted_pipe_library_files(*, library_dirs: Sequence[str] | None) -> list[MthdsFileItem]:- """The library a hosted `run pipe` sends: its library directories', else `PIPELEXPATH`'s.+def hosted_pipe_library_contents(*, library_dirs: Sequence[str] | None) -> dict[str, bytes]:+ """The library a hosted `run pipe` sends, as one tree's bundles by tree path: its library directories', else `PIPELEXPATH`'s.Raises:HostedRunSourceError: If no directory names a library, or the ones named hold no `.mthds` file.@@ -126,23 +234,24 @@ def hosted_pipe_library_files(*, library_dirs: Sequence[str] | None) -> list[Mthf"set {PIPELEXPATH_ENV_KEY}, or run the bundle with 'run bundle <path>'.")raise HostedRunSourceError(msg)- files = collect_mthds_files(primary=None, library_dirs=effective_dirs)- if not files:+ contents = method_tree_contents(method_tree=None, library_dirs=effective_dirs)+ if not contents:named = ", ".join(str(one_dir) for one_dir in effective_dirs)msg = f"No .mthds file found to send to the hosted API in {named}."raise HostedRunSourceError(msg)- return files+ return contentsclass HostedMethodTarget(BaseModel):"""What a hosted `run method` sends, and where its outputs and inputs are anchored.- Exactly one of `mthds_files`, `method_ref` and `method_id` is set, as `HostedRunRequest` takes them.+ Exactly one of `contents`, `method_ref` and `method_id` is set, as `HostedRunRequest` takes them."""model_config = ConfigDict(frozen=True)- mthds_files: list[MthdsFileItem] | None = None+ #: A local method's bundles, as one tree's bytes by tree path (`method_tree_contents`).+ contents: dict[str, bytes] | None = Nonemethod_ref: str | None = Nonemethod_id: str | None = None#: The pipe to run: `--pipe`, or a local method's `main_pipe`; `None` lets the hosted API run the entry pipe.@@ -200,12 +309,12 @@ def resolve_hosted_method_target(*, name: str, pipe_override: str | None, librarpipe_code, method_library_dirs, method = resolve_method_target(method_name=name, pipe_override=pipe_override, library_dirs=library_dirs)all_library_dirs = [*method_library_dirs, *(library_dirs or [])]- mthds_files = collect_mthds_files(primary=None, library_dirs=all_library_dirs)- if not mthds_files:+ contents = method_tree_contents(method_tree=None, library_dirs=all_library_dirs)+ if not contents:msg = f"Method '{name}' at '{method.path}' holds no .mthds file to send to the hosted API."raise HostedRunSourceError(msg)return HostedMethodTarget(- mthds_files=mthds_files,+ contents=contents,pipe_code=pipe_code,label=run_output_label(pipe_ref=pipe_code),output_base_dir=method_output_base_dir(method=method),diff --git a/pipelex/cli/commands/run/_run_hosted.py b/pipelex/cli/commands/run/_run_hosted.pyindex f61b3ea7f..31a956c8f 100644--- a/pipelex/cli/commands/run/_run_hosted.py+++ b/pipelex/cli/commands/run/_run_hosted.py@@ -36,7 +36,6 @@ from pipelex.tools.misc.pretty import pretty_print, pretty_print_mdif TYPE_CHECKING:from pipelex_sdk.client import PipelexAPIClient- from pipelex_sdk.crate_models import MthdsFileItemfrom pipelex.cli.commands.run._inputs_file_loader import DetectedInputsFile@@ -183,7 +182,7 @@ def bundle_main_pipe_code(*, bundle_path: str, library_dirs: list[str] | None) -def execute_hosted_run(*,- mthds_files: list[MthdsFileItem] | None = None,+ contents: dict[str, bytes] | None = None,method_ref: str | None = None,method_id: str | None = None,pipe_code: str | None,@@ -200,7 +199,8 @@ def execute_hosted_run() -> None:"""Run on the hosted API, print the main output, and save the outputs as a local run saves them.- The method is named by exactly one of `mthds_files`, `method_ref` and `method_id`. `inputs` is `--inputs` as the+ The method is named by exactly one of `contents`, a local method's bundles as one tree's bytes by tree path,+ `method_ref` and `method_id`. `inputs` is `--inputs` as thecommand resolved it, inline JSON or a JSON or TOML file, or the inputs file auto-detection read from a bundledirectory, read as a local run reads it, and a local file it names at a document or image input is uploaded first.@@ -222,7 +222,7 @@ def execute_hosted_run(loaded_inputs = load_run_inputs(inputs=inputs)request = HostedRunRequest(- mthds_files=mthds_files,+ contents=contents,method_ref=method_ref,method_id=method_id,pipe_code=pipe_code,diff --git a/pipelex/cli/commands/run/bundle_cmd.py b/pipelex/cli/commands/run/bundle_cmd.pyindex b4803104d..a33dc6bd6 100644--- a/pipelex/cli/commands/run/bundle_cmd.py+++ b/pipelex/cli/commands/run/bundle_cmd.py@@ -7,7 +7,7 @@ import typerfrom pipelex.base_exceptions import PipelexConfigError, PipelexUnexpectedErrorfrom pipelex.cli.bundle_target_resolution import list_bundle_file_tree, resolve_method_folder_run-from pipelex.cli.commands.run._hosted_sources import collect_mthds_files, hosted_library_dirs+from pipelex.cli.commands.run._hosted_sources import hosted_library_dirs, method_tree_contentsfrom pipelex.cli.commands.run._inputs_file_loader import DetectedInputsFile, read_default_inputs_filefrom pipelex.cli.commands.run._run_core import COMMAND, execute_run, validate_run_flag_combinationfrom pipelex.cli.commands.run._run_hosted import bundle_main_pipe_code, execute_hosted_run, refuse_local_only_flags, resolve_cli_run_execution@@ -233,17 +233,15 @@ def run_bundle_cmd(msg = "A hosted run of a method's folder names its pipe, or the bundle defining its main pipe."raise PipelexUnexpectedError(msg)hosted_pipe_code = bundle_main_pipe_code(bundle_path=bundle_path, library_dirs=library_dir)- # The entry bundle goes first, then the rest of the library a local run would load with it: the method's folder- # and -L, else PIPELEXPATH.+ # The method's tree, a bundle file's own entry first, then the rest of the library a local run would load with it:+ # the method's folder and -L, else PIPELEXPATH, as one tree keyed from the method's own.try:- bundle_files = collect_mthds_files(- primary=Path(bundle_path) if bundle_path else None, library_dirs=hosted_library_dirs(library_dirs=library_dir)- )+ bundle_contents = method_tree_contents(method_tree=method_tree, library_dirs=hosted_library_dirs(library_dirs=library_dir))except HostedRunSourceError as exc:typer.secho(f"Failed to run: {exc.message}", fg=typer.colors.RED, err=True)raise typer.Exit(1) from excexecute_hosted_run(- mthds_files=bundle_files,+ contents=bundle_contents,pipe_code=hosted_pipe_code,inputs=run_inputs,dynamic_output_concept_ref=dynamic_output_concept_ref,diff --git a/pipelex/cli/commands/run/method_cmd.py b/pipelex/cli/commands/run/method_cmd.pyindex 924bca6e2..71585bc66 100644--- a/pipelex/cli/commands/run/method_cmd.py+++ b/pipelex/cli/commands/run/method_cmd.py@@ -168,7 +168,7 @@ def run_method_cmd(typer.secho(f"Failed to run: {exc.message}", fg=typer.colors.RED, err=True)raise typer.Exit(1) from excexecute_hosted_run(- mthds_files=target.mthds_files,+ contents=target.contents,method_ref=target.method_ref,method_id=target.method_id,pipe_code=target.pipe_code,diff --git a/pipelex/cli/commands/run/pipe_cmd.py b/pipelex/cli/commands/run/pipe_cmd.pyindex c967729a0..15cea0289 100644--- a/pipelex/cli/commands/run/pipe_cmd.py+++ b/pipelex/cli/commands/run/pipe_cmd.py@@ -5,7 +5,7 @@ from typing import Annotatedimport typer-from pipelex.cli.commands.run._hosted_sources import hosted_pipe_library_files+from pipelex.cli.commands.run._hosted_sources import hosted_pipe_library_contentsfrom pipelex.cli.commands.run._run_core import COMMAND, execute_run, validate_run_flag_combinationfrom pipelex.cli.commands.run._run_hosted import execute_hosted_run, refuse_local_only_flags, resolve_cli_run_executionfrom pipelex.cli.commands.run._run_output_folder import run_output_label@@ -171,12 +171,12 @@ def run_pipe_cmd()# The hosted API holds no library of yours: the one a local run would load is sent along.try:- library_files = hosted_pipe_library_files(library_dirs=library_dir)+ library_contents = hosted_pipe_library_contents(library_dirs=library_dir)except HostedRunSourceError as exc:typer.secho(f"Failed to run: {exc.message}", fg=typer.colors.RED, err=True)raise typer.Exit(1) from excexecute_hosted_run(- mthds_files=library_files,+ contents=library_contents,pipe_code=pipe_code,inputs=inputs,dynamic_output_concept_ref=dynamic_output_concept_ref,diff --git a/pipelex/errors/unsupported_reasons.py b/pipelex/errors/unsupported_reasons.pyindex fb6231e91..913a39852 100644--- a/pipelex/errors/unsupported_reasons.py+++ b/pipelex/errors/unsupported_reasons.py@@ -5,13 +5,10 @@ the problem's text. This module imports nothing, so a client of the hosted API rinterpreter."""-#: A runner older than 0.89.0, whose `POST /v1/pipe-io` resolved a method sent as content strings, met a method calling-#: another one by its address, which that resolution could not fetch. No runtime of this release gives it: `/v1/pipe-io`-#: now resolves the method's tree and answers a call into a package nothing shipped with its invalid verdict. A hosted-#: run still tells this refusal apart by it, since the run route fetches such a dependency and a hosted API may run an-#: older runner.-ADDRESS_DEPENDENCY_UNSUPPORTED_REASON = "address_based_dependency"-#: A table input, such as a CSV file, given by a URL that is not a local file path: this runtime reads a table from a#: local file alone, so the form the input uses is one it does not accept, whatever the URL names.REMOTE_TABLE_UNSUPPORTED_REASON = "remote_table_url"++#: A method given as the MTHDS protocol's `files` map, a tree path to file entry, to the local runtime or the runner,+#: which take a method as its bundles' contents (`mthds_contents`) or as their library directories' method trees.+METHOD_FILES_UNSUPPORTED_REASON = "method_files_on_local_runtime"diff --git a/pipelex/hosted/error_rendering.py b/pipelex/hosted/error_rendering.pyindex 1bfdb7b68..f255a2723 100644--- a/pipelex/hosted/error_rendering.py+++ b/pipelex/hosted/error_rendering.py@@ -25,6 +25,8 @@ from pipelex_sdk.errors import (InputPreparationError,InvalidLocalSourceError,MethodErrorCode,+ MethodFileTransferCode,+ MethodFileTransferError,MissingMainStuffError,PipelineExecuteTimeoutError,RejectedAssetError,@@ -98,6 +100,19 @@ HOSTED_SERVER_FAULT_NEXT_STEP = (HOSTED_UNREACHABLE_NEXT_STEP = f"Check the network connection. {HOSTED_BASE_URL_NEXT_STEP}"#: The next step of a failure no arm of `describe_hosted_error` tailors a step for.HOSTED_RUN_REQUEST_NEXT_STEP = "Check the run request: the method, the pipe and the inputs"+#: The next steps of a file of the method's tree that could not be moved to or from the hosted API's storage, by why it+#: failed. pipelex-sdk moves a tree's files before the request that needs them, so nothing was started.+HOSTED_FILE_UNREACHABLE_NEXT_STEP = (+ "The hosted API's storage gave no answer for a file of the method, so nothing was started: check the network connection, then run again"+)+HOSTED_FILE_STORAGE_ERROR_NEXT_STEP = (+ "The hosted API's storage failed, timed out or throttled a file of the method, so nothing was started: wait a few seconds, then run again"+)+HOSTED_FILE_MISMATCH_NEXT_STEP = "A file of the method came back from the hosted API's storage as other bytes than the ones it names: run again"+HOSTED_FILE_REFUSED_NEXT_STEP = (+ "The hosted API's storage refused a file of the method, so nothing was started, and running again meets the same refusal: "+ "report it with the SHA-256 the message names"+)#: The member of the hosted plane's own refusal that states, in seconds, how long to wait before asking again; its@@ -347,6 +362,23 @@ def hosted_refusal_message(*, error: ApiResponseError) -> str:return message+def _method_file_transfer_next_step(*, error: MethodFileTransferError) -> str:+ """The next step of a file of the method's tree that could not be moved, by why it failed (`error.code`).++ Running again is the step for every code pipelex-sdk calls retryable, and a refusal is reported, since storage gives+ the same answer to the same upload; whether a retry can succeed is the SDK's own verdict, `error.retryable`.+ """+ match error.code:+ case MethodFileTransferCode.UNREACHABLE:+ return HOSTED_FILE_UNREACHABLE_NEXT_STEP+ case MethodFileTransferCode.STORAGE_ERROR:+ return HOSTED_FILE_STORAGE_ERROR_NEXT_STEP+ case MethodFileTransferCode.MISMATCH:+ return HOSTED_FILE_MISMATCH_NEXT_STEP+ case MethodFileTransferCode.REFUSED:+ return HOSTED_FILE_REFUSED_NEXT_STEP++def describe_hosted_error(*, error: PipelineRequestError | HostedRunError) -> HostedErrorView:"""Read a hosted run's failure off the error pipelex-sdk or pipelex raised.@@ -451,6 +483,12 @@ def describe_hosted_error(*, error: PipelineRequestError | HostedRunError) -> Hocase InputPreparationError():error_domain = ErrorDomain.INPUTnext_step = "Check the inputs against the pipe's signature (pipelex-agent inputs prints a template), then run again"+ case MethodFileTransferError():+ # A file of the method's tree, sent by hash, that could not be uploaded before pipe-io or the run: who acts and+ # whether a retry can succeed are the SDK's verdict.+ error_domain = error.error_domain+ retryable = error.retryable+ next_step = _method_file_transfer_next_step(error=error)case _:next_step = HOSTED_RUN_REQUEST_NEXT_STEPreturn HostedErrorView(diff --git a/pipelex/hosted/exceptions.py b/pipelex/hosted/exceptions.pyindex 1e071b39c..f9165144f 100644--- a/pipelex/hosted/exceptions.py+++ b/pipelex/hosted/exceptions.py@@ -50,8 +50,7 @@ class HostedMethodInvalidError(HostedRunError):"""The hosted API read the method's signature before the run and found that the method does not load.Raised from `POST /v1/pipe-io`'s invalid verdict, before any run starts. Its `validation_errors` are the hosted- API's items, each naming the file it found the fault in by the label the file was sent under, which the run route- could not do: it takes the method's files as bare contents.+ API's items, each naming the file it found the fault in by its tree path in the tree the run sends."""error_code = CoreCode.METHOD_INVALID@@ -89,12 +88,13 @@ class HostedRunPollingError(HostedRunError):class HostedRunOutcomeUnknownError(HostedRunError):- """The request that runs the method was sent, and the connection failed before its answer came back.+ """The request that runs the method may have reached the hosted API, and the connection failed before its answer came back.The hosted API may have created the run before the connection failed, with no way to tell from here: its id neverarrived. Running the command again could start a second paid run, so the next step is the run history first. The- cause is pipelex-sdk's `ApiUnreachableError`, whose own cause is the transport failure: a read, a write, a protocol- failure or a body that could not be decoded, met after the request left this machine.+ cause is pipelex-sdk's `ApiUnreachableError` for the start or the execute request, which the SDK reads as one that+ may have started the run (`run_may_have_started`); its own cause is the transport failure, such as a read, a write,+ a protocol failure or a body that could not be decoded, which does not prove the request never left this machine."""error_code = CoreCode.CLIENT_OUTCOME_UNKNOWN@@ -147,9 +147,9 @@ class HostedRunInterruptedError(HostedRunError):class HostedLocalFileUploadUnavailableError(HostedRunError):"""A hosted run's inputs name a local file, and its method calls another method by its address.- Uploading a local file is guided by the pipe's signature, which `POST /v1/pipe-io` reads, and the crate core behind- that route loads no address-based dependency, while the run route fetches it. The method is not at fault: the same- run goes through when the file is given as an https URL, which needs no upload.+ Uploading a local file is guided by the pipe's signature, which `POST /v1/pipe-io` reads with only the packages the+ request ships, and a hosted run ships none, while the run route fetches such a dependency. The method is not at+ fault: the same run goes through when the file is given as an https URL, which needs no upload."""error_code = CoreCode.REQUEST_UNSUPPORTEDdiff --git a/pipelex/hosted/hosted_inputs.py b/pipelex/hosted/hosted_inputs.pyindex b186f87ed..dd66e3f6e 100644--- a/pipelex/hosted/hosted_inputs.py+++ b/pipelex/hosted/hosted_inputs.py@@ -8,8 +8,10 @@ the path it names, `~` expanded), uploaded once with the SDK's `upload_file`, ancarrying the storage URI. Every other value, an explicit `null` included, reaches the run as the caller wrote it.The signature is read only when it can matter: when some string of the inputs, at any depth, names an existing file on-this machine. Any other inputs go straight to the run, which keeps pipe-io out of a run that uploads nothing; pipe-io-cannot load a method calling another one by its address, which the run route fetches and runs.+this machine. Any other inputs go straight to the run, which keeps pipe-io out of a run that uploads nothing. pipe-io+reads the method's tree as the run reads it, the same `files` map, but loads only the packages the request ships, so it+answers a method calling another one by its address with its invalid verdict, while the run route fetches the package+and runs it."""import contextlib@@ -36,15 +38,13 @@ from mthds.protocol.input_form import (from mthds.protocol.problem.models import ProblemItemfrom mthds.protocol.problem.registry import CoreCode, MethodDependencyMissingKind, MethodDependencyMissingReasonfrom pipelex_sdk.client import PipelexAPIClient-from pipelex_sdk.crate_models import CrateInvalidReport, MthdsFileItem, PipeIORequest-from pipelex_sdk.errors import ApiResponseError+from pipelex_sdk.crate_models import CrateInvalidReport, PipeIORequestfrom pipelex_sdk.upload import UploadRecordfrom pipelex_sdk.validation_models import ValidationErrorItemfrom pydantic import ValidationErrorfrom pipelex.core.pipes.exceptions import pipe_validation_error_codefrom pipelex.core.qualified_ref import QualifiedRef-from pipelex.errors.unsupported_reasons import ADDRESS_DEPENDENCY_UNSUPPORTED_REASONfrom pipelex.hosted.exceptions import HostedLocalFileUploadUnavailableError, HostedMethodInvalidErrorfrom pipelex.tools.uri.resolved_uri import ResolvedLocalPathfrom pipelex.tools.uri.uri_resolver import resolve_uri@@ -58,10 +58,6 @@ _HTTP_URL_PATTERN = re.compile(r"^https?://", re.IGNORECASE)_NOT_LOCAL_PREFIXES: tuple[str, ...] = ("pipelex-storage://", "data:")#: A `file://` URI, which a local run reads as the local path it names._FILE_URI_PREFIX = "file://"-#: The code of the refusal a runner older than 0.89.0 answers a method calling another one by its address with, its-#: pipe-io resolving the method from content strings, carrying the reason `ADDRESS_DEPENDENCY_UNSUPPORTED_REASON`. The-#: run route fetches such a dependency.-_ADDRESS_DEPENDENCY_REFUSAL_CODES: frozenset[str] = frozenset({CoreCode.REQUEST_UNSUPPORTED})class AnchoredInputs(NamedTuple):@@ -254,29 +250,6 @@ def _with_storage_uris(*, anchored: AnchoredInputs, descriptor: PipeInputFormDesreturn _walk_inputs(inputs=anchored.inputs, descriptor=descriptor, at_file_position=_rewrite)-def _address_dependency_refusal(*, refusal: ApiResponseError) -> HostedLocalFileUploadUnavailableError | None:- """The error to raise when pipe-io refused the method for calling another one by its address, else `None`.-- A runner older than 0.89.0, whose pipe-io resolved the method from content strings, answers that refusal with its- problem, coded `request.unsupported` and giving the reason `ADDRESS_DEPENDENCY_UNSUPPORTED_REASON`: the request is- what it cannot serve, not the method, which the run route fetches the dependency of. A current runner's pipe-io- resolves the method's tree and answers a call into a package nothing shipped with its invalid verdict instead- (`_unshipped_dependency_refusal`). The refusal's own advice, to send the package's files in- `dependencies`, is meant for the API's callers, so the error leaves it out.-- The error does not name the dependency, because the problem does not carry it: `request.unsupported` declares only- `field` and `reason`, and the sentence naming the dependency's address is the server's message, which reaches its- operator alone. Naming it would need a parameter of the error registry for the address.- """- if refusal.code not in _ADDRESS_DEPENDENCY_REFUSAL_CODES:- return None- params = (refusal.problem_document or {}).get("params")- if not isinstance(params, dict) or cast("dict[str, Any]", params).get("reason") != ADDRESS_DEPENDENCY_UNSUPPORTED_REASON:- return None- msg = "Local file upload is not available yet for methods with address-based dependencies, and the inputs name a local file"- return HostedLocalFileUploadUnavailableError(msg)--def _unshipped_dependency_refusal(*, report: CrateInvalidReport) -> HostedLocalFileUploadUnavailableError | None:"""The error to raise when pipe-io's invalid verdict refuses the method for calling a package by its address, else `None`.@@ -351,7 +324,7 @@ def _missing_package_of_validation_item(*, item: ValidationErrorItem) -> str | Nasync def prepare_hosted_inputs(*,client: PipelexAPIClient,- mthds_files: list[MthdsFileItem] | None,+ contents: dict[str, bytes] | None,method_ref: str | None,method_id: str | None,pipe_code: str | None,@@ -361,29 +334,26 @@ async def prepare_hosted_inputs("""Upload the local files a hosted run's inputs name, and hand back the inputs to send.Inputs naming no existing file on this machine go as they are, with no request. Otherwise one `POST /v1/pipe-io`- reads the signature of the pipe that runs, `pipe_code` or the method's entry pipe; each local file at a file- position is uploaded once with `upload_file` and rewritten to its `pipelex-storage://` URI, and every other value- is sent as written. A method whose signature does not resolve is refused here, before any run starts: pipe-io's- verdict names each faulty file by the label it was sent under, which the run route, taking the files as bare- contents, cannot do.+ reads the signature of the pipe that runs, `pipe_code` or the method's entry pipe, from the method's tree,+ `contents`, the tree the run sends, or from `method_ref` or `method_id`; each local file at a file position is+ uploaded once with `upload_file` and rewritten to its `pipelex-storage://` URI, and every other value is sent as+ written. A method whose signature does not resolve is refused here, before any run starts, pipe-io's verdict+ naming each faulty file by its tree path.Raises:- HostedLocalFileUploadUnavailableError: If pipe-io cannot load the method because it calls another method by- its address, refusing the request or answering its verdict: the run route would, so the file has to reach- it as a URL.- HostedMethodInvalidError: If the method does not load, with the hosted API's labelled validation items.+ HostedLocalFileUploadUnavailableError: If pipe-io's verdict refuses the method because it calls another method+ by its address, which nothing shipped: the run route would fetch it, so the file has to reach it as a URL.+ HostedMethodInvalidError: If the method does not load, with the hosted API's validation items.ApiResponseError: If the hosted API refuses the pipe-io request (an unknown method, a key it refuses).InputPreparationError: If an upload fails, or a local file cannot be read.+ MethodFileTransferError: If a file of the method's tree the hosted API lacks could not be uploaded."""if not inputs or not inputs_name_a_local_file(inputs=inputs, base_dir=inputs_base_dir):return PreparedHostedInputs(inputs=inputs, uploads=[], pipe_ref=None)- try:- report = await client.pipe_io(PipeIORequest(files=mthds_files, method_ref=method_ref, method_id=method_id, pipe_ref=pipe_code))- except ApiResponseError as refusal:- if (address_dependency_refusal := _address_dependency_refusal(refusal=refusal)) is not None:- raise address_dependency_refusal from refusal- raise+ # The request model takes a tree's files as bytes or text alike: the tree a run sends holds bytes.+ request_contents: dict[str, bytes | str] | None = dict(contents) if contents else None+ report = await client.pipe_io(PipeIORequest(contents=request_contents, method_ref=method_ref, method_id=method_id, pipe_ref=pipe_code))if isinstance(report, CrateInvalidReport):if (unshipped_dependency_refusal := _unshipped_dependency_refusal(report=report)) is not None:raise unshipped_dependency_refusaldiff --git a/pipelex/hosted/hosted_run.py b/pipelex/hosted/hosted_run.pyindex 93d47f6a3..f0b554670 100644--- a/pipelex/hosted/hosted_run.py+++ b/pipelex/hosted/hosted_run.py@@ -1,8 +1,11 @@"""A run on the hosted Pipelex API, mapped onto pipelex-sdk's `PipelexAPIClient`.-The request names the method one of three ways, as the hosted API takes them: a local bundle sent as its-`.mthds` contents, a published method's address (`method_ref`, resolved by the hosted runner), or a stored method's-catalog id (`method_id`, resolved by the platform). Local files named in the inputs are uploaded first+The request names the method one of three ways, as the hosted API takes them: a local method sent as its tree, the+MTHDS protocol's `files` map, a published method's address (`method_ref`, resolved by the hosted runner), or a stored+method's catalog id (`method_id`, resolved by the platform). A local method's tree is handed to the SDK as `contents`,+each bundle's bytes by tree path, for both the signature read and the run, and the SDK sends it as `mthds` prepares+it: inline when its map weighs 256 KiB or less, otherwise every file by hash once the blobs the hosted API lacks are+uploaded, a file uploaded for the signature read being found held for the run. Local files named in the inputs are uploaded first(`pipelex.hosted.hosted_inputs`), then the run is started and followed to its end, which outlives the hostedgateway's 30-second ceiling on a synchronous request.@@ -19,7 +22,6 @@ from typing import Any, Protocol, Selfimport httpxfrom mthds.protocol.exceptions import PipelineRequestErrorfrom pipelex_sdk.client import PipelexAPIClient-from pipelex_sdk.crate_models import MthdsFileItemfrom pipelex_sdk.errors import ApiUnreachableError, MissingMainStuffError, RunFailedError, RunLifecycleUnavailableError, RunTimeoutErrorfrom pipelex_sdk.execute_result import results_from_executefrom pipelex_sdk.runs import RunResults@@ -33,15 +35,6 @@ from pipelex.system.usage_stats.usage_stats_client import note_command_hosted#: The `implementation` a bare runner names in its `GET /v1/version` handshake: an open-source pipelex-api, which#: keeps no runs to poll. The same value pipelex-sdk's `start_and_wait` tests to choose the blocking route.BARE_RUNNER_IMPLEMENTATION = "pipelex-api"-#: The transport failures httpx raises before a request leaves this machine: no connection was made, so no run exists.-#: Every other one (a read, a write, a protocol failure) may come after the hosted API received the request.-_PRE_SEND_TRANSPORT_ERRORS: tuple[type[httpx.TransportError], ...] = (- httpx.ConnectError,- httpx.ConnectTimeout,- httpx.PoolTimeout,- httpx.UnsupportedProtocol,- httpx.ProxyError,-)class RunStartedCallback(Protocol):@@ -53,15 +46,15 @@ class RunStartedCallback(Protocol):class HostedRunRequest(BaseModel):"""One run to execute on the hosted API: its source, its pipe and its inputs.- Exactly one source: `mthds_files` (a local bundle and the rest of its library), `method_ref` (an address such as- `github.com/Pipelex/methods/[email protected]`) or `method_id` (a catalog id such as `mt_abc123`). Each file of- `mthds_files` carries a label, its path: the signature read before the run sends it, so the hosted API names the- file in the validation errors of a method that does not load, while the run itself takes the bare contents.+ Exactly one source: `contents` (a local method's bundles, with the rest of its library, as one tree's bytes by tree+ path), `method_ref` (an address such as `github.com/Pipelex/methods/[email protected]`) or `method_id` (a catalog id+ such as `mt_abc123`). The tree path a bundle is keyed by is how the hosted API names it, in the validation errors of+ a method that does not load and in the run's own diagnostics."""model_config = ConfigDict(frozen=True, extra="forbid")- mthds_files: list[MthdsFileItem] | None = None+ contents: dict[str, bytes] | None = Nonemethod_ref: str | None = Nonemethod_id: str | None = None#: The pipe to run; `None` runs the method's entry pipe (a package manifest's or the bundle's `main_pipe`).@@ -73,18 +66,12 @@ class HostedRunRequest(BaseModel):@model_validator(mode="after")def _exactly_one_source(self) -> Self:- named = [name for name, value in (("mthds_files", self.mthds_files), ("method_ref", self.method_ref), ("method_id", self.method_id)) if value]+ named = [name for name, value in (("contents", self.contents), ("method_ref", self.method_ref), ("method_id", self.method_id)) if value]if len(named) != 1:- msg = f"A hosted run names exactly one source among mthds_files, method_ref and method_id, got {named or 'none'}"+ msg = f"A hosted run names exactly one source among contents, method_ref and method_id, got {named or 'none'}"raise ValueError(msg)return self- @property- def mthds_contents(self) -> list[str] | None:- if not self.mthds_files:- return None- return [mthds_file.content for mthds_file in self.mthds_files]-class HostedRunOutcome(BaseModel):"""A completed hosted run: its results, the files uploaded for it, and the qualified pipe its inputs were read for."""@@ -115,7 +102,7 @@ async def _execute_blocking(*, client: PipelexAPIClient, request: HostedRunReque"""The blocking `POST /v1/execute` of a server with no run store, lifted onto the results a started run returns."""result = await client.execute(pipe_code=request.pipe_code,- mthds_contents=request.mthds_contents,+ contents=request.contents,inputs=inputs,dynamic_output_concept_ref=request.dynamic_output_concept_ref,method_ref=request.method_ref,@@ -130,7 +117,7 @@ async def _start_or_execute_unmapped(*, client: PipelexAPIClient, request: Hostetry:started = await client.start(pipe_code=request.pipe_code,- mthds_contents=request.mthds_contents,+ contents=request.contents,inputs=inputs,dynamic_output_concept_ref=request.dynamic_output_concept_ref,method_ref=request.method_ref,@@ -147,19 +134,21 @@ async def _start_or_execute(*, client: PipelexAPIClient, request: HostedRunRequeA start the server refuses for a missing run store created no run, so running the blocking route next cannot runthe method twice.- The SDK raises `ApiUnreachableError` for every transport failure, chained from httpx's error, and only some of- them mean the hosted API was not reached. A failure before the request left this machine stays the SDK's error.- Any later one, a connection lost or a read timed out after the request was sent, is a+ The SDK raises `ApiUnreachableError` for every transport failure, chained from httpx's error, and decides whether+ a run may have started (`run_may_have_started`): only on the start or the execute request itself, and only when the+ failure does not prove the request never left this machine. A failure it reads as starting nothing stays the SDK's+ error: the version handshake, the blob requests of a tree sent by hash, or a connection that was never made. Any+ other one, a connection lost or a read timed out once the run request may have left, is a`HostedRunOutcomeUnknownError`: the hosted API may have created the run, and its id never arrived."""try:return await _start_or_execute_unmapped(client=client, request=request, inputs=inputs)except ApiUnreachableError as exc:- transport_error = exc.__cause__- if isinstance(transport_error, _PRE_SEND_TRANSPORT_ERRORS):+ if not exc.run_may_have_started:raise+ transport_error = exc.__cause__failure = f"{type(transport_error).__name__}: {transport_error}" if transport_error is not None else str(exc)- msg = f"The connection to the hosted API at {client.base_url} failed after the run request was sent ({failure})"+ msg = f"The connection to the hosted API at {client.base_url} failed on the run request, which the hosted API may have received ({failure})"raise HostedRunOutcomeUnknownError(msg) from exc@@ -206,15 +195,18 @@ async def run_hosted(*, client: PipelexAPIClient, request: HostedRunRequest, on_RunTimeoutError: If the run outlived the wait; it keeps running, and its id resumes it.MissingMainStuffError: If the run completed and delivered no main output.HostedRunPollingError: If following a started run failed any other way; it names the run.- HostedRunOutcomeUnknownError: If the connection failed after the run request was sent, so a run may exist.- ApiUnreachableError: If the hosted API cannot be reached before the run request is sent.+ HostedRunOutcomeUnknownError: If the connection failed on the run request in a way that may have let it reach+ the hosted API, so a run may exist.+ ApiUnreachableError: If a request got no answer and pipelex-sdk reads it as starting no run.InputPreparationError: If a local file cannot be read or uploaded.+ MethodFileTransferError: If a file of the method's tree the hosted API lacks could not be uploaded, so no run+ started."""# A command running this sends its work to the hosted API; its `command_completed` says so and no more.note_command_hosted()prepared = await prepare_hosted_inputs(client=client,- mthds_files=request.mthds_files,+ contents=request.contents,method_ref=request.method_ref,method_id=request.method_id,pipe_code=request.pipe_code,diff --git a/pipelex/libraries/method_trees.py b/pipelex/libraries/method_trees.pyindex 764de681a..4b097a043 100644--- a/pipelex/libraries/method_trees.py+++ b/pipelex/libraries/method_trees.py@@ -452,6 +452,7 @@ def _holds_a_tree_of_its_own(*, rule: ExclusionRule) -> bool:ExclusionRule.DOT_SEGMENT| ExclusionRule.PYCACHE_OR_NODE_MODULES| ExclusionRule.VIRTUAL_ENVIRONMENT+ | ExclusionRule.RUN_INPUTS| ExclusionRule.GITIGNORE| ExclusionRule.PACKAGE_EXCLUDE):diff --git a/pipelex/methods/address_dependencies.py b/pipelex/methods/address_dependencies.pyindex 3e049f121..1a80e115d 100644--- a/pipelex/methods/address_dependencies.py+++ b/pipelex/methods/address_dependencies.py@@ -11,10 +11,6 @@ routes, reads nothing of its own and fetches nothing: a package the caller did nfrom enum import StrEnum-#: The words every refusal of an address-based dependency nothing shipped carries in its message, the operator's. No-#: client matches them: it reads the refusal's code and parameters.-ADDRESS_DEPENDENCY_REFUSAL_MARKER = "address-based dependency"-class AddressDependencySources(StrEnum):"""Where a load looks for a package its bundles call by address."""@@ -34,7 +30,7 @@ def unshipped_address_dependency_message(*, alias: str) -> str:beside the method's own in `files`."""return (- f"The method calls the {ADDRESS_DEPENDENCY_REFUSAL_MARKER} '{alias}', which was not sent with it, and this "+ f"The method calls the address-based dependency '{alias}', which was not sent with it, and this ""resolution loads only the packages sent with the method, fetching none: send the package's files in ""`dependencies`, keyed by its address, beside the method's own files in `files`.")diff --git a/pipelex/pipeline/runner.py b/pipelex/pipeline/runner.pyindex 34f5ce5f8..e10b32a64 100644--- a/pipelex/pipeline/runner.py+++ b/pipelex/pipeline/runner.py@@ -18,6 +18,7 @@ from pipelex.base_exceptions import PipelexErrorfrom pipelex.cogt.models.model_listing import ModelCategory, list_modelsfrom pipelex.config import get_configfrom pipelex.errors.security_event import emit_security_event, emit_security_event_for_run+from pipelex.errors.unsupported_reasons import METHOD_FILES_UNSUPPORTED_REASONfrom pipelex.graph.graph_tracer_manager import GraphTracerManagerfrom pipelex.interpreter_hub import (clear_current_library,@@ -46,6 +47,7 @@ if TYPE_CHECKING:import asynciofrom collections.abc import Mapping+ from mthds.method_tree.file_entry import MethodFilesfrom mthds.protocol.pipe_output import VariableMultiplicityfrom mthds.protocol.pipeline_inputs import PipelineInputsfrom mthds.protocol.working_memory import WorkingMemoryAbstract@@ -164,6 +166,23 @@ def _extract_validate_graph_pipe_code(extra: dict[str, Any] | None) -> str | Nonreturn graph_pipe_code+def refuse_method_files(*, files: MethodFiles | None) -> None:+ """Refuse a method given as the protocol's `files` map, which this runtime does not take yet.++ The protocol's run and validate operations take the method as `files`, a map from tree path to file entry. This+ runtime takes it as `mthds_contents`, the bundles' contents, or as the method trees of its library directories, and+ refuses the map before anything is set up, rather than running something other than what was sent. An empty map is+ no method and is not refused here.++ Raises:+ PipelexRequestError: If `files` holds a file, coded `request.unsupported`.+ """+ if not files:+ return+ msg = "The local runtime takes a method as its bundles' contents (mthds_contents) or as its library directories, not as the protocol's files map."+ raise PipelexRequestError(msg, field="files", unsupported_reason=METHOD_FILES_UNSUPPORTED_REASON)++class PipelexMTHDSProtocol(MTHDSProtocol["PipeOutput"]):"""Pipelex implementation of the mthds MTHDSProtocol.@@ -259,12 +278,14 @@ class PipelexMTHDSProtocol(MTHDSProtocol["PipeOutput"]):async def execute(self,pipe_code: str | None = None,- mthds_contents: list[str] | None = None,+ files: MethodFiles | None = None,inputs: PipelineInputs | WorkingMemoryAbstract[Any] | None = None,output_name: str | None = None,output_multiplicity: VariableMultiplicity | None = None,dynamic_output_concept_ref: str | None = None,extra: dict[str, Any] | None = None,+ *,+ mthds_contents: list[str] | None = None,delivery_assignment: DeliveryAssignment | None = None,request_id: str | None = None,tree_listing: MethodTreeListing | None = None,@@ -284,10 +305,15 @@ class PipelexMTHDSProtocol(MTHDSProtocol["PipeOutput"]):provided. When both ``mthds_contents`` and ``pipe_code`` are provided, thespecified pipe from the MTHDS contents will be executed (overriding any``main_pipe`` defined in the contents).+ files:+ The protocol's run source, the method as a map from tree path to file entry,+ which this runtime does not take yet: a map holding a file is refused with a+ ``PipelexRequestError`` coded ``request.unsupported`` (``refuse_method_files``).mthds_contents:- List of MTHDS bundle contents as strings. The pipe to execute is determined by- ``pipe_code`` (if provided) or the ``main_pipe`` property in the content.- Can be combined with ``library_dirs`` to load additional definitions.+ List of MTHDS bundle contents as strings, this runtime's own run source. The pipe+ to execute is determined by ``pipe_code`` (if provided) or the ``main_pipe``+ property in the content. Can be combined with ``library_dirs`` to load additional+ definitions.inputs:Inputs passed to the pipeline. Can be either a ``PipelineInputs`` dictionaryor a ``WorkingMemory`` instance.@@ -331,6 +357,7 @@ class PipelexMTHDSProtocol(MTHDSProtocol["PipeOutput"]):``graph_spec``."""+ refuse_method_files(files=files)if extra:msg = f"The local runtime defines no extension args; got {sorted(extra)}."raise PipelexRequestError(msg, field="extra", unsupported_reason="extension_args_on_local_execute")@@ -491,12 +518,14 @@ class PipelexMTHDSProtocol(MTHDSProtocol["PipeOutput"]):async def start(self,pipe_code: str | None = None,- mthds_contents: list[str] | None = None,+ files: MethodFiles | None = None,inputs: PipelineInputs | WorkingMemoryAbstract[Any] | None = None,output_name: str | None = None,output_multiplicity: VariableMultiplicity | None = None,dynamic_output_concept_ref: str | None = None,extra: dict[str, Any] | None = None,+ *,+ mthds_contents: list[str] | None = None,) -> PipelexRunResultStart:"""Start a method asynchronously — not implemented by the local runtime.@@ -507,6 +536,7 @@ class PipelexMTHDSProtocol(MTHDSProtocol["PipeOutput"]):"""_ = (pipe_code,+ files,mthds_contents,inputs,output_name,@@ -520,9 +550,11 @@ class PipelexMTHDSProtocol(MTHDSProtocol["PipeOutput"]):@overrideasync def validate(self,- mthds_contents: list[str],+ files: MethodFiles | None = None,allow_signatures: bool = False,extra: dict[str, Any] | None = None,+ *,+ mthds_contents: list[str] | None = None,) -> PipelexValidationReport:"""Parse, validate, and dry-run MTHDS bundles — protocol `validate`.@@ -555,18 +587,26 @@ class PipelexMTHDSProtocol(MTHDSProtocol["PipeOutput"]):`main_pipe` means no graph.Args:- mthds_contents: MTHDS contents to load (always a list, even for one file).+ files: The protocol's method source, a map from tree path to file entry, which this runtime does not take+ yet: a map holding a file is refused (`refuse_method_files`).allow_signatures: Tolerate unimplemented pipe signatures (strict by default).extra: Optional local runtime extension args. The only accepted key is`graph_pipe_code`, an explicit pipe target for graph generation.+ mthds_contents: MTHDS contents to load (always a list, even for one file), this runtime's own method+ source, which the call requires.Returns:PipelexValidationReport with the structural artifacts of a valid bundle.Raises:- PipelineRequestError: When unsupported or invalid extension args are passed.+ PipelineRequestError: When the method is given as `files` or not given as `mthds_contents`, or when+ unsupported or invalid extension args are passed.PipelexError: When the bundle is invalid (parse, static validation, or dry-run failure)."""+ refuse_method_files(files=files)+ if mthds_contents is None:+ msg = "validate takes the method's bundles as mthds_contents on the local runtime."+ raise PipelexRequestError(msg, field="mthds_contents")graph_pipe_code = _extract_validate_graph_pipe_code(extra)library_dirs = [Path(library_dir) for library_dir in self.library_dirs] if self.library_dirs else None# Delegate to the shared in-process orchestrator (library-window management,diff --git a/pyproject.toml b/pyproject.tomlindex 23a83a56b..29da916ce 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -31,7 +31,7 @@ dependencies = ["json2html>=1.3.0","kajson==0.7.1","markdown-it-py[linkify]>=3.0.0", # the Markdown concept, the `markdown` filter and the built-in PDF engine- "mthds==0.22.1",+ "mthds==0.25.0","networkx>=3.4.2","openai>=2.0.0","packaging>=24.0", # reads a method's requirements.txt: PEP 508 requirements, markers and versions@@ -44,7 +44,7 @@ dependencies = [# The client for the hosted Pipelex API, behind hosted runs (pipelex/hosted/). Pinned exactly, like# mthds: each pipelex-sdk release pins mthds exactly too, so the release chosen here must pin the# same mthds as this file, and the two pins move together (the bump-mthds skill says so).- "pipelex-sdk==0.46.0",+ "pipelex-sdk==0.48.0","polyfactory>=2.21.0","portkey-ai>=2.1.0","posthog>=6.7.0",diff --git a/tests/integration/pipelex/pipeline/test_resolve_crate_from_method_dir.py b/tests/integration/pipelex/pipeline/test_resolve_crate_from_method_dir.pyindex 2fae929c9..4e95f4e88 100644--- a/tests/integration/pipelex/pipeline/test_resolve_crate_from_method_dir.py+++ b/tests/integration/pipelex/pipeline/test_resolve_crate_from_method_dir.py@@ -18,7 +18,6 @@ from pytest_mock import MockerFixturefrom pipelex.errors.problem import ProblemViewfrom pipelex.interpreter_hub import clear_current_library, get_current_library_id_or_none, get_library_managerfrom pipelex.libraries.written_trees import WRITTEN_METHOD_TREES, write_method_tree-from pipelex.methods.address_dependencies import ADDRESS_DEPENDENCY_REFUSAL_MARKERfrom pipelex.pipeline.exceptions import ValidateBundleErrorfrom pipelex.pipeline.resolve_bundle import resolve_crate_from_method_dirfrom pipelex.validation_error_types import PipeValidationErrorType@@ -144,7 +143,7 @@ class TestResolveCrateFromMethodDir:item = validation_errors[0]assert item.error_type == PipeValidationErrorType.UNRESOLVED_PACKAGE_DEPENDENCYassert item.source == "host.mthds"- assert f"{ADDRESS_DEPENDENCY_REFUSAL_MARKER} 'github.com/org/pkg'" in item.message+ assert "address-based dependency 'github.com/org/pkg'" in item.message# Its advice is what the caller of a crate route can do: send the package's files beside the method's.assert "`dependencies`" in item.message# A hosted run tells it apart by the problem item's code and parameters, the package it names included.diff --git a/tests/integration/pipelex/pipeline/test_verdict_names_no_host_path.py b/tests/integration/pipelex/pipeline/test_verdict_names_no_host_path.pyindex 7010c1a70..331caea46 100644--- a/tests/integration/pipelex/pipeline/test_verdict_names_no_host_path.py+++ b/tests/integration/pipelex/pipeline/test_verdict_names_no_host_path.py@@ -389,7 +389,7 @@ class TestVerdictNamesNoHostPath:)with pytest.raises(ValidateBundleError) as raised:- await runtime.validate([_VALID_CALLER_BUNDLE])+ await runtime.validate(mthds_contents=[_VALID_CALLER_BUNDLE])assert "linked_board.mthds" in raised.value.message@@ -480,7 +480,7 @@ class TestVerdictNamesNoHostPath:)with pytest.raises(HostLibraryLoadRefusalError) as raised:- await runtime.validate([_VALID_CALLER_BUNDLE])+ await runtime.validate(mthds_contents=[_VALID_CALLER_BUNDLE])_assert_the_host_s_fault(error=raised.value, tmp_path=tmp_path)@@ -495,7 +495,7 @@ class TestVerdictNamesNoHostPath:)with pytest.raises(ValidateBundleError) as raised:- await runtime.validate([_VALID_CALLER_BUNDLE])+ await runtime.validate(mthds_contents=[_VALID_CALLER_BUNDLE])items = raised.value.validation_error_items() or []concept_items = [item for item in items if item.error_type == PipeValidationErrorType.UNRESOLVED_CONCEPT]diff --git a/tests/unit/pipelex/cli/agent_cli/test_run_hosted_envelope.py b/tests/unit/pipelex/cli/agent_cli/test_run_hosted_envelope.pyindex 9123f5a8d..b3f3873ae 100644--- a/tests/unit/pipelex/cli/agent_cli/test_run_hosted_envelope.py+++ b/tests/unit/pipelex/cli/agent_cli/test_run_hosted_envelope.py@@ -12,12 +12,16 @@ from typing import TYPE_CHECKING, Anyimport pytestimport typer+from mthds.protocol.problem.client_problems import make_client_problemfrom mthds.protocol.problem.models import Problemfrom mthds.protocol.problem.registry import CoreCodefrom pipelex_sdk.error_models import RunErrorReportfrom pipelex_sdk.errors import (ApiResponseError,InvalidLocalSourceError,+ MethodFileTransferCode,+ MethodFileTransferError,+ MethodFileTransferOperation,MissingMainStuffError,PipelexRequestError,PipelineExecuteTimeoutError,@@ -384,6 +388,64 @@ class TestRunHostedEnvelope:assert problem["code"] == error.problem.codeassert problem["next_step"] == {"kind": error.problem.next_step.kind, "detail": describe_hosted_error(error=error).next_step}+ @pytest.mark.parametrize(+ ("error", "retry", "kind"),+ [+ (+ MethodFileTransferError(+ "Uploading the file with SHA-256 abc to storage.test failed: no answer came back, so the run was not started.",+ operation=MethodFileTransferOperation.UPLOAD,+ code=MethodFileTransferCode.UNREACHABLE,+ sha256="abc",+ problem=make_client_problem(CoreCode.CLIENT_UNREACHABLE, params={"base_url": "https://storage.test"}),+ ),+ "yes",+ "retry",+ ),+ (+ MethodFileTransferError(+ "Uploading the file with SHA-256 abc to storage.test failed (429 Too Many Requests), so the run was not started.",+ operation=MethodFileTransferOperation.UPLOAD,+ code=MethodFileTransferCode.STORAGE_ERROR,+ sha256="abc",+ status=429,+ ),+ "yes",+ "retry",+ ),+ (+ MethodFileTransferError(+ "Uploading the file with SHA-256 abc to storage.test failed (403 Forbidden), so the run was not started.",+ operation=MethodFileTransferOperation.UPLOAD,+ code=MethodFileTransferCode.REFUSED,+ sha256="abc",+ status=403,+ ),+ "no",+ "report",+ ),+ ],+ ids=["unreachable", "throttled", "refused"],+ )+ def test_a_file_of_the_tree_that_could_not_be_uploaded_carries_the_sdk_s_verdict(+ self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str], error: MethodFileTransferError, retry: str, kind: str+ ) -> None:+ """The SDK's problem for storage's answer is read from its status alone, which the standard may read as no retry+ helping, a 429 for one; the problem carries the SDK's verdict instead, and the step the human CLI prints.+ """+ mocker.patch(f"{AGENT_RUN_HOSTED_MODULE}.run_hosted", new=mocker.AsyncMock(side_effect=error))++ with pytest.raises(typer.Exit):+ run_method_cmd(name=METHOD_REF, runner=RunExecution.HOSTED, output_format=CliOutputFormat.JSON)++ problem = json.loads(capsys.readouterr().err)+ assert problem["code"] == error.problem.code+ assert problem["retry"] == retry+ assert problem["next_step"] == {"kind": kind, "detail": describe_hosted_error(error=error).next_step}+ assert problem["message"] == str(error)+ for retired in RetiredEnvelope.MEMBERS:+ assert retired not in problem+@pytest.mark.parametrize("error_format", [CliOutputFormat.JSON, CliOutputFormat.MARKDOWN])@pytest.mark.parametrize("malformed",@@ -514,7 +576,7 @@ class TestRunHostedEnvelope:assert run_hosted.await_args is not Nonerequest = run_hosted.await_args.kwargs["request"]assert isinstance(request, HostedRunRequest)- assert [mthds_file.source for mthds_file in request.mthds_files or []] == [str(bundle_path), str(shared_dir / "shared.mthds")]+ assert list(request.contents or {}) == ["bundle.mthds", "shared/shared.mthds"]def test_a_folder_run_names_its_main_pipe_by_its_domain_when_two_domains_share_its_code(self, run_hosted: AsyncMock, tmp_path: Path, capsys: pytest.CaptureFixture[str]diff --git a/tests/unit/pipelex/cli/agent_cli/test_run_hosted_refusal.py b/tests/unit/pipelex/cli/agent_cli/test_run_hosted_refusal.pyindex 98cc9b93a..717dab464 100644--- a/tests/unit/pipelex/cli/agent_cli/test_run_hosted_refusal.py+++ b/tests/unit/pipelex/cli/agent_cli/test_run_hosted_refusal.py@@ -162,7 +162,7 @@ class TestRunHostedRefusal:@pytest.fixturedef bundle_file(self, tmp_path: Path) -> Path:- """A bundle file the command reads and sends as is (never parsed: --pipe is passed)."""+ """A bundle file the command reads and sends as is, keyed by its tree path (never parsed: --pipe is passed)."""path = tmp_path / "bundle.mthds"path.write_text("# bundle\n", encoding="utf-8")return path@@ -191,7 +191,8 @@ class TestRunHostedRefusal:assert _routes(seen=seen) == [START_ROUTE]start_body = json.loads(seen[-1].content)assert start_body["pipe_code"] == "entry"- assert start_body["mthds_contents"] == ["# bundle\n"]+ assert start_body["files"] == {"bundle.mthds": "# bundle\n"}+ assert "mthds_contents" not in start_bodycaptured = capsys.readouterr()assert not captured.outproblem = json.loads(captured.err)@@ -347,7 +348,7 @@ class TestRunHostedRefusal:)assert exc_info.value.exit_code == 1- assert json.loads(seen[-1].content)["mthds_contents"] == ["# bundle\n"]+ assert json.loads(seen[-1].content)["files"] == {"bundle.mthds": "# bundle\n"}assert json.loads(capsys.readouterr().err) == json.loads(RunnerProblems.OUTPUT_MULTIPLICITY)@pytest.mark.usefixtures("tty_stdin")@@ -363,6 +364,7 @@ class TestRunHostedRefusal:assert exc_info.value.exit_code == 1start_body = json.loads(seen[-1].content)assert start_body["method_ref"] == "github.com/Pipelex/methods/[email protected]"+ assert "files" not in start_bodyassert "mthds_contents" not in start_bodymarkdown = capsys.readouterr().errassert markdown.startswith("## The method does not validate\n")diff --git a/tests/unit/pipelex/cli/commands/run/test_hosted_sources.py b/tests/unit/pipelex/cli/commands/run/test_hosted_sources.pyindex 5fa5ea6a0..ce30ffb28 100644--- a/tests/unit/pipelex/cli/commands/run/test_hosted_sources.py+++ b/tests/unit/pipelex/cli/commands/run/test_hosted_sources.py@@ -1,4 +1,4 @@-"""Unit tests for what a hosted run sends: the `.mthds` files a local run would load, or a name the hosted API resolves."""+"""Unit tests for what a hosted run sends: the `.mthds` files a local run would load, as one tree, or a name the hosted API resolves."""from __future__ import annotations@@ -8,13 +8,15 @@ from typing import TYPE_CHECKINGimport pytestfrom pipelex.cli.commands.run._hosted_sources import (- collect_mthds_files,hosted_library_dirs,- hosted_pipe_library_files,+ hosted_pipe_library_contents,looks_like_method_id,+ method_tree_contents,resolve_hosted_method_target,)from pipelex.hosted.exceptions import HostedRunSourceError+from pipelex.libraries.exceptions import MethodTreeLoadError+from pipelex.libraries.method_trees import list_local_method_treefrom pipelex.system.environment import PIPELEXPATH_ENV_KEYif TYPE_CHECKING:@@ -52,7 +54,8 @@ def _write(*, path: Path, content: str) -> Path:class TestHostedSources:- def test_the_primary_file_goes_first_and_each_file_once(self, tmp_path: Path) -> None:+ def test_the_bundle_file_goes_first_and_each_file_once_by_its_tree_path(self, tmp_path: Path) -> None:+ """The bundle's own tree sets the root: its folder's files keep their tree paths, a tree beside it goes under its name."""bundle = _write(path=tmp_path / "lib" / "bundle.mthds", content="bundle")_write(path=tmp_path / "lib" / "a_other.mthds", content="other")_write(path=tmp_path / "lib" / "nested" / "deep.mthds", content="deep")@@ -63,27 +66,87 @@ class TestHostedSources:_write(path=tmp_path / "lib" / ".gitignore", content="draft.mthds\n")single = _write(path=tmp_path / "single.mthds", content="single")- files = collect_mthds_files(primary=bundle, library_dirs=[str(tmp_path / "lib"), str(single), str(tmp_path / "missing")])+ contents = method_tree_contents(+ method_tree=list_local_method_tree(handed_over=bundle),+ library_dirs=[str(tmp_path / "lib"), str(single), str(tmp_path / "missing")],+ )++ assert list(contents.items()) == [+ ("bundle.mthds", b"bundle"),+ ("a_other.mthds", b"other"),+ ("nested/deep.mthds", b"deep"),+ (f"{tmp_path.name}/single.mthds", b"single"),+ ]++ def test_a_bundle_file_of_a_method_folder_is_keyed_by_its_tree_path_there(self, tmp_path: Path) -> None:+ """A bundle file under a `METHODS.toml` is a member of that method's tree, and is sent as the run names it there."""+ method_dir = tmp_path / "reports"+ _write(path=method_dir / "METHODS.toml", content=MT_REPORTS_MANIFEST)+ bundle = _write(path=method_dir / "flows" / "bundle.mthds", content=MT_REPORTS_BUNDLE)++ contents = method_tree_contents(method_tree=list_local_method_tree(handed_over=bundle), library_dirs=None)++ assert contents == {"flows/bundle.mthds": MT_REPORTS_BUNDLE.encode()}++ def test_a_tree_nested_in_the_method_s_folder_is_keyed_under_its_folder(self, tmp_path: Path) -> None:+ method_dir = tmp_path / "method"+ _write(path=method_dir / "main.mthds", content="main")+ _write(path=method_dir / "vendor" / "reports" / "METHODS.toml", content=MT_REPORTS_MANIFEST)+ _write(path=method_dir / "vendor" / "reports" / "bundle.mthds", content="reports")++ contents = method_tree_contents(method_tree=list_local_method_tree(handed_over=method_dir), library_dirs=[str(method_dir)])- assert [mthds_file.content for mthds_file in files] == ["bundle", "other", "deep", "single"]- assert files[0].source == str(bundle)+ assert contents == {"main.mthds": b"main", "vendor/reports/bundle.mthds": b"reports"}++ def test_libraries_beside_the_method_are_keyed_under_their_names_each_once(self, tmp_path: Path) -> None:+ """Each goes under a top-level folder no other key uses: its name, numbered when the method or another library holds+ it, or a numbered `library-` when its name is no folder a tree may hold, so no library mixes into the method's folders.+ """+ method_dir = tmp_path / "method"+ _write(path=method_dir / "main.mthds", content="main")+ _write(path=method_dir / "shared" / "taken.mthds", content="the method's own")+ _write(path=tmp_path / "first" / "shared" / "taken.mthds", content="first taken")+ _write(path=tmp_path / "first" / "shared" / "kept.mthds", content="first kept")+ _write(path=tmp_path / "second" / "Shared" / "other.mthds", content="second")+ _write(path=tmp_path / ".hidden" / "hidden.mthds", content="hidden root")++ contents = method_tree_contents(+ method_tree=list_local_method_tree(handed_over=method_dir),+ library_dirs=[str(method_dir), str(tmp_path / "first" / "shared"), str(tmp_path / "second" / "Shared"), str(tmp_path / ".hidden")],+ )++ assert contents == {+ "main.mthds": b"main",+ "shared/taken.mthds": b"the method's own",+ "shared-2/kept.mthds": b"first kept",+ "shared-2/taken.mthds": b"first taken",+ "Shared-3/other.mthds": b"second",+ "library-1/hidden.mthds": b"hidden root",+ }++ def test_a_file_that_changed_since_its_listing_is_refused(self, mocker: MockerFixture, tmp_path: Path) -> None:+ bundle = _write(path=tmp_path / "bundle.mthds", content="bundle")+ mocker.patch(f"{SOURCES_MODULE}.read_tree_bundle_as_listed", side_effect=MethodTreeLoadError("The file changed since its listing."))++ with pytest.raises(HostedRunSourceError, match="changed since its listing"):+ method_tree_contents(method_tree=list_local_method_tree(handed_over=bundle), library_dirs=None)def test_a_pipe_run_without_a_library_is_refused(self, monkeypatch: pytest.MonkeyPatch) -> None:monkeypatch.delenv(PIPELEXPATH_ENV_KEY, raising=False)with pytest.raises(HostedRunSourceError, match="-L"):- hosted_pipe_library_files(library_dirs=None)+ hosted_pipe_library_contents(library_dirs=None)def test_a_pipe_run_falls_back_to_pipelexpath(self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:_write(path=tmp_path / "lib" / "bundle.mthds", content="bundle")monkeypatch.setenv(PIPELEXPATH_ENV_KEY, str(tmp_path / "lib"))- files = hosted_pipe_library_files(library_dirs=None)+ contents = hosted_pipe_library_contents(library_dirs=None)- assert [mthds_file.content for mthds_file in files] == ["bundle"]+ assert contents == {"bundle.mthds": b"bundle"}def test_a_library_with_no_bundle_is_refused(self, tmp_path: Path) -> None:with pytest.raises(HostedRunSourceError, match=r"No \.mthds file"):- hosted_pipe_library_files(library_dirs=[str(tmp_path)])+ hosted_pipe_library_contents(library_dirs=[str(tmp_path)])@pytest.mark.parametrize(("target", "is_method_id"),@@ -123,7 +186,7 @@ class TestHostedSources:target = resolve_hosted_method_target(name="my-method", pipe_override=None, library_dirs=[str(tmp_path / "extra")])- assert [mthds_file.content for mthds_file in target.mthds_files or []] == ["main", "extra"]+ assert target.contents == {"main.mthds": b"main", "extra/extra.mthds": b"extra"}assert target.pipe_code == "summarize"assert target.output_base_dir == method_dirassert target.inputs_anchor_dir == method_dir@@ -138,7 +201,7 @@ class TestHostedSources:target = resolve_hosted_method_target(name="mt_reports", pipe_override=None, library_dirs=None)assert target.method_id is None- assert [mthds_file.content for mthds_file in target.mthds_files or []] == [MT_REPORTS_BUNDLE]+ assert target.contents == {"bundle.mthds": MT_REPORTS_BUNDLE.encode()}assert target.pipe_code == "shout"def test_a_catalog_id_no_installed_method_bears_is_sent_as_an_id(self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:@@ -147,7 +210,7 @@ class TestHostedSources:target = resolve_hosted_method_target(name="mt_reports", pipe_override=None, library_dirs=None)assert target.method_id == "mt_reports"- assert target.mthds_files is None+ assert target.contents is Nonedef test_the_library_of_a_run_is_its_library_dirs_else_pipelexpath(self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:"""As a local run loads it: `-L` replaces PIPELEXPATH, and PIPELEXPATH is read only without it."""diff --git a/tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.py b/tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.pyindex 1fca53697..147a47f9d 100644--- a/tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.py+++ b/tests/unit/pipelex/cli/commands/run/test_run_hosted_cli.py@@ -109,16 +109,14 @@ class TestRunHostedCli:(pipeline_dir / "lib.mthds").write_text(LIBRARY_BUNDLE, encoding="utf-8")return pipeline_dir- def test_bundle_sends_the_bundle_first_then_its_library_and_saves_the_outputs(- self, run_hosted: AsyncMock, bundle_dir: Path, tmp_path: Path- ) -> None:+ def test_a_folder_run_sends_its_tree_and_saves_the_outputs(self, run_hosted: AsyncMock, bundle_dir: Path, tmp_path: Path) -> None:output_dir = tmp_path / "results"run_bundle_cmd(path=str(bundle_dir), hosted=True, output_dir=str(output_dir), no_pretty_print=True)request = _hosted_request(run_hosted=run_hosted)assert request.pipe_code == "probe.summarize"- assert [mthds_file.content for mthds_file in request.mthds_files or []] == [BUNDLE, LIBRARY_BUNDLE]+ assert request.contents == {"bundle.mthds": BUNDLE.encode(), "lib.mthds": LIBRARY_BUNDLE.encode()}assert request.method_ref is Noneassert request.method_id is Nonesaved_dir = output_dir / "summarize_output_01"@@ -158,7 +156,7 @@ class TestRunHostedCli:request = _hosted_request(run_hosted=run_hosted)assert request.method_ref == expected_method_refassert request.method_id == expected_method_id- assert request.mthds_files is None+ assert request.contents is Noneassert request.pipe_code is Noneassert request.inputs == {"text": "Hello"}fetch.assert_not_called()@@ -237,7 +235,7 @@ class TestRunHostedCli:request = _hosted_request(run_hosted=run_hosted)assert request.pipe_code == "summarize"- assert sorted(mthds_file.content for mthds_file in request.mthds_files or []) == sorted([BUNDLE, LIBRARY_BUNDLE])+ assert request.contents == {"bundle.mthds": BUNDLE.encode(), "lib.mthds": LIBRARY_BUNDLE.encode()}def test_a_hosted_failure_exits_with_its_next_step(self, mocker: MockerFixture, bundle_dir: Path) -> None:unreachable = ApiUnreachableError("Could not reach Pipelex API at https://api.pipelex.com (ConnectError)", api_url="https://api.pipelex.com")@@ -253,7 +251,7 @@ class TestRunHostedCli:def test_a_bundle_file_without_a_library_sends_pipelexpath(self, monkeypatch: pytest.MonkeyPatch, run_hosted: AsyncMock, bundle_dir: Path, tmp_path: Path) -> None:- """A local run of a bundle file loads PIPELEXPATH when no -L is given; a hosted one sends it."""+ """A local run of a bundle file loads PIPELEXPATH when no -L is given; a hosted one sends it, beside the bundle's own tree."""shared_dir = tmp_path / "shared"shared_dir.mkdir()(shared_dir / "shared.mthds").write_text(LIBRARY_BUNDLE, encoding="utf-8")@@ -262,7 +260,7 @@ class TestRunHostedCli:run_bundle_cmd(path=str(bundle_dir / "bundle.mthds"), hosted=True, output_dir=str(tmp_path / "results"), no_pretty_print=True)request = _hosted_request(run_hosted=run_hosted)- assert [mthds_file.source for mthds_file in request.mthds_files or []] == [str(bundle_dir / "bundle.mthds"), str(shared_dir / "shared.mthds")]+ assert list(request.contents or {}) == ["bundle.mthds", "shared/shared.mthds"]def test_a_folder_run_names_its_main_pipe_by_its_domain_when_two_domains_share_its_code(self, run_hosted: AsyncMock, tmp_path: Path) -> None:"""The hosted API starts at the pipe the local run would, never at a same-coded pipe of another domain sent with it."""diff --git a/tests/unit/pipelex/hosted/test_data.py b/tests/unit/pipelex/hosted/test_data.pyindex cd60b343b..51d7c0cce 100644--- a/tests/unit/pipelex/hosted/test_data.py+++ b/tests/unit/pipelex/hosted/test_data.py@@ -67,6 +67,11 @@ class HostedVersions:)#: A bare runner's, which keeps no runs, so a run on it takes the blocking `POST /v1/execute`.BARE_RUNNER: ClassVar[str] = '{"protocol_version":"0.1.0","implementation":"pipelex-api","implementation_version":"0.76.0"}'+ #: The hosted API's with a blob store, so a tree past the inline threshold travels by the hash of each file.+ HOSTED_WITH_BLOB_STORE: ClassVar[str] = (+ '{"protocol_version":"0.1.0","implementation":"pipelex-hosted","implementation_version":"0.30.0","runtime_version":null,'+ '"blob_store":true,"extensions":["runs","method_id","method_ref"]}'+ )class HostedPipeIoVerdicts:@@ -120,18 +125,8 @@ class HostedPipeIoVerdicts:class HostedPipeIoRefusals:"""`POST /v1/pipe-io` refusals, as the runner answers them in the caller's view."""- # A method calling a published method by address, refused by a runner older than 0.89.0, whose pipe-io resolved the- # method from content strings and loaded no address-based dependency, which `/v1/start` fetches and runs. Built from- # that runner's refusal on 2026-10-17.- ADDRESS_DEPENDENCY: ClassVar[str] = (- '{"type": "https://mthds.ai/errors/request.unsupported", "title": "The request uses a form this runtime does not accept", '- '"status": 422, "detail": "This runtime does not accept the form the request\'s field \'files\' uses (reason: '- 'address_based_dependency).", "code": "request.unsupported", "domain": "input", "retry": "no", "next_step": {"kind": '- '"change_input", "detail": "Send the field \'files\' in a form this runtime accepts, then send the request again."}, '- '"params": {"field": "files", "reason": "address_based_dependency"}, "request_id": "01K7ADDRESSDEPENDENCY0000"}'- )- # The same code for another reason, which is no address-based dependency.- OTHER_UNSUPPORTED_FORM: ClassVar[str] = (+ # A form of a field the runtime does not accept: a refusal no hosted run reads as anything but the hosted API's own.+ UNSUPPORTED_FORM: ClassVar[str] = ('{"type": "https://mthds.ai/errors/request.unsupported", "title": "The request uses a form this runtime does not accept", ''"status": 422, "detail": "This runtime does not accept the form the request\'s field \'extra\' uses (reason: ''hosted_only_extension).", "code": "request.unsupported", "domain": "input", "retry": "no", "next_step": {"kind": 'diff --git a/tests/unit/pipelex/hosted/test_hosted_error_rendering.py b/tests/unit/pipelex/hosted/test_hosted_error_rendering.pyindex 2b1820ddb..1ba34eede 100644--- a/tests/unit/pipelex/hosted/test_hosted_error_rendering.py+++ b/tests/unit/pipelex/hosted/test_hosted_error_rendering.py@@ -10,6 +10,9 @@ from pipelex_sdk.errors import (ApiResponseError,ApiUnreachableError,InvalidLocalSourceError,+ MethodFileTransferCode,+ MethodFileTransferError,+ MethodFileTransferOperation,MissingMainStuffError,PipelineExecuteTimeoutError,RunFailedError,@@ -22,11 +25,17 @@ from pipelex_sdk.validation_models import ValidationErrorItemfrom pipelex.hosted.client_factory import PIPELEX_API_KEY_ENV_KEY, PIPELEX_BASE_URL_ENV_KEYfrom pipelex.hosted.error_rendering import (+ HOSTED_FILE_MISMATCH_NEXT_STEP,+ HOSTED_FILE_REFUSED_NEXT_STEP,+ HOSTED_FILE_STORAGE_ERROR_NEXT_STEP,+ HOSTED_FILE_UNREACHABLE_NEXT_STEP,HOSTED_REFUSAL_CALLER_NEXT_STEP,HOSTED_REFUSAL_NEXT_STEPS_BY_STATUS,+ HOSTED_RUN_REQUEST_NEXT_STEP,HOSTED_SERVER_FAULT_NEXT_STEP,describe_hosted_error,hosted_refusal_next_step,+ tailored_next_step,)from pipelex.hosted.exceptions import (HostedLocalFileUploadUnavailableError,@@ -53,7 +62,7 @@ def _refusal(*, status: int, body: str) -> ApiResponseError:client = PipelexAPIClient(api_key="plx_sk_test_not_a_secret", base_url=API_URL)client.client = httpx.AsyncClient(transport=httpx.MockTransport(_handler))try:- await client.start(pipe_code="entry", mthds_contents=['domain = "probe"\n'])+ await client.start(pipe_code="entry", contents={"probe.mthds": 'domain = "probe"\n'})finally:await client.close()@@ -191,6 +200,42 @@ class TestHostedErrorRendering:assert PIPELEX_BASE_URL_ENV_KEY in view.next_stepassert "network" in view.next_step+ @pytest.mark.parametrize(+ ("code", "status", "retryable", "next_step"),+ [+ (MethodFileTransferCode.UNREACHABLE, None, True, HOSTED_FILE_UNREACHABLE_NEXT_STEP),+ (MethodFileTransferCode.STORAGE_ERROR, 503, True, HOSTED_FILE_STORAGE_ERROR_NEXT_STEP),+ (MethodFileTransferCode.STORAGE_ERROR, 429, True, HOSTED_FILE_STORAGE_ERROR_NEXT_STEP),+ (MethodFileTransferCode.MISMATCH, None, True, HOSTED_FILE_MISMATCH_NEXT_STEP),+ (MethodFileTransferCode.REFUSED, 403, False, HOSTED_FILE_REFUSED_NEXT_STEP),+ ],+ ids=["unreachable", "storage_failed", "storage_throttled", "mismatch", "refused"],+ )+ def test_a_file_of_the_tree_that_could_not_be_moved_carries_the_sdk_s_verdict(+ self, code: MethodFileTransferCode, status: int | None, retryable: bool, next_step: str+ ) -> None:+ """A tree sent by hash uploads what the hosted API lacks before the request: nothing started, and whether running+ again helps is the SDK's verdict, every code but a refusal, which is reported.+ """+ error = MethodFileTransferError(+ "Uploading the file with SHA-256 abc to storage.test failed, so the run was not started.",+ operation=MethodFileTransferOperation.UPLOAD,+ code=code,+ sha256="abc",+ status=status,+ )++ view = describe_hosted_error(error=error)++ assert view.error_type == "MethodFileTransferError"+ assert view.message == "Uploading the file with SHA-256 abc to storage.test failed, so the run was not started."+ assert view.error_domain == "runtime"+ assert view.retryable is retryable+ assert view.retryable is error.retryable+ assert view.next_step == next_step+ assert view.next_step != HOSTED_RUN_REQUEST_NEXT_STEP+ assert tailored_next_step(error=error) == next_step+def test_an_upload_the_server_failed_is_a_server_fault(self) -> None:error = UploadTransportError('Upload of "a.pdf" failed (502): Bad Gateway.')diff --git a/tests/unit/pipelex/hosted/test_hosted_run.py b/tests/unit/pipelex/hosted/test_hosted_run.pyindex 572770675..f7783a93f 100644--- a/tests/unit/pipelex/hosted/test_hosted_run.py+++ b/tests/unit/pipelex/hosted/test_hosted_run.py@@ -8,10 +8,13 @@ import pytestfrom mthds.protocol.input_form import PipeInputFormDescriptorfrom mthds.protocol.models import VersionInfofrom pipelex_sdk.client import PipelexAPIClient-from pipelex_sdk.crate_models import CrateInvalidReport, MthdsFileItem, PipeIORequest, PipeIOValidReport+from pipelex_sdk.crate_models import CrateInvalidReport, PipeIORequest, PipeIOValidReportfrom pipelex_sdk.errors import (ApiResponseError,ApiUnreachableError,+ MethodFileTransferCode,+ MethodFileTransferError,+ MethodFileTransferOperation,MissingMainStuffError,RunFailedError,RunLifecycleUnavailableError,@@ -37,7 +40,12 @@ if TYPE_CHECKING:from pytest_mock import MockerFixture-BUNDLE_FILE = MthdsFileItem(content='domain = "probe"\n', source="probe.mthds")+#: A local method's tree, as the CLI reads it: each bundle's bytes by tree path, which the SDK sends as `files`.+BUNDLE_CONTENTS = {"probe.mthds": b'domain = "probe"\n'}+#: What the transport says of a connection reset on the request it fails.+CONNECTION_RESET = "connection reset"+#: A tree past the SDK's inline threshold of 256 KiB, which travels by the hash of each file once the missing blobs are uploaded.+LARGE_BUNDLE_CONTENTS = {"probe.mthds": b'domain = "probe"\n' + b"#" * (300 * 1024) + b"\n"}DOCUMENT_METHOD_REF = "github.com/Pipelex/methods/[email protected]"HOSTED_RUN_MODULE = "pipelex.hosted.hosted_run"RUN_ID = "run_1"@@ -92,6 +100,13 @@ def _mocked_client(return client+def _connect_error_from(*, cause: BaseException) -> httpx.ConnectError:+ """A `ConnectError` raised from `cause`, as httpx raises one for a connection dropped during the TLS handshake."""+ error = httpx.ConnectError("connection failed")+ error.__cause__ = cause+ return error++async def _sdk_transport_failure(*, transport_error: httpx.TransportError) -> ApiUnreachableError:"""The error the real client raises when its transport fails this way while sending `POST /v1/start`."""@@ -102,25 +117,45 @@ async def _sdk_transport_failure(*, transport_error: httpx.TransportError) -> Apsdk_client.client = httpx.AsyncClient(transport=httpx.MockTransport(_fail))try:with pytest.raises(ApiUnreachableError) as exc_info:- await sdk_client.start(pipe_code="entry", mthds_contents=[BUNDLE_FILE.content])+ await sdk_client.start(pipe_code="entry", contents=BUNDLE_CONTENTS)finally:await sdk_client.close()assert exc_info.value.__cause__ is transport_errorreturn exc_info.value+def _client_reset_on(*, path: str, requested: list[str]) -> PipelexAPIClient:+ """The real client over a deployment with a blob store whose connection is reset once `path` was requested.++ Every request is recorded in `requested`; the version handshake is answered, and any other request is unexpected.+ """+ reset = httpx.ReadError(CONNECTION_RESET)++ def _handle(request: httpx.Request) -> httpx.Response:+ requested.append(f"{request.method} {request.url.path}")+ if request.url.path == path:+ raise reset+ if request.url.path == "/v1/version":+ return httpx.Response(200, content=HostedVersions.HOSTED_WITH_BLOB_STORE.encode("utf-8"), headers={"content-type": "application/json"})+ pytest.fail(f"unexpected request {request.method} {request.url.path}")++ sdk_client = PipelexAPIClient(api_key="plx_sk_test_not_a_secret", base_url="https://hosted.test")+ sdk_client.client = httpx.AsyncClient(transport=httpx.MockTransport(_handle))+ return sdk_client++class TestHostedRun:@pytest.mark.asyncio- async def test_an_inline_bundle_without_inputs_starts_and_waits_on_its_contents(self, mocker: MockerFixture) -> None:- """A local bundle travels as `mthds_contents`, and with no inputs nothing is asked of pipe-io."""+ async def test_a_local_method_without_inputs_starts_and_waits_on_its_tree(self, mocker: MockerFixture) -> None:+ """A local method travels as its tree, handed to the SDK as its contents, and with no inputs nothing is asked of pipe-io."""client = _mocked_client(mocker)- request = HostedRunRequest(mthds_files=[BUNDLE_FILE], pipe_code="entry", dynamic_output_concept_ref="probe.Thing")+ request = HostedRunRequest(contents=BUNDLE_CONTENTS, pipe_code="entry", dynamic_output_concept_ref="probe.Thing")outcome = await run_hosted(client=client, request=request)client.start.assert_awaited_once_with(pipe_code="entry",- mthds_contents=[BUNDLE_FILE.content],+ contents=BUNDLE_CONTENTS,inputs=None,dynamic_output_concept_ref="probe.Thing",method_ref=None,@@ -157,7 +192,7 @@ class TestHostedRun:client.start.assert_awaited_once_with(pipe_code=None,- mthds_contents=None,+ contents=None,inputs=None,dynamic_output_concept_ref=None,method_ref=expected_method_ref,@@ -180,10 +215,9 @@ class TestHostedRun:@pytest.mark.asyncioasync def test_an_address_dependency_runs_with_inputs_naming_no_local_file(self, mocker: MockerFixture) -> None:- """pipe-io loads no address-based dependency; with no file to upload it is not asked, and the run route fetches the dependency."""- client = _mocked_client(mocker)- client.pipe_io.side_effect = _pipe_io_refusal(problem_json=HostedPipeIoRefusals.ADDRESS_DEPENDENCY)- request = HostedRunRequest(mthds_files=[BUNDLE_FILE], inputs={"item": "a widget"})+ """pipe-io loads no package nothing shipped; with no file to upload it is not asked, and the run route fetches the dependency."""+ client = _mocked_client(mocker, pipe_io_report=_invalid_report(verdict_json=HostedPipeIoVerdicts.UNSHIPPED_ADDRESS_DEPENDENCY_PROBLEM_ITEMS))+ request = HostedRunRequest(contents=BUNDLE_CONTENTS, inputs={"item": "a widget"})outcome = await run_hosted(client=client, request=request)@@ -195,7 +229,8 @@ class TestHostedRun:async def test_a_local_file_is_anchored_then_uploaded_before_the_run(self, mocker: MockerFixture, tmp_path: Path) -> None:"""A relative file path resolves against the inputs file's directory, is uploaded, and the run gets the storage URI.- The signature is read once: the upload is driven from that one answer, not from a second pipe-io request.+ The signature is read once: the upload is driven from that one answer, not from a second pipe-io request. pipe-io+ and the run receive the same tree."""(tmp_path / "docs").mkdir()(tmp_path / "docs" / "invoice.pdf").write_bytes(b"%PDF")@@ -204,7 +239,7 @@ class TestHostedRun:upload = UploadRecord(uri="pipelex-storage://uploads/abc.pdf", filename="invoice.pdf", content_type="application/pdf", size=4)client.upload_file.return_value = uploadrequest = HostedRunRequest(- mthds_files=[BUNDLE_FILE],+ contents=BUNDLE_CONTENTS,pipe_code="summarize_report",inputs={"document": "docs/invoice.pdf", "notes": "see attached"},inputs_base_dir=tmp_path,@@ -212,7 +247,9 @@ class TestHostedRun:outcome = await run_hosted(client=client, request=request)- client.pipe_io.assert_awaited_once_with(PipeIORequest(files=[BUNDLE_FILE], pipe_ref="summarize_report"))+ sent_contents: dict[str, bytes | str] = dict(BUNDLE_CONTENTS)+ client.pipe_io.assert_awaited_once_with(PipeIORequest(contents=sent_contents, pipe_ref="summarize_report"))+ assert client.start.await_args.kwargs["contents"] == BUNDLE_CONTENTSclient.prepare_inputs.assert_not_awaited()client.upload_file.assert_awaited_once_with(str(tmp_path / "docs" / "invoice.pdf"))assert client.start.await_args.kwargs["inputs"] == {"document": {"url": "pipelex-storage://uploads/abc.pdf"}, "notes": "see attached"}@@ -233,7 +270,7 @@ class TestHostedRun:"report": {"title": "Report", "cover": None},"pages": ["invoice.pdf", None],}- request = HostedRunRequest(mthds_files=[BUNDLE_FILE], inputs=inputs, inputs_base_dir=tmp_path)+ request = HostedRunRequest(contents=BUNDLE_CONTENTS, inputs=inputs, inputs_base_dir=tmp_path)await run_hosted(client=client, request=request)@@ -244,31 +281,6 @@ class TestHostedRun:"pages": [{"url": "pipelex-storage://uploads/invoice.pdf"}, None],}- @pytest.mark.asyncio- async def test_a_local_file_for_a_method_with_an_address_dependency_is_refused_with_a_url_to_use(- self, mocker: MockerFixture, tmp_path: Path- ) -> None:- """Uploading needs the signature, which pipe-io cannot read through an address-based dependency: the method is not at fault.-- pipe-io answers the refusal with its problem, coded `request.unsupported` and giving the address-dependency reason.- """- (tmp_path / "invoice.pdf").write_bytes(b"%PDF")- client = _mocked_client(mocker)- client.pipe_io.side_effect = _pipe_io_refusal(problem_json=HostedPipeIoRefusals.ADDRESS_DEPENDENCY)- request = HostedRunRequest(mthds_files=[BUNDLE_FILE], inputs={"document": "invoice.pdf"}, inputs_base_dir=tmp_path)-- with pytest.raises(HostedLocalFileUploadUnavailableError) as exc_info:- await run_hosted(client=client, request=request)-- error = exc_info.value- assert "address-based dependencies" in error.message- assert isinstance(error.__cause__, ApiResponseError)- assert error.user_action is not None- assert "https URL" in error.user_action.detail- assert "Fix the method" not in error.user_action.detail- client.upload_file.assert_not_awaited()- client.start.assert_not_awaited()-@pytest.mark.asyncio@pytest.mark.parametrize("verdict_json",@@ -290,7 +302,7 @@ class TestHostedRun:"""(tmp_path / "invoice.pdf").write_bytes(b"%PDF")client = _mocked_client(mocker, pipe_io_report=_invalid_report(verdict_json=verdict_json))- request = HostedRunRequest(mthds_files=[BUNDLE_FILE], inputs={"document": "invoice.pdf"}, inputs_base_dir=tmp_path)+ request = HostedRunRequest(contents=BUNDLE_CONTENTS, inputs={"document": "invoice.pdf"}, inputs_base_dir=tmp_path)with pytest.raises(HostedLocalFileUploadUnavailableError) as exc_info:await run_hosted(client=client, request=request)@@ -318,7 +330,7 @@ class TestHostedRun:"""(tmp_path / "invoice.pdf").write_bytes(b"%PDF")client = _mocked_client(mocker, pipe_io_report=_invalid_report(verdict_json=verdict_json))- request = HostedRunRequest(mthds_files=[BUNDLE_FILE], inputs={"document": "invoice.pdf"}, inputs_base_dir=tmp_path)+ request = HostedRunRequest(contents=BUNDLE_CONTENTS, inputs={"document": "invoice.pdf"}, inputs_base_dir=tmp_path)with pytest.raises(HostedMethodInvalidError):await run_hosted(client=client, request=request)@@ -327,13 +339,13 @@ class TestHostedRun:client.start.assert_not_awaited()@pytest.mark.asyncio- async def test_another_unsupported_request_form_from_pipe_io_is_the_hosted_api_s_refusal(self, mocker: MockerFixture, tmp_path: Path) -> None:- """The same code for another reason is no address-based dependency, so the hosted API's refusal propagates as it is."""+ async def test_a_pipe_io_refusal_is_the_hosted_api_s_refusal(self, mocker: MockerFixture, tmp_path: Path) -> None:+ """A request pipe-io refuses, here for a form it does not accept, is the hosted API's refusal, propagated as it is."""(tmp_path / "invoice.pdf").write_bytes(b"%PDF")- refusal = _pipe_io_refusal(problem_json=HostedPipeIoRefusals.OTHER_UNSUPPORTED_FORM)+ refusal = _pipe_io_refusal(problem_json=HostedPipeIoRefusals.UNSUPPORTED_FORM)client = _mocked_client(mocker)client.pipe_io.side_effect = refusal- request = HostedRunRequest(mthds_files=[BUNDLE_FILE], inputs={"document": "invoice.pdf"}, inputs_base_dir=tmp_path)+ request = HostedRunRequest(contents=BUNDLE_CONTENTS, inputs={"document": "invoice.pdf"}, inputs_base_dir=tmp_path)with pytest.raises(ApiResponseError) as exc_info:await run_hosted(client=client, request=request)@@ -343,14 +355,14 @@ class TestHostedRun:@pytest.mark.asyncioasync def test_a_method_that_does_not_load_is_refused_before_the_run_with_its_labelled_items(self, mocker: MockerFixture, tmp_path: Path) -> None:- """pipe-io's verdict names each file by the label it was sent under; `/v1/start` takes bare contents and could not."""+ """pipe-io's verdict names each faulty file by its tree path, before any run starts."""(tmp_path / "invoice.pdf").write_bytes(b"%PDF")item = ValidationErrorItem.model_validate({"category": "blueprint_validation", "message": "unknown concept Foo", "source": "lib/b.mthds", "pipe_code": "step2"})invalid = CrateInvalidReport(is_valid=False, validation_errors=[item], message="Bundle does not load")client = _mocked_client(mocker, pipe_io_report=invalid)- request = HostedRunRequest(mthds_files=[BUNDLE_FILE], inputs={"document": "invoice.pdf"}, inputs_base_dir=tmp_path)+ request = HostedRunRequest(contents=BUNDLE_CONTENTS, inputs={"document": "invoice.pdf"}, inputs_base_dir=tmp_path)with pytest.raises(HostedMethodInvalidError) as exc_info:await run_hosted(client=client, request=request)@@ -377,7 +389,7 @@ class TestHostedRun:client.wait_for_result.side_effect = follow_errorwith pytest.raises(HostedRunPollingError) as exc_info:- await run_hosted(client=client, request=HostedRunRequest(mthds_files=[BUNDLE_FILE]))+ await run_hosted(client=client, request=HostedRunRequest(contents=BUNDLE_CONTENTS))error = exc_info.valueassert error.pipeline_run_id == RUN_ID@@ -395,7 +407,7 @@ class TestHostedRun:client.wait_for_result.side_effect = drift.valuewith pytest.raises(HostedRunPollingError) as exc_info:- await run_hosted(client=client, request=HostedRunRequest(mthds_files=[BUNDLE_FILE]))+ await run_hosted(client=client, request=HostedRunRequest(contents=BUNDLE_CONTENTS))assert exc_info.value.pipeline_run_id == RUN_ID@@ -413,7 +425,7 @@ class TestHostedRun:client.wait_for_result.side_effect = terminal_errorwith pytest.raises(type(terminal_error)) as exc_info:- await run_hosted(client=client, request=HostedRunRequest(mthds_files=[BUNDLE_FILE]))+ await run_hosted(client=client, request=HostedRunRequest(contents=BUNDLE_CONTENTS))assert exc_info.value is terminal_error@@ -429,7 +441,7 @@ class TestHostedRun:client.start.assert_not_awaited()client.execute.assert_awaited_once_with(pipe_code="extract",- mthds_contents=None,+ contents=None,inputs=None,dynamic_output_concept_ref=None,method_ref=DOCUMENT_METHOD_REF,@@ -445,7 +457,7 @@ class TestHostedRun:client.start.side_effect = RunLifecycleUnavailableError("no run store", api_url="https://hosted.test")mocker.patch(f"{HOSTED_RUN_MODULE}.results_from_execute", return_value=DONE)- outcome = await run_hosted(client=client, request=HostedRunRequest(mthds_files=[BUNDLE_FILE]))+ outcome = await run_hosted(client=client, request=HostedRunRequest(contents=BUNDLE_CONTENTS))client.execute.assert_awaited_once()client.wait_for_result.assert_not_awaited()@@ -466,7 +478,7 @@ class TestHostedRun:client.wait_for_result.side_effect = _follow- await run_hosted(client=client, request=HostedRunRequest(mthds_files=[BUNDLE_FILE]), on_started=_on_started)+ await run_hosted(client=client, request=HostedRunRequest(contents=BUNDLE_CONTENTS), on_started=_on_started)assert announced == [RUN_ID]@@ -477,7 +489,7 @@ class TestHostedRun:mocker.patch(f"{HOSTED_RUN_MODULE}.results_from_execute", return_value=DONE)on_started = mocker.Mock()- await run_hosted(client=client, request=HostedRunRequest(mthds_files=[BUNDLE_FILE]), on_started=on_started)+ await run_hosted(client=client, request=HostedRunRequest(contents=BUNDLE_CONTENTS), on_started=on_started)on_started.assert_not_called()@@ -489,19 +501,19 @@ class TestHostedRun:(httpx.ConnectTimeout("connect timed out"), "ConnectTimeout"),(httpx.PoolTimeout("no free connection"), "PoolTimeout"),(httpx.UnsupportedProtocol("unknown scheme"), "UnsupportedProtocol"),- (httpx.ProxyError("proxy refused"), "ProxyError"),],)async def test_a_transport_failure_before_the_start_is_sent_is_an_unreachable_api(self, mocker: MockerFixture, transport_error: httpx.TransportError, expected_code: str) -> None:- """No byte of the start left this machine, so no run exists: checking the network is the right advice."""+ """No byte of the start left this machine, as the SDK reads the failure, so no run exists: checking the network is the right advice."""sdk_error = await _sdk_transport_failure(transport_error=transport_error)+ assert sdk_error.run_may_have_started is Falseclient = _mocked_client(mocker)client.start.side_effect = sdk_errorwith pytest.raises(ApiUnreachableError) as exc_info:- await run_hosted(client=client, request=HostedRunRequest(mthds_files=[BUNDLE_FILE]))+ await run_hosted(client=client, request=HostedRunRequest(contents=BUNDLE_CONTENTS))assert exc_info.value is sdk_errorassert exc_info.value.api_url == "https://hosted.test"@@ -517,21 +529,28 @@ class TestHostedRun:httpx.ReadTimeout("timed out"),httpx.WriteError("broken pipe"),httpx.WriteTimeout("write timed out"),+ httpx.ProxyError("proxy refused"),+ _connect_error_from(cause=ConnectionResetError("reset during the TLS handshake")),],+ ids=["read", "remote_protocol", "read_timeout", "write", "write_timeout", "proxy", "handshake_reset"],)@pytest.mark.parametrize("bare_runner", [False, True])async def test_a_transport_failure_after_the_run_request_was_sent_is_an_unknown_outcome(self, mocker: MockerFixture, transport_error: httpx.TransportError, bare_runner: bool) -> None:- """The hosted API may have created the run before the connection failed, so "check the network" would lead to a second paid run."""+ """The hosted API may have created the run before the connection failed, as the SDK reads the failure, so "check the+ network" would lead to a second paid run. A proxy's failure and a handshake reset are among them: neither proves the+ request never left.+ """sdk_error = await _sdk_transport_failure(transport_error=transport_error)+ assert sdk_error.run_may_have_started is Truebare_version = '{"protocol_version":"0.1.0","implementation":"pipelex-api","implementation_version":"0.76.0"}'client = _mocked_client(mocker, version=bare_version) if bare_runner else _mocked_client(mocker)client.start.side_effect = sdk_errorclient.execute.side_effect = sdk_errorwith pytest.raises(HostedRunOutcomeUnknownError) as exc_info:- await run_hosted(client=client, request=HostedRunRequest(mthds_files=[BUNDLE_FILE]))+ await run_hosted(client=client, request=HostedRunRequest(contents=BUNDLE_CONTENTS))error = exc_info.valueassert error.__cause__ is sdk_error@@ -540,13 +559,69 @@ class TestHostedRun:assert "run history" in error.user_action.detailassert "before running again" in error.user_action.detail+ @pytest.mark.asyncio+ async def test_a_tree_upload_that_fails_is_the_sdk_s_transfer_error_and_no_unknown_outcome(self, mocker: MockerFixture) -> None:+ """The SDK uploads a large tree before the run request leaves, and says no run started: that is not an unknown outcome."""+ transfer_error = MethodFileTransferError(+ "Uploading the file with SHA-256 abc to storage failed (503 Service Unavailable), so the run was not started.",+ operation=MethodFileTransferOperation.UPLOAD,+ code=MethodFileTransferCode.STORAGE_ERROR,+ sha256="abc",+ status=503,+ )+ client = _mocked_client(mocker)+ client.start.side_effect = transfer_error++ with pytest.raises(MethodFileTransferError) as exc_info:+ await run_hosted(client=client, request=HostedRunRequest(contents=BUNDLE_CONTENTS))++ assert exc_info.value is transfer_error+ client.wait_for_result.assert_not_awaited()++ @pytest.mark.asyncio+ async def test_a_connection_reset_on_the_start_request_itself_is_an_unknown_outcome(self) -> None:+ """A tree inline asks nothing before the start, so the reset is on the request that may have created the run."""+ requested: list[str] = []+ sdk_client = _client_reset_on(path="/v1/start", requested=requested)++ try:+ with pytest.raises(HostedRunOutcomeUnknownError) as exc_info:+ await run_hosted(client=sdk_client, request=HostedRunRequest(contents=BUNDLE_CONTENTS, pipe_code="entry"))+ finally:+ await sdk_client.close()++ assert requested == ["GET /v1/version", "POST /v1/start"]+ cause = exc_info.value.__cause__+ assert isinstance(cause, ApiUnreachableError)+ assert cause.run_may_have_started is True+ assert f"ReadError: {CONNECTION_RESET}" in exc_info.value.message++ @pytest.mark.asyncio+ async def test_a_connection_reset_on_the_blob_request_of_a_large_tree_is_an_unreachable_api(self) -> None:+ """The SDK asks which blobs the hosted API lacks before the start leaves, so a reset there started no run: it stays+ the SDK's error, and no start is sent.+ """+ requested: list[str] = []+ sdk_client = _client_reset_on(path="/v1/blobs/missing", requested=requested)++ try:+ with pytest.raises(ApiUnreachableError) as exc_info:+ await run_hosted(client=sdk_client, request=HostedRunRequest(contents=LARGE_BUNDLE_CONTENTS, pipe_code="entry"))+ finally:+ await sdk_client.close()++ assert "POST /v1/blobs/missing" in requested+ assert "POST /v1/start" not in requested+ assert exc_info.value.run_may_have_started is False+ assert isinstance(exc_info.value.__cause__, httpx.ReadError)+@pytest.mark.parametrize("source",[{},{"method_ref": DOCUMENT_METHOD_REF, "method_id": "mt_abc123"},- {"mthds_files": [BUNDLE_FILE], "method_ref": DOCUMENT_METHOD_REF},- {"mthds_files": []},+ {"contents": BUNDLE_CONTENTS, "method_ref": DOCUMENT_METHOD_REF},+ {"contents": {}},],)def test_a_request_names_exactly_one_source(self, source: dict[str, Any]) -> None:diff --git a/tests/unit/pipelex/libraries/test_method_trees.py b/tests/unit/pipelex/libraries/test_method_trees.pyindex 9d0ee614d..3cb892800 100644--- a/tests/unit/pipelex/libraries/test_method_trees.py+++ b/tests/unit/pipelex/libraries/test_method_trees.py@@ -279,10 +279,6 @@ class TestMethodTrees:bundle_paths = {bundle_file.path for bundle_file in list_library_bundle_files(library_dirs=[tmp_path])}assert bundle_paths == {tmp_path / "top.mthds", tmp_path / "vendor" / "tool" / "inputs.json" / "flow.mthds"}- @pytest.mark.xfail(- raises=MethodTreeLoadError,- reason="The run-inputs default is applied by the mthds lister from the mthds release implementing it, not pinned yet",- )def test_a_run_s_inputs_file_is_no_member_of_any_tree_at_any_depth(self, tmp_path: Path) -> None:"""An inputs.json or inputs.toml, regular file or link never followed, stays out at the root and below; names match byte for byte."""outside = _touch(directory=tmp_path, tree_path="outside/secrets.json", content='{"token": "x"}')diff --git a/tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py b/tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.pyindex d63e1aabd..658c6298e 100644--- a/tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py+++ b/tests/unit/pipelex/pipeline/test_runner_protocol_surfaces.py@@ -1,6 +1,7 @@"""Coverage for the small protocol surfaces of :class:`PipelexMTHDSProtocol`.-Pins the ``extra`` rejection guard on ``execute``, the ``start`` not-implemented+Pins the refusal of the protocol's ``files`` map on ``execute`` and ``validate``, the+``extra`` rejection guard on ``execute``, the ``start`` not-implementedcontract, the ``models`` deck shaping (presets to ModelInfo, aliases/waterfalls keptkeyed by category, category filter passthrough), and the ``version`` handshakeincluding the missing-distribution fallback.@@ -19,6 +20,7 @@ from mthds.protocol.protocol import PROTOCOL_VERSIONfrom pipelex.cogt.models.model_listing import ModelCategoryfrom pipelex.errors.problem import ProblemView+from pipelex.errors.unsupported_reasons import METHOD_FILES_UNSUPPORTED_REASONfrom pipelex.pipe_run.exceptions import AsyncExecutionNotEnabledErrorfrom pipelex.pipeline.request_exceptions import PipelexRequestErrorfrom pipelex.pipeline.runner import (@@ -46,6 +48,15 @@ _MODELS_PAYLOAD: dict[str, Any] = {}+def _assert_the_files_map_refusal(*, error: PipelineRequestError) -> None:+ """The refusal of a `files` map: `request.unsupported` on the field `files`, with the local runtime's reason."""+ assert isinstance(error, PipelexRequestError)+ assert error.field == "files"+ problem = error.to_problem(view=ProblemView.CALLER)+ assert problem.code == CoreCode.REQUEST_UNSUPPORTED+ assert problem.model_dump(mode="json")["params"] == {"field": "files", "reason": METHOD_FILES_UNSUPPORTED_REASON}++@pytest.mark.asyncio(loop_scope="class")class TestRunnerProtocolSurfaces:async def test_execute_rejects_extra_args_listing_keys_sorted(self) -> None:@@ -77,6 +88,41 @@ class TestRunnerProtocolSurfaces:assert exc_info.value.field == "extra.graph_pipe_code"assert exc_info.value.to_problem(view=ProblemView.CALLER).code == CoreCode.REQUEST_INVALID+ async def test_execute_refuses_a_method_given_as_the_protocol_s_files_map(self) -> None:+ """The local runtime takes a method as `mthds_contents` or its library directories, and refuses the map unread."""+ runner = PipelexMTHDSProtocol()++ with pytest.raises(PipelineRequestError) as exc_info:+ await runner.execute(pipe_code="any_pipe", files={"main.mthds": 'domain = "files_map"'})++ _assert_the_files_map_refusal(error=exc_info.value)++ async def test_validate_refuses_a_method_given_as_the_protocol_s_files_map(self) -> None:+ runner = PipelexMTHDSProtocol()++ with pytest.raises(PipelineRequestError) as exc_info:+ await runner.validate(files={"main.mthds": 'domain = "files_map"'}, mthds_contents=['domain = "files_map"'])++ _assert_the_files_map_refusal(error=exc_info.value)++ async def test_an_empty_files_map_is_no_method_and_is_not_refused(self) -> None:+ """An empty map sends nothing: the call goes on to its next guard, here the extension args one."""+ runner = PipelexMTHDSProtocol()++ with pytest.raises(PipelexRequestError) as exc_info:+ await runner.execute(pipe_code="any_pipe", files={}, extra={"abc": 1})++ assert exc_info.value.field == "extra"++ async def test_validate_without_mthds_contents_is_an_invalid_request(self) -> None:+ runner = PipelexMTHDSProtocol()++ with pytest.raises(PipelexRequestError) as exc_info:+ await runner.validate()++ assert exc_info.value.field == "mthds_contents"+ assert exc_info.value.to_problem(view=ProblemView.CALLER).code == CoreCode.REQUEST_INVALID+async def test_start_raises_not_implemented_pointing_at_execute(self) -> None:"""The local runtime does not implement async start; the message redirects to execute."""runner = PipelexMTHDSProtocol()diff --git a/uv.lock b/uv.lockindex e91eb7db8..4a67d97fb 100644--- a/uv.lock+++ b/uv.lock@@ -2755,7 +2755,7 @@ wheels = [[[package]]name = "mthds"-version = "0.22.1"+version = "0.25.0"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "httpx" },@@ -2764,9 +2764,9 @@ dependencies = [{ name = "tomlkit" },{ name = "typing-extensions" },]-sdist = { url = "https://files.pythonhosted.org/packages/0d/00/86fbece07c3adbe53aa1a935fee525c89cf03438287172762e479a7a71a8/mthds-0.22.1.tar.gz", hash = "sha256:53de0f874786d9ff71912f1bf070bd2c0216a8b25f93a5b3b77f870919e26def", size = 478852, upload-time = "2026-10-18T22:44:12.284Z" }+sdist = { url = "https://files.pythonhosted.org/packages/d5/ce/436c4dc0a14e92dda0be376487b6c59ccb5df8f1bdd237d269dba7267f2d/mthds-0.25.0.tar.gz", hash = "sha256:924aa73e4bccbc29859048468d7a68f4fa8c61f738fda13fd857775893ef4187", size = 517806, upload-time = "2026-10-18T19:46:53.986Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/78/16/bea1ef16bf3398b7d1942ae014d9913942209885d939cbd595fed41894ae/mthds-0.22.1-py3-none-any.whl", hash = "sha256:af592e279ee5c7a3395c49171526f03b62462a45b171cb4232bbcb98e17c1066", size = 197875, upload-time = "2026-10-18T22:44:10.145Z" },+ { url = "https://files.pythonhosted.org/packages/44/d6/9ac2510bb6aaee2d8768371af85e13e4dd584ac2ffb445ccd349494c7dd5/mthds-0.25.0-py3-none-any.whl", hash = "sha256:86e865a74498ce2baffc8426522afe96ceccc493d1fc334f4c47e61758b41714", size = 210461, upload-time = "2026-10-18T19:46:52.295Z" },][[package]]@@ -3737,7 +3737,7 @@ requires-dist = [{ name = "mkdocs-meta-manager", marker = "extra == 'docs'", specifier = ">=1.1.0" },{ name = "mkdocs-redirects", marker = "extra == 'docs'", specifier = "==1.2.2" },{ name = "moto", extras = ["dynamodb", "s3"], marker = "extra == 'dev'", specifier = ">=5.0.0" },- { name = "mthds", specifier = "==0.22.1" },+ { name = "mthds", specifier = "==0.25.0" },{ name = "mypy", marker = "extra == 'dev'", specifier = "==1.19.1" },{ name = "networkx", specifier = ">=3.4.2" },{ name = "openai", specifier = ">=2.0.0" },@@ -3747,7 +3747,7 @@ requires-dist = [{ name = "opentelemetry-semantic-conventions", specifier = ">=0.59b0" },{ name = "packaging", specifier = ">=24.0" },{ name = "pillow", specifier = ">=12.1.1" },- { name = "pipelex-sdk", specifier = "==0.46.0" },+ { name = "pipelex-sdk", specifier = "==0.48.0" },{ name = "pipelex-tools", marker = "extra == 'dev'", specifier = ">=0.7.2" },{ name = "pipelex-tools-py", specifier = ">=0.1.3" },{ name = "polyfactory", specifier = ">=2.21.0" },@@ -3859,7 +3859,7 @@ provides-extras = ["dev"][[package]]name = "pipelex-sdk"-version = "0.46.0"+version = "0.48.0"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "httpx" },@@ -3867,9 +3867,9 @@ dependencies = [{ name = "pydantic" },{ name = "typing-extensions" },]-sdist = { url = "https://files.pythonhosted.org/packages/cd/66/9f0e2148d96b646357125c30859046e93e7530ba85d82419a5972aaadbbb/pipelex_sdk-0.46.0.tar.gz", hash = "sha256:9c3f7ad921c6d1399125e9c687b8ac720199fb29ba1ffeac7bef008118a41f25", size = 644042, upload-time = "2026-10-19T07:19:39.969Z" }+sdist = { url = "https://files.pythonhosted.org/packages/7d/2e/decbb96df27e6aab6442f19737d986e8416ff0b5b84ff75246afc10e49e8/pipelex_sdk-0.48.0.tar.gz", hash = "sha256:e9cc8921174e67e9f1f70eb3f8ec6bd005b3ffed550b61eed864f2493597c859", size = 695789, upload-time = "2026-10-20T09:19:03.443Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/82/fe/6a2cc6394ed34f89096fa0fbc3a5330a99df716958f5799dc6abcde13d87/pipelex_sdk-0.46.0-py3-none-any.whl", hash = "sha256:db6b6c8e27578671984352a806294062e91aa0b5189ced658be94a8ee1e4f175", size = 254349, upload-time = "2026-10-19T07:19:38.333Z" },+ { url = "https://files.pythonhosted.org/packages/7f/20/8e5f44348090854b5e207188b3be3480eb4af0e2f89b30c4a6630dad81df/pipelex_sdk-0.48.0-py3-none-any.whl", hash = "sha256:e992714e25f6a5fa91465d0788b51bc4341149deeb95c2963146350939295dcf", size = 273538, upload-time = "2026-10-20T09:19:01.523Z" },][[package]]