mechaharness.core.environment

Optional host probe for the active inference environment.

Hosts (for example a LAN OpenAI-compat deploy) implement this to refuse runs that need capabilities the loaded profile does not provide. The library default is a no-op so CLI/mock paths stay unchanged.

Lanes are open str identity (reason, judge, media, or a host namespace). Unknown lanes round-trip; hosts supply load hints.

class mechaharness.core.environment.InferenceEnvironment[source]

Bases: ABC

Describe what the current backend / host profile can do.

abstractmethod active_capabilities() → CapabilityProfile[source]

Capability set of the loaded environment.

active_grants() → list[str][source]

Grants the environment is willing to honor (default: none).

active_lane() → str | None[source]

Capability lane derived from the active profile, or None if unknown.

Well-known values: reason, judge, media. Hosts may return other namespaced lanes.

abstractmethod active_profile() → str | None[source]

Host profile name, or None when unknown.

assert_compatible(*, required_grants: Sequence[object] | None = None, require_media: bool = False, require_lane: str | None = None) → None[source]

Raise if the active environment cannot satisfy the request.

lane_load_hint(lane: str) → str[source]

Operator hint naming how to load a profile for lane.

exception mechaharness.core.environment.InferenceEnvironmentError[source]

Bases: MechaHarnessError

Requested work does not match the active inference environment.

class mechaharness.core.environment.NoOpInferenceEnvironment[source]

Bases: InferenceEnvironment

Always compatible; used when no host probe is configured.

active_capabilities() → CapabilityProfile[source]

Capability set of the loaded environment.

active_lane() → str | None[source]

Capability lane derived from the active profile, or None if unknown.

Well-known values: reason, judge, media. Hosts may return other namespaced lanes.

active_profile() → str | None[source]

Host profile name, or None when unknown.

assert_compatible(*, required_grants: Sequence[object] | None = None, require_media: bool = False, require_lane: str | None = None) → None[source]

Raise if the active environment cannot satisfy the request.