loopx 0.4.8__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.
- loopx/__init__.py +5 -0
- loopx/agent_onboarding.py +654 -0
- loopx/agent_registry.py +112 -0
- loopx/ark_managed_agent_host.py +59 -0
- loopx/authority.py +805 -0
- loopx/benchmark.py +2875 -0
- loopx/benchmark_adapters/__init__.py +1 -0
- loopx/benchmark_adapters/agentissue.py +2644 -0
- loopx/benchmark_adapters/agents_last_exam.py +3998 -0
- loopx/benchmark_adapters/edgebench.py +322 -0
- loopx/benchmark_adapters/skillsbench.py +5978 -0
- loopx/benchmark_adapters/skillsbench_acp_failure_policy.py +143 -0
- loopx/benchmark_adapters/skillsbench_acp_process.py +31 -0
- loopx/benchmark_adapters/skillsbench_acp_relay.py +4832 -0
- loopx/benchmark_adapters/skillsbench_batch.py +124 -0
- loopx/benchmark_adapters/skillsbench_bridge_guard.py +209 -0
- loopx/benchmark_adapters/skillsbench_bridge_summary.py +203 -0
- loopx/benchmark_adapters/skillsbench_codex_goal_recovery.py +271 -0
- loopx/benchmark_adapters/skillsbench_codex_goal_trace.py +81 -0
- loopx/benchmark_adapters/skillsbench_codex_runtime.py +339 -0
- loopx/benchmark_adapters/skillsbench_dockerfile_runtime.py +467 -0
- loopx/benchmark_adapters/skillsbench_failure_signals.py +652 -0
- loopx/benchmark_adapters/skillsbench_proxy_runtime.py +327 -0
- loopx/benchmark_adapters/skillsbench_remote_bridge.py +402 -0
- loopx/benchmark_adapters/skillsbench_result_discovery.py +143 -0
- loopx/benchmark_adapters/skillsbench_runner_profile.py +436 -0
- loopx/benchmark_adapters/skillsbench_runner_source.py +99 -0
- loopx/benchmark_adapters/skillsbench_setup_preflight.py +771 -0
- loopx/benchmark_adapters/skillsbench_signals.py +15 -0
- loopx/benchmark_adapters/skillsbench_task_source.py +141 -0
- loopx/benchmark_adapters/skillsbench_turn_route.py +723 -0
- loopx/benchmark_adapters/skillsbench_turn_runtime.py +1069 -0
- loopx/benchmark_adapters/skillsbench_typed_repair.py +689 -0
- loopx/benchmark_adapters/skillsbench_uv_cache.py +111 -0
- loopx/benchmark_adapters/skillsbench_verifier_bootstrap.py +227 -0
- loopx/benchmark_adapters/skillsbench_verifier_cache.py +138 -0
- loopx/benchmark_adapters/terminal_bench.py +10078 -0
- loopx/benchmark_case_analysis.py +1276 -0
- loopx/benchmark_case_state.py +1079 -0
- loopx/benchmark_core/__init__.py +239 -0
- loopx/benchmark_core/adapter.py +84 -0
- loopx/benchmark_core/artifacts.py +517 -0
- loopx/benchmark_core/attempts.py +199 -0
- loopx/benchmark_core/container_exec.py +216 -0
- loopx/benchmark_core/io.py +68 -0
- loopx/benchmark_core/lifecycle.py +211 -0
- loopx/benchmark_core/loop_protocol.py +689 -0
- loopx/benchmark_core/observable_handles.py +348 -0
- loopx/benchmark_core/parity.py +256 -0
- loopx/benchmark_core/remote_closeout.py +482 -0
- loopx/benchmark_core/rounds.py +215 -0
- loopx/benchmark_core/route_profile.py +509 -0
- loopx/benchmark_core/run_permissions.py +206 -0
- loopx/benchmark_core/split_control.py +925 -0
- loopx/benchmark_core/turn_fidelity.py +326 -0
- loopx/benchmark_ledger.py +3793 -0
- loopx/benchmark_ledger_countability.py +372 -0
- loopx/benchmark_ledger_current.py +724 -0
- loopx/benchmark_trajectory.py +405 -0
- loopx/benchmarks/__init__.py +1 -0
- loopx/benchmarks/qualification/__init__.py +1 -0
- loopx/benchmarks/qualification/release_outcome_baseline.py +360 -0
- loopx/benchmarks/read_models/__init__.py +1 -0
- loopx/benchmarks/read_models/benchmark_attempt_accounting.py +53 -0
- loopx/benchmarks/read_models/benchmark_comparison.py +414 -0
- loopx/benchmarks/read_models/benchmark_event_timeline.py +113 -0
- loopx/benchmarks/read_models/benchmark_experiment_report.py +475 -0
- loopx/benchmarks/read_models/benchmark_learning_ledger.py +137 -0
- loopx/benchmarks/read_models/benchmark_lifecycle_contracts.py +228 -0
- loopx/benchmarks/read_models/benchmark_projection.py +723 -0
- loopx/benchmarks/read_models/benchmark_result.py +146 -0
- loopx/benchmarks/read_models/benchmark_run_execution_contract.py +116 -0
- loopx/benchmarks/read_models/benchmark_run_failure.py +157 -0
- loopx/benchmarks/read_models/benchmark_run_metrics.py +213 -0
- loopx/benchmarks/read_models/benchmark_run_post_execution.py +635 -0
- loopx/benchmarks/read_models/benchmark_run_pre_execution.py +541 -0
- loopx/benchmarks/read_models/benchmark_status_compaction.py +1255 -0
- loopx/benchmarks/read_models/benchmark_status_runner.py +780 -0
- loopx/benchmarks/read_models/goal_start_control_score.py +857 -0
- loopx/benchmarks/read_models/skillsbench_post_run_debug.py +746 -0
- loopx/benchmarks/read_models/skillsbench_verifier_attribution.py +269 -0
- loopx/bootstrap.py +1116 -0
- loopx/bootstrap_command_pack.py +2167 -0
- loopx/boundary_authority.py +199 -0
- loopx/canary/__init__.py +1 -0
- loopx/canary/maintainability_ratchet.py +800 -0
- loopx/canary/planner.py +1984 -0
- loopx/canary/premerge.py +1130 -0
- loopx/canary/qualification_profiles.py +309 -0
- loopx/canary/quality_surface_catalog.py +838 -0
- loopx/canary/release_profiles.py +51 -0
- loopx/canary/runner.py +1107 -0
- loopx/canary/smoke_health.py +581 -0
- loopx/canary/smoke_profiles.py +212 -0
- loopx/capabilities/__init__.py +0 -0
- loopx/capabilities/agent_turn_recall/__init__.py +17 -0
- loopx/capabilities/agent_turn_recall/cli.py +369 -0
- loopx/capabilities/agent_turn_recall/core.py +296 -0
- loopx/capabilities/auto_research/__init__.py +16 -0
- loopx/capabilities/auto_research/bootstrap_contract.py +157 -0
- loopx/capabilities/auto_research/cli.py +1468 -0
- loopx/capabilities/auto_research/core.py +11 -0
- loopx/capabilities/auto_research/defaults.py +79 -0
- loopx/capabilities/auto_research/demo_e2e.py +1848 -0
- loopx/capabilities/auto_research/demo_supervisor.py +186 -0
- loopx/capabilities/auto_research/evidence_packet.py +767 -0
- loopx/capabilities/auto_research/human_view.py +794 -0
- loopx/capabilities/auto_research/kernel.py +191 -0
- loopx/capabilities/auto_research/knn_demo_workspace.py +322 -0
- loopx/capabilities/auto_research/live_evidence.py +248 -0
- loopx/capabilities/auto_research/preset.py +176 -0
- loopx/capabilities/auto_research/research_state.py +1085 -0
- loopx/capabilities/auto_research/role_profiles.py +394 -0
- loopx/capabilities/auto_research/rollout_append.py +97 -0
- loopx/capabilities/auto_research/terminal_result_contract.py +422 -0
- loopx/capabilities/auto_research/terminal_result_projection.py +171 -0
- loopx/capabilities/auto_research/terminal_result_query.py +233 -0
- loopx/capabilities/auto_research/terminal_results.py +349 -0
- loopx/capabilities/auto_research/user_contract.py +190 -0
- loopx/capabilities/auto_research/worker_loop.py +163 -0
- loopx/capabilities/auto_research/worker_runtime.py +777 -0
- loopx/capabilities/auto_research/worker_skill/SKILL.md +343 -0
- loopx/capabilities/benchmark_toolkit/__init__.py +19 -0
- loopx/capabilities/benchmark_toolkit/integrity.py +387 -0
- loopx/capabilities/catalog.py +1875 -0
- loopx/capabilities/change_quality/__init__.py +19 -0
- loopx/capabilities/change_quality/cli.py +171 -0
- loopx/capabilities/change_quality/context.py +156 -0
- loopx/capabilities/change_quality/oracles.py +269 -0
- loopx/capabilities/change_quality/policy.py +34 -0
- loopx/capabilities/change_quality/receipt.py +482 -0
- loopx/capabilities/change_quality/result.py +493 -0
- loopx/capabilities/change_quality/scope.py +171 -0
- loopx/capabilities/change_quality/shadow.py +680 -0
- loopx/capabilities/content_ops/__init__.py +0 -0
- loopx/capabilities/content_ops/cli.py +649 -0
- loopx/capabilities/content_ops/connector_packets.py +164 -0
- loopx/capabilities/content_ops/item_lifecycle.py +1000 -0
- loopx/capabilities/content_ops/layout.py +451 -0
- loopx/capabilities/content_ops/markdown.py +456 -0
- loopx/capabilities/content_ops/schemas.py +51 -0
- loopx/capabilities/content_ops/social_browser_x.py +107 -0
- loopx/capabilities/content_ops/surface.py +1956 -0
- loopx/capabilities/content_ops/templates/layout-catalog-v0.json +72 -0
- loopx/capabilities/context_providers/__init__.py +36 -0
- loopx/capabilities/context_providers/base.py +189 -0
- loopx/capabilities/context_providers/factory.py +32 -0
- loopx/capabilities/context_providers/openviking.py +702 -0
- loopx/capabilities/context_providers/service_ownership.py +185 -0
- loopx/capabilities/decision_context/__init__.py +129 -0
- loopx/capabilities/decision_context/architecture.py +83 -0
- loopx/capabilities/decision_context/assembler.py +849 -0
- loopx/capabilities/decision_context/catalog_entry.py +195 -0
- loopx/capabilities/decision_context/cli.py +310 -0
- loopx/capabilities/decision_context/cursor_commit.py +535 -0
- loopx/capabilities/decision_context/outcome_feedback.py +352 -0
- loopx/capabilities/decision_context/packets.py +654 -0
- loopx/capabilities/decision_context/private_state.py +189 -0
- loopx/capabilities/decision_context/profile.py +453 -0
- loopx/capabilities/decision_context/providers.py +228 -0
- loopx/capabilities/decision_context/review_settlement.py +136 -0
- loopx/capabilities/decision_context/runtime.py +273 -0
- loopx/capabilities/decision_context/sources.py +415 -0
- loopx/capabilities/explore/__init__.py +1 -0
- loopx/capabilities/explore/activation.py +198 -0
- loopx/capabilities/explore/adaptive_replay_planner.py +221 -0
- loopx/capabilities/explore/child_replay_runtime.py +463 -0
- loopx/capabilities/explore/composition_frontier.py +291 -0
- loopx/capabilities/explore/counterfactual_runtime.py +578 -0
- loopx/capabilities/explore/episode_runtime.py +647 -0
- loopx/capabilities/explore/harness_checkpoint.py +171 -0
- loopx/capabilities/explore/harness_gate.py +115 -0
- loopx/capabilities/explore/harness_runtime.py +1124 -0
- loopx/capabilities/explore/replay_metrics.py +206 -0
- loopx/capabilities/explore/replay_runtime.py +1271 -0
- loopx/capabilities/explore/resource_portfolio.py +173 -0
- loopx/capabilities/explore/result_log.py +974 -0
- loopx/capabilities/explore/router_state.py +432 -0
- loopx/capabilities/explore/source_history_reconcile.py +255 -0
- loopx/capabilities/explore/speculative_scheduler.py +498 -0
- loopx/capabilities/explore/todo_branch_plan.py +650 -0
- loopx/capabilities/explore/todo_evidence.py +141 -0
- loopx/capabilities/explore/trace_runtime.py +284 -0
- loopx/capabilities/explore/worker_branch_plan.py +1257 -0
- loopx/capabilities/integration_branch/__init__.py +13 -0
- loopx/capabilities/integration_branch/cli.py +148 -0
- loopx/capabilities/integration_branch/core.py +916 -0
- loopx/capabilities/issue_fix/__init__.py +19 -0
- loopx/capabilities/issue_fix/acceptance_loop.py +1050 -0
- loopx/capabilities/issue_fix/candidate_evidence.py +503 -0
- loopx/capabilities/issue_fix/candidate_preflight.py +676 -0
- loopx/capabilities/issue_fix/cli.py +1822 -0
- loopx/capabilities/issue_fix/cli_input.py +87 -0
- loopx/capabilities/issue_fix/content_ops_cli.py +148 -0
- loopx/capabilities/issue_fix/discovered_issue_promotion.py +947 -0
- loopx/capabilities/issue_fix/explore_projection.py +710 -0
- loopx/capabilities/issue_fix/feasibility.py +542 -0
- loopx/capabilities/issue_fix/github_public.py +661 -0
- loopx/capabilities/issue_fix/intake_surface.py +832 -0
- loopx/capabilities/issue_fix/metadata_preview.py +218 -0
- loopx/capabilities/issue_fix/metrics_projection.py +1340 -0
- loopx/capabilities/issue_fix/metrics_supplement.py +634 -0
- loopx/capabilities/issue_fix/metrics_supplement_cli.py +127 -0
- loopx/capabilities/issue_fix/outcome_projection.py +1235 -0
- loopx/capabilities/issue_fix/periodic_report.py +189 -0
- loopx/capabilities/issue_fix/pr_description.py +418 -0
- loopx/capabilities/issue_fix/pr_gate_reconcile.py +496 -0
- loopx/capabilities/issue_fix/pr_gate_reconcile_cli.py +464 -0
- loopx/capabilities/issue_fix/pr_lifecycle.py +1327 -0
- loopx/capabilities/issue_fix/pr_lifecycle_rollout.py +85 -0
- loopx/capabilities/issue_fix/pr_monitor_materialization.py +257 -0
- loopx/capabilities/issue_fix/pr_review_ack.py +439 -0
- loopx/capabilities/issue_fix/provider_hooks.py +24 -0
- loopx/capabilities/issue_fix/repository_commit_evidence.py +186 -0
- loopx/capabilities/issue_fix/repository_context.py +457 -0
- loopx/capabilities/issue_fix/repository_memory.py +459 -0
- loopx/capabilities/issue_fix/repository_memory_provider.py +1454 -0
- loopx/capabilities/issue_fix/repository_snapshot.py +454 -0
- loopx/capabilities/issue_fix/reviewer_cli.py +917 -0
- loopx/capabilities/issue_fix/reviewer_notification.py +882 -0
- loopx/capabilities/issue_fix/reviewer_notification_drain.py +942 -0
- loopx/capabilities/issue_fix/reviewer_recommendation.py +1057 -0
- loopx/capabilities/issue_fix/reviewer_request.py +1282 -0
- loopx/capabilities/issue_fix/reward_memory.py +879 -0
- loopx/capabilities/issue_fix/workflow_plan.py +1286 -0
- loopx/capabilities/material_lifecycle/__init__.py +161 -0
- loopx/capabilities/material_lifecycle/_validation.py +183 -0
- loopx/capabilities/material_lifecycle/apply.py +672 -0
- loopx/capabilities/material_lifecycle/architecture.py +122 -0
- loopx/capabilities/material_lifecycle/cli.py +161 -0
- loopx/capabilities/material_lifecycle/decision_planning.py +470 -0
- loopx/capabilities/material_lifecycle/explore_execution.py +306 -0
- loopx/capabilities/material_lifecycle/intake.py +869 -0
- loopx/capabilities/material_lifecycle/inventory.py +147 -0
- loopx/capabilities/material_lifecycle/lifecycle.py +98 -0
- loopx/capabilities/material_lifecycle/preparation.py +147 -0
- loopx/capabilities/material_lifecycle/project_skill.py +83 -0
- loopx/capabilities/material_lifecycle/ranking.py +267 -0
- loopx/capabilities/material_lifecycle/readable_projection.py +500 -0
- loopx/capabilities/material_lifecycle/rebuild.py +480 -0
- loopx/capabilities/material_lifecycle/settlement.py +238 -0
- loopx/capabilities/periodic_report/__init__.py +71 -0
- loopx/capabilities/periodic_report/adapters.py +939 -0
- loopx/capabilities/periodic_report/archive.py +422 -0
- loopx/capabilities/periodic_report/bindings.py +705 -0
- loopx/capabilities/periodic_report/cli.py +277 -0
- loopx/capabilities/periodic_report/core.py +691 -0
- loopx/capabilities/periodic_report/extension_envelope.py +66 -0
- loopx/capabilities/periodic_report/presets.py +103 -0
- loopx/capabilities/periodic_report/profile.py +235 -0
- loopx/capabilities/periodic_report/project_progress.py +179 -0
- loopx/capabilities/periodic_report/triggers.py +452 -0
- loopx/capabilities/pr_review_queue/__init__.py +17 -0
- loopx/capabilities/pr_review_queue/core.py +506 -0
- loopx/capabilities/pr_review_queue/review_contract.py +506 -0
- loopx/capabilities/registry.py +192 -0
- loopx/capabilities/reward_memory/__init__.py +75 -0
- loopx/capabilities/reward_memory/application.py +819 -0
- loopx/capabilities/reward_memory/architecture.py +572 -0
- loopx/capabilities/reward_memory/candidate_review.py +511 -0
- loopx/capabilities/reward_memory/cli.py +469 -0
- loopx/capabilities/reward_memory/dogfood.py +574 -0
- loopx/capabilities/reward_memory/evaluation.py +296 -0
- loopx/capabilities/reward_memory/evaluation_fixtures.py +362 -0
- loopx/capabilities/reward_memory/experiment.py +567 -0
- loopx/capabilities/reward_memory/health.py +222 -0
- loopx/capabilities/reward_memory/ingestion.py +519 -0
- loopx/capabilities/reward_memory/registry.py +600 -0
- loopx/capabilities/reward_memory/runtime_hooks.py +312 -0
- loopx/capabilities/reward_memory/scoped_feedback.py +173 -0
- loopx/capabilities/semantic_preference/__init__.py +12 -0
- loopx/capabilities/semantic_preference/cli.py +189 -0
- loopx/capabilities/semantic_preference/contract.py +592 -0
- loopx/capabilities/semantic_preference/reward_memory.py +62 -0
- loopx/capabilities/value_connectors/__init__.py +1 -0
- loopx/capabilities/value_connectors/cli.py +401 -0
- loopx/capabilities/value_connectors/finance_extension_migration.py +108 -0
- loopx/capabilities/value_connectors/install_check.py +147 -0
- loopx/capabilities/value_connectors/planner.py +733 -0
- loopx/capabilities/value_connectors/source_map.py +446 -0
- loopx/claude_goal_baseline.py +138 -0
- loopx/claude_goal_mode/__init__.py +23 -0
- loopx/claude_goal_mode/hooks/goal_policy.py +212 -0
- loopx/claude_goal_mode/hooks/goal_state.py +139 -0
- loopx/claude_goal_mode/mcp/loopx_mcp.py +167 -0
- loopx/claude_goal_mode/scripts/connect.py +103 -0
- loopx/claude_goal_mode/scripts/goalmode_cmd.py +241 -0
- loopx/claude_goal_mode/scripts/install.py +328 -0
- loopx/claude_goal_mode/statusline/goal_status.py +97 -0
- loopx/cli.py +836 -0
- loopx/cli_commands/__init__.py +334 -0
- loopx/cli_commands/_host_thread.py +13 -0
- loopx/cli_commands/agentissue_runner_flow.py +447 -0
- loopx/cli_commands/agents_last_exam.py +160 -0
- loopx/cli_commands/agents_last_exam_baked_input.py +302 -0
- loopx/cli_commands/agents_last_exam_host_codex.py +374 -0
- loopx/cli_commands/agents_last_exam_launch_dry_run.py +372 -0
- loopx/cli_commands/agents_last_exam_local_plan.py +322 -0
- loopx/cli_commands/agents_last_exam_runner_source.py +352 -0
- loopx/cli_commands/agents_last_exam_task_material.py +335 -0
- loopx/cli_commands/agents_last_exam_validation_gate.py +236 -0
- loopx/cli_commands/benchmark_boundary.py +499 -0
- loopx/cli_commands/benchmark_dispatch.py +161 -0
- loopx/cli_commands/benchmark_release_outcome.py +123 -0
- loopx/cli_commands/benchmark_review_lifecycle.py +1275 -0
- loopx/cli_commands/benchmark_run_ledger.py +763 -0
- loopx/cli_commands/benchmark_run_ledger_case_analysis.py +249 -0
- loopx/cli_commands/benchmark_run_ledger_classification.py +45 -0
- loopx/cli_commands/benchmark_run_ledger_maintenance.py +486 -0
- loopx/cli_commands/benchmark_run_ledger_maintenance_registration.py +342 -0
- loopx/cli_commands/benchmark_run_ledger_maintenance_rendering.py +233 -0
- loopx/cli_commands/benchmark_run_ledger_parity.py +92 -0
- loopx/cli_commands/bootstrap_connect.py +238 -0
- loopx/cli_commands/canary.py +707 -0
- loopx/cli_commands/canary_release_qualification.py +79 -0
- loopx/cli_commands/capability.py +96 -0
- loopx/cli_commands/doctor.py +43 -0
- loopx/cli_commands/dreaming.py +143 -0
- loopx/cli_commands/edgebench.py +205 -0
- loopx/cli_commands/evidence_log.py +275 -0
- loopx/cli_commands/explore.py +989 -0
- loopx/cli_commands/explore_planning_commands.py +157 -0
- loopx/cli_commands/extension.py +271 -0
- loopx/cli_commands/first_run_report.py +73 -0
- loopx/cli_commands/goal_channel.py +656 -0
- loopx/cli_commands/handoff_mode.py +158 -0
- loopx/cli_commands/history.py +622 -0
- loopx/cli_commands/host_mode_plan.py +113 -0
- loopx/cli_commands/lark_inbox.py +431 -0
- loopx/cli_commands/lark_kanban.py +629 -0
- loopx/cli_commands/ml_experiment.py +321 -0
- loopx/cli_commands/multi_agent.py +211 -0
- loopx/cli_commands/opencode2_goal_worker.py +217 -0
- loopx/cli_commands/pr_review.py +167 -0
- loopx/cli_commands/presentation.py +218 -0
- loopx/cli_commands/preset.py +96 -0
- loopx/cli_commands/project.py +150 -0
- loopx/cli_commands/project_lifecycle.py +915 -0
- loopx/cli_commands/quota.py +859 -0
- loopx/cli_commands/quota_registration.py +241 -0
- loopx/cli_commands/quota_request.py +113 -0
- loopx/cli_commands/ready_score.py +110 -0
- loopx/cli_commands/registry_admin.py +975 -0
- loopx/cli_commands/registry_admin_configure.py +344 -0
- loopx/cli_commands/registry_admin_peer.py +84 -0
- loopx/cli_commands/registry_authority.py +218 -0
- loopx/cli_commands/review_batch.py +146 -0
- loopx/cli_commands/slash_commands.py +145 -0
- loopx/cli_commands/start_goal.py +251 -0
- loopx/cli_commands/starter.py +175 -0
- loopx/cli_commands/starter_bootstrap.py +179 -0
- loopx/cli_commands/starter_bootstrap_registration.py +198 -0
- loopx/cli_commands/starter_runtime_idle.py +107 -0
- loopx/cli_commands/starter_scheduler.py +207 -0
- loopx/cli_commands/starter_session_runtime.py +152 -0
- loopx/cli_commands/starter_visible_common.py +54 -0
- loopx/cli_commands/starter_visible_driver.py +161 -0
- loopx/cli_commands/starter_visible_pilot.py +278 -0
- loopx/cli_commands/status.py +867 -0
- loopx/cli_commands/status_registration.py +239 -0
- loopx/cli_commands/summary_all.py +222 -0
- loopx/cli_commands/support_control.py +809 -0
- loopx/cli_commands/support_control_registry.py +68 -0
- loopx/cli_commands/support_control_supervisor.py +289 -0
- loopx/cli_commands/task_lease.py +306 -0
- loopx/cli_commands/terminal_bench_adapter.py +717 -0
- loopx/cli_commands/terminal_bench_environment_result.py +1246 -0
- loopx/cli_commands/todo.py +940 -0
- loopx/cli_commands/todo_argument_validation.py +572 -0
- loopx/cli_commands/todo_event.py +114 -0
- loopx/cli_commands/turn.py +804 -0
- loopx/cli_commands/version.py +46 -0
- loopx/cli_commands/worker_bridge.py +659 -0
- loopx/cli_rollout.py +314 -0
- loopx/codex_cli_goal_tui.py +672 -0
- loopx/codex_cli_probe.py +1530 -0
- loopx/codex_cli_probe_markdown.py +935 -0
- loopx/codex_cli_runtime_probe.py +733 -0
- loopx/codex_cli_scheduler.py +564 -0
- loopx/codex_goal_baseline.py +620 -0
- loopx/configuration_catalog.py +617 -0
- loopx/configure_goal.py +1375 -0
- loopx/contract.py +996 -0
- loopx/control_plane/__init__.py +71 -0
- loopx/control_plane/agents/__init__.py +1 -0
- loopx/control_plane/agents/agent_lane_recommendation.py +516 -0
- loopx/control_plane/agents/agent_scope.py +1578 -0
- loopx/control_plane/agents/agent_scope_frontier.py +60 -0
- loopx/control_plane/agents/capability_gate.py +531 -0
- loopx/control_plane/agents/identity.py +140 -0
- loopx/control_plane/agents/legacy_migration.py +169 -0
- loopx/control_plane/agents/management_projection.py +658 -0
- loopx/control_plane/agents/material_frontier.py +608 -0
- loopx/control_plane/agents/material_handoff.py +156 -0
- loopx/control_plane/agents/multi_agent/__init__.py +1 -0
- loopx/control_plane/agents/multi_agent/codex_executable.py +207 -0
- loopx/control_plane/agents/multi_agent/collective_round_ledger.py +387 -0
- loopx/control_plane/agents/multi_agent/contract.py +474 -0
- loopx/control_plane/agents/multi_agent/recipe.py +110 -0
- loopx/control_plane/agents/multi_agent/role_successor.py +297 -0
- loopx/control_plane/agents/multi_agent/runtime_scripts.py +426 -0
- loopx/control_plane/agents/multi_agent/visible_launch_policy.py +149 -0
- loopx/control_plane/agents/multi_agent/visible_wake_scheduler.py +392 -0
- loopx/control_plane/agents/profile.py +216 -0
- loopx/control_plane/agents/runtime_model.py +73 -0
- loopx/control_plane/agents/subagent_activity.py +164 -0
- loopx/control_plane/agents/supervisor.py +544 -0
- loopx/control_plane/agents/supervisor_events.py +462 -0
- loopx/control_plane/agents/supervisor_inject.py +204 -0
- loopx/control_plane/agents/work_mode.py +56 -0
- loopx/control_plane/agents/workspace_guard.py +364 -0
- loopx/control_plane/effect_program.py +644 -0
- loopx/control_plane/goals/__init__.py +1 -0
- loopx/control_plane/goals/active_state_event_projection.py +103 -0
- loopx/control_plane/goals/active_state_metadata.py +47 -0
- loopx/control_plane/goals/active_state_sections.py +58 -0
- loopx/control_plane/goals/configure_goal_service.py +354 -0
- loopx/control_plane/goals/contract_health.py +132 -0
- loopx/control_plane/goals/dreaming.py +152 -0
- loopx/control_plane/goals/global_registry_health.py +199 -0
- loopx/control_plane/goals/global_registry_shadow.py +33 -0
- loopx/control_plane/goals/goal_channel.py +34 -0
- loopx/control_plane/goals/goal_channel_projection.py +560 -0
- loopx/control_plane/goals/goal_frontier/__init__.py +1917 -0
- loopx/control_plane/goals/goal_frontier/ack_policy.py +149 -0
- loopx/control_plane/goals/goal_frontier/outcome_continuity.py +437 -0
- loopx/control_plane/goals/goal_frontier/replan_rules.py +210 -0
- loopx/control_plane/goals/goal_frontier/semantic_history.py +314 -0
- loopx/control_plane/goals/goal_frontier/terminal.py +180 -0
- loopx/control_plane/goals/goal_vision.py +443 -0
- loopx/control_plane/goals/goal_vision_policy.py +36 -0
- loopx/control_plane/goals/goal_vision_state.py +62 -0
- loopx/control_plane/goals/goal_vision_wait.py +290 -0
- loopx/control_plane/goals/path_resolution.py +20 -0
- loopx/control_plane/goals/start_contract.py +206 -0
- loopx/control_plane/goals/vision_checkpoint.py +92 -0
- loopx/control_plane/handoff/__init__.py +1 -0
- loopx/control_plane/handoff/cross_runtime_impl_review.py +311 -0
- loopx/control_plane/handoff/delivery_contract.py +161 -0
- loopx/control_plane/handoff/handoff_runs.py +71 -0
- loopx/control_plane/handoff/project_handoff.py +155 -0
- loopx/control_plane/handoff/review_batch.py +463 -0
- loopx/control_plane/handoff/review_packet_context.py +216 -0
- loopx/control_plane/heartbeat/agent.py +173 -0
- loopx/control_plane/heartbeat/budget.py +66 -0
- loopx/control_plane/heartbeat/builder.py +501 -0
- loopx/control_plane/heartbeat/host.py +64 -0
- loopx/control_plane/heartbeat/rules.py +68 -0
- loopx/control_plane/heartbeat/task_body.py +759 -0
- loopx/control_plane/heartbeat/visible_goal.py +86 -0
- loopx/control_plane/projects/__init__.py +1 -0
- loopx/control_plane/projects/contract.py +25 -0
- loopx/control_plane/projects/registry.py +663 -0
- loopx/control_plane/quota/__init__.py +1 -0
- loopx/control_plane/quota/cli_projection.py +704 -0
- loopx/control_plane/quota/decision_summary.py +431 -0
- loopx/control_plane/quota/effect_program.py +152 -0
- loopx/control_plane/quota/error_codes.py +19 -0
- loopx/control_plane/quota/goal_boundary.py +464 -0
- loopx/control_plane/quota/heartbeat_receipt.py +277 -0
- loopx/control_plane/quota/heartbeat_recommendation.py +718 -0
- loopx/control_plane/quota/host_poll_receipts.py +162 -0
- loopx/control_plane/quota/live_decision.py +142 -0
- loopx/control_plane/quota/monitor_poll.py +786 -0
- loopx/control_plane/quota/policy_constants.py +40 -0
- loopx/control_plane/quota/projection_repair.py +262 -0
- loopx/control_plane/quota/recent_runs.py +210 -0
- loopx/control_plane/quota/scheduler_ack.py +490 -0
- loopx/control_plane/quota/selected_todo_projection.py +139 -0
- loopx/control_plane/quota/settlement.py +437 -0
- loopx/control_plane/quota/settlement_cli.py +246 -0
- loopx/control_plane/quota/settlement_validation.py +64 -0
- loopx/control_plane/quota/settlement_workspace_causality.py +180 -0
- loopx/control_plane/quota/should_run.py +249 -0
- loopx/control_plane/quota/should_run_packet.py +1165 -0
- loopx/control_plane/quota/should_run_prepare.py +675 -0
- loopx/control_plane/quota/slot_accounting.py +1123 -0
- loopx/control_plane/quota/spend_sources.py +11 -0
- loopx/control_plane/quota/stall_repair.py +397 -0
- loopx/control_plane/quota/states.py +29 -0
- loopx/control_plane/quota/task_orchestration.py +448 -0
- loopx/control_plane/quota/task_orchestration_admission.py +497 -0
- loopx/control_plane/quota/turn_envelope.py +889 -0
- loopx/control_plane/quota/usage_summary.py +140 -0
- loopx/control_plane/reward_memory.py +43 -0
- loopx/control_plane/runtime/__init__.py +2 -0
- loopx/control_plane/runtime/active_user_assisted_pilot.py +275 -0
- loopx/control_plane/runtime/agent_scoped_evidence_log.py +435 -0
- loopx/control_plane/runtime/decision_freshness.py +203 -0
- loopx/control_plane/runtime/event_ledger.py +197 -0
- loopx/control_plane/runtime/event_store_migration_bridge.py +196 -0
- loopx/control_plane/runtime/goal_project_route.py +70 -0
- loopx/control_plane/runtime/local_state_write_correctness.py +242 -0
- loopx/control_plane/runtime/promotion_readiness.py +152 -0
- loopx/control_plane/runtime/public_safety.py +120 -0
- loopx/control_plane/runtime/run_artifacts.py +78 -0
- loopx/control_plane/runtime/run_compaction.py +397 -0
- loopx/control_plane/runtime/run_context_retention.py +241 -0
- loopx/control_plane/runtime/run_history.py +132 -0
- loopx/control_plane/runtime/run_index_duplicates.py +205 -0
- loopx/control_plane/runtime/run_index_rebuild.py +263 -0
- loopx/control_plane/runtime/run_ingest_health.py +336 -0
- loopx/control_plane/runtime/runtime_projection_route.py +624 -0
- loopx/control_plane/runtime/runtime_projection_writer.py +98 -0
- loopx/control_plane/runtime/session_runtime.py +339 -0
- loopx/control_plane/runtime/shared_runtime_material_projection.py +332 -0
- loopx/control_plane/runtime/shared_runtime_refresh_projection.py +183 -0
- loopx/control_plane/runtime/stale_latest_run.py +90 -0
- loopx/control_plane/runtime/status_classifications.py +49 -0
- loopx/control_plane/runtime/status_projection_cache.py +235 -0
- loopx/control_plane/runtime/stride_observation.py +144 -0
- loopx/control_plane/runtime/time.py +39 -0
- loopx/control_plane/runtime/trajectory_hygiene.py +149 -0
- loopx/control_plane/runtime/validation_command.py +69 -0
- loopx/control_plane/scheduler/__init__.py +1 -0
- loopx/control_plane/scheduler/ack.py +329 -0
- loopx/control_plane/scheduler/arbitration.py +188 -0
- loopx/control_plane/scheduler/automation_liveness.py +183 -0
- loopx/control_plane/scheduler/execution_context.py +555 -0
- loopx/control_plane/scheduler/external_evidence_observation.py +428 -0
- loopx/control_plane/scheduler/monitor_display.py +143 -0
- loopx/control_plane/scheduler/monitor_poll_policy.py +161 -0
- loopx/control_plane/scheduler/monitor_poll_writeback.py +351 -0
- loopx/control_plane/scheduler/monitor_target.py +64 -0
- loopx/control_plane/scheduler/monitor_todo.py +146 -0
- loopx/control_plane/scheduler/monitor_wait.py +237 -0
- loopx/control_plane/scheduler/scheduler_hint.py +1284 -0
- loopx/control_plane/scheduler/state.py +354 -0
- loopx/control_plane/scheduler/state_transition_rules.py +179 -0
- loopx/control_plane/scheduler/time.py +10 -0
- loopx/control_plane/settlement_driver.py +293 -0
- loopx/control_plane/status/__init__.py +6 -0
- loopx/control_plane/status/active_state_projection.py +105 -0
- loopx/control_plane/status/agent_lane_projection.py +375 -0
- loopx/control_plane/status/attention_projection.py +74 -0
- loopx/control_plane/status/autonomous_replan_projection.py +103 -0
- loopx/control_plane/status/collection.py +140 -0
- loopx/control_plane/status/contract_projection.py +31 -0
- loopx/control_plane/status/dreaming_projection.py +52 -0
- loopx/control_plane/status/goal_attention_projection.py +157 -0
- loopx/control_plane/status/lifecycle_projection.py +110 -0
- loopx/control_plane/status/monitor_display_projection.py +69 -0
- loopx/control_plane/status/registry_health_projection.py +75 -0
- loopx/control_plane/status/run_projection.py +70 -0
- loopx/control_plane/status/runtime_summaries.py +161 -0
- loopx/control_plane/testing/__init__.py +1 -0
- loopx/control_plane/testing/actual_default_model_behavior_portfolio.py +1371 -0
- loopx/control_plane/testing/canary_harness.py +182 -0
- loopx/control_plane/testing/capability_monitor_repair_tool_behavior.py +674 -0
- loopx/control_plane/testing/cli_output_budget.py +807 -0
- loopx/control_plane/testing/cli_output_differential.py +250 -0
- loopx/control_plane/testing/cli_output_semantics.py +87 -0
- loopx/control_plane/testing/control_plane_composition_scenarios.py +225 -0
- loopx/control_plane/testing/decision_replay.py +268 -0
- loopx/control_plane/testing/doubao_model_behavior_actor.py +559 -0
- loopx/control_plane/testing/model_behavior_corpus.py +344 -0
- loopx/control_plane/testing/model_behavior_qualification.py +769 -0
- loopx/control_plane/testing/model_behavior_retained_cases.py +235 -0
- loopx/control_plane/testing/model_tool_behavior.py +536 -0
- loopx/control_plane/testing/onboarding_model_behavior_qualification.py +642 -0
- loopx/control_plane/testing/quota_fixtures.py +208 -0
- loopx/control_plane/testing/quota_should_run_parity.py +57 -0
- loopx/control_plane/testing/release_commit_qualification.py +671 -0
- loopx/control_plane/testing/replan_semantic_action_behavior.py +1302 -0
- loopx/control_plane/testing/scoped_gate_successor_tool_behavior.py +527 -0
- loopx/control_plane/testing/selected_todo_tool_behavior.py +1002 -0
- loopx/control_plane/testing/terminal_settlement_tool_behavior.py +656 -0
- loopx/control_plane/todos/__init__.py +1 -0
- loopx/control_plane/todos/active_state_editing.py +296 -0
- loopx/control_plane/todos/active_state_todo_parser.py +138 -0
- loopx/control_plane/todos/active_state_todos.py +175 -0
- loopx/control_plane/todos/addition.py +103 -0
- loopx/control_plane/todos/claim_visibility.py +253 -0
- loopx/control_plane/todos/completed_archive.py +139 -0
- loopx/control_plane/todos/completion_fence.py +49 -0
- loopx/control_plane/todos/completion_policy.py +153 -0
- loopx/control_plane/todos/completion_validation.py +248 -0
- loopx/control_plane/todos/completion_validation_accountability.py +27 -0
- loopx/control_plane/todos/completion_validation_projection.py +57 -0
- loopx/control_plane/todos/contract.py +1476 -0
- loopx/control_plane/todos/decision_scope.py +554 -0
- loopx/control_plane/todos/deferred_resume.py +546 -0
- loopx/control_plane/todos/durable_completion.py +201 -0
- loopx/control_plane/todos/event_writeback.py +484 -0
- loopx/control_plane/todos/frontier_deadline.py +132 -0
- loopx/control_plane/todos/handoff_gate.py +283 -0
- loopx/control_plane/todos/handoff_mode.py +444 -0
- loopx/control_plane/todos/handoff_note.py +202 -0
- loopx/control_plane/todos/line_update.py +361 -0
- loopx/control_plane/todos/list_projection.py +205 -0
- loopx/control_plane/todos/markdown.py +199 -0
- loopx/control_plane/todos/monitor_metadata.py +88 -0
- loopx/control_plane/todos/mutation_authority.py +299 -0
- loopx/control_plane/todos/projection.py +655 -0
- loopx/control_plane/todos/quota_summary.py +1138 -0
- loopx/control_plane/todos/route_continuation.py +267 -0
- loopx/control_plane/todos/succession_warning.py +174 -0
- loopx/control_plane/todos/summary_item.py +223 -0
- loopx/control_plane/todos/text.py +30 -0
- loopx/control_plane/todos/todo_index.py +226 -0
- loopx/control_plane/todos/todo_summary.py +1458 -0
- loopx/control_plane/todos/unblock_resume.py +326 -0
- loopx/control_plane/todos/user_gate.py +263 -0
- loopx/control_plane/todos/write_hint.py +63 -0
- loopx/control_plane/todos/write_policy.py +135 -0
- loopx/control_plane/turn_driver/__init__.py +85 -0
- loopx/control_plane/turn_driver/codex_cli.py +502 -0
- loopx/control_plane/turn_driver/driver.py +355 -0
- loopx/control_plane/turn_driver/executor.py +1468 -0
- loopx/control_plane/turn_driver/loop_controller.py +669 -0
- loopx/control_plane/turn_driver/settlement.py +318 -0
- loopx/control_plane/turn_driver/transaction.py +375 -0
- loopx/control_plane/work_items/__init__.py +1 -0
- loopx/control_plane/work_items/attention_fields.py +56 -0
- loopx/control_plane/work_items/attention_item.py +77 -0
- loopx/control_plane/work_items/attention_queue.py +322 -0
- loopx/control_plane/work_items/attention_routing.py +213 -0
- loopx/control_plane/work_items/autonomous_candidates.py +135 -0
- loopx/control_plane/work_items/autonomous_replan_ack.py +276 -0
- loopx/control_plane/work_items/autonomous_replan_obligation.py +786 -0
- loopx/control_plane/work_items/backlog_hygiene.py +59 -0
- loopx/control_plane/work_items/capability_monitor_fallback.py +221 -0
- loopx/control_plane/work_items/delivery_batch_scale.py +66 -0
- loopx/control_plane/work_items/delivery_outcome.py +152 -0
- loopx/control_plane/work_items/delivery_signals.py +113 -0
- loopx/control_plane/work_items/execution_obligation.py +235 -0
- loopx/control_plane/work_items/goal_route_hint.py +320 -0
- loopx/control_plane/work_items/interaction_contract.py +1540 -0
- loopx/control_plane/work_items/issue_meta_surface.py +159 -0
- loopx/control_plane/work_items/lifecycle.py +139 -0
- loopx/control_plane/work_items/operator_inbox.py +266 -0
- loopx/control_plane/work_items/outcome_followthrough.py +69 -0
- loopx/control_plane/work_items/primary_action.py +326 -0
- loopx/control_plane/work_items/progress_observation.py +630 -0
- loopx/control_plane/work_items/project_asset.py +675 -0
- loopx/control_plane/work_items/repair_delta.py +693 -0
- loopx/control_plane/work_items/runtime_capability_reentry.py +168 -0
- loopx/control_plane/work_items/semantic_replan_writeback.py +177 -0
- loopx/control_plane/work_items/status_contract.py +49 -0
- loopx/control_plane/work_items/task_graph.py +1046 -0
- loopx/control_plane/work_items/task_lease.py +1254 -0
- loopx/control_plane/work_items/task_lease_settlement.py +422 -0
- loopx/control_plane/work_items/work_lane.py +510 -0
- loopx/control_plane/work_items/work_lane_context.py +161 -0
- loopx/demo.py +247 -0
- loopx/diagnose.py +633 -0
- loopx/doctor.py +1251 -0
- loopx/domain_packs/__init__.py +1 -0
- loopx/domain_packs/issue_fix.py +571 -0
- loopx/domain_packs/ml_experiment.py +854 -0
- loopx/domain_state.py +137 -0
- loopx/dreaming.py +706 -0
- loopx/entrypoint.py +16 -0
- loopx/event_sourced_state.py +981 -0
- loopx/execution_profile.py +286 -0
- loopx/experiments/__init__.py +1 -0
- loopx/experiments/planner_worker/__init__.py +1 -0
- loopx/experiments/planner_worker/contract.py +523 -0
- loopx/experiments/planner_worker/runtime.py +391 -0
- loopx/experiments/planner_worker/traex.py +461 -0
- loopx/explore_graph.py +11 -0
- loopx/extensions/__init__.py +1 -0
- loopx/extensions/bundled.py +28 -0
- loopx/extensions/execution_envelope.py +126 -0
- loopx/extensions/lark/__init__.py +11 -0
- loopx/extensions/lark/event_collector.py +478 -0
- loopx/extensions/lark/event_collector_runtime.py +506 -0
- loopx/extensions/lark/event_inbox.py +454 -0
- loopx/extensions/lark/extension.toml +88 -0
- loopx/extensions/lark/goal_channel.py +44 -0
- loopx/extensions/lark/goal_channel_contracts.py +388 -0
- loopx/extensions/lark/goal_channel_lifecycle.py +218 -0
- loopx/extensions/lark/goal_channel_runtime.py +792 -0
- loopx/extensions/lark/goal_channel_setup.py +805 -0
- loopx/extensions/lark/goal_channel_targets.py +215 -0
- loopx/extensions/lark/goal_channel_transport.py +281 -0
- loopx/extensions/lark/inbox_reactions.py +650 -0
- loopx/extensions/lark/inbox_reply.py +430 -0
- loopx/extensions/lark/presentation/__init__.py +11 -0
- loopx/extensions/lark/presentation/explore_results.py +2276 -0
- loopx/extensions/lark/presentation/explore_singleflight.py +127 -0
- loopx/extensions/lark/presentation/explore_source_guard.py +121 -0
- loopx/extensions/lark/presentation/explore_stage_document.py +703 -0
- loopx/extensions/lark/presentation/explore_visual_integrity.py +122 -0
- loopx/extensions/lark/presentation/explore_visual_readback.py +452 -0
- loopx/extensions/lark/presentation/explore_visual_styles.py +156 -0
- loopx/extensions/lark/presentation/issue_fix_surface.py +612 -0
- loopx/extensions/lark/presentation/kanban.py +2791 -0
- loopx/extensions/lark/presentation/message_card.py +112 -0
- loopx/extensions/lark/presentation/periodic_report.py +261 -0
- loopx/extensions/lark/presentation/projection_rows.py +600 -0
- loopx/extensions/lark/presentation/record_io.py +95 -0
- loopx/extensions/lark/presentation/sync_receipt.py +145 -0
- loopx/extensions/lark/private_json.py +40 -0
- loopx/extensions/lark/provider.py +86 -0
- loopx/extensions/lark/reviewer_notification.py +604 -0
- loopx/extensions/manifest.py +385 -0
- loopx/extensions/openviking_periodic_report/__init__.py +17 -0
- loopx/extensions/openviking_periodic_report/activation.py +173 -0
- loopx/extensions/openviking_periodic_report/extension.toml +17 -0
- loopx/extensions/openviking_periodic_report/provider.py +355 -0
- loopx/extensions/openviking_periodic_report/sink.py +117 -0
- loopx/extensions/openviking_semantic_preference/__init__.py +5 -0
- loopx/extensions/openviking_semantic_preference/extension.toml +16 -0
- loopx/extensions/openviking_semantic_preference/history_export.py +484 -0
- loopx/extensions/openviking_semantic_preference/project_peer.py +68 -0
- loopx/extensions/openviking_semantic_preference/provider.py +312 -0
- loopx/extensions/presentation.py +979 -0
- loopx/extensions/process_runtime.py +204 -0
- loopx/extensions/readiness.py +168 -0
- loopx/extensions/runtime.py +931 -0
- loopx/extensions/scaffold.py +335 -0
- loopx/feedback.py +581 -0
- loopx/file_lock.py +382 -0
- loopx/global_registry.py +842 -0
- loopx/global_risks.py +970 -0
- loopx/global_todos.py +568 -0
- loopx/handoff_budget.py +28 -0
- loopx/heartbeat_prequota.py +80 -0
- loopx/heartbeat_prompt.py +159 -0
- loopx/help_surface.py +516 -0
- loopx/history.py +1507 -0
- loopx/host_loop_activation.py +1311 -0
- loopx/host_mode_planner.py +991 -0
- loopx/install_contract.py +1 -0
- loopx/interface_budget.py +196 -0
- loopx/long_task_cadence.py +208 -0
- loopx/materials.py +185 -0
- loopx/ml_experiment.py +3 -0
- loopx/onboarding.py +214 -0
- loopx/opencode2_goal_mode/README.md +81 -0
- loopx/opencode2_goal_mode/__init__.py +9 -0
- loopx/opencode2_goal_mode/opencode2-goal-worker.mjs +1018 -0
- loopx/opencode_goal_mode/README.md +99 -0
- loopx/opencode_goal_mode/__init__.py +13 -0
- loopx/opencode_goal_mode/goal-bridge-runtime.mjs +858 -0
- loopx/opencode_goal_mode/loopx-goal.js +8 -0
- loopx/operator_gate.py +420 -0
- loopx/orchestration.py +127 -0
- loopx/paths.py +59 -0
- loopx/pi_goal_mode/README.md +67 -0
- loopx/pi_goal_mode/__init__.py +13 -0
- loopx/pi_goal_mode/loopx-goal.ts +254 -0
- loopx/pi_goal_mode/pi-goal-loop-runtime.mjs +574 -0
- loopx/pr_review.py +1206 -0
- loopx/presentation/__init__.py +1 -0
- loopx/presentation/explore_views.py +1334 -0
- loopx/presentation/markdown.py +61 -0
- loopx/presentation/projection_source_reconcile.py +140 -0
- loopx/presentation/public_safety.py +42 -0
- loopx/presentation/renderers/__init__.py +17 -0
- loopx/presentation/renderers/goal_channel_html.py +269 -0
- loopx/presentation/renderers/periodic_report_html.py +786 -0
- loopx/presentation/renderers/periodic_report_markdown.py +184 -0
- loopx/presentation/renderers/quota_event_markdown.py +116 -0
- loopx/presentation/renderers/quota_markdown.py +1112 -0
- loopx/presentation/renderers/status_markdown.py +1570 -0
- loopx/presentation/renderers/trajectory_hygiene_markdown.py +39 -0
- loopx/presentation/renderers/turn_envelope_markdown.py +33 -0
- loopx/presentation/sinks/__init__.py +5 -0
- loopx/presentation/sinks/openviking_periodic_report.py +7 -0
- loopx/presentation/static_site.py +691 -0
- loopx/presets.py +369 -0
- loopx/project_alias.py +217 -0
- loopx/project_map.py +589 -0
- loopx/project_prompt.py +1153 -0
- loopx/project_skill_cli.py +125 -0
- loopx/project_skill_delivery.py +470 -0
- loopx/project_uninstall.py +462 -0
- loopx/promotion_gate.py +197 -0
- loopx/quota.py +1197 -0
- loopx/ready_score.py +413 -0
- loopx/registry.py +621 -0
- loopx/registry_writability.py +64 -0
- loopx/release_candidate.py +148 -0
- loopx/release_manifest.py +316 -0
- loopx/repository_identity.py +100 -0
- loopx/review_packet.py +1024 -0
- loopx/rollout_event_log.py +505 -0
- loopx/runtime.py +112 -0
- loopx/self_update.py +750 -0
- loopx/session_runtime.py +418 -0
- loopx/skill_install_readback.py +500 -0
- loopx/slash_command_install.py +1393 -0
- loopx/slash_commands.py +264 -0
- loopx/state_backup.py +573 -0
- loopx/state_migration.py +350 -0
- loopx/state_projection.py +809 -0
- loopx/state_refresh.py +1416 -0
- loopx/status.py +1383 -0
- loopx/status_server.py +935 -0
- loopx/summary_all.py +725 -0
- loopx/terminal_bench_agent.py +2056 -0
- loopx/thread_agent_binding.py +408 -0
- loopx/todo_followups.py +168 -0
- loopx/todo_suggestion_prompt.py +204 -0
- loopx/todos.py +2229 -0
- loopx/turn_identity.py +17 -0
- loopx/upgrade.py +1083 -0
- loopx/visible_governance.py +667 -0
- loopx/visible_multi_agent_launcher.py +1253 -0
- loopx/visible_multi_agent_tmux.py +429 -0
- loopx/worker_bridge.py +1574 -0
- loopx-0.4.8.dist-info/METADATA +708 -0
- loopx-0.4.8.dist-info/RECORD +811 -0
- loopx-0.4.8.dist-info/WHEEL +5 -0
- loopx-0.4.8.dist-info/entry_points.txt +5 -0
- loopx-0.4.8.dist-info/licenses/LICENSE +202 -0
- loopx-0.4.8.dist-info/licenses/LICENSE-MIT +21 -0
- loopx-0.4.8.dist-info/licenses/NOTICE +6 -0
- loopx-0.4.8.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1235 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import re
|
|
5
|
+
from collections.abc import Mapping, Sequence
|
|
6
|
+
from pathlib import Path, PurePosixPath
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from ...control_plane.runtime.public_safety import public_safe_compact_text
|
|
10
|
+
from .metadata_preview import normalise_github_issue_link_reference
|
|
11
|
+
from .repository_commit_evidence import (
|
|
12
|
+
ISSUE_FIX_REPOSITORY_COMMIT_EVIDENCE_SCHEMA_VERSION,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
ISSUE_FIX_OUTCOME_PROJECTION_SCHEMA_VERSION = "issue_fix_outcome_projection_v0"
|
|
17
|
+
ISSUE_FIX_OUTCOME_CASE_SCHEMA_VERSION = "issue_fix_outcome_case_v0"
|
|
18
|
+
ISSUE_FIX_OUTCOME_COLLECTION_PROJECTION_SCHEMA_VERSION = (
|
|
19
|
+
"issue_fix_outcome_collection_projection_v0"
|
|
20
|
+
)
|
|
21
|
+
ISSUE_FIX_DELIVERY_EVIDENCE_INPUT_SCHEMA_VERSION = (
|
|
22
|
+
"issue_fix_delivery_evidence_input_v0"
|
|
23
|
+
)
|
|
24
|
+
ISSUE_FIX_REUSABLE_KNOWLEDGE_INPUT_SCHEMA_VERSION = (
|
|
25
|
+
"issue_fix_reusable_knowledge_input_v0"
|
|
26
|
+
)
|
|
27
|
+
ISSUE_FIX_REPOSITORY_LEARNING_CARD_INPUT_SCHEMA_VERSION = (
|
|
28
|
+
"issue_fix_repository_learning_card_input_v0"
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
DELIVERY_VALIDATION_STATUSES = {"passed", "failed", "partial", "not_run"}
|
|
32
|
+
DELIVERY_OUTCOME_STATUSES = {"in_progress", "completed", "blocked"}
|
|
33
|
+
BRANCH_REPLAN_MERGE_STATES = {"BEHIND", "DIRTY"}
|
|
34
|
+
_REPOSITORY_FINGERPRINT_PATTERN = re.compile(r"sha256:[0-9a-f]{64}")
|
|
35
|
+
_COMMIT_OID_PATTERN = re.compile(r"[0-9a-fA-F]{40,64}")
|
|
36
|
+
_RECOVERY_REF_PATTERN = re.compile(
|
|
37
|
+
r"refs/(?:heads|remotes|tags)/[A-Za-z0-9][A-Za-z0-9._/-]{0,180}"
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _mapping(value: Any) -> dict[str, Any]:
|
|
42
|
+
return dict(value) if isinstance(value, Mapping) else {}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _safe_text(value: Any, *, field: str, limit: int = 260) -> str:
|
|
46
|
+
if value is None:
|
|
47
|
+
return ""
|
|
48
|
+
text = public_safe_compact_text(value, limit=limit)
|
|
49
|
+
if str(value).strip() and not text:
|
|
50
|
+
raise ValueError(f"{field} must be a compact public-safe value")
|
|
51
|
+
return text
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _safe_text_list(
|
|
55
|
+
value: Any,
|
|
56
|
+
*,
|
|
57
|
+
field: str,
|
|
58
|
+
limit: int = 220,
|
|
59
|
+
count_limit: int = 20,
|
|
60
|
+
) -> list[str]:
|
|
61
|
+
if value is None:
|
|
62
|
+
return []
|
|
63
|
+
if not isinstance(value, Sequence) or isinstance(value, (str, bytes)):
|
|
64
|
+
raise ValueError(f"{field} must be a list")
|
|
65
|
+
return [
|
|
66
|
+
text
|
|
67
|
+
for index, item in enumerate(value)
|
|
68
|
+
if (text := _safe_text(item, field=f"{field}[{index}]", limit=limit))
|
|
69
|
+
][:count_limit]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _repo_relative_files(value: Any) -> list[str]:
|
|
73
|
+
files = _safe_text_list(value, field="changed_files", limit=260)
|
|
74
|
+
for path in files:
|
|
75
|
+
pure = PurePosixPath(path)
|
|
76
|
+
if (
|
|
77
|
+
path.startswith(("/", "~"))
|
|
78
|
+
or "\\" in path
|
|
79
|
+
or pure.is_absolute()
|
|
80
|
+
or ".." in pure.parts
|
|
81
|
+
):
|
|
82
|
+
raise ValueError("changed_files must contain only repo-relative paths")
|
|
83
|
+
return files
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _repository_commit_evidence(value: Any) -> dict[str, Any] | None:
|
|
87
|
+
if value is None:
|
|
88
|
+
return None
|
|
89
|
+
if not isinstance(value, Mapping):
|
|
90
|
+
raise ValueError("repository_commit_evidence must be an object")
|
|
91
|
+
if (
|
|
92
|
+
value.get("schema_version")
|
|
93
|
+
!= ISSUE_FIX_REPOSITORY_COMMIT_EVIDENCE_SCHEMA_VERSION
|
|
94
|
+
):
|
|
95
|
+
raise ValueError(
|
|
96
|
+
"repository_commit_evidence schema_version must be "
|
|
97
|
+
"issue_fix_repository_commit_evidence_v0"
|
|
98
|
+
)
|
|
99
|
+
evidence = {
|
|
100
|
+
"schema_version": ISSUE_FIX_REPOSITORY_COMMIT_EVIDENCE_SCHEMA_VERSION,
|
|
101
|
+
"status": _safe_text(
|
|
102
|
+
value.get("status"), field="commit evidence status", limit=20
|
|
103
|
+
),
|
|
104
|
+
"repo": _safe_text(value.get("repo"), field="commit evidence repo", limit=180),
|
|
105
|
+
"repository_fingerprint": _safe_text(
|
|
106
|
+
value.get("repository_fingerprint"),
|
|
107
|
+
field="repository fingerprint",
|
|
108
|
+
limit=80,
|
|
109
|
+
),
|
|
110
|
+
"declared_repository_revision": _safe_text(
|
|
111
|
+
value.get("declared_repository_revision")
|
|
112
|
+
or value.get("repository_revision"),
|
|
113
|
+
field="declared repository revision",
|
|
114
|
+
limit=80,
|
|
115
|
+
),
|
|
116
|
+
"repository_revision": _safe_text(
|
|
117
|
+
value.get("repository_revision"),
|
|
118
|
+
field="commit evidence repository revision",
|
|
119
|
+
limit=80,
|
|
120
|
+
),
|
|
121
|
+
"declared_commit_ref": _safe_text(
|
|
122
|
+
value.get("declared_commit_ref"),
|
|
123
|
+
field="declared commit ref",
|
|
124
|
+
limit=80,
|
|
125
|
+
),
|
|
126
|
+
"commit_oid": _safe_text(value.get("commit_oid"), field="commit oid", limit=80),
|
|
127
|
+
"recovery_ref": _safe_text(
|
|
128
|
+
value.get("recovery_ref"), field="recovery ref", limit=200
|
|
129
|
+
),
|
|
130
|
+
"recovery_ref_oid": _safe_text(
|
|
131
|
+
value.get("recovery_ref_oid"), field="recovery ref oid", limit=80
|
|
132
|
+
),
|
|
133
|
+
"commit_is_ancestor": value.get("commit_is_ancestor") is True,
|
|
134
|
+
"verified_at": _safe_text(
|
|
135
|
+
value.get("verified_at"), field="commit evidence verified_at", limit=80
|
|
136
|
+
),
|
|
137
|
+
"repo_path_captured": value.get("repo_path_captured") is True,
|
|
138
|
+
"remote_urls_captured": value.get("remote_urls_captured") is True,
|
|
139
|
+
"raw_git_output_captured": value.get("raw_git_output_captured") is True,
|
|
140
|
+
}
|
|
141
|
+
if evidence["status"] != "verified":
|
|
142
|
+
raise ValueError("repository_commit_evidence status must be verified")
|
|
143
|
+
if not _REPOSITORY_FINGERPRINT_PATTERN.fullmatch(
|
|
144
|
+
evidence["repository_fingerprint"]
|
|
145
|
+
):
|
|
146
|
+
raise ValueError("repository_commit_evidence fingerprint must use sha256")
|
|
147
|
+
for field in ("repository_revision", "commit_oid", "recovery_ref_oid"):
|
|
148
|
+
if not _COMMIT_OID_PATTERN.fullmatch(str(evidence[field])):
|
|
149
|
+
raise ValueError(f"repository_commit_evidence {field} must be a commit oid")
|
|
150
|
+
if not _RECOVERY_REF_PATTERN.fullmatch(str(evidence["recovery_ref"])):
|
|
151
|
+
raise ValueError(
|
|
152
|
+
"repository_commit_evidence recovery_ref must be a full git ref"
|
|
153
|
+
)
|
|
154
|
+
if evidence["recovery_ref_oid"] != evidence["repository_revision"]:
|
|
155
|
+
raise ValueError(
|
|
156
|
+
"repository_commit_evidence recovery ref must pin the revision"
|
|
157
|
+
)
|
|
158
|
+
if not evidence["commit_is_ancestor"]:
|
|
159
|
+
raise ValueError("repository_commit_evidence must prove commit ancestry")
|
|
160
|
+
if any(
|
|
161
|
+
evidence[field]
|
|
162
|
+
for field in (
|
|
163
|
+
"repo_path_captured",
|
|
164
|
+
"remote_urls_captured",
|
|
165
|
+
"raw_git_output_captured",
|
|
166
|
+
)
|
|
167
|
+
):
|
|
168
|
+
raise ValueError(
|
|
169
|
+
"repository_commit_evidence must not capture local or raw git data"
|
|
170
|
+
)
|
|
171
|
+
return evidence
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def _commit_evidence_status(
|
|
175
|
+
delivery: Mapping[str, Any], *, repo: str, repository_revision: str
|
|
176
|
+
) -> tuple[str, str | None]:
|
|
177
|
+
commit_ref = str(delivery.get("commit_ref") or "").strip()
|
|
178
|
+
verification_required = bool(
|
|
179
|
+
commit_ref
|
|
180
|
+
and (
|
|
181
|
+
delivery.get("validation_status") == "passed"
|
|
182
|
+
or delivery.get("outcome_status") == "completed"
|
|
183
|
+
)
|
|
184
|
+
)
|
|
185
|
+
if not verification_required:
|
|
186
|
+
return "not_required", None
|
|
187
|
+
evidence = delivery.get("repository_commit_evidence")
|
|
188
|
+
if not isinstance(evidence, Mapping):
|
|
189
|
+
return "unverified", "repository_commit_evidence_missing"
|
|
190
|
+
expected = {
|
|
191
|
+
"repo": repo,
|
|
192
|
+
"declared_repository_revision": repository_revision,
|
|
193
|
+
"declared_commit_ref": commit_ref,
|
|
194
|
+
}
|
|
195
|
+
if any(str(evidence.get(key) or "") != value for key, value in expected.items()):
|
|
196
|
+
return "unverified", "repository_commit_evidence_mismatch"
|
|
197
|
+
return "verified", None
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def _reusable_knowledge(value: Any) -> dict[str, Any] | None:
|
|
201
|
+
if value is None:
|
|
202
|
+
return None
|
|
203
|
+
if not isinstance(value, Mapping):
|
|
204
|
+
raise ValueError("reusable_knowledge must be an object")
|
|
205
|
+
schema_version = str(value.get("schema_version") or "").strip()
|
|
206
|
+
if schema_version not in {
|
|
207
|
+
ISSUE_FIX_REUSABLE_KNOWLEDGE_INPUT_SCHEMA_VERSION,
|
|
208
|
+
ISSUE_FIX_REPOSITORY_LEARNING_CARD_INPUT_SCHEMA_VERSION,
|
|
209
|
+
}:
|
|
210
|
+
raise ValueError(
|
|
211
|
+
"reusable_knowledge schema_version must be a supported reusable "
|
|
212
|
+
"knowledge or repository learning-card input"
|
|
213
|
+
)
|
|
214
|
+
compact = {
|
|
215
|
+
"schema_version": schema_version,
|
|
216
|
+
"symptom_signature": _safe_text(
|
|
217
|
+
value.get("symptom_signature"),
|
|
218
|
+
field="reusable_knowledge.symptom_signature",
|
|
219
|
+
limit=320,
|
|
220
|
+
),
|
|
221
|
+
"reproduction_contract": _safe_text(
|
|
222
|
+
value.get("reproduction_contract"),
|
|
223
|
+
field="reusable_knowledge.reproduction_contract",
|
|
224
|
+
limit=420,
|
|
225
|
+
),
|
|
226
|
+
"root_cause": _safe_text(
|
|
227
|
+
value.get("root_cause"),
|
|
228
|
+
field="reusable_knowledge.root_cause",
|
|
229
|
+
limit=420,
|
|
230
|
+
),
|
|
231
|
+
"violated_invariant": _safe_text(
|
|
232
|
+
value.get("violated_invariant"),
|
|
233
|
+
field="reusable_knowledge.violated_invariant",
|
|
234
|
+
limit=320,
|
|
235
|
+
),
|
|
236
|
+
"repair_pattern": _safe_text(
|
|
237
|
+
value.get("repair_pattern"),
|
|
238
|
+
field="reusable_knowledge.repair_pattern",
|
|
239
|
+
limit=420,
|
|
240
|
+
),
|
|
241
|
+
"validation_contract": _safe_text(
|
|
242
|
+
value.get("validation_contract"),
|
|
243
|
+
field="reusable_knowledge.validation_contract",
|
|
244
|
+
limit=420,
|
|
245
|
+
),
|
|
246
|
+
"applicability": _safe_text(
|
|
247
|
+
value.get("applicability"),
|
|
248
|
+
field="reusable_knowledge.applicability",
|
|
249
|
+
limit=320,
|
|
250
|
+
),
|
|
251
|
+
"non_applicability": _safe_text(
|
|
252
|
+
value.get("non_applicability"),
|
|
253
|
+
field="reusable_knowledge.non_applicability",
|
|
254
|
+
limit=320,
|
|
255
|
+
),
|
|
256
|
+
"verification_references": _repo_relative_files(
|
|
257
|
+
value.get("verification_references") or []
|
|
258
|
+
),
|
|
259
|
+
}
|
|
260
|
+
if schema_version == ISSUE_FIX_REPOSITORY_LEARNING_CARD_INPUT_SCHEMA_VERSION:
|
|
261
|
+
confidence = _safe_text(
|
|
262
|
+
value.get("confidence"),
|
|
263
|
+
field="reusable_knowledge.confidence",
|
|
264
|
+
limit=20,
|
|
265
|
+
).lower()
|
|
266
|
+
if confidence not in {"high", "medium", "low"}:
|
|
267
|
+
raise ValueError(
|
|
268
|
+
"reusable_knowledge.confidence must be high, medium, or low"
|
|
269
|
+
)
|
|
270
|
+
if value.get("current_checkout_verification_required") is not True:
|
|
271
|
+
raise ValueError(
|
|
272
|
+
"repository learning cards require current checkout verification"
|
|
273
|
+
)
|
|
274
|
+
compact.update(
|
|
275
|
+
{
|
|
276
|
+
"confidence": confidence,
|
|
277
|
+
"affected_modules": _repo_relative_files(
|
|
278
|
+
value.get("affected_modules") or []
|
|
279
|
+
),
|
|
280
|
+
"invalidation_conditions": _safe_text_list(
|
|
281
|
+
value.get("invalidation_conditions") or [],
|
|
282
|
+
field="reusable_knowledge.invalidation_conditions",
|
|
283
|
+
limit=320,
|
|
284
|
+
count_limit=8,
|
|
285
|
+
),
|
|
286
|
+
"revalidation_contract": _safe_text(
|
|
287
|
+
value.get("revalidation_contract"),
|
|
288
|
+
field="reusable_knowledge.revalidation_contract",
|
|
289
|
+
limit=420,
|
|
290
|
+
),
|
|
291
|
+
"current_checkout_verification_required": True,
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
missing = [
|
|
295
|
+
key for key, item in compact.items() if key != "schema_version" and not item
|
|
296
|
+
]
|
|
297
|
+
if missing:
|
|
298
|
+
raise ValueError(
|
|
299
|
+
"reusable_knowledge requires non-empty reusable fields: "
|
|
300
|
+
+ ", ".join(missing)
|
|
301
|
+
)
|
|
302
|
+
return compact
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def _delivery_evidence(value: Mapping[str, Any] | None) -> dict[str, Any]:
|
|
306
|
+
if value is None:
|
|
307
|
+
return {
|
|
308
|
+
"provided": False,
|
|
309
|
+
"outcome_status": "in_progress",
|
|
310
|
+
"validation_status": None,
|
|
311
|
+
"changed_files": [],
|
|
312
|
+
"commit_ref": None,
|
|
313
|
+
"repository_commit_evidence": None,
|
|
314
|
+
"outputs": [],
|
|
315
|
+
"risks": [],
|
|
316
|
+
}
|
|
317
|
+
schema_version = str(value.get("schema_version") or "").strip()
|
|
318
|
+
if schema_version != ISSUE_FIX_DELIVERY_EVIDENCE_INPUT_SCHEMA_VERSION:
|
|
319
|
+
raise ValueError(
|
|
320
|
+
"delivery evidence schema_version must be "
|
|
321
|
+
"issue_fix_delivery_evidence_input_v0"
|
|
322
|
+
)
|
|
323
|
+
validation_status = str(value.get("validation_status") or "not_run").strip()
|
|
324
|
+
if validation_status not in DELIVERY_VALIDATION_STATUSES:
|
|
325
|
+
raise ValueError(
|
|
326
|
+
"delivery evidence validation_status must be one of "
|
|
327
|
+
f"{sorted(DELIVERY_VALIDATION_STATUSES)}"
|
|
328
|
+
)
|
|
329
|
+
outcome_status = str(value.get("outcome_status") or "in_progress").strip()
|
|
330
|
+
if outcome_status not in DELIVERY_OUTCOME_STATUSES:
|
|
331
|
+
raise ValueError(
|
|
332
|
+
"delivery evidence outcome_status must be one of "
|
|
333
|
+
f"{sorted(DELIVERY_OUTCOME_STATUSES)}"
|
|
334
|
+
)
|
|
335
|
+
commit_ref = _safe_text(value.get("commit_ref"), field="commit_ref", limit=80)
|
|
336
|
+
if commit_ref and not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9._/-]{3,79}", commit_ref):
|
|
337
|
+
raise ValueError("commit_ref must be a compact public-safe git reference")
|
|
338
|
+
outputs: list[dict[str, str]] = []
|
|
339
|
+
raw_outputs = value.get("outputs") or []
|
|
340
|
+
if not isinstance(raw_outputs, Sequence) or isinstance(raw_outputs, (str, bytes)):
|
|
341
|
+
raise ValueError("delivery evidence outputs must be a list")
|
|
342
|
+
for index, item in enumerate(raw_outputs[:10]):
|
|
343
|
+
if not isinstance(item, Mapping):
|
|
344
|
+
raise ValueError(f"delivery evidence outputs[{index}] must be an object")
|
|
345
|
+
kind = _safe_text(item.get("kind"), field=f"outputs[{index}].kind", limit=60)
|
|
346
|
+
url = _safe_text(item.get("url"), field=f"outputs[{index}].url", limit=320)
|
|
347
|
+
if url and not url.startswith("https://"):
|
|
348
|
+
raise ValueError("delivery evidence output URLs must use https")
|
|
349
|
+
if kind or url:
|
|
350
|
+
outputs.append({"kind": kind or "artifact", "url": url})
|
|
351
|
+
return {
|
|
352
|
+
"provided": True,
|
|
353
|
+
"outcome_status": outcome_status,
|
|
354
|
+
"validation_status": validation_status,
|
|
355
|
+
"validation_label": _safe_text(
|
|
356
|
+
value.get("validation_label"), field="validation_label", limit=260
|
|
357
|
+
),
|
|
358
|
+
"changed_files": _repo_relative_files(value.get("changed_files") or []),
|
|
359
|
+
"commit_ref": commit_ref or None,
|
|
360
|
+
"repository_commit_evidence": _repository_commit_evidence(
|
|
361
|
+
value.get("repository_commit_evidence")
|
|
362
|
+
),
|
|
363
|
+
"outputs": outputs,
|
|
364
|
+
"risks": _safe_text_list(
|
|
365
|
+
value.get("risks") or [], field="risks", limit=260, count_limit=10
|
|
366
|
+
),
|
|
367
|
+
"recorded_at": _safe_text(
|
|
368
|
+
value.get("recorded_at"), field="recorded_at", limit=80
|
|
369
|
+
)
|
|
370
|
+
or None,
|
|
371
|
+
"reusable_knowledge": _reusable_knowledge(value.get("reusable_knowledge")),
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
def compact_issue_fix_delivery_evidence(
|
|
376
|
+
value: Mapping[str, Any],
|
|
377
|
+
*,
|
|
378
|
+
recorded_at: str | None = None,
|
|
379
|
+
) -> dict[str, Any]:
|
|
380
|
+
"""Validate and compact delivery evidence before domain-state writeback."""
|
|
381
|
+
|
|
382
|
+
delivery = _delivery_evidence(value)
|
|
383
|
+
compact: dict[str, Any] = {
|
|
384
|
+
"schema_version": ISSUE_FIX_DELIVERY_EVIDENCE_INPUT_SCHEMA_VERSION,
|
|
385
|
+
"outcome_status": delivery["outcome_status"],
|
|
386
|
+
"validation_status": delivery["validation_status"],
|
|
387
|
+
"validation_label": delivery.get("validation_label") or "",
|
|
388
|
+
"changed_files": list(delivery.get("changed_files") or []),
|
|
389
|
+
"commit_ref": delivery.get("commit_ref"),
|
|
390
|
+
"outputs": list(delivery.get("outputs") or []),
|
|
391
|
+
"risks": list(delivery.get("risks") or []),
|
|
392
|
+
}
|
|
393
|
+
if delivery.get("repository_commit_evidence") is not None:
|
|
394
|
+
compact["repository_commit_evidence"] = dict(
|
|
395
|
+
delivery["repository_commit_evidence"]
|
|
396
|
+
)
|
|
397
|
+
if delivery.get("reusable_knowledge") is not None:
|
|
398
|
+
compact["reusable_knowledge"] = dict(delivery["reusable_knowledge"])
|
|
399
|
+
effective_recorded_at = recorded_at or delivery.get("recorded_at")
|
|
400
|
+
if effective_recorded_at:
|
|
401
|
+
compact["recorded_at"] = _safe_text(
|
|
402
|
+
effective_recorded_at,
|
|
403
|
+
field="delivery evidence recorded_at",
|
|
404
|
+
limit=80,
|
|
405
|
+
)
|
|
406
|
+
return compact
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
def _stage_and_card_status(
|
|
410
|
+
*,
|
|
411
|
+
route: str,
|
|
412
|
+
reproduction_status: str,
|
|
413
|
+
delivery_outcome_status: str,
|
|
414
|
+
commit_evidence_status: str,
|
|
415
|
+
lifecycle_observation: Mapping[str, Any],
|
|
416
|
+
) -> tuple[str, str, str]:
|
|
417
|
+
if lifecycle_observation:
|
|
418
|
+
state = str(lifecycle_observation.get("state") or "OPEN").upper()
|
|
419
|
+
checks = _mapping(lifecycle_observation.get("checks"))
|
|
420
|
+
checks_aggregate = str(checks.get("aggregate") or "UNKNOWN").upper()
|
|
421
|
+
review_decision = str(
|
|
422
|
+
lifecycle_observation.get("review_decision") or "UNKNOWN"
|
|
423
|
+
).upper()
|
|
424
|
+
merge_state = str(
|
|
425
|
+
lifecycle_observation.get("merge_state_status") or "UNKNOWN"
|
|
426
|
+
).upper()
|
|
427
|
+
if state == "MERGED":
|
|
428
|
+
return "merged", "done", "P1"
|
|
429
|
+
if state == "CLOSED":
|
|
430
|
+
return "closed_without_merge", "done", "P1"
|
|
431
|
+
if commit_evidence_status == "unverified":
|
|
432
|
+
return "delivery_evidence_unverified", "blocked", "P1"
|
|
433
|
+
if delivery_outcome_status == "blocked":
|
|
434
|
+
return "delivery_blocked", "blocked", "P0"
|
|
435
|
+
if checks_aggregate == "FAILING":
|
|
436
|
+
return "ci_failed", "blocked", "P0"
|
|
437
|
+
if review_decision == "CHANGES_REQUESTED":
|
|
438
|
+
return "changes_requested", "blocked", "P0"
|
|
439
|
+
if merge_state in BRANCH_REPLAN_MERGE_STATES:
|
|
440
|
+
return "branch_stale_or_conflicted", "blocked", "P1"
|
|
441
|
+
if lifecycle_observation.get("is_draft") is True:
|
|
442
|
+
return "draft_pr", "open", "P1"
|
|
443
|
+
if checks_aggregate == "PENDING":
|
|
444
|
+
return "ci_pending", "open", "P2"
|
|
445
|
+
if review_decision == "APPROVED" and checks_aggregate == "PASSING":
|
|
446
|
+
return "merge_ready", "open", "P1"
|
|
447
|
+
if review_decision == "REVIEW_REQUIRED":
|
|
448
|
+
return "review_wait", "open", "P2"
|
|
449
|
+
return "pr_open", "open", "P2"
|
|
450
|
+
if route == "triage_only":
|
|
451
|
+
return "triage_complete", "done", "P1"
|
|
452
|
+
if commit_evidence_status == "unverified":
|
|
453
|
+
return "delivery_evidence_unverified", "blocked", "P1"
|
|
454
|
+
if route == "comment_only":
|
|
455
|
+
if delivery_outcome_status == "completed":
|
|
456
|
+
return "comment_published", "done", "P1"
|
|
457
|
+
if delivery_outcome_status == "blocked":
|
|
458
|
+
return "comment_blocked", "blocked", "P1"
|
|
459
|
+
return "comment_packet", "open", "P1"
|
|
460
|
+
if delivery_outcome_status == "blocked":
|
|
461
|
+
return "fix_blocked", "blocked", "P0"
|
|
462
|
+
if delivery_outcome_status == "completed":
|
|
463
|
+
return "fix_review_ready", "open", "P1"
|
|
464
|
+
if reproduction_status == "planned":
|
|
465
|
+
return "reproduction_planned", "open", "P0"
|
|
466
|
+
if reproduction_status in {"missing", "blocked"}:
|
|
467
|
+
return "reproduction_blocked", "blocked", "P0"
|
|
468
|
+
return "fix_in_progress", "open", "P0"
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
def _context_tags(
|
|
472
|
+
*,
|
|
473
|
+
route: str,
|
|
474
|
+
stage: str,
|
|
475
|
+
reproduction_status: str,
|
|
476
|
+
validation_status: str,
|
|
477
|
+
repository_context_status: str,
|
|
478
|
+
changed_files: Sequence[str],
|
|
479
|
+
commit_evidence_status: str,
|
|
480
|
+
) -> list[str]:
|
|
481
|
+
"""Build bounded, filterable reviewer context without free-form prose."""
|
|
482
|
+
|
|
483
|
+
tags = [
|
|
484
|
+
route,
|
|
485
|
+
stage,
|
|
486
|
+
f"reproduction_{reproduction_status}",
|
|
487
|
+
f"validation_{validation_status}",
|
|
488
|
+
]
|
|
489
|
+
if any(
|
|
490
|
+
PurePosixPath(path).parts and PurePosixPath(path).parts[0] in {"test", "tests"}
|
|
491
|
+
for path in changed_files
|
|
492
|
+
):
|
|
493
|
+
tags.append("tests_changed")
|
|
494
|
+
if len(changed_files) > 1:
|
|
495
|
+
tags.append("multi_file")
|
|
496
|
+
if repository_context_status == "grounded":
|
|
497
|
+
tags.append("repository_context_grounded")
|
|
498
|
+
if commit_evidence_status != "not_required":
|
|
499
|
+
tags.append(f"commit_{commit_evidence_status}")
|
|
500
|
+
return list(dict.fromkeys(tags))
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
def _result(
|
|
504
|
+
*,
|
|
505
|
+
route: str,
|
|
506
|
+
stage: str,
|
|
507
|
+
issue_url: str,
|
|
508
|
+
pr_url: str,
|
|
509
|
+
delivery: Mapping[str, Any],
|
|
510
|
+
) -> dict[str, Any]:
|
|
511
|
+
terminal = stage in {
|
|
512
|
+
"merged",
|
|
513
|
+
"closed_without_merge",
|
|
514
|
+
"triage_complete",
|
|
515
|
+
"comment_published",
|
|
516
|
+
}
|
|
517
|
+
if stage == "merged":
|
|
518
|
+
kind = "fix_pr_merged"
|
|
519
|
+
elif stage == "closed_without_merge":
|
|
520
|
+
kind = "pr_closed_without_merge"
|
|
521
|
+
elif stage == "triage_complete":
|
|
522
|
+
kind = "triage_complete"
|
|
523
|
+
elif stage == "comment_published":
|
|
524
|
+
kind = "useful_comment_published"
|
|
525
|
+
elif route == "comment_only":
|
|
526
|
+
kind = "comment_packet_pending_publication"
|
|
527
|
+
elif pr_url:
|
|
528
|
+
kind = "fix_pr_open"
|
|
529
|
+
else:
|
|
530
|
+
kind = "fix_in_progress"
|
|
531
|
+
outputs = list(delivery.get("outputs") or [])
|
|
532
|
+
known_urls = {
|
|
533
|
+
str(item.get("url") or "") for item in outputs if isinstance(item, Mapping)
|
|
534
|
+
}
|
|
535
|
+
for output_kind, url in (("issue", issue_url), ("pull_request", pr_url)):
|
|
536
|
+
if url and url not in known_urls:
|
|
537
|
+
outputs.append({"kind": output_kind, "url": url})
|
|
538
|
+
return {
|
|
539
|
+
"kind": kind,
|
|
540
|
+
"terminal": terminal,
|
|
541
|
+
"public_outputs": outputs,
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
def _evidence_summary(case: Mapping[str, Any]) -> str:
|
|
546
|
+
context = _mapping(case.get("repository_context"))
|
|
547
|
+
reproduction = _mapping(case.get("reproduction"))
|
|
548
|
+
validation = _mapping(case.get("validation"))
|
|
549
|
+
pull_request = _mapping(case.get("pull_request"))
|
|
550
|
+
issue = _mapping(case.get("issue"))
|
|
551
|
+
delivery = _mapping(case.get("delivery"))
|
|
552
|
+
result = _mapping(case.get("result"))
|
|
553
|
+
checks = _mapping(pull_request.get("checks"))
|
|
554
|
+
parts = [
|
|
555
|
+
f"stage={case.get('stage')}",
|
|
556
|
+
f"route={case.get('route')}",
|
|
557
|
+
f"revision={context.get('revision') or 'unknown'}",
|
|
558
|
+
f"context={context.get('fingerprint') or 'unknown'}",
|
|
559
|
+
f"reproduction={reproduction.get('status') or 'unknown'}",
|
|
560
|
+
f"validation={validation.get('status') or 'unknown'}",
|
|
561
|
+
]
|
|
562
|
+
if issue.get("url"):
|
|
563
|
+
parts.append(f"issue={issue.get('url')}")
|
|
564
|
+
if delivery.get("commit_ref"):
|
|
565
|
+
parts.append(f"commit={delivery.get('commit_ref')}")
|
|
566
|
+
parts.append(
|
|
567
|
+
f"commit_integrity={delivery.get('commit_evidence_status') or 'unverified'}"
|
|
568
|
+
)
|
|
569
|
+
changed_files = list(delivery.get("changed_files") or [])
|
|
570
|
+
if changed_files:
|
|
571
|
+
parts.append(f"changed_files={','.join(str(item) for item in changed_files)}")
|
|
572
|
+
if pull_request:
|
|
573
|
+
parts.extend(
|
|
574
|
+
[
|
|
575
|
+
f"pr_state={pull_request.get('state') or 'unknown'}",
|
|
576
|
+
f"checks={checks.get('aggregate') or 'unknown'}",
|
|
577
|
+
f"review={pull_request.get('review_decision') or 'unknown'}",
|
|
578
|
+
f"merge_state={pull_request.get('merge_state_status') or 'unknown'}",
|
|
579
|
+
f"pr={pull_request.get('url') or 'unknown'}",
|
|
580
|
+
]
|
|
581
|
+
)
|
|
582
|
+
output_urls = [
|
|
583
|
+
str(item.get("url") or "")
|
|
584
|
+
for item in result.get("public_outputs") or []
|
|
585
|
+
if isinstance(item, Mapping) and item.get("url")
|
|
586
|
+
]
|
|
587
|
+
if output_urls:
|
|
588
|
+
parts.append(f"outputs={','.join(output_urls)}")
|
|
589
|
+
risks = list(case.get("risks") or [])
|
|
590
|
+
if risks:
|
|
591
|
+
parts.append(f"risks={' | '.join(str(item) for item in risks)}")
|
|
592
|
+
return "; ".join(parts)
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
def build_issue_fix_outcome_projection(
|
|
596
|
+
*,
|
|
597
|
+
goal_id: str,
|
|
598
|
+
feasibility_packet: Mapping[str, Any],
|
|
599
|
+
pr_lifecycle_packet: Mapping[str, Any] | None = None,
|
|
600
|
+
delivery_evidence_input: Mapping[str, Any] | None = None,
|
|
601
|
+
agent_id: str | None = None,
|
|
602
|
+
generated_at: str | None = None,
|
|
603
|
+
) -> dict[str, Any]:
|
|
604
|
+
"""Compose one public-safe issue-fix case view without writing source state."""
|
|
605
|
+
|
|
606
|
+
feasibility_observation = _mapping(feasibility_packet.get("observation"))
|
|
607
|
+
feasibility_decision = _mapping(feasibility_packet.get("decision"))
|
|
608
|
+
if feasibility_packet.get("schema_version") != "issue_fix_feasibility_v0":
|
|
609
|
+
raise ValueError("feasibility packet must use issue_fix_feasibility_v0")
|
|
610
|
+
repo = _safe_text(feasibility_observation.get("repo"), field="repo", limit=180)
|
|
611
|
+
issue_ref = _safe_text(
|
|
612
|
+
feasibility_observation.get("issue_ref"), field="issue_ref", limit=180
|
|
613
|
+
)
|
|
614
|
+
if not repo or not issue_ref:
|
|
615
|
+
raise ValueError("feasibility packet must identify repo and issue_ref")
|
|
616
|
+
route = str(feasibility_decision.get("route") or "").strip()
|
|
617
|
+
if route not in {"fix_pr", "comment_only", "triage_only"}:
|
|
618
|
+
raise ValueError("feasibility packet must select a supported route")
|
|
619
|
+
|
|
620
|
+
lifecycle_observation: dict[str, Any] = {}
|
|
621
|
+
lifecycle_transition: dict[str, Any] = {}
|
|
622
|
+
if pr_lifecycle_packet is not None:
|
|
623
|
+
if (
|
|
624
|
+
pr_lifecycle_packet.get("schema_version")
|
|
625
|
+
!= "issue_fix_pr_lifecycle_monitor_v0"
|
|
626
|
+
):
|
|
627
|
+
raise ValueError(
|
|
628
|
+
"PR lifecycle packet must use issue_fix_pr_lifecycle_monitor_v0"
|
|
629
|
+
)
|
|
630
|
+
lifecycle_observation = _mapping(pr_lifecycle_packet.get("observation"))
|
|
631
|
+
lifecycle_transition = _mapping(pr_lifecycle_packet.get("transition"))
|
|
632
|
+
lifecycle_repo = str(lifecycle_observation.get("repo") or "").strip()
|
|
633
|
+
if lifecycle_repo != repo:
|
|
634
|
+
raise ValueError(
|
|
635
|
+
"feasibility and PR lifecycle packets must use the same repo"
|
|
636
|
+
)
|
|
637
|
+
|
|
638
|
+
repository_context = _mapping(feasibility_observation.get("repository_context"))
|
|
639
|
+
context_effect = _mapping(feasibility_packet.get("repository_context_effect"))
|
|
640
|
+
delivery = _delivery_evidence(delivery_evidence_input)
|
|
641
|
+
repository_revision = _safe_text(
|
|
642
|
+
repository_context.get("repository_revision"),
|
|
643
|
+
field="repository revision",
|
|
644
|
+
limit=80,
|
|
645
|
+
)
|
|
646
|
+
commit_evidence_status, commit_evidence_reason = _commit_evidence_status(
|
|
647
|
+
delivery,
|
|
648
|
+
repo=repo,
|
|
649
|
+
repository_revision=repository_revision,
|
|
650
|
+
)
|
|
651
|
+
effective_validation_status = (
|
|
652
|
+
"unverified"
|
|
653
|
+
if commit_evidence_status == "unverified"
|
|
654
|
+
else delivery.get("validation_status")
|
|
655
|
+
)
|
|
656
|
+
effective_delivery_outcome_status = (
|
|
657
|
+
"blocked"
|
|
658
|
+
if commit_evidence_status == "unverified"
|
|
659
|
+
else str(delivery.get("outcome_status") or "in_progress")
|
|
660
|
+
)
|
|
661
|
+
reproduction_status = str(
|
|
662
|
+
feasibility_observation.get("reproduction_status") or "missing"
|
|
663
|
+
).strip()
|
|
664
|
+
stage, card_status, priority = _stage_and_card_status(
|
|
665
|
+
route=route,
|
|
666
|
+
reproduction_status=reproduction_status,
|
|
667
|
+
delivery_outcome_status=effective_delivery_outcome_status,
|
|
668
|
+
commit_evidence_status=commit_evidence_status,
|
|
669
|
+
lifecycle_observation=lifecycle_observation,
|
|
670
|
+
)
|
|
671
|
+
issue_url = _safe_text(
|
|
672
|
+
feasibility_observation.get("permalink"), field="issue permalink", limit=320
|
|
673
|
+
)
|
|
674
|
+
pr_url = _safe_text(
|
|
675
|
+
lifecycle_observation.get("permalink"), field="PR permalink", limit=320
|
|
676
|
+
)
|
|
677
|
+
issue_number = feasibility_observation.get("number")
|
|
678
|
+
pr_number = lifecycle_observation.get("number")
|
|
679
|
+
title = f"[{route}] {repo} #{issue_number or issue_ref}"
|
|
680
|
+
if pr_number:
|
|
681
|
+
title += f" -> PR #{pr_number}"
|
|
682
|
+
validation_label = delivery.get("validation_label") or _safe_text(
|
|
683
|
+
feasibility_observation.get("validation_label"),
|
|
684
|
+
field="validation label",
|
|
685
|
+
limit=260,
|
|
686
|
+
)
|
|
687
|
+
validation_status = str(
|
|
688
|
+
effective_validation_status or ("declared" if validation_label else "unknown")
|
|
689
|
+
)
|
|
690
|
+
repository_context_status = (
|
|
691
|
+
_safe_text(
|
|
692
|
+
repository_context.get("context_status")
|
|
693
|
+
or context_effect.get("context_status"),
|
|
694
|
+
field="context status",
|
|
695
|
+
limit=80,
|
|
696
|
+
)
|
|
697
|
+
or "unknown"
|
|
698
|
+
)
|
|
699
|
+
changed_files = list(delivery.get("changed_files") or [])
|
|
700
|
+
feasibility_transition = _mapping(feasibility_packet.get("transition"))
|
|
701
|
+
projected_todo = _mapping(feasibility_transition.get("projected_todo"))
|
|
702
|
+
next_action = _safe_text(
|
|
703
|
+
lifecycle_transition.get("reason")
|
|
704
|
+
or projected_todo.get("text")
|
|
705
|
+
or feasibility_transition.get("decision"),
|
|
706
|
+
field="next action",
|
|
707
|
+
limit=320,
|
|
708
|
+
)
|
|
709
|
+
if commit_evidence_status == "unverified":
|
|
710
|
+
next_action = (
|
|
711
|
+
"Re-resolve commit_ref in the declared repository and record a "
|
|
712
|
+
"recoverable branch, tag, or remote ref before publication."
|
|
713
|
+
)
|
|
714
|
+
case: dict[str, Any] = {
|
|
715
|
+
"schema_version": ISSUE_FIX_OUTCOME_CASE_SCHEMA_VERSION,
|
|
716
|
+
"outcome_id": f"{repo}:{issue_ref}",
|
|
717
|
+
"title": title,
|
|
718
|
+
"summary": f"{stage}: {next_action}" if next_action else stage,
|
|
719
|
+
"goal_id": goal_id,
|
|
720
|
+
"repo": repo,
|
|
721
|
+
"issue_ref": issue_ref,
|
|
722
|
+
"route": route,
|
|
723
|
+
"stage": stage,
|
|
724
|
+
"status": card_status,
|
|
725
|
+
"priority": priority,
|
|
726
|
+
"task_class": "continuous_monitor"
|
|
727
|
+
if not card_status == "done"
|
|
728
|
+
else "advancement_task",
|
|
729
|
+
"action_kind": "issue_fix_outcome",
|
|
730
|
+
"claimed_by": _safe_text(agent_id, field="agent_id", limit=120) or None,
|
|
731
|
+
"issue": {
|
|
732
|
+
"number": issue_number,
|
|
733
|
+
"url": issue_url,
|
|
734
|
+
},
|
|
735
|
+
"repository_context": {
|
|
736
|
+
"revision": repository_revision or None,
|
|
737
|
+
"fingerprint": _safe_text(
|
|
738
|
+
repository_context.get("context_fingerprint")
|
|
739
|
+
or context_effect.get("context_fingerprint"),
|
|
740
|
+
field="context fingerprint",
|
|
741
|
+
limit=80,
|
|
742
|
+
)
|
|
743
|
+
or None,
|
|
744
|
+
"status": _safe_text(
|
|
745
|
+
repository_context.get("context_status")
|
|
746
|
+
or context_effect.get("context_status"),
|
|
747
|
+
field="context status",
|
|
748
|
+
limit=80,
|
|
749
|
+
)
|
|
750
|
+
or "unknown",
|
|
751
|
+
},
|
|
752
|
+
"reproduction": {
|
|
753
|
+
"status": reproduction_status,
|
|
754
|
+
"label": _safe_text(
|
|
755
|
+
feasibility_observation.get("reproduction_label"),
|
|
756
|
+
field="reproduction label",
|
|
757
|
+
limit=260,
|
|
758
|
+
)
|
|
759
|
+
or None,
|
|
760
|
+
"evidence_refs": list(
|
|
761
|
+
context_effect.get("reproduction_evidence_refs") or []
|
|
762
|
+
),
|
|
763
|
+
},
|
|
764
|
+
"validation": {
|
|
765
|
+
"status": validation_status,
|
|
766
|
+
"label": validation_label or None,
|
|
767
|
+
"evidence_refs": list(context_effect.get("validation_evidence_refs") or []),
|
|
768
|
+
},
|
|
769
|
+
"delivery": {
|
|
770
|
+
"evidence_provided": delivery.get("provided") is True,
|
|
771
|
+
"outcome_status": effective_delivery_outcome_status,
|
|
772
|
+
"reported_outcome_status": delivery.get("outcome_status"),
|
|
773
|
+
"reported_validation_status": delivery.get("validation_status"),
|
|
774
|
+
"commit_ref": delivery.get("commit_ref"),
|
|
775
|
+
"commit_evidence_status": commit_evidence_status,
|
|
776
|
+
"commit_evidence_reason": commit_evidence_reason,
|
|
777
|
+
"repository_commit_evidence": delivery.get("repository_commit_evidence"),
|
|
778
|
+
"changed_files": changed_files,
|
|
779
|
+
"recorded_at": delivery.get("recorded_at"),
|
|
780
|
+
},
|
|
781
|
+
"reusable_knowledge": delivery.get("reusable_knowledge"),
|
|
782
|
+
"pull_request": (
|
|
783
|
+
{
|
|
784
|
+
"number": pr_number,
|
|
785
|
+
"ref": lifecycle_observation.get("pr_ref"),
|
|
786
|
+
"url": pr_url,
|
|
787
|
+
"state": lifecycle_observation.get("state"),
|
|
788
|
+
"is_draft": lifecycle_observation.get("is_draft") is True,
|
|
789
|
+
"checks": _mapping(lifecycle_observation.get("checks")),
|
|
790
|
+
"review_decision": lifecycle_observation.get("review_decision"),
|
|
791
|
+
"merge_state_status": lifecycle_observation.get("merge_state_status"),
|
|
792
|
+
"merged_at": lifecycle_observation.get("merged_at"),
|
|
793
|
+
"closed_at": lifecycle_observation.get("closed_at"),
|
|
794
|
+
}
|
|
795
|
+
if lifecycle_observation
|
|
796
|
+
else None
|
|
797
|
+
),
|
|
798
|
+
"result": _result(
|
|
799
|
+
route=route,
|
|
800
|
+
stage=stage,
|
|
801
|
+
issue_url=issue_url,
|
|
802
|
+
pr_url=pr_url,
|
|
803
|
+
delivery=delivery,
|
|
804
|
+
),
|
|
805
|
+
"risks": list(delivery.get("risks") or []),
|
|
806
|
+
"context_tags": _context_tags(
|
|
807
|
+
route=route,
|
|
808
|
+
stage=stage,
|
|
809
|
+
reproduction_status=reproduction_status,
|
|
810
|
+
validation_status=validation_status,
|
|
811
|
+
repository_context_status=repository_context_status,
|
|
812
|
+
changed_files=changed_files,
|
|
813
|
+
commit_evidence_status=commit_evidence_status,
|
|
814
|
+
),
|
|
815
|
+
"next_action": next_action or None,
|
|
816
|
+
"handoff": next_action or "No further action projected.",
|
|
817
|
+
"scope": "issue_fix_outcome",
|
|
818
|
+
"_include_done_by_default": True,
|
|
819
|
+
}
|
|
820
|
+
case["evidence"] = _evidence_summary(case)
|
|
821
|
+
packet: dict[str, Any] = {
|
|
822
|
+
"ok": True,
|
|
823
|
+
"schema_version": ISSUE_FIX_OUTCOME_PROJECTION_SCHEMA_VERSION,
|
|
824
|
+
"mode": "issue-fix-outcome",
|
|
825
|
+
"source_id": "issue-fix-outcome",
|
|
826
|
+
"goal_id": goal_id,
|
|
827
|
+
"generated_at": generated_at,
|
|
828
|
+
"agent_identity": {"agent_id": agent_id} if agent_id else {},
|
|
829
|
+
"issue_fix_outcomes": [case],
|
|
830
|
+
"source_contract": {
|
|
831
|
+
"feasibility": "issue_fix_feasibility_v0",
|
|
832
|
+
"pr_lifecycle": (
|
|
833
|
+
"issue_fix_pr_lifecycle_monitor_v0"
|
|
834
|
+
if pr_lifecycle_packet is not None
|
|
835
|
+
else None
|
|
836
|
+
),
|
|
837
|
+
"delivery_evidence": (
|
|
838
|
+
ISSUE_FIX_DELIVERY_EVIDENCE_INPUT_SCHEMA_VERSION
|
|
839
|
+
if delivery_evidence_input is not None
|
|
840
|
+
else None
|
|
841
|
+
),
|
|
842
|
+
"repository_commit_evidence": (
|
|
843
|
+
ISSUE_FIX_REPOSITORY_COMMIT_EVIDENCE_SCHEMA_VERSION
|
|
844
|
+
if delivery.get("repository_commit_evidence") is not None
|
|
845
|
+
else None
|
|
846
|
+
),
|
|
847
|
+
"writes_source_state": False,
|
|
848
|
+
"creates_parallel_state_machine": False,
|
|
849
|
+
},
|
|
850
|
+
"external_reads_performed": False,
|
|
851
|
+
"external_writes_performed": False,
|
|
852
|
+
"raw_logs_captured": False,
|
|
853
|
+
"local_paths_captured": False,
|
|
854
|
+
"credentials_captured": False,
|
|
855
|
+
}
|
|
856
|
+
packet["validation"] = validate_issue_fix_outcome_projection(packet)
|
|
857
|
+
packet["ok"] = packet["validation"]["ok"]
|
|
858
|
+
return packet
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
def _load_domain_packets(path: Path) -> tuple[list[dict[str, Any]], list[str]]:
|
|
862
|
+
if not path.is_file():
|
|
863
|
+
return [], []
|
|
864
|
+
packets: list[dict[str, Any]] = []
|
|
865
|
+
warnings: list[str] = []
|
|
866
|
+
for line_number, line in enumerate(
|
|
867
|
+
path.read_text(encoding="utf-8").splitlines(), start=1
|
|
868
|
+
):
|
|
869
|
+
if not line.strip():
|
|
870
|
+
continue
|
|
871
|
+
try:
|
|
872
|
+
packet = json.loads(line)
|
|
873
|
+
except json.JSONDecodeError:
|
|
874
|
+
warnings.append(f"{path.name}:{line_number} is not valid JSON")
|
|
875
|
+
continue
|
|
876
|
+
if not isinstance(packet, dict):
|
|
877
|
+
warnings.append(f"{path.name}:{line_number} is not an object")
|
|
878
|
+
continue
|
|
879
|
+
packets.append(packet)
|
|
880
|
+
return packets, warnings
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
def _lifecycle_recency(packet: Mapping[str, Any]) -> tuple[str, str]:
|
|
884
|
+
observation = _mapping(packet.get("observation"))
|
|
885
|
+
return (
|
|
886
|
+
str(
|
|
887
|
+
observation.get("updated_at")
|
|
888
|
+
or observation.get("merged_at")
|
|
889
|
+
or observation.get("closed_at")
|
|
890
|
+
or packet.get("generated_at")
|
|
891
|
+
or ""
|
|
892
|
+
),
|
|
893
|
+
str(observation.get("pr_ref") or ""),
|
|
894
|
+
)
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
def _build_lifecycle_only_outcome(
|
|
898
|
+
*,
|
|
899
|
+
goal_id: str,
|
|
900
|
+
pr_lifecycle_packet: Mapping[str, Any],
|
|
901
|
+
agent_id: str | None = None,
|
|
902
|
+
) -> dict[str, Any]:
|
|
903
|
+
"""Project a PR lifecycle row that has no feasibility inventory row.
|
|
904
|
+
|
|
905
|
+
The PR lifecycle ledger is already compact source state. Dropping one of
|
|
906
|
+
its rows from the collection makes terminal delivery counts incorrect, so
|
|
907
|
+
this adapter keeps the lifecycle fact visible without inventing
|
|
908
|
+
reproduction, validation, or issue association evidence.
|
|
909
|
+
"""
|
|
910
|
+
|
|
911
|
+
if (
|
|
912
|
+
pr_lifecycle_packet.get("schema_version")
|
|
913
|
+
!= "issue_fix_pr_lifecycle_monitor_v0"
|
|
914
|
+
):
|
|
915
|
+
raise ValueError(
|
|
916
|
+
"PR lifecycle packet must use issue_fix_pr_lifecycle_monitor_v0"
|
|
917
|
+
)
|
|
918
|
+
observation = _mapping(pr_lifecycle_packet.get("observation"))
|
|
919
|
+
repo = _safe_text(observation.get("repo"), field="repo", limit=180)
|
|
920
|
+
pr_ref = _safe_text(observation.get("pr_ref"), field="pr_ref", limit=180)
|
|
921
|
+
if not repo or not pr_ref:
|
|
922
|
+
raise ValueError("PR lifecycle packet must identify repo and pr_ref")
|
|
923
|
+
raw_issue_ref = str(observation.get("issue_ref") or "").strip()
|
|
924
|
+
issue_ref = (
|
|
925
|
+
normalise_github_issue_link_reference(raw_issue_ref)
|
|
926
|
+
if raw_issue_ref
|
|
927
|
+
else ""
|
|
928
|
+
)
|
|
929
|
+
issue_number = None
|
|
930
|
+
if issue_ref:
|
|
931
|
+
match = re.fullmatch(r"issues_(\d+)", issue_ref)
|
|
932
|
+
issue_number = int(match.group(1)) if match else None
|
|
933
|
+
issue_url = (
|
|
934
|
+
f"https://github.com/{repo}/issues/{issue_number}"
|
|
935
|
+
if issue_number is not None
|
|
936
|
+
else ""
|
|
937
|
+
)
|
|
938
|
+
synthetic_issue_ref = issue_ref or f"pr_lifecycle_{pr_ref}"
|
|
939
|
+
synthetic_feasibility = {
|
|
940
|
+
"schema_version": "issue_fix_feasibility_v0",
|
|
941
|
+
"observation": {
|
|
942
|
+
"repo": repo,
|
|
943
|
+
"issue_ref": synthetic_issue_ref,
|
|
944
|
+
"number": issue_number,
|
|
945
|
+
"permalink": issue_url,
|
|
946
|
+
"reproduction_status": "missing",
|
|
947
|
+
"repository_context": {},
|
|
948
|
+
},
|
|
949
|
+
"decision": {"route": "fix_pr"},
|
|
950
|
+
"transition": {"decision": "pr_lifecycle_only"},
|
|
951
|
+
"repository_context_effect": {},
|
|
952
|
+
}
|
|
953
|
+
projection = build_issue_fix_outcome_projection(
|
|
954
|
+
goal_id=goal_id,
|
|
955
|
+
feasibility_packet=synthetic_feasibility,
|
|
956
|
+
pr_lifecycle_packet=pr_lifecycle_packet,
|
|
957
|
+
agent_id=agent_id,
|
|
958
|
+
)
|
|
959
|
+
case = _mapping((projection.get("issue_fix_outcomes") or [{}])[0])
|
|
960
|
+
case["outcome_id"] = f"{repo}:{issue_ref or pr_ref}"
|
|
961
|
+
case["title"] = f"[fix_pr] {repo} PR #{observation.get('number') or pr_ref}"
|
|
962
|
+
case["issue_ref"] = issue_ref or None
|
|
963
|
+
case["issue"] = {"number": issue_number, "url": issue_url}
|
|
964
|
+
case["evidence"] = _evidence_summary(case)
|
|
965
|
+
return case
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
def build_issue_fix_outcome_collection_from_domain_state(
|
|
969
|
+
*,
|
|
970
|
+
goal_id: str,
|
|
971
|
+
project: str | Path = ".",
|
|
972
|
+
agent_id: str | None = None,
|
|
973
|
+
generated_at: str | None = None,
|
|
974
|
+
) -> dict[str, Any]:
|
|
975
|
+
"""Derive all goal issue outcomes from existing compact domain state.
|
|
976
|
+
|
|
977
|
+
Feasibility rows are the issue inventory. A PR lifecycle row enriches an
|
|
978
|
+
issue only when its observation carries the same explicit ``issue_ref``.
|
|
979
|
+
Lifecycle rows without a matching feasibility row remain visible as
|
|
980
|
+
PR-only outcomes; branch names, titles, and issue numbers are never
|
|
981
|
+
guessed. No source state or parallel outcome ledger is written.
|
|
982
|
+
"""
|
|
983
|
+
|
|
984
|
+
from ...domain_packs.issue_fix import (
|
|
985
|
+
default_issue_fix_domain_state_ledger_path,
|
|
986
|
+
default_issue_fix_feasibility_ledger_path,
|
|
987
|
+
)
|
|
988
|
+
|
|
989
|
+
project_path = Path(project).expanduser()
|
|
990
|
+
feasibility_packets, feasibility_warnings = _load_domain_packets(
|
|
991
|
+
default_issue_fix_feasibility_ledger_path(
|
|
992
|
+
project=project_path,
|
|
993
|
+
goal_id=goal_id,
|
|
994
|
+
)
|
|
995
|
+
)
|
|
996
|
+
lifecycle_packets, lifecycle_warnings = _load_domain_packets(
|
|
997
|
+
default_issue_fix_domain_state_ledger_path(
|
|
998
|
+
project=project_path,
|
|
999
|
+
goal_id=goal_id,
|
|
1000
|
+
)
|
|
1001
|
+
)
|
|
1002
|
+
warnings = [*feasibility_warnings, *lifecycle_warnings]
|
|
1003
|
+
|
|
1004
|
+
lifecycle_by_issue: dict[tuple[str, str], list[dict[str, Any]]] = {}
|
|
1005
|
+
linked_lifecycle_ids: set[int] = set()
|
|
1006
|
+
for packet in lifecycle_packets:
|
|
1007
|
+
observation = _mapping(packet.get("observation"))
|
|
1008
|
+
repo = str(observation.get("repo") or "").strip()
|
|
1009
|
+
raw_issue_ref = str(observation.get("issue_ref") or "").strip()
|
|
1010
|
+
issue_ref = (
|
|
1011
|
+
normalise_github_issue_link_reference(raw_issue_ref)
|
|
1012
|
+
if raw_issue_ref
|
|
1013
|
+
else ""
|
|
1014
|
+
)
|
|
1015
|
+
if repo and issue_ref:
|
|
1016
|
+
lifecycle_by_issue.setdefault((repo, issue_ref), []).append(packet)
|
|
1017
|
+
|
|
1018
|
+
outcomes: list[dict[str, Any]] = []
|
|
1019
|
+
for feasibility_packet in feasibility_packets:
|
|
1020
|
+
observation = _mapping(feasibility_packet.get("observation"))
|
|
1021
|
+
repo = str(observation.get("repo") or "").strip()
|
|
1022
|
+
raw_issue_ref = str(observation.get("issue_ref") or "").strip()
|
|
1023
|
+
issue_ref = (
|
|
1024
|
+
normalise_github_issue_link_reference(raw_issue_ref)
|
|
1025
|
+
if raw_issue_ref
|
|
1026
|
+
else ""
|
|
1027
|
+
)
|
|
1028
|
+
lifecycle_packet: dict[str, Any] | None = None
|
|
1029
|
+
candidates = lifecycle_by_issue.get((repo, issue_ref), [])
|
|
1030
|
+
if candidates:
|
|
1031
|
+
lifecycle_packet = max(candidates, key=_lifecycle_recency)
|
|
1032
|
+
linked_lifecycle_ids.update(id(item) for item in candidates)
|
|
1033
|
+
try:
|
|
1034
|
+
projection = build_issue_fix_outcome_projection(
|
|
1035
|
+
goal_id=goal_id,
|
|
1036
|
+
feasibility_packet=feasibility_packet,
|
|
1037
|
+
pr_lifecycle_packet=lifecycle_packet,
|
|
1038
|
+
delivery_evidence_input=(
|
|
1039
|
+
feasibility_packet.get("delivery_evidence")
|
|
1040
|
+
if isinstance(feasibility_packet.get("delivery_evidence"), Mapping)
|
|
1041
|
+
else None
|
|
1042
|
+
),
|
|
1043
|
+
agent_id=agent_id,
|
|
1044
|
+
generated_at=generated_at,
|
|
1045
|
+
)
|
|
1046
|
+
except ValueError as exc:
|
|
1047
|
+
safe_identity = (
|
|
1048
|
+
public_safe_compact_text(f"{repo}:{issue_ref}", limit=220)
|
|
1049
|
+
or "unknown issue"
|
|
1050
|
+
)
|
|
1051
|
+
safe_error = public_safe_compact_text(exc, limit=260) or "invalid row"
|
|
1052
|
+
warnings.append(f"skipped {safe_identity}: {safe_error}")
|
|
1053
|
+
continue
|
|
1054
|
+
if projection.get("ok") is True:
|
|
1055
|
+
outcomes.extend(list(projection.get("issue_fix_outcomes") or []))
|
|
1056
|
+
|
|
1057
|
+
unlinked_lifecycle_packets = [
|
|
1058
|
+
packet for packet in lifecycle_packets if id(packet) not in linked_lifecycle_ids
|
|
1059
|
+
]
|
|
1060
|
+
lifecycle_only_by_key: dict[tuple[str, str], dict[str, Any]] = {}
|
|
1061
|
+
lifecycle_only_without_key: list[dict[str, Any]] = []
|
|
1062
|
+
for lifecycle_packet in unlinked_lifecycle_packets:
|
|
1063
|
+
observation = _mapping(lifecycle_packet.get("observation"))
|
|
1064
|
+
repo = str(observation.get("repo") or "").strip()
|
|
1065
|
+
raw_issue_ref = str(observation.get("issue_ref") or "").strip()
|
|
1066
|
+
issue_ref = (
|
|
1067
|
+
normalise_github_issue_link_reference(raw_issue_ref)
|
|
1068
|
+
if raw_issue_ref
|
|
1069
|
+
else ""
|
|
1070
|
+
)
|
|
1071
|
+
pr_ref = str(observation.get("pr_ref") or "").strip()
|
|
1072
|
+
identity = issue_ref or pr_ref
|
|
1073
|
+
if not repo or not identity:
|
|
1074
|
+
lifecycle_only_without_key.append(lifecycle_packet)
|
|
1075
|
+
continue
|
|
1076
|
+
key = (repo, identity)
|
|
1077
|
+
current = lifecycle_only_by_key.get(key)
|
|
1078
|
+
if current is None or _lifecycle_recency(lifecycle_packet) > _lifecycle_recency(
|
|
1079
|
+
current
|
|
1080
|
+
):
|
|
1081
|
+
lifecycle_only_by_key[key] = lifecycle_packet
|
|
1082
|
+
lifecycle_only_outcome_count = 0
|
|
1083
|
+
unprojected_lifecycle_count = len(lifecycle_only_without_key)
|
|
1084
|
+
for lifecycle_packet in lifecycle_only_by_key.values():
|
|
1085
|
+
try:
|
|
1086
|
+
outcomes.append(
|
|
1087
|
+
_build_lifecycle_only_outcome(
|
|
1088
|
+
goal_id=goal_id,
|
|
1089
|
+
pr_lifecycle_packet=lifecycle_packet,
|
|
1090
|
+
agent_id=agent_id,
|
|
1091
|
+
)
|
|
1092
|
+
)
|
|
1093
|
+
lifecycle_only_outcome_count += 1
|
|
1094
|
+
except ValueError as exc:
|
|
1095
|
+
observation = _mapping(lifecycle_packet.get("observation"))
|
|
1096
|
+
safe_identity = public_safe_compact_text(
|
|
1097
|
+
f"{observation.get('repo')}:{observation.get('pr_ref')}",
|
|
1098
|
+
limit=220,
|
|
1099
|
+
) or "unknown PR"
|
|
1100
|
+
safe_error = public_safe_compact_text(exc, limit=260) or "invalid row"
|
|
1101
|
+
warnings.append(f"skipped {safe_identity}: {safe_error}")
|
|
1102
|
+
unprojected_lifecycle_count += 1
|
|
1103
|
+
unlinked_lifecycle_count = len(unlinked_lifecycle_packets)
|
|
1104
|
+
collection: dict[str, Any] = {
|
|
1105
|
+
"ok": True,
|
|
1106
|
+
"schema_version": ISSUE_FIX_OUTCOME_COLLECTION_PROJECTION_SCHEMA_VERSION,
|
|
1107
|
+
"mode": "issue-fix-outcome-collection",
|
|
1108
|
+
"source_id": "issue-fix-outcome",
|
|
1109
|
+
"goal_id": goal_id,
|
|
1110
|
+
"generated_at": generated_at,
|
|
1111
|
+
"agent_identity": {"agent_id": agent_id} if agent_id else {},
|
|
1112
|
+
"issue_fix_outcomes": outcomes,
|
|
1113
|
+
"source_contract": {
|
|
1114
|
+
"feasibility": "issue_fix_feasibility_v0",
|
|
1115
|
+
"pr_lifecycle": "issue_fix_pr_lifecycle_monitor_v0",
|
|
1116
|
+
"delivery_evidence": "embedded_in_feasibility_row",
|
|
1117
|
+
"repository_commit_evidence": "embedded_in_delivery_evidence",
|
|
1118
|
+
"association": "explicit_repo_and_issue_ref_or_pr_lifecycle_only",
|
|
1119
|
+
"writes_source_state": False,
|
|
1120
|
+
"creates_parallel_state_machine": False,
|
|
1121
|
+
},
|
|
1122
|
+
"source_counts": {
|
|
1123
|
+
"feasibility": len(feasibility_packets),
|
|
1124
|
+
"pr_lifecycle": len(lifecycle_packets),
|
|
1125
|
+
"outcomes": len(outcomes),
|
|
1126
|
+
"unlinked_pr_lifecycle": unlinked_lifecycle_count,
|
|
1127
|
+
"lifecycle_only_outcomes": lifecycle_only_outcome_count,
|
|
1128
|
+
"coalesced_pr_lifecycle": (
|
|
1129
|
+
unlinked_lifecycle_count
|
|
1130
|
+
- len(lifecycle_only_by_key)
|
|
1131
|
+
- len(lifecycle_only_without_key)
|
|
1132
|
+
),
|
|
1133
|
+
"unprojected_pr_lifecycle": unprojected_lifecycle_count,
|
|
1134
|
+
},
|
|
1135
|
+
"warnings": warnings,
|
|
1136
|
+
"external_reads_performed": False,
|
|
1137
|
+
"external_writes_performed": False,
|
|
1138
|
+
"raw_logs_captured": False,
|
|
1139
|
+
"local_paths_captured": False,
|
|
1140
|
+
"credentials_captured": False,
|
|
1141
|
+
}
|
|
1142
|
+
collection["validation"] = validate_issue_fix_outcome_collection_projection(
|
|
1143
|
+
collection
|
|
1144
|
+
)
|
|
1145
|
+
collection["ok"] = bool(collection["validation"]["ok"])
|
|
1146
|
+
return collection
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
def validate_issue_fix_outcome_collection_projection(
|
|
1150
|
+
packet: Mapping[str, Any],
|
|
1151
|
+
) -> dict[str, Any]:
|
|
1152
|
+
errors: list[str] = []
|
|
1153
|
+
if (
|
|
1154
|
+
packet.get("schema_version")
|
|
1155
|
+
!= ISSUE_FIX_OUTCOME_COLLECTION_PROJECTION_SCHEMA_VERSION
|
|
1156
|
+
):
|
|
1157
|
+
errors.append(
|
|
1158
|
+
"schema_version must be issue_fix_outcome_collection_projection_v0"
|
|
1159
|
+
)
|
|
1160
|
+
outcomes = packet.get("issue_fix_outcomes")
|
|
1161
|
+
if not isinstance(outcomes, list):
|
|
1162
|
+
errors.append("issue_fix_outcomes must be a list")
|
|
1163
|
+
outcomes = []
|
|
1164
|
+
outcome_ids = [
|
|
1165
|
+
str(item.get("outcome_id") or "")
|
|
1166
|
+
for item in outcomes
|
|
1167
|
+
if isinstance(item, Mapping)
|
|
1168
|
+
]
|
|
1169
|
+
if any(not value for value in outcome_ids):
|
|
1170
|
+
errors.append("every issue-fix outcome must have an outcome_id")
|
|
1171
|
+
if len(set(outcome_ids)) != len(outcome_ids):
|
|
1172
|
+
errors.append("issue-fix outcome ids must be unique")
|
|
1173
|
+
for key in (
|
|
1174
|
+
"external_reads_performed",
|
|
1175
|
+
"external_writes_performed",
|
|
1176
|
+
"raw_logs_captured",
|
|
1177
|
+
"local_paths_captured",
|
|
1178
|
+
"credentials_captured",
|
|
1179
|
+
):
|
|
1180
|
+
if packet.get(key) is not False:
|
|
1181
|
+
errors.append(f"{key} must be false")
|
|
1182
|
+
return {
|
|
1183
|
+
"schema_version": "issue_fix_outcome_collection_projection_validation_v0",
|
|
1184
|
+
"ok": not errors,
|
|
1185
|
+
"errors": errors,
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
def validate_issue_fix_outcome_projection(packet: Mapping[str, Any]) -> dict[str, Any]:
|
|
1190
|
+
errors: list[str] = []
|
|
1191
|
+
if packet.get("schema_version") != ISSUE_FIX_OUTCOME_PROJECTION_SCHEMA_VERSION:
|
|
1192
|
+
errors.append("schema_version must be issue_fix_outcome_projection_v0")
|
|
1193
|
+
outcomes = packet.get("issue_fix_outcomes")
|
|
1194
|
+
if not isinstance(outcomes, list) or len(outcomes) != 1:
|
|
1195
|
+
errors.append("issue_fix_outcomes must contain exactly one case")
|
|
1196
|
+
for key in (
|
|
1197
|
+
"external_reads_performed",
|
|
1198
|
+
"external_writes_performed",
|
|
1199
|
+
"raw_logs_captured",
|
|
1200
|
+
"local_paths_captured",
|
|
1201
|
+
"credentials_captured",
|
|
1202
|
+
):
|
|
1203
|
+
if packet.get(key) is not False:
|
|
1204
|
+
errors.append(f"{key} must be false")
|
|
1205
|
+
return {
|
|
1206
|
+
"schema_version": "issue_fix_outcome_projection_validation_v0",
|
|
1207
|
+
"ok": not errors,
|
|
1208
|
+
"errors": errors,
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
def render_issue_fix_outcome_projection_markdown(payload: dict[str, Any]) -> str:
|
|
1213
|
+
if payload.get("ok") is not True:
|
|
1214
|
+
return f"# LoopX issue-fix outcome\n\n- ok: `false`\n- error: `{payload.get('error')}`"
|
|
1215
|
+
outcome = _mapping((payload.get("issue_fix_outcomes") or [{}])[0])
|
|
1216
|
+
result = _mapping(outcome.get("result"))
|
|
1217
|
+
lines = [
|
|
1218
|
+
"# LoopX issue-fix outcome",
|
|
1219
|
+
"",
|
|
1220
|
+
f"- case: `{outcome.get('outcome_id')}`",
|
|
1221
|
+
f"- stage: `{outcome.get('stage')}`",
|
|
1222
|
+
f"- route: `{outcome.get('route')}`",
|
|
1223
|
+
f"- result: `{result.get('kind')}`",
|
|
1224
|
+
f"- evidence: {outcome.get('evidence')}",
|
|
1225
|
+
f"- next action: {outcome.get('next_action') or 'none'}",
|
|
1226
|
+
]
|
|
1227
|
+
writeback = _mapping(payload.get("repository_memory_writeback"))
|
|
1228
|
+
if writeback:
|
|
1229
|
+
lines.extend(
|
|
1230
|
+
[
|
|
1231
|
+
f"- repository memory writeback: `{writeback.get('status')}`",
|
|
1232
|
+
f"- provider writes: `{writeback.get('write_count', 0)}`",
|
|
1233
|
+
]
|
|
1234
|
+
)
|
|
1235
|
+
return "\n".join(lines)
|