daecore 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- _daecore_entry.py +2145 -0
- daecore/__init__.py +22 -0
- daecore/__main__.py +21 -0
- daecore/_atomic_file.py +153 -0
- daecore/_durable_file.py +75 -0
- daecore/_error_mode.py +24 -0
- daecore/_exclusive_lock.py +521 -0
- daecore/_handover.py +548 -0
- daecore/_release/core.lock +4 -0
- daecore/_release/handover.lock +47 -0
- daecore/_release/overlay-cuda.lock +126 -0
- daecore/_release/overlay-metal.lock +6 -0
- daecore/_release/overlay-vulkan.lock +6 -0
- daecore/_release/python-version +1 -0
- daecore/_release/runtime.lock +1633 -0
- daecore/_release/tools.lock +20 -0
- daecore/_survey_store.py +156 -0
- daecore/_version.py +10 -0
- daecore/_windows_directory.py +69 -0
- daecore/agent_use/__init__.py +1 -0
- daecore/agent_use/capabilities.py +680 -0
- daecore/agent_use/constitution.py +185 -0
- daecore/agent_use/features.py +40 -0
- daecore/approval.py +150 -0
- daecore/artifact_cleanup.py +136 -0
- daecore/artifact_observation.py +278 -0
- daecore/assurance/__init__.py +1 -0
- daecore/assurance/access.py +54 -0
- daecore/assurance/campaign.py +267 -0
- daecore/assurance/catalog.py +235 -0
- daecore/assurance/census.py +67 -0
- daecore/assurance/contracts.py +212 -0
- daecore/assurance/control.py +90 -0
- daecore/assurance/control_provider.py +40 -0
- daecore/assurance/declarations.py +32 -0
- daecore/assurance/diagnostics.py +144 -0
- daecore/assurance/events.py +586 -0
- daecore/assurance/integrity/__init__.py +5 -0
- daecore/assurance/integrity/breach.py +309 -0
- daecore/assurance/integrity/proof.py +512 -0
- daecore/assurance/integrity/transparency.py +249 -0
- daecore/assurance/intent.py +367 -0
- daecore/assurance/ledger/__init__.py +445 -0
- daecore/assurance/ledger/_chain.py +169 -0
- daecore/assurance/ledger/_checkpoints.py +131 -0
- daecore/assurance/ledger/_heartbeats.py +290 -0
- daecore/assurance/ledger/_projections.py +390 -0
- daecore/assurance/ledger/_records.py +224 -0
- daecore/assurance/monitoring.py +784 -0
- daecore/assurance/providers.py +208 -0
- daecore/assurance/repair/__init__.py +1 -0
- daecore/assurance/repair/contracts.py +255 -0
- daecore/assurance/repair/engine.py +639 -0
- daecore/assurance/repair/registry.py +199 -0
- daecore/assurance/schema.py +174 -0
- daecore/assurance_runtime/__init__.py +1 -0
- daecore/assurance_runtime/authority.py +98 -0
- daecore/assurance_runtime/builtin.py +252 -0
- daecore/assurance_runtime/census.py +56 -0
- daecore/assurance_runtime/provider_set.py +337 -0
- daecore/assurance_runtime/repair.py +155 -0
- daecore/backup/__init__.py +1 -0
- daecore/backup/assurance.py +68 -0
- daecore/backup/checkpoint/__init__.py +1 -0
- daecore/backup/checkpoint/contracts.py +301 -0
- daecore/backup/checkpoint/engine.py +1048 -0
- daecore/backup/checkpoint/inspection.py +352 -0
- daecore/backup/checkpoint/inventory.py +255 -0
- daecore/backup/checkpoint/provider.py +347 -0
- daecore/backup/checkpoint/restore.py +1009 -0
- daecore/backup/checkpoint/verify.py +772 -0
- daecore/backup/core.py +244 -0
- daecore/chunk_identity.py +131 -0
- daecore/chunking/__init__.py +1 -0
- daecore/chunking/_packing_fit.py +217 -0
- daecore/chunking/contract.py +20 -0
- daecore/chunking/counter.py +173 -0
- daecore/chunking/geometry.py +35 -0
- daecore/chunking/import_packer.py +218 -0
- daecore/chunking/packer.py +300 -0
- daecore/chunking/record_packer.py +272 -0
- daecore/chunking/structural.py +87 -0
- daecore/classifier/__init__.py +1 -0
- daecore/classifier/agent_contract.py +113 -0
- daecore/classifier/facets.py +18 -0
- daecore/classifier/inputs.py +85 -0
- daecore/classifier/installation.py +127 -0
- daecore/classifier/labels.py +283 -0
- daecore/cli/__init__.py +19 -0
- daecore/cli/__main__.py +9 -0
- daecore/cli/client_names.py +34 -0
- daecore/cli/commands/__init__.py +1 -0
- daecore/cli/commands/add.py +327 -0
- daecore/cli/commands/doctor.py +153 -0
- daecore/cli/commands/drift.py +66 -0
- daecore/cli/commands/forget.py +443 -0
- daecore/cli/commands/lifecycle.py +452 -0
- daecore/cli/commands/memory/__init__.py +1 -0
- daecore/cli/commands/memory/backup.py +592 -0
- daecore/cli/commands/memory/common.py +35 -0
- daecore/cli/commands/memory/health.py +260 -0
- daecore/cli/commands/memory/reclassify.py +194 -0
- daecore/cli/commands/memory/remember.py +287 -0
- daecore/cli/commands/memory/transfer.py +301 -0
- daecore/cli/commands/memory/verbs.py +468 -0
- daecore/cli/commands/memory/word_index.py +61 -0
- daecore/cli/commands/models.py +210 -0
- daecore/cli/commands/relocate.py +366 -0
- daecore/cli/commands/remove.py +148 -0
- daecore/cli/commands/restart.py +338 -0
- daecore/cli/commands/retrieval/__init__.py +1 -0
- daecore/cli/commands/retrieval/inspection.py +285 -0
- daecore/cli/commands/retrieval/refresh.py +519 -0
- daecore/cli/commands/retrieval/refresh_offline.py +135 -0
- daecore/cli/commands/retrieval/refresh_reporting.py +445 -0
- daecore/cli/commands/retrieval/refresh_targets.py +99 -0
- daecore/cli/commands/retrieval/search.py +295 -0
- daecore/cli/commands/serve.py +35 -0
- daecore/cli/commands/setup.py +581 -0
- daecore/cli/commands/sources.py +352 -0
- daecore/cli/commands/status.py +767 -0
- daecore/cli/commands/sync.py +683 -0
- daecore/cli/commands/update.py +813 -0
- daecore/cli/common.py +88 -0
- daecore/cli/content_output.py +21 -0
- daecore/cli/data.py +37 -0
- daecore/cli/dispatch.py +503 -0
- daecore/cli/entry.py +274 -0
- daecore/cli/handlers.py +62 -0
- daecore/cli/help_screens.py +120 -0
- daecore/cli/machine.py +155 -0
- daecore/cli/model_repair.py +112 -0
- daecore/cli/old_folder.py +21 -0
- daecore/cli/parser/__init__.py +1 -0
- daecore/cli/parser/builder.py +87 -0
- daecore/cli/parser/groups.py +119 -0
- daecore/cli/parser/suggest.py +79 -0
- daecore/cli/parser/surface.py +353 -0
- daecore/cli/parser/verbs.py +404 -0
- daecore/cli/parser/visibility.py +200 -0
- daecore/cli/results.py +123 -0
- daecore/cli/source_output.py +90 -0
- daecore/cli/update_currency.py +203 -0
- daecore/cli/update_profile.py +110 -0
- daecore/cli/update_receipt.py +256 -0
- daecore/cli/update_reconcile.py +164 -0
- daecore/cli/version_notice.py +137 -0
- daecore/command_help.py +281 -0
- daecore/config/__init__.py +159 -0
- daecore/config/application.py +334 -0
- daecore/config/assurance.py +91 -0
- daecore/config/authority.py +580 -0
- daecore/config/authority_store.py +177 -0
- daecore/config/changes.py +112 -0
- daecore/config/loader.py +533 -0
- daecore/config/schema.py +373 -0
- daecore/config/settings.py +121 -0
- daecore/config/source_parsing.py +111 -0
- daecore/corpus_pause.py +269 -0
- daecore/cpu_capacity.py +27 -0
- daecore/daemon/__init__.py +1 -0
- daecore/daemon/_version_util.py +25 -0
- daecore/daemon/activation.py +376 -0
- daecore/daemon/assurance.py +132 -0
- daecore/daemon/assurance_provider.py +1160 -0
- daecore/daemon/attachments.py +470 -0
- daecore/daemon/automatic_recovery.py +192 -0
- daecore/daemon/candidate_checks.py +213 -0
- daecore/daemon/classifier_setup.py +186 -0
- daecore/daemon/disable.py +250 -0
- daecore/daemon/drain.py +247 -0
- daecore/daemon/drift_state.py +262 -0
- daecore/daemon/embedding_transition.py +153 -0
- daecore/daemon/fence.py +807 -0
- daecore/daemon/frozen_read_window.py +165 -0
- daecore/daemon/handover_steps.py +69 -0
- daecore/daemon/identity.py +149 -0
- daecore/daemon/labeler.py +611 -0
- daecore/daemon/maintenance/__init__.py +1 -0
- daecore/daemon/maintenance/_manifest_errors.py +13 -0
- daecore/daemon/maintenance/_manifest_rules.py +322 -0
- daecore/daemon/maintenance/_manifest_validation.py +266 -0
- daecore/daemon/maintenance/adjudication.py +282 -0
- daecore/daemon/maintenance/completion.py +238 -0
- daecore/daemon/maintenance/decisions.py +498 -0
- daecore/daemon/maintenance/events.py +122 -0
- daecore/daemon/maintenance/identity.py +402 -0
- daecore/daemon/maintenance/intent.py +309 -0
- daecore/daemon/maintenance/manifest.py +504 -0
- daecore/daemon/maintenance/pause_fields.py +84 -0
- daecore/daemon/maintenance/records.py +144 -0
- daecore/daemon/maintenance/status.py +262 -0
- daecore/daemon/maintenance/verification.py +137 -0
- daecore/daemon/maintenance_client.py +346 -0
- daecore/daemon/operation_hooks.py +115 -0
- daecore/daemon/pidfile.py +270 -0
- daecore/daemon/profile_setup.py +144 -0
- daecore/daemon/quiescence.py +294 -0
- daecore/daemon/recovery.py +432 -0
- daecore/daemon/refresh.py +150 -0
- daecore/daemon/refresh_recovery.py +193 -0
- daecore/daemon/release_notices.py +388 -0
- daecore/daemon/relocation/__init__.py +1 -0
- daecore/daemon/relocation/_backup.py +232 -0
- daecore/daemon/relocation/capacity.py +85 -0
- daecore/daemon/relocation/coordinator.py +907 -0
- daecore/daemon/relocation/copy.py +425 -0
- daecore/daemon/relocation/last_move.py +127 -0
- daecore/daemon/relocation/recovery.py +345 -0
- daecore/daemon/relocation/retirement.py +593 -0
- daecore/daemon/relocation/state.py +511 -0
- daecore/daemon/replacement.py +226 -0
- daecore/daemon/retrieval_client.py +335 -0
- daecore/daemon/runtime/__init__.py +557 -0
- daecore/daemon/runtime/_console_wrapper.py +114 -0
- daecore/daemon/runtime/_currency.py +160 -0
- daecore/daemon/runtime/_custody.py +40 -0
- daecore/daemon/runtime/_relay.py +190 -0
- daecore/daemon/runtime/_relocation.py +144 -0
- daecore/daemon/runtime/_seed_launcher.py +460 -0
- daecore/daemon/runtime/packages.py +196 -0
- daecore/daemon/runtime_change.py +165 -0
- daecore/daemon/runtime_install.py +262 -0
- daecore/daemon/runtime_retirement.py +430 -0
- daecore/daemon/runtime_switch.py +210 -0
- daecore/daemon/scheduler.py +308 -0
- daecore/daemon/spawn_guard.py +507 -0
- daecore/daemon/spawning.py +641 -0
- daecore/daemon/status.py +307 -0
- daecore/daemon/sync_policy.py +251 -0
- daecore/daemon/ticket_auth.py +162 -0
- daecore/daemon/tls.py +62 -0
- daecore/daemon/trust.py +456 -0
- daecore/daemon/uninstall_transaction.py +959 -0
- daecore/daemon/update/__init__.py +1 -0
- daecore/daemon/update/artifacts.py +779 -0
- daecore/daemon/update/completion.py +190 -0
- daecore/daemon/update/convergence.py +302 -0
- daecore/daemon/update/dispatch.py +155 -0
- daecore/daemon/update/journal.py +245 -0
- daecore/daemon/update/model_evidence.py +153 -0
- daecore/daemon/update/ownership.py +171 -0
- daecore/daemon/update/preimage.py +93 -0
- daecore/daemon/update/progress.py +55 -0
- daecore/daemon/update/proof.py +242 -0
- daecore/daemon/update/protocol.py +135 -0
- daecore/daemon/update/recovery.py +81 -0
- daecore/daemon/update/rollback.py +91 -0
- daecore/daemon/update/state.py +334 -0
- daecore/daemon/update/transaction.py +325 -0
- daecore/daemon/version_policy.py +29 -0
- daecore/daemon_lock.py +92 -0
- daecore/daemon_process/__init__.py +1 -0
- daecore/daemon_process/convergence.py +138 -0
- daecore/daemon_process/database_observation.py +157 -0
- daecore/daemon_process/name_observation.py +217 -0
- daecore/daemon_process/notes.py +14 -0
- daecore/daemon_process/resource_observation.py +167 -0
- daecore/daemon_process/serve.py +464 -0
- daecore/daemon_process/services.py +532 -0
- daecore/daemon_process/start.py +618 -0
- daecore/daemon_process/stop.py +219 -0
- daecore/daemon_process/watch.py +139 -0
- daecore/data/rerank_calibration.json +65 -0
- daecore/decoder_activation.py +87 -0
- daecore/decoder_installation.py +369 -0
- daecore/decoder_tree.py +138 -0
- daecore/digests.py +14 -0
- daecore/disk_capacity.py +128 -0
- daecore/doctor/__init__.py +1 -0
- daecore/doctor/contracts.py +351 -0
- daecore/doctor/guidance.py +246 -0
- daecore/doctor/identity.py +190 -0
- daecore/doctor/render.py +750 -0
- daecore/doctor/results.py +42 -0
- daecore/doctor/runner.py +800 -0
- daecore/doctor/session.py +245 -0
- daecore/doctor/store.py +190 -0
- daecore/document_extraction/__init__.py +64 -0
- daecore/document_extraction/entry.py +81 -0
- daecore/document_extraction/frames.py +60 -0
- daecore/document_extraction/level.py +281 -0
- daecore/document_extraction/level_probe.py +331 -0
- daecore/document_extraction/limits.py +53 -0
- daecore/document_extraction/office.py +531 -0
- daecore/document_extraction/posix_launcher.py +53 -0
- daecore/document_extraction/posix_policy.py +146 -0
- daecore/document_extraction/probe_entry.py +144 -0
- daecore/document_extraction/providers.py +613 -0
- daecore/document_extraction/registry_storage.py +46 -0
- daecore/document_extraction/result.py +84 -0
- daecore/document_extraction/session.py +338 -0
- daecore/document_extraction/warmup.zip +0 -0
- daecore/document_extraction/windows_access.py +239 -0
- daecore/document_extraction/windows_launcher.py +150 -0
- daecore/document_extraction/windows_probe_owner.py +35 -0
- daecore/document_extraction/worker.py +114 -0
- daecore/document_formats.py +72 -0
- daecore/documents/__init__.py +1 -0
- daecore/documents/_html.py +98 -0
- daecore/documents/_json_syntax.py +143 -0
- daecore/documents/_line_units.py +57 -0
- daecore/documents/_markdown.py +208 -0
- daecore/documents/_raw_positions.py +118 -0
- daecore/documents/_reader_metadata.py +16 -0
- daecore/documents/_record_input.py +30 -0
- daecore/documents/_slug_table.py +137 -0
- daecore/documents/_text_input.py +12 -0
- daecore/documents/csv_reader.py +155 -0
- daecore/documents/csv_records.py +40 -0
- daecore/documents/excerpts.py +174 -0
- daecore/documents/fidelity.py +178 -0
- daecore/documents/hygiene.py +202 -0
- daecore/documents/identity.py +49 -0
- daecore/documents/import_markdown.py +63 -0
- daecore/documents/json_reader.py +161 -0
- daecore/documents/links.py +672 -0
- daecore/documents/locators.py +713 -0
- daecore/documents/markdown_reader.py +161 -0
- daecore/documents/markup_reader.py +218 -0
- daecore/documents/model.py +245 -0
- daecore/documents/native.py +549 -0
- daecore/documents/outline.py +404 -0
- daecore/documents/plaintext_reader.py +57 -0
- daecore/documents/ranges.py +281 -0
- daecore/documents/readers.py +85 -0
- daecore/documents/record_units.py +61 -0
- daecore/documents/resolution.py +553 -0
- daecore/documents/sections.py +20 -0
- daecore/documents/slugs.py +36 -0
- daecore/documents/source_maps.py +49 -0
- daecore/documents/text.py +141 -0
- daecore/eligibility.py +1139 -0
- daecore/enablement.py +411 -0
- daecore/entry.py +138 -0
- daecore/envconf.py +419 -0
- daecore/evidence_dates.py +108 -0
- daecore/evidence_identity.py +515 -0
- daecore/exception_text.py +67 -0
- daecore/exit_codes.py +24 -0
- daecore/file_hash.py +17 -0
- daecore/file_probe.py +139 -0
- daecore/file_read.py +257 -0
- daecore/file_status.py +65 -0
- daecore/file_watch.py +247 -0
- daecore/filesystem_walk.py +703 -0
- daecore/health_readiness.py +130 -0
- daecore/held_lock.py +188 -0
- daecore/home_pointer.py +205 -0
- daecore/ignore_policy.py +1102 -0
- daecore/inference/__init__.py +1 -0
- daecore/inference/_execution_state.py +327 -0
- daecore/inference/_memory_state.py +148 -0
- daecore/inference/accelerator.py +505 -0
- daecore/inference/assurance.py +123 -0
- daecore/inference/assurance_provider.py +613 -0
- daecore/inference/batch_geometry.py +419 -0
- daecore/inference/device_memory.py +551 -0
- daecore/inference/execution.py +800 -0
- daecore/inference/failures.py +474 -0
- daecore/inference/hardware.py +241 -0
- daecore/inference/memory_budget.py +539 -0
- daecore/inference/model/__init__.py +1 -0
- daecore/inference/model/_file_identity.py +35 -0
- daecore/inference/model/_locking.py +62 -0
- daecore/inference/model/assets.py +1172 -0
- daecore/inference/model/blob_store.py +209 -0
- daecore/inference/model/cache/__init__.py +426 -0
- daecore/inference/model/cache/_collection.py +272 -0
- daecore/inference/model/cache/_leases.py +241 -0
- daecore/inference/model/cache/_observation.py +173 -0
- daecore/inference/model/cache/_pool.py +176 -0
- daecore/inference/model/cache/_records.py +311 -0
- daecore/inference/model/cache/_storage.py +232 -0
- daecore/inference/model/cache/_types.py +116 -0
- daecore/inference/model/registry.py +330 -0
- daecore/inference/model_fallback.py +227 -0
- daecore/inference/model_preparation.py +592 -0
- daecore/inference/model_progress.py +210 -0
- daecore/inference/model_status.py +407 -0
- daecore/inference/passage_geometry.py +215 -0
- daecore/inference/placement.py +352 -0
- daecore/inference/probe.py +119 -0
- daecore/inference/profile/__init__.py +393 -0
- daecore/inference/profile/circuit.py +262 -0
- daecore/inference/profile/contracts.py +188 -0
- daecore/inference/profile/incidents.py +502 -0
- daecore/inference/profile/registry.py +264 -0
- daecore/inference/profile/resolve.py +177 -0
- daecore/inference/profile/state.py +861 -0
- daecore/inference/providers.py +231 -0
- daecore/inference/residency.py +124 -0
- daecore/inference/role_health.py +139 -0
- daecore/inference/roles/__init__.py +1 -0
- daecore/inference/roles/classifier.py +1155 -0
- daecore/inference/roles/classifier_artifacts.py +799 -0
- daecore/inference/roles/embedding.py +337 -0
- daecore/inference/roles/lora_reranker.py +1098 -0
- daecore/inference/sequence_budget.py +254 -0
- daecore/inference/sessions/__init__.py +1 -0
- daecore/inference/sessions/_recovery.py +346 -0
- daecore/inference/sessions/_worker_client.py +387 -0
- daecore/inference/sessions/_worker_protocol.py +140 -0
- daecore/inference/sessions/_worker_transport.py +357 -0
- daecore/inference/sessions/locked_session.py +149 -0
- daecore/inference/sessions/model_worker.py +828 -0
- daecore/inference/system.py +72 -0
- daecore/inference/webgpu.py +89 -0
- daecore/input_budget.py +154 -0
- daecore/json_records.py +45 -0
- daecore/lifecycle_gate.py +657 -0
- daecore/link_contract.py +48 -0
- daecore/live_output.py +27 -0
- daecore/local_zone.py +143 -0
- daecore/memory/__init__.py +1 -0
- daecore/memory/_correction_inspection.py +161 -0
- daecore/memory/_inspection_contract.py +110 -0
- daecore/memory/_memory_inspection.py +368 -0
- daecore/memory/_source_inspection.py +269 -0
- daecore/memory/action_preflight.py +378 -0
- daecore/memory/annotation_writes.py +206 -0
- daecore/memory/assurance.py +151 -0
- daecore/memory/assurance_provider.py +719 -0
- daecore/memory/canonical/__init__.py +1 -0
- daecore/memory/canonical/_erasure.py +461 -0
- daecore/memory/canonical/_erasure_proofs.py +290 -0
- daecore/memory/canonical/_erasure_records.py +273 -0
- daecore/memory/canonical/_erasure_schema.py +521 -0
- daecore/memory/canonical/_facet_labels.py +195 -0
- daecore/memory/canonical/_history_reads.py +218 -0
- daecore/memory/canonical/_imported_files.py +207 -0
- daecore/memory/canonical/_mirrors.py +195 -0
- daecore/memory/canonical/_name_history.py +716 -0
- daecore/memory/canonical/_projection.py +63 -0
- daecore/memory/canonical/_record_reads.py +584 -0
- daecore/memory/canonical/_returns.py +277 -0
- daecore/memory/canonical/_revisions.py +208 -0
- daecore/memory/canonical/_rows.py +421 -0
- daecore/memory/canonical/_transfer.py +317 -0
- daecore/memory/canonical/access_lock.py +275 -0
- daecore/memory/canonical/admission.py +59 -0
- daecore/memory/canonical/citation_index.py +169 -0
- daecore/memory/canonical/connections.py +557 -0
- daecore/memory/canonical/correction_erasure.py +156 -0
- daecore/memory/canonical/correction_integrity.py +176 -0
- daecore/memory/canonical/correction_reads.py +812 -0
- daecore/memory/canonical/correction_references.py +187 -0
- daecore/memory/canonical/correction_row_data.py +176 -0
- daecore/memory/canonical/correction_rows.py +842 -0
- daecore/memory/canonical/correction_schema.py +144 -0
- daecore/memory/canonical/correction_transfer.py +227 -0
- daecore/memory/canonical/correction_winners.py +113 -0
- daecore/memory/canonical/database.py +1096 -0
- daecore/memory/canonical/erasure_ledger.py +857 -0
- daecore/memory/canonical/errors.py +149 -0
- daecore/memory/canonical/imported_file_schema.py +124 -0
- daecore/memory/canonical/location.py +57 -0
- daecore/memory/canonical/mirror_evidence.py +82 -0
- daecore/memory/canonical/name_schema.py +196 -0
- daecore/memory/canonical/project_links.py +138 -0
- daecore/memory/canonical/query_projection.py +272 -0
- daecore/memory/canonical/recall_returns.py +154 -0
- daecore/memory/canonical/record_holds.py +329 -0
- daecore/memory/canonical/reference_cleanup.py +801 -0
- daecore/memory/canonical/reference_index.py +146 -0
- daecore/memory/canonical/retry_outcome_schema.py +85 -0
- daecore/memory/canonical/retry_outcomes.py +586 -0
- daecore/memory/canonical/store_schema.py +931 -0
- daecore/memory/canonical/word_index.py +89 -0
- daecore/memory/citation_lookup.py +150 -0
- daecore/memory/citation_resolution.py +288 -0
- daecore/memory/citation_updates.py +207 -0
- daecore/memory/citation_upkeep.py +381 -0
- daecore/memory/consent.py +537 -0
- daecore/memory/correction.py +668 -0
- daecore/memory/correction_blockers.py +191 -0
- daecore/memory/correction_citations.py +172 -0
- daecore/memory/correction_dates.py +81 -0
- daecore/memory/correction_dependencies.py +420 -0
- daecore/memory/correction_errors.py +61 -0
- daecore/memory/correction_request.py +428 -0
- daecore/memory/correction_state.py +231 -0
- daecore/memory/correction_undo.py +566 -0
- daecore/memory/erasure_selection.py +387 -0
- daecore/memory/evidence_inspection.py +228 -0
- daecore/memory/exclusion_recovery.py +40 -0
- daecore/memory/filter_request.py +433 -0
- daecore/memory/filter_sql.py +363 -0
- daecore/memory/filtering.py +239 -0
- daecore/memory/forget.py +656 -0
- daecore/memory/index_projection.py +695 -0
- daecore/memory/inventory.py +103 -0
- daecore/memory/mirrored_documents.py +308 -0
- daecore/memory/name_files.py +210 -0
- daecore/memory/name_round.py +56 -0
- daecore/memory/name_state.py +766 -0
- daecore/memory/name_support.py +502 -0
- daecore/memory/native_folders.py +206 -0
- daecore/memory/native_import/__init__.py +137 -0
- daecore/memory/native_import/claude.py +400 -0
- daecore/memory/native_import/codex.py +58 -0
- daecore/memory/native_import/consented_routes.py +157 -0
- daecore/memory/native_import/contracts.py +161 -0
- daecore/memory/native_import/discovery.py +62 -0
- daecore/memory/native_import/folder_scan.py +178 -0
- daecore/memory/native_import/import_pass.py +342 -0
- daecore/memory/native_import/mapping.py +585 -0
- daecore/memory/native_import/reconcile.py +197 -0
- daecore/memory/native_import/store_rules.py +100 -0
- daecore/memory/native_providers.py +185 -0
- daecore/memory/policy.py +76 -0
- daecore/memory/projection_outbox.py +626 -0
- daecore/memory/publication.py +173 -0
- daecore/memory/read_facts.py +346 -0
- daecore/memory/records/__init__.py +1 -0
- daecore/memory/records/annotations.py +144 -0
- daecore/memory/records/authoring.py +107 -0
- daecore/memory/records/authorship.py +170 -0
- daecore/memory/records/cancellation.py +586 -0
- daecore/memory/records/citation_changes.py +90 -0
- daecore/memory/records/citations.py +890 -0
- daecore/memory/records/continuity_provenance.py +187 -0
- daecore/memory/records/contracts.py +214 -0
- daecore/memory/records/coordinates.py +119 -0
- daecore/memory/records/correction_history/__init__.py +5 -0
- daecore/memory/records/correction_history/contracts.py +19 -0
- daecore/memory/records/correction_history/derivation.py +437 -0
- daecore/memory/records/correction_history/erasure.py +107 -0
- daecore/memory/records/correction_history/naming.py +106 -0
- daecore/memory/records/correction_history/operations.py +219 -0
- daecore/memory/records/correction_history/recording.py +114 -0
- daecore/memory/records/correction_history/reference_fields.py +21 -0
- daecore/memory/records/correction_history/snapshots.py +46 -0
- daecore/memory/records/correction_history/undone_effects.py +101 -0
- daecore/memory/records/correction_history/validation.py +149 -0
- daecore/memory/records/exclusion_identity.py +54 -0
- daecore/memory/records/exclusions.py +350 -0
- daecore/memory/records/metadata.py +118 -0
- daecore/memory/records/origin_rights.py +197 -0
- daecore/memory/records/remember.py +68 -0
- daecore/memory/records/retirement.py +185 -0
- daecore/memory/records/revisions.py +135 -0
- daecore/memory/records/schema.py +428 -0
- daecore/memory/records/succession.py +287 -0
- daecore/memory/records/validation.py +226 -0
- daecore/memory/reference.py +172 -0
- daecore/memory/review_queues.py +116 -0
- daecore/memory/search.py +154 -0
- daecore/memory/store.py +903 -0
- daecore/memory/support.py +35 -0
- daecore/memory/support_reads.py +57 -0
- daecore/memory/writes.py +390 -0
- daecore/model_ids.py +6 -0
- daecore/name_coverage.py +266 -0
- daecore/name_presence.py +192 -0
- daecore/named_references.py +277 -0
- daecore/observability/__init__.py +1 -0
- daecore/observability/assurance.py +66 -0
- daecore/observability/assurance_provider.py +337 -0
- daecore/observability/crash_log.py +37 -0
- daecore/observability/event_log.py +229 -0
- daecore/observability/mcp_connections.py +274 -0
- daecore/observability/operation_status.py +101 -0
- daecore/observability/profile_io.py +42 -0
- daecore/observability/query_log.py +284 -0
- daecore/observability/rolling.py +224 -0
- daecore/observability/rotate.py +264 -0
- daecore/observability/semconv.py +1273 -0
- daecore/observability/telemetry_seal.py +310 -0
- daecore/observability/usage.py +225 -0
- daecore/operation_files/__init__.py +1103 -0
- daecore/operation_files/_coordination.py +283 -0
- daecore/operation_files/_files.py +316 -0
- daecore/operation_files/_records.py +204 -0
- daecore/operation_files/_types.py +30 -0
- daecore/operations/__init__.py +1 -0
- daecore/operations/admission.py +534 -0
- daecore/operations/barriers.py +81 -0
- daecore/operations/context.py +366 -0
- daecore/operations/contract.py +220 -0
- daecore/operations/errors.py +44 -0
- daecore/operations/frozen_read.py +101 -0
- daecore/operations/lease.py +340 -0
- daecore/operations/recovery.py +221 -0
- daecore/operations/recovery_contracts.py +214 -0
- daecore/operations/registry.py +1343 -0
- daecore/operations/rollback_snapshot.py +423 -0
- daecore/operations/runtime.py +281 -0
- daecore/operations/trace.py +121 -0
- daecore/operations/tree_snapshot.py +270 -0
- daecore/package_build.py +305 -0
- daecore/package_install.py +282 -0
- daecore/path_lock.py +168 -0
- daecore/paths.py +299 -0
- daecore/private_files.py +557 -0
- daecore/read_posture.py +52 -0
- daecore/read_vocabulary.py +227 -0
- daecore/reconcile.py +298 -0
- daecore/relay.py +8557 -0
- daecore/relay_support/__init__.py +1 -0
- daecore/relay_support/conversation.py +314 -0
- daecore/relay_support/custody.py +242 -0
- daecore/relay_support/diagnostics.py +114 -0
- daecore/relay_support/environment.py +65 -0
- daecore/relay_support/forwarding.py +248 -0
- daecore/relay_support/handshake.py +239 -0
- daecore/relay_support/home_location.py +215 -0
- daecore/relay_support/home_rename.py +188 -0
- daecore/relay_support/http_transport.py +451 -0
- daecore/relay_support/identity.py +672 -0
- daecore/relay_support/jsonrpc.py +167 -0
- daecore/relay_support/pinned_http.py +252 -0
- daecore/relay_support/processes.py +245 -0
- daecore/relay_support/protocol.py +742 -0
- daecore/relay_support/readiness.py +267 -0
- daecore/relay_support/relay_state.py +331 -0
- daecore/relay_support/runtime_selection.py +357 -0
- daecore/relay_support/spawn_broker.py +462 -0
- daecore/relay_support/spawn_process.py +249 -0
- daecore/relay_support/spawn_records.py +176 -0
- daecore/relay_support/spawn_tracking.py +647 -0
- daecore/relay_support/startup.py +744 -0
- daecore/relay_support/startup_files.py +178 -0
- daecore/relay_support/transport.py +510 -0
- daecore/release_install.py +481 -0
- daecore/request_deadline.py +173 -0
- daecore/resources/__init__.py +98 -0
- daecore/resources/_disk.py +463 -0
- daecore/resources/artifacts.py +134 -0
- daecore/retrieval/__init__.py +1 -0
- daecore/retrieval/_contract_primitives.py +105 -0
- daecore/retrieval/_evidence_validation.py +271 -0
- daecore/retrieval/_request_validation.py +101 -0
- daecore/retrieval/_response_validation.py +251 -0
- daecore/retrieval/assurance.py +103 -0
- daecore/retrieval/assurance_provider.py +573 -0
- daecore/retrieval/build/__init__.py +1 -0
- daecore/retrieval/build/cancellation.py +79 -0
- daecore/retrieval/build/candidate.py +159 -0
- daecore/retrieval/build/capture.py +159 -0
- daecore/retrieval/build/contract.py +199 -0
- daecore/retrieval/build/global_build.py +135 -0
- daecore/retrieval/build/identity.py +229 -0
- daecore/retrieval/build/ledger_candidate.py +1036 -0
- daecore/retrieval/build/ledger_publication.py +256 -0
- daecore/retrieval/build/ledger_rows.py +143 -0
- daecore/retrieval/build/memory.py +246 -0
- daecore/retrieval/build/metrics.py +131 -0
- daecore/retrieval/build/pipeline.py +401 -0
- daecore/retrieval/build/precommit.py +122 -0
- daecore/retrieval/build/residency.py +163 -0
- daecore/retrieval/build/results.py +98 -0
- daecore/retrieval/build/source.py +36 -0
- daecore/retrieval/build/source_selection.py +81 -0
- daecore/retrieval/build/state.py +843 -0
- daecore/retrieval/build/vectors.py +262 -0
- daecore/retrieval/build/workspace_progress.py +160 -0
- daecore/retrieval/candidate_cache.py +191 -0
- daecore/retrieval/capacity.py +90 -0
- daecore/retrieval/channel_fusion.py +73 -0
- daecore/retrieval/context_composer.py +413 -0
- daecore/retrieval/contracts.py +216 -0
- daecore/retrieval/corpus_date.py +545 -0
- daecore/retrieval/dense.py +1055 -0
- daecore/retrieval/document_projection.py +121 -0
- daecore/retrieval/embedders.py +221 -0
- daecore/retrieval/evidence.py +82 -0
- daecore/retrieval/file_ingest.py +587 -0
- daecore/retrieval/file_passages.py +125 -0
- daecore/retrieval/file_turns.py +435 -0
- daecore/retrieval/freshness.py +104 -0
- daecore/retrieval/index_state.py +56 -0
- daecore/retrieval/ingest_governor.py +127 -0
- daecore/retrieval/lexical.py +137 -0
- daecore/retrieval/name_history.py +306 -0
- daecore/retrieval/name_moves.py +161 -0
- daecore/retrieval/name_scan.py +357 -0
- daecore/retrieval/packed_files.py +427 -0
- daecore/retrieval/prefix_selection.py +266 -0
- daecore/retrieval/presentation.py +162 -0
- daecore/retrieval/query_cache.py +193 -0
- daecore/retrieval/rebuild.py +625 -0
- daecore/retrieval/reranking.py +492 -0
- daecore/retrieval/resource_budget.py +101 -0
- daecore/retrieval/resource_posture.py +213 -0
- daecore/retrieval/result_rows.py +193 -0
- daecore/retrieval/searcher.py +1172 -0
- daecore/retrieval/selection.py +161 -0
- daecore/retrieval/survey_storage.py +26 -0
- daecore/retrieval/sweep.py +1075 -0
- daecore/retrieval/watch_specs.py +70 -0
- daecore/retrieval/workspace_resolution.py +55 -0
- daecore/retrieval/workspace_withdrawal.py +231 -0
- daecore/runtime_contracts.py +80 -0
- daecore/runtime_enrollment.py +82 -0
- daecore/runtime_use.py +565 -0
- daecore/schema_versions.py +83 -0
- daecore/scripts/__init__.py +10 -0
- daecore/scripts/mcp_launcher.py +485 -0
- daecore/security/__init__.py +9 -0
- daecore/security/key_material/__init__.py +1139 -0
- daecore/security/key_material/_derivation.py +152 -0
- daecore/security/key_material/_dpapi.py +222 -0
- daecore/security/key_material/_errors.py +24 -0
- daecore/security/key_material/_machine.py +78 -0
- daecore/security/key_material/_os_keychain.py +191 -0
- daecore/security/key_material/_records.py +234 -0
- daecore/security/key_material/_registry.py +81 -0
- daecore/security/lock_state.py +55 -0
- daecore/security/posture.py +475 -0
- daecore/sentinel/__init__.py +1 -0
- daecore/sentinel/frontmatter.py +37 -0
- daecore/sentinel/hashing.py +50 -0
- daecore/sentinel/header.py +73 -0
- daecore/sentinel/marker.py +74 -0
- daecore/sentinel/ownership.py +34 -0
- daecore/sentinel/types.py +46 -0
- daecore/server/__init__.py +1 -0
- daecore/server/_embedding_handoff.py +96 -0
- daecore/server/_packet_render.py +239 -0
- daecore/server/_read_packets.py +314 -0
- daecore/server/_recall_packet.py +239 -0
- daecore/server/_utils.py +38 -0
- daecore/server/_write_packets.py +155 -0
- daecore/server/application.py +271 -0
- daecore/server/attachments.py +214 -0
- daecore/server/attribution.py +217 -0
- daecore/server/auth_gate.py +297 -0
- daecore/server/boot.py +317 -0
- daecore/server/boot_profile.py +66 -0
- daecore/server/candidate_check.py +68 -0
- daecore/server/change_queue.py +881 -0
- daecore/server/config_observer.py +688 -0
- daecore/server/content_access.py +521 -0
- daecore/server/corpus_mutation.py +260 -0
- daecore/server/frozen_reads.py +364 -0
- daecore/server/health.py +537 -0
- daecore/server/http/__init__.py +1 -0
- daecore/server/http/admin.py +187 -0
- daecore/server/http/admission.py +83 -0
- daecore/server/http/builder.py +66 -0
- daecore/server/http/middleware.py +258 -0
- daecore/server/http/retrieval.py +227 -0
- daecore/server/http/routes.py +98 -0
- daecore/server/index_rebuilds.py +289 -0
- daecore/server/lifecycle.py +1017 -0
- daecore/server/maintenance.py +317 -0
- daecore/server/memory_projection.py +157 -0
- daecore/server/model_health.py +209 -0
- daecore/server/model_residency.py +349 -0
- daecore/server/mutations.py +287 -0
- daecore/server/native_sync.py +331 -0
- daecore/server/next_calls.py +93 -0
- daecore/server/notices.py +137 -0
- daecore/server/observer_lifetime.py +374 -0
- daecore/server/packet_contracts.py +865 -0
- daecore/server/packets.py +345 -0
- daecore/server/proof_process.py +165 -0
- daecore/server/publication.py +231 -0
- daecore/server/rate_limit.py +179 -0
- daecore/server/readiness.py +497 -0
- daecore/server/reads/__init__.py +1 -0
- daecore/server/reads/_exact_documents.py +200 -0
- daecore/server/reads/_exact_lanes.py +278 -0
- daecore/server/reads/_exact_memory_facts.py +270 -0
- daecore/server/reads/_exact_paging.py +310 -0
- daecore/server/reads/_exact_passage_counts.py +193 -0
- daecore/server/reads/_exact_population.py +425 -0
- daecore/server/reads/_exact_reports.py +347 -0
- daecore/server/reads/_exact_request.py +212 -0
- daecore/server/reads/_exact_snapshot.py +325 -0
- daecore/server/reads/_exact_statistics.py +395 -0
- daecore/server/reads/_exact_types.py +273 -0
- daecore/server/reads/attribution.py +26 -0
- daecore/server/reads/browse.py +146 -0
- daecore/server/reads/browse_links.py +275 -0
- daecore/server/reads/bucket_listing.py +345 -0
- daecore/server/reads/clamps.py +20 -0
- daecore/server/reads/continuations.py +151 -0
- daecore/server/reads/dating.py +127 -0
- daecore/server/reads/degradation.py +123 -0
- daecore/server/reads/exact.py +58 -0
- daecore/server/reads/execution.py +869 -0
- daecore/server/reads/inspection.py +35 -0
- daecore/server/reads/inspection_pages.py +315 -0
- daecore/server/reads/link_graph.py +453 -0
- daecore/server/reads/link_items.py +301 -0
- daecore/server/reads/link_presentation.py +173 -0
- daecore/server/reads/link_report.py +172 -0
- daecore/server/reads/link_rows.py +415 -0
- daecore/server/reads/link_upkeep.py +145 -0
- daecore/server/reads/link_walks.py +754 -0
- daecore/server/reads/links.py +518 -0
- daecore/server/reads/pagination.py +148 -0
- daecore/server/reads/recall.py +210 -0
- daecore/server/reads/recall_links.py +198 -0
- daecore/server/reads/recall_log.py +105 -0
- daecore/server/reads/recall_pages.py +251 -0
- daecore/server/reads/recent_context.py +475 -0
- daecore/server/reads/retries.py +34 -0
- daecore/server/reads/write_reply.py +189 -0
- daecore/server/recall_handoff.py +176 -0
- daecore/server/recall_returns.py +129 -0
- daecore/server/refusals.py +191 -0
- daecore/server/rendering.py +466 -0
- daecore/server/reply_contracts.py +567 -0
- daecore/server/reply_views.py +496 -0
- daecore/server/response_write.py +333 -0
- daecore/server/result_catalog.py +226 -0
- daecore/server/review_health.py +195 -0
- daecore/server/scoping.py +221 -0
- daecore/server/tool_audit.py +340 -0
- daecore/server/tool_codes.py +29 -0
- daecore/server/tool_inventory.py +79 -0
- daecore/server/tool_requests.py +319 -0
- daecore/server/tool_runtime.py +884 -0
- daecore/server/tools/__init__.py +1 -0
- daecore/server/tools/_arguments.py +304 -0
- daecore/server/tools/_evidence.py +351 -0
- daecore/server/tools/_mutation_replies.py +82 -0
- daecore/server/tools/_variants.py +92 -0
- daecore/server/tools/admin.py +469 -0
- daecore/server/tools/annotation.py +275 -0
- daecore/server/tools/browse.py +353 -0
- daecore/server/tools/correction.py +385 -0
- daecore/server/tools/explore.py +217 -0
- daecore/server/tools/inspect.py +386 -0
- daecore/server/tools/memory.py +414 -0
- daecore/server/tools/recall.py +567 -0
- daecore/server/transport.py +156 -0
- daecore/server/update_window.py +217 -0
- daecore/server/warmup.py +293 -0
- daecore/server/watch_events.py +287 -0
- daecore/server/watch_queues.py +436 -0
- daecore/server/watch_routing.py +286 -0
- daecore/server/watcher.py +957 -0
- daecore/server/work.py +128 -0
- daecore/server/workspace_lifecycle.py +320 -0
- daecore/setup/__init__.py +37 -0
- daecore/setup/_application.py +353 -0
- daecore/setup/_contracts.py +84 -0
- daecore/setup/_planning.py +502 -0
- daecore/setup/_uninstall_removal.py +493 -0
- daecore/setup/_uninstall_runtime.py +123 -0
- daecore/setup/assurance.py +90 -0
- daecore/setup/assurance_provider.py +399 -0
- daecore/setup/bootstrap/__init__.py +280 -0
- daecore/setup/bootstrap/_acceleration.py +138 -0
- daecore/setup/bootstrap/_activation_receipts.py +115 -0
- daecore/setup/bootstrap/_plan_actions.py +221 -0
- daecore/setup/bootstrap/apply.py +555 -0
- daecore/setup/bootstrap/doctor.py +147 -0
- daecore/setup/bootstrap/fs_safety.py +93 -0
- daecore/setup/bootstrap/native_memory.py +457 -0
- daecore/setup/bootstrap/planning.py +708 -0
- daecore/setup/bootstrap/readiness.py +459 -0
- daecore/setup/bootstrap/receipt.py +85 -0
- daecore/setup/bootstrap/types.py +273 -0
- daecore/setup/bootstrap/wizard.py +389 -0
- daecore/setup/cli.py +222 -0
- daecore/setup/config.py +19 -0
- daecore/setup/detection.py +39 -0
- daecore/setup/execute.py +270 -0
- daecore/setup/guide.py +40 -0
- daecore/setup/hosts.py +674 -0
- daecore/setup/interaction.py +415 -0
- daecore/setup/merge/__init__.py +1 -0
- daecore/setup/merge/_json_patch_identity.py +178 -0
- daecore/setup/merge/_json_patch_operations.py +284 -0
- daecore/setup/merge/_json_patch_ownership.py +378 -0
- daecore/setup/merge/_json_patch_values.py +95 -0
- daecore/setup/merge/_publish.py +96 -0
- daecore/setup/merge/_toml_edit.py +416 -0
- daecore/setup/merge/_toml_structure.py +273 -0
- daecore/setup/merge/json_patch.py +324 -0
- daecore/setup/merge/jsonc.py +211 -0
- daecore/setup/merge/markdown_section.py +267 -0
- daecore/setup/merge/skill_file.py +41 -0
- daecore/setup/merge/syntax.py +146 -0
- daecore/setup/merge/toml_block.py +307 -0
- daecore/setup/merge/types.py +129 -0
- daecore/setup/merge/whole_file_sentinel.py +248 -0
- daecore/setup/merge/yaml_text.py +300 -0
- daecore/setup/plan.py +322 -0
- daecore/setup/plan_file.py +83 -0
- daecore/setup/record.py +224 -0
- daecore/setup/refresh_snapshot.py +361 -0
- daecore/setup/render.py +447 -0
- daecore/setup/templates/antigravity/continuity.md +8 -0
- daecore/setup/templates/antigravity/mcp.json.patch +19 -0
- daecore/setup/templates/claude-code/mcp.json.patch +22 -0
- daecore/setup/templates/codex/config.toml.patch +64 -0
- daecore/setup/templates/constitution-section.md.tmpl +3 -0
- daecore/setup/templates/copilot/mcp-config.json.patch +24 -0
- daecore/setup/templates/cursor/continuity.md +7 -0
- daecore/setup/templates/cursor/daecore-continuity.js +31 -0
- daecore/setup/templates/cursor/hooks.json.patch +24 -0
- daecore/setup/templates/cursor/mcp.json.patch +22 -0
- daecore/setup/templates/devin/continuity.md +8 -0
- daecore/setup/templates/devin/mcp.json.patch +20 -0
- daecore/setup/templates/hermes/config.yaml.patch +19 -0
- daecore/setup/templates/opencode/config.json.patch +28 -0
- daecore/setup/templates/skill/SKILL.md +38 -0
- daecore/setup/templates/skill/references/connect-any-host.md +84 -0
- daecore/setup/templates/skill/references/diagnose.md +62 -0
- daecore/setup/templates/skill/references/maintain.md +63 -0
- daecore/setup/uninstall.py +1298 -0
- daecore/setup/uninstall_execution.py +536 -0
- daecore/setup/uninstall_types.py +41 -0
- daecore/source_build.py +143 -0
- daecore/source_capture.py +117 -0
- daecore/source_identity.py +12 -0
- daecore/sqlite_identity.py +257 -0
- daecore/sqlite_space.py +153 -0
- daecore/stage_timings.py +119 -0
- daecore/status/__init__.py +1 -0
- daecore/status/inventory.py +192 -0
- daecore/status/memory_health.py +235 -0
- daecore/status/process_memory.py +141 -0
- daecore/status/snapshot.py +482 -0
- daecore/status/source_review.py +154 -0
- daecore/status/sources.py +271 -0
- daecore/status/watch.py +70 -0
- daecore/storage/__init__.py +3 -0
- daecore/storage/assurance.py +93 -0
- daecore/storage/assurance_provider.py +306 -0
- daecore/storage/database/__init__.py +71 -0
- daecore/storage/database/encrypted.py +451 -0
- daecore/storage/database/fs_probe.py +135 -0
- daecore/storage/database/fs_safety.py +576 -0
- daecore/storage/database/read_pool.py +94 -0
- daecore/storage/encrypted_meta_schema.py +374 -0
- daecore/storage/encrypted_snapshot.py +249 -0
- daecore/storage/index/__init__.py +3 -0
- daecore/storage/index/_diagnostic_moves.py +135 -0
- daecore/storage/index/_diagnostic_records.py +208 -0
- daecore/storage/index/chunk_projection.py +405 -0
- daecore/storage/index/citation_reading.py +510 -0
- daecore/storage/index/connections.py +269 -0
- daecore/storage/index/diagnostics.py +554 -0
- daecore/storage/index/document_reads.py +467 -0
- daecore/storage/index/document_schema.py +395 -0
- daecore/storage/index/document_visibility.py +77 -0
- daecore/storage/index/document_writers.py +474 -0
- daecore/storage/index/errors.py +46 -0
- daecore/storage/index/file_ledger.py +713 -0
- daecore/storage/index/generations.py +970 -0
- daecore/storage/index/hygiene_review.py +380 -0
- daecore/storage/index/key.py +130 -0
- daecore/storage/index/lexical.py +429 -0
- daecore/storage/index/link_revisions.py +87 -0
- daecore/storage/index/link_view.py +518 -0
- daecore/storage/index/memory_links.py +274 -0
- daecore/storage/index/metadata.py +65 -0
- daecore/storage/index/model_policy.py +69 -0
- daecore/storage/index/name_inventory.py +275 -0
- daecore/storage/index/payloads.py +513 -0
- daecore/storage/index/pointer.py +181 -0
- daecore/storage/index/profiles.py +581 -0
- daecore/storage/index/publication_undo.py +240 -0
- daecore/storage/index/schema.py +374 -0
- daecore/storage/index/search_atoms.py +782 -0
- daecore/storage/index/shared_generations.py +485 -0
- daecore/storage/index/shared_objects.py +831 -0
- daecore/storage/index/snapshots.py +118 -0
- daecore/storage/index/text_match.py +379 -0
- daecore/storage/index/vector_encoding.py +122 -0
- daecore/storage/integrity.py +222 -0
- daecore/storage/janitor/__init__.py +149 -0
- daecore/storage/janitor/_artifacts.py +426 -0
- daecore/storage/janitor/_audit.py +345 -0
- daecore/storage/meta_store.py +360 -0
- daecore/storage/native.py +51 -0
- daecore/subprocesses.py +404 -0
- daecore/sync/__init__.py +6 -0
- daecore/sync/catchup.py +203 -0
- daecore/sync/consent.py +905 -0
- daecore/sync/discovery.py +521 -0
- daecore/sync/full_scan.py +95 -0
- daecore/sync/identity.py +74 -0
- daecore/sync/recorded_sources.py +111 -0
- daecore/sync/result.py +86 -0
- daecore/sync/snapshot.py +586 -0
- daecore/templates/__init__.py +2 -0
- daecore/templates/global-config.toml +121 -0
- daecore/term/__init__.py +88 -0
- daecore/term/_brand.py +77 -0
- daecore/term/_console.py +96 -0
- daecore/term/_errors.py +62 -0
- daecore/term/_prompt.py +162 -0
- daecore/term/_questionary.py +62 -0
- daecore/term/_references.py +69 -0
- daecore/term/capabilities.py +153 -0
- daecore/term/lifecycle.py +917 -0
- daecore/term/live_region.py +260 -0
- daecore/term/loader.py +118 -0
- daecore/term/progress.py +958 -0
- daecore/term/prompts.py +58 -0
- daecore/term/rendering.py +971 -0
- daecore/term/safety.py +13 -0
- daecore/term/verb_help.py +207 -0
- daecore/term/wizard.py +86 -0
- daecore/testing/__init__.py +13 -0
- daecore/testing/crashpoints.py +81 -0
- daecore/testing/launch.py +97 -0
- daecore/text_decoding.py +68 -0
- daecore/time_utils.py +430 -0
- daecore/tokenizer_assets.py +39 -0
- daecore/transfer/__init__.py +1 -0
- daecore/transfer/_eff_wordlist.py +661 -0
- daecore/transfer/_verify.py +169 -0
- daecore/transfer/capacity.py +87 -0
- daecore/transfer/citations.py +253 -0
- daecore/transfer/classification.py +189 -0
- daecore/transfer/completion.py +155 -0
- daecore/transfer/contracts.py +280 -0
- daecore/transfer/convert.py +500 -0
- daecore/transfer/event_policy.py +85 -0
- daecore/transfer/export.py +163 -0
- daecore/transfer/export_file.py +371 -0
- daecore/transfer/export_payload.py +222 -0
- daecore/transfer/import_flow.py +278 -0
- daecore/transfer/import_job.py +296 -0
- daecore/transfer/journal.py +96 -0
- daecore/transfer/members.py +792 -0
- daecore/transfer/publication.py +584 -0
- daecore/transfer/publish.py +306 -0
- daecore/transfer/receipt.py +120 -0
- daecore/transfer/recovery.py +228 -0
- daecore/transfer/snapshot.py +950 -0
- daecore/transfer/verification.py +64 -0
- daecore/tree_copy.py +178 -0
- daecore/workspace/__init__.py +1 -0
- daecore/workspace/availability.py +192 -0
- daecore/workspace/config_transaction.py +772 -0
- daecore/workspace/filesystem.py +269 -0
- daecore/workspace/identity.py +327 -0
- daecore/workspace/intake.py +669 -0
- daecore/workspace/probes.py +221 -0
- daecore/workspace/project_links.py +252 -0
- daecore/workspace/project_membership.py +35 -0
- daecore/workspace/reattach.py +446 -0
- daecore/workspace/recovery.py +25 -0
- daecore/workspace/registry.py +645 -0
- daecore/workspace/scope.py +507 -0
- daecore-0.3.0.dist-info/METADATA +285 -0
- daecore-0.3.0.dist-info/RECORD +1051 -0
- daecore-0.3.0.dist-info/WHEEL +4 -0
- daecore-0.3.0.dist-info/entry_points.txt +3 -0
- daecore-0.3.0.dist-info/licenses/LICENSE +201 -0
- daecore-0.3.0.dist-info/licenses/NOTICE +99 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
"""Journal the Windows decoder's installation-owned profile and access entries outside the removable home."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
import re
|
|
6
|
+
from contextlib import contextmanager
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from daecore import runtime_use
|
|
10
|
+
from daecore._atomic_file import publish_bytes
|
|
11
|
+
from daecore.decoder_tree import DecoderTree
|
|
12
|
+
from daecore.document_extraction import windows_access as access
|
|
13
|
+
from daecore.document_extraction import windows_launcher as profiles
|
|
14
|
+
from daecore.held_lock import acquire_held_lock
|
|
15
|
+
from daecore.private_files import control_directory, read_control_bytes
|
|
16
|
+
from daecore.relay_support.runtime_selection import (
|
|
17
|
+
installed_package_root,
|
|
18
|
+
read_runtime_pointer,
|
|
19
|
+
venv_base_python,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
_RECEIPT = 'decoder-access.json'
|
|
23
|
+
_RECEIPT_BYTES = 1 << 20
|
|
24
|
+
_MANIFEST_BYTES = 8 << 20
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _sid(name):
|
|
28
|
+
try:
|
|
29
|
+
return profiles.decoder_profile_sid(name)
|
|
30
|
+
except (ImportError, AttributeError) as error:
|
|
31
|
+
raise OSError('the selected core cannot manage Windows decoder profiles') from error
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _check_storage(path, name):
|
|
35
|
+
if (not path.is_absolute() or '..' in path.parts or path.name.casefold() != 'ac'
|
|
36
|
+
or path.parent.name.casefold() != name.casefold() or path.parent.parent.name.casefold() != 'packages'):
|
|
37
|
+
raise OSError('unexpected decoder profile storage path')
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _layout(home, runtime):
|
|
41
|
+
from _daecore_entry import managed_python_root
|
|
42
|
+
from daecore.release_install import versioned_python_folder
|
|
43
|
+
|
|
44
|
+
if runtime.parent != home / 'runtime' or not runtime_use.is_managed_runtime_location(runtime):
|
|
45
|
+
raise OSError('decoder requires an immediate managed runtime')
|
|
46
|
+
with control_directory(runtime):
|
|
47
|
+
enrollment = runtime_use.runtime_use_record(runtime)
|
|
48
|
+
if enrollment is None or Path(enrollment['control']) != runtime_use.runtime_control_directory(home):
|
|
49
|
+
raise OSError('decoder runtime is not enrolled by this installation')
|
|
50
|
+
site = runtime / 'Lib' / 'site-packages'
|
|
51
|
+
if installed_package_root(runtime) != site / 'daecore':
|
|
52
|
+
raise OSError('decoder program must be installed in the runtime site directory')
|
|
53
|
+
base_exe = venv_base_python(runtime)
|
|
54
|
+
if (base_exe is None or base_exe.parent.parent != managed_python_root()
|
|
55
|
+
or not versioned_python_folder(base_exe.parent)):
|
|
56
|
+
raise OSError('decoder base interpreter is outside its versioned installation folder')
|
|
57
|
+
return enrollment['id'], access.identity(runtime), base_exe
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class Installation:
|
|
61
|
+
"""One durable namespace for all retained runtimes of this installation."""
|
|
62
|
+
|
|
63
|
+
def __init__(self, home, *, profile_prefix='Daecore.Decoder.'):
|
|
64
|
+
self.home = Path(home).absolute()
|
|
65
|
+
self._profile_prefix = profile_prefix
|
|
66
|
+
self.pool = runtime_use.runtime_control_directory(self.home)
|
|
67
|
+
self.receipt = self.pool / _RECEIPT
|
|
68
|
+
|
|
69
|
+
def _profile_name(self, installation):
|
|
70
|
+
return self._profile_prefix + installation
|
|
71
|
+
|
|
72
|
+
@contextmanager
|
|
73
|
+
def _locked(self, *, create=False):
|
|
74
|
+
if not create:
|
|
75
|
+
try:
|
|
76
|
+
self.receipt.lstat()
|
|
77
|
+
except FileNotFoundError:
|
|
78
|
+
yield None
|
|
79
|
+
return
|
|
80
|
+
runtime_use.ensure_runtime_control_pool(self.pool, self.home)
|
|
81
|
+
with control_directory(self.pool, private=True):
|
|
82
|
+
lock = acquire_held_lock(self.pool / 'decoder-access.lock', purpose='decoder-provision')
|
|
83
|
+
if lock is None:
|
|
84
|
+
raise OSError('decoder provisioning is already active')
|
|
85
|
+
with lock:
|
|
86
|
+
try:
|
|
87
|
+
raw = read_control_bytes(self.receipt, max_bytes=_RECEIPT_BYTES)
|
|
88
|
+
except FileNotFoundError:
|
|
89
|
+
state = None
|
|
90
|
+
else:
|
|
91
|
+
try:
|
|
92
|
+
state = json.loads(raw)
|
|
93
|
+
self._validate(state)
|
|
94
|
+
except (KeyError, TypeError, ValueError, AttributeError) as error:
|
|
95
|
+
raise OSError('invalid decoder provisioning receipt') from error
|
|
96
|
+
yield state
|
|
97
|
+
|
|
98
|
+
def _validate(self, state):
|
|
99
|
+
from _daecore_entry import managed_python_root
|
|
100
|
+
from daecore.release_install import versioned_python_folder
|
|
101
|
+
|
|
102
|
+
if (not isinstance(state, dict) or Path(state['home']) != self.home
|
|
103
|
+
or not re.fullmatch(r'[0-9a-f]{32}', state.get('installation', ''))
|
|
104
|
+
or state.get('sid') != _sid(self._profile_name(state['installation']))
|
|
105
|
+
or state.get('access_mask') != access.READ_EXECUTE
|
|
106
|
+
or state.get('phase') not in {'active', 'removing', 'relocating'}):
|
|
107
|
+
raise OSError('decoder provisioning receipt does not identify this installation')
|
|
108
|
+
if state['storage'] is not None:
|
|
109
|
+
_check_storage(Path(state['storage']['path']), self._profile_name(state['installation']))
|
|
110
|
+
for name, record in state['runtimes'].items():
|
|
111
|
+
root = self.home / 'runtime' / name
|
|
112
|
+
if (root.name != name or not runtime_use.is_managed_runtime_location(root)
|
|
113
|
+
or not re.fullmatch(r'[0-9a-f]{32}', record['enrollment'])):
|
|
114
|
+
raise OSError('invalid decoder runtime receipt')
|
|
115
|
+
if 'retiring' in record:
|
|
116
|
+
destination = Path(record['retiring'])
|
|
117
|
+
if (not destination.is_absolute() or '..' in destination.parts or destination.name != name
|
|
118
|
+
or destination.parent.name != 'payload'
|
|
119
|
+
or not re.fullmatch(r'runtime-prune-[0-9a-f]{32}', destination.parent.parent.name)):
|
|
120
|
+
raise OSError('invalid decoder retirement destination')
|
|
121
|
+
if record['identity'] is None:
|
|
122
|
+
raise OSError('missing decoder runtime identity')
|
|
123
|
+
for identity in (record['identity'], record['tree']):
|
|
124
|
+
if identity is not None and (not isinstance(identity, list) or len(identity) != 2
|
|
125
|
+
or not all(type(n) is int for n in identity)):
|
|
126
|
+
raise OSError('invalid decoder directory identity')
|
|
127
|
+
if record['base'] not in state['bases']:
|
|
128
|
+
raise OSError('decoder receipt lacks its base interpreter')
|
|
129
|
+
for key in state['bases']:
|
|
130
|
+
path = Path(key)
|
|
131
|
+
if path.parent != managed_python_root() or not versioned_python_folder(path):
|
|
132
|
+
raise OSError('decoder receipt names an unexpected base folder')
|
|
133
|
+
|
|
134
|
+
def _save(self, state):
|
|
135
|
+
self._validate(state)
|
|
136
|
+
body = json.dumps(state, sort_keys=True).encode()
|
|
137
|
+
if len(body) > _RECEIPT_BYTES:
|
|
138
|
+
raise OSError('decoder provisioning receipt exceeds its read bound')
|
|
139
|
+
publish_bytes(self.receipt, body)
|
|
140
|
+
|
|
141
|
+
@contextmanager
|
|
142
|
+
def _storage(self, state):
|
|
143
|
+
storage = access.storage_folder(state['sid'])
|
|
144
|
+
_check_storage(storage, self._profile_name(state['installation']))
|
|
145
|
+
with control_directory(storage):
|
|
146
|
+
binding = {'path': str(storage), 'identity': access.identity(storage),
|
|
147
|
+
'profile_folder': access.identity(storage.parent)}
|
|
148
|
+
previous = state['storage']
|
|
149
|
+
if previous is None or ('profile_folder' not in previous and
|
|
150
|
+
previous == {k: binding[k] for k in ('path', 'identity')}):
|
|
151
|
+
state['storage'] = binding # The directory identity first exists after profile creation.
|
|
152
|
+
self._save(state)
|
|
153
|
+
elif state['storage'] != binding:
|
|
154
|
+
raise OSError('decoder profile storage was rebound')
|
|
155
|
+
yield storage, binding['identity']
|
|
156
|
+
|
|
157
|
+
@staticmethod
|
|
158
|
+
def _revoke(tree, record, sid):
|
|
159
|
+
if tree.present(record['tree']):
|
|
160
|
+
access.apply_entry(tree.root, record['tree'], sid, remove=True)
|
|
161
|
+
|
|
162
|
+
def _manifest_path(self, record):
|
|
163
|
+
return self.pool / ('decoder-tree-' + record['enrollment'] + '.json')
|
|
164
|
+
|
|
165
|
+
def program(self, runtime):
|
|
166
|
+
"""Open a published enrollment for a command without repairing or granting access."""
|
|
167
|
+
with self._locked() as state:
|
|
168
|
+
if state is None or state['phase'] != 'active':
|
|
169
|
+
raise OSError('document reader installation is unavailable')
|
|
170
|
+
enrollment, identity, base = _layout(self.home, runtime)
|
|
171
|
+
record = state['runtimes'].get(runtime.name)
|
|
172
|
+
tree = DecoderTree(runtime)
|
|
173
|
+
if (not record or 'retiring' in record or record['enrollment'] != enrollment or record['identity'] != identity
|
|
174
|
+
or record['base'] != str(base.parent) or not tree.present(record['tree'])
|
|
175
|
+
or access.identity(base.parent) != state['bases'][record['base']] or not state['storage']):
|
|
176
|
+
raise OSError('document reader enrollment is unavailable')
|
|
177
|
+
return self._program(base, tree, state, enrollment)
|
|
178
|
+
|
|
179
|
+
def _program(self, base, tree, state, enrollment):
|
|
180
|
+
from daecore.document_extraction.level_probe import ProbeProgram
|
|
181
|
+
|
|
182
|
+
return ProbeProgram(base, tree.entry, (tree.root,), self._profile_name(state['installation']),
|
|
183
|
+
Path(state['storage']['path']), enrollment)
|
|
184
|
+
|
|
185
|
+
def select(self, runtime, *, first=False, full=True):
|
|
186
|
+
"""Return the enrolled reader's launcher after repairing its private copy and access."""
|
|
187
|
+
with self._locked(create=first) as state:
|
|
188
|
+
if state is not None and state['phase'] == 'relocating':
|
|
189
|
+
# The move was interrupted before copying. This home still owns the physical targets.
|
|
190
|
+
self._remove(state)
|
|
191
|
+
state = None
|
|
192
|
+
if state is None and not first:
|
|
193
|
+
return
|
|
194
|
+
from daecore.security.key_material import home_identity
|
|
195
|
+
|
|
196
|
+
if runtime is None:
|
|
197
|
+
runtime = read_runtime_pointer(self.home / 'runtime' / 'current')
|
|
198
|
+
if runtime is None:
|
|
199
|
+
raise OSError('decoder installation has no selected runtime')
|
|
200
|
+
runtime = Path(runtime).absolute()
|
|
201
|
+
enrollment, runtime_id, base_exe = _layout(self.home, runtime)
|
|
202
|
+
base = base_exe.parent
|
|
203
|
+
installation = home_identity(home=self.home)
|
|
204
|
+
if installation is None or (state is not None and state['installation'] != installation):
|
|
205
|
+
raise OSError('decoder installation has no matching Daecore home identity')
|
|
206
|
+
if state is None:
|
|
207
|
+
name = self._profile_name(installation)
|
|
208
|
+
sid = _sid(name)
|
|
209
|
+
if access.profile_exists(name, sid):
|
|
210
|
+
raise OSError('new decoder profile name already exists')
|
|
211
|
+
state = dict(installation=installation, home=str(self.home), sid=sid, phase='active',
|
|
212
|
+
access_mask=access.READ_EXECUTE, storage=None, runtimes={}, bases={})
|
|
213
|
+
if state['phase'] != 'active':
|
|
214
|
+
raise OSError('decoder profile removal is pending')
|
|
215
|
+
before = json.dumps(state, sort_keys=True)
|
|
216
|
+
name, sid = self._profile_name(state['installation']), state['sid']
|
|
217
|
+
prior = state['runtimes'].get(runtime.name)
|
|
218
|
+
if prior and (prior['enrollment'] != enrollment or prior['identity'] != runtime_id
|
|
219
|
+
or prior['base'] != str(base)):
|
|
220
|
+
raise OSError('decoder runtime enrollment was rebound')
|
|
221
|
+
tree = DecoderTree(runtime)
|
|
222
|
+
record = prior or dict(enrollment=enrollment, identity=runtime_id, base=str(base), tree=None)
|
|
223
|
+
tree.present(record['tree'])
|
|
224
|
+
record.pop('retiring', None)
|
|
225
|
+
state['runtimes'][runtime.name] = record
|
|
226
|
+
base_id = access.identity(base)
|
|
227
|
+
if str(base) not in state['bases']:
|
|
228
|
+
access.apply_entry(base, base_id, sid, fresh=True)
|
|
229
|
+
state['bases'][str(base)] = base_id
|
|
230
|
+
elif state['bases'][str(base)] != base_id:
|
|
231
|
+
raise OSError('decoder base interpreter was rebound')
|
|
232
|
+
if before != json.dumps(state, sort_keys=True):
|
|
233
|
+
self._save(state)
|
|
234
|
+
manifest_path = self._manifest_path(record)
|
|
235
|
+
manifest = None
|
|
236
|
+
if prior and not full:
|
|
237
|
+
try:
|
|
238
|
+
manifest = read_control_bytes(manifest_path, max_bytes=_MANIFEST_BYTES)
|
|
239
|
+
except FileNotFoundError:
|
|
240
|
+
pass # Publication stopped before the verified manifest became durable.
|
|
241
|
+
with tree.replacement(runtime_id, record['tree'], manifest=manifest) as staged:
|
|
242
|
+
if staged is not None:
|
|
243
|
+
if tree.present(record['tree']):
|
|
244
|
+
previous = tree.root.rename(staged.parent / 'previous')
|
|
245
|
+
access.apply_entry(previous, record['tree'], sid, remove=True)
|
|
246
|
+
record['tree'] = access.identity(staged)
|
|
247
|
+
# A crash on either side of the rename leaves a missing or identifiable complete copy.
|
|
248
|
+
self._save(state)
|
|
249
|
+
staged.rename(tree.root)
|
|
250
|
+
if staged is not None or manifest is None:
|
|
251
|
+
metadata = tree.manifest()
|
|
252
|
+
if len(metadata) > _MANIFEST_BYTES:
|
|
253
|
+
raise OSError('private decoder manifest exceeds its read bound')
|
|
254
|
+
publish_bytes(manifest_path, metadata)
|
|
255
|
+
if not access.profile_exists(name, sid):
|
|
256
|
+
if state['storage'] is not None:
|
|
257
|
+
previous = Path(state['storage']['path'])
|
|
258
|
+
if previous.parent.exists():
|
|
259
|
+
if access.identity(previous) != state['storage']['identity']:
|
|
260
|
+
raise OSError('unregistered decoder storage belongs to an unknown generation')
|
|
261
|
+
else:
|
|
262
|
+
state['storage'] = None
|
|
263
|
+
self._save(state)
|
|
264
|
+
# The OS can name the storage directory only after creating the profile.
|
|
265
|
+
profiles.create_decoder_profile(name)
|
|
266
|
+
with self._storage(state) as (storage, object_id):
|
|
267
|
+
access.restrict_storage(storage, object_id, sid)
|
|
268
|
+
access.restrict_registry(name, sid)
|
|
269
|
+
access.apply_entry(base, base_id, sid)
|
|
270
|
+
access.apply_entry(tree.root, record['tree'], sid)
|
|
271
|
+
return self._program(base_exe, tree, state, enrollment)
|
|
272
|
+
|
|
273
|
+
def retiring(self, runtime, destination):
|
|
274
|
+
"""Bind the runtime-prune owner's destination before it moves the runtime with its private tree."""
|
|
275
|
+
with self._locked() as state:
|
|
276
|
+
if state is None or runtime.name not in state['runtimes']:
|
|
277
|
+
return
|
|
278
|
+
prior = state['runtimes'][runtime.name]
|
|
279
|
+
if runtime.parent != self.home / 'runtime' or access.identity(runtime) != prior['identity']:
|
|
280
|
+
raise OSError('decoder retirement target changed')
|
|
281
|
+
prior['retiring'] = str(destination)
|
|
282
|
+
self._save(state)
|
|
283
|
+
|
|
284
|
+
def retire(self, runtime, destination):
|
|
285
|
+
"""Finish under the exclusive pin, on either side of a restart after detachment."""
|
|
286
|
+
with self._locked() as state:
|
|
287
|
+
if state is None or runtime.name not in state['runtimes']:
|
|
288
|
+
return
|
|
289
|
+
prior = state['runtimes'][runtime.name]
|
|
290
|
+
if runtime.parent != self.home / 'runtime' or prior.get('retiring') != str(destination):
|
|
291
|
+
raise OSError('decoder retirement lacks its recorded destination')
|
|
292
|
+
self._revoke_runtime(destination, prior, state['sid'])
|
|
293
|
+
self._manifest_path(prior).unlink(missing_ok=True)
|
|
294
|
+
del state['runtimes'][runtime.name]
|
|
295
|
+
if all(item['base'] != prior['base'] for item in state['runtimes'].values()):
|
|
296
|
+
access.apply_entry(Path(prior['base']), state['bases'][prior['base']], state['sid'], remove=True)
|
|
297
|
+
del state['bases'][prior['base']]
|
|
298
|
+
self._save(state)
|
|
299
|
+
|
|
300
|
+
def _revoke_runtime(self, path, record, sid):
|
|
301
|
+
with control_directory(path):
|
|
302
|
+
if access.identity(path) != record['identity']:
|
|
303
|
+
raise OSError('decoder removal target was rebound')
|
|
304
|
+
self._revoke(DecoderTree(path), record, sid)
|
|
305
|
+
|
|
306
|
+
def uninstall(self, *, relocating=False):
|
|
307
|
+
"""Revoke access while the control receipt still exists, even when runtime deletion is deferred."""
|
|
308
|
+
with self._locked() as state:
|
|
309
|
+
if state is None:
|
|
310
|
+
return
|
|
311
|
+
if relocating and state['phase'] == 'removing':
|
|
312
|
+
raise OSError('decoder profile removal is pending')
|
|
313
|
+
if state['phase'] == 'active':
|
|
314
|
+
state['phase'] = 'relocating' if relocating else 'removing'
|
|
315
|
+
self._save(state)
|
|
316
|
+
self._remove(state)
|
|
317
|
+
|
|
318
|
+
def _remove(self, state):
|
|
319
|
+
from daecore.tree_copy import remove_control_tree
|
|
320
|
+
|
|
321
|
+
for name, record in state['runtimes'].items():
|
|
322
|
+
runtime = self.home / 'runtime' / name
|
|
323
|
+
if 'retiring' in record:
|
|
324
|
+
destination = Path(record['retiring'])
|
|
325
|
+
try:
|
|
326
|
+
destination.lstat()
|
|
327
|
+
except FileNotFoundError:
|
|
328
|
+
pass # The runtime-prune rename never happened.
|
|
329
|
+
else:
|
|
330
|
+
runtime = destination
|
|
331
|
+
self._revoke_runtime(runtime, record, state['sid'])
|
|
332
|
+
if state['phase'] == 'relocating' and runtime.parent == self.home / 'runtime':
|
|
333
|
+
# Copies get different file identities. The selected home will build and measure its own tree.
|
|
334
|
+
tree = DecoderTree(runtime)
|
|
335
|
+
with control_directory(runtime):
|
|
336
|
+
if tree.present(record['tree']):
|
|
337
|
+
remove_control_tree(tree.root)
|
|
338
|
+
from daecore.document_extraction.level import RuntimeLevel
|
|
339
|
+
|
|
340
|
+
RuntimeLevel(self.home, runtime).discard()
|
|
341
|
+
self._manifest_path(record).unlink(missing_ok=True)
|
|
342
|
+
for base, identity in state['bases'].items():
|
|
343
|
+
access.apply_entry(Path(base), identity, state['sid'], remove=True)
|
|
344
|
+
name, sid = self._profile_name(state['installation']), state['sid']
|
|
345
|
+
if access.profile_exists(name, sid):
|
|
346
|
+
try:
|
|
347
|
+
with self._storage(state):
|
|
348
|
+
pass # Release directory handles before Windows deletes the profile.
|
|
349
|
+
except FileNotFoundError:
|
|
350
|
+
if not state['storage'] or not state['storage'].get('profile_folder'):
|
|
351
|
+
raise
|
|
352
|
+
folder = Path(state['storage']['path']).parent
|
|
353
|
+
if folder.exists() and access.identity(folder) != state['storage']['profile_folder']:
|
|
354
|
+
raise OSError('decoder profile folder was rebound') from None
|
|
355
|
+
profiles.delete_decoder_profile(name)
|
|
356
|
+
if access.profile_exists(name, sid):
|
|
357
|
+
raise OSError('decoder profile removal is incomplete')
|
|
358
|
+
if state['storage'] is not None:
|
|
359
|
+
folder = Path(state['storage']['path']).parent
|
|
360
|
+
try:
|
|
361
|
+
folder.lstat()
|
|
362
|
+
except FileNotFoundError:
|
|
363
|
+
pass
|
|
364
|
+
else:
|
|
365
|
+
with control_directory(folder.parent):
|
|
366
|
+
if access.identity(folder) != state['storage'].get('profile_folder'):
|
|
367
|
+
raise OSError('unregistered decoder profile folder was rebound')
|
|
368
|
+
remove_control_tree(folder)
|
|
369
|
+
self.receipt.unlink()
|
daecore/decoder_tree.py
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""The Windows decoder's private copy of its program and reader packages."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import hashlib
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import stat
|
|
8
|
+
from contextlib import contextmanager
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from daecore.document_formats import READER_PACKAGES
|
|
12
|
+
from daecore.file_read import open_checked_regular
|
|
13
|
+
from daecore.operation_files import WorkArea
|
|
14
|
+
from daecore.private_files import control_directory, create_private_directory
|
|
15
|
+
|
|
16
|
+
# Supporting modules in the reader closure. Python's own modules come from the versioned base.
|
|
17
|
+
_SUPPORT = {'PIL', 'linkify_it', 'markdown_it', 'mdurl', 'yaml'}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _contents(path, output=None):
|
|
21
|
+
"""Hash the opened source bytes, optionally writing them to a newly created file."""
|
|
22
|
+
digest = hashlib.sha256()
|
|
23
|
+
# The inventory holds this file's physical parent chain. An installed input may have other NTFS names.
|
|
24
|
+
with open_checked_regular(path) as fd:
|
|
25
|
+
remaining = os.fstat(fd).st_size
|
|
26
|
+
while remaining:
|
|
27
|
+
part = os.read(fd, min(remaining, 1024 * 1024))
|
|
28
|
+
if not part:
|
|
29
|
+
raise OSError(f'decoder file changed during read: {path}')
|
|
30
|
+
digest.update(part)
|
|
31
|
+
if output is not None:
|
|
32
|
+
output.write(part)
|
|
33
|
+
remaining -= len(part)
|
|
34
|
+
return digest.digest()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _inventory(root, *, source, copy_to=None, metadata=False):
|
|
38
|
+
"""Directory names and file hashes. Only installed source files may share an NTFS object."""
|
|
39
|
+
inventory = {}
|
|
40
|
+
required = {'daecore'} | {name for packages in READER_PACKAGES.values()
|
|
41
|
+
for roots in packages.values() for name in roots}
|
|
42
|
+
|
|
43
|
+
def visit(path):
|
|
44
|
+
relative = path.relative_to(root)
|
|
45
|
+
info = path.lstat()
|
|
46
|
+
if getattr(info, 'st_file_attributes', 0) & stat.FILE_ATTRIBUTE_REPARSE_POINT:
|
|
47
|
+
raise OSError(f'linked decoder path: {path}')
|
|
48
|
+
if stat.S_ISDIR(info.st_mode):
|
|
49
|
+
inventory[relative] = (info.st_dev, info.st_ino, info.st_mtime_ns, None) if metadata else None
|
|
50
|
+
if copy_to is not None:
|
|
51
|
+
(copy_to / relative).mkdir()
|
|
52
|
+
with control_directory(path):
|
|
53
|
+
for child in path.iterdir():
|
|
54
|
+
if source and (child.name == '__pycache__' or child.suffix == '.pyc'):
|
|
55
|
+
continue
|
|
56
|
+
visit(child)
|
|
57
|
+
elif stat.S_ISREG(info.st_mode) and (source or info.st_nlink == 1):
|
|
58
|
+
if metadata:
|
|
59
|
+
inventory[relative] = (info.st_dev, info.st_ino, info.st_mtime_ns, info.st_size)
|
|
60
|
+
elif copy_to is None:
|
|
61
|
+
inventory[relative] = _contents(path)
|
|
62
|
+
else:
|
|
63
|
+
# Descendants inherit from the private root, including its later reader grant.
|
|
64
|
+
with (copy_to / relative).open('xb') as output:
|
|
65
|
+
inventory[relative] = _contents(path, output)
|
|
66
|
+
else:
|
|
67
|
+
raise OSError(f'linked or irregular decoder file: {path}')
|
|
68
|
+
|
|
69
|
+
with control_directory(root):
|
|
70
|
+
for path in root.iterdir():
|
|
71
|
+
if source:
|
|
72
|
+
directory = path.name in required or path.name in _SUPPORT
|
|
73
|
+
module = path.name == 'typing_extensions.py'
|
|
74
|
+
if not directory and not module:
|
|
75
|
+
continue
|
|
76
|
+
if directory != path.is_dir():
|
|
77
|
+
raise OSError(f'unexpected reader package layout: {path}')
|
|
78
|
+
visit(path)
|
|
79
|
+
if source and (not all(Path(name) in inventory for name in required)
|
|
80
|
+
or inventory.get(DecoderTree.ENTRY) is None):
|
|
81
|
+
raise OSError('decoder entry or required reader package is missing')
|
|
82
|
+
return inventory
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class DecoderTree:
|
|
86
|
+
ENTRY = Path('daecore/document_extraction/entry.py')
|
|
87
|
+
|
|
88
|
+
def __init__(self, runtime):
|
|
89
|
+
self.runtime = runtime
|
|
90
|
+
self.root = runtime / 'decoder'
|
|
91
|
+
self.entry = self.root / self.ENTRY
|
|
92
|
+
|
|
93
|
+
def present(self, expected):
|
|
94
|
+
"""A missing copy is repairable. An unknown object at this name is never ours to replace."""
|
|
95
|
+
try:
|
|
96
|
+
info = self.root.lstat()
|
|
97
|
+
except FileNotFoundError:
|
|
98
|
+
return False
|
|
99
|
+
if (not stat.S_ISDIR(info.st_mode) or getattr(info, 'st_file_attributes', 0) & stat.FILE_ATTRIBUTE_REPARSE_POINT
|
|
100
|
+
or [info.st_dev, info.st_ino] != expected):
|
|
101
|
+
raise OSError(f'decoder tree was rebound or not enrolled: {self.root}')
|
|
102
|
+
return True
|
|
103
|
+
|
|
104
|
+
@contextmanager
|
|
105
|
+
def work(self):
|
|
106
|
+
area = WorkArea.for_publication(self.runtime.parent.parent, self.root)
|
|
107
|
+
with area.allocate('decoder-tree', reason='private reader copy publication') as group:
|
|
108
|
+
group.payload.mkdir()
|
|
109
|
+
yield group.payload
|
|
110
|
+
|
|
111
|
+
@contextmanager
|
|
112
|
+
def replacement(self, runtime_id, expected, *, manifest=None):
|
|
113
|
+
"""Yield a fully verified same-volume replacement, or None if the enrolled copy is current."""
|
|
114
|
+
site = self.runtime / 'Lib' / 'site-packages'
|
|
115
|
+
with control_directory(self.runtime):
|
|
116
|
+
info = self.runtime.lstat()
|
|
117
|
+
if [info.st_dev, info.st_ino] != runtime_id:
|
|
118
|
+
raise OSError('decoder runtime was rebound during private copy')
|
|
119
|
+
if self.present(expected):
|
|
120
|
+
current = (self.manifest() == manifest if manifest is not None else
|
|
121
|
+
_inventory(self.root, source=False) == _inventory(site, source=True))
|
|
122
|
+
if current:
|
|
123
|
+
yield None
|
|
124
|
+
return
|
|
125
|
+
with self.work() as payload:
|
|
126
|
+
staged = payload / 'new'
|
|
127
|
+
create_private_directory(staged)
|
|
128
|
+
source = _inventory(site, source=True, copy_to=staged)
|
|
129
|
+
if _inventory(staged, source=False) != source:
|
|
130
|
+
raise OSError('private decoder copy differs from the installed reader')
|
|
131
|
+
yield staged
|
|
132
|
+
|
|
133
|
+
def manifest(self):
|
|
134
|
+
"""Metadata for every private directory and file, bound to the root that was published."""
|
|
135
|
+
entries = _inventory(self.root, source=False, metadata=True)
|
|
136
|
+
info = self.root.lstat()
|
|
137
|
+
entries = {key.as_posix(): value for key, value in entries.items()}
|
|
138
|
+
return json.dumps(([info.st_dev, info.st_ino], entries), sort_keys=True, separators=(',', ':')).encode()
|
daecore/digests.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""What a SHA-256 digest looks like wherever one is stored or passed as text."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import re
|
|
5
|
+
|
|
6
|
+
_SHA256 = re.compile(r'[0-9a-f]{64}')
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def is_sha256(value: object) -> bool:
|
|
10
|
+
"""Whether a value is exactly 64 lowercase hexadecimal characters."""
|
|
11
|
+
return isinstance(value, str) and _SHA256.fullmatch(value) is not None
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
__all__ = ['is_sha256']
|
daecore/disk_capacity.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"""Disk observations and comparisons shared by operation-specific admission.
|
|
2
|
+
|
|
3
|
+
Callers own paths, peak-byte formulas, safety margins, and what to do when
|
|
4
|
+
capacity is unknown. These helpers neither create paths nor reclaim space.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import shutil
|
|
9
|
+
from collections.abc import Iterable, Iterator
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def free_bytes(path: str | Path) -> int:
|
|
15
|
+
"""Observe the given path's volume; preserve OS errors for the caller."""
|
|
16
|
+
return shutil.disk_usage(path).free
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def logical_file_bytes(paths: Iterable[Path]) -> int:
|
|
20
|
+
"""Count copy demand, including hardlinked names; only absent files are zero."""
|
|
21
|
+
total = 0
|
|
22
|
+
for path in paths:
|
|
23
|
+
try:
|
|
24
|
+
total += path.stat().st_size
|
|
25
|
+
except FileNotFoundError:
|
|
26
|
+
continue
|
|
27
|
+
return total
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def capacity_sufficient(required_bytes: int, available_bytes: int | None, *, complete: bool = True) -> bool | None:
|
|
31
|
+
"""A lower bound can prove a shortfall, but only a complete bound can fit."""
|
|
32
|
+
if available_bytes is None:
|
|
33
|
+
return None
|
|
34
|
+
if available_bytes < required_bytes:
|
|
35
|
+
return False
|
|
36
|
+
return True if complete else None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass(frozen=True, slots=True)
|
|
40
|
+
class VolumeCapacity:
|
|
41
|
+
path: Path
|
|
42
|
+
required_bytes: int
|
|
43
|
+
free_bytes: int
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class CapacityProbeError(Exception):
|
|
47
|
+
"""The exact target and OS failure, for operation-specific diagnostics."""
|
|
48
|
+
|
|
49
|
+
def __init__(self, path: Path, cause: OSError) -> None:
|
|
50
|
+
super().__init__(str(cause))
|
|
51
|
+
self.path = path
|
|
52
|
+
self.cause = cause
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True, slots=True)
|
|
56
|
+
class CapacityAssessment:
|
|
57
|
+
"""Observed additional demand; incomplete evidence never establishes a fit."""
|
|
58
|
+
|
|
59
|
+
volumes: tuple[VolumeCapacity, ...]
|
|
60
|
+
complete: bool = True
|
|
61
|
+
error: CapacityProbeError | None = None
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def shortfall(self) -> VolumeCapacity | None:
|
|
65
|
+
return next((item for item in self.volumes
|
|
66
|
+
if capacity_sufficient(item.required_bytes, item.free_bytes) is False), None)
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def sufficient(self) -> bool | None:
|
|
70
|
+
if self.shortfall is not None:
|
|
71
|
+
return False
|
|
72
|
+
return True if self.complete and self.error is None else None
|
|
73
|
+
|
|
74
|
+
def to_dict(self) -> dict:
|
|
75
|
+
return {
|
|
76
|
+
'requirements_complete': self.complete,
|
|
77
|
+
'sufficient': self.sufficient,
|
|
78
|
+
'volumes': [{'path': str(item.path), 'additional_required_bytes': item.required_bytes,
|
|
79
|
+
'free_bytes': item.free_bytes} for item in self.volumes],
|
|
80
|
+
'error': ({'path': str(self.error.path), 'reason': str(self.error.cause)}
|
|
81
|
+
if self.error is not None else None),
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def assess_capacity(requirements: Iterable[tuple[Path, int]], *, complete: bool = True,
|
|
86
|
+
other_phases: Iterable[Iterable[tuple[Path, int]]] = (),
|
|
87
|
+
margin_bytes: int = 0) -> CapacityAssessment:
|
|
88
|
+
"""Observe all affected volumes, retaining any partial evidence on failure."""
|
|
89
|
+
volumes = []
|
|
90
|
+
try:
|
|
91
|
+
volumes.extend(volume_capacities(requirements, other_phases=other_phases, margin_bytes=margin_bytes))
|
|
92
|
+
except CapacityProbeError as exc:
|
|
93
|
+
return CapacityAssessment(tuple(volumes), complete=complete, error=exc)
|
|
94
|
+
return CapacityAssessment(tuple(volumes), complete=complete)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def volume_capacities(requirements: Iterable[tuple[Path, int]], *,
|
|
98
|
+
other_phases: Iterable[Iterable[tuple[Path, int]]] = (),
|
|
99
|
+
margin_bytes: int = 0) -> Iterator[VolumeCapacity]:
|
|
100
|
+
"""Group requirements by volume, then observe free bytes one volume at a time.
|
|
101
|
+
|
|
102
|
+
Every target must exist and identify its volume before any free-space
|
|
103
|
+
probe. Keep first-volume order and the last target as its representative.
|
|
104
|
+
Lazy free-space probes let a caller refuse a shortfall before observing
|
|
105
|
+
later volumes. No observation reserves disk space against other writers.
|
|
106
|
+
"""
|
|
107
|
+
by_device: dict[int, tuple[Path, int]] = {}
|
|
108
|
+
devices = {}
|
|
109
|
+
for phase in (requirements, *other_phases):
|
|
110
|
+
totals = {}
|
|
111
|
+
for path, required_bytes in phase:
|
|
112
|
+
if path not in devices:
|
|
113
|
+
try:
|
|
114
|
+
devices[path] = path.stat().st_dev
|
|
115
|
+
except OSError as exc:
|
|
116
|
+
raise CapacityProbeError(path, exc) from exc
|
|
117
|
+
device = devices[path]
|
|
118
|
+
totals[device] = totals.get(device, 0) + required_bytes
|
|
119
|
+
by_device[device] = (path, by_device.get(device, (path, 0))[1])
|
|
120
|
+
for device, total in totals.items():
|
|
121
|
+
path, peak = by_device[device]
|
|
122
|
+
by_device[device] = (path, max(peak, total))
|
|
123
|
+
for path, required_bytes in by_device.values():
|
|
124
|
+
try:
|
|
125
|
+
available_bytes = free_bytes(path)
|
|
126
|
+
except OSError as exc:
|
|
127
|
+
raise CapacityProbeError(path, exc) from exc
|
|
128
|
+
yield VolumeCapacity(path, required_bytes + margin_bytes, available_bytes)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Full installation diagnosis and its human and machine interfaces."""
|