cadrumo.core.config_support module¶
Support types and defaults for the central settings facade.
This module holds the closed settings enums and derived records consumed
by Settings: LLM provider selection
(LLMProvider), and database routing via
StorageRouteKind and
StorageRouteClassification.
The route records are produced by
classify_storage_route(); output language strings are
coerced to OutputLanguage; and AEAT URL
defaults are read from load_external_constants().
- AEAT_CERTIFICATE_PROTECTED_ORIGIN¶
Exact Playwright client-certificate origin for AEAT certificate authentication.
- AEAT_CERTIFICATE_PROTECTED_PATH¶
Exact protected AEAT resource path used to prove certificate authentication.
- AEAT_CERTIFICATE_PROTECTED_URL¶
Canonical protected navigation URL for certificate authentication.
- assert_canonical_protected_resource(value, *, subject)[source]¶
Return
valueif it is the canonical protected resource, else raise.Certificate authentication is proved by reaching one specific AEAT resource, so a record claiming proof against any other URL is not evidence of anything. Both the persisted proof and the live session detail assert this, and they asserted it with separate copies of the comparison until this became its one home — beside the constant it is about, where a change to the route and a change to the rule cannot separate.
- Parameters:
- Return type:
- Returns:
valueunchanged.- Raises:
ValueError –
valueis not the canonical protected resource. A plainValueErrorbecause both call sites are pydantic validators, which fold it into the model’s ownValidationError.
- class TuiAppearance(*values)[source]¶
Bases:
StrEnumSupported appearances for the full-screen terminal surfaces.
Settingsexposes this closed set throughcadrumo_tui_appearanceso the profile manager, the paged flow frontend, and the read-only status page share one spelling for the operator’s light/dark preference.AUTOdefers to the host terminal rather than pinning an appearance.- AUTO¶
- LIGHT¶
- DARK¶
- unwrap_optional_secret(value)[source]¶
Return the cleartext of an optional
pydantic.SecretStr.Optional Cl@ve and certificate settings use this helper at adapter boundaries so unset secrets materialise as
""rather than leakingpydantic.SecretStrwrappers into string handling.- Return type:
- Parameters:
value (SecretStr | None)
- class LLMProvider(*values)[source]¶
Bases:
StrEnumThe closed set of model-transport identities, declared once, here.
Canonical home for the value set, not a settings-only convenience. Two byte-identical copies of it existed – this one and a second in the inference package’s request models – so a reader could not tell which was authoritative and a value added to one would silently not exist in the other.
It lives in
corebecause a closed value set is declared incoreby the architecture boundary, and because the direction is forced: the inference package may importcore(inward), whilecoreimporting the optional inference package is refused by contract. The package consumes this enum; it does not redeclare it.- ANTHROPIC¶
- OPENAI¶
- GEMINI¶
- LOCAL¶
- class StorageRouteKind(*values)[source]¶
Bases:
StrEnumResolved primary database route classification.
Members distinguish operator-supplied database URLs from computed active bucket routes and cold root-fallback routes. The storage write policy consumes this value through
inspect_storage_write_policy().- EXPLICIT_DATABASE_URL¶
- ACTIVE_BUCKET_DATABASE¶
- ROOT_FALLBACK_DATABASE¶
- class StorageRouteClassification(**data)[source]¶
Bases:
BaseModelStrict classification of the effective primary database route.
Instances are returned by
classify_storage_route()and carry the effectiveStorageRouteKind, original database URL, SQLite path when derivable, and active bucket id for bucket-attached routes.- Parameters:
data (Any)
- kind: StorageRouteKind¶
- database_url: str¶
- database_path: Path | None¶
- bucket_id: BucketId | None¶
- default_clave_sede_access_url_template()[source]¶
Return the configured Cl@ve Movil selector access URL template.
- Return type:
- default_clave_permanente_sede_access_url_template()[source]¶
Return the configured Cl@ve Permanente selector access URL template.
- Return type:
- default_sede_expedientes_path()[source]¶
Return the configured AEAT Sede expedientes summary path.
- Return type:
- default_status_detail_url_template()[source]¶
Return the configured AEAT expediente status detail URL template.
- Return type:
- default_status_notificaciones_path()[source]¶
Return the configured AEAT notifications status path.
- Return type:
- default_aeat_sede_origin_with_slash()[source]¶
Return the configured AEAT Sede origin with a trailing slash.
- Return type:
- class JustificanteParserBackendSetting(*values)[source]¶
Bases:
StrEnumSettings-shape selector for the justificante PDF parsing backend.
- PDFPLUMBER¶
- coerce_output_language_setting(value)[source]¶
Coerce an env-var output-language string to an
OutputLanguage.Returns
Nonefor invalid input soSettingsvalidation can decide how to fall back or report the bad value. A non-string value (e.g. a barebool, which is a subtype ofintand would otherwise reach.lower()) is invalid input, not a crash.- Return type:
- Parameters:
value (str)