hyf

Context-aware query service for Radroots
git clone https://radroots.dev/git/hyf.git
Log | Files | Refs | README | LICENSE

commit 50ac67ad5c724b6daf85fd663b888f9c49258dea
parent 64911e6aee9c8451eb8df843f0a13cb8a9950997
Author: triesap <tyson@radroots.org>
Date:   Mon, 21 Sep 2026 13:42:13 +0000

runtime: add operation enablement and kill switches

Diffstat:
Msrc/hyf_runtime/config.mojo | 24++++++++++++++++++++++++
Mtests/test_runtime_paths.mojo | 23++++++++++++++++++++---
2 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/src/hyf_runtime/config.mojo b/src/hyf_runtime/config.mojo @@ -16,10 +16,18 @@ struct HyfServiceRuntimeConfig(Defaultable, Copyable, Movable): struct HyfExecutionRuntimeConfig(Defaultable, Copyable, Movable): var default_execution_mode: String var allow_assisted: Bool + var enable_farm_update_interpret: Bool + var enable_buyer_request_interpret: Bool + var enable_buyer_request_match: Bool + var disable_provider: Bool def __init__(out self): self.default_execution_mode = "deterministic" self.allow_assisted = False + self.enable_farm_update_interpret = False + self.enable_buyer_request_interpret = False + self.enable_buyer_request_match = False + self.disable_provider = False @fieldwise_init @@ -115,6 +123,22 @@ def assisted_runtime_configured(config: HyfLoadedRuntimeConfig) -> Bool: return False +def operation_enabled(config: HyfLoadedRuntimeConfig, operation: String) -> Bool: + if config.effective.runtime.disable_provider: + return False + if operation == "farm_update.interpret": + return config.effective.runtime.enable_farm_update_interpret + if operation == "buyer_request.interpret": + return config.effective.runtime.enable_buyer_request_interpret + if operation == "buyer_request.match": + return config.effective.runtime.enable_buyer_request_match + return False + + +def provider_disabled(config: HyfLoadedRuntimeConfig) -> Bool: + return config.effective.runtime.disable_provider + + def typesafe_provider_configured(config: HyfLoadedRuntimeConfig) -> Bool: return ( config.effective.runtime.allow_assisted diff --git a/tests/test_runtime_paths.mojo b/tests/test_runtime_paths.mojo @@ -230,6 +230,9 @@ from hyf_runtime.config import ( def _typesafe_config(enabled: Bool, base_url: String) -> HyfLoadedRuntimeConfig: + var runtime = HyfExecutionRuntimeConfig() + runtime.default_execution_mode = "deterministic" + runtime.allow_assisted = True return HyfLoadedRuntimeConfig( artifact_present=True, loaded=True, @@ -238,9 +241,7 @@ def _typesafe_config(enabled: Bool, base_url: String) -> HyfLoadedRuntimeConfig: load_error="", effective=HyfRuntimeConfig( service=HyfServiceRuntimeConfig(transport="stdio"), - runtime=HyfExecutionRuntimeConfig( - default_execution_mode="deterministic", allow_assisted=True - ), + runtime=runtime.copy(), assisted=HyfAssistedRuntimeConfig( provider="typesafe", max_local=HyfMaxLocalProviderRuntimeConfig(), @@ -262,3 +263,19 @@ def test_typesafe_profile_is_configured_and_pins_https_model() raises: assert_equal(config.effective.assisted.typesafe.model, "jev-1.13.0") var disabled = _typesafe_config(False, "https://api.typesafe.ai") assert_true(not assisted_runtime_configured(disabled)) + + +from hyf_runtime.config import default_loaded_runtime_config, operation_enabled, provider_disabled + + +def test_operation_enablement_and_kill_switch() raises: + var config = default_loaded_runtime_config() + assert_true(not operation_enabled(config, "farm_update.interpret")) + assert_true(not operation_enabled(config, "buyer_request.interpret")) + assert_true(not operation_enabled(config, "buyer_request.match")) + assert_true(not provider_disabled(config)) + config.effective.runtime.enable_buyer_request_match = True + assert_true(operation_enabled(config, "buyer_request.match")) + config.effective.runtime.disable_provider = True + assert_true(provider_disabled(config)) + assert_true(not operation_enabled(config, "buyer_request.match"))