brainlayer 1.5.99__tar.gz → 1.6.0__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.99 → brainlayer-1.6.0}/PKG-INFO +1 -1
- {brainlayer-1.5.99 → brainlayer-1.6.0}/pyproject.toml +1 -1
- {brainlayer-1.5.99 → brainlayer-1.6.0}/server.json +2 -2
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/__init__.py +1 -1
- brainlayer-1.6.0/src/brainlayer/_build.py +1 -0
- brainlayer-1.6.0/src/brainlayer/agent_census.py +256 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/health_check.py +26 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/health_facts.py +24 -1
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/health_verdict.py +69 -2
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/jsonl_backup.py +75 -3
- brainlayer-1.5.99/src/brainlayer/_build.py +0 -1
- {brainlayer-1.5.99 → brainlayer-1.6.0}/.gitignore +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/LICENSE +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/README.md +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/brainlayer-version-check.sh +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/hotlane_brainbar_daemon.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/backup-daily.sh +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/brainlayer-env-run.sh +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/brainlayer.env.example +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.backup-daily.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.daemon.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.decay.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.drain.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.health-check.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.hotlane-brainbar.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.index.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.jsonl-backup.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.log-cap.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.maintenance-nightly.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.maintenance-weekly.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.maintenance.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.observability.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.p0-counter.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.repair-fts.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.t3-ingest.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.throughput-watchdog.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.tier0-watchdog.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.wal-checkpoint.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.brainlayer.watch.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/com.etanhey.brainlayer-fleet-watchdog.plist +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/fleet-watchdog.sh +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/install.sh +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/jsonl-backup.sh +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/launchd/throughput-watchdog.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/release-verify-signatures.sh +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/scripts/tier0-watchdog.sh +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/__main__.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/_helpers.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/agent_profiles.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/agent_provenance.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/alarm.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/archive_collapse.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/archive_lifecycle.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/backup_daily.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/backup_retention_invariant.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/badge_state.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/bitemporal.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/brainbar_activation.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/brainbar_auto_activation.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/brainbar_hybrid_helper.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/brainbar_identity.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/cachedelete_purge.swift +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/calibrate.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/chunk_origin.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/chunk_origin_backfill.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/chunk_origin_wipe.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/chunk_write.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/classify.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/claude_paths.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/cli/__init__.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/cli/wizard.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/cli_jobs.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/cli_new.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/cloud_backfill.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/clustering.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/codex_zst.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/component_jobs.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/config.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/consolidation_plan.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/content_class.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/content_hash_repair.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/correction_judge.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/data/agents_registry.yaml +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/data/sandbox_seeds/skill-eval-baseline.json +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/db_shrink.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/decay.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/decay_backfill.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/decay_job.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/dedupe.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/dedupe_merge.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/deploy_drift.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/disk_space.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/doctor.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/drain.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/drain_liveness.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/drive_credentials.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/embeddings.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/engine.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/enrichment_replay.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/__init__.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/abcde_enrich_runner.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/abcde_variants.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/abcde_variants.yaml +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/benchmark.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/enrichment_gold.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/enrichment_graders.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/enrichment_judge.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/enrichment_llm_judge.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/enrichment_quality_benchmark.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/experiment_store.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/fixtures/README.md +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/labeling/enrichment-labeler.html +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/phoenix_gate/__init__.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/phoenix_gate/__main__.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/phoenix_gate/baseline_store.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/phoenix_gate/cli.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/phoenix_gate/models.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/phoenix_gate/phoenix_client.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/phoenix_gate/regression_gate.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/phoenix_gate/triggers.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/eval/pilot_artifact_report.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/fallback_replay.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/git_learning.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/hook_python.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/hooks/__init__.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/hooks/indexer.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/hotlane_budget.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/import_sweep.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/index_admission.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/index_budget.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/index_completeness.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/index_new.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/index_watchdog.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/ingest/__init__.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/ingest/codex.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/ingest/codex_manifest.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/ingest/t3.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/ingest_denylist.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/ingest_guard.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/isolation_proof.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/job_alerts.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/job_lifecycle_health.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/jobs.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/kg/__init__.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/kg_cleanup.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/kg_judge.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/kg_promotion.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/kg_repo.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/kg_review_session.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/kg_session_finish.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/kg_session_harvest.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/launchd_consolidation.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/launchd_install.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/launchd_primitive.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/launchd_revert.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/launcher_policy_reconcile.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/lexical_defense.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/lexical_defense_dictionary.json +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/linkedin_import.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/log_cap.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/maintenance.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/maintenance_calendar.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/maintenance_control.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/maintenance_upload_recovery.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/mcp/__init__.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/mcp/_format.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/mcp/_shared.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/mcp/enrich_handler.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/mcp/entity_handler.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/mcp/palette.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/mcp/search_handler.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/mcp/store_handler.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/mcp/tags_handler.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/mcp_socket_config.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/mcp_stdio_bridge.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/memory_types.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/migrate.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/migration_custody.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/migration_journal.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/migration_runtime.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/notification_policy.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/observability_backup.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/observability_indexes.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/observability_surface.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/observability_transport.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/p0_longitudinal_count.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/parent_death.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/paths.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pause.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/phonetic.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/__init__.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/agent_enrichment.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/analyze_communication.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/batch_extraction.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/brain_graph.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/chat_tags.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/chunk.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/classify.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/cloud_scrub.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/cluster_sampling.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/code_intelligence.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/correction_detection.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/correction_mining.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/digest.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/enrichment_prompts.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/enrichment_results.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/enrichment_tiers.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/entity_extraction.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/entity_resolution.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/extract.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/extract_claude_desktop.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/extract_corrections.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/extract_markdown.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/extract_whatsapp.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/frustration_mining.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/git_overlay.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/kg_extraction.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/kg_extraction_groq.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/longitudinal_analyzer.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/obsidian_export.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/operation_grouping.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/plan_linking.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/rate_limiter.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/relation_backfill.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/relation_verification.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/sanitize.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/secret_scrub.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/semantic_style.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/sentiment.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/session_history.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/style_embed.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/style_index.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/tag_entity_promotion.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/temporal_chains.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/time_batcher.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/unified_timeline.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/pipeline/write_queue.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/policy_reconcile.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/provenance.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/provenance_autosupersede.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/provenance_integration.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/queue_io.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/queue_merge.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/readonly_snapshot.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/reembed_backfill.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/retired_services.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/runtime_store.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/sandbox_db.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/schema_ddl_ledger.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/scoping.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/scrub_at_rest.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/search_fanout.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/search_profile.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/search_repo.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/search_response.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/service_supervisor.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/session_repo.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/setup.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/socket_hygiene.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/source_class_migration.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/spotlight.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/storage.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/store.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/supervisor_adapters.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/supervisor_child.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/supervisor_diagnostics.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/supervisor_guard.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/supervisor_jobs.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/system_prompt_guard.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/t3_linkage_alarm.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/t3_provenance.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/t3_sources.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/tag_normalization.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/taxonomy.json +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/telemetry.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/timestamp_iso.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/types.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/vector_store.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/wal_checkpoint.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/watcher.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/watcher_bridge.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/writer_policy.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/writer_telemetry.py +0 -0
- {brainlayer-1.5.99 → brainlayer-1.6.0}/src/brainlayer/zstd_stream.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: brainlayer
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.0
|
|
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.
|
|
6
|
+
"version": "1.6.0",
|
|
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.
|
|
17
|
+
"version": "1.6.0",
|
|
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
|
+
__version__ = "1.6.0"
|
|
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 = "c876d3863c506e9140ffcac2f4a0f12c68f626f6"
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"""Known-agent census: a local agent from a fixed list is running and writes where BrainLayer does not watch.
|
|
2
|
+
|
|
3
|
+
The ingest guarantee (formal/ingest-coverage) holds only for wired roots, and new sources are wired on
|
|
4
|
+
purpose, never auto-detected. This is the honest add-on: it names a running agent from the list below
|
|
5
|
+
that wrote one of its transcripts, during its current run, outside every watched root. It cannot see an
|
|
6
|
+
agent that is not on the list.
|
|
7
|
+
|
|
8
|
+
Result, per agent: ``found`` lists ``"<agent>: <root>"`` for each agent measured positive this check;
|
|
9
|
+
``incomplete`` names each agent that could not be measured (a running instance without a start time, or a
|
|
10
|
+
scan cut short by a cap or a read error, with nothing found). Every other listed agent is a measured
|
|
11
|
+
negative, including one that is not running. The verdict merges per agent, so an incomplete agent keeps
|
|
12
|
+
whatever was last measured for it.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import os
|
|
18
|
+
import re
|
|
19
|
+
import time
|
|
20
|
+
from collections.abc import Callable, Iterable, Sequence
|
|
21
|
+
from dataclasses import dataclass
|
|
22
|
+
from fnmatch import fnmatch
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
|
|
25
|
+
MAX_ENTRIES = 5000
|
|
26
|
+
MAX_DEPTH = 6
|
|
27
|
+
START_SLACK_S = 1.0 # ps reports elapsed time in whole seconds
|
|
28
|
+
_INTERPRETER = re.compile(r"^(node|nodejs|bun|deno|python[0-9.]*)$")
|
|
29
|
+
|
|
30
|
+
ProcessStarts = Callable[[Sequence[int]], "dict[int, float] | None"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass(frozen=True)
|
|
34
|
+
class Census:
|
|
35
|
+
found: list[str] # "<agent>: <root>", measured positive this check
|
|
36
|
+
incomplete: list[str] # agent names that could not be measured this check
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def complete(self) -> bool:
|
|
40
|
+
return not self.incomplete
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass(frozen=True)
|
|
44
|
+
class KnownAgent:
|
|
45
|
+
name: str
|
|
46
|
+
executables: tuple[str, ...] # argv[0] basename of the agent's own binary
|
|
47
|
+
entry_scripts: tuple[str, ...] # script an interpreter runs: a basename, or a path fragment containing "/"
|
|
48
|
+
transcripts: tuple[tuple[str, str], ...] # (home-relative root, fnmatch pattern for the path under it)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
KNOWN_AGENTS: tuple[KnownAgent, ...] = (
|
|
52
|
+
KnownAgent("claude", ("claude",), ("claude", "@anthropic-ai/claude-code/"), ((".claude/projects", "*.jsonl"),)),
|
|
53
|
+
KnownAgent("codex", ("codex",), ("codex", "@openai/codex/"), ((".codex/sessions", "*rollout-*.jsonl"),)),
|
|
54
|
+
KnownAgent(
|
|
55
|
+
"cursor-agent", ("cursor-agent",), ("cursor-agent",), ((".cursor/projects", "*/agent-transcripts/*.jsonl"),)
|
|
56
|
+
),
|
|
57
|
+
# Gemini CLI saves chats as tmp/<project-hash>/chats/session-*.json, not under sessions/.
|
|
58
|
+
KnownAgent(
|
|
59
|
+
"gemini",
|
|
60
|
+
("gemini",),
|
|
61
|
+
("gemini", "@google/gemini-cli/"),
|
|
62
|
+
((".gemini/tmp", "*/chats/session-*.json"), (".gemini/sessions", "*.jsonl")),
|
|
63
|
+
),
|
|
64
|
+
KnownAgent("opencode", ("opencode",), ("opencode", "opencode-ai/"), ((".local/share/opencode/storage", "*.json"),)),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# Options that take the next token as their value (it is never the script).
|
|
69
|
+
_VALUE_OPTIONS = {
|
|
70
|
+
"python": {"-W", "-X", "-Q", "--check-hash-based-pycs"},
|
|
71
|
+
"node": {"-r", "--require", "--import", "--loader", "--experimental-loader", "-C", "--conditions"},
|
|
72
|
+
"bun": {"-r", "--preload", "--cwd", "--config", "-c"},
|
|
73
|
+
"deno": {"-c", "--config", "-L", "--log-level", "--import-map"},
|
|
74
|
+
}
|
|
75
|
+
# Options whose value is inline code or a module: the process runs no script at all.
|
|
76
|
+
_CODE_OPTIONS = {
|
|
77
|
+
"python": ("-c", "-m"),
|
|
78
|
+
"node": ("-e", "--eval", "-p", "--print"),
|
|
79
|
+
"bun": ("-e", "--eval", "-p", "--print"),
|
|
80
|
+
"deno": (),
|
|
81
|
+
}
|
|
82
|
+
_SUBCOMMANDS = {"bun": {"run"}, "deno": {"run"}} # a subcommand that is followed by a script
|
|
83
|
+
_NO_SCRIPT = {"bun": {"x", "exec", "eval", "repl", "install", "add", "test"}, "deno": {"eval", "repl", "test", "task"}}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _family(exe: str) -> str:
|
|
87
|
+
return "python" if exe.startswith("python") else "node" if exe in ("node", "nodejs") else exe
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _entry_script(tokens: Sequence[str]) -> str | None:
|
|
91
|
+
"""The script an interpreter runs, reading its options; None for ``-c``/``-e``/``-m``/``eval`` and the like."""
|
|
92
|
+
family = _family(os.path.basename(tokens[0]))
|
|
93
|
+
rest, i = list(tokens[1:]), 0
|
|
94
|
+
while i < len(rest):
|
|
95
|
+
token = rest[i]
|
|
96
|
+
if token == "--":
|
|
97
|
+
return rest[i + 1] if i + 1 < len(rest) else None
|
|
98
|
+
if any(
|
|
99
|
+
token == code
|
|
100
|
+
or (code.startswith("--") and token.startswith(code + "="))
|
|
101
|
+
or (not code.startswith("--") and token.startswith(code))
|
|
102
|
+
for code in _CODE_OPTIONS.get(family, ())
|
|
103
|
+
):
|
|
104
|
+
return None # inline code, e.g. ``python3 -c gemini`` or ``node -egemini``: not a script
|
|
105
|
+
if family == "python" and token.startswith("-") and not token.startswith("--") and len(token) > 1:
|
|
106
|
+
# A cluster such as -uc: -c or -m anywhere ends the options with code; -W/-X take a value.
|
|
107
|
+
for j, char in enumerate(token[1:], 1):
|
|
108
|
+
if char in "cm":
|
|
109
|
+
return None
|
|
110
|
+
if char in "WXQ":
|
|
111
|
+
i += 1 if j < len(token) - 1 else 2
|
|
112
|
+
break
|
|
113
|
+
else:
|
|
114
|
+
i += 1
|
|
115
|
+
continue
|
|
116
|
+
if token.startswith("-"):
|
|
117
|
+
i += 2 if token in _VALUE_OPTIONS.get(family, ()) else 1
|
|
118
|
+
continue
|
|
119
|
+
if token in _NO_SCRIPT.get(family, ()):
|
|
120
|
+
return None
|
|
121
|
+
if token in _SUBCOMMANDS.get(family, ()):
|
|
122
|
+
i += 1
|
|
123
|
+
continue
|
|
124
|
+
return token
|
|
125
|
+
return None
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _is_agent(tokens: Sequence[str], agent: KnownAgent) -> bool:
|
|
129
|
+
exe = os.path.basename(tokens[0])
|
|
130
|
+
if exe in agent.executables:
|
|
131
|
+
return True
|
|
132
|
+
if not _INTERPRETER.match(exe):
|
|
133
|
+
return False
|
|
134
|
+
script = _entry_script(tokens)
|
|
135
|
+
if script is None:
|
|
136
|
+
return False
|
|
137
|
+
return any(
|
|
138
|
+
(fragment in script) if "/" in fragment else os.path.basename(script) == fragment
|
|
139
|
+
for fragment in agent.entry_scripts
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def running_agents(ps_output: str, agents: Sequence[KnownAgent] = KNOWN_AGENTS) -> dict[str, list[int]]:
|
|
144
|
+
"""PIDs per agent from a ``ps axo pid=,command=`` snapshot, matched on the executable or entry script only."""
|
|
145
|
+
found: dict[str, list[int]] = {}
|
|
146
|
+
for line in ps_output.splitlines():
|
|
147
|
+
parts = line.split()
|
|
148
|
+
if len(parts) < 2 or not parts[0].isdigit():
|
|
149
|
+
continue
|
|
150
|
+
for agent in agents:
|
|
151
|
+
if _is_agent(parts[1:], agent):
|
|
152
|
+
found.setdefault(agent.name, []).append(int(parts[0]))
|
|
153
|
+
return found
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def parse_etime(value: str) -> int | None:
|
|
157
|
+
"""``ps`` elapsed time ``[[dd-]hh:]mm:ss`` in seconds."""
|
|
158
|
+
days, _, clock = value.strip().rpartition("-")
|
|
159
|
+
fields = clock.split(":")
|
|
160
|
+
if not 2 <= len(fields) <= 3 or not all(f.isdigit() for f in fields) or (days and not days.isdigit()):
|
|
161
|
+
return None
|
|
162
|
+
seconds = 0
|
|
163
|
+
for field in fields:
|
|
164
|
+
seconds = seconds * 60 + int(field)
|
|
165
|
+
return seconds + int(days or 0) * 86400
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def _watched(path: Path, watch_roots: Iterable[Path]) -> bool:
|
|
169
|
+
return any(path == root or root in path.parents for root in watch_roots)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def _scan(root: Path, pattern: str, since: float) -> tuple[bool, bool]:
|
|
173
|
+
"""(found, complete): a file under ``root`` matching ``pattern`` modified at or after ``since``."""
|
|
174
|
+
stack, looked, complete = [(root, 0)], 0, True
|
|
175
|
+
while stack:
|
|
176
|
+
directory, depth = stack.pop()
|
|
177
|
+
try:
|
|
178
|
+
with os.scandir(directory) as entries:
|
|
179
|
+
for entry in entries:
|
|
180
|
+
looked += 1
|
|
181
|
+
if looked > MAX_ENTRIES:
|
|
182
|
+
return False, False
|
|
183
|
+
if entry.is_dir(follow_symlinks=False):
|
|
184
|
+
if depth + 1 >= MAX_DEPTH:
|
|
185
|
+
complete = False
|
|
186
|
+
else:
|
|
187
|
+
stack.append((Path(entry.path), depth + 1))
|
|
188
|
+
elif entry.is_file(follow_symlinks=False):
|
|
189
|
+
relative = Path(entry.path).relative_to(root).as_posix()
|
|
190
|
+
if fnmatch(relative, pattern) and entry.stat().st_mtime >= since:
|
|
191
|
+
return True, True
|
|
192
|
+
except OSError:
|
|
193
|
+
complete = False
|
|
194
|
+
return False, complete
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def unindexed_agents(
|
|
198
|
+
ps_output: str,
|
|
199
|
+
*,
|
|
200
|
+
home: Path,
|
|
201
|
+
watch_roots: Iterable[Path],
|
|
202
|
+
process_starts: ProcessStarts | None = None,
|
|
203
|
+
agents: Sequence[KnownAgent] = KNOWN_AGENTS,
|
|
204
|
+
) -> Census:
|
|
205
|
+
"""Per agent: wrote a transcript during its current run under a root nobody watches, did not, or unknown."""
|
|
206
|
+
running = running_agents(ps_output, agents)
|
|
207
|
+
if not running:
|
|
208
|
+
return Census([], [])
|
|
209
|
+
watched = [Path(root).expanduser() for root in watch_roots]
|
|
210
|
+
pids = sorted(pid for found in running.values() for pid in found)
|
|
211
|
+
starts = process_starts(pids) if process_starts is not None else None
|
|
212
|
+
found, incomplete = [], []
|
|
213
|
+
for agent in agents:
|
|
214
|
+
if agent.name not in running:
|
|
215
|
+
continue
|
|
216
|
+
known = [starts[pid] for pid in running[agent.name] if starts and pid in starts]
|
|
217
|
+
unwatched = [
|
|
218
|
+
(home / rel, pattern)
|
|
219
|
+
for rel, pattern in agent.transcripts
|
|
220
|
+
if (home / rel).is_dir() and not _watched(home / rel, watched)
|
|
221
|
+
]
|
|
222
|
+
if not unwatched:
|
|
223
|
+
continue
|
|
224
|
+
if not known:
|
|
225
|
+
incomplete.append(agent.name) # running, but no start time to tie a write to this run
|
|
226
|
+
continue
|
|
227
|
+
since = min(known) - START_SLACK_S # any write newer than a live instance's start
|
|
228
|
+
complete = True
|
|
229
|
+
for root, pattern in unwatched:
|
|
230
|
+
hit, scanned = _scan(root, pattern, since)
|
|
231
|
+
if hit:
|
|
232
|
+
found.append(f"{agent.name}: {root}")
|
|
233
|
+
break
|
|
234
|
+
complete = complete and scanned
|
|
235
|
+
else:
|
|
236
|
+
if not complete:
|
|
237
|
+
incomplete.append(agent.name)
|
|
238
|
+
return Census(found, incomplete)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def ps_process_starts(run: Callable[[list[str]], object], now: Callable[[], float] = time.time) -> ProcessStarts:
|
|
242
|
+
"""Start times (epoch seconds) from ``ps -o pid=,etime= -p <pids>``; None when ps cannot answer."""
|
|
243
|
+
|
|
244
|
+
def starts(pids: Sequence[int]) -> dict[int, float] | None:
|
|
245
|
+
result = run(["ps", "-o", "pid=,etime=", "-p", ",".join(str(pid) for pid in pids)])
|
|
246
|
+
if getattr(result, "returncode", 1) not in (0, 1): # 1: some PIDs already gone
|
|
247
|
+
return None
|
|
248
|
+
at, out = now(), {}
|
|
249
|
+
for line in str(getattr(result, "stdout", "") or "").splitlines():
|
|
250
|
+
parts = line.split()
|
|
251
|
+
elapsed = parse_etime(parts[1]) if len(parts) == 2 and parts[0].isdigit() else None
|
|
252
|
+
if elapsed is not None:
|
|
253
|
+
out[int(parts[0])] = at - elapsed
|
|
254
|
+
return out
|
|
255
|
+
|
|
256
|
+
return starts
|
|
@@ -20,6 +20,7 @@ from datetime import UTC, datetime
|
|
|
20
20
|
from pathlib import Path
|
|
21
21
|
from typing import Any, Callable, Iterator
|
|
22
22
|
|
|
23
|
+
from .agent_census import ps_process_starts, unindexed_agents
|
|
23
24
|
from .drain_liveness import (
|
|
24
25
|
DEFAULT_DRAIN_LIVENESS_STALE_SECONDS,
|
|
25
26
|
PROGRESS_STALLED_CODE,
|
|
@@ -198,6 +199,7 @@ class HealthCheckConfig:
|
|
|
198
199
|
missing_embedding_instruction_limit: int = 100_000
|
|
199
200
|
heal: bool = False
|
|
200
201
|
socket_timeout_seconds: float = 5.0
|
|
202
|
+
agent_home: Path | None = None # None: Path.home(); where the known-agent census looks
|
|
201
203
|
max_stalled_ticks: int = 2
|
|
202
204
|
heal_min_consecutive_failures: int = field(
|
|
203
205
|
default_factory=lambda: _env_int(
|
|
@@ -269,6 +271,8 @@ class HealthCheckResult:
|
|
|
269
271
|
slow_check_stage: str | None = None
|
|
270
272
|
t3_health: dict[str, Any] | None = None
|
|
271
273
|
jsonl_backup: JsonlBackupHealth | None = None
|
|
274
|
+
unindexed_agents: list[str] | None = None # found this check; None: the process table was not read
|
|
275
|
+
agent_census_incomplete: list[str] = field(default_factory=list) # agents not measured this check
|
|
272
276
|
|
|
273
277
|
def to_dict(self) -> dict[str, Any]:
|
|
274
278
|
return asdict(self)
|
|
@@ -1560,6 +1564,28 @@ def _run_health_check_locked(
|
|
|
1560
1564
|
"could not read the process table; daemon liveness and writer ownership were not evaluated",
|
|
1561
1565
|
)
|
|
1562
1566
|
else:
|
|
1567
|
+
home = config.agent_home or Path.home()
|
|
1568
|
+
census = unindexed_agents(
|
|
1569
|
+
ps_output,
|
|
1570
|
+
home=home,
|
|
1571
|
+
watch_roots=[root.resolved_path for root in default_watch_roots(home)],
|
|
1572
|
+
process_starts=ps_process_starts(command_runner),
|
|
1573
|
+
)
|
|
1574
|
+
result.unindexed_agents, result.agent_census_incomplete = census.found, census.incomplete
|
|
1575
|
+
if census.incomplete:
|
|
1576
|
+
add_issue(
|
|
1577
|
+
"agent_census_incomplete",
|
|
1578
|
+
"warning",
|
|
1579
|
+
"known-agent census incomplete this check for "
|
|
1580
|
+
+ ", ".join(census.incomplete)
|
|
1581
|
+
+ " (process start time unknown or transcript scan cut short); their last measured state holds",
|
|
1582
|
+
)
|
|
1583
|
+
if result.unindexed_agents:
|
|
1584
|
+
add_issue(
|
|
1585
|
+
"unindexed_agent_running",
|
|
1586
|
+
"warning",
|
|
1587
|
+
"an agent BrainLayer does not index is running: " + "; ".join(result.unindexed_agents),
|
|
1588
|
+
)
|
|
1563
1589
|
lock_holder = _read_writer_lock_holder(config.db_path, ps_output)
|
|
1564
1590
|
result.lock_holder = lock_holder
|
|
1565
1591
|
hotlane_processes = parse_hotlane_processes(ps_output)
|
|
@@ -58,7 +58,16 @@ CHECK_FOR_CODE = {
|
|
|
58
58
|
),
|
|
59
59
|
"embedding",
|
|
60
60
|
),
|
|
61
|
-
**dict.fromkeys(
|
|
61
|
+
**dict.fromkeys(
|
|
62
|
+
(
|
|
63
|
+
"watcher_stalled",
|
|
64
|
+
"watch_unloaded",
|
|
65
|
+
"t3_ingest_unhealthy",
|
|
66
|
+
"unindexed_agent_running",
|
|
67
|
+
"agent_census_incomplete",
|
|
68
|
+
),
|
|
69
|
+
"ingest",
|
|
70
|
+
),
|
|
62
71
|
**dict.fromkeys(
|
|
63
72
|
(
|
|
64
73
|
"queue_backed_up",
|
|
@@ -445,6 +454,15 @@ def classify_issues(result: HealthCheckResult) -> tuple[tuple[str, ...], tuple[N
|
|
|
445
454
|
return tuple(blind), tuple(notes), {name: "; ".join(dict.fromkeys(msgs)) for name, msgs in context.items()}
|
|
446
455
|
|
|
447
456
|
|
|
457
|
+
def codes_by_check(result: HealthCheckResult) -> dict[str, tuple[str, ...]]:
|
|
458
|
+
"""The ``CHECK_FOR_CODE`` codes that fed each check's context, codes only."""
|
|
459
|
+
codes: dict[str, list[str]] = {}
|
|
460
|
+
for issue in result.issues:
|
|
461
|
+
if issue.code not in BLIND_CODES and (check := CHECK_FOR_CODE.get(issue.code)):
|
|
462
|
+
codes.setdefault(check, []).append(issue.code)
|
|
463
|
+
return {name: tuple(dict.fromkeys(found)) for name, found in codes.items()}
|
|
464
|
+
|
|
465
|
+
|
|
448
466
|
def search_canary_fact(result: HealthCheckResult, now: datetime) -> Any:
|
|
449
467
|
"""The canary health_check already ran. A failure excused by a valid snapshot episode is unobserved."""
|
|
450
468
|
from .badge_state import _expected_episode
|
|
@@ -600,6 +618,10 @@ def collect_facts(
|
|
|
600
618
|
drive_auth=drive_auth,
|
|
601
619
|
watcher_updated_at=got["watcher"],
|
|
602
620
|
ingest_paused=paused(config.watch_label),
|
|
621
|
+
unindexed_agents=tuple(result.unindexed_agents) if result.unindexed_agents is not None else UNOBSERVED,
|
|
622
|
+
census_incomplete=tuple(result.agent_census_incomplete),
|
|
623
|
+
stores_paused=drain_paused,
|
|
624
|
+
pause_ends_at=_aware(pause_payload.get("expires_at")) if pause_active else None,
|
|
603
625
|
oldest_pending_store_at=pending,
|
|
604
626
|
store_canary_ok=canary,
|
|
605
627
|
search_canary_ok=search_canary_fact(result, now),
|
|
@@ -613,6 +635,7 @@ def collect_facts(
|
|
|
613
635
|
blind_codes=blind,
|
|
614
636
|
notes=notes,
|
|
615
637
|
check_notes=context,
|
|
638
|
+
check_codes=codes_by_check(result),
|
|
616
639
|
)
|
|
617
640
|
state = {"store_canary_seen": canary_seen, "embedding": embedding_state, "drain_paused_seen_at": _iso(pause_seen)}
|
|
618
641
|
state["disk_measurement"] = disk_state
|
|
@@ -114,6 +114,10 @@ class Facts:
|
|
|
114
114
|
integrity: Any = UNOBSERVED # "ok" | "corrupt" (confirmed results only)
|
|
115
115
|
watcher_updated_at: Any = UNOBSERVED
|
|
116
116
|
ingest_paused: bool = False
|
|
117
|
+
unindexed_agents: Any = UNOBSERVED # ("<agent>: <root>", ...) found by the known-agent census this check
|
|
118
|
+
census_incomplete: tuple[str, ...] = () # agents the census could not measure this check
|
|
119
|
+
stores_paused: bool = False
|
|
120
|
+
pause_ends_at: datetime | None = None # the pause sentinel's expires_at while a pause is active
|
|
117
121
|
oldest_pending_store_at: Any = UNOBSERVED
|
|
118
122
|
store_canary_ok: Any = UNOBSERVED # True only for a persisted, retrieved round trip
|
|
119
123
|
search_canary_ok: Any = UNOBSERVED
|
|
@@ -127,6 +131,7 @@ class Facts:
|
|
|
127
131
|
blind_codes: tuple[str, ...] = ()
|
|
128
132
|
notes: tuple[Note, ...] = ()
|
|
129
133
|
check_notes: Mapping[str, str] = field(default_factory=dict)
|
|
134
|
+
check_codes: Mapping[str, tuple[str, ...]] = field(default_factory=dict)
|
|
130
135
|
|
|
131
136
|
|
|
132
137
|
@dataclass(frozen=True)
|
|
@@ -137,9 +142,12 @@ class Check:
|
|
|
137
142
|
threshold_s: float | None
|
|
138
143
|
since: str | None
|
|
139
144
|
note: str # bare sentence; consumers add CHECK_LABELS[name]
|
|
145
|
+
# Read-only display fields (seam PR-1). A key is present only on the checks it applies to.
|
|
146
|
+
typed: Mapping[str, Any] = field(default_factory=dict, hash=False)
|
|
140
147
|
|
|
141
148
|
def to_dict(self) -> dict[str, Any]:
|
|
142
|
-
|
|
149
|
+
base = {k: getattr(self, k) for k in ("name", "state", "age_s", "threshold_s", "since", "note")}
|
|
150
|
+
return {**base, **self.typed}
|
|
143
151
|
|
|
144
152
|
|
|
145
153
|
@dataclass(frozen=True)
|
|
@@ -184,6 +192,7 @@ CHECK_LABELS = {
|
|
|
184
192
|
}
|
|
185
193
|
_HYSTERESIS = frozenset({"ingest", "stores", "search"})
|
|
186
194
|
_WAKE_GRACE = frozenset({"backup_local", "backup_offsite", "transcripts"})
|
|
195
|
+
_PAUSED_FACT = {"ingest": "ingest_paused", "stores": "stores_paused"}
|
|
187
196
|
|
|
188
197
|
|
|
189
198
|
def _iso(value: datetime | None) -> str | None:
|
|
@@ -219,6 +228,7 @@ class _Raw:
|
|
|
219
228
|
keep: dict[str, Any] = field(default_factory=dict) # extra persisted fields (counters, latches)
|
|
220
229
|
evidence: bool = True # False: nothing new was observed, so this tick cannot show recovery
|
|
221
230
|
graced: bool = False # the state is milder than the real age only because the monitor was not running
|
|
231
|
+
typed: dict[str, Any] = field(default_factory=dict) # display-only fields; never read by the policy
|
|
222
232
|
|
|
223
233
|
|
|
224
234
|
def _age_state(age: float, amber: float, red: float) -> str:
|
|
@@ -439,6 +449,31 @@ def _raw_checks(
|
|
|
439
449
|
if facts.ingest_paused and r.state == RED:
|
|
440
450
|
r.state, r.note = AMBER, r.note + " (watcher paused by maintenance)"
|
|
441
451
|
raw["ingest"] = r
|
|
452
|
+
# Known-agent census: only a measured census replaces the last one; an unmeasured tick holds it.
|
|
453
|
+
prior_census = p("ingest").get("census")
|
|
454
|
+
prior_census = list(prior_census) if isinstance(prior_census, list) else None
|
|
455
|
+
unmeasured = facts.unindexed_agents is UNOBSERVED
|
|
456
|
+
partial = not unmeasured and bool(facts.census_incomplete)
|
|
457
|
+
if unmeasured:
|
|
458
|
+
census = prior_census
|
|
459
|
+
else:
|
|
460
|
+
# Per agent: a measured agent replaces its prior entry; an unmeasured one keeps it.
|
|
461
|
+
held = [e for e in prior_census or () if e.split(":", 1)[0] in facts.census_incomplete]
|
|
462
|
+
census = list(dict.fromkeys([*held, *facts.unindexed_agents]))
|
|
463
|
+
ingest = raw["ingest"]
|
|
464
|
+
if census:
|
|
465
|
+
if ingest.state in (GREEN, UNKNOWN):
|
|
466
|
+
ingest.state = AMBER
|
|
467
|
+
found = "an agent BrainLayer does not index is running: " + "; ".join(census)
|
|
468
|
+
if unmeasured:
|
|
469
|
+
found += " (census not measured this check; holds until a measured census clears it)"
|
|
470
|
+
elif partial:
|
|
471
|
+
found += f" (census incomplete for {', '.join(facts.census_incomplete)}; their last measured state holds)"
|
|
472
|
+
ingest.note = f"{ingest.note}; {found}" if ingest.note else found
|
|
473
|
+
if census is not None:
|
|
474
|
+
ingest.keep["census"] = census
|
|
475
|
+
ingest.typed["unindexed_agents"] = census
|
|
476
|
+
ingest.typed["census_incomplete"] = None if unmeasured else list(facts.census_incomplete)
|
|
442
477
|
|
|
443
478
|
raw["embedding"] = _stall_age(
|
|
444
479
|
facts.embedding_stalled_since,
|
|
@@ -470,6 +505,18 @@ def _raw_checks(
|
|
|
470
505
|
parts = [pending] + ([canary] if canary.state != UNKNOWN else [])
|
|
471
506
|
known = [r for r in parts if r.state != UNKNOWN] or parts
|
|
472
507
|
worst = max(known, key=lambda r: _RANK[r.state])
|
|
508
|
+
deciders = [r for r in known if _RANK[r.state] == _RANK[worst.state]]
|
|
509
|
+
cause = (
|
|
510
|
+
"blind"
|
|
511
|
+
if worst.state == UNKNOWN
|
|
512
|
+
else "none"
|
|
513
|
+
if worst.state == GREEN
|
|
514
|
+
else "both"
|
|
515
|
+
if len(deciders) == 2
|
|
516
|
+
else "queue"
|
|
517
|
+
if deciders[0] is pending
|
|
518
|
+
else "round_trip"
|
|
519
|
+
)
|
|
473
520
|
# A canary failure is owed a successful round trip: an empty queue never repays it.
|
|
474
521
|
owed = bool(prior_stores.get("canary_owed")) or canary.keep["fails"] > 0
|
|
475
522
|
canary_ok = facts.store_canary_ok is True
|
|
@@ -484,6 +531,7 @@ def _raw_checks(
|
|
|
484
531
|
{**pending.keep, **canary.keep, "canary_owed": owed},
|
|
485
532
|
evidence=evidence,
|
|
486
533
|
graced=pending.graced,
|
|
534
|
+
typed={"cause": cause},
|
|
487
535
|
)
|
|
488
536
|
raw["search"] = _counter(facts.search_canary_ok, p("search"), t.canary_red_failures)
|
|
489
537
|
|
|
@@ -613,7 +661,6 @@ def evaluate(facts: Facts, prior: Mapping[str, Any] | None = None, thresholds: T
|
|
|
613
661
|
since = _iso(since_at)
|
|
614
662
|
else:
|
|
615
663
|
since = before.get("since") if state == prior_state and before.get("since") else _iso(now)
|
|
616
|
-
checks.append(Check(name, state, r.age_s, r.threshold_s, since, note))
|
|
617
664
|
state_checks[name] = {
|
|
618
665
|
"state": state,
|
|
619
666
|
"since": since,
|
|
@@ -624,6 +671,26 @@ def evaluate(facts: Facts, prior: Mapping[str, Any] | None = None, thresholds: T
|
|
|
624
671
|
}
|
|
625
672
|
if deadline is not None:
|
|
626
673
|
state_checks[name]["catch_up_until"] = _iso(deadline)
|
|
674
|
+
typed: dict[str, Any] = {
|
|
675
|
+
"unknown_ticks": unknown_ticks,
|
|
676
|
+
"blind": r.state == UNKNOWN,
|
|
677
|
+
"clock": state_checks[name]["clock"],
|
|
678
|
+
"context_codes": sorted(set(facts.check_codes.get(name, ()))),
|
|
679
|
+
}
|
|
680
|
+
if name in _WAKE_GRACE:
|
|
681
|
+
typed["catch_up_until"] = state_checks[name].get("catch_up_until")
|
|
682
|
+
if name in _HYSTERESIS:
|
|
683
|
+
typed.update(good_ticks=good_ticks, good_ticks_needed=t.recovery_good_ticks)
|
|
684
|
+
if name in ("search", "stores"):
|
|
685
|
+
typed["fails"] = int(r.keep.get("fails") or 0)
|
|
686
|
+
if name in _PAUSED_FACT:
|
|
687
|
+
paused = bool(getattr(facts, _PAUSED_FACT[name]))
|
|
688
|
+
typed.update(
|
|
689
|
+
paused_by_maintenance=paused, pause_ends_at=_iso(_aware(facts.pause_ends_at)) if paused else None
|
|
690
|
+
)
|
|
691
|
+
if name == "monitor":
|
|
692
|
+
typed["blind_codes"] = sorted(set(facts.blind_codes))
|
|
693
|
+
checks.append(Check(name, state, r.age_s, r.threshold_s, since, note, {**typed, **r.typed}))
|
|
627
694
|
if name == "stores" and state == GREEN:
|
|
628
695
|
state_checks[name]["canary_owed"] = False # recovery completed on a successful round trip
|
|
629
696
|
worst = max((check.state for check in checks), key=lambda s: _RANK[s] if s != UNKNOWN else 0)
|