brainlayer 1.5.90__tar.gz → 1.5.91__tar.gz
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.
- {brainlayer-1.5.90 → brainlayer-1.5.91}/PKG-INFO +1 -1
- {brainlayer-1.5.90 → brainlayer-1.5.91}/pyproject.toml +1 -1
- {brainlayer-1.5.90 → brainlayer-1.5.91}/server.json +2 -2
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/__init__.py +1 -1
- brainlayer-1.5.91/src/brainlayer/_build.py +1 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/backup_daily.py +189 -28
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/cli/__init__.py +67 -4
- brainlayer-1.5.91/src/brainlayer/content_hash_repair.py +152 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/dedupe.py +18 -1
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/drive_credentials.py +16 -1
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/health_check.py +8 -5
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/health_facts.py +14 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/ingest/codex.py +10 -6
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/jobs.py +36 -11
- brainlayer-1.5.91/src/brainlayer/lexical_defense.py +284 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/maintenance.py +102 -41
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/maintenance_calendar.py +39 -4
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/maintenance_control.py +3 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/mcp/search_handler.py +2 -2
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/observability_backup.py +33 -1
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/classify.py +29 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/runtime_store.py +45 -0
- brainlayer-1.5.91/src/brainlayer/schema_ddl_ledger.py +326 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/scrub_at_rest.py +58 -0
- brainlayer-1.5.91/src/brainlayer/search_response.py +70 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/vector_store.py +67 -11
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/watcher_bridge.py +22 -1
- brainlayer-1.5.90/src/brainlayer/_build.py +0 -1
- brainlayer-1.5.90/src/brainlayer/lexical_defense.py +0 -134
- {brainlayer-1.5.90 → brainlayer-1.5.91}/.gitignore +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/LICENSE +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/README.md +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/hotlane_brainbar_daemon.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/backup-daily.sh +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/brainlayer-env-run.sh +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/brainlayer.env.example +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.backup-daily.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.daemon.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.decay.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.drain.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.health-check.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.hotlane-brainbar.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.index.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.jsonl-backup.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.log-cap.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.maintenance-nightly.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.maintenance-weekly.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.maintenance.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.observability.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.p0-counter.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.repair-fts.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.t3-ingest.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.throughput-watchdog.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.tier0-watchdog.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.wal-checkpoint.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.brainlayer.watch.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/com.etanhey.brainlayer-fleet-watchdog.plist +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/fleet-watchdog.sh +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/install.sh +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/jsonl-backup.sh +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/launchd/throughput-watchdog.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/release-verify-signatures.sh +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/scripts/tier0-watchdog.sh +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/__main__.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/_helpers.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/agent_profiles.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/agent_provenance.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/alarm.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/archive_collapse.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/archive_lifecycle.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/backup_retention_invariant.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/badge_state.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/bitemporal.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/brainbar_activation.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/brainbar_auto_activation.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/brainbar_hybrid_helper.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/brainbar_identity.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/cachedelete_purge.swift +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/calibrate.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/chunk_origin.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/chunk_origin_backfill.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/chunk_origin_wipe.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/chunk_write.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/classify.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/claude_paths.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/cli/wizard.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/cli_jobs.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/cli_new.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/cloud_backfill.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/clustering.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/component_jobs.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/config.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/consolidation_plan.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/content_class.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/correction_judge.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/data/agents_registry.yaml +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/data/sandbox_seeds/skill-eval-baseline.json +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/db_shrink.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/decay.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/decay_backfill.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/decay_job.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/dedupe_merge.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/deploy_drift.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/disk_space.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/doctor.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/drain.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/drain_liveness.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/embeddings.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/engine.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/enrichment_replay.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/__init__.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/abcde_enrich_runner.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/abcde_variants.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/abcde_variants.yaml +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/benchmark.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/enrichment_gold.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/enrichment_graders.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/enrichment_judge.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/enrichment_llm_judge.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/enrichment_quality_benchmark.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/experiment_store.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/fixtures/README.md +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/labeling/enrichment-labeler.html +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/phoenix_gate/__init__.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/phoenix_gate/__main__.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/phoenix_gate/baseline_store.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/phoenix_gate/cli.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/phoenix_gate/models.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/phoenix_gate/phoenix_client.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/phoenix_gate/regression_gate.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/phoenix_gate/triggers.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/eval/pilot_artifact_report.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/fallback_replay.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/git_learning.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/health_verdict.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/hook_python.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/hooks/__init__.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/hooks/indexer.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/hotlane_budget.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/import_sweep.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/index_admission.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/index_budget.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/index_completeness.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/index_new.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/index_watchdog.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/ingest/__init__.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/ingest/t3.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/ingest_denylist.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/ingest_guard.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/isolation_proof.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/job_alerts.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/job_lifecycle_health.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/jsonl_backup.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/kg/__init__.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/kg_cleanup.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/kg_judge.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/kg_promotion.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/kg_repo.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/kg_review_session.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/kg_session_finish.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/kg_session_harvest.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/launchd_consolidation.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/launchd_install.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/launchd_primitive.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/launchd_revert.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/launcher_policy_reconcile.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/lexical_defense_dictionary.json +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/linkedin_import.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/log_cap.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/mcp/__init__.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/mcp/_format.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/mcp/_shared.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/mcp/enrich_handler.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/mcp/entity_handler.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/mcp/palette.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/mcp/store_handler.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/mcp/tags_handler.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/mcp_socket_config.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/mcp_stdio_bridge.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/memory_types.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/migrate.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/migration_custody.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/migration_journal.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/migration_runtime.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/notification_policy.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/observability_surface.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/observability_transport.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/p0_longitudinal_count.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/parent_death.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/paths.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pause.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/phonetic.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/__init__.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/agent_enrichment.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/analyze_communication.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/batch_extraction.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/brain_graph.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/chat_tags.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/chunk.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/cloud_scrub.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/cluster_sampling.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/code_intelligence.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/correction_detection.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/correction_mining.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/digest.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/enrichment_prompts.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/enrichment_results.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/enrichment_tiers.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/entity_extraction.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/entity_resolution.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/extract.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/extract_claude_desktop.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/extract_corrections.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/extract_markdown.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/extract_whatsapp.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/frustration_mining.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/git_overlay.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/kg_extraction.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/kg_extraction_groq.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/longitudinal_analyzer.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/obsidian_export.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/operation_grouping.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/plan_linking.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/rate_limiter.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/relation_backfill.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/relation_verification.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/sanitize.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/secret_scrub.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/semantic_style.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/sentiment.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/session_history.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/style_embed.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/style_index.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/tag_entity_promotion.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/temporal_chains.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/time_batcher.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/unified_timeline.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/pipeline/write_queue.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/policy_reconcile.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/provenance.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/provenance_autosupersede.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/provenance_integration.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/queue_io.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/queue_merge.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/readonly_snapshot.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/reembed_backfill.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/retired_services.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/sandbox_db.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/scoping.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/search_fanout.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/search_profile.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/search_repo.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/service_supervisor.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/session_repo.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/setup.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/socket_hygiene.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/source_class_migration.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/spotlight.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/storage.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/store.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/supervisor_adapters.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/supervisor_child.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/supervisor_diagnostics.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/supervisor_guard.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/supervisor_jobs.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/system_prompt_guard.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/t3_linkage_alarm.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/t3_provenance.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/t3_sources.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/tag_normalization.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/taxonomy.json +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/telemetry.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/timestamp_iso.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/types.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/wal_checkpoint.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/watcher.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/writer_policy.py +0 -0
- {brainlayer-1.5.90 → brainlayer-1.5.91}/src/brainlayer/writer_telemetry.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: brainlayer
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.91
|
|
4
4
|
Summary: Persistent local memory for AI agents — 16 BrainBar MCP tools, semantic search, knowledge graph, SQLite
|
|
5
5
|
Project-URL: Homepage, https://brainlayer.etanheyman.com
|
|
6
6
|
Project-URL: Repository, https://github.com/EtanHey/brainlayer
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "io.github.etanhey/brainlayer",
|
|
4
4
|
"title": "BrainLayer",
|
|
5
5
|
"description": "Persistent local memory for AI agents \u2014 semantic search, knowledge graph, and 16 BrainBar MCP tools with ToolAnnotations over SQLite.",
|
|
6
|
-
"version": "1.5.
|
|
6
|
+
"version": "1.5.91",
|
|
7
7
|
"websiteUrl": "https://brainlayer.etanheyman.com",
|
|
8
8
|
"repository": {
|
|
9
9
|
"url": "https://github.com/EtanHey/brainlayer",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"registryType": "pypi",
|
|
15
15
|
"registryBaseUrl": "https://pypi.org",
|
|
16
16
|
"identifier": "brainlayer",
|
|
17
|
-
"version": "1.5.
|
|
17
|
+
"version": "1.5.91",
|
|
18
18
|
"runtimeHint": "pipx",
|
|
19
19
|
"transport": {
|
|
20
20
|
"type": "stdio"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
__version__ = "1.5.
|
|
5
|
+
__version__ = "1.5.91"
|
|
6
6
|
# Git sha the distributed package was built from; stamped by the release build, None in a source tree.
|
|
7
7
|
# scripts/sprint_gate.py reads it in "keg" mode to prove the served package is the code under test.
|
|
8
8
|
# No runtime `str | None` annotation: launchd/install.sh imports this under /usr/bin/python3 (3.9).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
BUILD_SHA = "abd3ecb5b2de3b3de7d1cc60fc19f22ee99b796e"
|
|
@@ -92,6 +92,13 @@ DEFAULT_SNAPSHOT_TIMEOUT_SECONDS = SNAPSHOT_TIMEOUT_CEILING_SECONDS
|
|
|
92
92
|
# The calendar kills at its budget; the backup's own deadline must fire this much earlier so its
|
|
93
93
|
# supervisor (SIGALRM, 10 s grace, SIGKILL) can still write the BackupTimeoutError receipt.
|
|
94
94
|
SNAPSHOT_RECEIPT_RESERVE_SECONDS = 60
|
|
95
|
+
# The supervisor's SIGALRM -> SIGKILL grace, and the slice of the reserve kept for the receipt itself.
|
|
96
|
+
SUPERVISOR_ALARM_GRACE_SECONDS = 10
|
|
97
|
+
SUPERVISOR_RECEIPT_WRITE_SECONDS = 5
|
|
98
|
+
# One elapsed deadline (#1422): the calendar's kill instant on the system-wide monotonic clock,
|
|
99
|
+
# taken before the spawn, so wrapper/Python startup and child creation are charged against it.
|
|
100
|
+
BACKUP_CALENDAR_DEADLINE_ENV = "BRAINLAYER_BACKUP_CALENDAR_DEADLINE_MONOTONIC"
|
|
101
|
+
BACKUP_DEFERRED_EXIT_CODE = 75
|
|
95
102
|
BACKUP_LOCAL_MAX_AGE_HOURS_ENV = "BRAINLAYER_BACKUP_LOCAL_MAX_AGE_HOURS"
|
|
96
103
|
BACKUP_REUSE_VERIFIED_MAX_AGE_HOURS_ENV = "BRAINLAYER_BACKUP_REUSE_VERIFIED_MAX_AGE_HOURS"
|
|
97
104
|
BACKUP_SUPERVISED_CHILD_ENV = "BRAINLAYER_BACKUP_SUPERVISED_CHILD"
|
|
@@ -413,6 +420,11 @@ class BrainBarSnapshotBusyError(RuntimeError):
|
|
|
413
420
|
|
|
414
421
|
# BrainBarServer.handleBackupToolCallAsync sends this before admission; the running writer continues.
|
|
415
422
|
BRAINBAR_SNAPSHOT_BUSY_MESSAGE = "A BrainBar backup snapshot is already in progress."
|
|
423
|
+
# #1413 structured busy contract: the rejection's JSON-RPC `error.data` carries this code. An
|
|
424
|
+
# intermediary that re-wraps it as a tool result may carry it in the result, structuredContent
|
|
425
|
+
# or _meta; older BrainBars send only the message, which stays recognised (legacy).
|
|
426
|
+
BRAINBAR_ERROR_CODE_KEY = "brainlayer_error_code"
|
|
427
|
+
BRAINBAR_SNAPSHOT_BUSY_CODE = "backup_snapshot_busy"
|
|
416
428
|
|
|
417
429
|
|
|
418
430
|
class BrainBarDatabaseIdentityError(RuntimeError):
|
|
@@ -447,8 +459,35 @@ def _same_database_file(a: str | os.PathLike[str], b: str | os.PathLike[str]) ->
|
|
|
447
459
|
|
|
448
460
|
|
|
449
461
|
def _is_brainbar_snapshot_busy(response: dict[str, Any]) -> bool:
|
|
462
|
+
"""Recognise a pre-admission busy rejection in every shape it reaches us (#1413).
|
|
463
|
+
|
|
464
|
+
Over-matching only preserves attempts and their reservations; under-matching treats the
|
|
465
|
+
rejection as terminal and unlinks a target BrainBar is still writing. So a structured code
|
|
466
|
+
anywhere, or the busy text in a JSON-RPC error or an isError tool result, counts as busy.
|
|
467
|
+
"""
|
|
468
|
+
if not isinstance(response, dict):
|
|
469
|
+
return False
|
|
450
470
|
error = response.get("error")
|
|
451
|
-
|
|
471
|
+
if isinstance(error, dict):
|
|
472
|
+
data = error.get("data")
|
|
473
|
+
if isinstance(data, dict) and data.get(BRAINBAR_ERROR_CODE_KEY) == BRAINBAR_SNAPSHOT_BUSY_CODE:
|
|
474
|
+
return True
|
|
475
|
+
message = error.get("message")
|
|
476
|
+
if isinstance(message, str) and BRAINBAR_SNAPSHOT_BUSY_MESSAGE in message:
|
|
477
|
+
return True
|
|
478
|
+
result = response.get("result")
|
|
479
|
+
if not isinstance(result, dict):
|
|
480
|
+
return False
|
|
481
|
+
for carrier in (result, result.get("structuredContent"), result.get("_meta")):
|
|
482
|
+
if isinstance(carrier, dict) and carrier.get(BRAINBAR_ERROR_CODE_KEY) == BRAINBAR_SNAPSHOT_BUSY_CODE:
|
|
483
|
+
return True
|
|
484
|
+
content = result.get("content")
|
|
485
|
+
if result.get("isError") and isinstance(content, list):
|
|
486
|
+
for item in content:
|
|
487
|
+
text = item.get("text") if isinstance(item, dict) else None
|
|
488
|
+
if isinstance(text, str) and BRAINBAR_SNAPSHOT_BUSY_MESSAGE in text:
|
|
489
|
+
return True
|
|
490
|
+
return False
|
|
452
491
|
|
|
453
492
|
|
|
454
493
|
class BackupStoppedError(BaseException):
|
|
@@ -782,14 +821,31 @@ def _sweep_stale_backup_attempts(
|
|
|
782
821
|
max_age_seconds: int | None = None,
|
|
783
822
|
now: float | None = None,
|
|
784
823
|
writer_started_at: float | None = None,
|
|
824
|
+
writer_snapshot_idle: Callable[[], bool] | None = None,
|
|
785
825
|
) -> tuple[list[str], list[Path]]:
|
|
786
|
-
"""Remove old, daemon-confirmed attempts while preserving unproven or recent entries.
|
|
826
|
+
"""Remove old, daemon-confirmed attempts while preserving unproven or recent entries.
|
|
827
|
+
|
|
828
|
+
An aged unmarked attempt is reclaimed when a later writer epoch began after it, or when
|
|
829
|
+
BrainBar positively reports, in the current epoch, that no snapshot is admitted
|
|
830
|
+
(writer_snapshot_idle, asked at most once and only when such an attempt exists, after its
|
|
831
|
+
stat: an aged file cannot be a newly admitted target). Age alone never proves the writer
|
|
832
|
+
stopped (#1413).
|
|
833
|
+
"""
|
|
787
834
|
output_dir = Path(output_dir)
|
|
788
835
|
cutoff = (time.time() if now is None else now) - (
|
|
789
836
|
_configured_backup_attempt_max_age_seconds() if max_age_seconds is None else max_age_seconds
|
|
790
837
|
)
|
|
791
838
|
deleted: list[str] = []
|
|
792
839
|
surviving: list[Path] = []
|
|
840
|
+
idle_answer: list[bool] = []
|
|
841
|
+
|
|
842
|
+
def proven_idle() -> bool:
|
|
843
|
+
if writer_snapshot_idle is None:
|
|
844
|
+
return False
|
|
845
|
+
if not idle_answer:
|
|
846
|
+
idle_answer.append(writer_snapshot_idle() is True)
|
|
847
|
+
return idle_answer[0]
|
|
848
|
+
|
|
793
849
|
for path in sorted(output_dir.glob(".*.db.attempt-*")):
|
|
794
850
|
try:
|
|
795
851
|
if path.name.endswith(".complete"):
|
|
@@ -800,9 +856,19 @@ def _sweep_stale_backup_attempts(
|
|
|
800
856
|
path_mtime = path.stat().st_mtime
|
|
801
857
|
completion_marker = _backup_attempt_completion_marker(path)
|
|
802
858
|
if completion_marker.is_symlink() or not completion_marker.is_file():
|
|
803
|
-
if
|
|
859
|
+
if (
|
|
860
|
+
path_mtime <= cutoff
|
|
861
|
+
and writer_started_at is not None
|
|
862
|
+
and (path_mtime < writer_started_at or proven_idle())
|
|
863
|
+
):
|
|
804
864
|
path.unlink()
|
|
805
865
|
deleted.append(path.name)
|
|
866
|
+
if path_mtime >= writer_started_at:
|
|
867
|
+
print(
|
|
868
|
+
f"Backup reclaimed aged unmarked attempt {path.name}: BrainBar reports no snapshot "
|
|
869
|
+
f"in progress in writer epoch {writer_started_at}",
|
|
870
|
+
flush=True,
|
|
871
|
+
)
|
|
806
872
|
else:
|
|
807
873
|
surviving.append(path)
|
|
808
874
|
continue
|
|
@@ -965,7 +1031,7 @@ def _backup_attempt_completion_marker(attempt_path: Path) -> Path:
|
|
|
965
1031
|
return attempt_path.with_name(f"{attempt_path.name}.complete")
|
|
966
1032
|
|
|
967
1033
|
|
|
968
|
-
def
|
|
1034
|
+
def _brainbar_initialize_server_info(socket_path: Path | str | None = None) -> dict[str, Any]:
|
|
969
1035
|
request = {
|
|
970
1036
|
"jsonrpc": "2.0",
|
|
971
1037
|
"id": "backup-writer-status",
|
|
@@ -979,12 +1045,37 @@ def _brainbar_writer_started_at(socket_path: Path | str | None = None) -> float:
|
|
|
979
1045
|
response = _send_brainbar_json_request(_brainbar_socket_path(socket_path), request, timeout_seconds=5)
|
|
980
1046
|
result = response.get("result")
|
|
981
1047
|
server_info = result.get("serverInfo") if isinstance(result, dict) else None
|
|
982
|
-
|
|
983
|
-
|
|
1048
|
+
return server_info if isinstance(server_info, dict) else {}
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
def _brainbar_writer_started_at(socket_path: Path | str | None = None) -> float:
|
|
1052
|
+
started_at = _brainbar_initialize_server_info(socket_path).get("backupWriterStartedAtUnix")
|
|
1053
|
+
if isinstance(started_at, bool) or not isinstance(started_at, (int, float)) or started_at <= 0:
|
|
984
1054
|
raise RuntimeError("BrainBar initialize response missing backupWriterStartedAtUnix")
|
|
985
1055
|
return float(started_at)
|
|
986
1056
|
|
|
987
1057
|
|
|
1058
|
+
def _brainbar_snapshot_idle_in_epoch(socket_path: Path | str | None, writer_started_at: float | None) -> bool:
|
|
1059
|
+
"""True only if BrainBar, still in writer epoch writer_started_at, reports no admitted snapshot.
|
|
1060
|
+
|
|
1061
|
+
Fail closed: an older BrainBar without the field, a malformed answer, a restart between the
|
|
1062
|
+
two probes (a different epoch) or a failed probe all read as "not proven idle".
|
|
1063
|
+
"""
|
|
1064
|
+
if writer_started_at is None:
|
|
1065
|
+
return False
|
|
1066
|
+
try:
|
|
1067
|
+
server_info = _brainbar_initialize_server_info(socket_path)
|
|
1068
|
+
except BackupTimeoutError:
|
|
1069
|
+
raise
|
|
1070
|
+
except (OSError, RuntimeError, ValueError) as exc:
|
|
1071
|
+
print(f"BrainBar snapshot status unavailable: {type(exc).__name__}", flush=True)
|
|
1072
|
+
return False
|
|
1073
|
+
started_at = server_info.get("backupWriterStartedAtUnix")
|
|
1074
|
+
if isinstance(started_at, bool) or not isinstance(started_at, (int, float)):
|
|
1075
|
+
return False
|
|
1076
|
+
return float(started_at) == writer_started_at and server_info.get("backupSnapshotInProgress") is False
|
|
1077
|
+
|
|
1078
|
+
|
|
988
1079
|
def _database_logical_size_bytes(db_path: Path) -> int:
|
|
989
1080
|
db_path = Path(db_path).expanduser().resolve()
|
|
990
1081
|
main_file_size = db_path.stat().st_size
|
|
@@ -1779,6 +1870,7 @@ def create_sqlite_backup_artifact(
|
|
|
1779
1870
|
stale_attempts_deleted, surviving_attempt_paths = _sweep_stale_backup_attempts(
|
|
1780
1871
|
output_dir,
|
|
1781
1872
|
writer_started_at=writer_started_at,
|
|
1873
|
+
writer_snapshot_idle=lambda: _brainbar_snapshot_idle_in_epoch(socket_path, writer_started_at),
|
|
1782
1874
|
)
|
|
1783
1875
|
db_size = _database_logical_size_bytes(db_path)
|
|
1784
1876
|
surviving_attempt_bytes = 0
|
|
@@ -2422,10 +2514,16 @@ def _assert_backup_owners(files: list[dict[str, Any]], *, folder_id: str, machin
|
|
|
2422
2514
|
class RetainedStalledBackupCapacityError(RuntimeError):
|
|
2423
2515
|
error_code = "retained_stalled_backup_capacity"
|
|
2424
2516
|
|
|
2425
|
-
def __init__(self, names: list[str], *, reason: str | None = None):
|
|
2426
|
-
|
|
2517
|
+
def __init__(self, names: list[str], *, reason: str | None = None, unconfirmed: list[str] | None = None):
|
|
2518
|
+
# Every retained stall is named, including one whose identity could not be confirmed (#1385).
|
|
2519
|
+
self.names = list(dict.fromkeys([*names, *(unconfirmed or [])]))
|
|
2520
|
+
self.unconfirmed = [name for name in self.names if name in (unconfirmed or [])]
|
|
2521
|
+
self.error_type = f"RetainedStalledBackupCapacityError[{','.join(self.names)}]"
|
|
2427
2522
|
detail = f"; {reason}" if reason else ""
|
|
2428
|
-
|
|
2523
|
+
unconfirmed_detail = f" (identity unconfirmed: {', '.join(self.unconfirmed)})" if self.unconfirmed else ""
|
|
2524
|
+
super().__init__(
|
|
2525
|
+
f"Insufficient capacity; retaining stalled backups: {', '.join(self.names)}{unconfirmed_detail}{detail}"
|
|
2526
|
+
)
|
|
2429
2527
|
|
|
2430
2528
|
|
|
2431
2529
|
class RetainedStalledBackupConflictError(RuntimeError):
|
|
@@ -3149,12 +3247,16 @@ def _local_snapshot_intact(receipt: Mapping[str, Any]) -> bool:
|
|
|
3149
3247
|
"""The durable #1387 proof is bound to these exact bytes, not a dated filename."""
|
|
3150
3248
|
try:
|
|
3151
3249
|
path = Path(receipt["snapshot"])
|
|
3250
|
+
artifact = receipt.get("local_artifact")
|
|
3152
3251
|
return (
|
|
3153
3252
|
receipt.get("local_verified") is True
|
|
3154
3253
|
and not path.is_symlink()
|
|
3155
3254
|
and path.is_file()
|
|
3156
3255
|
and path.stat().st_nlink == 1
|
|
3157
|
-
|
|
3256
|
+
# Cheap disproof first: a missing record or a size change can never equal the hash (#1385).
|
|
3257
|
+
and isinstance(artifact, dict)
|
|
3258
|
+
and artifact.get("size") == path.stat().st_size
|
|
3259
|
+
and artifact == _upload_identity(path)
|
|
3158
3260
|
)
|
|
3159
3261
|
except (OSError, KeyError, TypeError, ValueError):
|
|
3160
3262
|
return False
|
|
@@ -3465,8 +3567,25 @@ def _upload_identity(path: Path) -> dict[str, Any]:
|
|
|
3465
3567
|
return {"path": str(path.resolve()), "size": path.stat().st_size, "sha256": digest}
|
|
3466
3568
|
|
|
3467
3569
|
|
|
3570
|
+
def _stalled_identity_confirmed(receipt: Mapping[str, Any]) -> bool:
|
|
3571
|
+
"""Hash one retained stall against its receipt. Runs only where the bytes are about to be used:
|
|
3572
|
+
the candidate actually resumed, and (in _remove_superseded_stalls) a stall about to be reclaimed (#1385)."""
|
|
3573
|
+
state = receipt.get("resumable_upload")
|
|
3574
|
+
if not isinstance(state, dict):
|
|
3575
|
+
return False
|
|
3576
|
+
try:
|
|
3577
|
+
return _upload_identity(Path(receipt["snapshot"])) == {k: state.get(k) for k in ("path", "size", "sha256")}
|
|
3578
|
+
except (OSError, KeyError, TypeError):
|
|
3579
|
+
return False
|
|
3580
|
+
|
|
3581
|
+
|
|
3468
3582
|
def _stalled_uploads(log_path: Path, context: dict[str, Any], staging_dir: Path) -> list[dict[str, Any]]:
|
|
3469
|
-
"""Latest receipt per artifact; uncertainty disables reclamation, never broadens it.
|
|
3583
|
+
"""Latest receipt per artifact; uncertainty disables reclamation, never broadens it.
|
|
3584
|
+
|
|
3585
|
+
Listing never hashes: each retained stall is ~9.5 GB and most are too old to resume, so only
|
|
3586
|
+
path/size/link/name are checked here. Bytes are proven by _stalled_identity_confirmed at the
|
|
3587
|
+
point of use. A stall failing even these checks is named in context["retained_stalled_unconfirmed"]
|
|
3588
|
+
so a capacity failure can account for every retained file."""
|
|
3470
3589
|
if not log_path.exists():
|
|
3471
3590
|
return []
|
|
3472
3591
|
try:
|
|
@@ -3504,9 +3623,12 @@ def _stalled_uploads(log_path: Path, context: dict[str, Any], staging_dir: Path)
|
|
|
3504
3623
|
or _parse_snapshot_date(path.name) is None
|
|
3505
3624
|
or path.name not in {f"{path.name[:10]}{suffix}" for suffix in DB_SNAPSHOT_SUFFIXES}
|
|
3506
3625
|
or path.stat().st_nlink != 1
|
|
3507
|
-
or
|
|
3626
|
+
or str(path.resolve()) != state.get("path")
|
|
3627
|
+
or path.stat().st_size != state.get("size")
|
|
3508
3628
|
):
|
|
3509
3629
|
print(f"Retaining stalled backup with unconfirmed identity: {path.name}", flush=True)
|
|
3630
|
+
if os.path.lexists(path):
|
|
3631
|
+
context.setdefault("retained_stalled_unconfirmed", []).append(path.name)
|
|
3510
3632
|
continue
|
|
3511
3633
|
candidates.append(receipt)
|
|
3512
3634
|
return sorted(
|
|
@@ -3574,7 +3696,7 @@ def _remove_superseded_stalls(receipts: list[dict[str, Any]], result: dict[str,
|
|
|
3574
3696
|
or _snapshot_created_time(receipt) >= _snapshot_created_time(result)
|
|
3575
3697
|
or path.is_symlink()
|
|
3576
3698
|
or path.stat().st_nlink != 1
|
|
3577
|
-
or
|
|
3699
|
+
or not _stalled_identity_confirmed(receipt)
|
|
3578
3700
|
):
|
|
3579
3701
|
print(f"Retaining stalled backup without proof it is superseded: {path.name}", flush=True)
|
|
3580
3702
|
continue
|
|
@@ -3736,15 +3858,20 @@ def run_backup(
|
|
|
3736
3858
|
result["upload_state"] = "nothing_pending"
|
|
3737
3859
|
return result
|
|
3738
3860
|
stalled = _stalled_uploads(resolved_log_path, result, Path(staging_dir)) if upload else []
|
|
3739
|
-
candidate =
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
if _safe_upload_url(r["resumable_upload"].get("url"))
|
|
3861
|
+
candidate = None
|
|
3862
|
+
for r in stalled:
|
|
3863
|
+
if not (
|
|
3864
|
+
_safe_upload_url(r["resumable_upload"].get("url"))
|
|
3744
3865
|
and _resume_fresh_enough(r, dt.datetime.fromisoformat(result["attempted_at"]))
|
|
3745
|
-
)
|
|
3746
|
-
|
|
3747
|
-
|
|
3866
|
+
):
|
|
3867
|
+
continue # Not resumable, so its bytes are never read on this run.
|
|
3868
|
+
if _stalled_identity_confirmed(r):
|
|
3869
|
+
candidate = r
|
|
3870
|
+
break
|
|
3871
|
+
name = Path(r["snapshot"]).name
|
|
3872
|
+
print(f"Retaining stalled backup with unconfirmed identity: {name}", flush=True)
|
|
3873
|
+
result.setdefault("retained_stalled_unconfirmed", []).append(name)
|
|
3874
|
+
stalled = [r for r in stalled if Path(r["snapshot"]).name not in result.get("retained_stalled_unconfirmed", [])]
|
|
3748
3875
|
|
|
3749
3876
|
local_resume = local is not None and not (local.get("uploaded") and local.get("verified"))
|
|
3750
3877
|
candidate = local if local_resume else candidate
|
|
@@ -3795,9 +3922,12 @@ def run_backup(
|
|
|
3795
3922
|
reason += f"; retained compressed snapshots: {_compressed_snapshot_names(Path(staging_dir))}"
|
|
3796
3923
|
if floor_breach:
|
|
3797
3924
|
reason += f"; retained raw snapshots: {_retained_raw_snapshot_names(Path(staging_dir))}"
|
|
3798
|
-
|
|
3925
|
+
unconfirmed = list(result.get("retained_stalled_unconfirmed", []))
|
|
3926
|
+
if (stalled or unconfirmed) and (
|
|
3927
|
+
"Insufficient free space" in reason or "raw free space floor breached" in reason
|
|
3928
|
+
):
|
|
3799
3929
|
raise RetainedStalledBackupCapacityError(
|
|
3800
|
-
[Path(r["snapshot"]).name for r in stalled], reason=reason
|
|
3930
|
+
[Path(r["snapshot"]).name for r in stalled], reason=reason, unconfirmed=unconfirmed
|
|
3801
3931
|
) from exc
|
|
3802
3932
|
if "Insufficient free space" in reason or floor_breach:
|
|
3803
3933
|
raise RuntimeError(reason) from exc
|
|
@@ -4072,6 +4202,8 @@ def run_backup(
|
|
|
4072
4202
|
error_code = getattr(exc, "error_code", None)
|
|
4073
4203
|
if isinstance(exc, RawReclaimUnconfirmedError):
|
|
4074
4204
|
result["raw_reclaim"] = exc.measurements
|
|
4205
|
+
if isinstance(exc, RetainedStalledBackupCapacityError):
|
|
4206
|
+
result["retained_stalled_backups"] = exc.names
|
|
4075
4207
|
if isinstance(error_code, str):
|
|
4076
4208
|
result["error_code"] = error_code
|
|
4077
4209
|
if isinstance(exc, DriveUploadStalledError):
|
|
@@ -4196,7 +4328,10 @@ def _run_backup_process(timeout_seconds: int) -> int:
|
|
|
4196
4328
|
)
|
|
4197
4329
|
|
|
4198
4330
|
|
|
4199
|
-
def _supervise_backup_process(
|
|
4331
|
+
def _supervise_backup_process(
|
|
4332
|
+
timeout_seconds: int, *, command: list[str] | None = None, deadline: float | None = None
|
|
4333
|
+
) -> int:
|
|
4334
|
+
"""Run the backup child; with ``deadline`` (monotonic), the receipt is written strictly before it."""
|
|
4200
4335
|
guard_fd = os.environ.get("BRAINLAYER_CALENDAR_GUARD_FD")
|
|
4201
4336
|
managed = guard_fd is not None
|
|
4202
4337
|
if managed:
|
|
@@ -4226,12 +4361,22 @@ def _supervise_backup_process(timeout_seconds: int, *, command: list[str] | None
|
|
|
4226
4361
|
signal.signal(shutdown_signal, forward_shutdown_signal)
|
|
4227
4362
|
try:
|
|
4228
4363
|
try:
|
|
4229
|
-
|
|
4364
|
+
wait = timeout_seconds
|
|
4365
|
+
if deadline is not None:
|
|
4366
|
+
# Child creation already spent part of the budget; the alarm keeps the full reserve.
|
|
4367
|
+
alarm_at = deadline - SNAPSHOT_RECEIPT_RESERVE_SECONDS
|
|
4368
|
+
wait = max(0.0, min(timeout_seconds, alarm_at - time.monotonic()))
|
|
4369
|
+
return child.wait(timeout=wait)
|
|
4230
4370
|
except subprocess.TimeoutExpired:
|
|
4231
4371
|
if child.poll() is None:
|
|
4232
4372
|
signal_child(signal.SIGALRM)
|
|
4373
|
+
grace = SUPERVISOR_ALARM_GRACE_SECONDS
|
|
4374
|
+
if deadline is not None:
|
|
4375
|
+
# Never let the grace eat the receipt's own slice of the remaining window.
|
|
4376
|
+
remaining = deadline - time.monotonic() - SUPERVISOR_RECEIPT_WRITE_SECONDS
|
|
4377
|
+
grace = max(0.0, min(grace, remaining))
|
|
4233
4378
|
try:
|
|
4234
|
-
child.wait(timeout=
|
|
4379
|
+
child.wait(timeout=grace)
|
|
4235
4380
|
except subprocess.TimeoutExpired:
|
|
4236
4381
|
signal_child(signal.SIGKILL)
|
|
4237
4382
|
child.wait()
|
|
@@ -4283,6 +4428,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
4283
4428
|
_parse_cli_args([] if argv is None else argv)
|
|
4284
4429
|
timeout_seconds = _configured_backup_timeout_seconds()
|
|
4285
4430
|
snapshot_phase = os.environ.get("BRAINLAYER_BACKUP_PHASE") == "snapshot"
|
|
4431
|
+
deadline = None
|
|
4286
4432
|
if snapshot_phase:
|
|
4287
4433
|
timeout_seconds = min(
|
|
4288
4434
|
timeout_seconds,
|
|
@@ -4296,17 +4442,32 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
4296
4442
|
timeout_seconds = min(timeout_seconds, int(budget))
|
|
4297
4443
|
if timeout_seconds < 1:
|
|
4298
4444
|
raise ValueError("snapshot timeout must be positive")
|
|
4445
|
+
if (raw_deadline := os.environ.get(BACKUP_CALENDAR_DEADLINE_ENV)) is not None:
|
|
4446
|
+
deadline = float(raw_deadline)
|
|
4447
|
+
if not math.isfinite(deadline):
|
|
4448
|
+
raise ValueError(f"{BACKUP_CALENDAR_DEADLINE_ENV} must be finite")
|
|
4449
|
+
# Startup so far is charged against the calendar's clock, not added on top of it.
|
|
4450
|
+
work = math.floor(deadline - time.monotonic() - SNAPSHOT_RECEIPT_RESERVE_SECONDS)
|
|
4451
|
+
if work < 1:
|
|
4452
|
+
print(
|
|
4453
|
+
"brainlayer backup-snapshot deferred: no positive work budget plus the "
|
|
4454
|
+
f"{SNAPSHOT_RECEIPT_RESERVE_SECONDS}s receipt reserve fits before the calendar deadline",
|
|
4455
|
+
flush=True,
|
|
4456
|
+
)
|
|
4457
|
+
return BACKUP_DEFERRED_EXIT_CODE # nothing was started; the calendar records a deferral
|
|
4458
|
+
timeout_seconds = min(timeout_seconds, work)
|
|
4299
4459
|
if _env_flag_enabled(BACKUP_SUPERVISED_CHILD_ENV):
|
|
4300
4460
|
return _run_backup_process(timeout_seconds)
|
|
4301
4461
|
from .job_alerts import report
|
|
4302
4462
|
|
|
4303
4463
|
key = "backup-snapshot" if snapshot_phase else "backup-daily"
|
|
4304
4464
|
try:
|
|
4305
|
-
code = _supervise_backup_process(timeout_seconds)
|
|
4465
|
+
code = _supervise_backup_process(timeout_seconds, **({"deadline": deadline} if deadline is not None else {}))
|
|
4306
4466
|
except Exception:
|
|
4307
4467
|
report(key, "Database backup failed; check the backup log")
|
|
4308
4468
|
raise
|
|
4309
|
-
|
|
4469
|
+
if code != BACKUP_DEFERRED_EXIT_CODE or deadline is None: # a child's deadline deferral is not a failure
|
|
4470
|
+
report(key, None if code == 0 else "Database backup failed; check the backup log")
|
|
4310
4471
|
return code
|
|
4311
4472
|
|
|
4312
4473
|
|
|
@@ -511,8 +511,10 @@ class _CalendarIndexCheckpoint:
|
|
|
511
511
|
backlog = self.backlog()
|
|
512
512
|
stalled = self.previous.get("stalled_passes", 0)
|
|
513
513
|
best = self.previous.get("best_backlog")
|
|
514
|
-
|
|
515
|
-
#
|
|
514
|
+
growing = self.previous.get("growing_passes", 0)
|
|
515
|
+
# Compare measured passes with their own inventory. Retain the legacy
|
|
516
|
+
# baseline for older callers without a before measurement. Unknown
|
|
517
|
+
# lower bounds carry both count and baseline.
|
|
516
518
|
if (
|
|
517
519
|
best is None
|
|
518
520
|
and self.previous
|
|
@@ -520,10 +522,19 @@ class _CalendarIndexCheckpoint:
|
|
|
520
522
|
and self.previous["uncounted_files"] == 0
|
|
521
523
|
):
|
|
522
524
|
best = {key: self.previous[key] for key in self.backlog_keys()}
|
|
525
|
+
growth_best = best
|
|
523
526
|
measured = backlog["uncounted_files"] == 0
|
|
524
527
|
if not deferred and measured:
|
|
525
528
|
if not backlog["files_remaining"]:
|
|
526
529
|
stalled, best = 0, backlog
|
|
530
|
+
elif self.backlog_before is not None:
|
|
531
|
+
before = self.backlog_before
|
|
532
|
+
if before["uncounted_files"] == 0:
|
|
533
|
+
smaller = (backlog["chunks_remaining"], backlog["files_remaining"]) < (
|
|
534
|
+
before["chunks_remaining"],
|
|
535
|
+
before["files_remaining"],
|
|
536
|
+
)
|
|
537
|
+
stalled = 0 if smaller else stalled + 1
|
|
527
538
|
elif best is None or best["uncounted_files"] or not best["files_remaining"]:
|
|
528
539
|
best = backlog
|
|
529
540
|
else:
|
|
@@ -532,8 +543,19 @@ class _CalendarIndexCheckpoint:
|
|
|
532
543
|
best["files_remaining"],
|
|
533
544
|
)
|
|
534
545
|
stalled = 0 if smaller else stalled + 1
|
|
535
|
-
|
|
536
|
-
|
|
546
|
+
best = growth_best
|
|
547
|
+
if not deferred and measured:
|
|
548
|
+
if not backlog["files_remaining"]:
|
|
549
|
+
growing, best = 0, backlog
|
|
550
|
+
elif best is None or best["uncounted_files"] or not best["files_remaining"]:
|
|
551
|
+
growing, best = 0, backlog
|
|
552
|
+
elif (backlog["chunks_remaining"], backlog["files_remaining"]) < (
|
|
553
|
+
best["chunks_remaining"],
|
|
554
|
+
best["files_remaining"],
|
|
555
|
+
):
|
|
556
|
+
growing, best = 0, backlog
|
|
557
|
+
else:
|
|
558
|
+
growing += 1
|
|
537
559
|
quarantined = [key for key in self.catalog if self.quarantined(Path(key))]
|
|
538
560
|
state = dict(
|
|
539
561
|
database=self.database,
|
|
@@ -541,6 +563,7 @@ class _CalendarIndexCheckpoint:
|
|
|
541
563
|
**backlog,
|
|
542
564
|
backlog_before=self.backlog_before,
|
|
543
565
|
stalled_passes=stalled,
|
|
566
|
+
growing_passes=growing,
|
|
544
567
|
best_backlog=best,
|
|
545
568
|
deferred=deferred,
|
|
546
569
|
quarantined=quarantined,
|
|
@@ -555,6 +578,11 @@ class _CalendarIndexCheckpoint:
|
|
|
555
578
|
f"quarantined_files={len(quarantined)} resource_files={len(self.resource_faults)} "
|
|
556
579
|
f"{self.delta_summary()}"
|
|
557
580
|
)
|
|
581
|
+
if not deferred and measured and growing >= self.limit("BRAINLAYER_INDEX_STALL_PASSES"):
|
|
582
|
+
rprint(
|
|
583
|
+
f"INDEX_BACKLOG_GROWING passes={growing} "
|
|
584
|
+
f"leftover_chunks={backlog['chunks_remaining']} best_chunks={best['chunks_remaining']}"
|
|
585
|
+
)
|
|
558
586
|
for path, cause in self.resource_faults.items():
|
|
559
587
|
rprint(f"INDEX_RESOURCE_SKIPPED file={path} cause={cause}")
|
|
560
588
|
for path in quarantined:
|
|
@@ -1153,6 +1181,24 @@ def index(
|
|
|
1153
1181
|
index_fast(source, project, force)
|
|
1154
1182
|
|
|
1155
1183
|
|
|
1184
|
+
@app.command("bootstrap-db")
|
|
1185
|
+
def bootstrap_db() -> None:
|
|
1186
|
+
"""Create the configured BrainLayer database with the canonical schema -- only if it is absent.
|
|
1187
|
+
|
|
1188
|
+
Refuses any existing path (file, partial file, foreign DB, symlink). `brainlayer index` never
|
|
1189
|
+
creates a database; run this once on a fresh install when index reports INDEX_BOOTSTRAP_REQUIRED.
|
|
1190
|
+
"""
|
|
1191
|
+
from ..runtime_store import RuntimeBootstrapRefused, bootstrap_runtime_database
|
|
1192
|
+
|
|
1193
|
+
db_path = get_db_path()
|
|
1194
|
+
try:
|
|
1195
|
+
fingerprint = bootstrap_runtime_database(db_path)
|
|
1196
|
+
except RuntimeBootstrapRefused as exc:
|
|
1197
|
+
rprint(f"BOOTSTRAP_REFUSED db={db_path} reason={exc}")
|
|
1198
|
+
raise typer.Exit(1) from exc
|
|
1199
|
+
rprint(f"BOOTSTRAP_CREATED db={db_path} schema_fingerprint={fingerprint}")
|
|
1200
|
+
|
|
1201
|
+
|
|
1156
1202
|
@app.command()
|
|
1157
1203
|
def dashboard() -> None:
|
|
1158
1204
|
"""Launch interactive dashboard for memory search and management."""
|
|
@@ -3201,6 +3247,9 @@ def scrub_at_rest_command(
|
|
|
3201
3247
|
"error_type": type(exc).__name__,
|
|
3202
3248
|
"reason": getattr(exc, "reason", "scrub-failed"),
|
|
3203
3249
|
"detail": getattr(exc, "detail", None),
|
|
3250
|
+
# Fixed allowlisted labels only (#1129); never exception text.
|
|
3251
|
+
"cause": getattr(exc, "cause", "unknown"),
|
|
3252
|
+
"gate": getattr(exc, "gate", None),
|
|
3204
3253
|
}
|
|
3205
3254
|
)
|
|
3206
3255
|
)
|
|
@@ -4178,6 +4227,20 @@ def index_fast(
|
|
|
4178
4227
|
rprint(f"[bold red]Error:[/] Source directory not found: {source}")
|
|
4179
4228
|
raise typer.Exit(1)
|
|
4180
4229
|
|
|
4230
|
+
# #1349 first-calendar policy: the scheduled pass never creates a database. Decide BEFORE
|
|
4231
|
+
# the checkpoint sidecar (which stats the DB) or the writer (which refuses an absent DB)
|
|
4232
|
+
# are built, so an absent DB is one actionable rc78 instead of two unrelated tracebacks.
|
|
4233
|
+
# `brainlayer bootstrap-db` is the explicit creator. Interactive runs keep the writer's
|
|
4234
|
+
# own fail-closed refusal.
|
|
4235
|
+
if calendar:
|
|
4236
|
+
db_path = get_db_path()
|
|
4237
|
+
if os.path.lexists(db_path) and not db_path.exists():
|
|
4238
|
+
rprint(f"INDEX_DB_UNAVAILABLE db={db_path} reason=dangling_symlink")
|
|
4239
|
+
raise typer.Exit(1)
|
|
4240
|
+
if not os.path.lexists(db_path):
|
|
4241
|
+
rprint(f'INDEX_BOOTSTRAP_REQUIRED db={db_path} run="brainlayer bootstrap-db"')
|
|
4242
|
+
raise typer.Exit(78)
|
|
4243
|
+
|
|
4181
4244
|
start_time = time.time()
|
|
4182
4245
|
start_monotonic = time.monotonic()
|
|
4183
4246
|
max_runtime_s = _index_max_runtime_s()
|