aeat.application.provisioning module

Typed external-dependency probes for graceful degradation and config check.

This module is the read-only application doctor surface: each probe asks whether one external service or optional package extra is usable on this workstation and returns a typed DependencyStatus with the exact remediation command when it is not. Probes do not provision, unlock, write profile state, or raise on absence; a missing dependency is report data under the dependency-provisioning ADR, not an exception path.

The vision read consults probe_ollama_vision() before expensive inference, so a down server or an unpulled model becomes an instructive refusal instead of a raw stack trace. The aeat config check command renders this module’s statuses as CheckDependencyPayload rows beside the active profile’s capability posture from resolve_active_capability(). Optional-extra probes walk the core OPTIONAL_EXTRAS catalogue of OptionalExtra records, so CLI diagnostics and adapter import guards share one registry.

class DependencyStatus(**data)[source]

Bases: BaseModel

Availability result for one external dependency.

service is the stable row id shown by aeat config check; detail explains the observed state; remediation is the command or action the operator can run when available is false. The model is intentionally generic so Ollama, subprocess CLIs, Playwright browser binaries, and OptionalExtra package extras all render through the same payload shape and can be validated into CheckDependencyPayload.

Parameters:
service: str
available: bool
detail: str
remediation: str
probe_ollama_vision(settings=None)[source]

Probe Ollama and the configured vision model, returning a DependencyStatus.

Reads aeat_llm_ollama_chat_url and aeat_llm_ollama_vision_model from Settings, then performs a short-timeout GET /api/tags. The probe never runs inference and returns unavailable when the server is unreachable (ollama serve) or the configured model is not pulled (ollama pull <model>). Ledger evidence reading uses this result before local-vision inference so LLMClassifierError can carry the exact remediation.

Return type:

DependencyStatus

Parameters:

settings (Settings | None)

probe_subprocess_providers()[source]

Probe each subprocess LLM CLI provider on PATH.

Delegates provider discovery to the ledger classification surface and adapts each availability row into the common DependencyStatus shape. The probe resolves binaries only; it does not spawn provider processes. aeat config check combines these rows with ServiceCapability decisions to flag opted-in cloud evidence uploads that lack a provider CLI.

Return type:

tuple[DependencyStatus, ...]

probe_playwright_browser(cache_root=None)[source]

Probe the Playwright Chromium browser binary, returning a DependencyStatus.

Scans the Playwright browsers cache for an installed chromium* build using a fast filesystem check. The Playwright sync driver can hang inside the CLI process, so this probe deliberately never launches it. Missing, unreadable, or empty cache roots return unavailable with the playwright install chromium remediation. cache_root is a testable override for the browser cache directory. The row complements the browser health probe in aeat.application.diagnostics; it checks workstation provisioning, not AEAT site reachability.

Return type:

DependencyStatus

Parameters:

cache_root (Path | None)

probe_optional_extra(extra)[source]

Probe whether an optional package extra is importable, never raising.

Wraps the core optional_extra_available() spec-only check for one OptionalExtra (no import, no side effects) in the doctor’s DependencyStatus, naming the extra’s install_hint as remediation when absent. The feature-boundary guard is the sibling core require_optional_extra(), which raises the typed MissingOptionalExtraError when a command actually requires the feature.

Return type:

DependencyStatus

Parameters:

extra (OptionalExtra)

probe_optional_extras()[source]

Probe every capability-gated OptionalExtra into DependencyStatus rows.

The result set is keyed by the same OPTIONAL_EXTRAS catalogue used by require_optional_extra(), keeping aeat config check and runtime feature guards aligned.

Return type:

tuple[DependencyStatus, ...]