loopx 0.4.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- loopx/__init__.py +5 -0
- loopx/agent_onboarding.py +654 -0
- loopx/agent_registry.py +112 -0
- loopx/ark_managed_agent_host.py +59 -0
- loopx/authority.py +805 -0
- loopx/benchmark.py +2875 -0
- loopx/benchmark_adapters/__init__.py +1 -0
- loopx/benchmark_adapters/agentissue.py +2644 -0
- loopx/benchmark_adapters/agents_last_exam.py +3998 -0
- loopx/benchmark_adapters/edgebench.py +322 -0
- loopx/benchmark_adapters/skillsbench.py +5978 -0
- loopx/benchmark_adapters/skillsbench_acp_failure_policy.py +143 -0
- loopx/benchmark_adapters/skillsbench_acp_process.py +31 -0
- loopx/benchmark_adapters/skillsbench_acp_relay.py +4832 -0
- loopx/benchmark_adapters/skillsbench_batch.py +124 -0
- loopx/benchmark_adapters/skillsbench_bridge_guard.py +209 -0
- loopx/benchmark_adapters/skillsbench_bridge_summary.py +203 -0
- loopx/benchmark_adapters/skillsbench_codex_goal_recovery.py +271 -0
- loopx/benchmark_adapters/skillsbench_codex_goal_trace.py +81 -0
- loopx/benchmark_adapters/skillsbench_codex_runtime.py +339 -0
- loopx/benchmark_adapters/skillsbench_dockerfile_runtime.py +467 -0
- loopx/benchmark_adapters/skillsbench_failure_signals.py +652 -0
- loopx/benchmark_adapters/skillsbench_proxy_runtime.py +327 -0
- loopx/benchmark_adapters/skillsbench_remote_bridge.py +402 -0
- loopx/benchmark_adapters/skillsbench_result_discovery.py +143 -0
- loopx/benchmark_adapters/skillsbench_runner_profile.py +436 -0
- loopx/benchmark_adapters/skillsbench_runner_source.py +99 -0
- loopx/benchmark_adapters/skillsbench_setup_preflight.py +771 -0
- loopx/benchmark_adapters/skillsbench_signals.py +15 -0
- loopx/benchmark_adapters/skillsbench_task_source.py +141 -0
- loopx/benchmark_adapters/skillsbench_turn_route.py +723 -0
- loopx/benchmark_adapters/skillsbench_turn_runtime.py +1069 -0
- loopx/benchmark_adapters/skillsbench_typed_repair.py +689 -0
- loopx/benchmark_adapters/skillsbench_uv_cache.py +111 -0
- loopx/benchmark_adapters/skillsbench_verifier_bootstrap.py +227 -0
- loopx/benchmark_adapters/skillsbench_verifier_cache.py +138 -0
- loopx/benchmark_adapters/terminal_bench.py +10078 -0
- loopx/benchmark_case_analysis.py +1276 -0
- loopx/benchmark_case_state.py +1079 -0
- loopx/benchmark_core/__init__.py +239 -0
- loopx/benchmark_core/adapter.py +84 -0
- loopx/benchmark_core/artifacts.py +517 -0
- loopx/benchmark_core/attempts.py +199 -0
- loopx/benchmark_core/container_exec.py +216 -0
- loopx/benchmark_core/io.py +68 -0
- loopx/benchmark_core/lifecycle.py +211 -0
- loopx/benchmark_core/loop_protocol.py +689 -0
- loopx/benchmark_core/observable_handles.py +348 -0
- loopx/benchmark_core/parity.py +256 -0
- loopx/benchmark_core/remote_closeout.py +482 -0
- loopx/benchmark_core/rounds.py +215 -0
- loopx/benchmark_core/route_profile.py +509 -0
- loopx/benchmark_core/run_permissions.py +206 -0
- loopx/benchmark_core/split_control.py +925 -0
- loopx/benchmark_core/turn_fidelity.py +326 -0
- loopx/benchmark_ledger.py +3793 -0
- loopx/benchmark_ledger_countability.py +372 -0
- loopx/benchmark_ledger_current.py +724 -0
- loopx/benchmark_trajectory.py +405 -0
- loopx/benchmarks/__init__.py +1 -0
- loopx/benchmarks/qualification/__init__.py +1 -0
- loopx/benchmarks/qualification/release_outcome_baseline.py +360 -0
- loopx/benchmarks/read_models/__init__.py +1 -0
- loopx/benchmarks/read_models/benchmark_attempt_accounting.py +53 -0
- loopx/benchmarks/read_models/benchmark_comparison.py +414 -0
- loopx/benchmarks/read_models/benchmark_event_timeline.py +113 -0
- loopx/benchmarks/read_models/benchmark_experiment_report.py +475 -0
- loopx/benchmarks/read_models/benchmark_learning_ledger.py +137 -0
- loopx/benchmarks/read_models/benchmark_lifecycle_contracts.py +228 -0
- loopx/benchmarks/read_models/benchmark_projection.py +723 -0
- loopx/benchmarks/read_models/benchmark_result.py +146 -0
- loopx/benchmarks/read_models/benchmark_run_execution_contract.py +116 -0
- loopx/benchmarks/read_models/benchmark_run_failure.py +157 -0
- loopx/benchmarks/read_models/benchmark_run_metrics.py +213 -0
- loopx/benchmarks/read_models/benchmark_run_post_execution.py +635 -0
- loopx/benchmarks/read_models/benchmark_run_pre_execution.py +541 -0
- loopx/benchmarks/read_models/benchmark_status_compaction.py +1255 -0
- loopx/benchmarks/read_models/benchmark_status_runner.py +780 -0
- loopx/benchmarks/read_models/goal_start_control_score.py +857 -0
- loopx/benchmarks/read_models/skillsbench_post_run_debug.py +746 -0
- loopx/benchmarks/read_models/skillsbench_verifier_attribution.py +269 -0
- loopx/bootstrap.py +1116 -0
- loopx/bootstrap_command_pack.py +2167 -0
- loopx/boundary_authority.py +199 -0
- loopx/canary/__init__.py +1 -0
- loopx/canary/maintainability_ratchet.py +800 -0
- loopx/canary/planner.py +1984 -0
- loopx/canary/premerge.py +1130 -0
- loopx/canary/qualification_profiles.py +309 -0
- loopx/canary/quality_surface_catalog.py +838 -0
- loopx/canary/release_profiles.py +51 -0
- loopx/canary/runner.py +1107 -0
- loopx/canary/smoke_health.py +581 -0
- loopx/canary/smoke_profiles.py +212 -0
- loopx/capabilities/__init__.py +0 -0
- loopx/capabilities/agent_turn_recall/__init__.py +17 -0
- loopx/capabilities/agent_turn_recall/cli.py +369 -0
- loopx/capabilities/agent_turn_recall/core.py +296 -0
- loopx/capabilities/auto_research/__init__.py +16 -0
- loopx/capabilities/auto_research/bootstrap_contract.py +157 -0
- loopx/capabilities/auto_research/cli.py +1468 -0
- loopx/capabilities/auto_research/core.py +11 -0
- loopx/capabilities/auto_research/defaults.py +79 -0
- loopx/capabilities/auto_research/demo_e2e.py +1848 -0
- loopx/capabilities/auto_research/demo_supervisor.py +186 -0
- loopx/capabilities/auto_research/evidence_packet.py +767 -0
- loopx/capabilities/auto_research/human_view.py +794 -0
- loopx/capabilities/auto_research/kernel.py +191 -0
- loopx/capabilities/auto_research/knn_demo_workspace.py +322 -0
- loopx/capabilities/auto_research/live_evidence.py +248 -0
- loopx/capabilities/auto_research/preset.py +176 -0
- loopx/capabilities/auto_research/research_state.py +1085 -0
- loopx/capabilities/auto_research/role_profiles.py +394 -0
- loopx/capabilities/auto_research/rollout_append.py +97 -0
- loopx/capabilities/auto_research/terminal_result_contract.py +422 -0
- loopx/capabilities/auto_research/terminal_result_projection.py +171 -0
- loopx/capabilities/auto_research/terminal_result_query.py +233 -0
- loopx/capabilities/auto_research/terminal_results.py +349 -0
- loopx/capabilities/auto_research/user_contract.py +190 -0
- loopx/capabilities/auto_research/worker_loop.py +163 -0
- loopx/capabilities/auto_research/worker_runtime.py +777 -0
- loopx/capabilities/auto_research/worker_skill/SKILL.md +343 -0
- loopx/capabilities/benchmark_toolkit/__init__.py +19 -0
- loopx/capabilities/benchmark_toolkit/integrity.py +387 -0
- loopx/capabilities/catalog.py +1875 -0
- loopx/capabilities/change_quality/__init__.py +19 -0
- loopx/capabilities/change_quality/cli.py +171 -0
- loopx/capabilities/change_quality/context.py +156 -0
- loopx/capabilities/change_quality/oracles.py +269 -0
- loopx/capabilities/change_quality/policy.py +34 -0
- loopx/capabilities/change_quality/receipt.py +482 -0
- loopx/capabilities/change_quality/result.py +493 -0
- loopx/capabilities/change_quality/scope.py +171 -0
- loopx/capabilities/change_quality/shadow.py +680 -0
- loopx/capabilities/content_ops/__init__.py +0 -0
- loopx/capabilities/content_ops/cli.py +649 -0
- loopx/capabilities/content_ops/connector_packets.py +164 -0
- loopx/capabilities/content_ops/item_lifecycle.py +1000 -0
- loopx/capabilities/content_ops/layout.py +451 -0
- loopx/capabilities/content_ops/markdown.py +456 -0
- loopx/capabilities/content_ops/schemas.py +51 -0
- loopx/capabilities/content_ops/social_browser_x.py +107 -0
- loopx/capabilities/content_ops/surface.py +1956 -0
- loopx/capabilities/content_ops/templates/layout-catalog-v0.json +72 -0
- loopx/capabilities/context_providers/__init__.py +36 -0
- loopx/capabilities/context_providers/base.py +189 -0
- loopx/capabilities/context_providers/factory.py +32 -0
- loopx/capabilities/context_providers/openviking.py +702 -0
- loopx/capabilities/context_providers/service_ownership.py +185 -0
- loopx/capabilities/decision_context/__init__.py +129 -0
- loopx/capabilities/decision_context/architecture.py +83 -0
- loopx/capabilities/decision_context/assembler.py +849 -0
- loopx/capabilities/decision_context/catalog_entry.py +195 -0
- loopx/capabilities/decision_context/cli.py +310 -0
- loopx/capabilities/decision_context/cursor_commit.py +535 -0
- loopx/capabilities/decision_context/outcome_feedback.py +352 -0
- loopx/capabilities/decision_context/packets.py +654 -0
- loopx/capabilities/decision_context/private_state.py +189 -0
- loopx/capabilities/decision_context/profile.py +453 -0
- loopx/capabilities/decision_context/providers.py +228 -0
- loopx/capabilities/decision_context/review_settlement.py +136 -0
- loopx/capabilities/decision_context/runtime.py +273 -0
- loopx/capabilities/decision_context/sources.py +415 -0
- loopx/capabilities/explore/__init__.py +1 -0
- loopx/capabilities/explore/activation.py +198 -0
- loopx/capabilities/explore/adaptive_replay_planner.py +221 -0
- loopx/capabilities/explore/child_replay_runtime.py +463 -0
- loopx/capabilities/explore/composition_frontier.py +291 -0
- loopx/capabilities/explore/counterfactual_runtime.py +578 -0
- loopx/capabilities/explore/episode_runtime.py +647 -0
- loopx/capabilities/explore/harness_checkpoint.py +171 -0
- loopx/capabilities/explore/harness_gate.py +115 -0
- loopx/capabilities/explore/harness_runtime.py +1124 -0
- loopx/capabilities/explore/replay_metrics.py +206 -0
- loopx/capabilities/explore/replay_runtime.py +1271 -0
- loopx/capabilities/explore/resource_portfolio.py +173 -0
- loopx/capabilities/explore/result_log.py +974 -0
- loopx/capabilities/explore/router_state.py +432 -0
- loopx/capabilities/explore/source_history_reconcile.py +255 -0
- loopx/capabilities/explore/speculative_scheduler.py +498 -0
- loopx/capabilities/explore/todo_branch_plan.py +650 -0
- loopx/capabilities/explore/todo_evidence.py +141 -0
- loopx/capabilities/explore/trace_runtime.py +284 -0
- loopx/capabilities/explore/worker_branch_plan.py +1257 -0
- loopx/capabilities/integration_branch/__init__.py +13 -0
- loopx/capabilities/integration_branch/cli.py +148 -0
- loopx/capabilities/integration_branch/core.py +916 -0
- loopx/capabilities/issue_fix/__init__.py +19 -0
- loopx/capabilities/issue_fix/acceptance_loop.py +1050 -0
- loopx/capabilities/issue_fix/candidate_evidence.py +503 -0
- loopx/capabilities/issue_fix/candidate_preflight.py +676 -0
- loopx/capabilities/issue_fix/cli.py +1822 -0
- loopx/capabilities/issue_fix/cli_input.py +87 -0
- loopx/capabilities/issue_fix/content_ops_cli.py +148 -0
- loopx/capabilities/issue_fix/discovered_issue_promotion.py +947 -0
- loopx/capabilities/issue_fix/explore_projection.py +710 -0
- loopx/capabilities/issue_fix/feasibility.py +542 -0
- loopx/capabilities/issue_fix/github_public.py +661 -0
- loopx/capabilities/issue_fix/intake_surface.py +832 -0
- loopx/capabilities/issue_fix/metadata_preview.py +218 -0
- loopx/capabilities/issue_fix/metrics_projection.py +1340 -0
- loopx/capabilities/issue_fix/metrics_supplement.py +634 -0
- loopx/capabilities/issue_fix/metrics_supplement_cli.py +127 -0
- loopx/capabilities/issue_fix/outcome_projection.py +1235 -0
- loopx/capabilities/issue_fix/periodic_report.py +189 -0
- loopx/capabilities/issue_fix/pr_description.py +418 -0
- loopx/capabilities/issue_fix/pr_gate_reconcile.py +496 -0
- loopx/capabilities/issue_fix/pr_gate_reconcile_cli.py +464 -0
- loopx/capabilities/issue_fix/pr_lifecycle.py +1327 -0
- loopx/capabilities/issue_fix/pr_lifecycle_rollout.py +85 -0
- loopx/capabilities/issue_fix/pr_monitor_materialization.py +257 -0
- loopx/capabilities/issue_fix/pr_review_ack.py +439 -0
- loopx/capabilities/issue_fix/provider_hooks.py +24 -0
- loopx/capabilities/issue_fix/repository_commit_evidence.py +186 -0
- loopx/capabilities/issue_fix/repository_context.py +457 -0
- loopx/capabilities/issue_fix/repository_memory.py +459 -0
- loopx/capabilities/issue_fix/repository_memory_provider.py +1454 -0
- loopx/capabilities/issue_fix/repository_snapshot.py +454 -0
- loopx/capabilities/issue_fix/reviewer_cli.py +917 -0
- loopx/capabilities/issue_fix/reviewer_notification.py +882 -0
- loopx/capabilities/issue_fix/reviewer_notification_drain.py +942 -0
- loopx/capabilities/issue_fix/reviewer_recommendation.py +1057 -0
- loopx/capabilities/issue_fix/reviewer_request.py +1282 -0
- loopx/capabilities/issue_fix/reward_memory.py +879 -0
- loopx/capabilities/issue_fix/workflow_plan.py +1286 -0
- loopx/capabilities/material_lifecycle/__init__.py +161 -0
- loopx/capabilities/material_lifecycle/_validation.py +183 -0
- loopx/capabilities/material_lifecycle/apply.py +672 -0
- loopx/capabilities/material_lifecycle/architecture.py +122 -0
- loopx/capabilities/material_lifecycle/cli.py +161 -0
- loopx/capabilities/material_lifecycle/decision_planning.py +470 -0
- loopx/capabilities/material_lifecycle/explore_execution.py +306 -0
- loopx/capabilities/material_lifecycle/intake.py +869 -0
- loopx/capabilities/material_lifecycle/inventory.py +147 -0
- loopx/capabilities/material_lifecycle/lifecycle.py +98 -0
- loopx/capabilities/material_lifecycle/preparation.py +147 -0
- loopx/capabilities/material_lifecycle/project_skill.py +83 -0
- loopx/capabilities/material_lifecycle/ranking.py +267 -0
- loopx/capabilities/material_lifecycle/readable_projection.py +500 -0
- loopx/capabilities/material_lifecycle/rebuild.py +480 -0
- loopx/capabilities/material_lifecycle/settlement.py +238 -0
- loopx/capabilities/periodic_report/__init__.py +71 -0
- loopx/capabilities/periodic_report/adapters.py +939 -0
- loopx/capabilities/periodic_report/archive.py +422 -0
- loopx/capabilities/periodic_report/bindings.py +705 -0
- loopx/capabilities/periodic_report/cli.py +277 -0
- loopx/capabilities/periodic_report/core.py +691 -0
- loopx/capabilities/periodic_report/extension_envelope.py +66 -0
- loopx/capabilities/periodic_report/presets.py +103 -0
- loopx/capabilities/periodic_report/profile.py +235 -0
- loopx/capabilities/periodic_report/project_progress.py +179 -0
- loopx/capabilities/periodic_report/triggers.py +452 -0
- loopx/capabilities/pr_review_queue/__init__.py +17 -0
- loopx/capabilities/pr_review_queue/core.py +506 -0
- loopx/capabilities/pr_review_queue/review_contract.py +506 -0
- loopx/capabilities/registry.py +192 -0
- loopx/capabilities/reward_memory/__init__.py +75 -0
- loopx/capabilities/reward_memory/application.py +819 -0
- loopx/capabilities/reward_memory/architecture.py +572 -0
- loopx/capabilities/reward_memory/candidate_review.py +511 -0
- loopx/capabilities/reward_memory/cli.py +469 -0
- loopx/capabilities/reward_memory/dogfood.py +574 -0
- loopx/capabilities/reward_memory/evaluation.py +296 -0
- loopx/capabilities/reward_memory/evaluation_fixtures.py +362 -0
- loopx/capabilities/reward_memory/experiment.py +567 -0
- loopx/capabilities/reward_memory/health.py +222 -0
- loopx/capabilities/reward_memory/ingestion.py +519 -0
- loopx/capabilities/reward_memory/registry.py +600 -0
- loopx/capabilities/reward_memory/runtime_hooks.py +312 -0
- loopx/capabilities/reward_memory/scoped_feedback.py +173 -0
- loopx/capabilities/semantic_preference/__init__.py +12 -0
- loopx/capabilities/semantic_preference/cli.py +189 -0
- loopx/capabilities/semantic_preference/contract.py +592 -0
- loopx/capabilities/semantic_preference/reward_memory.py +62 -0
- loopx/capabilities/value_connectors/__init__.py +1 -0
- loopx/capabilities/value_connectors/cli.py +401 -0
- loopx/capabilities/value_connectors/finance_extension_migration.py +108 -0
- loopx/capabilities/value_connectors/install_check.py +147 -0
- loopx/capabilities/value_connectors/planner.py +733 -0
- loopx/capabilities/value_connectors/source_map.py +446 -0
- loopx/claude_goal_baseline.py +138 -0
- loopx/claude_goal_mode/__init__.py +23 -0
- loopx/claude_goal_mode/hooks/goal_policy.py +212 -0
- loopx/claude_goal_mode/hooks/goal_state.py +139 -0
- loopx/claude_goal_mode/mcp/loopx_mcp.py +167 -0
- loopx/claude_goal_mode/scripts/connect.py +103 -0
- loopx/claude_goal_mode/scripts/goalmode_cmd.py +241 -0
- loopx/claude_goal_mode/scripts/install.py +328 -0
- loopx/claude_goal_mode/statusline/goal_status.py +97 -0
- loopx/cli.py +836 -0
- loopx/cli_commands/__init__.py +334 -0
- loopx/cli_commands/_host_thread.py +13 -0
- loopx/cli_commands/agentissue_runner_flow.py +447 -0
- loopx/cli_commands/agents_last_exam.py +160 -0
- loopx/cli_commands/agents_last_exam_baked_input.py +302 -0
- loopx/cli_commands/agents_last_exam_host_codex.py +374 -0
- loopx/cli_commands/agents_last_exam_launch_dry_run.py +372 -0
- loopx/cli_commands/agents_last_exam_local_plan.py +322 -0
- loopx/cli_commands/agents_last_exam_runner_source.py +352 -0
- loopx/cli_commands/agents_last_exam_task_material.py +335 -0
- loopx/cli_commands/agents_last_exam_validation_gate.py +236 -0
- loopx/cli_commands/benchmark_boundary.py +499 -0
- loopx/cli_commands/benchmark_dispatch.py +161 -0
- loopx/cli_commands/benchmark_release_outcome.py +123 -0
- loopx/cli_commands/benchmark_review_lifecycle.py +1275 -0
- loopx/cli_commands/benchmark_run_ledger.py +763 -0
- loopx/cli_commands/benchmark_run_ledger_case_analysis.py +249 -0
- loopx/cli_commands/benchmark_run_ledger_classification.py +45 -0
- loopx/cli_commands/benchmark_run_ledger_maintenance.py +486 -0
- loopx/cli_commands/benchmark_run_ledger_maintenance_registration.py +342 -0
- loopx/cli_commands/benchmark_run_ledger_maintenance_rendering.py +233 -0
- loopx/cli_commands/benchmark_run_ledger_parity.py +92 -0
- loopx/cli_commands/bootstrap_connect.py +238 -0
- loopx/cli_commands/canary.py +707 -0
- loopx/cli_commands/canary_release_qualification.py +79 -0
- loopx/cli_commands/capability.py +96 -0
- loopx/cli_commands/doctor.py +43 -0
- loopx/cli_commands/dreaming.py +143 -0
- loopx/cli_commands/edgebench.py +205 -0
- loopx/cli_commands/evidence_log.py +275 -0
- loopx/cli_commands/explore.py +989 -0
- loopx/cli_commands/explore_planning_commands.py +157 -0
- loopx/cli_commands/extension.py +271 -0
- loopx/cli_commands/first_run_report.py +73 -0
- loopx/cli_commands/goal_channel.py +656 -0
- loopx/cli_commands/handoff_mode.py +158 -0
- loopx/cli_commands/history.py +622 -0
- loopx/cli_commands/host_mode_plan.py +113 -0
- loopx/cli_commands/lark_inbox.py +431 -0
- loopx/cli_commands/lark_kanban.py +629 -0
- loopx/cli_commands/ml_experiment.py +321 -0
- loopx/cli_commands/multi_agent.py +211 -0
- loopx/cli_commands/opencode2_goal_worker.py +217 -0
- loopx/cli_commands/pr_review.py +167 -0
- loopx/cli_commands/presentation.py +218 -0
- loopx/cli_commands/preset.py +96 -0
- loopx/cli_commands/project.py +150 -0
- loopx/cli_commands/project_lifecycle.py +915 -0
- loopx/cli_commands/quota.py +859 -0
- loopx/cli_commands/quota_registration.py +241 -0
- loopx/cli_commands/quota_request.py +113 -0
- loopx/cli_commands/ready_score.py +110 -0
- loopx/cli_commands/registry_admin.py +975 -0
- loopx/cli_commands/registry_admin_configure.py +344 -0
- loopx/cli_commands/registry_admin_peer.py +84 -0
- loopx/cli_commands/registry_authority.py +218 -0
- loopx/cli_commands/review_batch.py +146 -0
- loopx/cli_commands/slash_commands.py +145 -0
- loopx/cli_commands/start_goal.py +251 -0
- loopx/cli_commands/starter.py +175 -0
- loopx/cli_commands/starter_bootstrap.py +179 -0
- loopx/cli_commands/starter_bootstrap_registration.py +198 -0
- loopx/cli_commands/starter_runtime_idle.py +107 -0
- loopx/cli_commands/starter_scheduler.py +207 -0
- loopx/cli_commands/starter_session_runtime.py +152 -0
- loopx/cli_commands/starter_visible_common.py +54 -0
- loopx/cli_commands/starter_visible_driver.py +161 -0
- loopx/cli_commands/starter_visible_pilot.py +278 -0
- loopx/cli_commands/status.py +867 -0
- loopx/cli_commands/status_registration.py +239 -0
- loopx/cli_commands/summary_all.py +222 -0
- loopx/cli_commands/support_control.py +809 -0
- loopx/cli_commands/support_control_registry.py +68 -0
- loopx/cli_commands/support_control_supervisor.py +289 -0
- loopx/cli_commands/task_lease.py +306 -0
- loopx/cli_commands/terminal_bench_adapter.py +717 -0
- loopx/cli_commands/terminal_bench_environment_result.py +1246 -0
- loopx/cli_commands/todo.py +940 -0
- loopx/cli_commands/todo_argument_validation.py +572 -0
- loopx/cli_commands/todo_event.py +114 -0
- loopx/cli_commands/turn.py +804 -0
- loopx/cli_commands/version.py +46 -0
- loopx/cli_commands/worker_bridge.py +659 -0
- loopx/cli_rollout.py +314 -0
- loopx/codex_cli_goal_tui.py +672 -0
- loopx/codex_cli_probe.py +1530 -0
- loopx/codex_cli_probe_markdown.py +935 -0
- loopx/codex_cli_runtime_probe.py +733 -0
- loopx/codex_cli_scheduler.py +564 -0
- loopx/codex_goal_baseline.py +620 -0
- loopx/configuration_catalog.py +617 -0
- loopx/configure_goal.py +1375 -0
- loopx/contract.py +996 -0
- loopx/control_plane/__init__.py +71 -0
- loopx/control_plane/agents/__init__.py +1 -0
- loopx/control_plane/agents/agent_lane_recommendation.py +516 -0
- loopx/control_plane/agents/agent_scope.py +1578 -0
- loopx/control_plane/agents/agent_scope_frontier.py +60 -0
- loopx/control_plane/agents/capability_gate.py +531 -0
- loopx/control_plane/agents/identity.py +140 -0
- loopx/control_plane/agents/legacy_migration.py +169 -0
- loopx/control_plane/agents/management_projection.py +658 -0
- loopx/control_plane/agents/material_frontier.py +608 -0
- loopx/control_plane/agents/material_handoff.py +156 -0
- loopx/control_plane/agents/multi_agent/__init__.py +1 -0
- loopx/control_plane/agents/multi_agent/codex_executable.py +207 -0
- loopx/control_plane/agents/multi_agent/collective_round_ledger.py +387 -0
- loopx/control_plane/agents/multi_agent/contract.py +474 -0
- loopx/control_plane/agents/multi_agent/recipe.py +110 -0
- loopx/control_plane/agents/multi_agent/role_successor.py +297 -0
- loopx/control_plane/agents/multi_agent/runtime_scripts.py +426 -0
- loopx/control_plane/agents/multi_agent/visible_launch_policy.py +149 -0
- loopx/control_plane/agents/multi_agent/visible_wake_scheduler.py +392 -0
- loopx/control_plane/agents/profile.py +216 -0
- loopx/control_plane/agents/runtime_model.py +73 -0
- loopx/control_plane/agents/subagent_activity.py +164 -0
- loopx/control_plane/agents/supervisor.py +544 -0
- loopx/control_plane/agents/supervisor_events.py +462 -0
- loopx/control_plane/agents/supervisor_inject.py +204 -0
- loopx/control_plane/agents/work_mode.py +56 -0
- loopx/control_plane/agents/workspace_guard.py +364 -0
- loopx/control_plane/effect_program.py +644 -0
- loopx/control_plane/goals/__init__.py +1 -0
- loopx/control_plane/goals/active_state_event_projection.py +103 -0
- loopx/control_plane/goals/active_state_metadata.py +47 -0
- loopx/control_plane/goals/active_state_sections.py +58 -0
- loopx/control_plane/goals/configure_goal_service.py +354 -0
- loopx/control_plane/goals/contract_health.py +132 -0
- loopx/control_plane/goals/dreaming.py +152 -0
- loopx/control_plane/goals/global_registry_health.py +199 -0
- loopx/control_plane/goals/global_registry_shadow.py +33 -0
- loopx/control_plane/goals/goal_channel.py +34 -0
- loopx/control_plane/goals/goal_channel_projection.py +560 -0
- loopx/control_plane/goals/goal_frontier/__init__.py +1917 -0
- loopx/control_plane/goals/goal_frontier/ack_policy.py +149 -0
- loopx/control_plane/goals/goal_frontier/outcome_continuity.py +437 -0
- loopx/control_plane/goals/goal_frontier/replan_rules.py +210 -0
- loopx/control_plane/goals/goal_frontier/semantic_history.py +314 -0
- loopx/control_plane/goals/goal_frontier/terminal.py +180 -0
- loopx/control_plane/goals/goal_vision.py +443 -0
- loopx/control_plane/goals/goal_vision_policy.py +36 -0
- loopx/control_plane/goals/goal_vision_state.py +62 -0
- loopx/control_plane/goals/goal_vision_wait.py +290 -0
- loopx/control_plane/goals/path_resolution.py +20 -0
- loopx/control_plane/goals/start_contract.py +206 -0
- loopx/control_plane/goals/vision_checkpoint.py +92 -0
- loopx/control_plane/handoff/__init__.py +1 -0
- loopx/control_plane/handoff/cross_runtime_impl_review.py +311 -0
- loopx/control_plane/handoff/delivery_contract.py +161 -0
- loopx/control_plane/handoff/handoff_runs.py +71 -0
- loopx/control_plane/handoff/project_handoff.py +155 -0
- loopx/control_plane/handoff/review_batch.py +463 -0
- loopx/control_plane/handoff/review_packet_context.py +216 -0
- loopx/control_plane/heartbeat/agent.py +173 -0
- loopx/control_plane/heartbeat/budget.py +66 -0
- loopx/control_plane/heartbeat/builder.py +501 -0
- loopx/control_plane/heartbeat/host.py +64 -0
- loopx/control_plane/heartbeat/rules.py +68 -0
- loopx/control_plane/heartbeat/task_body.py +759 -0
- loopx/control_plane/heartbeat/visible_goal.py +86 -0
- loopx/control_plane/projects/__init__.py +1 -0
- loopx/control_plane/projects/contract.py +25 -0
- loopx/control_plane/projects/registry.py +663 -0
- loopx/control_plane/quota/__init__.py +1 -0
- loopx/control_plane/quota/cli_projection.py +704 -0
- loopx/control_plane/quota/decision_summary.py +431 -0
- loopx/control_plane/quota/effect_program.py +152 -0
- loopx/control_plane/quota/error_codes.py +19 -0
- loopx/control_plane/quota/goal_boundary.py +464 -0
- loopx/control_plane/quota/heartbeat_receipt.py +277 -0
- loopx/control_plane/quota/heartbeat_recommendation.py +718 -0
- loopx/control_plane/quota/host_poll_receipts.py +162 -0
- loopx/control_plane/quota/live_decision.py +142 -0
- loopx/control_plane/quota/monitor_poll.py +786 -0
- loopx/control_plane/quota/policy_constants.py +40 -0
- loopx/control_plane/quota/projection_repair.py +262 -0
- loopx/control_plane/quota/recent_runs.py +210 -0
- loopx/control_plane/quota/scheduler_ack.py +490 -0
- loopx/control_plane/quota/selected_todo_projection.py +139 -0
- loopx/control_plane/quota/settlement.py +437 -0
- loopx/control_plane/quota/settlement_cli.py +246 -0
- loopx/control_plane/quota/settlement_validation.py +64 -0
- loopx/control_plane/quota/settlement_workspace_causality.py +180 -0
- loopx/control_plane/quota/should_run.py +249 -0
- loopx/control_plane/quota/should_run_packet.py +1165 -0
- loopx/control_plane/quota/should_run_prepare.py +675 -0
- loopx/control_plane/quota/slot_accounting.py +1123 -0
- loopx/control_plane/quota/spend_sources.py +11 -0
- loopx/control_plane/quota/stall_repair.py +397 -0
- loopx/control_plane/quota/states.py +29 -0
- loopx/control_plane/quota/task_orchestration.py +448 -0
- loopx/control_plane/quota/task_orchestration_admission.py +497 -0
- loopx/control_plane/quota/turn_envelope.py +889 -0
- loopx/control_plane/quota/usage_summary.py +140 -0
- loopx/control_plane/reward_memory.py +43 -0
- loopx/control_plane/runtime/__init__.py +2 -0
- loopx/control_plane/runtime/active_user_assisted_pilot.py +275 -0
- loopx/control_plane/runtime/agent_scoped_evidence_log.py +435 -0
- loopx/control_plane/runtime/decision_freshness.py +203 -0
- loopx/control_plane/runtime/event_ledger.py +197 -0
- loopx/control_plane/runtime/event_store_migration_bridge.py +196 -0
- loopx/control_plane/runtime/goal_project_route.py +70 -0
- loopx/control_plane/runtime/local_state_write_correctness.py +242 -0
- loopx/control_plane/runtime/promotion_readiness.py +152 -0
- loopx/control_plane/runtime/public_safety.py +120 -0
- loopx/control_plane/runtime/run_artifacts.py +78 -0
- loopx/control_plane/runtime/run_compaction.py +397 -0
- loopx/control_plane/runtime/run_context_retention.py +241 -0
- loopx/control_plane/runtime/run_history.py +132 -0
- loopx/control_plane/runtime/run_index_duplicates.py +205 -0
- loopx/control_plane/runtime/run_index_rebuild.py +263 -0
- loopx/control_plane/runtime/run_ingest_health.py +336 -0
- loopx/control_plane/runtime/runtime_projection_route.py +624 -0
- loopx/control_plane/runtime/runtime_projection_writer.py +98 -0
- loopx/control_plane/runtime/session_runtime.py +339 -0
- loopx/control_plane/runtime/shared_runtime_material_projection.py +332 -0
- loopx/control_plane/runtime/shared_runtime_refresh_projection.py +183 -0
- loopx/control_plane/runtime/stale_latest_run.py +90 -0
- loopx/control_plane/runtime/status_classifications.py +49 -0
- loopx/control_plane/runtime/status_projection_cache.py +235 -0
- loopx/control_plane/runtime/stride_observation.py +144 -0
- loopx/control_plane/runtime/time.py +39 -0
- loopx/control_plane/runtime/trajectory_hygiene.py +149 -0
- loopx/control_plane/runtime/validation_command.py +69 -0
- loopx/control_plane/scheduler/__init__.py +1 -0
- loopx/control_plane/scheduler/ack.py +329 -0
- loopx/control_plane/scheduler/arbitration.py +188 -0
- loopx/control_plane/scheduler/automation_liveness.py +183 -0
- loopx/control_plane/scheduler/execution_context.py +555 -0
- loopx/control_plane/scheduler/external_evidence_observation.py +428 -0
- loopx/control_plane/scheduler/monitor_display.py +143 -0
- loopx/control_plane/scheduler/monitor_poll_policy.py +161 -0
- loopx/control_plane/scheduler/monitor_poll_writeback.py +351 -0
- loopx/control_plane/scheduler/monitor_target.py +64 -0
- loopx/control_plane/scheduler/monitor_todo.py +146 -0
- loopx/control_plane/scheduler/monitor_wait.py +237 -0
- loopx/control_plane/scheduler/scheduler_hint.py +1284 -0
- loopx/control_plane/scheduler/state.py +354 -0
- loopx/control_plane/scheduler/state_transition_rules.py +179 -0
- loopx/control_plane/scheduler/time.py +10 -0
- loopx/control_plane/settlement_driver.py +293 -0
- loopx/control_plane/status/__init__.py +6 -0
- loopx/control_plane/status/active_state_projection.py +105 -0
- loopx/control_plane/status/agent_lane_projection.py +375 -0
- loopx/control_plane/status/attention_projection.py +74 -0
- loopx/control_plane/status/autonomous_replan_projection.py +103 -0
- loopx/control_plane/status/collection.py +140 -0
- loopx/control_plane/status/contract_projection.py +31 -0
- loopx/control_plane/status/dreaming_projection.py +52 -0
- loopx/control_plane/status/goal_attention_projection.py +157 -0
- loopx/control_plane/status/lifecycle_projection.py +110 -0
- loopx/control_plane/status/monitor_display_projection.py +69 -0
- loopx/control_plane/status/registry_health_projection.py +75 -0
- loopx/control_plane/status/run_projection.py +70 -0
- loopx/control_plane/status/runtime_summaries.py +161 -0
- loopx/control_plane/testing/__init__.py +1 -0
- loopx/control_plane/testing/actual_default_model_behavior_portfolio.py +1371 -0
- loopx/control_plane/testing/canary_harness.py +182 -0
- loopx/control_plane/testing/capability_monitor_repair_tool_behavior.py +674 -0
- loopx/control_plane/testing/cli_output_budget.py +807 -0
- loopx/control_plane/testing/cli_output_differential.py +250 -0
- loopx/control_plane/testing/cli_output_semantics.py +87 -0
- loopx/control_plane/testing/control_plane_composition_scenarios.py +225 -0
- loopx/control_plane/testing/decision_replay.py +268 -0
- loopx/control_plane/testing/doubao_model_behavior_actor.py +559 -0
- loopx/control_plane/testing/model_behavior_corpus.py +344 -0
- loopx/control_plane/testing/model_behavior_qualification.py +769 -0
- loopx/control_plane/testing/model_behavior_retained_cases.py +235 -0
- loopx/control_plane/testing/model_tool_behavior.py +536 -0
- loopx/control_plane/testing/onboarding_model_behavior_qualification.py +642 -0
- loopx/control_plane/testing/quota_fixtures.py +208 -0
- loopx/control_plane/testing/quota_should_run_parity.py +57 -0
- loopx/control_plane/testing/release_commit_qualification.py +671 -0
- loopx/control_plane/testing/replan_semantic_action_behavior.py +1302 -0
- loopx/control_plane/testing/scoped_gate_successor_tool_behavior.py +527 -0
- loopx/control_plane/testing/selected_todo_tool_behavior.py +1002 -0
- loopx/control_plane/testing/terminal_settlement_tool_behavior.py +656 -0
- loopx/control_plane/todos/__init__.py +1 -0
- loopx/control_plane/todos/active_state_editing.py +296 -0
- loopx/control_plane/todos/active_state_todo_parser.py +138 -0
- loopx/control_plane/todos/active_state_todos.py +175 -0
- loopx/control_plane/todos/addition.py +103 -0
- loopx/control_plane/todos/claim_visibility.py +253 -0
- loopx/control_plane/todos/completed_archive.py +139 -0
- loopx/control_plane/todos/completion_fence.py +49 -0
- loopx/control_plane/todos/completion_policy.py +153 -0
- loopx/control_plane/todos/completion_validation.py +248 -0
- loopx/control_plane/todos/completion_validation_accountability.py +27 -0
- loopx/control_plane/todos/completion_validation_projection.py +57 -0
- loopx/control_plane/todos/contract.py +1476 -0
- loopx/control_plane/todos/decision_scope.py +554 -0
- loopx/control_plane/todos/deferred_resume.py +546 -0
- loopx/control_plane/todos/durable_completion.py +201 -0
- loopx/control_plane/todos/event_writeback.py +484 -0
- loopx/control_plane/todos/frontier_deadline.py +132 -0
- loopx/control_plane/todos/handoff_gate.py +283 -0
- loopx/control_plane/todos/handoff_mode.py +444 -0
- loopx/control_plane/todos/handoff_note.py +202 -0
- loopx/control_plane/todos/line_update.py +361 -0
- loopx/control_plane/todos/list_projection.py +205 -0
- loopx/control_plane/todos/markdown.py +199 -0
- loopx/control_plane/todos/monitor_metadata.py +88 -0
- loopx/control_plane/todos/mutation_authority.py +299 -0
- loopx/control_plane/todos/projection.py +655 -0
- loopx/control_plane/todos/quota_summary.py +1138 -0
- loopx/control_plane/todos/route_continuation.py +267 -0
- loopx/control_plane/todos/succession_warning.py +174 -0
- loopx/control_plane/todos/summary_item.py +223 -0
- loopx/control_plane/todos/text.py +30 -0
- loopx/control_plane/todos/todo_index.py +226 -0
- loopx/control_plane/todos/todo_summary.py +1458 -0
- loopx/control_plane/todos/unblock_resume.py +326 -0
- loopx/control_plane/todos/user_gate.py +263 -0
- loopx/control_plane/todos/write_hint.py +63 -0
- loopx/control_plane/todos/write_policy.py +135 -0
- loopx/control_plane/turn_driver/__init__.py +85 -0
- loopx/control_plane/turn_driver/codex_cli.py +502 -0
- loopx/control_plane/turn_driver/driver.py +355 -0
- loopx/control_plane/turn_driver/executor.py +1468 -0
- loopx/control_plane/turn_driver/loop_controller.py +669 -0
- loopx/control_plane/turn_driver/settlement.py +318 -0
- loopx/control_plane/turn_driver/transaction.py +375 -0
- loopx/control_plane/work_items/__init__.py +1 -0
- loopx/control_plane/work_items/attention_fields.py +56 -0
- loopx/control_plane/work_items/attention_item.py +77 -0
- loopx/control_plane/work_items/attention_queue.py +322 -0
- loopx/control_plane/work_items/attention_routing.py +213 -0
- loopx/control_plane/work_items/autonomous_candidates.py +135 -0
- loopx/control_plane/work_items/autonomous_replan_ack.py +276 -0
- loopx/control_plane/work_items/autonomous_replan_obligation.py +786 -0
- loopx/control_plane/work_items/backlog_hygiene.py +59 -0
- loopx/control_plane/work_items/capability_monitor_fallback.py +221 -0
- loopx/control_plane/work_items/delivery_batch_scale.py +66 -0
- loopx/control_plane/work_items/delivery_outcome.py +152 -0
- loopx/control_plane/work_items/delivery_signals.py +113 -0
- loopx/control_plane/work_items/execution_obligation.py +235 -0
- loopx/control_plane/work_items/goal_route_hint.py +320 -0
- loopx/control_plane/work_items/interaction_contract.py +1540 -0
- loopx/control_plane/work_items/issue_meta_surface.py +159 -0
- loopx/control_plane/work_items/lifecycle.py +139 -0
- loopx/control_plane/work_items/operator_inbox.py +266 -0
- loopx/control_plane/work_items/outcome_followthrough.py +69 -0
- loopx/control_plane/work_items/primary_action.py +326 -0
- loopx/control_plane/work_items/progress_observation.py +630 -0
- loopx/control_plane/work_items/project_asset.py +675 -0
- loopx/control_plane/work_items/repair_delta.py +693 -0
- loopx/control_plane/work_items/runtime_capability_reentry.py +168 -0
- loopx/control_plane/work_items/semantic_replan_writeback.py +177 -0
- loopx/control_plane/work_items/status_contract.py +49 -0
- loopx/control_plane/work_items/task_graph.py +1046 -0
- loopx/control_plane/work_items/task_lease.py +1254 -0
- loopx/control_plane/work_items/task_lease_settlement.py +422 -0
- loopx/control_plane/work_items/work_lane.py +510 -0
- loopx/control_plane/work_items/work_lane_context.py +161 -0
- loopx/demo.py +247 -0
- loopx/diagnose.py +633 -0
- loopx/doctor.py +1251 -0
- loopx/domain_packs/__init__.py +1 -0
- loopx/domain_packs/issue_fix.py +571 -0
- loopx/domain_packs/ml_experiment.py +854 -0
- loopx/domain_state.py +137 -0
- loopx/dreaming.py +706 -0
- loopx/entrypoint.py +16 -0
- loopx/event_sourced_state.py +981 -0
- loopx/execution_profile.py +286 -0
- loopx/experiments/__init__.py +1 -0
- loopx/experiments/planner_worker/__init__.py +1 -0
- loopx/experiments/planner_worker/contract.py +523 -0
- loopx/experiments/planner_worker/runtime.py +391 -0
- loopx/experiments/planner_worker/traex.py +461 -0
- loopx/explore_graph.py +11 -0
- loopx/extensions/__init__.py +1 -0
- loopx/extensions/bundled.py +28 -0
- loopx/extensions/execution_envelope.py +126 -0
- loopx/extensions/lark/__init__.py +11 -0
- loopx/extensions/lark/event_collector.py +478 -0
- loopx/extensions/lark/event_collector_runtime.py +506 -0
- loopx/extensions/lark/event_inbox.py +454 -0
- loopx/extensions/lark/extension.toml +88 -0
- loopx/extensions/lark/goal_channel.py +44 -0
- loopx/extensions/lark/goal_channel_contracts.py +388 -0
- loopx/extensions/lark/goal_channel_lifecycle.py +218 -0
- loopx/extensions/lark/goal_channel_runtime.py +792 -0
- loopx/extensions/lark/goal_channel_setup.py +805 -0
- loopx/extensions/lark/goal_channel_targets.py +215 -0
- loopx/extensions/lark/goal_channel_transport.py +281 -0
- loopx/extensions/lark/inbox_reactions.py +650 -0
- loopx/extensions/lark/inbox_reply.py +430 -0
- loopx/extensions/lark/presentation/__init__.py +11 -0
- loopx/extensions/lark/presentation/explore_results.py +2276 -0
- loopx/extensions/lark/presentation/explore_singleflight.py +127 -0
- loopx/extensions/lark/presentation/explore_source_guard.py +121 -0
- loopx/extensions/lark/presentation/explore_stage_document.py +703 -0
- loopx/extensions/lark/presentation/explore_visual_integrity.py +122 -0
- loopx/extensions/lark/presentation/explore_visual_readback.py +452 -0
- loopx/extensions/lark/presentation/explore_visual_styles.py +156 -0
- loopx/extensions/lark/presentation/issue_fix_surface.py +612 -0
- loopx/extensions/lark/presentation/kanban.py +2791 -0
- loopx/extensions/lark/presentation/message_card.py +112 -0
- loopx/extensions/lark/presentation/periodic_report.py +261 -0
- loopx/extensions/lark/presentation/projection_rows.py +600 -0
- loopx/extensions/lark/presentation/record_io.py +95 -0
- loopx/extensions/lark/presentation/sync_receipt.py +145 -0
- loopx/extensions/lark/private_json.py +40 -0
- loopx/extensions/lark/provider.py +86 -0
- loopx/extensions/lark/reviewer_notification.py +604 -0
- loopx/extensions/manifest.py +385 -0
- loopx/extensions/openviking_periodic_report/__init__.py +17 -0
- loopx/extensions/openviking_periodic_report/activation.py +173 -0
- loopx/extensions/openviking_periodic_report/extension.toml +17 -0
- loopx/extensions/openviking_periodic_report/provider.py +355 -0
- loopx/extensions/openviking_periodic_report/sink.py +117 -0
- loopx/extensions/openviking_semantic_preference/__init__.py +5 -0
- loopx/extensions/openviking_semantic_preference/extension.toml +16 -0
- loopx/extensions/openviking_semantic_preference/history_export.py +484 -0
- loopx/extensions/openviking_semantic_preference/project_peer.py +68 -0
- loopx/extensions/openviking_semantic_preference/provider.py +312 -0
- loopx/extensions/presentation.py +979 -0
- loopx/extensions/process_runtime.py +204 -0
- loopx/extensions/readiness.py +168 -0
- loopx/extensions/runtime.py +931 -0
- loopx/extensions/scaffold.py +335 -0
- loopx/feedback.py +581 -0
- loopx/file_lock.py +382 -0
- loopx/global_registry.py +842 -0
- loopx/global_risks.py +970 -0
- loopx/global_todos.py +568 -0
- loopx/handoff_budget.py +28 -0
- loopx/heartbeat_prequota.py +80 -0
- loopx/heartbeat_prompt.py +159 -0
- loopx/help_surface.py +516 -0
- loopx/history.py +1507 -0
- loopx/host_loop_activation.py +1311 -0
- loopx/host_mode_planner.py +991 -0
- loopx/install_contract.py +1 -0
- loopx/interface_budget.py +196 -0
- loopx/long_task_cadence.py +208 -0
- loopx/materials.py +185 -0
- loopx/ml_experiment.py +3 -0
- loopx/onboarding.py +214 -0
- loopx/opencode2_goal_mode/README.md +81 -0
- loopx/opencode2_goal_mode/__init__.py +9 -0
- loopx/opencode2_goal_mode/opencode2-goal-worker.mjs +1018 -0
- loopx/opencode_goal_mode/README.md +99 -0
- loopx/opencode_goal_mode/__init__.py +13 -0
- loopx/opencode_goal_mode/goal-bridge-runtime.mjs +858 -0
- loopx/opencode_goal_mode/loopx-goal.js +8 -0
- loopx/operator_gate.py +420 -0
- loopx/orchestration.py +127 -0
- loopx/paths.py +59 -0
- loopx/pi_goal_mode/README.md +67 -0
- loopx/pi_goal_mode/__init__.py +13 -0
- loopx/pi_goal_mode/loopx-goal.ts +254 -0
- loopx/pi_goal_mode/pi-goal-loop-runtime.mjs +574 -0
- loopx/pr_review.py +1206 -0
- loopx/presentation/__init__.py +1 -0
- loopx/presentation/explore_views.py +1334 -0
- loopx/presentation/markdown.py +61 -0
- loopx/presentation/projection_source_reconcile.py +140 -0
- loopx/presentation/public_safety.py +42 -0
- loopx/presentation/renderers/__init__.py +17 -0
- loopx/presentation/renderers/goal_channel_html.py +269 -0
- loopx/presentation/renderers/periodic_report_html.py +786 -0
- loopx/presentation/renderers/periodic_report_markdown.py +184 -0
- loopx/presentation/renderers/quota_event_markdown.py +116 -0
- loopx/presentation/renderers/quota_markdown.py +1112 -0
- loopx/presentation/renderers/status_markdown.py +1570 -0
- loopx/presentation/renderers/trajectory_hygiene_markdown.py +39 -0
- loopx/presentation/renderers/turn_envelope_markdown.py +33 -0
- loopx/presentation/sinks/__init__.py +5 -0
- loopx/presentation/sinks/openviking_periodic_report.py +7 -0
- loopx/presentation/static_site.py +691 -0
- loopx/presets.py +369 -0
- loopx/project_alias.py +217 -0
- loopx/project_map.py +589 -0
- loopx/project_prompt.py +1153 -0
- loopx/project_skill_cli.py +125 -0
- loopx/project_skill_delivery.py +470 -0
- loopx/project_uninstall.py +462 -0
- loopx/promotion_gate.py +197 -0
- loopx/quota.py +1197 -0
- loopx/ready_score.py +413 -0
- loopx/registry.py +621 -0
- loopx/registry_writability.py +64 -0
- loopx/release_candidate.py +148 -0
- loopx/release_manifest.py +316 -0
- loopx/repository_identity.py +100 -0
- loopx/review_packet.py +1024 -0
- loopx/rollout_event_log.py +505 -0
- loopx/runtime.py +112 -0
- loopx/self_update.py +750 -0
- loopx/session_runtime.py +418 -0
- loopx/skill_install_readback.py +500 -0
- loopx/slash_command_install.py +1393 -0
- loopx/slash_commands.py +264 -0
- loopx/state_backup.py +573 -0
- loopx/state_migration.py +350 -0
- loopx/state_projection.py +809 -0
- loopx/state_refresh.py +1416 -0
- loopx/status.py +1383 -0
- loopx/status_server.py +935 -0
- loopx/summary_all.py +725 -0
- loopx/terminal_bench_agent.py +2056 -0
- loopx/thread_agent_binding.py +408 -0
- loopx/todo_followups.py +168 -0
- loopx/todo_suggestion_prompt.py +204 -0
- loopx/todos.py +2229 -0
- loopx/turn_identity.py +17 -0
- loopx/upgrade.py +1083 -0
- loopx/visible_governance.py +667 -0
- loopx/visible_multi_agent_launcher.py +1253 -0
- loopx/visible_multi_agent_tmux.py +429 -0
- loopx/worker_bridge.py +1574 -0
- loopx-0.4.8.dist-info/METADATA +708 -0
- loopx-0.4.8.dist-info/RECORD +811 -0
- loopx-0.4.8.dist-info/WHEEL +5 -0
- loopx-0.4.8.dist-info/entry_points.txt +5 -0
- loopx-0.4.8.dist-info/licenses/LICENSE +202 -0
- loopx-0.4.8.dist-info/licenses/LICENSE-MIT +21 -0
- loopx-0.4.8.dist-info/licenses/NOTICE +6 -0
- loopx-0.4.8.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,804 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
from collections.abc import Callable
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from ..capabilities.explore.composition_frontier import (
|
|
9
|
+
project_live_explore_composition_frontier,
|
|
10
|
+
)
|
|
11
|
+
from ..control_plane.quota.live_decision import build_live_quota_should_run_decision
|
|
12
|
+
from ..control_plane.quota.turn_envelope import build_turn_envelope
|
|
13
|
+
from ..control_plane.runtime.status_projection_cache import (
|
|
14
|
+
resolve_status_projection_cache_runtime_root,
|
|
15
|
+
)
|
|
16
|
+
from ..control_plane.todos.durable_completion import (
|
|
17
|
+
project_durable_completion_intent,
|
|
18
|
+
project_durable_completion_outcome,
|
|
19
|
+
read_persisted_todo_record,
|
|
20
|
+
)
|
|
21
|
+
from ..control_plane.scheduler.execution_context import (
|
|
22
|
+
scheduler_execution_context_for_turn,
|
|
23
|
+
)
|
|
24
|
+
from ..control_plane.turn_driver import (
|
|
25
|
+
LOOPX_TURN_EXECUTION_SCHEMA_VERSION,
|
|
26
|
+
LOOPX_TURN_JOURNAL_INSPECTION_SCHEMA_VERSION,
|
|
27
|
+
LOOPX_TURN_SESSION_BINDING_SCHEMA_VERSION,
|
|
28
|
+
build_loopx_turn_command_validator,
|
|
29
|
+
build_loopx_turn_plan,
|
|
30
|
+
codex_cli_session_binding,
|
|
31
|
+
inspect_loopx_turn_journal,
|
|
32
|
+
load_loopx_turn_plan_from_journal,
|
|
33
|
+
run_codex_cli_host,
|
|
34
|
+
run_loopx_turn_once,
|
|
35
|
+
selected_turn_todo,
|
|
36
|
+
)
|
|
37
|
+
from ..quota import spend_quota_slot
|
|
38
|
+
from ..state_refresh import refresh_state_run
|
|
39
|
+
from ..status import AUTONOMOUS_REPLAN_PERIODIC_LOOKBACK, collect_status
|
|
40
|
+
from ..todos import complete_goal_todo, resolve_todo_state_path, update_goal_todo
|
|
41
|
+
from .lark_inbox import build_lark_operator_inbox_urgency_projector
|
|
42
|
+
|
|
43
|
+
PrintPayload = Callable[
|
|
44
|
+
[dict[str, object], str, Callable[[dict[str, object]], str]],
|
|
45
|
+
None,
|
|
46
|
+
]
|
|
47
|
+
FormatSelector = Callable[..., str]
|
|
48
|
+
AddFormat = Callable[[argparse.ArgumentParser], None]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _default_public_scan_root() -> str:
|
|
52
|
+
return str(Path(__file__).resolve().parents[2])
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def register_turn_commands(
|
|
56
|
+
subparsers: argparse._SubParsersAction,
|
|
57
|
+
add_subcommand_format: AddFormat,
|
|
58
|
+
) -> None:
|
|
59
|
+
parser = subparsers.add_parser(
|
|
60
|
+
"turn",
|
|
61
|
+
help="Plan, run, or inspect one governed external-host Turn.",
|
|
62
|
+
)
|
|
63
|
+
command_sub = parser.add_subparsers(dest="turn_command", required=True)
|
|
64
|
+
inspect_journal = command_sub.add_parser(
|
|
65
|
+
"inspect-journal",
|
|
66
|
+
help="Inspect one canonical fenced Turn journal without executing effects.",
|
|
67
|
+
)
|
|
68
|
+
add_subcommand_format(inspect_journal)
|
|
69
|
+
inspect_journal.add_argument("--goal-id", required=True)
|
|
70
|
+
inspect_journal.add_argument("--agent-id", required=True)
|
|
71
|
+
inspect_journal.add_argument("--turn-key", required=True)
|
|
72
|
+
|
|
73
|
+
plan = command_sub.add_parser(
|
|
74
|
+
"plan",
|
|
75
|
+
help="Build one typed read-only host decision without launching or writing.",
|
|
76
|
+
)
|
|
77
|
+
add_subcommand_format(plan)
|
|
78
|
+
_add_turn_decision_arguments(plan, default_host="codex-cli")
|
|
79
|
+
plan.add_argument(
|
|
80
|
+
"--include-transaction-detail",
|
|
81
|
+
action="store_true",
|
|
82
|
+
help="Include session binding and transaction receipt planning detail.",
|
|
83
|
+
)
|
|
84
|
+
plan.add_argument(
|
|
85
|
+
"--scan-root",
|
|
86
|
+
default=_default_public_scan_root(),
|
|
87
|
+
help="Public files to scan for obvious private material.",
|
|
88
|
+
)
|
|
89
|
+
plan.add_argument(
|
|
90
|
+
"--scan-path",
|
|
91
|
+
action="append",
|
|
92
|
+
default=[],
|
|
93
|
+
help="Specific public file or directory to scan. Repeatable.",
|
|
94
|
+
)
|
|
95
|
+
plan.add_argument("--limit", type=int, default=5)
|
|
96
|
+
|
|
97
|
+
run_once = command_sub.add_parser(
|
|
98
|
+
"run-once",
|
|
99
|
+
help=(
|
|
100
|
+
"Run one explicit isolated generic host command and commit only a "
|
|
101
|
+
"validated public-safe result."
|
|
102
|
+
),
|
|
103
|
+
description=(
|
|
104
|
+
"Run one governed Turn: LoopX decides, a host adapter invokes an "
|
|
105
|
+
"agent CLI, an independent validator proves the postcondition, and "
|
|
106
|
+
"LoopX commits only a passing result."
|
|
107
|
+
),
|
|
108
|
+
epilog=(
|
|
109
|
+
"A Trae, Codex, or other conversational CLI normally needs a thin "
|
|
110
|
+
"adapter: read one typed request from stdin and emit one typed result "
|
|
111
|
+
"to stdout. The validation command receives that normalized result "
|
|
112
|
+
"on stdin and must independently check the real postcondition. Only "
|
|
113
|
+
"eligible interrupted sessions resume; terminal startup or missing-session "
|
|
114
|
+
"failures start a fresh host session on the next Turn."
|
|
115
|
+
),
|
|
116
|
+
)
|
|
117
|
+
add_subcommand_format(run_once)
|
|
118
|
+
_add_turn_decision_arguments(
|
|
119
|
+
run_once,
|
|
120
|
+
default_host="generic-cli",
|
|
121
|
+
host_choices=["codex-cli", "generic-cli"],
|
|
122
|
+
execution_mode_choices=["isolated-headless"],
|
|
123
|
+
default_execution_mode="isolated-headless",
|
|
124
|
+
)
|
|
125
|
+
run_once.add_argument("--project", required=True)
|
|
126
|
+
run_once.add_argument(
|
|
127
|
+
"--host-command-json",
|
|
128
|
+
"--host-adapter-command-json",
|
|
129
|
+
dest="host_command_json",
|
|
130
|
+
help=(
|
|
131
|
+
"JSON argv array for a typed generic host adapter. The adapter reads "
|
|
132
|
+
"the Turn request from stdin and emits one result JSON object; shell "
|
|
133
|
+
"parsing is never used."
|
|
134
|
+
),
|
|
135
|
+
)
|
|
136
|
+
run_once.add_argument(
|
|
137
|
+
"--validation-command-json",
|
|
138
|
+
help=(
|
|
139
|
+
"Trusted JSON argv array for independent task/postcondition validation. "
|
|
140
|
+
"The normalized host result is provided on stdin; shell parsing is never used."
|
|
141
|
+
),
|
|
142
|
+
)
|
|
143
|
+
run_once.add_argument(
|
|
144
|
+
"--validation-timeout-seconds",
|
|
145
|
+
type=float,
|
|
146
|
+
default=30.0,
|
|
147
|
+
help="Timeout for the independent validation command.",
|
|
148
|
+
)
|
|
149
|
+
run_once.add_argument(
|
|
150
|
+
"--validation-failure-kind",
|
|
151
|
+
choices=["repair_required", "replan_required"],
|
|
152
|
+
default="repair_required",
|
|
153
|
+
help="Typed recovery disposition when the independent validator rejects the result.",
|
|
154
|
+
)
|
|
155
|
+
run_once.add_argument(
|
|
156
|
+
"--codex-bin",
|
|
157
|
+
default="codex",
|
|
158
|
+
help="Codex CLI executable used by the built-in codex-cli host.",
|
|
159
|
+
)
|
|
160
|
+
run_once.add_argument("--codex-model")
|
|
161
|
+
run_once.add_argument(
|
|
162
|
+
"--codex-sandbox",
|
|
163
|
+
choices=["read-only", "workspace-write"],
|
|
164
|
+
default="read-only",
|
|
165
|
+
help="Sandbox for a new Codex CLI session; resume preserves its original session policy.",
|
|
166
|
+
)
|
|
167
|
+
run_once.add_argument("--timeout-seconds", type=float, default=120.0)
|
|
168
|
+
run_once.add_argument(
|
|
169
|
+
"--retry-failed-turn",
|
|
170
|
+
action="store_true",
|
|
171
|
+
help="Retry a failed transaction from its last side-effect-safe phase.",
|
|
172
|
+
)
|
|
173
|
+
run_once.add_argument(
|
|
174
|
+
"--resume-turn-key",
|
|
175
|
+
help="Resume the exact journaled transaction without recomputing its plan.",
|
|
176
|
+
)
|
|
177
|
+
run_once.add_argument(
|
|
178
|
+
"--no-global-sync",
|
|
179
|
+
action="store_true",
|
|
180
|
+
help="Keep disposable fixture writeback out of the shared global registry.",
|
|
181
|
+
)
|
|
182
|
+
run_once.add_argument(
|
|
183
|
+
"--execute",
|
|
184
|
+
action="store_true",
|
|
185
|
+
help="Invoke the host and commit validated writeback/quota effects.",
|
|
186
|
+
)
|
|
187
|
+
run_once.add_argument(
|
|
188
|
+
"--scan-root",
|
|
189
|
+
default=_default_public_scan_root(),
|
|
190
|
+
help="Public files to scan for obvious private material.",
|
|
191
|
+
)
|
|
192
|
+
run_once.add_argument("--scan-path", action="append", default=[])
|
|
193
|
+
run_once.add_argument("--limit", type=int, default=5)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def _add_turn_decision_arguments(
|
|
197
|
+
parser: argparse.ArgumentParser,
|
|
198
|
+
*,
|
|
199
|
+
default_host: str,
|
|
200
|
+
host_choices: list[str] | None = None,
|
|
201
|
+
execution_mode_choices: list[str] | None = None,
|
|
202
|
+
default_execution_mode: str = "interactive-visible",
|
|
203
|
+
) -> None:
|
|
204
|
+
parser.add_argument("--goal-id", required=True)
|
|
205
|
+
parser.add_argument("--agent-id", required=True)
|
|
206
|
+
parser.add_argument(
|
|
207
|
+
"--host",
|
|
208
|
+
choices=host_choices or ["codex-cli", "claude-code", "generic-cli"],
|
|
209
|
+
default=default_host,
|
|
210
|
+
)
|
|
211
|
+
parser.add_argument(
|
|
212
|
+
"--execution-mode",
|
|
213
|
+
choices=execution_mode_choices or ["interactive-visible", "isolated-headless"],
|
|
214
|
+
default=default_execution_mode,
|
|
215
|
+
)
|
|
216
|
+
parser.add_argument(
|
|
217
|
+
"--scheduler-owner",
|
|
218
|
+
choices=["host_automation", "agent_cli_loop", "outer_controller", "none"],
|
|
219
|
+
help=(
|
|
220
|
+
"Cadence owner; defaults to outer_controller for generic-cli and "
|
|
221
|
+
"agent_cli_loop otherwise."
|
|
222
|
+
),
|
|
223
|
+
)
|
|
224
|
+
parser.add_argument(
|
|
225
|
+
"--turn-instance-id",
|
|
226
|
+
help=(
|
|
227
|
+
"Caller-stable public-safe identity for one logical Turn. Reusing the "
|
|
228
|
+
"same id replays idempotently; use a new id for a new Turn with the "
|
|
229
|
+
"same semantic action."
|
|
230
|
+
),
|
|
231
|
+
)
|
|
232
|
+
parser.add_argument(
|
|
233
|
+
"--resume-goal-id",
|
|
234
|
+
help="Goal identity bound to an available opaque host session.",
|
|
235
|
+
)
|
|
236
|
+
parser.add_argument(
|
|
237
|
+
"--resume-agent-id",
|
|
238
|
+
help="Agent identity bound to an available opaque host session.",
|
|
239
|
+
)
|
|
240
|
+
parser.add_argument(
|
|
241
|
+
"--resume-todo-id",
|
|
242
|
+
help="Todo identity bound to an available opaque host session.",
|
|
243
|
+
)
|
|
244
|
+
parser.add_argument(
|
|
245
|
+
"--available-capability",
|
|
246
|
+
dest="available_capabilities",
|
|
247
|
+
action="append",
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def _render_loopx_turn_plan_markdown(payload: dict[str, object]) -> str:
|
|
252
|
+
if not payload.get("ok"):
|
|
253
|
+
error = payload.get("error") or "invalid TurnEnvelope contract"
|
|
254
|
+
return f"LoopX Turn plan failed: {error}"
|
|
255
|
+
host = payload.get("host") if isinstance(payload.get("host"), dict) else {}
|
|
256
|
+
route = payload.get("route") if isinstance(payload.get("route"), dict) else {}
|
|
257
|
+
return "\n".join(
|
|
258
|
+
[
|
|
259
|
+
"# LoopX Turn Plan",
|
|
260
|
+
f"- host: {host.get('kind')}",
|
|
261
|
+
f"- execution_mode: {host.get('execution_mode')}",
|
|
262
|
+
f"- route: {route.get('kind')}",
|
|
263
|
+
f"- would_invoke_host: {route.get('would_invoke_host')}",
|
|
264
|
+
"- side_effects: none",
|
|
265
|
+
]
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def _render_loopx_turn_execution_markdown(payload: dict[str, object]) -> str:
|
|
270
|
+
effects = payload.get("effects") if isinstance(payload.get("effects"), dict) else {}
|
|
271
|
+
receipt = payload.get("receipt") if isinstance(payload.get("receipt"), dict) else {}
|
|
272
|
+
validation = (
|
|
273
|
+
payload.get("validation")
|
|
274
|
+
if isinstance(payload.get("validation"), dict)
|
|
275
|
+
else {}
|
|
276
|
+
)
|
|
277
|
+
return "\n".join(
|
|
278
|
+
[
|
|
279
|
+
"# LoopX Turn Run Once",
|
|
280
|
+
f"- status: {payload.get('status')}",
|
|
281
|
+
f"- result_kind: {payload.get('result_kind')}",
|
|
282
|
+
f"- validation: {validation.get('status')}",
|
|
283
|
+
f"- recovery_kind: {validation.get('recovery_kind')}",
|
|
284
|
+
f"- next_phase: {receipt.get('next_phase')}",
|
|
285
|
+
f"- host_invoked: {effects.get('host_invoked')}",
|
|
286
|
+
f"- state_written: {effects.get('state_written')}",
|
|
287
|
+
f"- quota_spent: {effects.get('quota_spent')}",
|
|
288
|
+
]
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def _render_loopx_turn_journal_inspection_markdown(
|
|
293
|
+
payload: dict[str, object],
|
|
294
|
+
) -> str:
|
|
295
|
+
if not payload.get("ok"):
|
|
296
|
+
error = payload.get("error") or "Turn journal inspection failed"
|
|
297
|
+
return f"LoopX Turn journal inspection failed: {error}"
|
|
298
|
+
completed_phases = payload.get("completed_phases")
|
|
299
|
+
violations = payload.get("violations")
|
|
300
|
+
return "\n".join(
|
|
301
|
+
[
|
|
302
|
+
"# LoopX Turn Journal Inspection",
|
|
303
|
+
f"- decision: {payload.get('decision')}",
|
|
304
|
+
f"- journal_status: {payload.get('journal_status')}",
|
|
305
|
+
f"- replay_legal: {payload.get('replay_legal')}",
|
|
306
|
+
f"- goal_matches: {payload.get('goal_matches')}",
|
|
307
|
+
f"- owner_matches: {payload.get('owner_matches')}",
|
|
308
|
+
f"- turn_key_matches: {payload.get('turn_key_matches')}",
|
|
309
|
+
(
|
|
310
|
+
"- phases_form_ordered_prefix: "
|
|
311
|
+
f"{payload.get('phases_form_ordered_prefix')}"
|
|
312
|
+
),
|
|
313
|
+
"- completed_phases: "
|
|
314
|
+
+ (
|
|
315
|
+
", ".join(str(value) for value in completed_phases)
|
|
316
|
+
if isinstance(completed_phases, list) and completed_phases
|
|
317
|
+
else "none"
|
|
318
|
+
),
|
|
319
|
+
f"- tombstone_retained: {payload.get('tombstone_retained')}",
|
|
320
|
+
"- violations: "
|
|
321
|
+
+ (
|
|
322
|
+
", ".join(str(value) for value in violations)
|
|
323
|
+
if isinstance(violations, list) and violations
|
|
324
|
+
else "none"
|
|
325
|
+
),
|
|
326
|
+
"- effects: none",
|
|
327
|
+
]
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def handle_turn_command(
|
|
332
|
+
args: argparse.Namespace,
|
|
333
|
+
*,
|
|
334
|
+
registry_path: Path,
|
|
335
|
+
runtime_root_arg: str | None,
|
|
336
|
+
output_format: FormatSelector,
|
|
337
|
+
print_payload: PrintPayload,
|
|
338
|
+
) -> int | None:
|
|
339
|
+
if args.command != "turn":
|
|
340
|
+
return None
|
|
341
|
+
if args.turn_command == "inspect-journal":
|
|
342
|
+
try:
|
|
343
|
+
runtime_root = resolve_status_projection_cache_runtime_root(
|
|
344
|
+
registry_path=registry_path,
|
|
345
|
+
runtime_root_override=runtime_root_arg,
|
|
346
|
+
)
|
|
347
|
+
payload = inspect_loopx_turn_journal(
|
|
348
|
+
runtime_root,
|
|
349
|
+
goal_id=args.goal_id,
|
|
350
|
+
agent_id=args.agent_id,
|
|
351
|
+
turn_key=args.turn_key,
|
|
352
|
+
)
|
|
353
|
+
except Exception as exc: # noqa: BLE001 - typed CLI failure boundary
|
|
354
|
+
payload = {
|
|
355
|
+
"ok": False,
|
|
356
|
+
"schema_version": LOOPX_TURN_JOURNAL_INSPECTION_SCHEMA_VERSION,
|
|
357
|
+
"error": str(exc),
|
|
358
|
+
"effects": [],
|
|
359
|
+
}
|
|
360
|
+
print_payload(
|
|
361
|
+
payload,
|
|
362
|
+
output_format(args),
|
|
363
|
+
_render_loopx_turn_journal_inspection_markdown,
|
|
364
|
+
)
|
|
365
|
+
return 0 if payload.get("ok") else 1
|
|
366
|
+
try:
|
|
367
|
+
scan_roots = [Path(item).expanduser() for item in args.scan_path]
|
|
368
|
+
if not scan_roots:
|
|
369
|
+
scan_roots = [Path(args.scan_root).expanduser()]
|
|
370
|
+
runtime_root = resolve_status_projection_cache_runtime_root(
|
|
371
|
+
registry_path=registry_path,
|
|
372
|
+
runtime_root_override=runtime_root_arg,
|
|
373
|
+
)
|
|
374
|
+
operator_inbox_urgency_projector = (
|
|
375
|
+
build_lark_operator_inbox_urgency_projector(
|
|
376
|
+
runtime_root_arg=runtime_root,
|
|
377
|
+
)
|
|
378
|
+
)
|
|
379
|
+
status_payload = collect_status(
|
|
380
|
+
registry_path=registry_path,
|
|
381
|
+
runtime_root_override=runtime_root_arg,
|
|
382
|
+
scan_roots=scan_roots,
|
|
383
|
+
limit=max(max(0, args.limit), AUTONOMOUS_REPLAN_PERIODIC_LOOKBACK),
|
|
384
|
+
goal_id=args.goal_id,
|
|
385
|
+
available_capabilities=args.available_capabilities,
|
|
386
|
+
)
|
|
387
|
+
scheduler_context = scheduler_execution_context_for_turn(
|
|
388
|
+
host=args.host,
|
|
389
|
+
execution_mode=args.execution_mode,
|
|
390
|
+
scheduler_owner=args.scheduler_owner,
|
|
391
|
+
)
|
|
392
|
+
decision = build_live_quota_should_run_decision(
|
|
393
|
+
status_payload,
|
|
394
|
+
goal_id=args.goal_id,
|
|
395
|
+
agent_id=args.agent_id,
|
|
396
|
+
available_capabilities=args.available_capabilities,
|
|
397
|
+
include_scheduler_detail=False,
|
|
398
|
+
codex_app_current_rrule=None,
|
|
399
|
+
registry_path=registry_path,
|
|
400
|
+
runtime_root=runtime_root,
|
|
401
|
+
route_source="loopx_turn_plan",
|
|
402
|
+
scheduler_execution_context=scheduler_context,
|
|
403
|
+
operator_inbox_urgency_projector=operator_inbox_urgency_projector,
|
|
404
|
+
bounded_research_frontier_projector=(
|
|
405
|
+
project_live_explore_composition_frontier
|
|
406
|
+
),
|
|
407
|
+
)
|
|
408
|
+
resume_identity = {
|
|
409
|
+
"goal_id": args.resume_goal_id,
|
|
410
|
+
"agent_id": args.resume_agent_id,
|
|
411
|
+
"todo_id": args.resume_todo_id,
|
|
412
|
+
}
|
|
413
|
+
supplied_resume_fields = [
|
|
414
|
+
field for field, value in resume_identity.items() if value is not None
|
|
415
|
+
]
|
|
416
|
+
if supplied_resume_fields and len(supplied_resume_fields) != len(
|
|
417
|
+
resume_identity
|
|
418
|
+
):
|
|
419
|
+
raise ValueError(
|
|
420
|
+
"resume planning requires --resume-goal-id, --resume-agent-id, "
|
|
421
|
+
"and --resume-todo-id together"
|
|
422
|
+
)
|
|
423
|
+
session_binding = None
|
|
424
|
+
if supplied_resume_fields:
|
|
425
|
+
session_binding = {
|
|
426
|
+
"schema_version": LOOPX_TURN_SESSION_BINDING_SCHEMA_VERSION,
|
|
427
|
+
**resume_identity,
|
|
428
|
+
}
|
|
429
|
+
turn_envelope = build_turn_envelope(
|
|
430
|
+
decision,
|
|
431
|
+
scheduler_execution_context=scheduler_context,
|
|
432
|
+
)
|
|
433
|
+
if args.turn_command == "run-once" and args.host == "codex-cli" and not supplied_resume_fields:
|
|
434
|
+
session_binding = codex_cli_session_binding(runtime_root, turn_envelope)
|
|
435
|
+
payload = build_loopx_turn_plan(
|
|
436
|
+
turn_envelope,
|
|
437
|
+
host=args.host,
|
|
438
|
+
execution_mode=args.execution_mode,
|
|
439
|
+
scheduler_owner=args.scheduler_owner,
|
|
440
|
+
session_binding=session_binding,
|
|
441
|
+
turn_instance_id=args.turn_instance_id,
|
|
442
|
+
)
|
|
443
|
+
if args.turn_command == "plan":
|
|
444
|
+
if not args.include_transaction_detail:
|
|
445
|
+
payload.pop("session", None)
|
|
446
|
+
payload.pop("transaction", None)
|
|
447
|
+
boundary = payload.get("boundary")
|
|
448
|
+
if isinstance(boundary, dict):
|
|
449
|
+
boundary.pop("opaque_session_handle_omitted", None)
|
|
450
|
+
else:
|
|
451
|
+
# The typed settlement plan is used by validation and
|
|
452
|
+
# execution, but is not part of the agent-facing CLI contract.
|
|
453
|
+
transaction = payload.get("transaction")
|
|
454
|
+
if isinstance(transaction, dict):
|
|
455
|
+
transaction.pop("settlement_plan", None)
|
|
456
|
+
elif args.turn_command == "run-once":
|
|
457
|
+
if args.resume_turn_key:
|
|
458
|
+
if args.turn_instance_id:
|
|
459
|
+
raise ValueError(
|
|
460
|
+
"--resume-turn-key cannot be combined with --turn-instance-id"
|
|
461
|
+
)
|
|
462
|
+
if supplied_resume_fields:
|
|
463
|
+
raise ValueError(
|
|
464
|
+
"--resume-turn-key cannot be combined with host session identity flags"
|
|
465
|
+
)
|
|
466
|
+
payload = load_loopx_turn_plan_from_journal(
|
|
467
|
+
runtime_root,
|
|
468
|
+
goal_id=args.goal_id,
|
|
469
|
+
turn_key=args.resume_turn_key,
|
|
470
|
+
)
|
|
471
|
+
envelope = (
|
|
472
|
+
payload.get("turn_envelope")
|
|
473
|
+
if isinstance(payload.get("turn_envelope"), dict)
|
|
474
|
+
else {}
|
|
475
|
+
)
|
|
476
|
+
if envelope.get("agent_id") != args.agent_id:
|
|
477
|
+
raise ValueError(
|
|
478
|
+
"LoopX Turn resume journal belongs to another agent"
|
|
479
|
+
)
|
|
480
|
+
project = Path(args.project).expanduser().resolve()
|
|
481
|
+
planned_host = payload.get("host") if isinstance(payload.get("host"), dict) else {}
|
|
482
|
+
if planned_host.get("kind") != args.host:
|
|
483
|
+
raise ValueError("--host must match the journaled LoopX Turn plan")
|
|
484
|
+
if args.host == "generic-cli":
|
|
485
|
+
if not args.host_command_json:
|
|
486
|
+
raise ValueError(
|
|
487
|
+
"generic-cli requires --host-adapter-command-json "
|
|
488
|
+
"(alias --host-command-json)"
|
|
489
|
+
)
|
|
490
|
+
raw_argv = json.loads(args.host_command_json)
|
|
491
|
+
if not isinstance(raw_argv, list) or not all(
|
|
492
|
+
isinstance(item, str) for item in raw_argv
|
|
493
|
+
):
|
|
494
|
+
raise ValueError(
|
|
495
|
+
"--host-adapter-command-json must be a JSON string array"
|
|
496
|
+
)
|
|
497
|
+
else:
|
|
498
|
+
if args.host_command_json:
|
|
499
|
+
raise ValueError("codex-cli does not accept --host-command-json")
|
|
500
|
+
raw_argv = None
|
|
501
|
+
if args.validation_command_json:
|
|
502
|
+
raw_validation_argv = json.loads(args.validation_command_json)
|
|
503
|
+
if not isinstance(raw_validation_argv, list) or not all(
|
|
504
|
+
isinstance(item, str) for item in raw_validation_argv
|
|
505
|
+
):
|
|
506
|
+
raise ValueError(
|
|
507
|
+
"--validation-command-json must be a JSON string array"
|
|
508
|
+
)
|
|
509
|
+
task_validator = build_loopx_turn_command_validator(
|
|
510
|
+
raw_validation_argv,
|
|
511
|
+
project=project,
|
|
512
|
+
timeout_seconds=args.validation_timeout_seconds,
|
|
513
|
+
failure_recovery_kind=args.validation_failure_kind,
|
|
514
|
+
)
|
|
515
|
+
else:
|
|
516
|
+
task_validator = None
|
|
517
|
+
envelope = payload.get("turn_envelope") if isinstance(payload.get("turn_envelope"), dict) else {}
|
|
518
|
+
selected_todo = selected_turn_todo(envelope)
|
|
519
|
+
writeback_contract = (
|
|
520
|
+
envelope.get("writeback")
|
|
521
|
+
if isinstance(envelope.get("writeback"), dict)
|
|
522
|
+
else {}
|
|
523
|
+
)
|
|
524
|
+
delivery_workspace_path = (
|
|
525
|
+
project
|
|
526
|
+
if isinstance(
|
|
527
|
+
writeback_contract.get("delivery_workspace_causality"), dict
|
|
528
|
+
)
|
|
529
|
+
else None
|
|
530
|
+
)
|
|
531
|
+
|
|
532
|
+
def writeback(
|
|
533
|
+
result: dict[str, object],
|
|
534
|
+
*,
|
|
535
|
+
completion_todo_id: str | None = None,
|
|
536
|
+
completion_turn_key: str | None = None,
|
|
537
|
+
) -> dict[str, object]:
|
|
538
|
+
# The host workspace is execution context, not state authority.
|
|
539
|
+
state_project = None
|
|
540
|
+
result_kind = str(result.get("result_kind") or "")
|
|
541
|
+
if result_kind in {"repair_required", "replan_required"}:
|
|
542
|
+
todo_id = str(selected_todo.get("todo_id") or "")
|
|
543
|
+
if not todo_id:
|
|
544
|
+
raise ValueError(f"{result_kind} requires one selected todo for typed writeback")
|
|
545
|
+
update_goal_todo(
|
|
546
|
+
registry_path=registry_path,
|
|
547
|
+
goal_id=args.goal_id,
|
|
548
|
+
todo_id=todo_id,
|
|
549
|
+
role="agent",
|
|
550
|
+
note=str(result.get("summary") or result["classification"]),
|
|
551
|
+
evidence=f"LoopX Turn {result_kind}: {result['next_action']}",
|
|
552
|
+
agent_id=args.agent_id,
|
|
553
|
+
project=state_project,
|
|
554
|
+
dry_run=False,
|
|
555
|
+
)
|
|
556
|
+
return refresh_state_run(
|
|
557
|
+
registry_path=registry_path,
|
|
558
|
+
runtime_root_override=runtime_root_arg,
|
|
559
|
+
goal_id=args.goal_id,
|
|
560
|
+
project=state_project,
|
|
561
|
+
state_file=None,
|
|
562
|
+
classification=str(result["classification"]),
|
|
563
|
+
recommended_action=str(result["recommended_action"]),
|
|
564
|
+
next_action=str(result["next_action"]),
|
|
565
|
+
delivery_batch_scale=str(result["delivery_batch_scale"]),
|
|
566
|
+
delivery_outcome=str(result["delivery_outcome"]),
|
|
567
|
+
delivery_workspace_path=delivery_workspace_path,
|
|
568
|
+
agent_id=args.agent_id,
|
|
569
|
+
progress_scope="goal",
|
|
570
|
+
autonomous_replan_recorded=result_kind == "replan_required",
|
|
571
|
+
agent_vision_packet=(
|
|
572
|
+
dict(result["agent_vision"])
|
|
573
|
+
if isinstance(result.get("agent_vision"), dict)
|
|
574
|
+
else None
|
|
575
|
+
),
|
|
576
|
+
vision_unchanged_reason=(
|
|
577
|
+
str(result.get("vision_unchanged_reason") or "") or None
|
|
578
|
+
),
|
|
579
|
+
completion_todo_id=completion_todo_id,
|
|
580
|
+
completion_turn_key=completion_turn_key,
|
|
581
|
+
dry_run=False,
|
|
582
|
+
sync_global=not bool(args.no_global_sync),
|
|
583
|
+
)
|
|
584
|
+
|
|
585
|
+
def completion_intent(_result: dict[str, object]) -> dict[str, object]:
|
|
586
|
+
todo_id = str(selected_todo.get("todo_id") or "")
|
|
587
|
+
if not todo_id:
|
|
588
|
+
raise ValueError(
|
|
589
|
+
"validated_completion requires one selected todo for lifecycle writeback"
|
|
590
|
+
)
|
|
591
|
+
_state_project, state_file = resolve_todo_state_path(
|
|
592
|
+
registry_path=registry_path,
|
|
593
|
+
goal_id=args.goal_id,
|
|
594
|
+
project=None,
|
|
595
|
+
state_file=None,
|
|
596
|
+
)
|
|
597
|
+
durable_todo, existing_todo_ids = read_persisted_todo_record(
|
|
598
|
+
state_file,
|
|
599
|
+
todo_id=todo_id,
|
|
600
|
+
registry_path=registry_path,
|
|
601
|
+
goal_id=args.goal_id,
|
|
602
|
+
)
|
|
603
|
+
return project_durable_completion_intent(
|
|
604
|
+
todo=durable_todo,
|
|
605
|
+
expected_todo_id=todo_id,
|
|
606
|
+
existing_todo_ids=existing_todo_ids,
|
|
607
|
+
)
|
|
608
|
+
|
|
609
|
+
def todo_completion(result: dict[str, object]) -> dict[str, object]:
|
|
610
|
+
todo_id = str(selected_todo.get("todo_id") or "")
|
|
611
|
+
if not todo_id:
|
|
612
|
+
raise ValueError(
|
|
613
|
+
"validated_completion requires one selected todo for lifecycle writeback"
|
|
614
|
+
)
|
|
615
|
+
completion = complete_goal_todo(
|
|
616
|
+
registry_path=registry_path,
|
|
617
|
+
goal_id=args.goal_id,
|
|
618
|
+
todo_id=todo_id,
|
|
619
|
+
role="agent",
|
|
620
|
+
completion_turn_key=str(result["turn_key"]),
|
|
621
|
+
evidence=(
|
|
622
|
+
"LoopX Turn validated completion: "
|
|
623
|
+
+ str(result.get("summary") or result["classification"])
|
|
624
|
+
),
|
|
625
|
+
note=str(result["next_action"]),
|
|
626
|
+
agent_id=args.agent_id,
|
|
627
|
+
project=None,
|
|
628
|
+
dry_run=False,
|
|
629
|
+
)
|
|
630
|
+
# Project the continuation the Todo lifecycle durably recorded,
|
|
631
|
+
# never a host-normalized continuation. Contradictory or
|
|
632
|
+
# dangling durable state fails closed before any further
|
|
633
|
+
# writeback so the typed settlement sees the truthful outcome.
|
|
634
|
+
state_file = completion.get("state_file")
|
|
635
|
+
if not isinstance(state_file, str) or not state_file:
|
|
636
|
+
return {
|
|
637
|
+
"ok": False,
|
|
638
|
+
"appended": False,
|
|
639
|
+
"reason": (
|
|
640
|
+
"validated completion lifecycle did not report its "
|
|
641
|
+
"durable Todo state file"
|
|
642
|
+
),
|
|
643
|
+
}
|
|
644
|
+
try:
|
|
645
|
+
durable_todo, existing_todo_ids = read_persisted_todo_record(
|
|
646
|
+
Path(state_file),
|
|
647
|
+
todo_id=todo_id,
|
|
648
|
+
registry_path=registry_path,
|
|
649
|
+
goal_id=args.goal_id,
|
|
650
|
+
)
|
|
651
|
+
completion_outcome = project_durable_completion_outcome(
|
|
652
|
+
todo=durable_todo,
|
|
653
|
+
expected_todo_id=todo_id,
|
|
654
|
+
existing_todo_ids=existing_todo_ids,
|
|
655
|
+
)
|
|
656
|
+
except ValueError as exc:
|
|
657
|
+
return {
|
|
658
|
+
"ok": False,
|
|
659
|
+
"appended": False,
|
|
660
|
+
"reason": f"durable completion projection failed: {exc}",
|
|
661
|
+
}
|
|
662
|
+
return {
|
|
663
|
+
"ok": bool(completion.get("ok")),
|
|
664
|
+
# A completed Todo is idempotent under Turn replay: after an
|
|
665
|
+
# interrupted journal write, the retry may observe it done.
|
|
666
|
+
"appended": bool(completion.get("completed")) and bool(
|
|
667
|
+
completion.get("changed")
|
|
668
|
+
or completion.get("idempotent_replay")
|
|
669
|
+
),
|
|
670
|
+
"completion": completion_outcome,
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
def completion_writeback(result: dict[str, object]) -> dict[str, object]:
|
|
674
|
+
completion = todo_completion(result)
|
|
675
|
+
if not completion.get("ok"):
|
|
676
|
+
return completion
|
|
677
|
+
todo_id = str(selected_todo.get("todo_id") or "")
|
|
678
|
+
refresh = writeback(
|
|
679
|
+
result,
|
|
680
|
+
completion_todo_id=todo_id,
|
|
681
|
+
completion_turn_key=str(result["turn_key"]),
|
|
682
|
+
)
|
|
683
|
+
return {
|
|
684
|
+
"ok": bool(refresh.get("ok")),
|
|
685
|
+
"appended": bool(completion.get("appended")) and bool(
|
|
686
|
+
refresh.get("appended")
|
|
687
|
+
),
|
|
688
|
+
"classification": refresh.get("classification"),
|
|
689
|
+
"completion": completion["completion"],
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
def current_status() -> dict[str, object]:
|
|
693
|
+
return collect_status(
|
|
694
|
+
registry_path=registry_path,
|
|
695
|
+
runtime_root_override=runtime_root_arg,
|
|
696
|
+
scan_roots=scan_roots,
|
|
697
|
+
limit=max(max(0, args.limit), AUTONOMOUS_REPLAN_PERIODIC_LOOKBACK),
|
|
698
|
+
goal_id=args.goal_id,
|
|
699
|
+
available_capabilities=args.available_capabilities,
|
|
700
|
+
)
|
|
701
|
+
|
|
702
|
+
def spend() -> dict[str, object]:
|
|
703
|
+
return spend_quota_slot(
|
|
704
|
+
current_status(),
|
|
705
|
+
goal_id=args.goal_id,
|
|
706
|
+
slots=1,
|
|
707
|
+
execute=True,
|
|
708
|
+
source="adapter",
|
|
709
|
+
agent_id=args.agent_id,
|
|
710
|
+
workspace_path=delivery_workspace_path,
|
|
711
|
+
available_capabilities=args.available_capabilities,
|
|
712
|
+
operator_inbox_urgency_projector=operator_inbox_urgency_projector,
|
|
713
|
+
)
|
|
714
|
+
|
|
715
|
+
def scheduler(_spend_payload: dict[str, object]) -> dict[str, object]:
|
|
716
|
+
turn_scheduler_context = (
|
|
717
|
+
payload.get("scheduler_execution_context")
|
|
718
|
+
if isinstance(payload.get("scheduler_execution_context"), dict)
|
|
719
|
+
else None
|
|
720
|
+
)
|
|
721
|
+
latest = build_live_quota_should_run_decision(
|
|
722
|
+
current_status(),
|
|
723
|
+
goal_id=args.goal_id,
|
|
724
|
+
agent_id=args.agent_id,
|
|
725
|
+
available_capabilities=args.available_capabilities,
|
|
726
|
+
include_scheduler_detail=False,
|
|
727
|
+
codex_app_current_rrule=None,
|
|
728
|
+
registry_path=registry_path,
|
|
729
|
+
runtime_root=runtime_root,
|
|
730
|
+
route_source="loopx_turn_run_once",
|
|
731
|
+
scheduler_execution_context=turn_scheduler_context,
|
|
732
|
+
operator_inbox_urgency_projector=operator_inbox_urgency_projector,
|
|
733
|
+
bounded_research_frontier_projector=(
|
|
734
|
+
project_live_explore_composition_frontier
|
|
735
|
+
),
|
|
736
|
+
)
|
|
737
|
+
hint = latest.get("scheduler_hint") if isinstance(latest.get("scheduler_hint"), dict) else {}
|
|
738
|
+
phase = hint.get("execution_phase")
|
|
739
|
+
return dict(phase) if isinstance(phase, dict) else {
|
|
740
|
+
"disposition": "contract_error",
|
|
741
|
+
"completed": False,
|
|
742
|
+
"acknowledged": False,
|
|
743
|
+
"apply_needed": False,
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
host_runner = None
|
|
747
|
+
if args.host == "codex-cli":
|
|
748
|
+
def run_built_in_host(request: dict[str, object]) -> dict[str, object]:
|
|
749
|
+
return run_codex_cli_host(
|
|
750
|
+
request,
|
|
751
|
+
runtime_root=runtime_root,
|
|
752
|
+
project=project,
|
|
753
|
+
codex_bin=args.codex_bin,
|
|
754
|
+
sandbox=args.codex_sandbox,
|
|
755
|
+
model=args.codex_model,
|
|
756
|
+
timeout_seconds=max(1.0, args.timeout_seconds - 5.0),
|
|
757
|
+
)
|
|
758
|
+
|
|
759
|
+
host_runner = run_built_in_host
|
|
760
|
+
|
|
761
|
+
payload = run_loopx_turn_once(
|
|
762
|
+
payload,
|
|
763
|
+
host_argv=raw_argv,
|
|
764
|
+
host_runner=host_runner,
|
|
765
|
+
project=project,
|
|
766
|
+
runtime_root=runtime_root,
|
|
767
|
+
goal_id=args.goal_id,
|
|
768
|
+
timeout_seconds=args.timeout_seconds,
|
|
769
|
+
execute=bool(args.execute),
|
|
770
|
+
retry_failed=bool(args.retry_failed_turn),
|
|
771
|
+
task_validator=task_validator,
|
|
772
|
+
writeback=writeback if args.execute else None,
|
|
773
|
+
completion_writeback=completion_writeback if args.execute else None,
|
|
774
|
+
completion_intent=completion_intent if args.execute else None,
|
|
775
|
+
terminal_closeout=todo_completion if args.execute else None,
|
|
776
|
+
spend=spend if args.execute else None,
|
|
777
|
+
scheduler=scheduler if args.execute else None,
|
|
778
|
+
)
|
|
779
|
+
else:
|
|
780
|
+
raise ValueError("turn requires the `plan` or `run-once` subcommand")
|
|
781
|
+
except Exception as exc: # noqa: BLE001 - CLI boundary renders typed JSON failure
|
|
782
|
+
payload = {
|
|
783
|
+
"ok": False,
|
|
784
|
+
"schema_version": (
|
|
785
|
+
LOOPX_TURN_EXECUTION_SCHEMA_VERSION
|
|
786
|
+
if args.turn_command == "run-once"
|
|
787
|
+
else "loopx_turn_plan_v0"
|
|
788
|
+
),
|
|
789
|
+
"mode": "run_once" if args.turn_command == "run-once" else "plan",
|
|
790
|
+
"error": str(exc),
|
|
791
|
+
"effects": {
|
|
792
|
+
"host_invoked": False,
|
|
793
|
+
"state_written": False,
|
|
794
|
+
"scheduler_acknowledged": False,
|
|
795
|
+
"quota_spent": False,
|
|
796
|
+
},
|
|
797
|
+
}
|
|
798
|
+
renderer = (
|
|
799
|
+
_render_loopx_turn_execution_markdown
|
|
800
|
+
if args.turn_command == "run-once"
|
|
801
|
+
else _render_loopx_turn_plan_markdown
|
|
802
|
+
)
|
|
803
|
+
print_payload(payload, output_format(args), renderer)
|
|
804
|
+
return 0 if payload.get("ok") else 1
|