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,1848 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import shlex
|
|
5
|
+
import tempfile
|
|
6
|
+
import time
|
|
7
|
+
from collections.abc import Callable, Sequence
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from .bootstrap_contract import (
|
|
11
|
+
auto_research_contract_command_text,
|
|
12
|
+
auto_research_start_command_text,
|
|
13
|
+
build_auto_research_contract_acceptance,
|
|
14
|
+
build_auto_research_live_worker_proof,
|
|
15
|
+
)
|
|
16
|
+
from .demo_supervisor import build_auto_research_demo_supervisor_plan
|
|
17
|
+
from .defaults import AUTO_RESEARCH_DEFAULT_GOAL_ID
|
|
18
|
+
from .live_evidence import load_live_codex_e2e_evidence
|
|
19
|
+
from .preset import (
|
|
20
|
+
auto_research_seed_action_for_role,
|
|
21
|
+
auto_research_seed_title,
|
|
22
|
+
default_auto_research_agent_specs,
|
|
23
|
+
)
|
|
24
|
+
from .rollout_append import append_auto_research_rollout_events
|
|
25
|
+
from .user_contract import build_auto_research_user_contract
|
|
26
|
+
from .worker_loop import run_auto_research_worker_loop
|
|
27
|
+
from .worker_runtime import load_auto_research_worker_frontier
|
|
28
|
+
from ...control_plane.agents.multi_agent.collective_round_ledger import (
|
|
29
|
+
build_multi_agent_collective_round_ledger,
|
|
30
|
+
)
|
|
31
|
+
from ...control_plane.todos.contract import normalize_required_write_scopes
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
AppendEvidence = Callable[[str], dict[str, object]]
|
|
35
|
+
VisibleLauncher = Callable[..., dict[str, object]]
|
|
36
|
+
VisibleWake = Callable[[str, Sequence[str]], dict[str, object]]
|
|
37
|
+
|
|
38
|
+
AUTO_RESEARCH_DEMO_E2E_SCHEMA_VERSION = "auto_research_demo_e2e_result_v0"
|
|
39
|
+
AUTO_RESEARCH_SEED_ACTION_CHAIN = (
|
|
40
|
+
"write_research_contract",
|
|
41
|
+
"propose_hypothesis",
|
|
42
|
+
"run_dev_eval",
|
|
43
|
+
"summarize_evidence",
|
|
44
|
+
)
|
|
45
|
+
AUTO_RESEARCH_SEED_ACTION_ORDER = {
|
|
46
|
+
action: index for index, action in enumerate(AUTO_RESEARCH_SEED_ACTION_CHAIN)
|
|
47
|
+
}
|
|
48
|
+
AUTO_RESEARCH_SEED_PREREQUISITE_ACTION_BY_ACTION = dict(
|
|
49
|
+
zip(AUTO_RESEARCH_SEED_ACTION_CHAIN[1:], AUTO_RESEARCH_SEED_ACTION_CHAIN)
|
|
50
|
+
)
|
|
51
|
+
AUTO_RESEARCH_DEMO_CONTROL_WRITE_SCOPE = ("examples/**", "experiments/**", ".local/**")
|
|
52
|
+
AUTO_RESEARCH_DEMO_AVAILABLE_CAPABILITIES = ("benchmark_runner",)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _prepare_visible_demo_workspace_route(
|
|
56
|
+
*,
|
|
57
|
+
control_project: Path,
|
|
58
|
+
lanes: list[dict[str, object]],
|
|
59
|
+
) -> dict[str, object]:
|
|
60
|
+
"""Keep visible Codex TUIs off demo-local git worktrees.
|
|
61
|
+
|
|
62
|
+
The demo still shares one LoopX state surface. Mutating attempts can claim
|
|
63
|
+
their own execution boundary from inside the role, but the first visible TUI
|
|
64
|
+
screen must not start in a freshly-created git worktree because Codex will
|
|
65
|
+
stop on a trust prompt before the user sees the auto-research flow.
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
(control_project / ".gitignore").write_text(".local/\n", encoding="utf-8")
|
|
69
|
+
|
|
70
|
+
peer_count = 0
|
|
71
|
+
for lane in lanes:
|
|
72
|
+
agent_id = str(lane.get("agent_id") or "").strip()
|
|
73
|
+
if not agent_id:
|
|
74
|
+
continue
|
|
75
|
+
lane["workspace_role"] = "shared_visible_tui_workspace"
|
|
76
|
+
peer_count += 1
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
"schema_version": "auto_research_visible_demo_workspace_route_v0",
|
|
80
|
+
"shared_goal_surface": "demo_local_loopx_registry_and_runtime",
|
|
81
|
+
"peer_workspace": "visible_codex_tui_workspace",
|
|
82
|
+
"default_visible_workspace": "demo_owned_clean_workspace",
|
|
83
|
+
"peer_lane_workspace": "visible_codex_tui_workspace",
|
|
84
|
+
"peer_lane_worktree_count": 0,
|
|
85
|
+
"peer_lane_count": peer_count,
|
|
86
|
+
"trust_prompt_avoidance": (
|
|
87
|
+
"demo_owned_clean_workspace_with_persisted_codex_trust_config"
|
|
88
|
+
),
|
|
89
|
+
"mutation_isolation_policy": (
|
|
90
|
+
"mutating attempts claim an execution boundary from inside the role; "
|
|
91
|
+
"the first visible TUI uses the demo-owned clean workspace unless "
|
|
92
|
+
"the operator passes --workspace"
|
|
93
|
+
),
|
|
94
|
+
"absolute_paths_recorded": False,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _visible_demo_goal_write_scope(
|
|
99
|
+
preset_context: dict[str, object] | None,
|
|
100
|
+
) -> list[str]:
|
|
101
|
+
scopes = list(AUTO_RESEARCH_DEMO_CONTROL_WRITE_SCOPE)
|
|
102
|
+
if isinstance(preset_context, dict):
|
|
103
|
+
scopes.extend(
|
|
104
|
+
normalize_required_write_scopes(preset_context.get("editable_scope"))
|
|
105
|
+
)
|
|
106
|
+
return list(dict.fromkeys(scopes))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _seed_visible_demo_control_plane(
|
|
110
|
+
*,
|
|
111
|
+
demo_root: Path,
|
|
112
|
+
goal_id: str,
|
|
113
|
+
objective: str,
|
|
114
|
+
supervisor: dict[str, object],
|
|
115
|
+
preset_context: dict[str, object] | None = None,
|
|
116
|
+
) -> tuple[dict[str, object], Path, str]:
|
|
117
|
+
"""Create a tiny demo-local LoopX queue for visible workers."""
|
|
118
|
+
|
|
119
|
+
from ...bootstrap import bootstrap_project
|
|
120
|
+
from ...configure_goal import configure_goal
|
|
121
|
+
from ...state_refresh import now_local, replace_next_action_section
|
|
122
|
+
from ...todos import add_goal_todo
|
|
123
|
+
|
|
124
|
+
control_project = demo_root / "visible-control-plane"
|
|
125
|
+
control_registry = demo_root / "visible-control-plane.registry.json"
|
|
126
|
+
control_runtime = demo_root / "visible-control-plane.runtime"
|
|
127
|
+
bootstrap_project(
|
|
128
|
+
project=control_project,
|
|
129
|
+
registry_path=control_registry,
|
|
130
|
+
runtime_root=control_runtime,
|
|
131
|
+
goal_id=goal_id,
|
|
132
|
+
objective=objective,
|
|
133
|
+
domain="auto-research-demo",
|
|
134
|
+
role="agent",
|
|
135
|
+
parent_goal_id=None,
|
|
136
|
+
state_file=None,
|
|
137
|
+
goal_doc=None,
|
|
138
|
+
adapter_kind="auto_research_demo_local_queue",
|
|
139
|
+
adapter_status="connected",
|
|
140
|
+
next_probe=None,
|
|
141
|
+
spawn_allowed=True,
|
|
142
|
+
max_children=4,
|
|
143
|
+
allowed_domains=["auto-research-demo"],
|
|
144
|
+
write_scope=_visible_demo_goal_write_scope(preset_context),
|
|
145
|
+
onboarding_scan_enabled=False,
|
|
146
|
+
accept_onboarding_agent_todos=False,
|
|
147
|
+
begin_autonomous_advance=True,
|
|
148
|
+
codex_app_heartbeat="no",
|
|
149
|
+
force=False,
|
|
150
|
+
dry_run=False,
|
|
151
|
+
sync_global=False,
|
|
152
|
+
)
|
|
153
|
+
state_file = control_project / ".codex" / "goals" / goal_id / "ACTIVE_GOAL_STATE.md"
|
|
154
|
+
if state_file.exists():
|
|
155
|
+
updated_state, state_changed = replace_next_action_section(
|
|
156
|
+
state_file.read_text(encoding="utf-8"),
|
|
157
|
+
next_action=(
|
|
158
|
+
"Goal-level route delegates to role frontier; panes own execution."
|
|
159
|
+
),
|
|
160
|
+
updated_at=now_local(),
|
|
161
|
+
)
|
|
162
|
+
if state_changed:
|
|
163
|
+
state_file.write_text(updated_state, encoding="utf-8")
|
|
164
|
+
|
|
165
|
+
lanes = [lane for lane in supervisor.get("lanes") or [] if isinstance(lane, dict)]
|
|
166
|
+
agents = sorted(
|
|
167
|
+
{
|
|
168
|
+
str(lane.get("agent_id") or "").strip()
|
|
169
|
+
for lane in lanes
|
|
170
|
+
if str(lane.get("agent_id") or "").strip()
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
configure_goal(
|
|
174
|
+
registry_path=control_registry,
|
|
175
|
+
goal_id=goal_id,
|
|
176
|
+
registered_agents=agents,
|
|
177
|
+
agent_model="peer_v1",
|
|
178
|
+
waiting_on="codex",
|
|
179
|
+
orchestration_mode="multi_subagent",
|
|
180
|
+
spawn_allowed=True,
|
|
181
|
+
execute=True,
|
|
182
|
+
)
|
|
183
|
+
registry_payload = json.loads(control_registry.read_text(encoding="utf-8"))
|
|
184
|
+
for goal in registry_payload.get("goals", []):
|
|
185
|
+
if isinstance(goal, dict) and str(goal.get("id")) == goal_id:
|
|
186
|
+
coordination = goal.setdefault("coordination", {})
|
|
187
|
+
if isinstance(coordination, dict):
|
|
188
|
+
capabilities = [
|
|
189
|
+
str(value).strip()
|
|
190
|
+
for value in coordination.get("available_capabilities", [])
|
|
191
|
+
if str(value).strip()
|
|
192
|
+
]
|
|
193
|
+
for capability in AUTO_RESEARCH_DEMO_AVAILABLE_CAPABILITIES:
|
|
194
|
+
if capability not in capabilities:
|
|
195
|
+
capabilities.append(capability)
|
|
196
|
+
coordination["available_capabilities"] = capabilities
|
|
197
|
+
goal["workspace_guard_policy"] = {
|
|
198
|
+
"schema_version": "loopx_workspace_guard_policy_v0",
|
|
199
|
+
"peer_independent_worktree_required": False,
|
|
200
|
+
"reason": (
|
|
201
|
+
"auto_research_demo_local_queue uses a demo-owned workspace and "
|
|
202
|
+
"writes only demo-local LoopX state/evidence; repository edits still "
|
|
203
|
+
"require an explicit lane-owned execution boundary"
|
|
204
|
+
),
|
|
205
|
+
}
|
|
206
|
+
break
|
|
207
|
+
control_registry.write_text(
|
|
208
|
+
json.dumps(registry_payload, indent=2, sort_keys=True) + "\n",
|
|
209
|
+
encoding="utf-8",
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
seeded_todos: list[dict[str, object]] = []
|
|
213
|
+
seeded_todo_ids_by_action: dict[str, str] = {}
|
|
214
|
+
seed_rows: list[tuple[str, str, str, str]] = []
|
|
215
|
+
for lane in lanes:
|
|
216
|
+
agent_id = str(lane.get("agent_id") or "").strip()
|
|
217
|
+
role_id = str(lane.get("role_id") or "").strip()
|
|
218
|
+
lane_id = str(lane.get("lane_id") or "").strip()
|
|
219
|
+
action_kind = auto_research_seed_action_for_role(role_id)
|
|
220
|
+
seed_rows.append((action_kind, agent_id, role_id, lane_id))
|
|
221
|
+
seed_rows.sort(
|
|
222
|
+
key=lambda row: (
|
|
223
|
+
AUTO_RESEARCH_SEED_ACTION_ORDER.get(
|
|
224
|
+
row[0], len(AUTO_RESEARCH_SEED_ACTION_ORDER)
|
|
225
|
+
),
|
|
226
|
+
row[1],
|
|
227
|
+
)
|
|
228
|
+
)
|
|
229
|
+
for action_kind, agent_id, role_id, lane_id in seed_rows:
|
|
230
|
+
title = auto_research_seed_title(
|
|
231
|
+
action_kind=action_kind,
|
|
232
|
+
role_id=role_id,
|
|
233
|
+
lane_id=lane_id,
|
|
234
|
+
)
|
|
235
|
+
prerequisite_action = AUTO_RESEARCH_SEED_PREREQUISITE_ACTION_BY_ACTION.get(
|
|
236
|
+
action_kind
|
|
237
|
+
)
|
|
238
|
+
prerequisite_todo_id = (
|
|
239
|
+
seeded_todo_ids_by_action.get(prerequisite_action)
|
|
240
|
+
if prerequisite_action
|
|
241
|
+
else None
|
|
242
|
+
)
|
|
243
|
+
resume_when = (
|
|
244
|
+
f"todo_done:{prerequisite_todo_id}"
|
|
245
|
+
if prerequisite_todo_id
|
|
246
|
+
else None
|
|
247
|
+
)
|
|
248
|
+
result = add_goal_todo(
|
|
249
|
+
registry_path=control_registry,
|
|
250
|
+
goal_id=goal_id,
|
|
251
|
+
role="agent",
|
|
252
|
+
text=f"[P0-auto-research-live] {title}",
|
|
253
|
+
task_class="advancement_task",
|
|
254
|
+
action_kind=action_kind,
|
|
255
|
+
claimed_by=agent_id or None,
|
|
256
|
+
resume_when=resume_when,
|
|
257
|
+
project=control_project,
|
|
258
|
+
)
|
|
259
|
+
todo_id = result.get("todo_id")
|
|
260
|
+
if isinstance(todo_id, str) and todo_id:
|
|
261
|
+
seeded_todo_ids_by_action.setdefault(action_kind, todo_id)
|
|
262
|
+
seeded_todos.append(
|
|
263
|
+
{
|
|
264
|
+
"todo_id": todo_id,
|
|
265
|
+
"agent_id": agent_id,
|
|
266
|
+
"lane_id": lane_id,
|
|
267
|
+
"role_id": role_id,
|
|
268
|
+
"action_kind": action_kind,
|
|
269
|
+
"resume_when": result.get("resume_when"),
|
|
270
|
+
}
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
workspace_route = _prepare_visible_demo_workspace_route(
|
|
274
|
+
control_project=control_project,
|
|
275
|
+
lanes=lanes,
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
summary = {
|
|
279
|
+
"schema_version": "auto_research_visible_demo_control_plane_v0",
|
|
280
|
+
"mode": "demo_local_loopx_queue",
|
|
281
|
+
"goal_id": goal_id,
|
|
282
|
+
"registry_scope": "demo_local_runtime",
|
|
283
|
+
"registered_agent_count": len(agents),
|
|
284
|
+
"seeded_todo_count": len(seeded_todos),
|
|
285
|
+
"seeded_todos": seeded_todos,
|
|
286
|
+
"state_route": "visible_lanes_use_LOOPX_REGISTRY_and_LOOPX_RUNTIME_ROOT",
|
|
287
|
+
"workspace_route": workspace_route,
|
|
288
|
+
"workspace_guard_policy": {
|
|
289
|
+
"peer_independent_worktree_required": False,
|
|
290
|
+
"repository_edits_still_require_lane_boundary": True,
|
|
291
|
+
},
|
|
292
|
+
"absolute_paths_recorded": False,
|
|
293
|
+
"private_artifacts_recorded": False,
|
|
294
|
+
}
|
|
295
|
+
return summary, control_registry, str(control_runtime)
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def _command_text(
|
|
299
|
+
*,
|
|
300
|
+
cli_bin: str,
|
|
301
|
+
goal_id: str,
|
|
302
|
+
agent_id: str,
|
|
303
|
+
execute: bool,
|
|
304
|
+
run_worker_loop: bool = False,
|
|
305
|
+
launch_visible: bool = False,
|
|
306
|
+
headless: bool = False,
|
|
307
|
+
attach: bool = False,
|
|
308
|
+
no_attach: bool = False,
|
|
309
|
+
live_evidence: bool = False,
|
|
310
|
+
wake_visible_after_launch: bool = False,
|
|
311
|
+
configure_visible_worker_turn: bool = False,
|
|
312
|
+
tracking_goal_id: str | None = None,
|
|
313
|
+
output_language: str = "en",
|
|
314
|
+
) -> str:
|
|
315
|
+
parts = [
|
|
316
|
+
shlex.quote(cli_bin),
|
|
317
|
+
"--format",
|
|
318
|
+
"json",
|
|
319
|
+
"auto-research",
|
|
320
|
+
"demo-e2e",
|
|
321
|
+
"--goal-id",
|
|
322
|
+
shlex.quote(goal_id),
|
|
323
|
+
"--agent-id",
|
|
324
|
+
shlex.quote(agent_id),
|
|
325
|
+
]
|
|
326
|
+
if tracking_goal_id:
|
|
327
|
+
parts.extend(["--tracking-goal-id", shlex.quote(tracking_goal_id)])
|
|
328
|
+
if output_language and output_language != "en":
|
|
329
|
+
parts.extend(["--language", shlex.quote(output_language)])
|
|
330
|
+
if execute:
|
|
331
|
+
parts.append("--execute")
|
|
332
|
+
if run_worker_loop:
|
|
333
|
+
parts.append("--run-worker-loop")
|
|
334
|
+
if headless:
|
|
335
|
+
parts.append("--headless")
|
|
336
|
+
if launch_visible:
|
|
337
|
+
parts.append("--launch-visible")
|
|
338
|
+
if attach:
|
|
339
|
+
parts.append("--attach")
|
|
340
|
+
if no_attach:
|
|
341
|
+
parts.append("--no-attach")
|
|
342
|
+
if live_evidence:
|
|
343
|
+
parts.extend(["--live-evidence", "<public-safe-live-evidence.json>"])
|
|
344
|
+
if wake_visible_after_launch:
|
|
345
|
+
parts.append("--wake-visible-after-launch")
|
|
346
|
+
if configure_visible_worker_turn:
|
|
347
|
+
parts.append("--configure-visible-worker-turn")
|
|
348
|
+
return " ".join(parts)
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
def _build_demo_frontier_route_contract(
|
|
352
|
+
*,
|
|
353
|
+
goal_id: str,
|
|
354
|
+
tracking_goal: str,
|
|
355
|
+
preset_context: dict[str, object] | None,
|
|
356
|
+
goal_surface_mode: str,
|
|
357
|
+
reuses_default_internal_goal: bool,
|
|
358
|
+
) -> dict[str, object]:
|
|
359
|
+
return {
|
|
360
|
+
"schema_version": "auto_research_demo_frontier_route_v0",
|
|
361
|
+
"goal_surface_mode": goal_surface_mode,
|
|
362
|
+
"frontier_goal_id": goal_id,
|
|
363
|
+
"tracking_goal_id": tracking_goal or None,
|
|
364
|
+
"preset_id": preset_context.get("preset_id") if preset_context else None,
|
|
365
|
+
"preset_baseline_source": (
|
|
366
|
+
preset_context.get("baseline_source") if preset_context else None
|
|
367
|
+
),
|
|
368
|
+
"tracking_goal_drives_frontier": False,
|
|
369
|
+
"visible_lanes_read_goal_id": goal_id,
|
|
370
|
+
"fresh_goal_default": goal_surface_mode == "fresh_demo_goal",
|
|
371
|
+
"inherits_default_goal": goal_surface_mode == "inherited_default_goal",
|
|
372
|
+
"reuses_default_internal_goal": reuses_default_internal_goal,
|
|
373
|
+
"default_internal_goal_id": AUTO_RESEARCH_DEFAULT_GOAL_ID,
|
|
374
|
+
"dedicated_positive_demo_frontier": not reuses_default_internal_goal,
|
|
375
|
+
"reason": (
|
|
376
|
+
"Omitting --goal-id creates an isolated demo goal surface. "
|
|
377
|
+
"Use --goal-id to target a specific research frontier, or --inherit-default-goal "
|
|
378
|
+
"to intentionally reuse the internal shared demo goal. --tracking-goal-id is metadata "
|
|
379
|
+
"for the parent productization goal and must not reroute panes."
|
|
380
|
+
),
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
def _build_demo_e2e_commands(
|
|
385
|
+
*,
|
|
386
|
+
cli_bin: str,
|
|
387
|
+
objective: str,
|
|
388
|
+
preset_id: str | None,
|
|
389
|
+
output_language: str,
|
|
390
|
+
goal_id: str,
|
|
391
|
+
agent_id: str,
|
|
392
|
+
tracking_goal: str,
|
|
393
|
+
session_name: str,
|
|
394
|
+
) -> dict[str, str]:
|
|
395
|
+
tracking_goal_id = tracking_goal or None
|
|
396
|
+
return {
|
|
397
|
+
"one_question_contract": auto_research_contract_command_text(
|
|
398
|
+
cli_bin=cli_bin,
|
|
399
|
+
objective=objective,
|
|
400
|
+
),
|
|
401
|
+
"one_question_start": auto_research_start_command_text(
|
|
402
|
+
cli_bin=cli_bin,
|
|
403
|
+
objective=objective,
|
|
404
|
+
preset_id=preset_id,
|
|
405
|
+
execute=True,
|
|
406
|
+
output_language=output_language,
|
|
407
|
+
),
|
|
408
|
+
"one_question_start_preview": auto_research_start_command_text(
|
|
409
|
+
cli_bin=cli_bin,
|
|
410
|
+
objective=objective,
|
|
411
|
+
preset_id=preset_id,
|
|
412
|
+
output_language=output_language,
|
|
413
|
+
),
|
|
414
|
+
"one_question_start_with_visible_wake": auto_research_start_command_text(
|
|
415
|
+
cli_bin=cli_bin,
|
|
416
|
+
objective=objective,
|
|
417
|
+
preset_id=preset_id,
|
|
418
|
+
execute=True,
|
|
419
|
+
output_language=output_language,
|
|
420
|
+
),
|
|
421
|
+
"one_command_worker_loop": _command_text(
|
|
422
|
+
cli_bin=cli_bin,
|
|
423
|
+
goal_id=goal_id,
|
|
424
|
+
agent_id=agent_id,
|
|
425
|
+
execute=True,
|
|
426
|
+
run_worker_loop=True,
|
|
427
|
+
tracking_goal_id=tracking_goal_id,
|
|
428
|
+
output_language=output_language,
|
|
429
|
+
),
|
|
430
|
+
"headless_worker_loop": _command_text(
|
|
431
|
+
cli_bin=cli_bin,
|
|
432
|
+
goal_id=goal_id,
|
|
433
|
+
agent_id=agent_id,
|
|
434
|
+
execute=True,
|
|
435
|
+
run_worker_loop=True,
|
|
436
|
+
headless=True,
|
|
437
|
+
tracking_goal_id=tracking_goal_id,
|
|
438
|
+
output_language=output_language,
|
|
439
|
+
),
|
|
440
|
+
"start_visible_lanes_without_attach": _command_text(
|
|
441
|
+
cli_bin=cli_bin,
|
|
442
|
+
goal_id=goal_id,
|
|
443
|
+
agent_id=agent_id,
|
|
444
|
+
execute=True,
|
|
445
|
+
launch_visible=True,
|
|
446
|
+
no_attach=True,
|
|
447
|
+
tracking_goal_id=tracking_goal_id,
|
|
448
|
+
output_language=output_language,
|
|
449
|
+
),
|
|
450
|
+
"one_command_visible_wake_demo": _command_text(
|
|
451
|
+
cli_bin=cli_bin,
|
|
452
|
+
goal_id=goal_id,
|
|
453
|
+
agent_id=agent_id,
|
|
454
|
+
execute=True,
|
|
455
|
+
launch_visible=True,
|
|
456
|
+
no_attach=True,
|
|
457
|
+
wake_visible_after_launch=True,
|
|
458
|
+
tracking_goal_id=tracking_goal_id,
|
|
459
|
+
output_language=output_language,
|
|
460
|
+
),
|
|
461
|
+
"one_command_visible_worker_turn_validation": _command_text(
|
|
462
|
+
cli_bin=cli_bin,
|
|
463
|
+
goal_id=goal_id,
|
|
464
|
+
agent_id=agent_id,
|
|
465
|
+
execute=True,
|
|
466
|
+
launch_visible=True,
|
|
467
|
+
no_attach=True,
|
|
468
|
+
configure_visible_worker_turn=True,
|
|
469
|
+
tracking_goal_id=tracking_goal_id,
|
|
470
|
+
output_language=output_language,
|
|
471
|
+
),
|
|
472
|
+
"one_command_worker_loop_with_visible_lanes": _command_text(
|
|
473
|
+
cli_bin=cli_bin,
|
|
474
|
+
goal_id=goal_id,
|
|
475
|
+
agent_id=agent_id,
|
|
476
|
+
execute=True,
|
|
477
|
+
run_worker_loop=True,
|
|
478
|
+
launch_visible=True,
|
|
479
|
+
attach=True,
|
|
480
|
+
tracking_goal_id=tracking_goal_id,
|
|
481
|
+
output_language=output_language,
|
|
482
|
+
),
|
|
483
|
+
"load_live_worker_evidence": _command_text(
|
|
484
|
+
cli_bin=cli_bin,
|
|
485
|
+
goal_id=goal_id,
|
|
486
|
+
agent_id=agent_id,
|
|
487
|
+
execute=True,
|
|
488
|
+
live_evidence=True,
|
|
489
|
+
tracking_goal_id=tracking_goal_id,
|
|
490
|
+
output_language=output_language,
|
|
491
|
+
),
|
|
492
|
+
"wake_visible_lanes": (
|
|
493
|
+
f"{shlex.quote(cli_bin)} --format json multi-agent wake --session-name "
|
|
494
|
+
f"{shlex.quote(session_name)} --execute"
|
|
495
|
+
),
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
def _supervisor_summary(supervisor: dict[str, object]) -> dict[str, object]:
|
|
500
|
+
product_spec = (
|
|
501
|
+
supervisor.get("product_spec")
|
|
502
|
+
if isinstance(supervisor.get("product_spec"), dict)
|
|
503
|
+
else {}
|
|
504
|
+
)
|
|
505
|
+
runner_contract = (
|
|
506
|
+
supervisor.get("runner_contract")
|
|
507
|
+
if isinstance(supervisor.get("runner_contract"), dict)
|
|
508
|
+
else {}
|
|
509
|
+
)
|
|
510
|
+
pane_local_a2a = (
|
|
511
|
+
runner_contract.get("pane_local_a2a")
|
|
512
|
+
if isinstance(runner_contract.get("pane_local_a2a"), dict)
|
|
513
|
+
else {}
|
|
514
|
+
)
|
|
515
|
+
decentralized_a2a_driver = (
|
|
516
|
+
runner_contract.get("decentralized_a2a_driver")
|
|
517
|
+
if isinstance(runner_contract.get("decentralized_a2a_driver"), dict)
|
|
518
|
+
else {}
|
|
519
|
+
)
|
|
520
|
+
cli_contract = (
|
|
521
|
+
supervisor.get("cli_contract")
|
|
522
|
+
if isinstance(supervisor.get("cli_contract"), dict)
|
|
523
|
+
else {}
|
|
524
|
+
)
|
|
525
|
+
auto_research = (
|
|
526
|
+
supervisor.get("auto_research")
|
|
527
|
+
if isinstance(supervisor.get("auto_research"), dict)
|
|
528
|
+
else {}
|
|
529
|
+
)
|
|
530
|
+
coordination_model = (
|
|
531
|
+
supervisor.get("coordination_model")
|
|
532
|
+
if isinstance(supervisor.get("coordination_model"), dict)
|
|
533
|
+
else {}
|
|
534
|
+
)
|
|
535
|
+
return {
|
|
536
|
+
"schema_version": supervisor.get("schema_version"),
|
|
537
|
+
"mode": supervisor.get("mode"),
|
|
538
|
+
"lane_count": len(supervisor.get("lanes") or []),
|
|
539
|
+
"reasoning_contract": supervisor.get("reasoning_contract"),
|
|
540
|
+
"uses_generic_runner": bool(
|
|
541
|
+
product_spec.get("uses_generic_runner")
|
|
542
|
+
or auto_research.get("uses_generic_runner")
|
|
543
|
+
),
|
|
544
|
+
"generic_spec_schema": product_spec.get("schema_version"),
|
|
545
|
+
"runner_contract_schema": runner_contract.get("schema_version"),
|
|
546
|
+
"pane_local_a2a": {
|
|
547
|
+
"tick_command": pane_local_a2a.get("tick_command"),
|
|
548
|
+
"machine_json_policy": pane_local_a2a.get("machine_json_policy"),
|
|
549
|
+
"machine_json_destination": pane_local_a2a.get("machine_json_destination"),
|
|
550
|
+
"status_artifact": pane_local_a2a.get("status_artifact"),
|
|
551
|
+
"human_default": pane_local_a2a.get("human_default"),
|
|
552
|
+
},
|
|
553
|
+
"decentralized_a2a_driver": {
|
|
554
|
+
"schema_version": decentralized_a2a_driver.get("schema_version"),
|
|
555
|
+
"owner_layer": decentralized_a2a_driver.get("owner_layer"),
|
|
556
|
+
"driver_model": decentralized_a2a_driver.get("driver_model"),
|
|
557
|
+
"coordination_pattern": decentralized_a2a_driver.get("coordination_pattern"),
|
|
558
|
+
"broadcaster_decides_work": (
|
|
559
|
+
decentralized_a2a_driver.get("broadcaster", {}).get("decides_work")
|
|
560
|
+
if isinstance(decentralized_a2a_driver.get("broadcaster"), dict)
|
|
561
|
+
else None
|
|
562
|
+
),
|
|
563
|
+
"pane_decision_owner": (
|
|
564
|
+
decentralized_a2a_driver.get("pane", {}).get("decision_owner")
|
|
565
|
+
if isinstance(decentralized_a2a_driver.get("pane"), dict)
|
|
566
|
+
else None
|
|
567
|
+
),
|
|
568
|
+
"user_and_preset_do_not_own_tick_driver": (
|
|
569
|
+
decentralized_a2a_driver.get("acceptance", {}).get(
|
|
570
|
+
"user_and_preset_do_not_own_tick_driver"
|
|
571
|
+
)
|
|
572
|
+
if isinstance(decentralized_a2a_driver.get("acceptance"), dict)
|
|
573
|
+
else None
|
|
574
|
+
),
|
|
575
|
+
},
|
|
576
|
+
"machine_json_policy": cli_contract.get("machine_json_policy"),
|
|
577
|
+
"domain_specific_runner_logic": bool(product_spec.get("domain_specific")),
|
|
578
|
+
"kernel_boundary": {
|
|
579
|
+
"state_bus": auto_research.get("state_bus"),
|
|
580
|
+
"presentation_layers_in_kernel": bool(
|
|
581
|
+
auto_research.get("presentation_layers_in_kernel")
|
|
582
|
+
),
|
|
583
|
+
"coordination_pattern": coordination_model.get("pattern"),
|
|
584
|
+
},
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
def _compact_live_worker_evidence(evidence: dict[str, object]) -> dict[str, object]:
|
|
589
|
+
return {
|
|
590
|
+
"schema_version": "auto_research_live_worker_evidence_summary_v0",
|
|
591
|
+
"loaded": True,
|
|
592
|
+
"source": evidence.get("source"),
|
|
593
|
+
"goal_id": evidence.get("goal_id"),
|
|
594
|
+
"agent_id": evidence.get("agent_id"),
|
|
595
|
+
"lane_count": evidence.get("lane_count"),
|
|
596
|
+
"evidence_event_count": evidence.get("evidence_event_count"),
|
|
597
|
+
"result_status": evidence.get("result_status"),
|
|
598
|
+
"protected_scope_clean": bool(evidence.get("protected_scope_clean")),
|
|
599
|
+
"dev_metric": evidence.get("dev_metric"),
|
|
600
|
+
"holdout_metric": evidence.get("holdout_metric"),
|
|
601
|
+
"public_boundary": evidence.get("public_boundary"),
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
def _compact_visible_pane_a2a_status(artifacts: list[dict[str, object]]) -> dict[str, object]:
|
|
606
|
+
lane_outcomes: list[dict[str, object]] = []
|
|
607
|
+
status_check_count = 0
|
|
608
|
+
for raw in artifacts:
|
|
609
|
+
checks = raw.get("checks") if isinstance(raw.get("checks"), list) else []
|
|
610
|
+
status_check_count += len(checks)
|
|
611
|
+
last = checks[-1] if checks and isinstance(checks[-1], dict) else {}
|
|
612
|
+
lane_outcomes.append(
|
|
613
|
+
{
|
|
614
|
+
"agent_id": raw.get("agent_id"),
|
|
615
|
+
"role_id": raw.get("role_id"),
|
|
616
|
+
"status": raw.get("status"),
|
|
617
|
+
"worker_configured": raw.get("worker_configured") is True,
|
|
618
|
+
"worker_label": raw.get("worker_label"),
|
|
619
|
+
"selected_todo_id": last.get("selected_todo_id"),
|
|
620
|
+
"selected_action": last.get("selected_action"),
|
|
621
|
+
"worker_status": last.get("worker_status"),
|
|
622
|
+
"counts_as_research_round": False,
|
|
623
|
+
}
|
|
624
|
+
)
|
|
625
|
+
return {
|
|
626
|
+
"schema_version": "auto_research_visible_pane_a2a_status_summary_v0",
|
|
627
|
+
"loaded": bool(artifacts),
|
|
628
|
+
"source": "visible_pane_a2a_status_artifacts",
|
|
629
|
+
"lane_count": len(artifacts),
|
|
630
|
+
"status_check_count": status_check_count,
|
|
631
|
+
"workflow_driver": False,
|
|
632
|
+
"counts_as_collective_research_round": False,
|
|
633
|
+
"lane_outcomes": lane_outcomes,
|
|
634
|
+
"public_boundary": {
|
|
635
|
+
"raw_logs_recorded": False,
|
|
636
|
+
"private_artifacts_recorded": False,
|
|
637
|
+
"absolute_paths_recorded": False,
|
|
638
|
+
"credentials_recorded": False,
|
|
639
|
+
"local_workspace_path_redacted": True,
|
|
640
|
+
},
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
def _build_collective_round_summary(
|
|
645
|
+
*,
|
|
646
|
+
source: str,
|
|
647
|
+
agent_count: int | None,
|
|
648
|
+
collective_round_count: int,
|
|
649
|
+
dev_metric: float | None,
|
|
650
|
+
holdout_metric: float | None,
|
|
651
|
+
dev_metric_sequence: list[float] | None = None,
|
|
652
|
+
holdout_metric_sequence: list[float] | None = None,
|
|
653
|
+
holdout_improvement_count: int | None = None,
|
|
654
|
+
evidence_event_count: int | None = None,
|
|
655
|
+
expected_lanes: list[dict[str, object]] | None = None,
|
|
656
|
+
lane_outcomes: list[dict[str, object]] | None = None,
|
|
657
|
+
role_declared_successor_todos: list[dict[str, object]] | None = None,
|
|
658
|
+
visible_role_participation_verified: bool = False,
|
|
659
|
+
visible_role_participation_basis: str | None = None,
|
|
660
|
+
) -> dict[str, object]:
|
|
661
|
+
baseline = 1.0
|
|
662
|
+
integrated_evidence: dict[str, object] = {
|
|
663
|
+
"dev_metric": dev_metric,
|
|
664
|
+
"holdout_metric": holdout_metric,
|
|
665
|
+
"evidence_event_count": evidence_event_count,
|
|
666
|
+
}
|
|
667
|
+
if dev_metric_sequence is not None:
|
|
668
|
+
integrated_evidence["dev_metric_sequence"] = list(dev_metric_sequence)
|
|
669
|
+
if holdout_metric_sequence is not None:
|
|
670
|
+
integrated_evidence["holdout_metric_sequence"] = list(holdout_metric_sequence)
|
|
671
|
+
if holdout_improvement_count is not None:
|
|
672
|
+
integrated_evidence["holdout_improvement_count"] = holdout_improvement_count
|
|
673
|
+
kernel_ledger = build_multi_agent_collective_round_ledger(
|
|
674
|
+
source=source,
|
|
675
|
+
expected_lanes=expected_lanes,
|
|
676
|
+
lane_outcomes=lane_outcomes,
|
|
677
|
+
integrated_evidence=integrated_evidence,
|
|
678
|
+
role_declared_successor_todos=role_declared_successor_todos,
|
|
679
|
+
baseline_metric=baseline,
|
|
680
|
+
required_full_participation_round_count=4,
|
|
681
|
+
required_holdout_improvement_count=2,
|
|
682
|
+
)
|
|
683
|
+
kernel_evidence = (
|
|
684
|
+
kernel_ledger.get("integrated_evidence")
|
|
685
|
+
if isinstance(kernel_ledger.get("integrated_evidence"), dict)
|
|
686
|
+
else {}
|
|
687
|
+
)
|
|
688
|
+
verification = (
|
|
689
|
+
kernel_ledger.get("collective_research_verification")
|
|
690
|
+
if isinstance(kernel_ledger.get("collective_research_verification"), dict)
|
|
691
|
+
else {}
|
|
692
|
+
)
|
|
693
|
+
dev_metric = _numeric_metric(kernel_evidence.get("dev_metric"))
|
|
694
|
+
holdout_metric = _numeric_metric(kernel_evidence.get("holdout_metric"))
|
|
695
|
+
dev_sequence = _numeric_sequence(kernel_evidence.get("dev_metric_sequence"))
|
|
696
|
+
holdout_sequence = _numeric_sequence(kernel_evidence.get("holdout_metric_sequence"))
|
|
697
|
+
holdout_improvements = (
|
|
698
|
+
int(kernel_evidence.get("holdout_improvement_count"))
|
|
699
|
+
if isinstance(kernel_evidence.get("holdout_improvement_count"), int)
|
|
700
|
+
and not isinstance(kernel_evidence.get("holdout_improvement_count"), bool)
|
|
701
|
+
else 0
|
|
702
|
+
)
|
|
703
|
+
full_participation_round_count = kernel_ledger.get("full_participation_round_count")
|
|
704
|
+
if not isinstance(full_participation_round_count, int) or isinstance(
|
|
705
|
+
full_participation_round_count, bool
|
|
706
|
+
):
|
|
707
|
+
full_participation_round_count = 0
|
|
708
|
+
full_participation_verified = kernel_ledger.get("full_participation_verified") is True
|
|
709
|
+
full_participation_gap = (
|
|
710
|
+
kernel_ledger.get("full_participation_requirement_gap")
|
|
711
|
+
if isinstance(kernel_ledger.get("full_participation_requirement_gap"), dict)
|
|
712
|
+
else {}
|
|
713
|
+
)
|
|
714
|
+
full_participation_count_basis = str(
|
|
715
|
+
kernel_ledger.get("full_participation_count_basis") or ""
|
|
716
|
+
)
|
|
717
|
+
multi_round_research_verified = (
|
|
718
|
+
verification.get("verified") is True
|
|
719
|
+
and verification.get("dev_metric_over_baseline") is True
|
|
720
|
+
and holdout_metric is not None
|
|
721
|
+
and visible_role_participation_verified
|
|
722
|
+
)
|
|
723
|
+
return {
|
|
724
|
+
"schema_version": "auto_research_collective_round_summary_v0",
|
|
725
|
+
"loaded": collective_round_count > 0 or dev_metric is not None or holdout_metric is not None,
|
|
726
|
+
"source": source,
|
|
727
|
+
"claim_source": source,
|
|
728
|
+
"round_unit": "collective_agent_pass",
|
|
729
|
+
"kernel_ledger": kernel_ledger,
|
|
730
|
+
"definition": (
|
|
731
|
+
"one collective research round means each configured research lane has "
|
|
732
|
+
"one quota/frontier/worker-turn opportunity; pane-local tick loops are "
|
|
733
|
+
"reported separately and do not by themselves prove multi-round research"
|
|
734
|
+
),
|
|
735
|
+
"visible_role_participation_required": True,
|
|
736
|
+
"visible_role_participation_verified": bool(visible_role_participation_verified),
|
|
737
|
+
"visible_role_participation_basis": visible_role_participation_basis
|
|
738
|
+
or (
|
|
739
|
+
"visible_pane_artifacts_plus_live_evidence"
|
|
740
|
+
if visible_role_participation_verified
|
|
741
|
+
else "not_visible_pane_verified"
|
|
742
|
+
),
|
|
743
|
+
"claim_boundary": (
|
|
744
|
+
"worker-loop summaries are control-plane plumbing evidence only; "
|
|
745
|
+
"visible multi-role research claims require visible pane artifacts "
|
|
746
|
+
"plus lane-authored public evidence"
|
|
747
|
+
),
|
|
748
|
+
"agent_count": agent_count,
|
|
749
|
+
"required_collective_round_count": 4,
|
|
750
|
+
"required_holdout_improvement_count": 2,
|
|
751
|
+
"collective_round_count": collective_round_count,
|
|
752
|
+
"full_participation_round_count": full_participation_round_count,
|
|
753
|
+
"full_participation_count_basis": full_participation_count_basis,
|
|
754
|
+
"full_participation_requirement_gap": full_participation_gap,
|
|
755
|
+
"full_participation_verified": full_participation_verified,
|
|
756
|
+
"evidence_stage_count": len(dev_sequence) + len(holdout_sequence),
|
|
757
|
+
"multi_round_research_verified": multi_round_research_verified,
|
|
758
|
+
"improvement_over_rounds": multi_round_research_verified,
|
|
759
|
+
"holdout_improvement_verified": holdout_improvements >= 2,
|
|
760
|
+
"baseline_metric": baseline,
|
|
761
|
+
"dev_metric": dev_metric,
|
|
762
|
+
"holdout_metric": holdout_metric,
|
|
763
|
+
"dev_metric_sequence": dev_sequence,
|
|
764
|
+
"holdout_metric_sequence": holdout_sequence,
|
|
765
|
+
"holdout_improvement_count": holdout_improvements,
|
|
766
|
+
"holdout_delta_over_dev": (
|
|
767
|
+
holdout_metric - dev_metric
|
|
768
|
+
if holdout_metric is not None and dev_metric is not None
|
|
769
|
+
else None
|
|
770
|
+
),
|
|
771
|
+
"evidence_event_count": evidence_event_count,
|
|
772
|
+
"public_boundary": {
|
|
773
|
+
"raw_logs_recorded": False,
|
|
774
|
+
"private_artifacts_recorded": False,
|
|
775
|
+
"absolute_paths_recorded": False,
|
|
776
|
+
"credentials_recorded": False,
|
|
777
|
+
"local_workspace_path_redacted": True,
|
|
778
|
+
},
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
def _collective_summary_from_worker_loop(
|
|
783
|
+
worker_loop: dict[str, object],
|
|
784
|
+
*,
|
|
785
|
+
agent_count: int,
|
|
786
|
+
) -> dict[str, object]:
|
|
787
|
+
turns = worker_loop.get("turns") if isinstance(worker_loop.get("turns"), list) else []
|
|
788
|
+
round_indexes = {
|
|
789
|
+
turn.get("round")
|
|
790
|
+
for turn in turns
|
|
791
|
+
if isinstance(turn, dict)
|
|
792
|
+
and turn.get("executed") is True
|
|
793
|
+
and isinstance(turn.get("round"), int)
|
|
794
|
+
and not isinstance(turn.get("round"), bool)
|
|
795
|
+
}
|
|
796
|
+
dev_metrics = [
|
|
797
|
+
metric
|
|
798
|
+
for turn in turns
|
|
799
|
+
if isinstance(turn, dict)
|
|
800
|
+
for metric in [_numeric_metric(turn.get("dev_metric"))]
|
|
801
|
+
if metric is not None
|
|
802
|
+
]
|
|
803
|
+
holdout_metrics = [
|
|
804
|
+
metric
|
|
805
|
+
for turn in turns
|
|
806
|
+
if isinstance(turn, dict)
|
|
807
|
+
for metric in [_numeric_metric(turn.get("holdout_metric"))]
|
|
808
|
+
if metric is not None
|
|
809
|
+
]
|
|
810
|
+
previous_holdout = 1.0
|
|
811
|
+
holdout_improvement_count = 0
|
|
812
|
+
for metric in holdout_metrics:
|
|
813
|
+
if metric > previous_holdout:
|
|
814
|
+
holdout_improvement_count += 1
|
|
815
|
+
previous_holdout = metric
|
|
816
|
+
successors = [
|
|
817
|
+
successor
|
|
818
|
+
for turn in turns
|
|
819
|
+
if isinstance(turn, dict) and isinstance(turn.get("successor_todos"), list)
|
|
820
|
+
for successor in turn.get("successor_todos", [])
|
|
821
|
+
if isinstance(successor, dict)
|
|
822
|
+
]
|
|
823
|
+
return _build_collective_round_summary(
|
|
824
|
+
source="worker_loop_collective_agent_passes",
|
|
825
|
+
agent_count=agent_count,
|
|
826
|
+
collective_round_count=len(round_indexes),
|
|
827
|
+
dev_metric=dev_metrics[-1] if dev_metrics else None,
|
|
828
|
+
holdout_metric=holdout_metrics[-1] if holdout_metrics else None,
|
|
829
|
+
dev_metric_sequence=dev_metrics,
|
|
830
|
+
holdout_metric_sequence=holdout_metrics,
|
|
831
|
+
holdout_improvement_count=holdout_improvement_count,
|
|
832
|
+
expected_lanes=[
|
|
833
|
+
{"agent_id": turn.get("agent_id"), "role_id": turn.get("role_id")}
|
|
834
|
+
for turn in turns
|
|
835
|
+
if isinstance(turn, dict) and turn.get("round") == 1
|
|
836
|
+
],
|
|
837
|
+
lane_outcomes=[turn for turn in turns if isinstance(turn, dict)],
|
|
838
|
+
role_declared_successor_todos=successors,
|
|
839
|
+
visible_role_participation_verified=False,
|
|
840
|
+
visible_role_participation_basis="headless_worker_loop_summary_only",
|
|
841
|
+
)
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
def _collective_summary_from_visible_evidence(
|
|
845
|
+
*,
|
|
846
|
+
pane_status: dict[str, object],
|
|
847
|
+
evidence: dict[str, object],
|
|
848
|
+
agent_count: int | None,
|
|
849
|
+
expected_lanes: list[dict[str, object]] | None = None,
|
|
850
|
+
) -> dict[str, object]:
|
|
851
|
+
lane_outcomes = (
|
|
852
|
+
pane_status.get("lane_outcomes")
|
|
853
|
+
if isinstance(pane_status.get("lane_outcomes"), list)
|
|
854
|
+
else []
|
|
855
|
+
)
|
|
856
|
+
return _build_collective_round_summary(
|
|
857
|
+
source="visible_lane_authored_evidence",
|
|
858
|
+
agent_count=agent_count,
|
|
859
|
+
collective_round_count=0,
|
|
860
|
+
dev_metric=_numeric_metric(evidence.get("dev_metric")),
|
|
861
|
+
holdout_metric=_numeric_metric(evidence.get("holdout_metric")),
|
|
862
|
+
evidence_event_count=(
|
|
863
|
+
int(evidence.get("evidence_event_count"))
|
|
864
|
+
if isinstance(evidence.get("evidence_event_count"), int)
|
|
865
|
+
and not isinstance(evidence.get("evidence_event_count"), bool)
|
|
866
|
+
else None
|
|
867
|
+
),
|
|
868
|
+
expected_lanes=expected_lanes
|
|
869
|
+
or (
|
|
870
|
+
pane_status.get("lanes") if isinstance(pane_status.get("lanes"), list) else None
|
|
871
|
+
),
|
|
872
|
+
lane_outcomes=lane_outcomes,
|
|
873
|
+
visible_role_participation_verified=True,
|
|
874
|
+
visible_role_participation_basis=(
|
|
875
|
+
"visible_status_artifacts_plus_lane_authored_evidence"
|
|
876
|
+
),
|
|
877
|
+
)
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
def _discover_visible_pane_a2a_status(
|
|
881
|
+
*,
|
|
882
|
+
runtime_root_arg: str | None,
|
|
883
|
+
session_name: str,
|
|
884
|
+
goal_id: str,
|
|
885
|
+
wait_seconds: float,
|
|
886
|
+
) -> dict[str, object] | None:
|
|
887
|
+
if not runtime_root_arg:
|
|
888
|
+
return None
|
|
889
|
+
runtime_root = Path(runtime_root_arg)
|
|
890
|
+
artifact_root = runtime_root / "visible-launcher-artifacts" / session_name
|
|
891
|
+
|
|
892
|
+
deadline = time.monotonic() + max(0.0, wait_seconds)
|
|
893
|
+
while True:
|
|
894
|
+
artifacts = []
|
|
895
|
+
if artifact_root.is_dir():
|
|
896
|
+
for candidate in sorted(artifact_root.glob("*/pane-a2a-status.public.json")):
|
|
897
|
+
try:
|
|
898
|
+
raw = json.loads(candidate.read_text(encoding="utf-8"))
|
|
899
|
+
except Exception:
|
|
900
|
+
continue
|
|
901
|
+
if not isinstance(raw, dict):
|
|
902
|
+
continue
|
|
903
|
+
if raw.get("schema_version") != "pane_local_a2a_status_check_v0":
|
|
904
|
+
continue
|
|
905
|
+
if raw.get("source") != "pane_local_a2a_status_check":
|
|
906
|
+
continue
|
|
907
|
+
if raw.get("goal_id") != goal_id:
|
|
908
|
+
continue
|
|
909
|
+
boundary = raw.get("public_boundary") if isinstance(raw.get("public_boundary"), dict) else {}
|
|
910
|
+
if any(
|
|
911
|
+
boundary.get(key) is not False
|
|
912
|
+
for key in (
|
|
913
|
+
"raw_logs_recorded",
|
|
914
|
+
"private_artifacts_recorded",
|
|
915
|
+
"absolute_paths_recorded",
|
|
916
|
+
"credentials_recorded",
|
|
917
|
+
)
|
|
918
|
+
):
|
|
919
|
+
continue
|
|
920
|
+
artifacts.append(raw)
|
|
921
|
+
if artifacts:
|
|
922
|
+
return _compact_visible_pane_a2a_status(artifacts)
|
|
923
|
+
if time.monotonic() >= deadline:
|
|
924
|
+
return None
|
|
925
|
+
time.sleep(0.5)
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
def _discover_visible_live_evidence(
|
|
929
|
+
*,
|
|
930
|
+
runtime_root_arg: str | None,
|
|
931
|
+
session_name: str,
|
|
932
|
+
goal_id: str,
|
|
933
|
+
wait_seconds: float,
|
|
934
|
+
) -> dict[str, object] | None:
|
|
935
|
+
if not runtime_root_arg:
|
|
936
|
+
return None
|
|
937
|
+
runtime_root = Path(runtime_root_arg)
|
|
938
|
+
artifact_root = runtime_root / "visible-launcher-artifacts" / session_name
|
|
939
|
+
|
|
940
|
+
deadline = time.monotonic() + max(0.0, wait_seconds)
|
|
941
|
+
while True:
|
|
942
|
+
candidates = []
|
|
943
|
+
if artifact_root.is_dir():
|
|
944
|
+
for artifact_name in (
|
|
945
|
+
"live-codex-e2e-evidence.public.json",
|
|
946
|
+
"live_codex_e2e_evidence.public.json",
|
|
947
|
+
):
|
|
948
|
+
candidates.extend(artifact_root.glob(f"*/{artifact_name}"))
|
|
949
|
+
candidates = sorted(set(candidates))
|
|
950
|
+
loaded: list[dict[str, object]] = []
|
|
951
|
+
for candidate in candidates:
|
|
952
|
+
try:
|
|
953
|
+
raw = json.loads(candidate.read_text(encoding="utf-8"))
|
|
954
|
+
except Exception:
|
|
955
|
+
continue
|
|
956
|
+
if not isinstance(raw, dict) or raw.get("goal_id") != goal_id:
|
|
957
|
+
continue
|
|
958
|
+
lane_agent_id = str(raw.get("agent_id") or "").strip()
|
|
959
|
+
if not lane_agent_id:
|
|
960
|
+
continue
|
|
961
|
+
try:
|
|
962
|
+
loaded.append(
|
|
963
|
+
load_live_codex_e2e_evidence(
|
|
964
|
+
evidence_path=str(candidate),
|
|
965
|
+
goal_id=goal_id,
|
|
966
|
+
agent_id=lane_agent_id,
|
|
967
|
+
)
|
|
968
|
+
)
|
|
969
|
+
except ValueError:
|
|
970
|
+
continue
|
|
971
|
+
for evidence in loaded:
|
|
972
|
+
if evidence.get("holdout_metric") is not None:
|
|
973
|
+
merged = dict(evidence)
|
|
974
|
+
if merged.get("dev_metric") is None:
|
|
975
|
+
for other in loaded:
|
|
976
|
+
if other.get("dev_metric") is not None:
|
|
977
|
+
merged["dev_metric"] = other.get("dev_metric")
|
|
978
|
+
break
|
|
979
|
+
return merged
|
|
980
|
+
if loaded and time.monotonic() >= deadline:
|
|
981
|
+
return loaded[0]
|
|
982
|
+
if time.monotonic() >= deadline:
|
|
983
|
+
return None
|
|
984
|
+
time.sleep(0.5)
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
def _load_live_worker_evidence_into_payload(
|
|
988
|
+
*,
|
|
989
|
+
payload: dict[str, object],
|
|
990
|
+
evidence: dict[str, object],
|
|
991
|
+
evidence_source: str,
|
|
992
|
+
) -> None:
|
|
993
|
+
payload["live_worker_evidence"] = _compact_live_worker_evidence(evidence)
|
|
994
|
+
visible_proof = payload["visible_worker_proof"]
|
|
995
|
+
if isinstance(visible_proof, dict):
|
|
996
|
+
visible_proof["lane_authored_evidence_loaded"] = True
|
|
997
|
+
visible_proof["visible_lanes_launched"] = True
|
|
998
|
+
visible_proof["visible_lanes_accepted"] = True
|
|
999
|
+
visible_proof["evidence_source"] = evidence_source
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
def _load_visible_pane_a2a_status_into_payload(
|
|
1003
|
+
*,
|
|
1004
|
+
payload: dict[str, object],
|
|
1005
|
+
status: dict[str, object],
|
|
1006
|
+
) -> None:
|
|
1007
|
+
payload["visible_pane_a2a_status"] = status
|
|
1008
|
+
visible_proof = payload["visible_worker_proof"]
|
|
1009
|
+
if isinstance(visible_proof, dict):
|
|
1010
|
+
visible_proof["pane_local_a2a_status_loaded"] = bool(status.get("loaded"))
|
|
1011
|
+
visible_proof["pane_local_a2a_status_check_count"] = status.get(
|
|
1012
|
+
"status_check_count"
|
|
1013
|
+
)
|
|
1014
|
+
visible_proof["decentralized_a2a_rounds_verified"] = False
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
def _load_collective_research_rounds_into_payload(
|
|
1018
|
+
*,
|
|
1019
|
+
payload: dict[str, object],
|
|
1020
|
+
rounds: dict[str, object],
|
|
1021
|
+
) -> None:
|
|
1022
|
+
payload["collective_research_rounds"] = rounds
|
|
1023
|
+
visible_proof = payload["visible_worker_proof"]
|
|
1024
|
+
if isinstance(visible_proof, dict):
|
|
1025
|
+
visible_proof["collective_research_rounds_loaded"] = bool(rounds.get("loaded"))
|
|
1026
|
+
visible_proof["collective_research_rounds_source"] = rounds.get("source")
|
|
1027
|
+
visible_proof["visible_role_participation_required"] = (
|
|
1028
|
+
rounds.get("visible_role_participation_required") is not False
|
|
1029
|
+
)
|
|
1030
|
+
visible_proof["visible_role_participation_verified"] = (
|
|
1031
|
+
rounds.get("visible_role_participation_verified") is True
|
|
1032
|
+
)
|
|
1033
|
+
visible_proof["visible_role_participation_basis"] = rounds.get(
|
|
1034
|
+
"visible_role_participation_basis"
|
|
1035
|
+
)
|
|
1036
|
+
visible_proof["collective_research_round_count"] = rounds.get(
|
|
1037
|
+
"collective_round_count"
|
|
1038
|
+
)
|
|
1039
|
+
visible_proof["holdout_improvement_count"] = rounds.get(
|
|
1040
|
+
"holdout_improvement_count"
|
|
1041
|
+
)
|
|
1042
|
+
visible_proof["decentralized_a2a_rounds_verified"] = bool(
|
|
1043
|
+
rounds.get("multi_round_research_verified")
|
|
1044
|
+
and rounds.get("visible_role_participation_verified") is True
|
|
1045
|
+
)
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
def _load_visible_wake_into_payload(
|
|
1049
|
+
*,
|
|
1050
|
+
payload: dict[str, object],
|
|
1051
|
+
wake: dict[str, object],
|
|
1052
|
+
) -> None:
|
|
1053
|
+
driver = (
|
|
1054
|
+
wake.get("driver_contract")
|
|
1055
|
+
if isinstance(wake.get("driver_contract"), dict)
|
|
1056
|
+
else {}
|
|
1057
|
+
)
|
|
1058
|
+
prompt_submit_checks = wake.get("prompt_submit_checks") or []
|
|
1059
|
+
pane_input_ready_checks = wake.get("pane_input_ready_checks") or []
|
|
1060
|
+
not_ready_reasons = sorted(
|
|
1061
|
+
{
|
|
1062
|
+
str(check.get("not_ready_reason"))
|
|
1063
|
+
for check in pane_input_ready_checks
|
|
1064
|
+
if isinstance(check, dict) and check.get("not_ready_reason")
|
|
1065
|
+
}
|
|
1066
|
+
)
|
|
1067
|
+
prompt_delivered = bool(prompt_submit_checks)
|
|
1068
|
+
payload["visible_wake"] = {
|
|
1069
|
+
"schema_version": wake.get("schema_version"),
|
|
1070
|
+
"mode": wake.get("mode"),
|
|
1071
|
+
"session_name": wake.get("session_name"),
|
|
1072
|
+
"target_lanes": wake.get("target_lanes"),
|
|
1073
|
+
"prompt_hash": wake.get("prompt_hash"),
|
|
1074
|
+
"coordination_model": wake.get("coordination_model"),
|
|
1075
|
+
"wakeup_model": wake.get("wakeup_model"),
|
|
1076
|
+
"workflow_driver": bool(wake.get("workflow_driver")),
|
|
1077
|
+
"broadcaster_reads_frontier": bool(wake.get("broadcaster_reads_frontier")),
|
|
1078
|
+
"broadcaster_reads_todo_readiness": bool(
|
|
1079
|
+
wake.get("broadcaster_reads_todo_readiness")
|
|
1080
|
+
),
|
|
1081
|
+
"broadcaster_selects_todo": bool(wake.get("broadcaster_selects_todo")),
|
|
1082
|
+
"pane_decision_owner": wake.get("pane_decision_owner"),
|
|
1083
|
+
"pane_input_ready_verified": wake.get("pane_input_ready_verified") is True,
|
|
1084
|
+
"pane_input_ready_checks": pane_input_ready_checks,
|
|
1085
|
+
"pane_input_ready_timeout_seconds": wake.get("pane_input_ready_timeout_seconds"),
|
|
1086
|
+
"ready_lanes": wake.get("ready_lanes") or [],
|
|
1087
|
+
"not_ready_lanes": wake.get("not_ready_lanes") or [],
|
|
1088
|
+
"not_ready_reasons": not_ready_reasons,
|
|
1089
|
+
"prompt_submit_checks": prompt_submit_checks,
|
|
1090
|
+
"prompt_delivered": prompt_delivered,
|
|
1091
|
+
"prompt_delivery": wake.get("prompt_delivery"),
|
|
1092
|
+
"auto_wake_backoff_recommended": wake.get("auto_wake_backoff_recommended") is True,
|
|
1093
|
+
"driver_contract_schema": driver.get("schema_version"),
|
|
1094
|
+
"driver_owner_layer": driver.get("owner_layer"),
|
|
1095
|
+
"boundary": wake.get("boundary"),
|
|
1096
|
+
}
|
|
1097
|
+
visible_proof = payload["visible_worker_proof"]
|
|
1098
|
+
if isinstance(visible_proof, dict):
|
|
1099
|
+
visible_proof["cadence_wake_loaded"] = True
|
|
1100
|
+
prompt_delivery = wake.get("prompt_delivery")
|
|
1101
|
+
cadence_wake_pending_reason = None
|
|
1102
|
+
if not prompt_delivered:
|
|
1103
|
+
if prompt_delivery == "skipped_no_input_ready_panes":
|
|
1104
|
+
cadence_wake_pending_reason = "pane_not_ready"
|
|
1105
|
+
elif prompt_delivery == "skipped_terminal_pane_backoff":
|
|
1106
|
+
cadence_wake_pending_reason = "terminal_backoff"
|
|
1107
|
+
visible_proof["cadence_wake_verified"] = (
|
|
1108
|
+
wake.get("mode") == "execute"
|
|
1109
|
+
and wake.get("coordination_model") == "decentralized_state_a2a"
|
|
1110
|
+
and wake.get("wakeup_model") == "fixed_prompt_broadcast"
|
|
1111
|
+
and wake.get("workflow_driver") is False
|
|
1112
|
+
and wake.get("broadcaster_reads_frontier") is False
|
|
1113
|
+
and wake.get("broadcaster_selects_todo") is False
|
|
1114
|
+
and prompt_delivery
|
|
1115
|
+
in {
|
|
1116
|
+
"tmux_paste_buffer_after_codex_tui_first_turn_ready",
|
|
1117
|
+
"tmux_paste_buffer_after_ready_subset",
|
|
1118
|
+
}
|
|
1119
|
+
and prompt_delivered
|
|
1120
|
+
)
|
|
1121
|
+
visible_proof["cadence_wake_prompt_delivered"] = prompt_delivered
|
|
1122
|
+
visible_proof["cadence_wake_pending_reason"] = cadence_wake_pending_reason
|
|
1123
|
+
visible_proof["cadence_wake_not_ready_reasons"] = not_ready_reasons
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
def _numeric_metric(value: object) -> float | None:
|
|
1127
|
+
if isinstance(value, bool):
|
|
1128
|
+
return None
|
|
1129
|
+
if isinstance(value, (int, float)):
|
|
1130
|
+
return float(value)
|
|
1131
|
+
return None
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
def _numeric_sequence(value: object) -> list[float]:
|
|
1135
|
+
if not isinstance(value, list):
|
|
1136
|
+
return []
|
|
1137
|
+
metrics: list[float] = []
|
|
1138
|
+
for item in value:
|
|
1139
|
+
metric = _numeric_metric(item)
|
|
1140
|
+
if metric is not None:
|
|
1141
|
+
metrics.append(metric)
|
|
1142
|
+
return metrics
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
def _metric_improvement_count(metrics: list[float], *, baseline: float) -> int:
|
|
1146
|
+
previous = baseline
|
|
1147
|
+
count = 0
|
|
1148
|
+
for metric in metrics:
|
|
1149
|
+
if metric > previous:
|
|
1150
|
+
count += 1
|
|
1151
|
+
previous = metric
|
|
1152
|
+
return count
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
def _build_visible_readiness(payload: dict[str, object]) -> dict[str, object]:
|
|
1156
|
+
proof = (
|
|
1157
|
+
payload.get("visible_worker_proof")
|
|
1158
|
+
if isinstance(payload.get("visible_worker_proof"), dict)
|
|
1159
|
+
else {}
|
|
1160
|
+
)
|
|
1161
|
+
pane_status = (
|
|
1162
|
+
payload.get("visible_pane_a2a_status")
|
|
1163
|
+
if isinstance(payload.get("visible_pane_a2a_status"), dict)
|
|
1164
|
+
else {}
|
|
1165
|
+
)
|
|
1166
|
+
collective_rounds = (
|
|
1167
|
+
payload.get("collective_research_rounds")
|
|
1168
|
+
if isinstance(payload.get("collective_research_rounds"), dict)
|
|
1169
|
+
else {}
|
|
1170
|
+
)
|
|
1171
|
+
evidence = (
|
|
1172
|
+
payload.get("live_worker_evidence")
|
|
1173
|
+
if isinstance(payload.get("live_worker_evidence"), dict)
|
|
1174
|
+
else {}
|
|
1175
|
+
)
|
|
1176
|
+
wake = payload.get("visible_wake") if isinstance(payload.get("visible_wake"), dict) else {}
|
|
1177
|
+
supervisor = payload.get("supervisor") if isinstance(payload.get("supervisor"), dict) else {}
|
|
1178
|
+
contract_acceptance = (
|
|
1179
|
+
payload.get("contract_acceptance")
|
|
1180
|
+
if isinstance(payload.get("contract_acceptance"), dict)
|
|
1181
|
+
else {}
|
|
1182
|
+
)
|
|
1183
|
+
driver = (
|
|
1184
|
+
supervisor.get("decentralized_a2a_driver")
|
|
1185
|
+
if isinstance(supervisor.get("decentralized_a2a_driver"), dict)
|
|
1186
|
+
else {}
|
|
1187
|
+
)
|
|
1188
|
+
baseline = 1.0
|
|
1189
|
+
dev_sequence = _numeric_sequence(evidence.get("dev_metric_sequence")) or _numeric_sequence(
|
|
1190
|
+
collective_rounds.get("dev_metric_sequence")
|
|
1191
|
+
)
|
|
1192
|
+
holdout_sequence = _numeric_sequence(evidence.get("holdout_metric_sequence")) or _numeric_sequence(
|
|
1193
|
+
collective_rounds.get("holdout_metric_sequence")
|
|
1194
|
+
)
|
|
1195
|
+
dev_metric = dev_sequence[-1] if dev_sequence else _numeric_metric(evidence.get("dev_metric"))
|
|
1196
|
+
holdout_metric = (
|
|
1197
|
+
holdout_sequence[-1] if holdout_sequence else _numeric_metric(evidence.get("holdout_metric"))
|
|
1198
|
+
)
|
|
1199
|
+
if dev_metric is None:
|
|
1200
|
+
dev_metric = _numeric_metric(collective_rounds.get("dev_metric"))
|
|
1201
|
+
if holdout_metric is None:
|
|
1202
|
+
holdout_metric = _numeric_metric(collective_rounds.get("holdout_metric"))
|
|
1203
|
+
holdout_improvement_count = (
|
|
1204
|
+
collective_rounds.get("holdout_improvement_count")
|
|
1205
|
+
if isinstance(collective_rounds.get("holdout_improvement_count"), int)
|
|
1206
|
+
and not isinstance(collective_rounds.get("holdout_improvement_count"), bool)
|
|
1207
|
+
else _metric_improvement_count(holdout_sequence, baseline=baseline)
|
|
1208
|
+
)
|
|
1209
|
+
best_metric = holdout_metric if holdout_metric is not None else dev_metric
|
|
1210
|
+
best_source = (
|
|
1211
|
+
"final_holdout"
|
|
1212
|
+
if holdout_metric is not None
|
|
1213
|
+
else "final_dev"
|
|
1214
|
+
if dev_metric is not None
|
|
1215
|
+
else None
|
|
1216
|
+
)
|
|
1217
|
+
protected_scope_clean = evidence.get("protected_scope_clean") is True
|
|
1218
|
+
checks = {
|
|
1219
|
+
"user_contract_accepted": contract_acceptance.get("accepted") is True,
|
|
1220
|
+
"visible_lanes_accepted": proof.get("visible_lanes_accepted") is True,
|
|
1221
|
+
"cadence_wake_verified": proof.get("cadence_wake_verified") is True,
|
|
1222
|
+
"pane_local_status_loaded": pane_status.get("loaded") is True,
|
|
1223
|
+
"collective_research_multi_round_verified": (
|
|
1224
|
+
collective_rounds.get("multi_round_research_verified") is True
|
|
1225
|
+
),
|
|
1226
|
+
"visible_role_participation_verified": (
|
|
1227
|
+
proof.get("visible_role_participation_verified") is True
|
|
1228
|
+
),
|
|
1229
|
+
"lane_authored_evidence_loaded": proof.get("lane_authored_evidence_loaded") is True,
|
|
1230
|
+
"protected_scope_clean": protected_scope_clean,
|
|
1231
|
+
"positive_metric_over_baseline": (
|
|
1232
|
+
best_metric is not None and best_metric > baseline
|
|
1233
|
+
),
|
|
1234
|
+
"workflow_driver_false": (
|
|
1235
|
+
pane_status.get("workflow_driver") is False
|
|
1236
|
+
and wake.get("workflow_driver") is False
|
|
1237
|
+
),
|
|
1238
|
+
"kernel_driver_contract_loaded": (
|
|
1239
|
+
driver.get("owner_layer") == "generic_multi_agent_kernel"
|
|
1240
|
+
and driver.get("user_and_preset_do_not_own_tick_driver") is True
|
|
1241
|
+
),
|
|
1242
|
+
}
|
|
1243
|
+
ready = all(checks.values())
|
|
1244
|
+
return {
|
|
1245
|
+
"schema_version": "auto_research_visible_readiness_v0",
|
|
1246
|
+
"ready": ready,
|
|
1247
|
+
"readiness_level": "ready" if ready else "collecting_evidence",
|
|
1248
|
+
"one_command": payload.get("commands", {}).get("one_question_start_with_visible_wake")
|
|
1249
|
+
or payload.get("commands", {}).get("one_command_visible_wake_demo")
|
|
1250
|
+
if isinstance(payload.get("commands"), dict)
|
|
1251
|
+
else None,
|
|
1252
|
+
"coordination_pattern": "decentralized_state_a2a",
|
|
1253
|
+
"wake_model": wake.get("wakeup_model"),
|
|
1254
|
+
"workflow_model": driver.get("driver_model")
|
|
1255
|
+
or "todo_readiness_edge_plus_fixed_retry",
|
|
1256
|
+
"driver_owner_layer": driver.get("owner_layer"),
|
|
1257
|
+
"auto_research_preset_role": "thin_domain_defaults_only",
|
|
1258
|
+
"user_contract_invocation": contract_acceptance.get("canonical_invocation"),
|
|
1259
|
+
"leader_agent_required": False,
|
|
1260
|
+
"manual_artifact_inspection_required": not ready,
|
|
1261
|
+
"checks": checks,
|
|
1262
|
+
"missing_requirements": [key for key, passed in checks.items() if not passed],
|
|
1263
|
+
"contract_acceptance": {
|
|
1264
|
+
"accepted": contract_acceptance.get("accepted") is True,
|
|
1265
|
+
"required_outputs": contract_acceptance.get("required_outputs"),
|
|
1266
|
+
"present_outputs": contract_acceptance.get("present_outputs"),
|
|
1267
|
+
"one_click_start": contract_acceptance.get("checks", {}).get("one_click_start_present")
|
|
1268
|
+
if isinstance(contract_acceptance.get("checks"), dict)
|
|
1269
|
+
else False,
|
|
1270
|
+
},
|
|
1271
|
+
"pane_status": {
|
|
1272
|
+
"scope": "pane_local_state_check",
|
|
1273
|
+
"status_check_count": pane_status.get("status_check_count"),
|
|
1274
|
+
"lane_count": pane_status.get("lane_count"),
|
|
1275
|
+
"counts_as_collective_research_round": False,
|
|
1276
|
+
},
|
|
1277
|
+
"collective_research_rounds": {
|
|
1278
|
+
"scope": collective_rounds.get("round_unit") or "collective_agent_pass",
|
|
1279
|
+
"count": collective_rounds.get("collective_round_count"),
|
|
1280
|
+
"multi_round_verified": collective_rounds.get(
|
|
1281
|
+
"multi_round_research_verified"
|
|
1282
|
+
)
|
|
1283
|
+
is True,
|
|
1284
|
+
"visible_role_participation_verified": collective_rounds.get(
|
|
1285
|
+
"visible_role_participation_verified"
|
|
1286
|
+
)
|
|
1287
|
+
is True,
|
|
1288
|
+
"claim_source": collective_rounds.get("claim_source")
|
|
1289
|
+
or collective_rounds.get("source"),
|
|
1290
|
+
"full_participation_round_count": collective_rounds.get(
|
|
1291
|
+
"full_participation_round_count"
|
|
1292
|
+
),
|
|
1293
|
+
"full_participation_count_basis": collective_rounds.get(
|
|
1294
|
+
"full_participation_count_basis"
|
|
1295
|
+
),
|
|
1296
|
+
"full_participation_requirement_gap": collective_rounds.get(
|
|
1297
|
+
"full_participation_requirement_gap"
|
|
1298
|
+
),
|
|
1299
|
+
"stages": collective_rounds.get("stages") or [],
|
|
1300
|
+
"holdout_improvement_count": holdout_improvement_count,
|
|
1301
|
+
},
|
|
1302
|
+
"improvement_summary": {
|
|
1303
|
+
"baseline_metric": baseline,
|
|
1304
|
+
"dev_metric_sequence": dev_sequence or ([] if dev_metric is None else [dev_metric]),
|
|
1305
|
+
"holdout_metric_sequence": holdout_sequence
|
|
1306
|
+
or ([] if holdout_metric is None else [holdout_metric]),
|
|
1307
|
+
"holdout_improvement_count": holdout_improvement_count,
|
|
1308
|
+
"final_dev_metric": dev_metric,
|
|
1309
|
+
"final_holdout_metric": holdout_metric,
|
|
1310
|
+
"best_metric": best_metric,
|
|
1311
|
+
"best_metric_source": best_source,
|
|
1312
|
+
"improved_over_baseline": best_metric is not None and best_metric > baseline,
|
|
1313
|
+
"holdout_delta_over_dev": (
|
|
1314
|
+
holdout_metric - dev_metric
|
|
1315
|
+
if holdout_metric is not None and dev_metric is not None
|
|
1316
|
+
else None
|
|
1317
|
+
),
|
|
1318
|
+
},
|
|
1319
|
+
"public_boundary": {
|
|
1320
|
+
"raw_logs_recorded": False,
|
|
1321
|
+
"private_artifacts_recorded": False,
|
|
1322
|
+
"absolute_paths_recorded": False,
|
|
1323
|
+
"credentials_recorded": False,
|
|
1324
|
+
},
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
def _load_visible_readiness_into_payload(payload: dict[str, object]) -> None:
|
|
1329
|
+
payload["visible_readiness"] = _build_visible_readiness(payload)
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
def run_auto_research_demo_e2e(
|
|
1333
|
+
*,
|
|
1334
|
+
agent_id: str,
|
|
1335
|
+
goal_id: str,
|
|
1336
|
+
tracking_goal_id: str | None,
|
|
1337
|
+
objective: str,
|
|
1338
|
+
preset_id: str | None = None,
|
|
1339
|
+
output_dir: str,
|
|
1340
|
+
execute: bool,
|
|
1341
|
+
launch_visible: bool,
|
|
1342
|
+
keep_workspace: bool,
|
|
1343
|
+
registry_path: Path,
|
|
1344
|
+
runtime_root_arg: str | None,
|
|
1345
|
+
session_name: str,
|
|
1346
|
+
cli_bin: str,
|
|
1347
|
+
codex_bin: str,
|
|
1348
|
+
tmux_bin: str,
|
|
1349
|
+
reasoning_effort: str,
|
|
1350
|
+
output_language: str,
|
|
1351
|
+
live_evidence_path: str | None,
|
|
1352
|
+
append_evidence: AppendEvidence,
|
|
1353
|
+
visible_launcher: VisibleLauncher | None = None,
|
|
1354
|
+
visible_wake: VisibleWake | None = None,
|
|
1355
|
+
wake_visible_after_launch: bool = False,
|
|
1356
|
+
goal_surface_mode: str = "explicit_goal",
|
|
1357
|
+
agent_specs: Sequence[str] | None = None,
|
|
1358
|
+
run_worker_loop: bool = False,
|
|
1359
|
+
worker_loop_rounds: int = 4,
|
|
1360
|
+
configure_visible_worker_turn: bool = False,
|
|
1361
|
+
visible_live_evidence_wait_seconds: float = 30.0,
|
|
1362
|
+
) -> dict[str, object]:
|
|
1363
|
+
if launch_visible and not execute:
|
|
1364
|
+
raise ValueError("--launch-visible requires --execute")
|
|
1365
|
+
if run_worker_loop and not execute:
|
|
1366
|
+
raise ValueError("--run-worker-loop requires --execute")
|
|
1367
|
+
if worker_loop_rounds < 1:
|
|
1368
|
+
raise ValueError("--worker-loop-rounds must be >= 1")
|
|
1369
|
+
if launch_visible and visible_launcher is None:
|
|
1370
|
+
raise ValueError("--launch-visible requires a visible launcher callback")
|
|
1371
|
+
if wake_visible_after_launch and not launch_visible:
|
|
1372
|
+
raise ValueError("--wake-visible-after-launch requires --launch-visible")
|
|
1373
|
+
if wake_visible_after_launch and visible_wake is None:
|
|
1374
|
+
raise ValueError("--wake-visible-after-launch requires a visible wake callback")
|
|
1375
|
+
if live_evidence_path and not execute:
|
|
1376
|
+
raise ValueError("--live-evidence requires --execute")
|
|
1377
|
+
|
|
1378
|
+
tracking_goal = tracking_goal_id.strip() if isinstance(tracking_goal_id, str) else ""
|
|
1379
|
+
if tracking_goal == goal_id:
|
|
1380
|
+
tracking_goal = ""
|
|
1381
|
+
reuses_default_internal_goal = goal_id == AUTO_RESEARCH_DEFAULT_GOAL_ID
|
|
1382
|
+
effective_agent_specs = list(agent_specs or [])
|
|
1383
|
+
if (run_worker_loop or launch_visible) and not effective_agent_specs:
|
|
1384
|
+
effective_agent_specs = default_auto_research_agent_specs()
|
|
1385
|
+
user_contract = build_auto_research_user_contract(
|
|
1386
|
+
objective,
|
|
1387
|
+
output_language=output_language,
|
|
1388
|
+
preset_id=preset_id,
|
|
1389
|
+
)
|
|
1390
|
+
preset_context = (
|
|
1391
|
+
user_contract.get("preset_context")
|
|
1392
|
+
if isinstance(user_contract.get("preset_context"), dict)
|
|
1393
|
+
else None
|
|
1394
|
+
)
|
|
1395
|
+
contract_acceptance = build_auto_research_contract_acceptance(user_contract)
|
|
1396
|
+
supervisor = build_auto_research_demo_supervisor_plan(
|
|
1397
|
+
goal_id=goal_id,
|
|
1398
|
+
open_question=objective,
|
|
1399
|
+
preset_context=preset_context,
|
|
1400
|
+
agent_specs=effective_agent_specs,
|
|
1401
|
+
session_name=session_name,
|
|
1402
|
+
cli_bin=cli_bin,
|
|
1403
|
+
codex_bin=codex_bin,
|
|
1404
|
+
tmux_bin=tmux_bin,
|
|
1405
|
+
reasoning_effort=reasoning_effort,
|
|
1406
|
+
output_language=output_language,
|
|
1407
|
+
configure_visible_worker_turn=configure_visible_worker_turn,
|
|
1408
|
+
)
|
|
1409
|
+
execution_kind = (
|
|
1410
|
+
"loopx_worker_loop"
|
|
1411
|
+
if execute and run_worker_loop
|
|
1412
|
+
else "visible_worker_launch"
|
|
1413
|
+
if execute and launch_visible
|
|
1414
|
+
else "worker_loop_preview"
|
|
1415
|
+
)
|
|
1416
|
+
result_source = (
|
|
1417
|
+
"loopx_worker_loop_public_evidence"
|
|
1418
|
+
if execute and run_worker_loop
|
|
1419
|
+
else "visible_worker_launcher"
|
|
1420
|
+
if execute and launch_visible
|
|
1421
|
+
else "dry_run_preview"
|
|
1422
|
+
)
|
|
1423
|
+
payload: dict[str, object] = {
|
|
1424
|
+
"ok": True,
|
|
1425
|
+
"schema_version": AUTO_RESEARCH_DEMO_E2E_SCHEMA_VERSION,
|
|
1426
|
+
"mode": "execute" if execute else "dry_run",
|
|
1427
|
+
"execution_kind": execution_kind,
|
|
1428
|
+
"result_source": result_source,
|
|
1429
|
+
"goal_id": goal_id,
|
|
1430
|
+
"tracking_goal_id": tracking_goal or None,
|
|
1431
|
+
"route_contract": _build_demo_frontier_route_contract(
|
|
1432
|
+
goal_id=goal_id,
|
|
1433
|
+
tracking_goal=tracking_goal,
|
|
1434
|
+
preset_context=preset_context,
|
|
1435
|
+
goal_surface_mode=goal_surface_mode,
|
|
1436
|
+
reuses_default_internal_goal=reuses_default_internal_goal,
|
|
1437
|
+
),
|
|
1438
|
+
"agent_id": agent_id,
|
|
1439
|
+
"reasoning_effort": reasoning_effort,
|
|
1440
|
+
"output_language": output_language,
|
|
1441
|
+
"user_contract": user_contract,
|
|
1442
|
+
"preset_context": preset_context,
|
|
1443
|
+
"contract_acceptance": contract_acceptance,
|
|
1444
|
+
"commands": _build_demo_e2e_commands(
|
|
1445
|
+
cli_bin=cli_bin,
|
|
1446
|
+
objective=objective,
|
|
1447
|
+
preset_id=preset_id,
|
|
1448
|
+
output_language=output_language,
|
|
1449
|
+
goal_id=goal_id,
|
|
1450
|
+
agent_id=agent_id,
|
|
1451
|
+
tracking_goal=tracking_goal,
|
|
1452
|
+
session_name=session_name,
|
|
1453
|
+
),
|
|
1454
|
+
"supervisor": _supervisor_summary(supervisor),
|
|
1455
|
+
"public_boundary": {
|
|
1456
|
+
"raw_logs_recorded": False,
|
|
1457
|
+
"private_artifacts_recorded": False,
|
|
1458
|
+
"absolute_paths_recorded": False,
|
|
1459
|
+
"credentials_recorded": False,
|
|
1460
|
+
"local_workspace_path_redacted": True,
|
|
1461
|
+
"writes_loopx_state": bool(execute),
|
|
1462
|
+
"launches_visible_lanes": bool(launch_visible),
|
|
1463
|
+
"visible_codex_sessions_recorded": False,
|
|
1464
|
+
},
|
|
1465
|
+
"visible_worker_proof": build_auto_research_live_worker_proof(
|
|
1466
|
+
launch_visible=launch_visible,
|
|
1467
|
+
),
|
|
1468
|
+
"visible_worker_turn_validation": {
|
|
1469
|
+
"schema_version": "auto_research_visible_worker_turn_validation_v0",
|
|
1470
|
+
"configured": bool(configure_visible_worker_turn),
|
|
1471
|
+
"counts_as_research_evidence_without_role_output": False,
|
|
1472
|
+
"manual_research_required_is_blocker_not_progress": True,
|
|
1473
|
+
},
|
|
1474
|
+
}
|
|
1475
|
+
if not execute:
|
|
1476
|
+
payload["worker_loop_preview"] = {
|
|
1477
|
+
"executed": False,
|
|
1478
|
+
"result_source": "dry_run_preview",
|
|
1479
|
+
"expected_steps": (
|
|
1480
|
+
"seed a demo-local LoopX queue, let role-compatible workers claim "
|
|
1481
|
+
"frontier todos, write public-safe evidence, append rollout events, "
|
|
1482
|
+
"and read compact evidence from state"
|
|
1483
|
+
),
|
|
1484
|
+
"coordination_pattern": "decentralized_state_a2a",
|
|
1485
|
+
}
|
|
1486
|
+
return payload
|
|
1487
|
+
|
|
1488
|
+
tmp_obj: tempfile.TemporaryDirectory[str] | None = None
|
|
1489
|
+
if keep_workspace or launch_visible:
|
|
1490
|
+
demo_root = Path(tempfile.mkdtemp(prefix="loopx-auto-research-demo-e2e."))
|
|
1491
|
+
else:
|
|
1492
|
+
tmp_obj = tempfile.TemporaryDirectory(prefix="loopx-auto-research-demo-e2e.")
|
|
1493
|
+
demo_root = Path(tmp_obj.name)
|
|
1494
|
+
try:
|
|
1495
|
+
visible_control: dict[str, object] | None = None
|
|
1496
|
+
visible_registry_path: Path | None = None
|
|
1497
|
+
visible_runtime_root_arg: str | None = None
|
|
1498
|
+
|
|
1499
|
+
def ensure_visible_control_plane() -> tuple[dict[str, object], Path, str | None]:
|
|
1500
|
+
nonlocal visible_control, visible_registry_path, visible_runtime_root_arg
|
|
1501
|
+
if visible_control is None or visible_registry_path is None:
|
|
1502
|
+
(
|
|
1503
|
+
visible_control,
|
|
1504
|
+
visible_registry_path,
|
|
1505
|
+
visible_runtime_root_arg,
|
|
1506
|
+
) = _seed_visible_demo_control_plane(
|
|
1507
|
+
demo_root=demo_root,
|
|
1508
|
+
goal_id=goal_id,
|
|
1509
|
+
objective=objective,
|
|
1510
|
+
supervisor=supervisor,
|
|
1511
|
+
preset_context=preset_context,
|
|
1512
|
+
)
|
|
1513
|
+
payload["visible_control_plane"] = visible_control
|
|
1514
|
+
return visible_control, visible_registry_path, visible_runtime_root_arg
|
|
1515
|
+
|
|
1516
|
+
visible_control, visible_registry_path, visible_runtime_root_arg = ensure_visible_control_plane()
|
|
1517
|
+
if run_worker_loop:
|
|
1518
|
+
worker_agent_ids = [
|
|
1519
|
+
str(lane.get("agent_id") or "").strip()
|
|
1520
|
+
for lane in supervisor.get("lanes") or []
|
|
1521
|
+
if isinstance(lane, dict) and str(lane.get("agent_id") or "").strip()
|
|
1522
|
+
]
|
|
1523
|
+
|
|
1524
|
+
def append_worker_evidence(packet_path: str) -> dict[str, object]:
|
|
1525
|
+
return append_auto_research_rollout_events(
|
|
1526
|
+
packet_path=packet_path,
|
|
1527
|
+
registry_path=visible_registry_path,
|
|
1528
|
+
runtime_root_arg=visible_runtime_root_arg,
|
|
1529
|
+
dry_run=False,
|
|
1530
|
+
)
|
|
1531
|
+
|
|
1532
|
+
worker_loop = run_auto_research_worker_loop(
|
|
1533
|
+
registry_path=visible_registry_path,
|
|
1534
|
+
runtime_root_arg=visible_runtime_root_arg,
|
|
1535
|
+
goal_id=goal_id,
|
|
1536
|
+
agent_ids=worker_agent_ids,
|
|
1537
|
+
objective=objective,
|
|
1538
|
+
workspace=demo_root / "visible-control-plane",
|
|
1539
|
+
output_dir=output_dir,
|
|
1540
|
+
execute=True,
|
|
1541
|
+
append_evidence=append_worker_evidence,
|
|
1542
|
+
lane_count=len(worker_agent_ids),
|
|
1543
|
+
visible_lanes_accepted=True,
|
|
1544
|
+
complete_selected_todo=True,
|
|
1545
|
+
max_rounds=worker_loop_rounds,
|
|
1546
|
+
)
|
|
1547
|
+
payload["worker_loop"] = worker_loop
|
|
1548
|
+
collective_rounds = _collective_summary_from_worker_loop(
|
|
1549
|
+
worker_loop,
|
|
1550
|
+
agent_count=len(worker_agent_ids),
|
|
1551
|
+
)
|
|
1552
|
+
_load_collective_research_rounds_into_payload(
|
|
1553
|
+
payload=payload,
|
|
1554
|
+
rounds=collective_rounds,
|
|
1555
|
+
)
|
|
1556
|
+
turns = worker_loop.get("turns") if isinstance(worker_loop.get("turns"), list) else []
|
|
1557
|
+
dev_metrics = [
|
|
1558
|
+
metric
|
|
1559
|
+
for turn in turns
|
|
1560
|
+
if isinstance(turn, dict)
|
|
1561
|
+
for metric in [_numeric_metric(turn.get("dev_metric"))]
|
|
1562
|
+
if metric is not None
|
|
1563
|
+
]
|
|
1564
|
+
holdout_metrics = [
|
|
1565
|
+
metric
|
|
1566
|
+
for turn in turns
|
|
1567
|
+
if isinstance(turn, dict)
|
|
1568
|
+
for metric in [_numeric_metric(turn.get("holdout_metric"))]
|
|
1569
|
+
if metric is not None
|
|
1570
|
+
]
|
|
1571
|
+
dev_metric = dev_metrics[-1] if dev_metrics else None
|
|
1572
|
+
holdout_metric = holdout_metrics[-1] if holdout_metrics else None
|
|
1573
|
+
positive_result = holdout_metric is not None or dev_metric is not None
|
|
1574
|
+
payload["tonight_experience"] = {
|
|
1575
|
+
"schema_version": "auto_research_tonight_experience_v0",
|
|
1576
|
+
"ready": positive_result,
|
|
1577
|
+
"one_command": payload["commands"]["one_command_worker_loop"],
|
|
1578
|
+
"goal_id": goal_id,
|
|
1579
|
+
"goal_surface_mode": goal_surface_mode,
|
|
1580
|
+
"coordination_pattern": "decentralized_state_a2a",
|
|
1581
|
+
"workflow_model": "state_projected_frontier_not_dynamic_workflow",
|
|
1582
|
+
"driver_role": "polling_driver_only",
|
|
1583
|
+
"leader_agent_required": False,
|
|
1584
|
+
"worker_loop_round_count": worker_loop.get("round_count"),
|
|
1585
|
+
"collective_research_round_count": collective_rounds.get(
|
|
1586
|
+
"collective_round_count"
|
|
1587
|
+
),
|
|
1588
|
+
"collective_multi_round_verified": collective_rounds.get(
|
|
1589
|
+
"multi_round_research_verified"
|
|
1590
|
+
),
|
|
1591
|
+
"executed_turn_count": worker_loop.get("executed_turn_count"),
|
|
1592
|
+
"completed_turn_count": worker_loop.get("completed_turn_count"),
|
|
1593
|
+
"selected_actions": worker_loop.get("selected_actions"),
|
|
1594
|
+
"dev_metric_sequence": dev_metrics,
|
|
1595
|
+
"holdout_metric_sequence": holdout_metrics,
|
|
1596
|
+
"holdout_improvement_count": collective_rounds.get(
|
|
1597
|
+
"holdout_improvement_count"
|
|
1598
|
+
),
|
|
1599
|
+
"dev_metric": dev_metric,
|
|
1600
|
+
"holdout_metric": holdout_metric,
|
|
1601
|
+
"positive_result": positive_result,
|
|
1602
|
+
"positive_result_basis": (
|
|
1603
|
+
"public_safe_dev_and_holdout_evidence"
|
|
1604
|
+
if holdout_metric is not None
|
|
1605
|
+
else "public_safe_dev_evidence"
|
|
1606
|
+
if dev_metric is not None
|
|
1607
|
+
else "requires_visible_lane_authored_evidence"
|
|
1608
|
+
),
|
|
1609
|
+
"state_surfaces": [
|
|
1610
|
+
"demo-local LoopX registry",
|
|
1611
|
+
"quota/frontier selection",
|
|
1612
|
+
"todo completion",
|
|
1613
|
+
"rollout event log",
|
|
1614
|
+
],
|
|
1615
|
+
"worker_contract": (
|
|
1616
|
+
"Each role reads the shared LoopX state surface, accepts only its projected "
|
|
1617
|
+
"frontier item, writes public-safe evidence, and completes the selected todo."
|
|
1618
|
+
),
|
|
1619
|
+
"public_boundary": {
|
|
1620
|
+
"raw_logs_recorded": False,
|
|
1621
|
+
"private_artifacts_recorded": False,
|
|
1622
|
+
"absolute_paths_recorded": False,
|
|
1623
|
+
"visible_codex_lane_authored": False,
|
|
1624
|
+
},
|
|
1625
|
+
}
|
|
1626
|
+
if launch_visible and visible_launcher is not None:
|
|
1627
|
+
(
|
|
1628
|
+
visible_control,
|
|
1629
|
+
visible_registry_path,
|
|
1630
|
+
visible_runtime_root_arg,
|
|
1631
|
+
) = ensure_visible_control_plane()
|
|
1632
|
+
visible_payload = visible_launcher(
|
|
1633
|
+
dict(supervisor),
|
|
1634
|
+
visible_registry_path,
|
|
1635
|
+
visible_runtime_root_arg,
|
|
1636
|
+
demo_root,
|
|
1637
|
+
)
|
|
1638
|
+
launch_result = (
|
|
1639
|
+
visible_payload.get("launch_result")
|
|
1640
|
+
if isinstance(visible_payload.get("launch_result"), dict)
|
|
1641
|
+
else {}
|
|
1642
|
+
)
|
|
1643
|
+
visible_acceptance = (
|
|
1644
|
+
launch_result.get("visible_acceptance")
|
|
1645
|
+
if isinstance(launch_result.get("visible_acceptance"), dict)
|
|
1646
|
+
else {}
|
|
1647
|
+
)
|
|
1648
|
+
payload["visible_launch"] = {
|
|
1649
|
+
"mode": visible_payload.get("mode"),
|
|
1650
|
+
"launch_result": launch_result,
|
|
1651
|
+
"boundary": visible_payload.get("boundary"),
|
|
1652
|
+
}
|
|
1653
|
+
visible_proof = payload["visible_worker_proof"]
|
|
1654
|
+
if isinstance(visible_proof, dict):
|
|
1655
|
+
visible_proof["visible_lanes_launched"] = True
|
|
1656
|
+
visible_proof["visible_lanes_accepted"] = bool(visible_acceptance.get("accepted"))
|
|
1657
|
+
visible_proof["evidence_source"] = "visible_launcher"
|
|
1658
|
+
if wake_visible_after_launch and visible_wake is not None:
|
|
1659
|
+
session = str(launch_result.get("session_name") or session_name)
|
|
1660
|
+
workspace = demo_root / "visible-control-plane"
|
|
1661
|
+
|
|
1662
|
+
# Build lane_id → agent_id mapping from the supervisor lanes.
|
|
1663
|
+
lane_agent_lookup: dict[str, str] = {}
|
|
1664
|
+
for lane in supervisor.get("lanes") or []:
|
|
1665
|
+
if not isinstance(lane, dict):
|
|
1666
|
+
continue
|
|
1667
|
+
lid = str(lane.get("lane_id") or "").strip()
|
|
1668
|
+
aid = str(lane.get("agent_id") or "").strip()
|
|
1669
|
+
if lid and aid:
|
|
1670
|
+
lane_agent_lookup[lid] = aid
|
|
1671
|
+
|
|
1672
|
+
# Filter: only wake lanes that have a selected runnable todo and
|
|
1673
|
+
# are not in quiet-completion.
|
|
1674
|
+
ready_lanes: list[str] = []
|
|
1675
|
+
skipped_lanes: list[dict[str, object]] = []
|
|
1676
|
+
for raw_lane in launch_result.get("started_lanes") or []:
|
|
1677
|
+
lane_id = str(raw_lane).strip() if raw_lane else ""
|
|
1678
|
+
if not lane_id:
|
|
1679
|
+
continue
|
|
1680
|
+
agent_id = lane_agent_lookup.get(lane_id)
|
|
1681
|
+
if not agent_id:
|
|
1682
|
+
skipped_lanes.append({
|
|
1683
|
+
"lane_id": lane_id,
|
|
1684
|
+
"reason": "no_agent_mapping",
|
|
1685
|
+
})
|
|
1686
|
+
continue
|
|
1687
|
+
try:
|
|
1688
|
+
frontier = load_auto_research_worker_frontier(
|
|
1689
|
+
registry_path=visible_registry_path,
|
|
1690
|
+
runtime_root_arg=visible_runtime_root_arg,
|
|
1691
|
+
goal_id=goal_id,
|
|
1692
|
+
agent_id=agent_id,
|
|
1693
|
+
workspace=workspace,
|
|
1694
|
+
)
|
|
1695
|
+
except Exception:
|
|
1696
|
+
skipped_lanes.append({
|
|
1697
|
+
"lane_id": lane_id,
|
|
1698
|
+
"agent_id": agent_id,
|
|
1699
|
+
"reason": "frontier_load_failed",
|
|
1700
|
+
"error_code": "FRONTIER_LOAD_FAILED",
|
|
1701
|
+
})
|
|
1702
|
+
continue
|
|
1703
|
+
frontier_data = (
|
|
1704
|
+
frontier.get("frontier")
|
|
1705
|
+
if isinstance(frontier.get("frontier"), dict)
|
|
1706
|
+
else {}
|
|
1707
|
+
)
|
|
1708
|
+
selected = frontier_data.get("selected")
|
|
1709
|
+
completion = (
|
|
1710
|
+
frontier_data.get("completion")
|
|
1711
|
+
if isinstance(frontier_data.get("completion"), dict)
|
|
1712
|
+
else None
|
|
1713
|
+
)
|
|
1714
|
+
quota = (
|
|
1715
|
+
frontier.get("quota")
|
|
1716
|
+
if isinstance(frontier.get("quota"), dict)
|
|
1717
|
+
else {}
|
|
1718
|
+
)
|
|
1719
|
+
if completion and completion.get("quiet_completion_allowed") is True:
|
|
1720
|
+
skipped_lanes.append({
|
|
1721
|
+
"lane_id": lane_id,
|
|
1722
|
+
"agent_id": agent_id,
|
|
1723
|
+
"reason": "quiet_completion_allowed",
|
|
1724
|
+
})
|
|
1725
|
+
continue
|
|
1726
|
+
if not selected:
|
|
1727
|
+
skipped_lanes.append({
|
|
1728
|
+
"lane_id": lane_id,
|
|
1729
|
+
"agent_id": agent_id,
|
|
1730
|
+
"reason": "no_selected_todo",
|
|
1731
|
+
"runnable_count": frontier_data.get("runnable_count"),
|
|
1732
|
+
"blocked_count": frontier_data.get("blocked_count"),
|
|
1733
|
+
})
|
|
1734
|
+
continue
|
|
1735
|
+
if quota.get("should_run") is False:
|
|
1736
|
+
skipped_lanes.append({
|
|
1737
|
+
"lane_id": lane_id,
|
|
1738
|
+
"agent_id": agent_id,
|
|
1739
|
+
"reason": "quota_should_run_false",
|
|
1740
|
+
"quota_state": quota.get("state"),
|
|
1741
|
+
})
|
|
1742
|
+
continue
|
|
1743
|
+
ready_lanes.append(lane_id)
|
|
1744
|
+
|
|
1745
|
+
if not ready_lanes:
|
|
1746
|
+
wake_payload: dict[str, object] = {
|
|
1747
|
+
"ok": True,
|
|
1748
|
+
"schema_version": "multi_agent_pane_a2a_wakeup_v0",
|
|
1749
|
+
"mode": "no_op_all_filtered",
|
|
1750
|
+
"session_name": session,
|
|
1751
|
+
"target_lanes": [],
|
|
1752
|
+
"prompt": "",
|
|
1753
|
+
"prompt_hash": "",
|
|
1754
|
+
"coordination_model": "decentralized_state_a2a",
|
|
1755
|
+
"wakeup_model": "state_aware_filter_no_ready_lanes",
|
|
1756
|
+
"workflow_driver": False,
|
|
1757
|
+
"broadcaster_reads_frontier": False,
|
|
1758
|
+
"broadcaster_reads_todo_readiness": False,
|
|
1759
|
+
"broadcaster_selects_todo": False,
|
|
1760
|
+
"prompt_delivery": "skipped_no_ready_lanes",
|
|
1761
|
+
"prompt_delivered": False,
|
|
1762
|
+
"auto_wake_backoff_recommended": False,
|
|
1763
|
+
}
|
|
1764
|
+
else:
|
|
1765
|
+
wake_payload = visible_wake(session, ready_lanes)
|
|
1766
|
+
if skipped_lanes:
|
|
1767
|
+
wake_payload = dict(wake_payload)
|
|
1768
|
+
wake_payload["state_aware_filter"] = {
|
|
1769
|
+
"schema_version": "auto_research_state_aware_wake_filter_v0",
|
|
1770
|
+
"total_started_lanes": len(
|
|
1771
|
+
[
|
|
1772
|
+
s for s in (launch_result.get("started_lanes") or [])
|
|
1773
|
+
if str(s).strip()
|
|
1774
|
+
]
|
|
1775
|
+
),
|
|
1776
|
+
"ready_lane_count": len(ready_lanes),
|
|
1777
|
+
"skipped_lane_count": len(skipped_lanes),
|
|
1778
|
+
"skipped_lanes": skipped_lanes,
|
|
1779
|
+
}
|
|
1780
|
+
_load_visible_wake_into_payload(
|
|
1781
|
+
payload=payload,
|
|
1782
|
+
wake=wake_payload,
|
|
1783
|
+
)
|
|
1784
|
+
pane_status = _discover_visible_pane_a2a_status(
|
|
1785
|
+
runtime_root_arg=visible_runtime_root_arg,
|
|
1786
|
+
session_name=str(launch_result.get("session_name") or session_name),
|
|
1787
|
+
goal_id=goal_id,
|
|
1788
|
+
wait_seconds=visible_live_evidence_wait_seconds,
|
|
1789
|
+
)
|
|
1790
|
+
if pane_status is not None:
|
|
1791
|
+
_load_visible_pane_a2a_status_into_payload(
|
|
1792
|
+
payload=payload,
|
|
1793
|
+
status=pane_status,
|
|
1794
|
+
)
|
|
1795
|
+
collective_rounds = None
|
|
1796
|
+
live_evidence = _discover_visible_live_evidence(
|
|
1797
|
+
runtime_root_arg=visible_runtime_root_arg,
|
|
1798
|
+
session_name=str(launch_result.get("session_name") or session_name),
|
|
1799
|
+
goal_id=goal_id,
|
|
1800
|
+
wait_seconds=visible_live_evidence_wait_seconds,
|
|
1801
|
+
)
|
|
1802
|
+
if live_evidence is not None:
|
|
1803
|
+
_load_live_worker_evidence_into_payload(
|
|
1804
|
+
payload=payload,
|
|
1805
|
+
evidence=live_evidence,
|
|
1806
|
+
evidence_source="visible_launcher_artifact",
|
|
1807
|
+
)
|
|
1808
|
+
if collective_rounds is None and pane_status is not None:
|
|
1809
|
+
collective_rounds = _collective_summary_from_visible_evidence(
|
|
1810
|
+
pane_status=pane_status,
|
|
1811
|
+
evidence=payload["live_worker_evidence"],
|
|
1812
|
+
agent_count=(
|
|
1813
|
+
int(pane_status.get("lane_count"))
|
|
1814
|
+
if isinstance(pane_status.get("lane_count"), int)
|
|
1815
|
+
and not isinstance(pane_status.get("lane_count"), bool)
|
|
1816
|
+
else None
|
|
1817
|
+
),
|
|
1818
|
+
expected_lanes=[
|
|
1819
|
+
{
|
|
1820
|
+
"agent_id": lane.get("agent_id"),
|
|
1821
|
+
"lane_id": lane.get("lane_id"),
|
|
1822
|
+
"role_id": lane.get("role_id"),
|
|
1823
|
+
}
|
|
1824
|
+
for lane in supervisor.get("lanes") or []
|
|
1825
|
+
if isinstance(lane, dict)
|
|
1826
|
+
],
|
|
1827
|
+
)
|
|
1828
|
+
_load_collective_research_rounds_into_payload(
|
|
1829
|
+
payload=payload,
|
|
1830
|
+
rounds=collective_rounds,
|
|
1831
|
+
)
|
|
1832
|
+
_load_visible_readiness_into_payload(payload)
|
|
1833
|
+
payload["workspace_retained"] = keep_workspace or launch_visible
|
|
1834
|
+
if live_evidence_path:
|
|
1835
|
+
live_evidence = load_live_codex_e2e_evidence(
|
|
1836
|
+
evidence_path=live_evidence_path,
|
|
1837
|
+
goal_id=goal_id,
|
|
1838
|
+
agent_id=agent_id,
|
|
1839
|
+
)
|
|
1840
|
+
_load_live_worker_evidence_into_payload(
|
|
1841
|
+
payload=payload,
|
|
1842
|
+
evidence=live_evidence,
|
|
1843
|
+
evidence_source="live_worker_evidence",
|
|
1844
|
+
)
|
|
1845
|
+
return payload
|
|
1846
|
+
finally:
|
|
1847
|
+
if tmp_obj is not None:
|
|
1848
|
+
tmp_obj.cleanup()
|