cadrumo.application.local_reader_operation module¶
Supervised operation for provisioning the local document reader from any frontend.
One definition, local-reader.provision, carries every action a status area
or the command line offers – install, start, pull, load, verify, remove, and
the one-shot setup that runs the first five in order – so a TUI button and
aeat config provision <verb> run the same implementation. Installing runs
a package manager and therefore requires consent on the request; every
frontend gathers that consent explicitly before submitting.
Process control is injected. The application layer never spawns a process itself; the entrypoint composition binds the outbound adapters.
- LOCAL_READER_OPERATION_SUBJECT¶
The runtime is one per host, so every provisioning request shares one subject and the definition-subject lease serialises them.
- class LocalReaderProvisionAction(*values)[source]¶
Bases:
StrEnumWhat one provisioning operation does.
- INSTALL¶
- START¶
- PULL¶
- LOAD¶
- VERIFY¶
- REMOVE¶
- SETUP¶
- class LocalReaderSetupStep(*values)[source]¶
Bases:
StrEnumThe ordered steps of a one-shot setup.
- INSTALL¶
- START¶
- PULL¶
- LOAD¶
- VERIFY¶
- class LocalReaderSetupStepState(*values)[source]¶
Bases:
StrEnumWhat one setup step did: nothing needed, a change, a refusal, or not run.
- UNCHANGED¶
- CHANGED¶
- FAILED¶
- NOT_REACHED¶
- local_reader_setup_phase(step)[source]¶
Return the declared phase code a setup publishes when
stepbegins.- Return type:
- Parameters:
step (LocalReaderSetupStep)
- class LocalReaderProvisionRequest(**data)[source]¶
Bases:
CredentialFreeOperationRequestOne provisioning action, over one role’s model, a named model, or every role’s.
consentis the operator’s explicit agreement to run the package-manager install and is accepted only by the actions that may install.modelnames a model outright and is accepted only by load and remove; remove requires a role or a model so it never deletes every model by default.- Parameters:
data (Any)
- action: LocalReaderProvisionAction¶
- role: ModelRole | None¶
- model: str | None¶
- consent: bool¶
- build_local_reader_install_request(*, consent)[source]¶
Build the request that installs the runtime; nothing is installed without
consent.- Return type:
OperationRequest[LocalReaderProvisionRequest]- Parameters:
consent (bool)
- build_local_reader_start_request()[source]¶
Build the request that starts the local runtime when it is not answering.
- Return type:
OperationRequest[LocalReaderProvisionRequest]
- build_local_reader_pull_request(role=None)[source]¶
Build the request that pulls
role’s model, or every reader role’s model.- Return type:
OperationRequest[LocalReaderProvisionRequest]- Parameters:
role (ModelRole | None)
- build_local_reader_load_request(role=None, model=None)[source]¶
Build the request that loads
role’s model, a named model, or every role’s model.
- build_local_reader_verify_request(role=None)[source]¶
Build the request that verifies
role’s model, or every reader role’s model.- Return type:
OperationRequest[LocalReaderProvisionRequest]- Parameters:
role (ModelRole | None)
- build_local_reader_remove_request(role=None, model=None)[source]¶
Build the request that removes
role’s model or a named model from the runtime’s store.
- build_local_reader_setup_request(*, consent)[source]¶
Build the one-shot setup request: install (with
consent), start, pull, load, verify.- Return type:
OperationRequest[LocalReaderProvisionRequest]- Parameters:
consent (bool)
- class LocalReaderModelOutcome(**data)[source]¶
Bases:
BaseModelWhat happened to one model, or to one role whose selection refused.
already_satisfiedmarks a model that needed nothing: already pulled for a pull, already resident for a load.stepnames the setup step that produced the item, and is absent outside setup.- Parameters:
data (Any)
- model: str | None¶
- roles: tuple[ModelRole, ...]¶
- succeeded: bool¶
- already_satisfied: bool¶
- step: LocalReaderSetupStep | None¶
- bytes_fetched: int | None¶
- freed_bytes: int | None¶
- was_installed: bool¶
- resident: bool¶
- answered: bool¶
- elapsed_ms: int | None¶
- facts: Mapping[str, ProvisioningFactValue]¶
- precondition_verdict: PreconditionVerdict | None¶
- class LocalReaderInstallOutcome(**data)[source]¶
Bases:
BaseModelWhat the install request found and did.
- Parameters:
data (Any)
- installed: bool¶
- already_installed: bool¶
- installer: RuntimeInstaller¶
- consented: bool¶
- installer_exit_code: int | None¶
- class LocalReaderSetupStepOutcome(**data)[source]¶
Bases:
BaseModelOne setup step’s state and, when it failed, the refused condition.
- Parameters:
data (Any)
- step: LocalReaderSetupStep¶
- state: LocalReaderSetupStepState¶
- failed_condition_id: str | None¶
- class LocalReaderProvisionOutcome(**data)[source]¶
Bases:
BaseModelThe settled result of one provisioning operation.
factsandprecondition_verdictdescribe the runtime-level action (install or start); per-model detail is inmodels. For setup,stepslists every step in order andstopped_stepnames the step that failed, after which every later step isnot_reached.- Parameters:
data (Any)
- action: LocalReaderProvisionAction¶
- succeeded: bool¶
- runtime_started: bool¶
- already_running: bool¶
- started_pid: int | None¶
- install: LocalReaderInstallOutcome | None¶
- models: tuple[LocalReaderModelOutcome, ...]¶
- steps: tuple[LocalReaderSetupStepOutcome, ...]¶
- stopped_step: LocalReaderSetupStep | None¶
- facts: Mapping[str, ProvisioningFactValue]¶
- precondition_verdict: PreconditionVerdict | None¶
- class LocalReaderFactV1(**data)[source]¶
Bases:
BaseModelOne locale-neutral provisioning fact, as an immutable key/value pair.
- key: str¶
- value: str | int | bool¶
- local_reader_fact_mapping(facts)[source]¶
Return published facts as the mapping a frontend payload carries.
- local_reader_public_verdict(failed_condition_id, verdict_facts)[source]¶
Rebuild the provisioning refusal a public result names, or
Nonewhen nothing was refused.Every provisioning refusal is a no-recovery runtime observation over its condition and facts, so the condition and the evidence facts are the whole verdict; the projector refuses to publish one that would not rebuild exactly.
- Return type:
- Parameters:
failed_condition_id (str | None)
verdict_facts (tuple[LocalReaderFactV1, ...])
- class LocalReaderModelOutcomeV1(**data)[source]¶
Bases:
BaseModelPublic projection of one model outcome.
- Parameters:
model (str | None)
succeeded (bool)
already_satisfied (bool)
step (LocalReaderSetupStep | None)
was_installed (bool)
resident (bool)
answered (bool)
failed_condition_id (str | None)
facts (tuple[LocalReaderFactV1, ...])
verdict_condition_id (str | None)
verdict_facts (tuple[LocalReaderFactV1, ...])
- model: str | None¶
- roles: tuple[ModelRole, ...]¶
- succeeded: bool¶
- already_satisfied: bool¶
- step: LocalReaderSetupStep | None¶
- bytes_fetched: NonNegativeInt | None¶
- freed_bytes: NonNegativeInt | None¶
- was_installed: bool¶
- resident: bool¶
- answered: bool¶
- elapsed_ms: NonNegativeInt | None¶
- failed_condition_id: str | None¶
- facts: tuple[LocalReaderFactV1, ...]¶
- verdict_condition_id: str | None¶
- verdict_facts: tuple[LocalReaderFactV1, ...]¶
- class LocalReaderInstallOutcomeV1(**data)[source]¶
Bases:
BaseModelPublic projection of the install request.
- Parameters:
installed (bool)
already_installed (bool)
installer (RuntimeInstaller)
consented (bool)
installer_exit_code (int | None)
- installed: bool¶
- already_installed: bool¶
- installer: RuntimeInstaller¶
- consented: bool¶
- installer_exit_code: int | None¶
- class LocalReaderSetupStepOutcomeV1(**data)[source]¶
Bases:
BaseModelPublic projection of one setup step.
- Parameters:
step (LocalReaderSetupStep)
state (LocalReaderSetupStepState)
failed_condition_id (str | None)
- step: LocalReaderSetupStep¶
- state: LocalReaderSetupStepState¶
- failed_condition_id: str | None¶
- class LocalReaderProvisionPublicResultV1(**data)[source]¶
Bases:
BaseModelPublic projection of a settled provisioning operation.
- Parameters:
action (LocalReaderProvisionAction)
succeeded (bool)
runtime_started (bool)
already_running (bool)
install (LocalReaderInstallOutcomeV1 | None)
failed_condition_id (str | None)
models (tuple[LocalReaderModelOutcomeV1, ...])
steps (tuple[LocalReaderSetupStepOutcomeV1, ...])
stopped_step (LocalReaderSetupStep | None)
facts (tuple[LocalReaderFactV1, ...])
verdict_condition_id (str | None)
verdict_facts (tuple[LocalReaderFactV1, ...])
- action: LocalReaderProvisionAction¶
- succeeded: bool¶
- runtime_started: bool¶
- already_running: bool¶
- started_pid: NonNegativeInt | None¶
- install: LocalReaderInstallOutcomeV1 | None¶
- failed_condition_id: str | None¶
- models: tuple[LocalReaderModelOutcomeV1, ...]¶
- steps: tuple[LocalReaderSetupStepOutcomeV1, ...]¶
- stopped_step: LocalReaderSetupStep | None¶
- facts: tuple[LocalReaderFactV1, ...]¶
- verdict_condition_id: str | None¶
- verdict_facts: tuple[LocalReaderFactV1, ...]¶
- class LocalReaderProvisionEvents(*args, **kwargs)[source]¶
Bases:
ProtocolWhere a provisioning run reports its progress; the supervised operation journals it.
- async step(step)[source]¶
Report that a setup step begins.
- Return type:
- Parameters:
step (LocalReaderSetupStep)
- local_reader_provision_effect(outcome)[source]¶
Return the committed extent a settled provisioning outcome represents.
- Return type:
- Parameters:
outcome (LocalReaderProvisionOutcome)
- async provision_local_reader(payload, *, spawn, run_installer, text_probe, events=None)[source]¶
Run one provisioning action and return its settled outcome.
The single implementation of install, start, pull, load, verify, remove and setup. The supervised operation wraps it with journaled progress for frontends that hold a profile session; a host-level caller such as the command line runs it directly, because provisioning the machine’s runtime needs no profile. Never raises for a refusal: every refusal is a typed verdict on the outcome.
- Return type:
- Parameters:
payload (LocalReaderProvisionRequest)
spawn (RuntimeSpawner)
run_installer (InstallerRunner)
text_probe (TextExtractionFitnessProbe)
events (LocalReaderProvisionEvents | None)
- class LocalReaderProvisionExecutor(*, spawn, run_installer, text_probe)[source]¶
Bases:
objectSupervise
provision_local_reader(): journal its progress and persist its outcome.- Parameters:
spawn (RuntimeSpawner)
run_installer (InstallerRunner)
text_probe (TextExtractionFitnessProbe)
- async execute(request, context)[source]¶
Execute the requested action and persist its settled outcome.
- Return type:
- Parameters:
request (OperationRequest[LocalReaderProvisionRequest])
context (OperationExecutorContext)
- build_local_reader_operation_definition(*, spawn, run_installer, text_probe)[source]¶
Bind the injected process and fitness ports to the canonical provisioning operation.
- Return type:
- Parameters:
spawn (RuntimeSpawner)
run_installer (InstallerRunner)
text_probe (TextExtractionFitnessProbe)
- build_local_reader_operation_registration(definition)[source]¶
Bind the provisioning definition to its stable public schemas.
- Return type:
- Parameters:
definition (OperationDefinition)