phase-loop-runtime 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- phase_loop_runtime/__init__.py +20 -0
- phase_loop_runtime/_contract_docs/phase-loop/extraction-readiness.md +90 -0
- phase_loop_runtime/_contract_docs/phase-loop/granular-execution-policy.md +137 -0
- phase_loop_runtime/_contract_docs/phase-loop/harness-capability-matrix.md +510 -0
- phase_loop_runtime/_contract_docs/phase-loop/harness-skill-matrix.md +125 -0
- phase_loop_runtime/_contract_docs/phase-loop/harness-substrate-manifest.md +232 -0
- phase_loop_runtime/_contract_docs/phase-loop/pi-loop-control.md +247 -0
- phase_loop_runtime/_contract_docs/phase-loop/protocol.md +2759 -0
- phase_loop_runtime/_contract_docs/phase-loop/runtime-boundary.md +289 -0
- phase_loop_runtime/_contract_docs/phase-loop/spec-discovery-roots.md +47 -0
- phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-governed-pipeline.md +42 -0
- phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-portal-projection.md +34 -0
- phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-regenesis.md +29 -0
- phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-report.md +32 -0
- phase_loop_runtime/_contract_docs/runtime/verification-evidence-contract.md +52 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-mixed-signals/commands.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-mixed-signals/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-mixed-signals/mixed.json +5 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-provider-timeout/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-provider-timeout/timeout-note.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-redacted-summary/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-redacted-summary/redacted-summary.json +6 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-small-sample/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-small-sample/sample.json +7 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-threshold-edge/edge.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-threshold-edge/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/shot-a.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/shot-b.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/shot-c.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-missing-references/claimed-results.json +5 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-missing-references/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-subtle-low-variance/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-subtle-low-variance/metrics.json +9 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-templated-prose/findings.md +10 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-templated-prose/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-uniform-scores/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-uniform-scores/scores.json +4 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-uniform-scores/summary.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-adoption-bundle/bundle-check.json +8 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-adoption-bundle/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-adoption-bundle/operator-note.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-handoff-ledger/events-sample.jsonl +3 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-handoff-ledger/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-handoff-ledger/receipt.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-runner-diff/evidence.json +13 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-runner-diff/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-runner-diff/summary.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-test-matrix/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-test-matrix/matrix.json +9 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-test-matrix/notes.md +4 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-ui-screenshot-standin/console-summary.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-ui-screenshot-standin/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-ui-screenshot-standin/screenshot-standin.ppm +5 -0
- phase_loop_runtime/adoption_bundle.py +273 -0
- phase_loop_runtime/advisor_board/CONTRACTS.md +257 -0
- phase_loop_runtime/advisor_board/__init__.py +288 -0
- phase_loop_runtime/advisor_board/backing.py +137 -0
- phase_loop_runtime/advisor_board/backing_omnigent.py +498 -0
- phase_loop_runtime/advisor_board/config.py +225 -0
- phase_loop_runtime/advisor_board/events.py +115 -0
- phase_loop_runtime/advisor_board/fixtures/advisor-boards.example.toml +59 -0
- phase_loop_runtime/advisor_board/fixtures.py +91 -0
- phase_loop_runtime/advisor_board/harness_mapping.py +125 -0
- phase_loop_runtime/advisor_board/matrix.py +146 -0
- phase_loop_runtime/advisor_board/observability.py +481 -0
- phase_loop_runtime/advisor_board/presets.py +188 -0
- phase_loop_runtime/advisor_board/registries.py +309 -0
- phase_loop_runtime/advisor_board/resolver.py +253 -0
- phase_loop_runtime/advisor_board/schema.py +269 -0
- phase_loop_runtime/advisor_board/standin.py +166 -0
- phase_loop_runtime/advisor_board/validation.py +159 -0
- phase_loop_runtime/agent_runtime_provider.py +676 -0
- phase_loop_runtime/baml_modular.py +656 -0
- phase_loop_runtime/baml_src/dotfiles_adoption_manifest.baml +37 -0
- phase_loop_runtime/baml_src/dotfiles_c4_document.baml +14 -0
- phase_loop_runtime/baml_src/dotfiles_plan_manifest.baml +50 -0
- phase_loop_runtime/baml_src/dotfiles_runtime_projection.baml +16 -0
- phase_loop_runtime/baml_src/dotfiles_task_catalog.baml +20 -0
- phase_loop_runtime/baml_src/emit_phase_closeout.baml +86 -0
- phase_loop_runtime/baml_src/evaluate_suspected_fake_evidence.baml +36 -0
- phase_loop_runtime/baml_src/verification_evidence.baml +40 -0
- phase_loop_runtime/broker.py +181 -0
- phase_loop_runtime/build_bundle.py +294 -0
- phase_loop_runtime/capability_registry.py +835 -0
- phase_loop_runtime/classifier.py +87 -0
- phase_loop_runtime/claude_agent_view.py +625 -0
- phase_loop_runtime/claude_channel_sidecar.py +1086 -0
- phase_loop_runtime/cli.py +2599 -0
- phase_loop_runtime/closeout.py +865 -0
- phase_loop_runtime/closeout_classifier.py +120 -0
- phase_loop_runtime/closeout_evidence_audit.py +112 -0
- phase_loop_runtime/closeout_validation.py +144 -0
- phase_loop_runtime/closeout_validators.py +203 -0
- phase_loop_runtime/consiliency_gates.py +374 -0
- phase_loop_runtime/consiliency_ingest.py +399 -0
- phase_loop_runtime/consiliency_layout.py +176 -0
- phase_loop_runtime/consiliency_scaffold.py +305 -0
- phase_loop_runtime/cross_repo_channel.py +331 -0
- phase_loop_runtime/discovery.py +2368 -0
- phase_loop_runtime/dispatch_lock.py +167 -0
- phase_loop_runtime/doc_delta_validator.py +98 -0
- phase_loop_runtime/docs_audit.py +285 -0
- phase_loop_runtime/docs_freshness.py +468 -0
- phase_loop_runtime/docs_surfaces.py +150 -0
- phase_loop_runtime/dotfiles_profile_plugin.py +96 -0
- phase_loop_runtime/events.py +154 -0
- phase_loop_runtime/events_migration.py +96 -0
- phase_loop_runtime/evidence_audit.py +1082 -0
- phase_loop_runtime/evidence_audit_config.py +172 -0
- phase_loop_runtime/fleet_map.py +426 -0
- phase_loop_runtime/fleet_metrics.py +298 -0
- phase_loop_runtime/fleet_metrics_export.py +196 -0
- phase_loop_runtime/git_discipline.py +479 -0
- phase_loop_runtime/git_ops.py +122 -0
- phase_loop_runtime/git_topology.py +252 -0
- phase_loop_runtime/governed_bundle.py +137 -0
- phase_loop_runtime/governed_premerge.py +219 -0
- phase_loop_runtime/governed_review.py +264 -0
- phase_loop_runtime/handoff.py +932 -0
- phase_loop_runtime/handoff_path.py +14 -0
- phase_loop_runtime/injection.py +740 -0
- phase_loop_runtime/install_status.py +88 -0
- phase_loop_runtime/lane_scheduler.py +317 -0
- phase_loop_runtime/launcher.py +2760 -0
- phase_loop_runtime/lease_store.py +553 -0
- phase_loop_runtime/maintenance.py +401 -0
- phase_loop_runtime/migrate_handoffs.py +201 -0
- phase_loop_runtime/models.py +2144 -0
- phase_loop_runtime/observability.py +1290 -0
- phase_loop_runtime/panel_invoker.py +1638 -0
- phase_loop_runtime/phase_loop_drift_audit.py +388 -0
- phase_loop_runtime/phase_worktree_executor.py +433 -0
- phase_loop_runtime/pipeline_adapter/__init__.py +12 -0
- phase_loop_runtime/pipeline_adapter/branch_ops.py +274 -0
- phase_loop_runtime/pipeline_adapter/flag.py +55 -0
- phase_loop_runtime/pipeline_adapter/markers.py +13 -0
- phase_loop_runtime/pipeline_adapter/merge_policy.py +72 -0
- phase_loop_runtime/pipeline_adapter/ratification.py +100 -0
- phase_loop_runtime/pipeline_adapter/sibling_matcher.py +123 -0
- phase_loop_runtime/plan_ir.py +523 -0
- phase_loop_runtime/plan_manifest.py +415 -0
- phase_loop_runtime/planner_validation.py +176 -0
- phase_loop_runtime/profiles.py +462 -0
- phase_loop_runtime/prompts.py +365 -0
- phase_loop_runtime/provenance.py +165 -0
- phase_loop_runtime/publishing.py +339 -0
- phase_loop_runtime/py.typed +1 -0
- phase_loop_runtime/reconcile.py +1550 -0
- phase_loop_runtime/redaction.py +184 -0
- phase_loop_runtime/reflection_sync.py +293 -0
- phase_loop_runtime/release_guard.py +186 -0
- phase_loop_runtime/render.py +432 -0
- phase_loop_runtime/repo_validation.py +427 -0
- phase_loop_runtime/review_summary.py +150 -0
- phase_loop_runtime/roadmap_lint.py +425 -0
- phase_loop_runtime/route_log.py +59 -0
- phase_loop_runtime/route_policy/__init__.py +11 -0
- phase_loop_runtime/route_policy/fixtures/route_selection.golden.json +263 -0
- phase_loop_runtime/runner.py +8400 -0
- phase_loop_runtime/runtime_paths.py +225 -0
- phase_loop_runtime/runtime_projection.py +113 -0
- phase_loop_runtime/runtime_resources.py +36 -0
- phase_loop_runtime/schema_export.py +292 -0
- phase_loop_runtime/schemas/phase_loop_closeout.schema.json +366 -0
- phase_loop_runtime/skill_install.py +176 -0
- phase_loop_runtime/skill_inventory.py +662 -0
- phase_loop_runtime/skill_paths.py +42 -0
- phase_loop_runtime/skill_sources_plugin.py +37 -0
- phase_loop_runtime/skills_bundle/claude-advisor-board/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-advisor-board/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/claude-advisor-panel/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-advisor-panel/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/claude-execute-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-execute-detailed/SKILL.md +152 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/SKILL.md +745 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/allocate_worktree_name.sh +33 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/audit_lane_file_touches.py +197 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/state.py +274 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/team_teardown.sh +32 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/validate_plan_doc.py +642 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/verify_harness.sh +96 -0
- phase_loop_runtime/skills_bundle/claude-phase-loop/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-phase-loop/SKILL.md +115 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/SKILL.md +439 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/assets/review_prompt.md +19 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/references/roadmap-template.md +193 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
- phase_loop_runtime/skills_bundle/claude-plan-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-plan-detailed/SKILL.md +334 -0
- phase_loop_runtime/skills_bundle/claude-plan-detailed/assets/review_prompt.md +25 -0
- phase_loop_runtime/skills_bundle/claude-plan-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-plan-phase/SKILL.md +776 -0
- phase_loop_runtime/skills_bundle/claude-plan-phase/assets/review_prompt.md +17 -0
- phase_loop_runtime/skills_bundle/claude-plan-phase/scripts/validate_plan_doc.py +1092 -0
- phase_loop_runtime/skills_bundle/claude-run-train/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-run-train/SKILL.md +75 -0
- phase_loop_runtime/skills_bundle/claude-skill-editor/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-skill-editor/SKILL.md +243 -0
- phase_loop_runtime/skills_bundle/claude-skill-editor/assets/editor_prompt.md +72 -0
- phase_loop_runtime/skills_bundle/claude-skill-improvement-planner/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-skill-improvement-planner/SKILL.md +249 -0
- phase_loop_runtime/skills_bundle/claude-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
- phase_loop_runtime/skills_bundle/claude-task-contextualizer/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-task-contextualizer/SKILL.md +74 -0
- phase_loop_runtime/skills_bundle/claude-task-contextualizer/references/task-templates.md +103 -0
- phase_loop_runtime/skills_bundle/codex-advisor-board/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-advisor-board/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/codex-advisor-panel/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-advisor-panel/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/codex-execute-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-execute-detailed/SKILL.md +154 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/SKILL.md +231 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/allocate_worktree_name.sh +33 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/audit_lane_file_touches.py +197 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/state.py +274 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/team_teardown.sh +32 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/validate_plan_doc.py +642 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/verify_harness.sh +96 -0
- phase_loop_runtime/skills_bundle/codex-phase-loop/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-phase-loop/SKILL.md +248 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/SKILL.md +150 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/assets/review_prompt.md +19 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/references/roadmap-template.md +193 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
- phase_loop_runtime/skills_bundle/codex-plan-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-plan-detailed/SKILL.md +119 -0
- phase_loop_runtime/skills_bundle/codex-plan-detailed/assets/review_prompt.md +25 -0
- phase_loop_runtime/skills_bundle/codex-plan-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-plan-phase/SKILL.md +307 -0
- phase_loop_runtime/skills_bundle/codex-plan-phase/assets/review_prompt.md +17 -0
- phase_loop_runtime/skills_bundle/codex-plan-phase/scripts/validate_plan_doc.py +1092 -0
- phase_loop_runtime/skills_bundle/codex-run-train/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-run-train/SKILL.md +75 -0
- phase_loop_runtime/skills_bundle/codex-skill-editor/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-skill-editor/SKILL.md +94 -0
- phase_loop_runtime/skills_bundle/codex-skill-editor/assets/editor_prompt.md +72 -0
- phase_loop_runtime/skills_bundle/codex-skill-improvement-planner/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-skill-improvement-planner/SKILL.md +114 -0
- phase_loop_runtime/skills_bundle/codex-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
- phase_loop_runtime/skills_bundle/codex-task-contextualizer/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-task-contextualizer/SKILL.md +102 -0
- phase_loop_runtime/skills_bundle/codex-task-contextualizer/references/task-templates.md +103 -0
- phase_loop_runtime/skills_bundle/gemini-advisor-board/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-advisor-board/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/gemini-advisor-panel/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-advisor-panel/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/gemini-execute-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-execute-detailed/SKILL.md +144 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/SKILL.md +198 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/allocate_worktree_name.sh +33 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/audit_lane_file_touches.py +197 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/state.py +274 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/team_teardown.sh +32 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/validate_plan_doc.py +642 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/verify_harness.sh +96 -0
- phase_loop_runtime/skills_bundle/gemini-phase-loop/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-phase-loop/SKILL.md +111 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/SKILL.md +147 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/assets/review_prompt.md +19 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/references/roadmap-template.md +193 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
- phase_loop_runtime/skills_bundle/gemini-plan-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-plan-detailed/SKILL.md +119 -0
- phase_loop_runtime/skills_bundle/gemini-plan-detailed/assets/review_prompt.md +25 -0
- phase_loop_runtime/skills_bundle/gemini-plan-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-plan-phase/SKILL.md +217 -0
- phase_loop_runtime/skills_bundle/gemini-plan-phase/assets/review_prompt.md +17 -0
- phase_loop_runtime/skills_bundle/gemini-plan-phase/scripts/validate_plan_doc.py +1092 -0
- phase_loop_runtime/skills_bundle/gemini-run-train/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-run-train/SKILL.md +75 -0
- phase_loop_runtime/skills_bundle/gemini-skill-editor/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-skill-editor/SKILL.md +87 -0
- phase_loop_runtime/skills_bundle/gemini-skill-editor/assets/editor_prompt.md +72 -0
- phase_loop_runtime/skills_bundle/gemini-skill-improvement-planner/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-skill-improvement-planner/SKILL.md +109 -0
- phase_loop_runtime/skills_bundle/gemini-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
- phase_loop_runtime/skills_bundle/gemini-task-contextualizer/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-task-contextualizer/SKILL.md +98 -0
- phase_loop_runtime/skills_bundle/gemini-task-contextualizer/references/task-templates.md +103 -0
- phase_loop_runtime/skills_bundle/opencode-advisor-board/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-advisor-board/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/opencode-advisor-panel/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-advisor-panel/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/opencode-execute-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-execute-detailed/SKILL.md +144 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/SKILL.md +196 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/allocate_worktree_name.sh +33 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/audit_lane_file_touches.py +197 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/state.py +274 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/team_teardown.sh +32 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/validate_plan_doc.py +642 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/verify_harness.sh +96 -0
- phase_loop_runtime/skills_bundle/opencode-phase-loop/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-phase-loop/SKILL.md +113 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/SKILL.md +147 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/assets/review_prompt.md +19 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/references/roadmap-template.md +193 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
- phase_loop_runtime/skills_bundle/opencode-plan-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-plan-detailed/SKILL.md +119 -0
- phase_loop_runtime/skills_bundle/opencode-plan-detailed/assets/review_prompt.md +25 -0
- phase_loop_runtime/skills_bundle/opencode-plan-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-plan-phase/SKILL.md +211 -0
- phase_loop_runtime/skills_bundle/opencode-plan-phase/assets/review_prompt.md +17 -0
- phase_loop_runtime/skills_bundle/opencode-plan-phase/scripts/validate_plan_doc.py +1092 -0
- phase_loop_runtime/skills_bundle/opencode-run-train/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-run-train/SKILL.md +75 -0
- phase_loop_runtime/skills_bundle/opencode-skill-editor/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-skill-editor/SKILL.md +87 -0
- phase_loop_runtime/skills_bundle/opencode-skill-editor/assets/editor_prompt.md +72 -0
- phase_loop_runtime/skills_bundle/opencode-skill-improvement-planner/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-skill-improvement-planner/SKILL.md +109 -0
- phase_loop_runtime/skills_bundle/opencode-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
- phase_loop_runtime/skills_bundle/opencode-task-contextualizer/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-task-contextualizer/SKILL.md +98 -0
- phase_loop_runtime/skills_bundle/opencode-task-contextualizer/references/task-templates.md +103 -0
- phase_loop_runtime/state.py +156 -0
- phase_loop_runtime/state_degradation.py +136 -0
- phase_loop_runtime/state_ops.py +676 -0
- phase_loop_runtime/train_ledger.py +215 -0
- phase_loop_runtime/train_roadmap.py +339 -0
- phase_loop_runtime/train_runner.py +1197 -0
- phase_loop_runtime/verification_evidence.py +650 -0
- phase_loop_runtime/verification_evidence_validator.py +75 -0
- phase_loop_runtime/visual_evidence_validator.py +36 -0
- phase_loop_runtime/worker_pool.py +123 -0
- phase_loop_runtime/worktree_index.py +270 -0
- phase_loop_runtime-0.2.0.data/data/share/phase-loop-runtime/protocol/protocol.md +2475 -0
- phase_loop_runtime-0.2.0.dist-info/METADATA +106 -0
- phase_loop_runtime-0.2.0.dist-info/RECORD +370 -0
- phase_loop_runtime-0.2.0.dist-info/WHEEL +5 -0
- phase_loop_runtime-0.2.0.dist-info/entry_points.txt +9 -0
- phase_loop_runtime-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass, field
|
|
4
|
+
from datetime import datetime, timedelta, timezone
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any, Iterable
|
|
8
|
+
|
|
9
|
+
from .models import BLOCKER_CLASSES, CLOSEOUT_SCHEMA, DISPATCH_CAPABILITIES, EXECUTORS, PHASE_STATUSES
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
VERIFICATION_STATUSES = tuple(CLOSEOUT_SCHEMA["properties"]["verification_status"]["enum"])
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(frozen=True)
|
|
16
|
+
class DriftFinding:
|
|
17
|
+
repo: str
|
|
18
|
+
field: str
|
|
19
|
+
literal: str
|
|
20
|
+
source: str
|
|
21
|
+
first_seen: str | None = None
|
|
22
|
+
|
|
23
|
+
def key(self) -> tuple[str, str, str]:
|
|
24
|
+
return (self.repo, self.field, self.literal)
|
|
25
|
+
|
|
26
|
+
def to_json(self) -> dict[str, Any]:
|
|
27
|
+
return {
|
|
28
|
+
"repo": self.repo,
|
|
29
|
+
"field": self.field,
|
|
30
|
+
"literal": self.literal,
|
|
31
|
+
"source": self.source,
|
|
32
|
+
"first_seen": self.first_seen,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass(frozen=True)
|
|
37
|
+
class DriftCount:
|
|
38
|
+
repo: str
|
|
39
|
+
field: str
|
|
40
|
+
literal: str
|
|
41
|
+
count: int
|
|
42
|
+
first_seen: str | None
|
|
43
|
+
sources: tuple[str, ...]
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> dict[str, Any]:
|
|
46
|
+
return {
|
|
47
|
+
"repo": self.repo,
|
|
48
|
+
"field": self.field,
|
|
49
|
+
"literal": self.literal,
|
|
50
|
+
"count": self.count,
|
|
51
|
+
"first_seen": self.first_seen,
|
|
52
|
+
"sources": list(self.sources),
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@dataclass(frozen=True)
|
|
57
|
+
class SetupDiagnostic:
|
|
58
|
+
repo: str
|
|
59
|
+
message: str
|
|
60
|
+
|
|
61
|
+
def to_json(self) -> dict[str, str]:
|
|
62
|
+
return {"repo": self.repo, "message": self.message}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@dataclass(frozen=True)
|
|
66
|
+
class RepoScanSummary:
|
|
67
|
+
repo: str
|
|
68
|
+
terminal_summaries_scanned: int = 0
|
|
69
|
+
events_scanned: int = 0
|
|
70
|
+
malformed_events: int = 0
|
|
71
|
+
|
|
72
|
+
def to_json(self) -> dict[str, Any]:
|
|
73
|
+
return {
|
|
74
|
+
"repo": self.repo,
|
|
75
|
+
"terminal_summaries_scanned": self.terminal_summaries_scanned,
|
|
76
|
+
"events_scanned": self.events_scanned,
|
|
77
|
+
"malformed_events": self.malformed_events,
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@dataclass(frozen=True)
|
|
82
|
+
class DriftAuditResult:
|
|
83
|
+
repos: tuple[RepoScanSummary, ...]
|
|
84
|
+
days: int
|
|
85
|
+
scope: str
|
|
86
|
+
cutoff_timestamp: str
|
|
87
|
+
allowlists: dict[str, tuple[str, ...]]
|
|
88
|
+
drift_counts: tuple[DriftCount, ...] = field(default_factory=tuple)
|
|
89
|
+
setup_diagnostics: tuple[SetupDiagnostic, ...] = field(default_factory=tuple)
|
|
90
|
+
|
|
91
|
+
def has_drift(self) -> bool:
|
|
92
|
+
return bool(self.drift_counts)
|
|
93
|
+
|
|
94
|
+
def has_setup_errors(self) -> bool:
|
|
95
|
+
return bool(self.setup_diagnostics)
|
|
96
|
+
|
|
97
|
+
def is_clean(self) -> bool:
|
|
98
|
+
return not self.has_drift() and not self.has_setup_errors()
|
|
99
|
+
|
|
100
|
+
def to_json(self) -> dict[str, Any]:
|
|
101
|
+
return {
|
|
102
|
+
"days": self.days,
|
|
103
|
+
"scope": self.scope,
|
|
104
|
+
"cutoff_timestamp": self.cutoff_timestamp,
|
|
105
|
+
"allowlists": {key: list(values) for key, values in sorted(self.allowlists.items())},
|
|
106
|
+
"repos": [repo.to_json() for repo in self.repos],
|
|
107
|
+
"counts": {
|
|
108
|
+
"repos": len(self.repos),
|
|
109
|
+
"drift_findings": sum(item.count for item in self.drift_counts),
|
|
110
|
+
"setup_errors": len(self.setup_diagnostics),
|
|
111
|
+
},
|
|
112
|
+
"drift": [item.to_json() for item in self.drift_counts],
|
|
113
|
+
"setup_diagnostics": [item.to_json() for item in self.setup_diagnostics],
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
def render_text(self) -> str:
|
|
117
|
+
lines = [
|
|
118
|
+
"Closeout Drift Audit",
|
|
119
|
+
f"scope: {self.scope}",
|
|
120
|
+
f"days: {self.days}",
|
|
121
|
+
f"cutoff: {self.cutoff_timestamp}",
|
|
122
|
+
"",
|
|
123
|
+
]
|
|
124
|
+
for repo in self.repos:
|
|
125
|
+
lines.extend(
|
|
126
|
+
[
|
|
127
|
+
f"Repo: {repo.repo}",
|
|
128
|
+
f" terminal summaries scanned: {repo.terminal_summaries_scanned}",
|
|
129
|
+
f" events scanned: {repo.events_scanned}",
|
|
130
|
+
f" malformed events: {repo.malformed_events}",
|
|
131
|
+
]
|
|
132
|
+
)
|
|
133
|
+
if self.setup_diagnostics:
|
|
134
|
+
lines.append("")
|
|
135
|
+
lines.append("Setup diagnostics:")
|
|
136
|
+
for diagnostic in self.setup_diagnostics:
|
|
137
|
+
lines.append(f" {diagnostic.repo}: {diagnostic.message}")
|
|
138
|
+
lines.append("")
|
|
139
|
+
if not self.drift_counts:
|
|
140
|
+
lines.append("Drift: none")
|
|
141
|
+
return "\n".join(lines)
|
|
142
|
+
lines.append("Drift:")
|
|
143
|
+
current_field = None
|
|
144
|
+
for count in self.drift_counts:
|
|
145
|
+
if count.field != current_field:
|
|
146
|
+
current_field = count.field
|
|
147
|
+
lines.append(f" {count.field}:")
|
|
148
|
+
first_seen = count.first_seen or "unknown"
|
|
149
|
+
lines.append(f" {count.literal}: count={count.count} first_seen={first_seen} repo={count.repo}")
|
|
150
|
+
return "\n".join(lines)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def run_drift_audit(repos: Iterable[str | Path], days: int, scope: str) -> DriftAuditResult:
|
|
154
|
+
if days < 0:
|
|
155
|
+
return DriftAuditResult(
|
|
156
|
+
repos=(),
|
|
157
|
+
days=days,
|
|
158
|
+
scope=scope,
|
|
159
|
+
cutoff_timestamp=_now().isoformat().replace("+00:00", "Z"),
|
|
160
|
+
allowlists=_allowlists(),
|
|
161
|
+
setup_diagnostics=(SetupDiagnostic(repo="", message="days must be non-negative"),),
|
|
162
|
+
)
|
|
163
|
+
if scope not in {"closeout", "all-events"}:
|
|
164
|
+
return DriftAuditResult(
|
|
165
|
+
repos=(),
|
|
166
|
+
days=days,
|
|
167
|
+
scope=scope,
|
|
168
|
+
cutoff_timestamp=_now().isoformat().replace("+00:00", "Z"),
|
|
169
|
+
allowlists=_allowlists(),
|
|
170
|
+
setup_diagnostics=(SetupDiagnostic(repo="", message="scope must be closeout or all-events"),),
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
now = _now()
|
|
174
|
+
cutoff = now - timedelta(days=days)
|
|
175
|
+
repo_summaries: list[RepoScanSummary] = []
|
|
176
|
+
setup_diagnostics: list[SetupDiagnostic] = []
|
|
177
|
+
findings: list[DriftFinding] = []
|
|
178
|
+
|
|
179
|
+
for repo_input in repos:
|
|
180
|
+
repo = Path(repo_input).expanduser().resolve()
|
|
181
|
+
repo_label = str(repo)
|
|
182
|
+
if not repo.exists() or not repo.is_dir():
|
|
183
|
+
setup_diagnostics.append(SetupDiagnostic(repo=repo_label, message="repo path is missing or not a directory"))
|
|
184
|
+
continue
|
|
185
|
+
phase_loop = repo / ".phase-loop"
|
|
186
|
+
if not phase_loop.exists():
|
|
187
|
+
setup_diagnostics.append(SetupDiagnostic(repo=repo_label, message=".phase-loop directory is missing"))
|
|
188
|
+
continue
|
|
189
|
+
repo_findings, summary = _scan_repo(repo, cutoff, scope)
|
|
190
|
+
findings.extend(repo_findings)
|
|
191
|
+
repo_summaries.append(summary)
|
|
192
|
+
|
|
193
|
+
return DriftAuditResult(
|
|
194
|
+
repos=tuple(sorted(repo_summaries, key=lambda item: item.repo)),
|
|
195
|
+
days=days,
|
|
196
|
+
scope=scope,
|
|
197
|
+
cutoff_timestamp=cutoff.isoformat().replace("+00:00", "Z"),
|
|
198
|
+
allowlists=_allowlists(),
|
|
199
|
+
drift_counts=_collapse_findings(findings),
|
|
200
|
+
setup_diagnostics=tuple(sorted(setup_diagnostics, key=lambda item: (item.repo, item.message))),
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def _scan_repo(repo: Path, cutoff: datetime, scope: str) -> tuple[list[DriftFinding], RepoScanSummary]:
|
|
205
|
+
findings: list[DriftFinding] = []
|
|
206
|
+
terminal_summaries_scanned = 0
|
|
207
|
+
events_scanned = 0
|
|
208
|
+
malformed_events = 0
|
|
209
|
+
|
|
210
|
+
for path in sorted((repo / ".phase-loop" / "runs").glob("**/terminal-summary.json")):
|
|
211
|
+
event_time = _file_timestamp(path)
|
|
212
|
+
if event_time and event_time < cutoff:
|
|
213
|
+
continue
|
|
214
|
+
try:
|
|
215
|
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
216
|
+
except (OSError, json.JSONDecodeError):
|
|
217
|
+
malformed_events += 1
|
|
218
|
+
continue
|
|
219
|
+
terminal_summaries_scanned += 1
|
|
220
|
+
findings.extend(_scan_payload(payload, repo=str(repo), source=_relative(path, repo), first_seen=_timestamp_from_payload(payload) or _format_time(event_time)))
|
|
221
|
+
|
|
222
|
+
events_path = repo / ".phase-loop" / "events.jsonl"
|
|
223
|
+
if events_path.exists():
|
|
224
|
+
try:
|
|
225
|
+
lines = events_path.read_text(encoding="utf-8").splitlines()
|
|
226
|
+
except OSError:
|
|
227
|
+
lines = []
|
|
228
|
+
malformed_events += 1
|
|
229
|
+
for line_number, line in enumerate(lines, start=1):
|
|
230
|
+
if not line.strip():
|
|
231
|
+
continue
|
|
232
|
+
try:
|
|
233
|
+
event = json.loads(line)
|
|
234
|
+
except json.JSONDecodeError:
|
|
235
|
+
malformed_events += 1
|
|
236
|
+
continue
|
|
237
|
+
event_time = _timestamp_from_payload(event)
|
|
238
|
+
if event_time and _parse_time(event_time) and _parse_time(event_time) < cutoff:
|
|
239
|
+
continue
|
|
240
|
+
if scope == "closeout" and not _is_closeout_class_event(event):
|
|
241
|
+
continue
|
|
242
|
+
events_scanned += 1
|
|
243
|
+
findings.extend(
|
|
244
|
+
_scan_payload(
|
|
245
|
+
event,
|
|
246
|
+
repo=str(repo),
|
|
247
|
+
source=f"{_relative(events_path, repo)}:{line_number}",
|
|
248
|
+
first_seen=event_time,
|
|
249
|
+
)
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
return findings, RepoScanSummary(
|
|
253
|
+
repo=str(repo),
|
|
254
|
+
terminal_summaries_scanned=terminal_summaries_scanned,
|
|
255
|
+
events_scanned=events_scanned,
|
|
256
|
+
malformed_events=malformed_events,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def _scan_payload(payload: Any, *, repo: str, source: str, first_seen: str | None) -> list[DriftFinding]:
|
|
261
|
+
findings: list[DriftFinding] = []
|
|
262
|
+
for path, key, value in _walk_items(payload):
|
|
263
|
+
field = _field_for(path, key)
|
|
264
|
+
if field is None or not isinstance(value, str):
|
|
265
|
+
continue
|
|
266
|
+
allowed = _allowlists()[field]
|
|
267
|
+
if value not in allowed and value != "none":
|
|
268
|
+
findings.append(DriftFinding(repo=repo, field=field, literal=value, source=source, first_seen=first_seen))
|
|
269
|
+
return findings
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def _walk_items(value: Any, path: tuple[str, ...] = ()) -> Iterable[tuple[tuple[str, ...], str, Any]]:
|
|
273
|
+
if isinstance(value, dict):
|
|
274
|
+
for key, child in value.items():
|
|
275
|
+
key_str = str(key)
|
|
276
|
+
yield path, key_str, child
|
|
277
|
+
yield from _walk_items(child, path + (key_str,))
|
|
278
|
+
elif isinstance(value, list):
|
|
279
|
+
for child in value:
|
|
280
|
+
if isinstance(child, (dict, list)):
|
|
281
|
+
yield from _walk_items(child, path)
|
|
282
|
+
elif path:
|
|
283
|
+
yield path, path[-1], child
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
def _field_for(path: tuple[str, ...], key: str) -> str | None:
|
|
287
|
+
if key in {"terminal_status", "closeout_terminal_status"}:
|
|
288
|
+
return "terminal_status"
|
|
289
|
+
if key == "verification_status":
|
|
290
|
+
return "verification_status"
|
|
291
|
+
if key == "blocker_class":
|
|
292
|
+
return "blocker_class"
|
|
293
|
+
if key in {"executor", "selected_executor", "parent_executor", "child_executor", "target_executor", "harness_target"}:
|
|
294
|
+
return "executor"
|
|
295
|
+
if key == "capability" or key == "required_capability" or path[-1:] == ("required_capabilities",):
|
|
296
|
+
return "dispatch_capability"
|
|
297
|
+
return None
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
def _is_closeout_class_event(event: dict[str, Any]) -> bool:
|
|
301
|
+
action = str(event.get("action", ""))
|
|
302
|
+
metadata = event.get("metadata") if isinstance(event.get("metadata"), dict) else {}
|
|
303
|
+
return (
|
|
304
|
+
"closeout" in action
|
|
305
|
+
or action in {"manual_repair", "phase_complete", "phase_reopen", "reconcile"}
|
|
306
|
+
or any(key in metadata for key in ("terminal_summary", "automation", "closeout"))
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def _collapse_findings(findings: Iterable[DriftFinding]) -> tuple[DriftCount, ...]:
|
|
311
|
+
buckets: dict[tuple[str, str, str], list[DriftFinding]] = {}
|
|
312
|
+
for finding in findings:
|
|
313
|
+
buckets.setdefault(finding.key(), []).append(finding)
|
|
314
|
+
counts: list[DriftCount] = []
|
|
315
|
+
for (repo, field, literal), items in buckets.items():
|
|
316
|
+
first_seen_values = sorted(item.first_seen for item in items if item.first_seen)
|
|
317
|
+
sources = tuple(sorted({item.source for item in items}))
|
|
318
|
+
counts.append(
|
|
319
|
+
DriftCount(
|
|
320
|
+
repo=repo,
|
|
321
|
+
field=field,
|
|
322
|
+
literal=literal,
|
|
323
|
+
count=len(items),
|
|
324
|
+
first_seen=first_seen_values[0] if first_seen_values else None,
|
|
325
|
+
sources=sources,
|
|
326
|
+
)
|
|
327
|
+
)
|
|
328
|
+
return tuple(sorted(counts, key=lambda item: (item.field, item.literal, item.repo)))
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def _allowlists() -> dict[str, tuple[str, ...]]:
|
|
332
|
+
return {
|
|
333
|
+
"terminal_status": PHASE_STATUSES,
|
|
334
|
+
"verification_status": VERIFICATION_STATUSES,
|
|
335
|
+
"blocker_class": BLOCKER_CLASSES,
|
|
336
|
+
"executor": EXECUTORS,
|
|
337
|
+
"dispatch_capability": DISPATCH_CAPABILITIES,
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def _timestamp_from_payload(payload: Any) -> str | None:
|
|
342
|
+
if not isinstance(payload, dict):
|
|
343
|
+
return None
|
|
344
|
+
for key in ("timestamp", "created_at", "updated_at"):
|
|
345
|
+
value = payload.get(key)
|
|
346
|
+
if isinstance(value, str):
|
|
347
|
+
return value
|
|
348
|
+
metadata = payload.get("metadata")
|
|
349
|
+
if isinstance(metadata, dict):
|
|
350
|
+
for key in ("timestamp", "created_at", "updated_at"):
|
|
351
|
+
value = metadata.get(key)
|
|
352
|
+
if isinstance(value, str):
|
|
353
|
+
return value
|
|
354
|
+
return None
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
def _parse_time(value: str) -> datetime | None:
|
|
358
|
+
try:
|
|
359
|
+
parsed = datetime.fromisoformat(value.replace("Z", "+00:00"))
|
|
360
|
+
except ValueError:
|
|
361
|
+
return None
|
|
362
|
+
if parsed.tzinfo is None:
|
|
363
|
+
return parsed.replace(tzinfo=timezone.utc)
|
|
364
|
+
return parsed.astimezone(timezone.utc)
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
def _file_timestamp(path: Path) -> datetime | None:
|
|
368
|
+
try:
|
|
369
|
+
return datetime.fromtimestamp(path.stat().st_mtime, tz=timezone.utc)
|
|
370
|
+
except OSError:
|
|
371
|
+
return None
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def _format_time(value: datetime | None) -> str | None:
|
|
375
|
+
if value is None:
|
|
376
|
+
return None
|
|
377
|
+
return value.isoformat().replace("+00:00", "Z")
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def _relative(path: Path, repo: Path) -> str:
|
|
381
|
+
try:
|
|
382
|
+
return str(path.relative_to(repo))
|
|
383
|
+
except ValueError:
|
|
384
|
+
return str(path)
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
def _now() -> datetime:
|
|
388
|
+
return datetime.now(timezone.utc)
|