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
loopx/worker_bridge.py
ADDED
|
@@ -0,0 +1,1574 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import re
|
|
5
|
+
import shlex
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
WORKER_BRIDGE_INSTALL_CONTRACT_VERSION = "loopx_worker_bridge_install_contract_v0"
|
|
11
|
+
WORKER_BRIDGE_SURFACE = "loopx_worker_bridge_source_mount_v0"
|
|
12
|
+
LOOPX_PROJECT_ROOT_PLACEHOLDER = "<loopx-project-root>"
|
|
13
|
+
LOOPX_RUNTIME_ROOT_PLACEHOLDER = "<loopx-runtime-root>"
|
|
14
|
+
LOOPX_ACTIVE_USER_HOST_DIR_PLACEHOLDER = "<active-user-host-dir>"
|
|
15
|
+
DEFAULT_WORKER_BRIDGE_TRACE_DIR = "/logs/agent"
|
|
16
|
+
DEFAULT_WORKER_BRIDGE_ACTIVE_USER_MOUNT_TARGET = "/loopx-active-user"
|
|
17
|
+
DEFAULT_WORKER_BRIDGE_COUNTER_TRACE_JSON = (
|
|
18
|
+
DEFAULT_WORKER_BRIDGE_TRACE_DIR + "/loopx-counter-trace.jsonl"
|
|
19
|
+
)
|
|
20
|
+
DEFAULT_WORKER_BRIDGE_BENCHMARK_RUN_JSON = (
|
|
21
|
+
DEFAULT_WORKER_BRIDGE_TRACE_DIR + "/loopx-worker-benchmark-run.json"
|
|
22
|
+
)
|
|
23
|
+
DEFAULT_WORKER_BRIDGE_ACTIVE_USER_FEED_JSONL = (
|
|
24
|
+
DEFAULT_WORKER_BRIDGE_TRACE_DIR + "/loopx-active-user-interventions.jsonl"
|
|
25
|
+
)
|
|
26
|
+
DEFAULT_WORKER_BRIDGE_ACTIVE_USER_OBSERVATION_JSON = (
|
|
27
|
+
DEFAULT_WORKER_BRIDGE_TRACE_DIR + "/loopx-active-user-observation.json"
|
|
28
|
+
)
|
|
29
|
+
DEFAULT_ACTIVE_USER_CODEX_BIN = "/opt/homebrew/bin/codex"
|
|
30
|
+
DEFAULT_ACTIVE_USER_SIMULATOR_CONTEXT_DIR = "<active-user-public-context-dir>"
|
|
31
|
+
DEFAULT_ACTIVE_USER_SIMULATOR_PROMPT_JSON = "<active-user-simulator-prompt.json>"
|
|
32
|
+
DEFAULT_ACTIVE_USER_SIMULATOR_OUTPUT_JSON = "<active-user-simulator-output.json>"
|
|
33
|
+
DEFAULT_ACTIVE_USER_SIMULATOR_OUTPUT_SCHEMA_JSON = (
|
|
34
|
+
"<active-user-simulator-output-schema.json>"
|
|
35
|
+
)
|
|
36
|
+
DEFAULT_WORKER_BRIDGE_PYTHON_BIN = "python3"
|
|
37
|
+
DEFAULT_WORKER_BRIDGE_MODULE = "loopx.cli"
|
|
38
|
+
WORKER_BRIDGE_PYTHON_RUNTIME_POLICY = "ensure_python3_before_worker_cli_bridge"
|
|
39
|
+
WORKER_BRIDGE_OUTCOME_SCHEMA_VERSION = "loopx_worker_bridge_outcome_v0"
|
|
40
|
+
WORKER_BRIDGE_BENCHMARK_RUN_WRITEBACK_CONTRACT_VERSION = (
|
|
41
|
+
"loopx_worker_benchmark_run_writeback_contract_v0"
|
|
42
|
+
)
|
|
43
|
+
ACTIVE_USER_INTERVENTION_CHANNEL_CONTRACT_VERSION = (
|
|
44
|
+
"loopx_active_user_intervention_channel_contract_v0"
|
|
45
|
+
)
|
|
46
|
+
ACTIVE_USER_INTERVENTION_EVENT_VERSION = "loopx_active_user_intervention_v0"
|
|
47
|
+
ACTIVE_USER_INTERVENTION_OBSERVATION_VERSION = (
|
|
48
|
+
"loopx_active_user_intervention_observation_v0"
|
|
49
|
+
)
|
|
50
|
+
ACTIVE_USER_INTERVENTION_CHANNEL_SURFACE = (
|
|
51
|
+
"loopx_active_user_external_update_loop_v0"
|
|
52
|
+
)
|
|
53
|
+
ACTIVE_USER_CODEX_SIMULATOR_CONTRACT_VERSION = (
|
|
54
|
+
"loopx_active_user_codex_cli_simulator_contract_v0"
|
|
55
|
+
)
|
|
56
|
+
ACTIVE_USER_SIMULATOR_OUTPUT_VERSION = (
|
|
57
|
+
"loopx_active_user_simulator_output_v0"
|
|
58
|
+
)
|
|
59
|
+
ACTIVE_USER_SIMULATOR_ALLOWED_EVIDENCE_BASIS = (
|
|
60
|
+
"public task prompt visible to worker",
|
|
61
|
+
"worker public artifacts",
|
|
62
|
+
"compact LoopX status and run metadata",
|
|
63
|
+
)
|
|
64
|
+
ACTIVE_USER_SIMULATOR_NO_ORACLE_AUDIT_KEYS = (
|
|
65
|
+
"hidden_tests_visible",
|
|
66
|
+
"expected_solution_visible",
|
|
67
|
+
"benchmark_answer_key_visible",
|
|
68
|
+
"credential_values_visible",
|
|
69
|
+
"private_material_visible",
|
|
70
|
+
"solution_patch_visible",
|
|
71
|
+
)
|
|
72
|
+
DEFAULT_WORKER_BRIDGE_CLI_CALL_MINIMUM = 1
|
|
73
|
+
DEFAULT_WORKER_BRIDGE_WALL_TIME_LIMIT_SECONDS = 900.0
|
|
74
|
+
DEFAULT_WORKER_BRIDGE_SOURCE_RUNNER = "worker_bridge_runner"
|
|
75
|
+
DEFAULT_WORKER_BRIDGE_BENCHMARK_ID = "worker-bridge-sample@v0"
|
|
76
|
+
DEFAULT_WORKER_BRIDGE_JOB_NAME = "loopx_worker_bridge_sample"
|
|
77
|
+
DEFAULT_WORKER_BRIDGE_MODE = "codex_loopx_active_worker"
|
|
78
|
+
DEFAULT_WORKER_BRIDGE_WORKER_MODE = "codex_loopx_cli"
|
|
79
|
+
DEFAULT_WORKER_BRIDGE_TASK_ID = "worker-bridge-sample"
|
|
80
|
+
DEFAULT_WORKER_BRIDGE_TRIAL_NAME = "worker-bridge-sample-worker"
|
|
81
|
+
WORKER_BRIDGE_BENCHMARK_RUN_REQUIRED_TOP_LEVEL_FIELDS = (
|
|
82
|
+
"schema_version",
|
|
83
|
+
"source_runner",
|
|
84
|
+
"benchmark_id",
|
|
85
|
+
"job_name",
|
|
86
|
+
"mode",
|
|
87
|
+
"worker_mode",
|
|
88
|
+
"real_run",
|
|
89
|
+
"submit_eligible",
|
|
90
|
+
"leaderboard_evidence",
|
|
91
|
+
"official_task_score",
|
|
92
|
+
"validation_scope",
|
|
93
|
+
"progress",
|
|
94
|
+
"validation",
|
|
95
|
+
"claim_boundary",
|
|
96
|
+
"trials",
|
|
97
|
+
)
|
|
98
|
+
WORKER_BRIDGE_BENCHMARK_RUN_REQUIRED_FIXED_FIELDS = {
|
|
99
|
+
"real_run": True,
|
|
100
|
+
"submit_eligible": False,
|
|
101
|
+
"leaderboard_evidence": False,
|
|
102
|
+
}
|
|
103
|
+
WORKER_BRIDGE_BENCHMARK_RUN_FORBIDDEN_PUBLIC_FIELDS = (
|
|
104
|
+
"raw_paths",
|
|
105
|
+
"raw_logs",
|
|
106
|
+
"raw_trace",
|
|
107
|
+
"raw_task_prompt",
|
|
108
|
+
"raw_sessions",
|
|
109
|
+
"credential_values",
|
|
110
|
+
"auth_values",
|
|
111
|
+
)
|
|
112
|
+
ACTIVE_USER_PUBLIC_TEXT_FORBIDDEN_MARKERS = (
|
|
113
|
+
"/" + "Users/",
|
|
114
|
+
"/" + "tmp/",
|
|
115
|
+
".local/",
|
|
116
|
+
".loopx",
|
|
117
|
+
"OPENAI" + "_API_KEY",
|
|
118
|
+
"ARK" + "_API_KEY",
|
|
119
|
+
"CODEX" + "_AUTH_JSON",
|
|
120
|
+
"Author" + "ization:",
|
|
121
|
+
"Bear" + "er ",
|
|
122
|
+
"-----BEGIN",
|
|
123
|
+
"tok" + "en=",
|
|
124
|
+
"pass" + "word=",
|
|
125
|
+
)
|
|
126
|
+
ACTIVE_USER_SECRET_KEY_SHAPED_RE = re.compile(r"(?<![A-Za-z0-9])sk-[A-Za-z0-9_-]{8,}")
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def build_worker_bridge_mounts(
|
|
130
|
+
*,
|
|
131
|
+
project_root: str = LOOPX_PROJECT_ROOT_PLACEHOLDER,
|
|
132
|
+
runtime_root: str = LOOPX_RUNTIME_ROOT_PLACEHOLDER,
|
|
133
|
+
active_user_host_dir: str | None = None,
|
|
134
|
+
active_user_mount_target: str = DEFAULT_WORKER_BRIDGE_ACTIVE_USER_MOUNT_TARGET,
|
|
135
|
+
) -> list[dict[str, Any]]:
|
|
136
|
+
"""Build read-only source/runtime mounts for a worker-side LoopX CLI."""
|
|
137
|
+
|
|
138
|
+
mounts = [
|
|
139
|
+
{
|
|
140
|
+
"type": "bind",
|
|
141
|
+
"source": project_root,
|
|
142
|
+
"target": project_root,
|
|
143
|
+
"read_only": True,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"type": "bind",
|
|
147
|
+
"source": runtime_root,
|
|
148
|
+
"target": runtime_root,
|
|
149
|
+
"read_only": True,
|
|
150
|
+
},
|
|
151
|
+
]
|
|
152
|
+
if active_user_host_dir:
|
|
153
|
+
mounts.append(
|
|
154
|
+
{
|
|
155
|
+
"type": "bind",
|
|
156
|
+
"source": active_user_host_dir,
|
|
157
|
+
"target": active_user_mount_target,
|
|
158
|
+
"read_only": False,
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
return mounts
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def build_worker_bridge_command_prefix(
|
|
165
|
+
*,
|
|
166
|
+
project_root: str = LOOPX_PROJECT_ROOT_PLACEHOLDER,
|
|
167
|
+
python_bin: str = DEFAULT_WORKER_BRIDGE_PYTHON_BIN,
|
|
168
|
+
module: str = DEFAULT_WORKER_BRIDGE_MODULE,
|
|
169
|
+
) -> str:
|
|
170
|
+
"""Build the in-worker command prefix for LoopX CLI calls."""
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
f"PYTHONPATH={shlex.quote(project_root)} "
|
|
174
|
+
f"{shlex.quote(python_bin)} -m {shlex.quote(module)}"
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def build_worker_bridge_python_runtime_preflight_command(
|
|
179
|
+
*,
|
|
180
|
+
project_root: str = LOOPX_PROJECT_ROOT_PLACEHOLDER,
|
|
181
|
+
python_bin: str = DEFAULT_WORKER_BRIDGE_PYTHON_BIN,
|
|
182
|
+
module: str = DEFAULT_WORKER_BRIDGE_MODULE,
|
|
183
|
+
) -> str:
|
|
184
|
+
"""Build a worker-side preflight that makes the Python CLI bridge runnable."""
|
|
185
|
+
|
|
186
|
+
project_root_arg = shlex.quote(project_root)
|
|
187
|
+
python_bin_arg = shlex.quote(python_bin)
|
|
188
|
+
python_code = shlex.quote(
|
|
189
|
+
"import importlib; "
|
|
190
|
+
f"importlib.import_module({json.dumps(module)})"
|
|
191
|
+
)
|
|
192
|
+
return (
|
|
193
|
+
"set -e; "
|
|
194
|
+
f"if ! command -v {python_bin_arg} >/dev/null 2>&1; then "
|
|
195
|
+
"if command -v apt-get >/dev/null 2>&1; then "
|
|
196
|
+
"apt-get update && apt-get install -y python3; "
|
|
197
|
+
"elif command -v apk >/dev/null 2>&1; then "
|
|
198
|
+
"apk add --no-cache python3; "
|
|
199
|
+
"elif command -v yum >/dev/null 2>&1; then "
|
|
200
|
+
"yum install -y python3; "
|
|
201
|
+
"else "
|
|
202
|
+
"echo 'loopx worker bridge requires python3 but no supported package manager was found' >&2; "
|
|
203
|
+
"exit 127; "
|
|
204
|
+
"fi; "
|
|
205
|
+
"fi; "
|
|
206
|
+
f"PYTHONPATH={project_root_arg} {python_bin_arg} -c {python_code}"
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def build_worker_bridge_benchmark_run_writeback_contract(
|
|
211
|
+
*,
|
|
212
|
+
benchmark_run_json: str = DEFAULT_WORKER_BRIDGE_BENCHMARK_RUN_JSON,
|
|
213
|
+
counter_trace_json: str = DEFAULT_WORKER_BRIDGE_COUNTER_TRACE_JSON,
|
|
214
|
+
classification: str = "<classification>",
|
|
215
|
+
) -> dict[str, Any]:
|
|
216
|
+
"""Build the worker-facing compact benchmark_run writeback contract.
|
|
217
|
+
|
|
218
|
+
This is deliberately schema guidance, not a task-specific report. It gives
|
|
219
|
+
an isolated worker enough shape to write a compactor-safe payload before
|
|
220
|
+
calling `history append-benchmark-run`, without exposing raw traces or
|
|
221
|
+
benchmark-private paths in public artifacts.
|
|
222
|
+
"""
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
"schema_version": WORKER_BRIDGE_BENCHMARK_RUN_WRITEBACK_CONTRACT_VERSION,
|
|
226
|
+
"benchmark_run_schema_version": "benchmark_run_v0",
|
|
227
|
+
"benchmark_run_json": benchmark_run_json,
|
|
228
|
+
"counter_trace_json": counter_trace_json,
|
|
229
|
+
"classification": classification,
|
|
230
|
+
"required_top_level_fields": list(
|
|
231
|
+
WORKER_BRIDGE_BENCHMARK_RUN_REQUIRED_TOP_LEVEL_FIELDS
|
|
232
|
+
),
|
|
233
|
+
"required_fixed_fields": dict(
|
|
234
|
+
WORKER_BRIDGE_BENCHMARK_RUN_REQUIRED_FIXED_FIELDS
|
|
235
|
+
),
|
|
236
|
+
"required_validation_flags": [
|
|
237
|
+
"validation_scope",
|
|
238
|
+
"bridge_connected",
|
|
239
|
+
"case_success_claimed",
|
|
240
|
+
"official_verifier_validation_present",
|
|
241
|
+
"worker_bridge_trace_observed",
|
|
242
|
+
"worker_cli_call_threshold_met",
|
|
243
|
+
"runner_return_completed_or_blocker_recorded",
|
|
244
|
+
"official_score_completed_or_not_claimed",
|
|
245
|
+
"no_leaderboard_upload_requested",
|
|
246
|
+
"paths_redacted",
|
|
247
|
+
"raw_trace_excluded",
|
|
248
|
+
"side_effect_audit_passed",
|
|
249
|
+
],
|
|
250
|
+
"validation_scope_contract": {
|
|
251
|
+
"field": "validation_scope",
|
|
252
|
+
"recommended_values": [
|
|
253
|
+
"worker_bridge_connectivity",
|
|
254
|
+
"environment_ready",
|
|
255
|
+
"worker_case_success",
|
|
256
|
+
"official_verifier_result",
|
|
257
|
+
],
|
|
258
|
+
"connectivity_is_not_case_success": True,
|
|
259
|
+
"legacy_unscoped_passed_validation_is_ambiguous": True,
|
|
260
|
+
},
|
|
261
|
+
"claim_boundary_required_fields": [
|
|
262
|
+
"bridge_connectivity_claim_allowed",
|
|
263
|
+
"case_success_claim_allowed",
|
|
264
|
+
"official_score_claim_allowed",
|
|
265
|
+
"leaderboard_claim_allowed",
|
|
266
|
+
"forbidden_claims",
|
|
267
|
+
],
|
|
268
|
+
"forbidden_public_fields": list(
|
|
269
|
+
WORKER_BRIDGE_BENCHMARK_RUN_FORBIDDEN_PUBLIC_FIELDS
|
|
270
|
+
),
|
|
271
|
+
"retry_policy": {
|
|
272
|
+
"on_append_benchmark_run_schema_rejected": (
|
|
273
|
+
"rewrite_minimal_benchmark_run_v0_and_retry_once"
|
|
274
|
+
),
|
|
275
|
+
"retry_payload_source": "compact_counters_only",
|
|
276
|
+
"do_not_retry_with_raw_logs_or_raw_paths": True,
|
|
277
|
+
},
|
|
278
|
+
"public_boundary": {
|
|
279
|
+
"no_upload": True,
|
|
280
|
+
"submit_eligible": False,
|
|
281
|
+
"leaderboard_evidence": False,
|
|
282
|
+
"raw_trace_excluded": True,
|
|
283
|
+
"raw_paths_redacted": True,
|
|
284
|
+
},
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
def _coerce_public_safe_worker_text(
|
|
289
|
+
value: str,
|
|
290
|
+
*,
|
|
291
|
+
field: str,
|
|
292
|
+
limit: int,
|
|
293
|
+
) -> str:
|
|
294
|
+
text = str(value or "").strip()
|
|
295
|
+
if not text:
|
|
296
|
+
raise ValueError(f"{field} is required")
|
|
297
|
+
leaked = [marker for marker in ACTIVE_USER_PUBLIC_TEXT_FORBIDDEN_MARKERS if marker in text]
|
|
298
|
+
if ACTIVE_USER_SECRET_KEY_SHAPED_RE.search(text):
|
|
299
|
+
leaked.append("sk-token-shaped")
|
|
300
|
+
if leaked:
|
|
301
|
+
raise ValueError(f"{field} contains a non-public marker")
|
|
302
|
+
return text[:limit].rstrip()
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def build_active_user_intervention_channel_contract(
|
|
306
|
+
*,
|
|
307
|
+
project_root: str = LOOPX_PROJECT_ROOT_PLACEHOLDER,
|
|
308
|
+
runtime_root: str = LOOPX_RUNTIME_ROOT_PLACEHOLDER,
|
|
309
|
+
python_bin: str = DEFAULT_WORKER_BRIDGE_PYTHON_BIN,
|
|
310
|
+
module: str = DEFAULT_WORKER_BRIDGE_MODULE,
|
|
311
|
+
feed_jsonl: str = DEFAULT_WORKER_BRIDGE_ACTIVE_USER_FEED_JSONL,
|
|
312
|
+
observation_json: str = DEFAULT_WORKER_BRIDGE_ACTIVE_USER_OBSERVATION_JSON,
|
|
313
|
+
benchmark_run_json: str = DEFAULT_WORKER_BRIDGE_BENCHMARK_RUN_JSON,
|
|
314
|
+
counter_trace_json: str = DEFAULT_WORKER_BRIDGE_COUNTER_TRACE_JSON,
|
|
315
|
+
classification: str = "active_user_observe_checkpoint",
|
|
316
|
+
min_interval_seconds: int = 300,
|
|
317
|
+
max_interventions_per_task: int = 3,
|
|
318
|
+
) -> dict[str, Any]:
|
|
319
|
+
"""Build the pull-based active-user update channel for a worker run."""
|
|
320
|
+
|
|
321
|
+
min_interval = _coerce_non_negative_int(
|
|
322
|
+
int(min_interval_seconds),
|
|
323
|
+
field="min_interval_seconds",
|
|
324
|
+
)
|
|
325
|
+
max_interventions = _coerce_non_negative_int(
|
|
326
|
+
int(max_interventions_per_task),
|
|
327
|
+
field="max_interventions_per_task",
|
|
328
|
+
)
|
|
329
|
+
if max_interventions <= 0:
|
|
330
|
+
raise ValueError("max_interventions_per_task must be greater than zero")
|
|
331
|
+
command_prefix = build_worker_bridge_command_prefix(
|
|
332
|
+
project_root=project_root,
|
|
333
|
+
python_bin=python_bin,
|
|
334
|
+
module=module,
|
|
335
|
+
)
|
|
336
|
+
observe_command = (
|
|
337
|
+
f"{command_prefix} worker-bridge active-user-observe "
|
|
338
|
+
f"--feed-jsonl {shlex.quote(feed_jsonl)} "
|
|
339
|
+
"--worker-start-seq <worker-start-seq> "
|
|
340
|
+
f"--observation-json {shlex.quote(observation_json)} "
|
|
341
|
+
f"--counter-trace-json {shlex.quote(counter_trace_json)} "
|
|
342
|
+
f"--benchmark-run-json {shlex.quote(benchmark_run_json)} "
|
|
343
|
+
f"--classification {shlex.quote(classification)} "
|
|
344
|
+
"--format json"
|
|
345
|
+
)
|
|
346
|
+
simulator_append_command = (
|
|
347
|
+
f"{command_prefix} worker-bridge active-user-intervention "
|
|
348
|
+
"--seq <next-seq> "
|
|
349
|
+
"--trigger public_progress_or_stall_signal "
|
|
350
|
+
"--message '<public-safe-user-message>' "
|
|
351
|
+
"--jsonl "
|
|
352
|
+
f">> {shlex.quote(feed_jsonl)}"
|
|
353
|
+
)
|
|
354
|
+
return {
|
|
355
|
+
"ok": True,
|
|
356
|
+
"schema_version": ACTIVE_USER_INTERVENTION_CHANNEL_CONTRACT_VERSION,
|
|
357
|
+
"bridge_surface": WORKER_BRIDGE_SURFACE,
|
|
358
|
+
"channel_surface": ACTIVE_USER_INTERVENTION_CHANNEL_SURFACE,
|
|
359
|
+
"mode": "audited_external_update_loop",
|
|
360
|
+
"feed_jsonl": feed_jsonl,
|
|
361
|
+
"observation_json": observation_json,
|
|
362
|
+
"benchmark_run_json": benchmark_run_json,
|
|
363
|
+
"counter_trace_json": counter_trace_json,
|
|
364
|
+
"worker_observe_command": observe_command,
|
|
365
|
+
"simulator_append_command": simulator_append_command,
|
|
366
|
+
"worker_start_marker": {
|
|
367
|
+
"kind": "worker_start_seq",
|
|
368
|
+
"proof_rule": "worker must observe an intervention with seq greater than worker_start_seq",
|
|
369
|
+
},
|
|
370
|
+
"frequency_budget": {
|
|
371
|
+
"min_interval_seconds": min_interval,
|
|
372
|
+
"max_interventions_per_task": max_interventions,
|
|
373
|
+
"simulator_may_be_proactive": True,
|
|
374
|
+
"artificial_mildness_required": False,
|
|
375
|
+
},
|
|
376
|
+
"visibility_policy": {
|
|
377
|
+
"simulator_may_read": [
|
|
378
|
+
"public task prompt visible to worker",
|
|
379
|
+
"worker public artifacts",
|
|
380
|
+
"compact LoopX status and run metadata",
|
|
381
|
+
],
|
|
382
|
+
"simulator_must_not_read": [
|
|
383
|
+
"hidden tests",
|
|
384
|
+
"expected solutions",
|
|
385
|
+
"benchmark answer keys",
|
|
386
|
+
"credentials",
|
|
387
|
+
"private project material",
|
|
388
|
+
],
|
|
389
|
+
},
|
|
390
|
+
"claim_boundary": {
|
|
391
|
+
"official_score_claim_allowed": False,
|
|
392
|
+
"leaderboard_claim_allowed": False,
|
|
393
|
+
"assisted_collaboration_claim_allowed": True,
|
|
394
|
+
"direct_codex_chat_injection": False,
|
|
395
|
+
"worker_pull_required": True,
|
|
396
|
+
},
|
|
397
|
+
"public_boundary": {
|
|
398
|
+
"raw_paths_recorded": False,
|
|
399
|
+
"raw_transcript_recorded": False,
|
|
400
|
+
"credential_values_recorded": False,
|
|
401
|
+
"no_upload": True,
|
|
402
|
+
},
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
def active_user_simulator_output_json_schema() -> dict[str, Any]:
|
|
407
|
+
"""Return the strict JSON shape expected from a Codex CLI user simulator."""
|
|
408
|
+
|
|
409
|
+
return {
|
|
410
|
+
"type": "object",
|
|
411
|
+
"additionalProperties": False,
|
|
412
|
+
"required": [
|
|
413
|
+
"schema_version",
|
|
414
|
+
"simulator_kind",
|
|
415
|
+
"trigger",
|
|
416
|
+
"message",
|
|
417
|
+
"visible_evidence_basis",
|
|
418
|
+
"no_oracle_audit",
|
|
419
|
+
"controller_authored_message",
|
|
420
|
+
],
|
|
421
|
+
"properties": {
|
|
422
|
+
"schema_version": {
|
|
423
|
+
"type": "string",
|
|
424
|
+
"const": ACTIVE_USER_SIMULATOR_OUTPUT_VERSION,
|
|
425
|
+
},
|
|
426
|
+
"simulator_kind": {"type": "string", "const": "codex_cli"},
|
|
427
|
+
"trigger": {"type": "string", "minLength": 1, "maxLength": 120},
|
|
428
|
+
"message": {"type": "string", "minLength": 1, "maxLength": 500},
|
|
429
|
+
"visible_evidence_basis": {
|
|
430
|
+
"type": "array",
|
|
431
|
+
"minItems": 1,
|
|
432
|
+
"items": {
|
|
433
|
+
"type": "string",
|
|
434
|
+
"enum": list(ACTIVE_USER_SIMULATOR_ALLOWED_EVIDENCE_BASIS),
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
"no_oracle_audit": {
|
|
438
|
+
"type": "object",
|
|
439
|
+
"additionalProperties": False,
|
|
440
|
+
"required": list(ACTIVE_USER_SIMULATOR_NO_ORACLE_AUDIT_KEYS),
|
|
441
|
+
"properties": {
|
|
442
|
+
key: {"type": "boolean", "const": False}
|
|
443
|
+
for key in ACTIVE_USER_SIMULATOR_NO_ORACLE_AUDIT_KEYS
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
"controller_authored_message": {"type": "boolean", "const": False},
|
|
447
|
+
},
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
def build_active_user_codex_simulator_contract(
|
|
452
|
+
*,
|
|
453
|
+
project_root: str = LOOPX_PROJECT_ROOT_PLACEHOLDER,
|
|
454
|
+
python_bin: str = DEFAULT_WORKER_BRIDGE_PYTHON_BIN,
|
|
455
|
+
module: str = DEFAULT_WORKER_BRIDGE_MODULE,
|
|
456
|
+
codex_bin: str = DEFAULT_ACTIVE_USER_CODEX_BIN,
|
|
457
|
+
context_dir: str = DEFAULT_ACTIVE_USER_SIMULATOR_CONTEXT_DIR,
|
|
458
|
+
prompt_json: str = DEFAULT_ACTIVE_USER_SIMULATOR_PROMPT_JSON,
|
|
459
|
+
simulator_output_json: str = DEFAULT_ACTIVE_USER_SIMULATOR_OUTPUT_JSON,
|
|
460
|
+
simulator_output_schema_json: str = DEFAULT_ACTIVE_USER_SIMULATOR_OUTPUT_SCHEMA_JSON,
|
|
461
|
+
feed_jsonl: str = DEFAULT_WORKER_BRIDGE_ACTIVE_USER_FEED_JSONL,
|
|
462
|
+
) -> dict[str, Any]:
|
|
463
|
+
"""Build the model-backed active-user simulator launch contract.
|
|
464
|
+
|
|
465
|
+
The formal treatment path uses this contract instead of controller-written
|
|
466
|
+
feed messages: a separate Codex CLI run reads only public context, writes a
|
|
467
|
+
bounded JSON object, and LoopX validates it before appending to the
|
|
468
|
+
worker-visible feed.
|
|
469
|
+
"""
|
|
470
|
+
|
|
471
|
+
safe_codex_bin = shlex.quote(codex_bin)
|
|
472
|
+
safe_context_dir = shlex.quote(context_dir)
|
|
473
|
+
safe_schema_json = shlex.quote(simulator_output_schema_json)
|
|
474
|
+
safe_output_json = shlex.quote(simulator_output_json)
|
|
475
|
+
safe_prompt_json = shlex.quote(prompt_json)
|
|
476
|
+
command_prefix = build_worker_bridge_command_prefix(
|
|
477
|
+
project_root=project_root,
|
|
478
|
+
python_bin=python_bin,
|
|
479
|
+
module=module,
|
|
480
|
+
)
|
|
481
|
+
codex_exec_command = (
|
|
482
|
+
f"{safe_codex_bin} exec "
|
|
483
|
+
f"--cd {safe_context_dir} "
|
|
484
|
+
"--sandbox read-only "
|
|
485
|
+
"--ask-for-approval never "
|
|
486
|
+
"--ephemeral "
|
|
487
|
+
f"--output-schema {safe_schema_json} "
|
|
488
|
+
f"--output-last-message {safe_output_json} "
|
|
489
|
+
f"- < {safe_prompt_json}"
|
|
490
|
+
)
|
|
491
|
+
append_validated_output_command = (
|
|
492
|
+
f"{command_prefix} worker-bridge active-user-simulator-output "
|
|
493
|
+
"--seq <next-seq> "
|
|
494
|
+
f"--simulator-output-json {safe_output_json} "
|
|
495
|
+
"--jsonl "
|
|
496
|
+
f">> {shlex.quote(feed_jsonl)}"
|
|
497
|
+
)
|
|
498
|
+
return {
|
|
499
|
+
"ok": True,
|
|
500
|
+
"schema_version": ACTIVE_USER_CODEX_SIMULATOR_CONTRACT_VERSION,
|
|
501
|
+
"bridge_surface": WORKER_BRIDGE_SURFACE,
|
|
502
|
+
"channel_surface": ACTIVE_USER_INTERVENTION_CHANNEL_SURFACE,
|
|
503
|
+
"simulator_kind": "codex_cli",
|
|
504
|
+
"formal_treatment_requires_model_backed_simulator": True,
|
|
505
|
+
"manual_controller_feed_allowed": False,
|
|
506
|
+
"codex_cli": {
|
|
507
|
+
"codex_bin": codex_bin,
|
|
508
|
+
"exec_command": codex_exec_command,
|
|
509
|
+
"sandbox": "read-only",
|
|
510
|
+
"approval_policy": "never",
|
|
511
|
+
"ephemeral": True,
|
|
512
|
+
},
|
|
513
|
+
"simulator_input_contract": {
|
|
514
|
+
"prompt_json": prompt_json,
|
|
515
|
+
"context_dir": context_dir,
|
|
516
|
+
"allowed_context": list(ACTIVE_USER_SIMULATOR_ALLOWED_EVIDENCE_BASIS),
|
|
517
|
+
"must_not_include": [
|
|
518
|
+
"hidden tests",
|
|
519
|
+
"expected solutions",
|
|
520
|
+
"benchmark answer keys",
|
|
521
|
+
"credentials",
|
|
522
|
+
"private project material",
|
|
523
|
+
"controller-authored intervention text",
|
|
524
|
+
],
|
|
525
|
+
},
|
|
526
|
+
"simulator_output_contract": {
|
|
527
|
+
"schema_version": ACTIVE_USER_SIMULATOR_OUTPUT_VERSION,
|
|
528
|
+
"output_json": simulator_output_json,
|
|
529
|
+
"output_schema_json": simulator_output_schema_json,
|
|
530
|
+
"json_schema": active_user_simulator_output_json_schema(),
|
|
531
|
+
},
|
|
532
|
+
"append_validated_output_command": append_validated_output_command,
|
|
533
|
+
"claim_boundary": {
|
|
534
|
+
"official_score_claim_allowed": False,
|
|
535
|
+
"leaderboard_claim_allowed": False,
|
|
536
|
+
"assisted_collaboration_claim_allowed": True,
|
|
537
|
+
"direct_codex_chat_injection": False,
|
|
538
|
+
"worker_pull_required": True,
|
|
539
|
+
"controller_authored_feed_allowed": False,
|
|
540
|
+
},
|
|
541
|
+
"public_boundary": {
|
|
542
|
+
"raw_paths_recorded": False,
|
|
543
|
+
"raw_transcript_recorded": False,
|
|
544
|
+
"credential_values_recorded": False,
|
|
545
|
+
"no_upload": True,
|
|
546
|
+
},
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
def build_active_user_intervention_from_simulator_output(
|
|
551
|
+
*,
|
|
552
|
+
seq: int,
|
|
553
|
+
simulator_output: dict[str, Any],
|
|
554
|
+
created_after_worker_start: bool = True,
|
|
555
|
+
) -> dict[str, Any]:
|
|
556
|
+
"""Validate a Codex CLI simulator output and convert it to feed JSON."""
|
|
557
|
+
|
|
558
|
+
if not isinstance(simulator_output, dict):
|
|
559
|
+
raise ValueError("simulator_output must be a JSON object")
|
|
560
|
+
allowed_top_level_keys = {
|
|
561
|
+
"schema_version",
|
|
562
|
+
"simulator_kind",
|
|
563
|
+
"trigger",
|
|
564
|
+
"message",
|
|
565
|
+
"visible_evidence_basis",
|
|
566
|
+
"no_oracle_audit",
|
|
567
|
+
"controller_authored_message",
|
|
568
|
+
}
|
|
569
|
+
extra_top_level_keys = [
|
|
570
|
+
key for key in simulator_output if key not in allowed_top_level_keys
|
|
571
|
+
]
|
|
572
|
+
if extra_top_level_keys:
|
|
573
|
+
raise ValueError("simulator_output contains unsupported fields")
|
|
574
|
+
if simulator_output.get("schema_version") != ACTIVE_USER_SIMULATOR_OUTPUT_VERSION:
|
|
575
|
+
raise ValueError(
|
|
576
|
+
"simulator_output must have "
|
|
577
|
+
f"schema_version={ACTIVE_USER_SIMULATOR_OUTPUT_VERSION}"
|
|
578
|
+
)
|
|
579
|
+
if simulator_output.get("simulator_kind") != "codex_cli":
|
|
580
|
+
raise ValueError("simulator_output must have simulator_kind=codex_cli")
|
|
581
|
+
if simulator_output.get("controller_authored_message") is not False:
|
|
582
|
+
raise ValueError("simulator_output must not be controller-authored")
|
|
583
|
+
|
|
584
|
+
evidence_basis = simulator_output.get("visible_evidence_basis")
|
|
585
|
+
if not isinstance(evidence_basis, list) or not evidence_basis:
|
|
586
|
+
raise ValueError("visible_evidence_basis must be a non-empty list")
|
|
587
|
+
evidence_basis_text = [
|
|
588
|
+
_coerce_public_safe_worker_text(str(item), field="visible_evidence_basis", limit=120)
|
|
589
|
+
for item in evidence_basis
|
|
590
|
+
]
|
|
591
|
+
invalid_basis = [
|
|
592
|
+
item
|
|
593
|
+
for item in evidence_basis_text
|
|
594
|
+
if item not in ACTIVE_USER_SIMULATOR_ALLOWED_EVIDENCE_BASIS
|
|
595
|
+
]
|
|
596
|
+
if invalid_basis:
|
|
597
|
+
raise ValueError("visible_evidence_basis contains non-public or unsupported evidence")
|
|
598
|
+
|
|
599
|
+
audit = simulator_output.get("no_oracle_audit")
|
|
600
|
+
if not isinstance(audit, dict):
|
|
601
|
+
raise ValueError("no_oracle_audit must be an object")
|
|
602
|
+
extra_audit_keys = [
|
|
603
|
+
key for key in audit if key not in ACTIVE_USER_SIMULATOR_NO_ORACLE_AUDIT_KEYS
|
|
604
|
+
]
|
|
605
|
+
if extra_audit_keys:
|
|
606
|
+
raise ValueError("no_oracle_audit contains unsupported fields")
|
|
607
|
+
missing_audit_keys = [
|
|
608
|
+
key for key in ACTIVE_USER_SIMULATOR_NO_ORACLE_AUDIT_KEYS if key not in audit
|
|
609
|
+
]
|
|
610
|
+
if missing_audit_keys:
|
|
611
|
+
raise ValueError("no_oracle_audit is missing required keys")
|
|
612
|
+
leaked_audit_keys = [
|
|
613
|
+
key for key in ACTIVE_USER_SIMULATOR_NO_ORACLE_AUDIT_KEYS if audit.get(key) is not False
|
|
614
|
+
]
|
|
615
|
+
if leaked_audit_keys:
|
|
616
|
+
raise ValueError("simulator_output failed no-oracle audit")
|
|
617
|
+
|
|
618
|
+
intervention = build_active_user_intervention(
|
|
619
|
+
seq=seq,
|
|
620
|
+
message=str(simulator_output.get("message") or ""),
|
|
621
|
+
trigger=str(simulator_output.get("trigger") or "codex_cli_simulator_public_guidance"),
|
|
622
|
+
channel="codex_cli_user_simulator",
|
|
623
|
+
created_after_worker_start=created_after_worker_start,
|
|
624
|
+
)
|
|
625
|
+
intervention.update(
|
|
626
|
+
{
|
|
627
|
+
"simulator_kind": "codex_cli",
|
|
628
|
+
"simulator_output_schema_version": ACTIVE_USER_SIMULATOR_OUTPUT_VERSION,
|
|
629
|
+
"controller_authored_message": False,
|
|
630
|
+
"formal_treatment_eligible": True,
|
|
631
|
+
"manual_controller_feed": False,
|
|
632
|
+
"visible_evidence_basis": evidence_basis_text,
|
|
633
|
+
"no_oracle_audit": {
|
|
634
|
+
key: False for key in ACTIVE_USER_SIMULATOR_NO_ORACLE_AUDIT_KEYS
|
|
635
|
+
},
|
|
636
|
+
}
|
|
637
|
+
)
|
|
638
|
+
return intervention
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
def build_active_user_intervention(
|
|
642
|
+
*,
|
|
643
|
+
seq: int,
|
|
644
|
+
message: str,
|
|
645
|
+
trigger: str = "public_progress_or_stall_signal",
|
|
646
|
+
channel: str = "simulator_proactive_user_message",
|
|
647
|
+
created_after_worker_start: bool = True,
|
|
648
|
+
) -> dict[str, Any]:
|
|
649
|
+
"""Build one public-safe active-user intervention event."""
|
|
650
|
+
|
|
651
|
+
intervention_seq = _coerce_non_negative_int(seq, field="seq")
|
|
652
|
+
safe_message = _coerce_public_safe_worker_text(
|
|
653
|
+
message,
|
|
654
|
+
field="message",
|
|
655
|
+
limit=500,
|
|
656
|
+
)
|
|
657
|
+
safe_trigger = _coerce_public_safe_worker_text(
|
|
658
|
+
trigger,
|
|
659
|
+
field="trigger",
|
|
660
|
+
limit=120,
|
|
661
|
+
)
|
|
662
|
+
safe_channel = _coerce_public_safe_worker_text(
|
|
663
|
+
channel,
|
|
664
|
+
field="channel",
|
|
665
|
+
limit=120,
|
|
666
|
+
)
|
|
667
|
+
return {
|
|
668
|
+
"ok": True,
|
|
669
|
+
"schema_version": ACTIVE_USER_INTERVENTION_EVENT_VERSION,
|
|
670
|
+
"channel_surface": ACTIVE_USER_INTERVENTION_CHANNEL_SURFACE,
|
|
671
|
+
"seq": intervention_seq,
|
|
672
|
+
"channel": safe_channel,
|
|
673
|
+
"type": "active_user_instruction",
|
|
674
|
+
"trigger": safe_trigger,
|
|
675
|
+
"message": safe_message,
|
|
676
|
+
"created_after_worker_start": bool(created_after_worker_start),
|
|
677
|
+
"oracle_free": True,
|
|
678
|
+
"hidden_tests_visible": False,
|
|
679
|
+
"expected_solution_visible": False,
|
|
680
|
+
"credential_values_visible": False,
|
|
681
|
+
"private_material_visible": False,
|
|
682
|
+
"official_score_claim_allowed": False,
|
|
683
|
+
"leaderboard_claim_allowed": False,
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
def observe_active_user_intervention_feed(
|
|
688
|
+
feed_jsonl: str | Path,
|
|
689
|
+
*,
|
|
690
|
+
worker_start_seq: int = 0,
|
|
691
|
+
) -> dict[str, Any]:
|
|
692
|
+
"""Read a public-safe intervention feed and summarize worker-observable updates."""
|
|
693
|
+
|
|
694
|
+
start_seq = _coerce_non_negative_int(worker_start_seq, field="worker_start_seq")
|
|
695
|
+
feed_path = Path(feed_jsonl)
|
|
696
|
+
valid_events: list[dict[str, Any]] = []
|
|
697
|
+
invalid_line_count = 0
|
|
698
|
+
if feed_path.exists():
|
|
699
|
+
for line in feed_path.read_text(encoding="utf-8").splitlines():
|
|
700
|
+
if not line.strip():
|
|
701
|
+
continue
|
|
702
|
+
try:
|
|
703
|
+
item = json.loads(line)
|
|
704
|
+
except json.JSONDecodeError:
|
|
705
|
+
invalid_line_count += 1
|
|
706
|
+
continue
|
|
707
|
+
if not isinstance(item, dict):
|
|
708
|
+
invalid_line_count += 1
|
|
709
|
+
continue
|
|
710
|
+
if item.get("schema_version") != ACTIVE_USER_INTERVENTION_EVENT_VERSION:
|
|
711
|
+
invalid_line_count += 1
|
|
712
|
+
continue
|
|
713
|
+
seq = item.get("seq")
|
|
714
|
+
if isinstance(seq, bool) or not isinstance(seq, int) or seq < 0:
|
|
715
|
+
invalid_line_count += 1
|
|
716
|
+
continue
|
|
717
|
+
valid_events.append(item)
|
|
718
|
+
observable = [
|
|
719
|
+
item
|
|
720
|
+
for item in valid_events
|
|
721
|
+
if item.get("seq", -1) > start_seq and item.get("created_after_worker_start") is True
|
|
722
|
+
]
|
|
723
|
+
latest = max(observable, key=lambda item: item["seq"], default=None)
|
|
724
|
+
latest_summary: dict[str, Any] = {}
|
|
725
|
+
if latest:
|
|
726
|
+
latest_summary = {
|
|
727
|
+
"seq": latest.get("seq"),
|
|
728
|
+
"channel": latest.get("channel"),
|
|
729
|
+
"type": latest.get("type"),
|
|
730
|
+
"trigger": latest.get("trigger"),
|
|
731
|
+
"message": latest.get("message"),
|
|
732
|
+
"oracle_free": latest.get("oracle_free") is True,
|
|
733
|
+
"hidden_tests_visible": latest.get("hidden_tests_visible") is True,
|
|
734
|
+
"expected_solution_visible": latest.get("expected_solution_visible") is True,
|
|
735
|
+
"credential_values_visible": latest.get("credential_values_visible") is True,
|
|
736
|
+
"private_material_visible": latest.get("private_material_visible") is True,
|
|
737
|
+
"simulator_kind": latest.get("simulator_kind"),
|
|
738
|
+
"formal_treatment_eligible": latest.get("formal_treatment_eligible") is True,
|
|
739
|
+
"manual_controller_feed": latest.get("manual_controller_feed") is True,
|
|
740
|
+
"controller_authored_message": latest.get("controller_authored_message") is True,
|
|
741
|
+
}
|
|
742
|
+
return {
|
|
743
|
+
"ok": True,
|
|
744
|
+
"schema_version": ACTIVE_USER_INTERVENTION_OBSERVATION_VERSION,
|
|
745
|
+
"bridge_surface": WORKER_BRIDGE_SURFACE,
|
|
746
|
+
"channel_surface": ACTIVE_USER_INTERVENTION_CHANNEL_SURFACE,
|
|
747
|
+
"feed_present": feed_path.exists(),
|
|
748
|
+
"feed_path_recorded": False,
|
|
749
|
+
"worker_start_seq": start_seq,
|
|
750
|
+
"valid_intervention_count": len(valid_events),
|
|
751
|
+
"invalid_line_count": invalid_line_count,
|
|
752
|
+
"observed_after_worker_start": bool(latest),
|
|
753
|
+
"observed_intervention_count": len(observable),
|
|
754
|
+
"latest_intervention": latest_summary,
|
|
755
|
+
"worker_observation_proof": bool(latest),
|
|
756
|
+
"claim_boundary": {
|
|
757
|
+
"official_score_claim_allowed": False,
|
|
758
|
+
"leaderboard_claim_allowed": False,
|
|
759
|
+
"assisted_collaboration_claim_allowed": bool(latest),
|
|
760
|
+
"direct_codex_chat_injection": False,
|
|
761
|
+
"worker_pull_channel": True,
|
|
762
|
+
},
|
|
763
|
+
"public_boundary": {
|
|
764
|
+
"raw_paths_recorded": False,
|
|
765
|
+
"raw_transcript_recorded": False,
|
|
766
|
+
"credential_values_recorded": False,
|
|
767
|
+
},
|
|
768
|
+
"next_action": (
|
|
769
|
+
"wire the worker prompt to poll active-user-observe during assisted treatment"
|
|
770
|
+
if latest
|
|
771
|
+
else "append a public-safe simulator intervention after worker start and poll again"
|
|
772
|
+
),
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
def write_active_user_observation_file(
|
|
777
|
+
path: str | Path | None,
|
|
778
|
+
payload: dict[str, Any],
|
|
779
|
+
) -> bool:
|
|
780
|
+
"""Write compact active-user observation without exposing raw path values."""
|
|
781
|
+
|
|
782
|
+
if not path:
|
|
783
|
+
return False
|
|
784
|
+
output_path = Path(path)
|
|
785
|
+
try:
|
|
786
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
787
|
+
output_path.write_text(
|
|
788
|
+
json.dumps(payload, ensure_ascii=True, sort_keys=True, indent=2) + "\n",
|
|
789
|
+
encoding="utf-8",
|
|
790
|
+
)
|
|
791
|
+
except OSError:
|
|
792
|
+
return False
|
|
793
|
+
return True
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
def _compact_counter_trace_label(value: Any) -> str:
|
|
797
|
+
return str(value or "").strip().lower().replace("-", "_")
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
def append_worker_bridge_counter_trace_row(
|
|
801
|
+
path: str | Path | None,
|
|
802
|
+
*,
|
|
803
|
+
command: str,
|
|
804
|
+
ok: bool,
|
|
805
|
+
goal_id: str,
|
|
806
|
+
mode: str,
|
|
807
|
+
classification: str,
|
|
808
|
+
observed_after_worker_start: bool | None = None,
|
|
809
|
+
worker_observation_proof: bool | None = None,
|
|
810
|
+
) -> bool:
|
|
811
|
+
"""Append one compact worker-side LoopX CLI call trace row."""
|
|
812
|
+
|
|
813
|
+
if not path:
|
|
814
|
+
return False
|
|
815
|
+
trace_path = Path(path)
|
|
816
|
+
row: dict[str, Any] = {
|
|
817
|
+
"kind": "loopx_cli_call",
|
|
818
|
+
"command": _compact_counter_trace_label(command),
|
|
819
|
+
"ok": bool(ok),
|
|
820
|
+
"goal_id": str(goal_id or "").strip() or "worker-bridge",
|
|
821
|
+
"mode": str(mode or "").strip() or DEFAULT_WORKER_BRIDGE_MODE,
|
|
822
|
+
"classification": (
|
|
823
|
+
str(classification or "").strip() or "worker_bridge_checkpoint"
|
|
824
|
+
),
|
|
825
|
+
}
|
|
826
|
+
if observed_after_worker_start is not None:
|
|
827
|
+
row["observed_after_worker_start"] = bool(observed_after_worker_start)
|
|
828
|
+
if worker_observation_proof is not None:
|
|
829
|
+
row["worker_observation_proof"] = bool(worker_observation_proof)
|
|
830
|
+
try:
|
|
831
|
+
trace_path.parent.mkdir(parents=True, exist_ok=True)
|
|
832
|
+
with trace_path.open("a", encoding="utf-8") as handle:
|
|
833
|
+
handle.write(json.dumps(row, ensure_ascii=True, sort_keys=True) + "\n")
|
|
834
|
+
except OSError:
|
|
835
|
+
return False
|
|
836
|
+
return True
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
def load_worker_bridge_counter_trace_file(path: str | Path | None) -> list[dict[str, Any]]:
|
|
840
|
+
"""Load compact worker-side counter trace rows, ignoring malformed rows."""
|
|
841
|
+
|
|
842
|
+
if not path:
|
|
843
|
+
return []
|
|
844
|
+
trace_path = Path(path)
|
|
845
|
+
if not trace_path.exists():
|
|
846
|
+
return []
|
|
847
|
+
rows: list[dict[str, Any]] = []
|
|
848
|
+
try:
|
|
849
|
+
for line in trace_path.read_text(encoding="utf-8").splitlines():
|
|
850
|
+
text = line.strip()
|
|
851
|
+
if not text:
|
|
852
|
+
continue
|
|
853
|
+
try:
|
|
854
|
+
row = json.loads(text)
|
|
855
|
+
except json.JSONDecodeError:
|
|
856
|
+
continue
|
|
857
|
+
if isinstance(row, dict):
|
|
858
|
+
rows.append(row)
|
|
859
|
+
except OSError:
|
|
860
|
+
return []
|
|
861
|
+
return rows
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
def build_worker_bridge_interaction_counters_from_trace(
|
|
865
|
+
trace_rows: list[dict[str, Any]] | None,
|
|
866
|
+
) -> dict[str, Any]:
|
|
867
|
+
"""Build generic compact interaction counters from worker bridge trace rows."""
|
|
868
|
+
|
|
869
|
+
loopx_cli_calls: dict[str, int] = {}
|
|
870
|
+
total = 0
|
|
871
|
+
for row in trace_rows or []:
|
|
872
|
+
if not isinstance(row, dict):
|
|
873
|
+
continue
|
|
874
|
+
kind = _compact_counter_trace_label(
|
|
875
|
+
row.get("kind") or row.get("type") or row.get("event")
|
|
876
|
+
)
|
|
877
|
+
command = _compact_counter_trace_label(row.get("command") or row.get("call"))
|
|
878
|
+
if kind and kind != "loopx_cli_call":
|
|
879
|
+
continue
|
|
880
|
+
if not command:
|
|
881
|
+
continue
|
|
882
|
+
total += 1
|
|
883
|
+
loopx_cli_calls[command] = loopx_cli_calls.get(command, 0) + 1
|
|
884
|
+
loopx_cli_calls["total"] = total
|
|
885
|
+
return {
|
|
886
|
+
"schema_version": "loopx_worker_bridge_interaction_counters_v0",
|
|
887
|
+
"loopx_cli_calls": loopx_cli_calls,
|
|
888
|
+
"trace_row_count": len(trace_rows or []),
|
|
889
|
+
"state_reads": loopx_cli_calls.get("active_user_observe", 0),
|
|
890
|
+
"state_writes": loopx_cli_calls.get("append_benchmark_run", 0),
|
|
891
|
+
"raw_trace_recorded": False,
|
|
892
|
+
"raw_paths_recorded": False,
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
def build_worker_bridge_install_contract(
|
|
897
|
+
*,
|
|
898
|
+
project_root: str = LOOPX_PROJECT_ROOT_PLACEHOLDER,
|
|
899
|
+
runtime_root: str = LOOPX_RUNTIME_ROOT_PLACEHOLDER,
|
|
900
|
+
python_bin: str = DEFAULT_WORKER_BRIDGE_PYTHON_BIN,
|
|
901
|
+
module: str = DEFAULT_WORKER_BRIDGE_MODULE,
|
|
902
|
+
scan_path: str | None = None,
|
|
903
|
+
benchmark_run_json: str = DEFAULT_WORKER_BRIDGE_BENCHMARK_RUN_JSON,
|
|
904
|
+
counter_trace_json: str = DEFAULT_WORKER_BRIDGE_COUNTER_TRACE_JSON,
|
|
905
|
+
classification: str = "<classification>",
|
|
906
|
+
active_user_host_dir: str | None = None,
|
|
907
|
+
active_user_mount_target: str = DEFAULT_WORKER_BRIDGE_ACTIVE_USER_MOUNT_TARGET,
|
|
908
|
+
) -> dict[str, Any]:
|
|
909
|
+
"""Build a runner-agnostic worker bridge/install contract.
|
|
910
|
+
|
|
911
|
+
The contract is intentionally declarative. A benchmark runner can translate
|
|
912
|
+
`mounts` and `agent_kwargs` into its own container or worker launch surface.
|
|
913
|
+
"""
|
|
914
|
+
|
|
915
|
+
registry_arg = f"{runtime_root}/registry.global.json"
|
|
916
|
+
scan_path_arg = scan_path or f"{project_root}/loopx/benchmark.py"
|
|
917
|
+
command_prefix = build_worker_bridge_command_prefix(
|
|
918
|
+
project_root=project_root,
|
|
919
|
+
python_bin=python_bin,
|
|
920
|
+
module=module,
|
|
921
|
+
)
|
|
922
|
+
runtime_preflight_command = build_worker_bridge_python_runtime_preflight_command(
|
|
923
|
+
project_root=project_root,
|
|
924
|
+
python_bin=python_bin,
|
|
925
|
+
module=module,
|
|
926
|
+
)
|
|
927
|
+
active_user_feed_jsonl = DEFAULT_WORKER_BRIDGE_ACTIVE_USER_FEED_JSONL
|
|
928
|
+
active_user_observation_json = DEFAULT_WORKER_BRIDGE_ACTIVE_USER_OBSERVATION_JSON
|
|
929
|
+
if active_user_host_dir:
|
|
930
|
+
mount_target = active_user_mount_target.rstrip("/")
|
|
931
|
+
active_user_feed_jsonl = f"{mount_target}/loopx-active-user-interventions.jsonl"
|
|
932
|
+
active_user_observation_json = f"{mount_target}/loopx-active-user-observation.json"
|
|
933
|
+
benchmark_run_writeback_contract = (
|
|
934
|
+
build_worker_bridge_benchmark_run_writeback_contract(
|
|
935
|
+
benchmark_run_json=benchmark_run_json,
|
|
936
|
+
counter_trace_json=counter_trace_json,
|
|
937
|
+
classification=classification,
|
|
938
|
+
)
|
|
939
|
+
)
|
|
940
|
+
active_user_intervention_channel_contract = (
|
|
941
|
+
build_active_user_intervention_channel_contract(
|
|
942
|
+
project_root=project_root,
|
|
943
|
+
runtime_root=runtime_root,
|
|
944
|
+
python_bin=python_bin,
|
|
945
|
+
module=module,
|
|
946
|
+
feed_jsonl=active_user_feed_jsonl,
|
|
947
|
+
observation_json=active_user_observation_json,
|
|
948
|
+
benchmark_run_json=benchmark_run_json,
|
|
949
|
+
counter_trace_json=counter_trace_json,
|
|
950
|
+
classification=classification,
|
|
951
|
+
)
|
|
952
|
+
)
|
|
953
|
+
return {
|
|
954
|
+
"ok": True,
|
|
955
|
+
"schema_version": WORKER_BRIDGE_INSTALL_CONTRACT_VERSION,
|
|
956
|
+
"bridge_surface": WORKER_BRIDGE_SURFACE,
|
|
957
|
+
"install_mode": "source_mount_read_only_pythonpath",
|
|
958
|
+
"runtime_policy": WORKER_BRIDGE_PYTHON_RUNTIME_POLICY,
|
|
959
|
+
"runtime_preflight_command": runtime_preflight_command,
|
|
960
|
+
"project_root": project_root,
|
|
961
|
+
"runtime_root": runtime_root,
|
|
962
|
+
"mounts": build_worker_bridge_mounts(
|
|
963
|
+
project_root=project_root,
|
|
964
|
+
runtime_root=runtime_root,
|
|
965
|
+
active_user_host_dir=active_user_host_dir,
|
|
966
|
+
active_user_mount_target=active_user_mount_target,
|
|
967
|
+
),
|
|
968
|
+
"active_user_external_update_mount": {
|
|
969
|
+
"enabled": bool(active_user_host_dir),
|
|
970
|
+
"target": active_user_mount_target if active_user_host_dir else None,
|
|
971
|
+
"read_only": False if active_user_host_dir else None,
|
|
972
|
+
"raw_host_path_recorded": False,
|
|
973
|
+
},
|
|
974
|
+
"command_prefix": command_prefix,
|
|
975
|
+
"agent_kwargs": {
|
|
976
|
+
"loopx_command_prefix": command_prefix,
|
|
977
|
+
"loopx_runtime_preflight_command": runtime_preflight_command,
|
|
978
|
+
"loopx_registry_arg": registry_arg,
|
|
979
|
+
"loopx_runtime_root_arg": runtime_root,
|
|
980
|
+
"loopx_scan_path": scan_path_arg,
|
|
981
|
+
"loopx_benchmark_run_json": benchmark_run_json,
|
|
982
|
+
"loopx_benchmark_run_schema_version": "benchmark_run_v0",
|
|
983
|
+
"loopx_benchmark_run_writeback_contract": (
|
|
984
|
+
WORKER_BRIDGE_BENCHMARK_RUN_WRITEBACK_CONTRACT_VERSION
|
|
985
|
+
),
|
|
986
|
+
"loopx_counter_trace_json": counter_trace_json,
|
|
987
|
+
"loopx_classification": classification,
|
|
988
|
+
"loopx_active_user_feed_jsonl": (
|
|
989
|
+
active_user_intervention_channel_contract["feed_jsonl"]
|
|
990
|
+
),
|
|
991
|
+
"loopx_active_user_observation_json": (
|
|
992
|
+
active_user_intervention_channel_contract["observation_json"]
|
|
993
|
+
),
|
|
994
|
+
"loopx_active_user_observe_command": (
|
|
995
|
+
active_user_intervention_channel_contract["worker_observe_command"]
|
|
996
|
+
),
|
|
997
|
+
"loopx_active_user_channel_surface": (
|
|
998
|
+
ACTIVE_USER_INTERVENTION_CHANNEL_SURFACE
|
|
999
|
+
),
|
|
1000
|
+
},
|
|
1001
|
+
"benchmark_run_writeback_contract": benchmark_run_writeback_contract,
|
|
1002
|
+
"active_user_intervention_channel_contract": (
|
|
1003
|
+
active_user_intervention_channel_contract
|
|
1004
|
+
),
|
|
1005
|
+
"trace": {
|
|
1006
|
+
"counter_trace_json": counter_trace_json,
|
|
1007
|
+
"benchmark_run_json": benchmark_run_json,
|
|
1008
|
+
"active_user_feed_jsonl": active_user_intervention_channel_contract[
|
|
1009
|
+
"feed_jsonl"
|
|
1010
|
+
],
|
|
1011
|
+
"active_user_observation_json": active_user_intervention_channel_contract[
|
|
1012
|
+
"observation_json"
|
|
1013
|
+
],
|
|
1014
|
+
"write_surface": "worker_agent_logs",
|
|
1015
|
+
"raw_trace_public": False,
|
|
1016
|
+
},
|
|
1017
|
+
"boundary": {
|
|
1018
|
+
"real_run": False,
|
|
1019
|
+
"submit_eligible": False,
|
|
1020
|
+
"no_upload": True,
|
|
1021
|
+
"credential_values_recorded": False,
|
|
1022
|
+
"raw_paths_required_in_public_artifacts": False,
|
|
1023
|
+
},
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
def _coerce_non_negative_int(value: int, *, field: str) -> int:
|
|
1028
|
+
if isinstance(value, bool) or not isinstance(value, int) or value < 0:
|
|
1029
|
+
raise ValueError(f"{field} must be a non-negative integer")
|
|
1030
|
+
return value
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
def _coerce_optional_non_negative_float(
|
|
1034
|
+
value: int | float | None,
|
|
1035
|
+
*,
|
|
1036
|
+
field: str,
|
|
1037
|
+
) -> float | None:
|
|
1038
|
+
if value is None:
|
|
1039
|
+
return None
|
|
1040
|
+
if isinstance(value, bool) or not isinstance(value, (int, float)) or value < 0:
|
|
1041
|
+
raise ValueError(f"{field} must be a non-negative number")
|
|
1042
|
+
return float(value)
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
def build_worker_bridge_outcome(
|
|
1046
|
+
*,
|
|
1047
|
+
worker_loopx_cli_call_total: int = 0,
|
|
1048
|
+
counter_trace_present: bool = False,
|
|
1049
|
+
runner_return_completed: bool = False,
|
|
1050
|
+
official_score_completed: bool = False,
|
|
1051
|
+
official_score_value: int | float | None = None,
|
|
1052
|
+
interrupted: bool = False,
|
|
1053
|
+
interrupt_reason: str = "",
|
|
1054
|
+
wall_time_seconds: int | float | None = None,
|
|
1055
|
+
wall_time_limit_seconds: int | float = DEFAULT_WORKER_BRIDGE_WALL_TIME_LIMIT_SECONDS,
|
|
1056
|
+
required_worker_loopx_cli_call_total_min: int = DEFAULT_WORKER_BRIDGE_CLI_CALL_MINIMUM,
|
|
1057
|
+
side_effect_audit_passed: bool = True,
|
|
1058
|
+
) -> dict[str, Any]:
|
|
1059
|
+
"""Summarize worker bridge evidence and runner-return state.
|
|
1060
|
+
|
|
1061
|
+
The outcome is public-safe by construction: it records compact counts,
|
|
1062
|
+
booleans, and policy labels only, never argv, paths, raw logs, prompts, or
|
|
1063
|
+
credential surfaces.
|
|
1064
|
+
"""
|
|
1065
|
+
|
|
1066
|
+
cli_total = _coerce_non_negative_int(
|
|
1067
|
+
worker_loopx_cli_call_total,
|
|
1068
|
+
field="worker_loopx_cli_call_total",
|
|
1069
|
+
)
|
|
1070
|
+
required_cli_total = _coerce_non_negative_int(
|
|
1071
|
+
required_worker_loopx_cli_call_total_min,
|
|
1072
|
+
field="required_worker_loopx_cli_call_total_min",
|
|
1073
|
+
)
|
|
1074
|
+
wall_time = _coerce_optional_non_negative_float(
|
|
1075
|
+
wall_time_seconds,
|
|
1076
|
+
field="wall_time_seconds",
|
|
1077
|
+
)
|
|
1078
|
+
wall_time_limit = _coerce_optional_non_negative_float(
|
|
1079
|
+
wall_time_limit_seconds,
|
|
1080
|
+
field="wall_time_limit_seconds",
|
|
1081
|
+
)
|
|
1082
|
+
if wall_time_limit is None or wall_time_limit <= 0:
|
|
1083
|
+
raise ValueError("wall_time_limit_seconds must be greater than zero")
|
|
1084
|
+
if official_score_completed and official_score_value is None:
|
|
1085
|
+
raise ValueError("official_score_value is required when official_score_completed=true")
|
|
1086
|
+
if not official_score_completed and official_score_value is not None:
|
|
1087
|
+
raise ValueError("official_score_value requires official_score_completed=true")
|
|
1088
|
+
|
|
1089
|
+
worker_bridge_verified = bool(counter_trace_present) and cli_total >= required_cli_total
|
|
1090
|
+
official_case_success = bool(official_score_completed and official_score_value)
|
|
1091
|
+
runner_return_status = (
|
|
1092
|
+
"completed"
|
|
1093
|
+
if runner_return_completed
|
|
1094
|
+
else "interrupted_after_worker_bridge_success"
|
|
1095
|
+
if interrupted and worker_bridge_verified
|
|
1096
|
+
else "pending_after_worker_bridge_success"
|
|
1097
|
+
if worker_bridge_verified
|
|
1098
|
+
else "worker_bridge_evidence_missing"
|
|
1099
|
+
)
|
|
1100
|
+
official_score_status = (
|
|
1101
|
+
"completed"
|
|
1102
|
+
if official_score_completed
|
|
1103
|
+
else "blocked_pending_runner_return"
|
|
1104
|
+
if worker_bridge_verified and not runner_return_completed
|
|
1105
|
+
else "not_ready"
|
|
1106
|
+
)
|
|
1107
|
+
labels: list[str] = []
|
|
1108
|
+
if worker_bridge_verified:
|
|
1109
|
+
labels.append("worker_bridge_install_verified")
|
|
1110
|
+
else:
|
|
1111
|
+
labels.append("worker_bridge_install_unverified")
|
|
1112
|
+
if not runner_return_completed:
|
|
1113
|
+
labels.append("runner_return_pending")
|
|
1114
|
+
if interrupted:
|
|
1115
|
+
labels.append("controller_interrupt")
|
|
1116
|
+
if not official_score_completed:
|
|
1117
|
+
labels.append("official_score_pending")
|
|
1118
|
+
|
|
1119
|
+
next_action = (
|
|
1120
|
+
"ingest official runner score and close benchmark_run_v0"
|
|
1121
|
+
if runner_return_completed and official_score_completed
|
|
1122
|
+
else "finish runner return or record a runner-return blocker with the same outcome policy"
|
|
1123
|
+
if worker_bridge_verified
|
|
1124
|
+
else "recheck worker bridge install before another active worker sample"
|
|
1125
|
+
)
|
|
1126
|
+
reason = interrupt_reason.strip() or (
|
|
1127
|
+
"controller_wall_time_policy"
|
|
1128
|
+
if interrupted
|
|
1129
|
+
else "runner_return_pending"
|
|
1130
|
+
)
|
|
1131
|
+
|
|
1132
|
+
return {
|
|
1133
|
+
"ok": True,
|
|
1134
|
+
"schema_version": WORKER_BRIDGE_OUTCOME_SCHEMA_VERSION,
|
|
1135
|
+
"bridge_surface": WORKER_BRIDGE_SURFACE,
|
|
1136
|
+
"worker_bridge_verified": worker_bridge_verified,
|
|
1137
|
+
"runner_return_status": runner_return_status,
|
|
1138
|
+
"official_score_status": official_score_status,
|
|
1139
|
+
"worker_loopx_cli_call_total": cli_total,
|
|
1140
|
+
"required_worker_loopx_cli_call_total_min": required_cli_total,
|
|
1141
|
+
"counter_trace_present": bool(counter_trace_present),
|
|
1142
|
+
"runner_return_completed": bool(runner_return_completed),
|
|
1143
|
+
"official_score_completed": bool(official_score_completed),
|
|
1144
|
+
"official_score_value": official_score_value,
|
|
1145
|
+
"side_effect_audit_passed": bool(side_effect_audit_passed),
|
|
1146
|
+
"wall_time_policy": {
|
|
1147
|
+
"schema_version": "loopx_worker_bridge_wall_time_policy_v0",
|
|
1148
|
+
"kind": "controller_interrupt_after_worker_bridge_evidence_no_runner_return",
|
|
1149
|
+
"wall_time_seconds": wall_time,
|
|
1150
|
+
"wall_time_limit_seconds": wall_time_limit,
|
|
1151
|
+
"interrupted": bool(interrupted),
|
|
1152
|
+
"interrupt_reason": reason,
|
|
1153
|
+
"changes_official_benchmark_timeout": False,
|
|
1154
|
+
"changes_official_task_resources": False,
|
|
1155
|
+
"leaderboard_claim_allowed": False,
|
|
1156
|
+
},
|
|
1157
|
+
"failure_attribution_labels": labels,
|
|
1158
|
+
"claim_boundary": {
|
|
1159
|
+
"public_claim_allowed": (
|
|
1160
|
+
"worker bridge install verified by compact in-worker CLI counts"
|
|
1161
|
+
if worker_bridge_verified
|
|
1162
|
+
else "worker bridge install not yet verified"
|
|
1163
|
+
),
|
|
1164
|
+
"bridge_connectivity_claim_allowed": worker_bridge_verified,
|
|
1165
|
+
"case_success_claim_allowed": official_case_success,
|
|
1166
|
+
"official_score_claim_allowed": bool(official_score_completed),
|
|
1167
|
+
"leaderboard_claim_allowed": False,
|
|
1168
|
+
"forbidden_claims": [
|
|
1169
|
+
*([] if official_score_completed else ["official_reward_complete"]),
|
|
1170
|
+
*([] if official_case_success else ["case_success"]),
|
|
1171
|
+
"leaderboard_ready",
|
|
1172
|
+
"uplift_over_baseline",
|
|
1173
|
+
"raw_trace_public",
|
|
1174
|
+
],
|
|
1175
|
+
},
|
|
1176
|
+
"next_action": next_action,
|
|
1177
|
+
"trace_publicness": "compact_counts_only_no_raw_trace",
|
|
1178
|
+
"raw_paths_recorded": False,
|
|
1179
|
+
"raw_trace_recorded": False,
|
|
1180
|
+
"credential_values_recorded": False,
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
def build_worker_bridge_benchmark_run(
|
|
1185
|
+
*,
|
|
1186
|
+
source_runner: str = DEFAULT_WORKER_BRIDGE_SOURCE_RUNNER,
|
|
1187
|
+
benchmark_id: str = DEFAULT_WORKER_BRIDGE_BENCHMARK_ID,
|
|
1188
|
+
job_name: str = DEFAULT_WORKER_BRIDGE_JOB_NAME,
|
|
1189
|
+
mode: str = DEFAULT_WORKER_BRIDGE_MODE,
|
|
1190
|
+
worker_mode: str = DEFAULT_WORKER_BRIDGE_WORKER_MODE,
|
|
1191
|
+
task_id: str = DEFAULT_WORKER_BRIDGE_TASK_ID,
|
|
1192
|
+
trial_name: str = DEFAULT_WORKER_BRIDGE_TRIAL_NAME,
|
|
1193
|
+
official_score_kind: str | None = None,
|
|
1194
|
+
worker_loopx_cli_call_total: int = 0,
|
|
1195
|
+
counter_trace_present: bool = False,
|
|
1196
|
+
runner_return_completed: bool = False,
|
|
1197
|
+
official_score_completed: bool = False,
|
|
1198
|
+
official_score_value: int | float | None = None,
|
|
1199
|
+
interrupted: bool = False,
|
|
1200
|
+
interrupt_reason: str = "",
|
|
1201
|
+
wall_time_seconds: int | float | None = None,
|
|
1202
|
+
wall_time_limit_seconds: int | float = DEFAULT_WORKER_BRIDGE_WALL_TIME_LIMIT_SECONDS,
|
|
1203
|
+
required_worker_loopx_cli_call_total_min: int = DEFAULT_WORKER_BRIDGE_CLI_CALL_MINIMUM,
|
|
1204
|
+
side_effect_audit_passed: bool = True,
|
|
1205
|
+
) -> dict[str, Any]:
|
|
1206
|
+
"""Build the public-safe worker-side benchmark_run_v0 writeback payload."""
|
|
1207
|
+
|
|
1208
|
+
outcome = build_worker_bridge_outcome(
|
|
1209
|
+
worker_loopx_cli_call_total=worker_loopx_cli_call_total,
|
|
1210
|
+
counter_trace_present=counter_trace_present,
|
|
1211
|
+
runner_return_completed=runner_return_completed,
|
|
1212
|
+
official_score_completed=official_score_completed,
|
|
1213
|
+
official_score_value=official_score_value,
|
|
1214
|
+
interrupted=interrupted,
|
|
1215
|
+
interrupt_reason=interrupt_reason,
|
|
1216
|
+
wall_time_seconds=wall_time_seconds,
|
|
1217
|
+
wall_time_limit_seconds=wall_time_limit_seconds,
|
|
1218
|
+
required_worker_loopx_cli_call_total_min=(
|
|
1219
|
+
required_worker_loopx_cli_call_total_min
|
|
1220
|
+
),
|
|
1221
|
+
side_effect_audit_passed=side_effect_audit_passed,
|
|
1222
|
+
)
|
|
1223
|
+
score_kind = official_score_kind or (
|
|
1224
|
+
"sample_private_no_upload"
|
|
1225
|
+
if official_score_completed
|
|
1226
|
+
else "worker_bridge_runner_return_blocker"
|
|
1227
|
+
)
|
|
1228
|
+
official_score: dict[str, Any] = {"kind": score_kind}
|
|
1229
|
+
if official_score_completed:
|
|
1230
|
+
official_score["value"] = official_score_value
|
|
1231
|
+
official_score["passed"] = bool(official_score_value)
|
|
1232
|
+
|
|
1233
|
+
runner_closed = bool(runner_return_completed)
|
|
1234
|
+
official_case_success = bool(official_score_completed and official_score_value)
|
|
1235
|
+
official_verifier_status = (
|
|
1236
|
+
"passed"
|
|
1237
|
+
if official_case_success
|
|
1238
|
+
else "failed"
|
|
1239
|
+
if official_score_completed
|
|
1240
|
+
else "pending"
|
|
1241
|
+
)
|
|
1242
|
+
validation_scope = (
|
|
1243
|
+
"official_verifier_result"
|
|
1244
|
+
if official_score_completed
|
|
1245
|
+
else "worker_bridge_connectivity"
|
|
1246
|
+
)
|
|
1247
|
+
claim_boundary = {
|
|
1248
|
+
"public_claim_allowed": (
|
|
1249
|
+
"official verifier result"
|
|
1250
|
+
if official_score_completed
|
|
1251
|
+
else "worker bridge install verified by compact in-worker CLI counts"
|
|
1252
|
+
if outcome["worker_bridge_verified"]
|
|
1253
|
+
else "worker bridge install not yet verified"
|
|
1254
|
+
),
|
|
1255
|
+
"bridge_connectivity_claim_allowed": bool(outcome["worker_bridge_verified"]),
|
|
1256
|
+
"case_success_claim_allowed": official_case_success,
|
|
1257
|
+
"official_score_claim_allowed": bool(official_score_completed),
|
|
1258
|
+
"leaderboard_claim_allowed": False,
|
|
1259
|
+
"forbidden_claims": [
|
|
1260
|
+
"leaderboard_ready",
|
|
1261
|
+
"uplift_over_baseline",
|
|
1262
|
+
"raw_trace_public",
|
|
1263
|
+
*([] if official_score_completed else ["official_reward_complete"]),
|
|
1264
|
+
*([] if official_case_success else ["case_success"]),
|
|
1265
|
+
],
|
|
1266
|
+
}
|
|
1267
|
+
progress = {
|
|
1268
|
+
"n_total_trials": 1,
|
|
1269
|
+
"n_completed_trials": 1 if runner_closed else 0,
|
|
1270
|
+
"n_errored_trials": 0,
|
|
1271
|
+
"n_running_trials": 0 if runner_closed or interrupted else 1,
|
|
1272
|
+
"n_pending_trials": 0,
|
|
1273
|
+
"n_cancelled_trials": 1 if interrupted and not runner_closed else 0,
|
|
1274
|
+
"n_retries": 0,
|
|
1275
|
+
}
|
|
1276
|
+
trial: dict[str, Any] = {
|
|
1277
|
+
"task_id": task_id,
|
|
1278
|
+
"trial_name": trial_name,
|
|
1279
|
+
"source": benchmark_id,
|
|
1280
|
+
"exception_type": (
|
|
1281
|
+
"none"
|
|
1282
|
+
if runner_closed
|
|
1283
|
+
else "runner_return_pending_after_worker_bridge_success"
|
|
1284
|
+
if outcome["worker_bridge_verified"]
|
|
1285
|
+
else "worker_bridge_evidence_missing"
|
|
1286
|
+
),
|
|
1287
|
+
"trajectory_present": False,
|
|
1288
|
+
"verifier_reward_present": bool(official_score_completed),
|
|
1289
|
+
"artifact_manifest_present": False,
|
|
1290
|
+
"trial_result_present": runner_closed,
|
|
1291
|
+
}
|
|
1292
|
+
if official_score_completed:
|
|
1293
|
+
trial["reward"] = {"reward": official_score_value}
|
|
1294
|
+
|
|
1295
|
+
return {
|
|
1296
|
+
"ok": True,
|
|
1297
|
+
"schema_version": "benchmark_run_v0",
|
|
1298
|
+
"source_runner": source_runner,
|
|
1299
|
+
"benchmark_id": benchmark_id,
|
|
1300
|
+
"job_name": job_name,
|
|
1301
|
+
"mode": mode,
|
|
1302
|
+
"worker_mode": worker_mode,
|
|
1303
|
+
"real_run": True,
|
|
1304
|
+
"submit_eligible": False,
|
|
1305
|
+
"leaderboard_evidence": False,
|
|
1306
|
+
"trace_publicness": "compact_counts_only_no_raw_trace",
|
|
1307
|
+
"loopx_worker_cli_bridge_available": True,
|
|
1308
|
+
"loopx_worker_cli_bridge_trace_observed": bool(counter_trace_present),
|
|
1309
|
+
"worker_loopx_cli_call_total": outcome["worker_loopx_cli_call_total"],
|
|
1310
|
+
"required_worker_loopx_cli_call_total_min": (
|
|
1311
|
+
outcome["required_worker_loopx_cli_call_total_min"]
|
|
1312
|
+
),
|
|
1313
|
+
"official_task_score": official_score,
|
|
1314
|
+
"validation_scope": validation_scope,
|
|
1315
|
+
"bridge_connectivity_claim_allowed": bool(outcome["worker_bridge_verified"]),
|
|
1316
|
+
"case_success_claimed": official_case_success,
|
|
1317
|
+
"official_verifier_validation_present": bool(official_score_completed),
|
|
1318
|
+
"official_case_success": official_case_success,
|
|
1319
|
+
"progress": progress,
|
|
1320
|
+
"worker_bridge_outcome": outcome,
|
|
1321
|
+
"claim_boundary": claim_boundary,
|
|
1322
|
+
"validation": {
|
|
1323
|
+
"validation_scope": validation_scope,
|
|
1324
|
+
"bridge_connected": bool(outcome["worker_bridge_verified"]),
|
|
1325
|
+
"bridge_connectivity_claim_allowed": bool(outcome["worker_bridge_verified"]),
|
|
1326
|
+
"case_success_claimed": official_case_success,
|
|
1327
|
+
"case_success_claim_kind": (
|
|
1328
|
+
"official_verifier_score_positive" if official_case_success else "none"
|
|
1329
|
+
),
|
|
1330
|
+
"official_verifier_validation_present": bool(official_score_completed),
|
|
1331
|
+
"official_verifier_status": official_verifier_status,
|
|
1332
|
+
"official_case_success": official_case_success,
|
|
1333
|
+
"worker_bridge_trace_observed": bool(counter_trace_present),
|
|
1334
|
+
"worker_cli_call_threshold_met": outcome["worker_bridge_verified"],
|
|
1335
|
+
"runner_return_completed_or_blocker_recorded": (
|
|
1336
|
+
runner_closed or outcome["worker_bridge_verified"]
|
|
1337
|
+
),
|
|
1338
|
+
"official_score_completed_or_not_claimed": (
|
|
1339
|
+
bool(official_score_completed) or not runner_closed
|
|
1340
|
+
),
|
|
1341
|
+
"no_leaderboard_upload_requested": True,
|
|
1342
|
+
"paths_redacted": True,
|
|
1343
|
+
"raw_trace_excluded": True,
|
|
1344
|
+
"side_effect_audit_passed": bool(side_effect_audit_passed),
|
|
1345
|
+
},
|
|
1346
|
+
"trials": [trial],
|
|
1347
|
+
"stop_conditions": [
|
|
1348
|
+
"do_not_upload_or_submit_leaderboard",
|
|
1349
|
+
"do_not_record_raw_trace_or_paths",
|
|
1350
|
+
"do_not_claim_official_reward_complete_without_official_score",
|
|
1351
|
+
],
|
|
1352
|
+
"case_semantics_changed_by_harness": True,
|
|
1353
|
+
"loopx_inside_case": True,
|
|
1354
|
+
"official_score_comparable_to_native_codex": False,
|
|
1355
|
+
"model_plus_harness_pair": True,
|
|
1356
|
+
"control_plane_score_applicable": True,
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
def worker_bridge_cli_call_total_from_interaction_counters(
|
|
1361
|
+
interaction_counters: dict[str, Any],
|
|
1362
|
+
) -> int:
|
|
1363
|
+
"""Read worker LoopX CLI call total from compact benchmark counters."""
|
|
1364
|
+
|
|
1365
|
+
calls = interaction_counters.get("loopx_cli_calls")
|
|
1366
|
+
if not isinstance(calls, dict):
|
|
1367
|
+
return 0
|
|
1368
|
+
total = calls.get("total")
|
|
1369
|
+
if isinstance(total, bool) or not isinstance(total, int) or total < 0:
|
|
1370
|
+
return 0
|
|
1371
|
+
return total
|
|
1372
|
+
|
|
1373
|
+
|
|
1374
|
+
def build_worker_bridge_benchmark_run_from_counters(
|
|
1375
|
+
interaction_counters: dict[str, Any],
|
|
1376
|
+
*,
|
|
1377
|
+
counter_trace_present: bool,
|
|
1378
|
+
source_runner: str = DEFAULT_WORKER_BRIDGE_SOURCE_RUNNER,
|
|
1379
|
+
benchmark_id: str = DEFAULT_WORKER_BRIDGE_BENCHMARK_ID,
|
|
1380
|
+
job_name: str = DEFAULT_WORKER_BRIDGE_JOB_NAME,
|
|
1381
|
+
mode: str = DEFAULT_WORKER_BRIDGE_MODE,
|
|
1382
|
+
worker_mode: str = DEFAULT_WORKER_BRIDGE_WORKER_MODE,
|
|
1383
|
+
task_id: str = DEFAULT_WORKER_BRIDGE_TASK_ID,
|
|
1384
|
+
trial_name: str = DEFAULT_WORKER_BRIDGE_TRIAL_NAME,
|
|
1385
|
+
interrupted: bool = False,
|
|
1386
|
+
interrupt_reason: str = "",
|
|
1387
|
+
wall_time_seconds: int | float | None = None,
|
|
1388
|
+
wall_time_limit_seconds: int | float = DEFAULT_WORKER_BRIDGE_WALL_TIME_LIMIT_SECONDS,
|
|
1389
|
+
side_effect_audit_passed: bool = True,
|
|
1390
|
+
) -> dict[str, Any]:
|
|
1391
|
+
"""Build a generic worker-side benchmark_run_v0 from compact counters."""
|
|
1392
|
+
|
|
1393
|
+
return build_worker_bridge_benchmark_run(
|
|
1394
|
+
source_runner=source_runner,
|
|
1395
|
+
benchmark_id=benchmark_id,
|
|
1396
|
+
job_name=job_name,
|
|
1397
|
+
mode=mode,
|
|
1398
|
+
worker_mode=worker_mode,
|
|
1399
|
+
task_id=task_id,
|
|
1400
|
+
trial_name=trial_name,
|
|
1401
|
+
worker_loopx_cli_call_total=(
|
|
1402
|
+
worker_bridge_cli_call_total_from_interaction_counters(
|
|
1403
|
+
interaction_counters
|
|
1404
|
+
)
|
|
1405
|
+
),
|
|
1406
|
+
counter_trace_present=counter_trace_present,
|
|
1407
|
+
interrupted=interrupted,
|
|
1408
|
+
interrupt_reason=interrupt_reason,
|
|
1409
|
+
wall_time_seconds=wall_time_seconds,
|
|
1410
|
+
wall_time_limit_seconds=wall_time_limit_seconds,
|
|
1411
|
+
side_effect_audit_passed=side_effect_audit_passed,
|
|
1412
|
+
)
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
def write_worker_bridge_benchmark_run_file(
|
|
1416
|
+
path: str | Path | None,
|
|
1417
|
+
payload: dict[str, Any],
|
|
1418
|
+
) -> bool:
|
|
1419
|
+
"""Write compact worker-side benchmark_run_v0 without raw traces or paths."""
|
|
1420
|
+
|
|
1421
|
+
if not path:
|
|
1422
|
+
return False
|
|
1423
|
+
output_path = Path(path)
|
|
1424
|
+
try:
|
|
1425
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
1426
|
+
output_path.write_text(
|
|
1427
|
+
json.dumps(payload, ensure_ascii=True, sort_keys=True, indent=2) + "\n",
|
|
1428
|
+
encoding="utf-8",
|
|
1429
|
+
)
|
|
1430
|
+
except OSError:
|
|
1431
|
+
return False
|
|
1432
|
+
return True
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
def render_worker_bridge_install_contract_markdown(payload: dict[str, Any]) -> str:
|
|
1436
|
+
if payload.get("schema_version") == ACTIVE_USER_CODEX_SIMULATOR_CONTRACT_VERSION:
|
|
1437
|
+
cli = payload.get("codex_cli") or {}
|
|
1438
|
+
boundary = payload.get("claim_boundary") or {}
|
|
1439
|
+
lines = [
|
|
1440
|
+
"# LoopX Active User Codex Simulator Contract",
|
|
1441
|
+
"",
|
|
1442
|
+
f"- ok: `{payload.get('ok')}`",
|
|
1443
|
+
f"- schema_version: `{payload.get('schema_version')}`",
|
|
1444
|
+
f"- simulator_kind: `{payload.get('simulator_kind')}`",
|
|
1445
|
+
f"- manual_controller_feed_allowed: `{payload.get('manual_controller_feed_allowed')}`",
|
|
1446
|
+
f"- codex_bin: `{cli.get('codex_bin')}`",
|
|
1447
|
+
f"- official_score_claim_allowed: `{boundary.get('official_score_claim_allowed')}`",
|
|
1448
|
+
f"- direct_codex_chat_injection: `{boundary.get('direct_codex_chat_injection')}`",
|
|
1449
|
+
f"- controller_authored_feed_allowed: `{boundary.get('controller_authored_feed_allowed')}`",
|
|
1450
|
+
]
|
|
1451
|
+
return "\n".join(lines) + "\n"
|
|
1452
|
+
|
|
1453
|
+
if payload.get("schema_version") == ACTIVE_USER_INTERVENTION_CHANNEL_CONTRACT_VERSION:
|
|
1454
|
+
budget = payload.get("frequency_budget") or {}
|
|
1455
|
+
boundary = payload.get("claim_boundary") or {}
|
|
1456
|
+
lines = [
|
|
1457
|
+
"# LoopX Active User Intervention Channel",
|
|
1458
|
+
"",
|
|
1459
|
+
f"- ok: `{payload.get('ok')}`",
|
|
1460
|
+
f"- schema_version: `{payload.get('schema_version')}`",
|
|
1461
|
+
f"- channel_surface: `{payload.get('channel_surface')}`",
|
|
1462
|
+
f"- mode: `{payload.get('mode')}`",
|
|
1463
|
+
f"- max_interventions_per_task: `{budget.get('max_interventions_per_task')}`",
|
|
1464
|
+
f"- min_interval_seconds: `{budget.get('min_interval_seconds')}`",
|
|
1465
|
+
f"- official_score_claim_allowed: `{boundary.get('official_score_claim_allowed')}`",
|
|
1466
|
+
f"- direct_codex_chat_injection: `{boundary.get('direct_codex_chat_injection')}`",
|
|
1467
|
+
f"- worker_pull_required: `{boundary.get('worker_pull_required')}`",
|
|
1468
|
+
]
|
|
1469
|
+
return "\n".join(lines) + "\n"
|
|
1470
|
+
|
|
1471
|
+
if payload.get("schema_version") == ACTIVE_USER_INTERVENTION_EVENT_VERSION:
|
|
1472
|
+
lines = [
|
|
1473
|
+
"# LoopX Active User Intervention",
|
|
1474
|
+
"",
|
|
1475
|
+
f"- schema_version: `{payload.get('schema_version')}`",
|
|
1476
|
+
f"- channel_surface: `{payload.get('channel_surface')}`",
|
|
1477
|
+
f"- seq: `{payload.get('seq')}`",
|
|
1478
|
+
f"- channel: `{payload.get('channel')}`",
|
|
1479
|
+
f"- trigger: `{payload.get('trigger')}`",
|
|
1480
|
+
f"- created_after_worker_start: `{payload.get('created_after_worker_start')}`",
|
|
1481
|
+
f"- oracle_free: `{payload.get('oracle_free')}`",
|
|
1482
|
+
f"- simulator_kind: `{payload.get('simulator_kind')}`",
|
|
1483
|
+
f"- formal_treatment_eligible: `{payload.get('formal_treatment_eligible')}`",
|
|
1484
|
+
]
|
|
1485
|
+
return "\n".join(lines) + "\n"
|
|
1486
|
+
|
|
1487
|
+
if payload.get("schema_version") == ACTIVE_USER_INTERVENTION_OBSERVATION_VERSION:
|
|
1488
|
+
latest = payload.get("latest_intervention") or {}
|
|
1489
|
+
boundary = payload.get("claim_boundary") or {}
|
|
1490
|
+
lines = [
|
|
1491
|
+
"# LoopX Active User Intervention Observation",
|
|
1492
|
+
"",
|
|
1493
|
+
f"- ok: `{payload.get('ok')}`",
|
|
1494
|
+
f"- schema_version: `{payload.get('schema_version')}`",
|
|
1495
|
+
f"- channel_surface: `{payload.get('channel_surface')}`",
|
|
1496
|
+
f"- observed_after_worker_start: `{payload.get('observed_after_worker_start')}`",
|
|
1497
|
+
f"- observed_intervention_count: `{payload.get('observed_intervention_count')}`",
|
|
1498
|
+
f"- latest_seq: `{latest.get('seq')}`",
|
|
1499
|
+
f"- latest_trigger: `{latest.get('trigger')}`",
|
|
1500
|
+
f"- official_score_claim_allowed: `{boundary.get('official_score_claim_allowed')}`",
|
|
1501
|
+
f"- direct_codex_chat_injection: `{boundary.get('direct_codex_chat_injection')}`",
|
|
1502
|
+
f"- next_action: `{payload.get('next_action')}`",
|
|
1503
|
+
]
|
|
1504
|
+
return "\n".join(lines) + "\n"
|
|
1505
|
+
|
|
1506
|
+
if payload.get("schema_version") == "benchmark_run_v0":
|
|
1507
|
+
outcome = payload.get("worker_bridge_outcome") or {}
|
|
1508
|
+
progress = payload.get("progress") or {}
|
|
1509
|
+
lines = [
|
|
1510
|
+
"# LoopX Worker Bridge Benchmark Run",
|
|
1511
|
+
"",
|
|
1512
|
+
f"- schema_version: `{payload.get('schema_version')}`",
|
|
1513
|
+
f"- benchmark_id: `{payload.get('benchmark_id')}`",
|
|
1514
|
+
f"- mode: `{payload.get('mode')}`",
|
|
1515
|
+
f"- worker_mode: `{payload.get('worker_mode')}`",
|
|
1516
|
+
f"- worker_bridge_verified: `{outcome.get('worker_bridge_verified')}`",
|
|
1517
|
+
f"- runner_return_status: `{outcome.get('runner_return_status')}`",
|
|
1518
|
+
f"- official_score_status: `{outcome.get('official_score_status')}`",
|
|
1519
|
+
f"- worker_loopx_cli_call_total: `{outcome.get('worker_loopx_cli_call_total')}`",
|
|
1520
|
+
f"- n_completed_trials: `{progress.get('n_completed_trials')}`",
|
|
1521
|
+
f"- submit_eligible: `{payload.get('submit_eligible')}`",
|
|
1522
|
+
]
|
|
1523
|
+
return "\n".join(lines) + "\n"
|
|
1524
|
+
|
|
1525
|
+
if payload.get("schema_version") == WORKER_BRIDGE_OUTCOME_SCHEMA_VERSION:
|
|
1526
|
+
policy = payload.get("wall_time_policy") or {}
|
|
1527
|
+
lines = [
|
|
1528
|
+
"# LoopX Worker Bridge Outcome",
|
|
1529
|
+
"",
|
|
1530
|
+
f"- ok: `{payload.get('ok')}`",
|
|
1531
|
+
f"- schema_version: `{payload.get('schema_version')}`",
|
|
1532
|
+
f"- bridge_surface: `{payload.get('bridge_surface')}`",
|
|
1533
|
+
f"- worker_bridge_verified: `{payload.get('worker_bridge_verified')}`",
|
|
1534
|
+
f"- runner_return_status: `{payload.get('runner_return_status')}`",
|
|
1535
|
+
f"- official_score_status: `{payload.get('official_score_status')}`",
|
|
1536
|
+
f"- worker_loopx_cli_call_total: `{payload.get('worker_loopx_cli_call_total')}`",
|
|
1537
|
+
f"- required_worker_loopx_cli_call_total_min: `{payload.get('required_worker_loopx_cli_call_total_min')}`",
|
|
1538
|
+
f"- counter_trace_present: `{payload.get('counter_trace_present')}`",
|
|
1539
|
+
f"- interrupted: `{policy.get('interrupted')}`",
|
|
1540
|
+
f"- wall_time_limit_seconds: `{policy.get('wall_time_limit_seconds')}`",
|
|
1541
|
+
f"- changes_official_benchmark_timeout: `{policy.get('changes_official_benchmark_timeout')}`",
|
|
1542
|
+
f"- next_action: `{payload.get('next_action')}`",
|
|
1543
|
+
]
|
|
1544
|
+
return "\n".join(lines) + "\n"
|
|
1545
|
+
|
|
1546
|
+
lines = [
|
|
1547
|
+
"# LoopX Worker Bridge",
|
|
1548
|
+
"",
|
|
1549
|
+
f"- ok: `{payload.get('ok')}`",
|
|
1550
|
+
f"- schema_version: `{payload.get('schema_version')}`",
|
|
1551
|
+
f"- bridge_surface: `{payload.get('bridge_surface')}`",
|
|
1552
|
+
f"- install_mode: `{payload.get('install_mode')}`",
|
|
1553
|
+
f"- command_prefix: `{payload.get('command_prefix')}`",
|
|
1554
|
+
f"- counter_trace_json: `{(payload.get('trace') or {}).get('counter_trace_json')}`",
|
|
1555
|
+
]
|
|
1556
|
+
mounts = payload.get("mounts")
|
|
1557
|
+
if isinstance(mounts, list):
|
|
1558
|
+
lines.append("- mounts:")
|
|
1559
|
+
for mount in mounts:
|
|
1560
|
+
if not isinstance(mount, dict):
|
|
1561
|
+
continue
|
|
1562
|
+
lines.append(
|
|
1563
|
+
" - "
|
|
1564
|
+
f"type=`{mount.get('type')}` "
|
|
1565
|
+
f"source=`{mount.get('source')}` "
|
|
1566
|
+
f"target=`{mount.get('target')}` "
|
|
1567
|
+
f"read_only=`{mount.get('read_only')}`"
|
|
1568
|
+
)
|
|
1569
|
+
agent_kwargs = payload.get("agent_kwargs")
|
|
1570
|
+
if isinstance(agent_kwargs, dict):
|
|
1571
|
+
lines.append("- agent_kwargs:")
|
|
1572
|
+
for key in sorted(agent_kwargs):
|
|
1573
|
+
lines.append(f" - {key}: `{agent_kwargs[key]}`")
|
|
1574
|
+
return "\n".join(lines) + "\n"
|